aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--WORKSPACE12
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD2
-rw-r--r--src/main/protobuf/BUILD4
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD2
-rwxr-xr-xsrc/test/shell/integration/bazel_command_log_test.sh18
-rwxr-xr-xsrc/test/shell/testenv.sh2
-rw-r--r--third_party/googleapis/BUILD36
-rw-r--r--third_party/grpc/build_defs.bzl4
-rw-r--r--third_party/protobuf/3.4.0/.travis.yml91
-rw-r--r--third_party/protobuf/3.4.0/BUILD (renamed from third_party/protobuf/3.6.0/BUILD)265
-rw-r--r--third_party/protobuf/3.4.0/CHANGES.txt (renamed from third_party/protobuf/3.6.0/CHANGES.txt)198
-rw-r--r--third_party/protobuf/3.4.0/CONTRIBUTORS.txt (renamed from third_party/protobuf/3.6.0/CONTRIBUTORS.txt)0
-rw-r--r--third_party/protobuf/3.4.0/LICENSE (renamed from third_party/protobuf/3.6.0/LICENSE)12
-rw-r--r--third_party/protobuf/3.4.0/Makefile.am (renamed from third_party/protobuf/3.6.0/Makefile.am)277
-rw-r--r--third_party/protobuf/3.4.0/Protobuf.podspec (renamed from third_party/protobuf/3.6.0/Protobuf.podspec)2
-rw-r--r--third_party/protobuf/3.4.0/README.md78
-rw-r--r--third_party/protobuf/3.4.0/WORKSPACE (renamed from third_party/protobuf/3.6.0/WORKSPACE)15
-rw-r--r--third_party/protobuf/3.4.0/appveyor.bat (renamed from third_party/protobuf/3.6.0/appveyor.bat)4
-rw-r--r--third_party/protobuf/3.4.0/appveyor.yml (renamed from third_party/protobuf/3.6.0/appveyor.yml)15
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/autogen.sh (renamed from third_party/protobuf/3.6.0/autogen.sh)16
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/Makefile.am78
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/ProtoBench.java203
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/README.md28
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/benchmark_messages_proto2.proto143
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/benchmark_messages_proto3.proto (renamed from third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/benchmarks.proto (renamed from third_party/protobuf/3.6.0/benchmarks/benchmarks.proto)0
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/cpp_benchmark.cc (renamed from third_party/protobuf/3.6.0/benchmarks/cpp/cpp_benchmark.cc)40
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/generate_datasets.cc117
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/google_message1.dat (renamed from third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto2/dataset.google_message1_proto2.pb)bin289 -> 228 bytes
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/google_message2.dat (renamed from third_party/protobuf/3.6.0/benchmarks/datasets/google_message2/dataset.google_message2.pb)bin84625 -> 84570 bytes
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/google_size.proto (renamed from third_party/protobuf/3.6.0/benchmarks/google_size.proto)0
-rw-r--r--third_party/protobuf/3.4.0/benchmarks/readme.txt46
-rw-r--r--third_party/protobuf/3.4.0/cmake/CMakeLists.txt (renamed from third_party/protobuf/3.6.0/cmake/CMakeLists.txt)49
-rw-r--r--third_party/protobuf/3.4.0/cmake/README.md (renamed from third_party/protobuf/3.6.0/cmake/README.md)42
-rw-r--r--third_party/protobuf/3.4.0/cmake/examples.cmake (renamed from third_party/protobuf/3.6.0/cmake/examples.cmake)0
-rw-r--r--third_party/protobuf/3.4.0/cmake/extract_includes.bat.in (renamed from third_party/protobuf/3.6.0/cmake/extract_includes.bat.in)34
-rw-r--r--third_party/protobuf/3.4.0/cmake/install.cmake (renamed from third_party/protobuf/3.6.0/cmake/install.cmake)32
-rw-r--r--third_party/protobuf/3.4.0/cmake/libprotobuf-lite.cmake (renamed from third_party/protobuf/3.6.0/cmake/libprotobuf-lite.cmake)8
-rw-r--r--third_party/protobuf/3.4.0/cmake/libprotobuf.cmake (renamed from third_party/protobuf/3.6.0/cmake/libprotobuf.cmake)2
-rw-r--r--third_party/protobuf/3.4.0/cmake/libprotoc.cmake (renamed from third_party/protobuf/3.6.0/cmake/libprotoc.cmake)53
-rw-r--r--third_party/protobuf/3.4.0/cmake/protobuf-config-version.cmake.in (renamed from third_party/protobuf/3.6.0/cmake/protobuf-config-version.cmake.in)4
-rw-r--r--third_party/protobuf/3.4.0/cmake/protobuf-config.cmake.in (renamed from third_party/protobuf/3.6.0/cmake/protobuf-config.cmake.in)57
-rw-r--r--third_party/protobuf/3.4.0/cmake/protobuf-lite.pc.cmake (renamed from third_party/protobuf/3.6.0/cmake/protobuf-lite.pc.cmake)0
-rw-r--r--third_party/protobuf/3.4.0/cmake/protobuf-module.cmake.in (renamed from third_party/protobuf/3.6.0/cmake/protobuf-module.cmake.in)13
-rw-r--r--third_party/protobuf/3.4.0/cmake/protobuf-options.cmake (renamed from third_party/protobuf/3.6.0/cmake/protobuf-options.cmake)0
-rw-r--r--third_party/protobuf/3.4.0/cmake/protobuf.pc.cmake (renamed from third_party/protobuf/3.6.0/cmake/protobuf.pc.cmake)0
-rw-r--r--third_party/protobuf/3.4.0/cmake/protoc.cmake (renamed from third_party/protobuf/3.6.0/cmake/protoc.cmake)1
-rw-r--r--third_party/protobuf/3.4.0/cmake/tests.cmake (renamed from third_party/protobuf/3.6.0/cmake/tests.cmake)31
-rw-r--r--third_party/protobuf/3.4.0/com_google_protobuf_java.BUILD (renamed from third_party/protobuf/3.6.0/com_google_protobuf_java.BUILD)0
-rw-r--r--third_party/protobuf/3.4.0/composer.json (renamed from third_party/protobuf/3.6.0/composer.json)0
-rw-r--r--third_party/protobuf/3.4.0/configure.ac (renamed from third_party/protobuf/3.6.0/configure.ac)25
-rw-r--r--third_party/protobuf/3.4.0/conformance/ConformanceJava.java (renamed from third_party/protobuf/3.6.0/conformance/ConformanceJava.java)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/ConformanceJavaLite.java (renamed from third_party/protobuf/3.6.0/conformance/ConformanceJavaLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/Makefile.am (renamed from third_party/protobuf/3.6.0/conformance/Makefile.am)4
-rw-r--r--third_party/protobuf/3.4.0/conformance/README.md (renamed from third_party/protobuf/3.6.0/conformance/README.md)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/autoload.php (renamed from third_party/protobuf/3.6.0/conformance/autoload.php)2
-rw-r--r--third_party/protobuf/3.4.0/conformance/conformance.proto (renamed from third_party/protobuf/3.6.0/conformance/conformance.proto)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/conformance_cpp.cc (renamed from third_party/protobuf/3.6.0/conformance/conformance_cpp.cc)2
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/conformance/conformance_nodejs.js (renamed from third_party/protobuf/3.6.0/conformance/conformance_nodejs.js)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/conformance_objc.m (renamed from third_party/protobuf/3.6.0/conformance/conformance_objc.m)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/conformance/conformance_php.php (renamed from third_party/protobuf/3.6.0/conformance/conformance_php.php)41
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/conformance/conformance_python.py (renamed from third_party/protobuf/3.6.0/conformance/conformance_python.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/conformance/conformance_ruby.rb (renamed from third_party/protobuf/3.6.0/conformance/conformance_ruby.rb)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/conformance_test.cc (renamed from third_party/protobuf/3.6.0/conformance/conformance_test.cc)99
-rw-r--r--third_party/protobuf/3.4.0/conformance/conformance_test.h (renamed from third_party/protobuf/3.6.0/conformance/conformance_test.h)17
-rw-r--r--third_party/protobuf/3.4.0/conformance/conformance_test_runner.cc (renamed from third_party/protobuf/3.6.0/conformance/conformance_test_runner.cc)7
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_cpp.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_cpp.txt)1
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_csharp.txt7
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_java.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_java.txt)2
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_js.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_js.txt)6
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_objc.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_objc.txt)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_php.txt120
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_php_c.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_php_c.txt)15
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_php_zts_c.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_php_zts_c.txt)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_python-post26.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_python-post26.txt)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_python.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_python.txt)1
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_python_cpp.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_python_cpp.txt)1
-rw-r--r--third_party/protobuf/3.4.0/conformance/failure_list_ruby.txt (renamed from third_party/protobuf/3.6.0/conformance/failure_list_ruby.txt)4
-rw-r--r--third_party/protobuf/3.4.0/conformance/third_party/jsoncpp/json.h (renamed from third_party/protobuf/3.6.0/conformance/third_party/jsoncpp/json.h)0
-rw-r--r--third_party/protobuf/3.4.0/conformance/third_party/jsoncpp/jsoncpp.cpp (renamed from third_party/protobuf/3.6.0/conformance/third_party/jsoncpp/jsoncpp.cpp)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/conformance/update_failure_list.py (renamed from third_party/protobuf/3.6.0/conformance/update_failure_list.py)4
-rw-r--r--third_party/protobuf/3.4.0/csharp/.gitignore (renamed from third_party/protobuf/3.6.0/csharp/.gitignore)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/CHANGES.txt (renamed from third_party/protobuf/3.6.0/csharp/CHANGES.txt)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/Google.Protobuf.Tools.nuspec (renamed from third_party/protobuf/3.6.0/csharp/Google.Protobuf.Tools.nuspec)2
-rw-r--r--third_party/protobuf/3.4.0/csharp/README.md (renamed from third_party/protobuf/3.6.0/csharp/README.md)12
-rw-r--r--third_party/protobuf/3.4.0/csharp/build_packages.bat (renamed from third_party/protobuf/3.6.0/csharp/build_packages.bat)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/build_tools.sh (renamed from third_party/protobuf/3.6.0/csharp/build_tools.sh)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/buildall.sh (renamed from third_party/protobuf/3.6.0/csharp/buildall.sh)2
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs)12
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/test.sh (renamed from third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/test.sh)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/generate_protos.sh (renamed from third_party/protobuf/3.6.0/csharp/generate_protos.sh)30
-rw-r--r--third_party/protobuf/3.4.0/csharp/global.json5
-rw-r--r--third_party/protobuf/3.4.0/csharp/keys/Google.Protobuf.public.snk (renamed from third_party/protobuf/3.6.0/csharp/keys/Google.Protobuf.public.snk)bin160 -> 160 bytes
-rw-r--r--third_party/protobuf/3.4.0/csharp/keys/Google.Protobuf.snk (renamed from third_party/protobuf/3.6.0/csharp/keys/Google.Protobuf.snk)bin596 -> 596 bytes
-rw-r--r--third_party/protobuf/3.4.0/csharp/keys/README.md (renamed from third_party/protobuf/3.6.0/csharp/keys/README.md)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/protos/unittest_custom_options_proto3.proto (renamed from third_party/protobuf/3.6.0/csharp/protos/unittest_custom_options_proto3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/protos/unittest_issues.proto (renamed from third_party/protobuf/3.6.0/csharp/protos/unittest_issues.proto)16
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/AddressBook/AddPerson.cs (renamed from third_party/protobuf/3.6.0/csharp/src/AddressBook/AddPerson.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/AddressBook/AddressBook.csproj (renamed from third_party/protobuf/3.6.0/csharp/src/AddressBook/AddressBook.csproj)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/AddressBook/Addressbook.cs (renamed from third_party/protobuf/3.6.0/csharp/src/AddressBook/Addressbook.cs)112
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/AddressBook/ListPeople.cs (renamed from third_party/protobuf/3.6.0/csharp/src/AddressBook/ListPeople.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/AddressBook/Program.cs (renamed from third_party/protobuf/3.6.0/csharp/src/AddressBook/Program.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/AddressBook/SampleUsage.cs (renamed from third_party/protobuf/3.6.0/csharp/src/AddressBook/SampleUsage.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Conformance.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Conformance.cs)38
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Program.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Program.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.JsonDump/Program.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.JsonDump/Program.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/ByteStringTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/ByteStringTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs)97
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs)43
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs)13
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/EqualityTester.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/EqualityTester.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs)21
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj)8
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/IssuesTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/IssuesTest.cs)14
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs)6
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonParserTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonParserTest.cs)41
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs)16
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Program.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs)25
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs)34
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/SampleEnum.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleEnum.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/SampleMessages.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleMessages.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestCornerCases.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestCornerCases.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs)372
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs)115
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs)348
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs)40
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs)34
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs)565
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs)994
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs)151
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs)6
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs)11
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.sln (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.sln)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ByteArray.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ByteArray.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ByteString.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ByteString.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedInputStream.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedInputStream.cs)21
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedOutputStream.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedOutputStream.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/MapField.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/MapField.cs)22
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/RepeatedField.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/RepeatedField.cs)5
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/FieldCodec.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/FieldCodec.cs)4
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/FrameworkPortability.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/FrameworkPortability.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Google.Protobuf.csproj (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Google.Protobuf.csproj)4
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/IDeepCloneable.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/IDeepCloneable.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/IMessage.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/IMessage.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/InvalidJsonException.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/InvalidJsonException.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonFormatter.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonFormatter.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonParser.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonParser.cs)59
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonToken.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonToken.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonTokenizer.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonTokenizer.cs)30
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/LimitedInputStream.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/LimitedInputStream.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/MessageExtensions.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/MessageExtensions.cs)102
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/MessageParser.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/MessageParser.cs)94
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ProtoPreconditions.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ProtoPreconditions.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/Descriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/Descriptor.cs)910
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldType.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldType.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs)24
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs)2
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs107
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs)43
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs)56
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs)22
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs)22
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs)28
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs)22
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs)68
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs)30
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs)92
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs)158
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs)0
-rw-r--r--third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WireFormat.cs (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WireFormat.cs)0
-rw-r--r--third_party/protobuf/3.4.0/docs/third_party.md (renamed from third_party/protobuf/3.6.0/docs/third_party.md)13
-rw-r--r--third_party/protobuf/3.4.0/editors/README.txt (renamed from third_party/protobuf/3.6.0/editors/README.txt)0
-rw-r--r--third_party/protobuf/3.4.0/editors/proto.vim (renamed from third_party/protobuf/3.6.0/editors/proto.vim)0
-rw-r--r--third_party/protobuf/3.4.0/editors/protobuf-mode.el (renamed from third_party/protobuf/3.6.0/editors/protobuf-mode.el)0
-rw-r--r--third_party/protobuf/3.4.0/examples/AddPerson.java (renamed from third_party/protobuf/3.6.0/examples/AddPerson.java)0
-rw-r--r--third_party/protobuf/3.4.0/examples/CMakeLists.txt (renamed from third_party/protobuf/3.6.0/examples/CMakeLists.txt)0
-rw-r--r--third_party/protobuf/3.4.0/examples/ListPeople.java (renamed from third_party/protobuf/3.6.0/examples/ListPeople.java)3
-rw-r--r--third_party/protobuf/3.4.0/examples/Makefile (renamed from third_party/protobuf/3.6.0/examples/Makefile)8
-rw-r--r--third_party/protobuf/3.4.0/examples/README.txt61
-rw-r--r--third_party/protobuf/3.4.0/examples/add_person.cc (renamed from third_party/protobuf/3.6.0/examples/add_person.cc)9
-rw-r--r--third_party/protobuf/3.4.0/examples/add_person.go (renamed from third_party/protobuf/3.6.0/examples/add_person.go)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/examples/add_person.py (renamed from third_party/protobuf/3.6.0/examples/add_person.py)13
-rw-r--r--third_party/protobuf/3.4.0/examples/add_person_test.go (renamed from third_party/protobuf/3.6.0/examples/add_person_test.go)4
-rw-r--r--third_party/protobuf/3.4.0/examples/addressbook.proto (renamed from third_party/protobuf/3.6.0/examples/addressbook.proto)4
-rw-r--r--third_party/protobuf/3.4.0/examples/list_people.cc (renamed from third_party/protobuf/3.6.0/examples/list_people.cc)13
-rw-r--r--third_party/protobuf/3.4.0/examples/list_people.go (renamed from third_party/protobuf/3.6.0/examples/list_people.go)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/examples/list_people.py (renamed from third_party/protobuf/3.6.0/examples/list_people.py)19
-rw-r--r--third_party/protobuf/3.4.0/examples/list_people_test.go (renamed from third_party/protobuf/3.6.0/examples/list_people_test.go)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/generate_changelog.py (renamed from third_party/protobuf/3.6.0/generate_changelog.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/generate_descriptor_proto.sh (renamed from third_party/protobuf/3.6.0/generate_descriptor_proto.sh)4
-rw-r--r--third_party/protobuf/3.4.0/gmock.BUILD28
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/any.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/any.proto)21
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/api.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/api.proto)0
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/compiler/plugin.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.proto)0
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/descriptor.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor.proto)40
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/duration.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/duration.proto)0
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/empty.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/empty.proto)0
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/field_mask.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/field_mask.proto)6
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/source_context.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/source_context.proto)0
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/struct.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/struct.proto)0
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/timestamp.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/timestamp.proto)8
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/type.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/type.proto)0
-rw-r--r--third_party/protobuf/3.4.0/google/protobuf/wrappers.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wrappers.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/README.md (renamed from third_party/protobuf/3.6.0/java/README.md)81
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/README.md (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/README.md)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/deps/pom.xml (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/deps/pom.xml)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/pom.xml (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/pom.xml)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/pom.xml (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/pom.xml)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/pom.xml (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/pom.xml)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/test.sh (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/test.sh)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/pom.xml (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/pom.xml)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java (renamed from third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/generate-sources-build.xml (renamed from third_party/protobuf/3.6.0/java/core/generate-sources-build.xml)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/generate-test-sources-build.xml (renamed from third_party/protobuf/3.6.0/java/core/generate-test-sources-build.xml)2
-rw-r--r--third_party/protobuf/3.4.0/java/core/pom.xml (renamed from third_party/protobuf/3.6.0/java/core/pom.xml)2
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractMessage.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractMessage.java)17
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java)10
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractParser.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractParser.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BlockingService.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BlockingService.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java)16
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteOutput.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteOutput.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteString.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteString.java)10
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/CodedInputStream.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/CodedInputStream.java)965
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java)18
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Descriptors.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Descriptors.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java)16
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DynamicMessage.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DynamicMessage.java)18
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Extension.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Extension.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/FieldSet.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/FieldSet.java)5
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/FloatArrayList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/FloatArrayList.java)16
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java)283
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java)6
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/IntArrayList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/IntArrayList.java)16
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Internal.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Internal.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyField.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyField.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyStringList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyStringList.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LongArrayList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LongArrayList.java)16
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapEntry.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapEntry.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapEntryLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapEntryLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapField.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapField.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapFieldLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapFieldLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Message.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Message.java)2
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java)96
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageReflection.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageReflection.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MutabilityOracle.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MutabilityOracle.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/NioByteString.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/NioByteString.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Parser.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Parser.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtocolStringList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtocolStringList.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RopeByteString.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RopeByteString.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcCallback.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcCallback.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcChannel.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcChannel.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcController.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcController.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcUtil.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcUtil.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Service.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Service.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ServiceException.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ServiceException.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java)4
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormat.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormat.java)104
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java)27
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java)58
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Utf8.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Utf8.java)486
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/WireFormat.java (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/WireFormat.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java)12
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/AnyTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/AnyTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java)15
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ByteBufferWriterTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ByteBufferWriterTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java)43
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java)46
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java)20
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java)15
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/EnumTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/EnumTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java)30
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java)15
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java)79
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IntArrayListTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IntArrayListTest.java)15
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java)9
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteTest.java)1500
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java)15
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java)18
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapTest.java)18
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MessageTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MessageTest.java)8
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ParserTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ParserTest.java)102
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ServiceTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ServiceTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiersLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiersLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestUtil.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestUtil.java)6
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestUtilLite.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestUtilLite.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatTest.java)145
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java)268
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java)204
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/WireFormatTest.java (renamed from third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/WireFormatTest.java)91
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/any_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/any_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_extension.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_extension.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto)0
-rw-r--r--third_party/protobuf/3.4.0/java/lite/generate-sources-build.xml20
-rw-r--r--third_party/protobuf/3.4.0/java/lite/generate-test-sources-build.xml43
-rw-r--r--third_party/protobuf/3.4.0/java/lite/pom.xml185
-rw-r--r--third_party/protobuf/3.4.0/java/pom.xml (renamed from third_party/protobuf/3.6.0/java/pom.xml)9
-rw-r--r--third_party/protobuf/3.4.0/java/util/pom.xml (renamed from third_party/protobuf/3.6.0/java/util/pom.xml)2
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/Durations.java (renamed from third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/Durations.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java (renamed from third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java)6
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java (renamed from third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java (renamed from third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java)60
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/TimeUtil.java (renamed from third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/TimeUtil.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/Timestamps.java (renamed from third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/Timestamps.java)11
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java (renamed from third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java)8
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java (renamed from third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java (renamed from third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java)15
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java (renamed from third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java)0
-rw-r--r--third_party/protobuf/3.4.0/java/util/src/test/proto/com/google/protobuf/util/json_test.proto (renamed from third_party/protobuf/3.6.0/java/util/src/test/proto/com/google/protobuf/util/json_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/javanano/README.md401
-rw-r--r--third_party/protobuf/3.4.0/javanano/pom.xml244
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java683
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java1214
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/ExtendableMessageNano.java169
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/Extension.java706
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/FieldArray.java291
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/FieldData.java240
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/InternalNano.java547
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/InvalidProtocolBufferNanoException.java93
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MapFactories.java (renamed from third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleNaNs.cs)52
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MessageNano.java198
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java275
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/UnknownFieldData.java88
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/WireFormatNano.java124
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/NanoTest.java4471
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/map_test.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/structurally_valid_unittest.cc)68
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_accessors_nano.proto118
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_multiple_nano.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest10.m)20
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_nano.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest03.m)20
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_validity_nano.proto28
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_nano.proto37
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_packed_nano.proto29
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_repeated_nano.proto34
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_singular_nano.proto34
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_has_nano.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest25.m)56
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_import_nano.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/test_util.cc)25
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nameclash_nano.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest01.m)15
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nano.proto63
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_nano.proto195
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_recursive_nano.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest02.m)21
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_reference_types_nano.proto116
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_merge_nano.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest11.m)19
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_packables_nano.proto95
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_simple_nano.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest12.m)26
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_single_nano.proto (renamed from third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/deprecated_file.proto)10
-rw-r--r--third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_stringutf8_nano.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest07.m)17
-rw-r--r--third_party/protobuf/3.4.0/jenkins/README.md6
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/jenkins/build_and_run_docker.sh (renamed from third_party/protobuf/3.6.0/kokoro/linux/build_and_run_docker.sh)21
-rw-r--r--third_party/protobuf/3.4.0/jenkins/buildcmds/README.md6
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/jenkins/buildcmds/pull_request.sh (renamed from third_party/protobuf/3.6.0/kokoro/linux/64-bit/build.sh)13
-rwxr-xr-xthird_party/protobuf/3.4.0/jenkins/buildcmds/pull_request_32.sh16
-rw-r--r--third_party/protobuf/3.4.0/jenkins/docker/Dockerfile (renamed from third_party/protobuf/3.6.0/kokoro/linux/64-bit/Dockerfile)7
-rw-r--r--third_party/protobuf/3.4.0/jenkins/docker32/Dockerfile (renamed from third_party/protobuf/3.6.0/kokoro/linux/32-bit/Dockerfile)0
-rw-r--r--third_party/protobuf/3.4.0/jenkins/make_test_output.py (renamed from third_party/protobuf/3.6.0/kokoro/linux/make_test_output.py)11
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/jenkins/pull_request_in_docker.sh (renamed from third_party/protobuf/3.6.0/kokoro/linux/pull_request_in_docker.sh)11
-rw-r--r--third_party/protobuf/3.4.0/js/README.md (renamed from third_party/protobuf/3.6.0/js/README.md)2
-rw-r--r--third_party/protobuf/3.4.0/js/binary/arith.js (renamed from third_party/protobuf/3.6.0/js/binary/arith.js)2
-rw-r--r--third_party/protobuf/3.4.0/js/binary/arith_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/arith_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/binary/constants.js (renamed from third_party/protobuf/3.6.0/js/binary/constants.js)22
-rw-r--r--third_party/protobuf/3.4.0/js/binary/decoder.js (renamed from third_party/protobuf/3.6.0/js/binary/decoder.js)40
-rw-r--r--third_party/protobuf/3.4.0/js/binary/decoder_test.js (renamed from third_party/protobuf/3.6.0/js/binary/decoder_test.js)19
-rw-r--r--third_party/protobuf/3.4.0/js/binary/encoder.js (renamed from third_party/protobuf/3.6.0/js/binary/encoder.js)4
-rw-r--r--third_party/protobuf/3.4.0/js/binary/message_test.js (renamed from third_party/protobuf/3.6.0/js/binary/message_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/binary/proto_test.js (renamed from third_party/protobuf/3.6.0/js/binary/proto_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/binary/reader.js (renamed from third_party/protobuf/3.6.0/js/binary/reader.js)50
-rw-r--r--third_party/protobuf/3.4.0/js/binary/reader_test.js (renamed from third_party/protobuf/3.6.0/js/binary/reader_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/binary/utils.js (renamed from third_party/protobuf/3.6.0/js/binary/utils.js)13
-rw-r--r--third_party/protobuf/3.4.0/js/binary/utils_test.js (renamed from third_party/protobuf/3.6.0/js/binary/utils_test.js)3
-rw-r--r--third_party/protobuf/3.4.0/js/binary/writer.js (renamed from third_party/protobuf/3.6.0/js/binary/writer.js)112
-rw-r--r--third_party/protobuf/3.4.0/js/binary/writer_test.js (renamed from third_party/protobuf/3.6.0/js/binary/writer_test.js)12
-rw-r--r--third_party/protobuf/3.4.0/js/commonjs/export.js (renamed from third_party/protobuf/3.6.0/js/commonjs/export.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/commonjs/export_asserts.js (renamed from third_party/protobuf/3.6.0/js/commonjs/export_asserts.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/commonjs/export_testdeps.js (renamed from third_party/protobuf/3.6.0/js/commonjs/export_testdeps.js)1
-rw-r--r--third_party/protobuf/3.4.0/js/commonjs/import_test.js (renamed from third_party/protobuf/3.6.0/js/commonjs/import_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/commonjs/jasmine.json (renamed from third_party/protobuf/3.6.0/js/commonjs/jasmine.json)0
-rw-r--r--third_party/protobuf/3.4.0/js/commonjs/rewrite_tests_for_commonjs.js (renamed from third_party/protobuf/3.6.0/js/commonjs/rewrite_tests_for_commonjs.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/commonjs/test6/test6.proto (renamed from third_party/protobuf/3.6.0/js/commonjs/test6/test6.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/commonjs/test7/test7.proto (renamed from third_party/protobuf/3.6.0/js/commonjs/test7/test7.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/arith_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/arith_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/decoder_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/decoder_test.js)19
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/proto_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/proto_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/reader_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/reader_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/utils_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/utils_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/writer_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/writer_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/export_asserts.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/export_asserts.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/import_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/import_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/jasmine.json (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/jasmine.json)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/data.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/data.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/debug_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/debug_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine1.json (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine1.json)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine2.json (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine2.json)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine3.json (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine3.json)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/message_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/message_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/proto3_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/proto3_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/proto3_test.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/proto3_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test.sh (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test.sh)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test2.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test2.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test3.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test4.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test4.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test5.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test5.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/testbinary.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/testbinary.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/testempty.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/testempty.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/arith_test.js (renamed from third_party/protobuf/3.6.0/js/binary/arith_test.js)109
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/decoder_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/decoder_test.js)19
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/proto_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/proto_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/reader_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/reader_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/utils_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/utils_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/writer_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/writer_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/data.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/data.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/debug_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/debug_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/maps_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/maps_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/message_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/message_test.js)7
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/proto3_test.js (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/proto3_test.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/proto3_test.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/proto3_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test2.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test2.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test3.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test4.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test4.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test5.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test5.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/testbinary.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/testbinary.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/testempty.proto (renamed from third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/testempty.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/data.proto (renamed from third_party/protobuf/3.6.0/js/data.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/debug.js (renamed from third_party/protobuf/3.6.0/js/debug.js)11
-rw-r--r--third_party/protobuf/3.4.0/js/debug_test.js (renamed from third_party/protobuf/3.6.0/js/debug_test.js)11
-rw-r--r--third_party/protobuf/3.4.0/js/gulpfile.js (renamed from third_party/protobuf/3.6.0/js/gulpfile.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/jasmine.json (renamed from third_party/protobuf/3.6.0/js/jasmine.json)0
-rw-r--r--third_party/protobuf/3.4.0/js/map.js (renamed from third_party/protobuf/3.6.0/js/map.js)31
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/js/maps_test.js (renamed from third_party/protobuf/3.6.0/js/maps_test.js)40
-rw-r--r--third_party/protobuf/3.4.0/js/message.js (renamed from third_party/protobuf/3.6.0/js/message.js)239
-rw-r--r--third_party/protobuf/3.4.0/js/message_test.js (renamed from third_party/protobuf/3.6.0/js/message_test.js)23
-rw-r--r--third_party/protobuf/3.4.0/js/node_loader.js (renamed from third_party/protobuf/3.6.0/js/node_loader.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/package.json (renamed from third_party/protobuf/3.6.0/js/package.json)2
-rw-r--r--third_party/protobuf/3.4.0/js/proto3_test.js (renamed from third_party/protobuf/3.6.0/js/proto3_test.js)48
-rw-r--r--third_party/protobuf/3.4.0/js/proto3_test.proto (renamed from third_party/protobuf/3.6.0/js/proto3_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/test.proto (renamed from third_party/protobuf/3.6.0/js/test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/test2.proto (renamed from third_party/protobuf/3.6.0/js/test2.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/test3.proto (renamed from third_party/protobuf/3.6.0/js/test3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/test4.proto (renamed from third_party/protobuf/3.6.0/js/test4.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/test5.proto (renamed from third_party/protobuf/3.6.0/js/test5.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/test8.proto (renamed from third_party/protobuf/3.6.0/js/test8.proto)0
-rw-r--r--third_party/protobuf/3.4.0/js/test_bootstrap.js (renamed from third_party/protobuf/3.6.0/js/test_bootstrap.js)0
-rw-r--r--third_party/protobuf/3.4.0/js/testbinary.proto (renamed from third_party/protobuf/3.6.0/js/testbinary.proto)32
-rw-r--r--third_party/protobuf/3.4.0/js/testempty.proto (renamed from third_party/protobuf/3.6.0/js/testempty.proto)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/README.md (renamed from third_party/protobuf/3.6.0/kokoro/README.md)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/linux/csharp/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/linux/csharp/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/csharp/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/linux/csharp/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/csharp/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/linux/csharp/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/presubmit.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/prepare_build_linux_rc9
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/cpp/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/cpp/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/cpp/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/cpp/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/cpp/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/cpp/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/javascript/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/javascript/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/javascript/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/javascript/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/javascript/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/javascript/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/jruby/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/jruby/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/jruby/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/jruby/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/jruby/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/jruby/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/prepare_build_macos_rc (renamed from third_party/protobuf/3.6.0/kokoro/macos/prepare_build_macos_rc)6
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/python/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/python/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/python/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/python/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/python/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/python/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/python_cpp/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/python_cpp/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/python_cpp/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/python_cpp/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/python_cpp/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/python_cpp/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/ruby21/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/ruby21/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/ruby21/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/ruby21/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/ruby21/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/ruby21/presubmit.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/kokoro/macos/ruby22/build.sh (renamed from third_party/protobuf/3.6.0/kokoro/macos/ruby22/build.sh)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/ruby22/continuous.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/ruby22/continuous.cfg)0
-rw-r--r--third_party/protobuf/3.4.0/kokoro/macos/ruby22/presubmit.cfg (renamed from third_party/protobuf/3.6.0/kokoro/macos/ruby22/presubmit.cfg)0
-rwxr-xr-xthird_party/protobuf/3.4.0/libprotobuf_java.jarbin0 -> 1191241 bytes
-rwxr-xr-xthird_party/protobuf/3.4.0/libprotobuf_java_util.jarbin0 -> 58519 bytes
-rw-r--r--third_party/protobuf/3.4.0/m4/ac_system_extensions.m4 (renamed from third_party/protobuf/3.6.0/m4/ac_system_extensions.m4)0
-rw-r--r--third_party/protobuf/3.4.0/m4/acx_check_suncc.m4 (renamed from third_party/protobuf/3.6.0/m4/acx_check_suncc.m4)0
-rw-r--r--third_party/protobuf/3.4.0/m4/acx_pthread.m4397
-rw-r--r--third_party/protobuf/3.4.0/m4/ax_cxx_compile_stdcxx.m4 (renamed from third_party/protobuf/3.6.0/m4/ax_cxx_compile_stdcxx.m4)0
-rw-r--r--third_party/protobuf/3.4.0/m4/ax_prog_cc_for_build.m4 (renamed from third_party/protobuf/3.6.0/m4/ax_prog_cc_for_build.m4)0
-rw-r--r--third_party/protobuf/3.4.0/m4/ax_prog_cxx_for_build.m4 (renamed from third_party/protobuf/3.6.0/m4/ax_prog_cxx_for_build.m4)0
-rw-r--r--third_party/protobuf/3.4.0/m4/stl_hash.m4 (renamed from third_party/protobuf/3.6.0/m4/stl_hash.m4)0
-rwxr-xr-xthird_party/protobuf/3.4.0/more_tests/Makefile41
-rw-r--r--third_party/protobuf/3.4.0/objectivec/.gitignore (renamed from third_party/protobuf/3.6.0/objectivec/.gitignore)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/objectivec/DevTools/check_version_stamps.sh (renamed from third_party/protobuf/3.6.0/objectivec/DevTools/check_version_stamps.sh)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/objectivec/DevTools/compile_testing_protos.sh (renamed from third_party/protobuf/3.6.0/objectivec/DevTools/compile_testing_protos.sh)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/objectivec/DevTools/full_mac_build.sh (renamed from third_party/protobuf/3.6.0/objectivec/DevTools/full_mac_build.sh)49
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/objectivec/DevTools/pddm.py (renamed from third_party/protobuf/3.6.0/objectivec/DevTools/pddm.py)24
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/objectivec/DevTools/pddm_tests.py (renamed from third_party/protobuf/3.6.0/objectivec/DevTools/pddm_tests.py)6
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBArray.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBArray.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBArray.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBArray.m)4
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBArray_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBArray_PackagePrivate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBBootstrap.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBBootstrap.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream.m)69
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream_PackagePrivate.h)2
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBCodedOutputStream.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBCodedOutputStream.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream.m)7
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBCodedOutputStream_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream_PackagePrivate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBDescriptor.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBDescriptor.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBDescriptor.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBDescriptor.m)16
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBDescriptor_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBDescriptor_PackagePrivate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBDictionary.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBDictionary.h)2800
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBDictionary.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBDictionary.m)1957
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBDictionary_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBDictionary_PackagePrivate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBExtensionInternals.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBExtensionInternals.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBExtensionInternals.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBExtensionInternals.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBExtensionRegistry.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBExtensionRegistry.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBExtensionRegistry.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBExtensionRegistry.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBMessage.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBMessage.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBMessage.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBMessage.m)83
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBMessage_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBMessage_PackagePrivate.h)18
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers_RuntimeSupport.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers_RuntimeSupport.h)2
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBRootObject.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBRootObject.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBRootObject.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBRootObject.m)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBRootObject_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBRootObject_PackagePrivate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBRuntimeTypes.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBRuntimeTypes.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUnknownField.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBUnknownField.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUnknownField.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBUnknownField.m)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet_PackagePrivate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUnknownField_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBUnknownField_PackagePrivate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUtilities.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBUtilities.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUtilities.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBUtilities.m)337
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBUtilities_PackagePrivate.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBUtilities_PackagePrivate.h)7
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBWellKnownTypes.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBWellKnownTypes.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBWellKnownTypes.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBWellKnownTypes.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBWireFormat.h (renamed from third_party/protobuf/3.6.0/objectivec/GPBWireFormat.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/GPBWireFormat.m (renamed from third_party/protobuf/3.6.0/objectivec/GPBWireFormat.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj)118
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme)2
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme)6
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj)266
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme)2
-rw-r--r--third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme (renamed from third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme)17
-rw-r--r--third_party/protobuf/3.4.0/objectivec/README.md (renamed from third_party/protobuf/3.6.0/objectivec/README.md)12
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/README.md (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/README.md)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/run_tests.sh (renamed from third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/run_tests.sh)2
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBARCUnittestProtos.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBARCUnittestProtos.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBArrayTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBArrayTests.m)158
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBCodedInputStreamTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCodedInputStreamTests.m)187
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBCodedOuputStreamTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCodedOuputStreamTests.m)12
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBConcurrencyTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBConcurrencyTests.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDescriptorTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDescriptorTests.m)117
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Bool.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Bool.m)80
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Int32.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Int32.m)105
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Int64.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Int64.m)105
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+String.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+String.m)95
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+UInt32.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+UInt32.m)105
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+UInt64.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+UInt64.m)105
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests.pddm (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests.pddm)35
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBExtensionRegistryTest.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBExtensionRegistryTest.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Merge.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Merge.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Runtime.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Runtime.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Serialization.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Serialization.m)22
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests.m)57
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBPerfTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBPerfTests.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBSwiftTests.swift (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBSwiftTests.swift)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBTestUtilities.h (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBTestUtilities.h)3
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBTestUtilities.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBTestUtilities.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBUnittestProtos.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBUnittestProtos.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBUnittestProtos2.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBUnittestProtos2.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBUnknownFieldSetTest.m255
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBUtilitiesTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBUtilitiesTests.m)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBWellKnownTypesTest.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBWellKnownTypesTest.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/GPBWireFormatTests.m (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBWireFormatTests.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/UnitTests-Bridging-Header.h (renamed from third_party/protobuf/3.6.0/objectivec/Tests/UnitTests-Bridging-Header.h)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/UnitTests-Info.plist (renamed from third_party/protobuf/3.6.0/objectivec/Tests/UnitTests-Info.plist)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/golden_message (renamed from third_party/protobuf/3.6.0/objectivec/Tests/golden_message)bin493 -> 493 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/golden_packed_fields_message (renamed from third_party/protobuf/3.6.0/objectivec/Tests/golden_packed_fields_message)bin493 -> 493 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/AppDelegate.m35
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json116
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.pngbin0 -> 8583 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.pngbin0 -> 17744 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.pngbin0 -> 8969 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.pngbin0 -> 18788 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.pngbin0 -> 7021 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.pngbin0 -> 13348 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.pngbin0 -> 11128 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.pngbin0 -> 21792 bytes
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json49
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Info.plist43
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/LaunchScreen.xib33
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/en.lproj/InfoPlist.strings2
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/text_format_map_unittest_data.txt (renamed from third_party/protobuf/3.6.0/objectivec/Tests/text_format_map_unittest_data.txt)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/text_format_unittest_data.txt (renamed from third_party/protobuf/3.6.0/objectivec/Tests/text_format_unittest_data.txt)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_cycle.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_cycle.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_deprecated.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_deprecated.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_deprecated_file.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_deprecated_file.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_a.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_a.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_b.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_b.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_c.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_c.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_d.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_d.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_e.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_e.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_f.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_f.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_g.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_g.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_objc.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_objc.proto)21
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_objc_startup.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_objc_startup.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_runtime_proto2.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_runtime_proto2.proto)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/Tests/unittest_runtime_proto3.proto (renamed from third_party/protobuf/3.6.0/objectivec/Tests/unittest_runtime_proto3.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/objectivec/generate_well_known_types.sh (renamed from third_party/protobuf/3.6.0/objectivec/generate_well_known_types.sh)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Any.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Any.pbobjc.h)29
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Any.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Any.pbobjc.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Api.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Api.pbobjc.h)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Api.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Api.pbobjc.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Duration.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Duration.pbobjc.h)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Duration.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Duration.pbobjc.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Empty.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Empty.pbobjc.h)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Empty.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Empty.pbobjc.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/FieldMask.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/FieldMask.pbobjc.h)14
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/FieldMask.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/FieldMask.pbobjc.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/SourceContext.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/SourceContext.pbobjc.h)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/SourceContext.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/SourceContext.pbobjc.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Struct.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Struct.pbobjc.h)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Struct.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Struct.pbobjc.m)7
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Timestamp.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Timestamp.pbobjc.h)16
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Timestamp.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Timestamp.pbobjc.m)0
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Type.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Type.pbobjc.h)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Type.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Type.pbobjc.m)17
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Wrappers.pbobjc.h (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Wrappers.pbobjc.h)8
-rw-r--r--third_party/protobuf/3.4.0/objectivec/google/protobuf/Wrappers.pbobjc.m (renamed from third_party/protobuf/3.6.0/objectivec/google/protobuf/Wrappers.pbobjc.m)0
-rw-r--r--third_party/protobuf/3.4.0/php/README.md (renamed from third_party/protobuf/3.6.0/php/README.md)2
-rw-r--r--third_party/protobuf/3.4.0/php/composer.json (renamed from third_party/protobuf/3.6.0/php/composer.json)0
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/array.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/array.c)0
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/config.m4 (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/config.m4)0
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/def.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/def.c)312
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/encode_decode.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/encode_decode.c)190
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/map.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/map.c)44
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/message.c344
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/package.xml (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/package.xml)104
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/protobuf.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/protobuf.c)170
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/protobuf.h (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/protobuf.h)581
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/storage.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/storage.c)54
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/type_check.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/type_check.c)44
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/upb.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/upb.c)3965
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/upb.h (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/upb.h)815
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/utf8.c (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/utf8.c)0
-rw-r--r--third_party/protobuf/3.4.0/php/ext/google/protobuf/utf8.h (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/utf8.h)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/php/generate_descriptor_protos.sh (renamed from third_party/protobuf/3.6.0/php/generate_descriptor_protos.sh)0
-rw-r--r--third_party/protobuf/3.4.0/php/phpunit.xml (renamed from third_party/protobuf/3.6.0/php/phpunit.xml)2
-rw-r--r--third_party/protobuf/3.4.0/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php (renamed from third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php)21
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Descriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Descriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/DescriptorPool.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/DescriptorPool.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/EnumDescriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumDescriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/EnumValueDescriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumValueDescriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/FieldDescriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/FieldDescriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/CodedInputStream.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/CodedInputStream.php)7
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/CodedOutputStream.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/CodedOutputStream.php)2
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/Descriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/Descriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorPool.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorPool.php)20
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto.php)32
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php)22
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php)23
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumDescriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php126
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumOptions.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumOptions.php)22
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php)15
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php)19
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptor.php)6
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php)42
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php)9
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php)9
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions.php)68
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions_CType.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions/CType.php)9
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php)9
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php)37
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php)13
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileOptions.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileOptions.php)200
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php)9
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBJsonWire.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBJsonWire.php)47
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBLabel.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBLabel.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBType.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBType.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBUtil.php343
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBWire.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBWire.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBWireType.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBWireType.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php)19
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php)31
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapEntry.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapEntry.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapField.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapField.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapFieldIter.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapFieldIter.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/Message.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/Message.php)646
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MessageOptions.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MessageOptions.php)58
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php)22
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodOptions.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodOptions.php)20
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php)9
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofDescriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofDescriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php)14
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofField.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofField.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofOptions.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofOptions.php)14
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RawInputStream.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RawInputStream.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RepeatedField.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RepeatedField.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php)15
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/ServiceOptions.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ServiceOptions.php)19
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php)58
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php)86
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php)25
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php)21
-rw-r--r--third_party/protobuf/3.4.0/php/src/Google/Protobuf/OneofDescriptor.php (renamed from third_party/protobuf/3.6.0/php/src/Google/Protobuf/OneofDescriptor.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/src/phpdoc.dist.xml (renamed from third_party/protobuf/3.6.0/php/src/phpdoc.dist.xml)0
-rw-r--r--third_party/protobuf/3.4.0/php/tests/array_test.php (renamed from third_party/protobuf/3.6.0/php/tests/array_test.php)12
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/php/tests/autoload.php (renamed from third_party/protobuf/3.6.0/php/tests/autoload.php)2
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/php/tests/compatibility_test.sh (renamed from third_party/protobuf/3.6.0/php/tests/compatibility_test.sh)1
-rw-r--r--third_party/protobuf/3.4.0/php/tests/descriptors_test.php (renamed from third_party/protobuf/3.6.0/php/tests/descriptors_test.php)2
-rw-r--r--third_party/protobuf/3.4.0/php/tests/encode_decode_test.php (renamed from third_party/protobuf/3.6.0/php/tests/encode_decode_test.php)78
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/php/tests/gdb_test.sh (renamed from third_party/protobuf/3.6.0/php/tests/gdb_test.sh)10
-rw-r--r--third_party/protobuf/3.4.0/php/tests/generated_class_test.php718
-rw-r--r--third_party/protobuf/3.4.0/php/tests/generated_phpdoc_test.php (renamed from third_party/protobuf/3.6.0/php/tests/generated_phpdoc_test.php)14
-rw-r--r--third_party/protobuf/3.4.0/php/tests/generated_service_test.php (renamed from third_party/protobuf/3.6.0/php/tests/generated_service_test.php)0
-rw-r--r--third_party/protobuf/3.4.0/php/tests/map_field_test.php (renamed from third_party/protobuf/3.6.0/php/tests/map_field_test.php)10
-rw-r--r--third_party/protobuf/3.4.0/php/tests/memory_leak_test.php106
-rw-r--r--third_party/protobuf/3.4.0/php/tests/php_implementation_test.php (renamed from third_party/protobuf/3.6.0/php/tests/php_implementation_test.php)75
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test.proto (renamed from third_party/protobuf/3.6.0/php/tests/proto/test.proto)9
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_descriptors.proto (renamed from third_party/protobuf/3.6.0/php/tests/proto/test_descriptors.proto)0
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_empty_php_namespace.proto8
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_import_descriptor_proto.proto (renamed from third_party/protobuf/3.6.0/php/tests/proto/test_import_descriptor_proto.proto)0
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_include.proto7
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_no_namespace.proto16
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_php_namespace.proto8
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_prefix.proto (renamed from third_party/protobuf/3.6.0/php/tests/proto/test_prefix.proto)8
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_service.proto (renamed from third_party/protobuf/3.6.0/php/tests/proto/test_service.proto)0
-rw-r--r--third_party/protobuf/3.4.0/php/tests/proto/test_service_namespace.proto (renamed from third_party/protobuf/3.6.0/php/tests/proto/test_service_namespace.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/php/tests/test.sh (renamed from third_party/protobuf/3.6.0/php/tests/test.sh)18
-rw-r--r--third_party/protobuf/3.4.0/php/tests/test_base.php (renamed from third_party/protobuf/3.6.0/php/tests/test_base.php)2
-rw-r--r--third_party/protobuf/3.4.0/php/tests/test_util.php (renamed from third_party/protobuf/3.6.0/php/tests/test_util.php)18
-rw-r--r--third_party/protobuf/3.4.0/php/tests/undefined_test.php (renamed from third_party/protobuf/3.6.0/php/tests/undefined_test.php)86
-rw-r--r--third_party/protobuf/3.4.0/php/tests/well_known_test.php17
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/post_process_dist.sh (renamed from third_party/protobuf/3.6.0/post_process_dist.sh)2
-rw-r--r--third_party/protobuf/3.4.0/protobuf-lite.pc.in (renamed from third_party/protobuf/3.6.0/protobuf-lite.pc.in)0
-rw-r--r--third_party/protobuf/3.4.0/protobuf.bzl (renamed from third_party/protobuf/3.6.0/protobuf.bzl)29
-rw-r--r--third_party/protobuf/3.4.0/protobuf.pc.in (renamed from third_party/protobuf/3.6.0/protobuf.pc.in)0
-rw-r--r--third_party/protobuf/3.4.0/protoc-artifacts/Dockerfile (renamed from third_party/protobuf/3.6.0/protoc-artifacts/Dockerfile)27
-rw-r--r--third_party/protobuf/3.4.0/protoc-artifacts/README.md (renamed from third_party/protobuf/3.6.0/protoc-artifacts/README.md)24
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/protoc-artifacts/build-protoc.sh (renamed from third_party/protobuf/3.6.0/protoc-artifacts/build-protoc.sh)21
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/protoc-artifacts/build-zip.sh (renamed from third_party/protobuf/3.6.0/protoc-artifacts/build-zip.sh)8
-rw-r--r--third_party/protobuf/3.4.0/protoc-artifacts/pom.xml (renamed from third_party/protobuf/3.6.0/protoc-artifacts/pom.xml)4
-rw-r--r--third_party/protobuf/3.4.0/python/MANIFEST.in (renamed from third_party/protobuf/3.6.0/python/MANIFEST.in)3
-rw-r--r--third_party/protobuf/3.4.0/python/README.md (renamed from third_party/protobuf/3.6.0/python/README.md)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/setup.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/setup.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/test.sh (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/test.sh)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/__init__.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/__init__.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/__init__.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/__init__.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message)bin509 -> 509 bytes
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message)bin142 -> 142 bytes
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py)5
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt)0
-rw-r--r--third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py (renamed from third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/__init__.py (renamed from third_party/protobuf/3.6.0/python/google/__init__.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/__init__.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/__init__.py)2
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/descriptor.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/descriptor.py)113
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/descriptor_database.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/descriptor_database.py)39
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/descriptor_pool.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/descriptor_pool.py)56
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/__init__.py (renamed from third_party/protobuf/3.6.0/benchmarks/__init__.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/_parameterized.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/_parameterized.py)50
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/any_test.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/any_test.proto)1
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/api_implementation.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/api_implementation.cc)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/api_implementation.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/api_implementation.py)42
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/containers.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/containers.py)4
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/decoder.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/decoder.py)2
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_database_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_database_test.py)55
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test.py)312
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test1.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test1.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test2.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test2.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_test.py)312
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/encoder.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/encoder.py)21
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/enum_type_wrapper.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/enum_type_wrapper.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/factory_test1.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/factory_test1.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/factory_test2.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/factory_test2.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/file_options_test.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/file_options_test.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/generator_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/generator_test.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/__init__.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/__init__.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/inner.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/inner.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/outer.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/outer.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/json_format_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/json_format_test.py)78
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/message_factory_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/message_factory_test.py)38
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/message_listener.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/message_listener.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/message_set_extensions.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/message_set_extensions.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/message_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/message_test.py)250
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/missing_enum_values.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/missing_enum_values.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/more_extensions.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/more_extensions.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/more_extensions_dynamic.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/more_extensions_dynamic.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/more_messages.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/more_messages.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/packed_field_test.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/packed_field_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/proto_builder_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/proto_builder_test.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/python_message.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/python_message.py)37
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/python_protobuf.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/python_protobuf.cc)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/reflection_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/reflection_test.py)65
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/service_reflection_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/service_reflection_test.py)4
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/symbol_database_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/symbol_database_test.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/test_bad_identifiers.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/test_bad_identifiers.proto)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/test_util.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/test_util.py)64
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/testing_refleaks.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/testing_refleaks.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/text_encoding_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/text_encoding_test.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/text_format_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/text_format_test.py)198
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/type_checkers.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/type_checkers.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/unknown_fields_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/unknown_fields_test.py)157
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/well_known_types.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/well_known_types.py)72
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/internal/well_known_types_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/well_known_types_test.py)203
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/wire_format.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/wire_format.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/internal/wire_format_test.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/internal/wire_format_test.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/json_format.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/json_format.py)38
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/message.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/message.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/message_factory.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/message_factory.py)13
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/proto_builder.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/proto_builder.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/README (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/README)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/__init__.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/__init__.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/cpp_message.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/cpp_message.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor.cc)93
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor.h)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_containers.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_containers.cc)530
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_containers.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_containers.h)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_database.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_database.cc)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_database.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_database.h)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_pool.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_pool.cc)122
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_pool.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_pool.h)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/extension_dict.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/extension_dict.cc)2
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/extension_dict.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/extension_dict.h)15
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/map_container.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/map_container.cc)48
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/map_container.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/map_container.h)17
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/message.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/message.cc)153
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/message.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/message.h)43
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_factory.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_factory.cc)8
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_factory.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_factory.h)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_module.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_module.cc)33
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/proto2_api_test.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/proto2_api_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/python.proto (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/python.proto)8
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_composite_container.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_composite_container.cc)129
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_composite_container.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_composite_container.h)21
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_scalar_container.cc (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_scalar_container.cc)178
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_scalar_container.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_scalar_container.h)19
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/safe_numerics.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/safe_numerics.h)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/pyext/scoped_pyobject_ptr.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/pyext/scoped_pyobject_ptr.h)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/python_protobuf.h (renamed from third_party/protobuf/3.6.0/python/google/protobuf/python_protobuf.h)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/reflection.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/reflection.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/service.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/service.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/service_reflection.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/service_reflection.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/symbol_database.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/symbol_database.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/google/protobuf/text_encoding.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/text_encoding.py)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/google/protobuf/text_format.py (renamed from third_party/protobuf/3.6.0/python/google/protobuf/text_format.py)105
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/mox.py (renamed from third_party/protobuf/3.6.0/python/mox.py)2
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/release.sh (renamed from third_party/protobuf/3.6.0/python/release.sh)16
-rw-r--r--third_party/protobuf/3.4.0/python/release/wheel/Dockerfile (renamed from third_party/protobuf/3.6.0/python/release/wheel/Dockerfile)0
-rw-r--r--third_party/protobuf/3.4.0/python/release/wheel/README.md (renamed from third_party/protobuf/3.6.0/python/release/wheel/README.md)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/release/wheel/build_wheel_manylinux.sh (renamed from third_party/protobuf/3.6.0/python/release/wheel/build_wheel_manylinux.sh)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/release/wheel/protobuf_optimized_pip.sh (renamed from third_party/protobuf/3.6.0/python/release/wheel/protobuf_optimized_pip.sh)12
-rw-r--r--third_party/protobuf/3.4.0/python/setup.cfg (renamed from third_party/protobuf/3.6.0/python/setup.cfg)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/setup.py (renamed from third_party/protobuf/3.6.0/python/setup.py)43
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/python/stubout.py (renamed from third_party/protobuf/3.6.0/python/stubout.py)0
-rw-r--r--third_party/protobuf/3.4.0/python/tox.ini (renamed from third_party/protobuf/3.6.0/python/tox.ini)2
-rw-r--r--third_party/protobuf/3.4.0/ruby/.gitignore (renamed from third_party/protobuf/3.6.0/ruby/.gitignore)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/Gemfile (renamed from third_party/protobuf/3.6.0/ruby/Gemfile)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/README.md (renamed from third_party/protobuf/3.6.0/ruby/README.md)4
-rw-r--r--third_party/protobuf/3.4.0/ruby/Rakefile (renamed from third_party/protobuf/3.6.0/ruby/Rakefile)23
-rw-r--r--third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/README.md (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/README.md)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/Rakefile (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/Rakefile)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/test.sh (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/test.sh)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/basic.rb (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/basic.rb)2
-rw-r--r--third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/generated_code.proto (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/generated_code.proto)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/stress.rb (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/stress.rb)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/test_import.proto (renamed from third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/test_import.proto)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/defs.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/defs.c)39
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/encode_decode.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/encode_decode.c)240
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/extconf.rb (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/extconf.rb)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/map.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/map.c)10
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/message.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/message.c)53
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/protobuf.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/protobuf.c)6
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/protobuf.h (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/protobuf.h)24
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/repeated_field.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/repeated_field.c)2
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/storage.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/storage.c)29
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/upb.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/upb.c)1824
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/upb.h (renamed from third_party/protobuf/3.6.0/php/ext/google/protobuf/upb.h)1428
-rw-r--r--third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/wrap_memcpy.c (renamed from third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/wrap_memcpy.c)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/google-protobuf.gemspec (renamed from third_party/protobuf/3.6.0/ruby/google-protobuf.gemspec)2
-rw-r--r--third_party/protobuf/3.4.0/ruby/lib/google/protobuf.rb (renamed from third_party/protobuf/3.6.0/ruby/lib/google/protobuf.rb)4
-rw-r--r--third_party/protobuf/3.4.0/ruby/lib/google/protobuf/message_exts.rb (renamed from third_party/protobuf/3.6.0/ruby/lib/google/protobuf/message_exts.rb)4
-rw-r--r--third_party/protobuf/3.4.0/ruby/lib/google/protobuf/repeated_field.rb (renamed from third_party/protobuf/3.6.0/ruby/lib/google/protobuf/repeated_field.rb)4
-rw-r--r--third_party/protobuf/3.4.0/ruby/lib/google/protobuf/well_known_types.rb (renamed from third_party/protobuf/3.6.0/ruby/lib/google/protobuf/well_known_types.rb)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/pom.xml (renamed from third_party/protobuf/3.6.0/ruby/pom.xml)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java)57
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/SentinelOuterClass.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/SentinelOuterClass.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/Utils.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/Utils.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/java/google/ProtobufJavaService.java (renamed from third_party/protobuf/3.6.0/ruby/src/main/java/google/ProtobufJavaService.java)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/src/main/sentinel.proto (renamed from third_party/protobuf/3.6.0/ruby/src/main/sentinel.proto)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/tests/basic.rb (renamed from third_party/protobuf/3.6.0/ruby/tests/basic.rb)78
-rw-r--r--third_party/protobuf/3.4.0/ruby/tests/generated_code.proto (renamed from third_party/protobuf/3.6.0/ruby/tests/generated_code.proto)13
-rw-r--r--third_party/protobuf/3.4.0/ruby/tests/generated_code_test.rb (renamed from third_party/protobuf/3.6.0/ruby/tests/generated_code_test.rb)2
-rw-r--r--third_party/protobuf/3.4.0/ruby/tests/repeated_field_test.rb (renamed from third_party/protobuf/3.6.0/ruby/tests/repeated_field_test.rb)15
-rw-r--r--third_party/protobuf/3.4.0/ruby/tests/stress.rb (renamed from third_party/protobuf/3.6.0/ruby/tests/stress.rb)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/tests/test_import.proto (renamed from third_party/protobuf/3.6.0/ruby/tests/test_import.proto)0
-rw-r--r--third_party/protobuf/3.4.0/ruby/tests/well_known_types_test.rb (renamed from third_party/protobuf/3.6.0/ruby/tests/well_known_types_test.rb)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/ruby/travis-test.sh (renamed from third_party/protobuf/3.6.0/ruby/travis-test.sh)1
-rw-r--r--third_party/protobuf/3.4.0/six.BUILD (renamed from third_party/protobuf/3.6.0/six.BUILD)0
-rw-r--r--third_party/protobuf/3.4.0/src/Makefile.am (renamed from third_party/protobuf/3.6.0/src/Makefile.am)137
-rw-r--r--third_party/protobuf/3.4.0/src/README.md212
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/any.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/any.cc)11
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/any.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/any.h)11
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/any.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/any.pb.cc)261
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/any.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/any.pb.h)102
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/any.proto149
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/any_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/any_test.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/any_test.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/any_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/api.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/api.pb.cc)1015
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/api.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/api.pb.h)290
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/api.proto210
-rwxr-xr-xthird_party/protobuf/3.4.0/src/google/protobuf/arena.cc357
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/arena.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/arena.h)637
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/arena_impl.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/arena_impl.h)209
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/arena_test_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/arena_test_util.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/arena_test_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/arena_test_util.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/arena_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/arena_unittest.cc)84
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/arenastring.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/arenastring.cc)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/src/google/protobuf/arenastring.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/arenastring.h)107
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/arenastring_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/arenastring_unittest.cc)31
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/code_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/code_generator.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/code_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/code_generator.h)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface.cc)108
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface.h)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface_unittest.cc)41
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc)79
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum.cc)40
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum.h)11
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum_field.cc)66
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum_field.h)9
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_extension.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_extension.cc)43
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_extension.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_extension.h)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_field.cc)46
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_field.h)53
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_file.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_file.cc)1152
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_file.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_file.h)44
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_generator.cc)79
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_generator.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_helpers.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_helpers.cc)293
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_helpers.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_helpers.h)168
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_map_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_map_field.cc)68
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_map_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_map_field.h)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message.cc)1964
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message.h)40
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message_field.cc1138
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_field.h)45
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_options.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_options.h)12
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc)7
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc)51
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.h)9
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_service.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_service.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_service.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_service.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_string_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_string_field.cc)520
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_string_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_string_field.h)17
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.inc)838
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_unittest.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/metadata_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/metadata_test.cc)114
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum_field.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum_field.h)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_field_base.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_field_base.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_field_base.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_field_base.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator.cc)6
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_helpers.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_helpers.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_helpers.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_helpers.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_map_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_map_field.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_map_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_map_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message.cc)131
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message_field.cc)10
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message_field.h)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_names.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_names.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_options.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_options.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc)24
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.h)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc)6
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc)26
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer.cc)24
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer_unittest.cc)7
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_context.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_context.cc)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_context.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_context.h)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field.cc)13
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field_lite.cc)23
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_lite.cc)6
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension.cc)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension_lite.cc)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_field.cc)9
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_field.h)13
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_file.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_file.cc)40
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_file.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_file.h)11
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator.cc)13
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator_factory.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator_factory.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator_factory.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator_factory.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_helpers.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_helpers.cc)165
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_helpers.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_helpers.h)42
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field_lite.cc)26
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message.cc)232
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder.cc)26
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder_lite.cc)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field_lite.cc)23
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_lite.cc)413
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_name_resolver.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_name_resolver.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_name_resolver.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_name_resolver.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_names.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_names.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_options.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_options.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_plugin_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_plugin_unittest.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field.cc)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field_lite.cc)14
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_service.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_service.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_service.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_service.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_shared_code_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_shared_code_generator.cc)22
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_shared_code_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_shared_code_generator.h)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field_lite.cc)20
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum.cc143
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/message_unittest.cc)58
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum_field.cc544
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum_field.h126
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_extension.cc150
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_extension.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h)45
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_field.cc209
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_field.h130
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_file.cc263
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_file.h94
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_generator.cc230
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h)44
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_helpers.cc591
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_helpers.h199
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_map_field.cc186
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_map_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/implicit_weak_message.cc)53
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message.cc676
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message.h97
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message_field.cc363
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message_field.h121
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_params.h258
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc968
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_primitive_field.h150
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/embed.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/embed.cc)2
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/js_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/js_generator.cc)285
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/js_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/js_generator.h)6
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/any.js (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/any.js)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/struct.js (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/struct.js)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/timestamp.js (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/timestamp.js)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types_embed.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types_embed.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/main.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/main.cc)6
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/mock_code_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/mock_code_generator.cc)28
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/mock_code_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/mock_code_generator.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum.h)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_extension.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_extension.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_extension.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_extension.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_field.cc)6
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_field.h)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_file.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_file.cc)127
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_file.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_file.h)9
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_generator.cc)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_generator.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc)58
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.h)18
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message.cc)48
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message.h)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/package_info.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/package_info.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser.cc)149
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser.h)20
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser_unittest.cc)108
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/php/php_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/php/php_generator.cc)480
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/php/php_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/php/php_generator.h)11
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.cc)15
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.pb.cc)1114
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.pb.h)316
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.proto167
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_generator.cc)87
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_generator.h)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_plugin_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_plugin_unittest.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generated_code.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generated_code.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator.cc)23
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/subprocess.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/subprocess.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/subprocess.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/subprocess.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/test_plugin.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/test_plugin.cc)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_output_unittest.sh (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_output_unittest.sh)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_writer.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_writer.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_writer.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_writer.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor.cc)731
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor.h)84
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor.pb.cc)9521
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor.pb.h)5082
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor.proto849
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database_unittest.cc)13
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/descriptor_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/descriptor_unittest.cc)822
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/drop_unknown_fields_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/drop_unknown_fields_test.cc)7
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/duration.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/duration.pb.cc)179
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/duration.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/duration.pb.h)89
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/duration.proto117
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message.cc)91
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message.h)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message_unittest.cc)77
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/empty.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/empty.pb.cc)147
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/empty.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/empty.pb.h)89
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/empty.proto (renamed from third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Android.java)43
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/extension_set.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/extension_set.cc)531
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/extension_set.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/extension_set.h)194
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/extension_set_heavy.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/extension_set_heavy.cc)156
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/extension_set_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/extension_set_unittest.cc)50
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/field_mask.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/field_mask.pb.cc)215
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/field_mask.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/field_mask.pb.h)85
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/field_mask.proto246
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_enum_reflection.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_enum_reflection.h)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_enum_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_enum_util.h)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection.cc)97
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection.h)54
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection_unittest.cc)11
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven.cc)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven.h)73
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven_lite.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven_lite.h)248
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_util.cc)117
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/generated_message_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/generated_message_util.h)91
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/has_bits.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/has_bits.h)10
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream.cc)44
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream.h)124
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream_inl.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream_inl.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream_unittest.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream.h)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream_unittest.sh (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream_unittest.sh)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/package_info.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/package_info.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/printer.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/printer.cc)10
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/printer.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/printer.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/printer_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/printer_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/strtod.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/strtod.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/strtod.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/strtod.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl_lite.cc)21
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h)27
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_unittest.cc)10
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/lite_arena_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/lite_arena_unittest.cc)33
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/lite_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/lite_unittest.cc)48
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map.h)35
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_entry.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_entry.h)51
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_entry_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_entry_lite.h)84
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_field.cc)52
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_field.h)34
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_field_inl.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_field_inl.h)10
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_field_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_field_lite.h)15
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_field_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_field_test.cc)27
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_lite_test_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_lite_test_util.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_lite_test_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_lite_test_util.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_lite_unittest.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_lite_unittest.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_proto2_unittest.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_proto2_unittest.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_test.cc)90
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_test_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_test_util.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_test_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_test_util.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_test_util_impl.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_test_util_impl.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_type_handler.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_type_handler.h)59
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_unittest.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/map_unittest.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/map_unittest_proto3.proto (renamed from third_party/protobuf/3.6.0/csharp/protos/map_unittest_proto3.proto)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/message.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/message.cc)14
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/message.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/message.h)44
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/message_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/message_lite.cc)42
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/message_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/message_lite.h)60
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/message_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/message_unittest.inc)267
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/metadata.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/metadata.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/metadata_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/metadata_lite.h)54
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/no_field_presence_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/no_field_presence_test.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/package_info.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/package_info.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/preserve_unknown_enum_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/preserve_unknown_enum_test.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/proto3_arena_lite_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/proto3_arena_lite_unittest.cc)29
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/proto3_arena_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/proto3_arena_unittest.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/proto3_lite_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/proto3_lite_unittest.cc)5
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/src/google/protobuf/reflection.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/reflection.h)25
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/reflection_internal.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/reflection_internal.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops.cc)29
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/repeated_field.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/repeated_field.cc)16
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/repeated_field.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/repeated_field.h)409
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/repeated_field_reflection_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/repeated_field_reflection_unittest.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/repeated_field_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/repeated_field_unittest.cc)288
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/service.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/service.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/service.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/service.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/source_context.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/source_context.pb.cc)200
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/source_context.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/source_context.pb.h)85
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/source_context.proto48
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/struct.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/struct.pb.cc)899
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/struct.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/struct.pb.h)430
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/struct.proto96
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomic_sequence_num.h (renamed from third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest13.m)28
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops.h249
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h325
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h151
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h146
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h122
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h231
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h155
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h313
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_power.h440
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h155
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_solaris.h188
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_tsan.h219
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc137
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h293
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc113
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h150
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/callback.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/callback.h)15
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/casts.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/casts.h)5
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/src/google/protobuf/stubs/common.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/common.cc)86
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/common.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/common.h)17
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/common_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/common_unittest.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/fastmem.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/fastmem.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/hash.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/hash.h)19
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32.cc)184
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32.h)27
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32_unittest.cc)229
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/logging.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/logging.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/macros.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/macros.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/map_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/map_util.h)7
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathlimits.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathlimits.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathlimits.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathlimits.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathutil.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathutil.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/mutex.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/mutex.h)38
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/once.cc99
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/once.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/once.h)71
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/once_unittest.cc254
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/platform_macros.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/platform_macros.h)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/port.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/port.h)147
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/scoped_ptr.h236
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/shared_ptr.h471
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/singleton.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/singleton.h)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/status.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/status.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/status.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/status.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/status_macros.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/status_macros.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/status_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/status_test.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor_test.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/stl_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/stl_util.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/structurally_valid.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/structurally_valid.cc)31
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/structurally_valid_unittest.cc40
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil.cc)22
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil.h)20
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil_unittest.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/substitute.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/substitute.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/substitute.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/substitute.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/template_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/template_util.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/template_util_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/template_util_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/time.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/time.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/time.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/time.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/time_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/stubs/time_test.cc)53
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/type_traits.h364
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/stubs/type_traits_unittest.cc631
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/test_messages_proto2.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/test_messages_proto2.proto)16
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/test_messages_proto3.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/test_messages_proto3.proto)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/test_util.cc3350
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/test_util.h215
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/test_util_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/test_util_lite.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/test_util_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/test_util_lite.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/bad_utf8_string (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/bad_utf8_string)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message)bin531 -> 531 bytes
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_maps (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_maps)bin13619 -> 13619 bytes
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_oneof_implemented (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_oneof_implemented)bin515 -> 515 bytes
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_proto3 (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_proto3)bin248 -> 248 bytes
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_packed_fields_message (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_packed_fields_message)bin142 -> 142 bytes
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/map_test_data.txt (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/map_test_data.txt)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data.txt (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data.txt)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testing/file.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testing/file.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testing/file.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testing/file.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testing/googletest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testing/googletest.cc)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testing/googletest.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testing/googletest.h)7
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testing/zcgunzip.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testing/zcgunzip.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/testing/zcgzip.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/testing/zcgzip.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/text_format.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/text_format.cc)196
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/text_format.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/text_format.h)99
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/text_format_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/text_format_unittest.cc)226
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/timestamp.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/timestamp.pb.cc)179
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/timestamp.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/timestamp.pb.h)89
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/timestamp.proto133
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/type.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/type.pb.cc)1882
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/type.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/type.pb.h)726
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/type.proto187
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest.proto)61
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_arena.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_arena.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_custom_options.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_custom_options.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_drop_unknown_fields.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_drop_unknown_fields.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_embed_optimize_for.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_embed_optimize_for.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_empty.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_empty.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_enormous_descriptor.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_enormous_descriptor.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_import.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_import.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_lite.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_proto3.proto (renamed from third_party/protobuf/3.6.0/csharp/protos/unittest_import_proto3.proto)14
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_public.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public_lite.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_public_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public_proto3.proto (renamed from third_party/protobuf/3.6.0/csharp/protos/unittest_import_public_proto3.proto)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies_enum.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies_enum.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_lite.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_lite.proto)19
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_lite_imports_nonlite.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_lite_imports_nonlite.proto)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_mset.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_mset.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_mset_wire_format.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_mset_wire_format.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena_import.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena_import.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena_lite.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_field_presence.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_field_presence.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_generic_services.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_generic_services.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_optimize_for.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_optimize_for.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_preserve_unknown_enum.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_preserve_unknown_enum.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_preserve_unknown_enum2.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_preserve_unknown_enum2.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_arena.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_arena.proto)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_arena_lite.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_arena_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_lite.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_lite.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unittest_well_known_types.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unittest_well_known_types.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set_unittest.cc)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util_test.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator.cc)10
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator.h)11
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator_test.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util.cc)95
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util.h)24
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util_test.cc)59
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/constants.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/constants.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/datapiece.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/datapiece.cc)27
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/datapiece.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/datapiece.h)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter.cc)115
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter.h)29
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter_test.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/error_listener.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/error_listener.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/error_listener.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/error_listener.h)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/expecting_objectwriter.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/expecting_objectwriter.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/field_mask_utility.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/field_mask_utility.cc)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/field_mask_utility.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/field_mask_utility.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_escaping.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_escaping.cc)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_escaping.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_escaping.h)6
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter.cc)13
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter.h)47
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter_test.cc)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser.cc)63
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser.h)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser_test.cc)17
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/location_tracker.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/location_tracker.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/mock_error_listener.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/mock_error_listener.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_location_tracker.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_location_tracker.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_source.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_source.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_writer.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_writer.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_writer.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_writer.h)7
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/proto_writer.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/proto_writer.cc)70
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/proto_writer.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/proto_writer.h)46
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource.cc)71
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource_test.cc)27
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter.cc)78
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter.h)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter_test.cc)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/structured_objectwriter.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/structured_objectwriter.h)9
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/anys.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/anys.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/books.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/books.proto)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/default_value.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/default_value.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/default_value_test.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/default_value_test.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/field_mask.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/field_mask.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/maps.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/maps.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/oneofs.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/oneofs.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/proto3.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/proto3.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/struct.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/struct.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/timestamp_duration.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/timestamp_duration.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/wrappers.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/wrappers.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info.cc)4
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info_test_helper.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info_test_helper.cc)3
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info_test_helper.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info_test_helper.h)7
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/utility.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/utility.cc)53
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/internal/utility.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/internal/utility.h)22
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/json_format_proto3.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/json_format_proto3.proto)6
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/json_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/json_util.cc)22
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/json_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/json_util.h)10
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/json_util_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/json_util_test.cc)108
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer.cc)53
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer.h)24
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer_unittest.cc)21
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer_unittest.proto (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer_unittest.proto)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/package_info.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/package_info.h)2
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/time_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/time_util.cc)5
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/time_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/time_util.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/time_util_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/time_util_test.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util.cc)8
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util.h)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util_test.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util_test.cc)26
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/well_known_types_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/well_known_types_unittest.cc)0
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wire_format.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wire_format.cc)9
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wire_format.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wire_format.h)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite.cc)191
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite.h)86
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite_inl.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite_inl.h)114
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wire_format_unittest.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wire_format_unittest.cc)1
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wrappers.pb.cc (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wrappers.pb.cc)1039
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wrappers.pb.h (renamed from third_party/protobuf/3.6.0/src/google/protobuf/wrappers.pb.h)475
-rw-r--r--third_party/protobuf/3.4.0/src/google/protobuf/wrappers.proto118
-rw-r--r--third_party/protobuf/3.4.0/src/libprotobuf-lite.map (renamed from third_party/protobuf/3.6.0/src/libprotobuf-lite.map)0
-rw-r--r--third_party/protobuf/3.4.0/src/libprotobuf.map (renamed from third_party/protobuf/3.6.0/src/libprotobuf.map)0
-rw-r--r--third_party/protobuf/3.4.0/src/libprotoc.map (renamed from third_party/protobuf/3.6.0/src/libprotoc.map)0
-rw-r--r--third_party/protobuf/3.4.0/src/solaris/libstdc++.la (renamed from third_party/protobuf/3.6.0/src/solaris/libstdc++.la)0
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/tests.sh (renamed from third_party/protobuf/3.6.0/tests.sh)83
-rwxr-xr-x[-rw-r--r--]third_party/protobuf/3.4.0/update_file_lists.sh (renamed from third_party/protobuf/3.6.0/update_file_lists.sh)24
-rw-r--r--third_party/protobuf/3.4.0/util/python/BUILD (renamed from third_party/protobuf/3.6.0/util/python/BUILD)0
-rw-r--r--third_party/protobuf/3.6.0/.travis.yml90
-rw-r--r--third_party/protobuf/3.6.0/README.md85
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/Makefile.am518
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/README.md187
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto78
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pbbin289 -> 0 bytes
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message2/benchmark_message2.proto76
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3.proto534
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_1.proto1280
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_2.proto499
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_3.proto466
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_4.proto491
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_5.proto473
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_6.proto454
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_7.proto56
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_8.proto1900
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4.proto454
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_1.proto474
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_2.proto292
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_3.proto751
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/download_data.sh5
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/go/go_benchmark_test.go124
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/java/pom.xml95
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java232
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/python/__init__.py0
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/python/py_benchmark.py152
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/python/python_benchmark_messages.cc29
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/util/__init__.py0
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/util/big_query_utils.py188
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/util/gogo_data_scrubber.cc105
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/util/protoc-gen-gogoproto.cc103
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/util/run_and_upload.py290
-rw-r--r--third_party/protobuf/3.6.0/benchmarks/util/schema_proto2_to_proto3_util.h137
-rw-r--r--third_party/protobuf/3.6.0/conformance/failure_list_csharp.txt2
-rw-r--r--third_party/protobuf/3.6.0/conformance/failure_list_php.txt20
-rw-r--r--third_party/protobuf/3.6.0/csharp/global.json5
-rw-r--r--third_party/protobuf/3.6.0/csharp/protos/README.md3
-rw-r--r--third_party/protobuf/3.6.0/csharp/protos/unittest_proto3.proto380
-rw-r--r--third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs124
-rw-r--r--third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs176
-rw-r--r--third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/Lists.cs89
-rw-r--r--third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs130
-rw-r--r--third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs205
-rw-r--r--third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/UnknownField.cs263
-rw-r--r--third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/UnknownFieldSet.cs330
-rw-r--r--third_party/protobuf/3.6.0/docs/performance.md304
-rw-r--r--third_party/protobuf/3.6.0/examples/BUILD109
-rw-r--r--third_party/protobuf/3.6.0/examples/README.md124
-rw-r--r--third_party/protobuf/3.6.0/examples/WORKSPACE35
-rw-r--r--third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java150
-rw-r--r--third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java325
-rw-r--r--third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_lite_test.proto111
-rw-r--r--third_party/protobuf/3.6.0/java/lite.md50
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/32-bit/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/32-bit/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/32-bit/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/64-bit/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/64-bit/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/benchmark/build.sh87
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/benchmark/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/golang/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/golang/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/golang/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/javascript/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/javascript/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/javascript/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/php_all/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/php_all/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/php_all/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/prepare_build_linux_rc13
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/python/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/python/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/python/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/python_cpp/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/python_cpp/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/python_cpp/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/ruby_all/build.sh17
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/ruby_all/continuous.cfg11
-rw-r--r--third_party/protobuf/3.6.0/kokoro/linux/ruby_all/presubmit.cfg11
-rw-r--r--third_party/protobuf/3.6.0/libprotobuf_java.jarbin1408007 -> 0 bytes
-rw-r--r--third_party/protobuf/3.6.0/libprotobuf_java_util.jarbin67227 -> 0 bytes
-rw-r--r--third_party/protobuf/3.6.0/m4/ax_pthread.m4485
-rw-r--r--third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist8
-rw-r--r--third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist8
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest04.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest05.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest06.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest08.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest09.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest14.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest15.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest16.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest17.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest18.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest19.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest20.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest21.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest22.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest23.m40
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest24.m42
-rw-r--r--third_party/protobuf/3.6.0/objectivec/Tests/GPBUnknownFieldSetTest.m502
-rw-r--r--third_party/protobuf/3.6.0/php/ext/google/protobuf/message.c2235
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Any.php30
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Api.php49
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Duration.php31
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/FieldMask.php31
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php30
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/SourceContext.php32
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Struct.php45
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Timestamp.php31
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Type.php78
-rw-r--r--third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Wrappers.php38
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Any.php325
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Api.php350
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/BoolValue.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/BytesValue.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/DoubleValue.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Duration.php173
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Enum.php203
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumValue.php135
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field.php381
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field/Cardinality.php42
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field/Kind.php132
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/FieldMask.php223
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field_Cardinality.php16
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field_Kind.php16
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/FloatValue.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/GPBEmpty.php39
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Int32Value.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Int64Value.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php231
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php124
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php74
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBUtil.php579
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/ListValue.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Method.php271
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Mixin.php166
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/NullValue.php23
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Option.php126
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/SourceContext.php72
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/StringValue.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Struct.php73
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Syntax.php27
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Timestamp.php197
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Type.php237
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/UInt32Value.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/UInt64Value.php68
-rw-r--r--third_party/protobuf/3.6.0/php/src/Google/Protobuf/Value.php214
-rw-r--r--third_party/protobuf/3.6.0/php/tests/bootstrap_phpunit.php5
-rw-r--r--third_party/protobuf/3.6.0/php/tests/generated_class_test.php1345
-rw-r--r--third_party/protobuf/3.6.0/php/tests/memory_leak_test.php193
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/empty/echo.proto17
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_empty_php_namespace.proto19
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_include.proto18
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_no_namespace.proto22
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_php_namespace.proto31
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_lower.proto77
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_upper.proto77
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_value_lower.proto79
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_value_upper.proto79
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_reserved_message_lower.proto77
-rw-r--r--third_party/protobuf/3.6.0/php/tests/proto/test_reserved_message_upper.proto77
-rw-r--r--third_party/protobuf/3.6.0/php/tests/well_known_test.php393
-rw-r--r--third_party/protobuf/3.6.0/protoc-artifacts/scl-enable-devtoolset.sh13
-rw-r--r--third_party/protobuf/3.6.0/python/google/protobuf/compiler/__init__.py0
-rw-r--r--third_party/protobuf/3.6.0/python/google/protobuf/internal/__init__.py0
-rw-r--r--third_party/protobuf/3.6.0/python/google/protobuf/internal/no_package.proto10
-rw-r--r--third_party/protobuf/3.6.0/python/google/protobuf/pyext/thread_unsafe_shared_ptr.h104
-rw-r--r--third_party/protobuf/3.6.0/python/google/protobuf/util/__init__.py0
-rw-r--r--third_party/protobuf/3.6.0/ruby/tests/encode_decode_test.rb87
-rw-r--r--third_party/protobuf/3.6.0/ruby/tests/gc_test.rb58
-rw-r--r--third_party/protobuf/3.6.0/ruby/tests/test_ruby_package.proto7
-rw-r--r--third_party/protobuf/3.6.0/src/README.md228
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/arena.cc415
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/compiler/annotation_test_util.cc166
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/compiler/annotation_test_util.h114
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_field.cc836
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc220
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.cc122
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/implicit_weak_message.h135
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/inlined_string_field.h271
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/test_util.h1301
-rw-r--r--third_party/protobuf/3.6.0/src/google/protobuf/test_util.inc2600
-rw-r--r--third_party/protobuf/BUILD2
-rw-r--r--third_party/protobuf/README.md14
2026 files changed, 67621 insertions, 78326 deletions
diff --git a/WORKSPACE b/WORKSPACE
index 13b6cee0ff..6ac9c6faa7 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -69,20 +69,20 @@ bind(
new_local_repository(
name = "com_google_protobuf",
- build_file = "./third_party/protobuf/3.6.0/BUILD",
- path = "./third_party/protobuf/3.6.0/",
+ build_file = "./third_party/protobuf/3.4.0/BUILD",
+ path = "./third_party/protobuf/3.4.0/",
)
new_local_repository(
name = "com_google_protobuf_cc",
- build_file = "./third_party/protobuf/3.6.0/BUILD",
- path = "./third_party/protobuf/3.6.0/",
+ build_file = "./third_party/protobuf/3.4.0/BUILD",
+ path = "./third_party/protobuf/3.4.0/",
)
new_local_repository(
name = "com_google_protobuf_java",
- build_file = "./third_party/protobuf/3.6.0/com_google_protobuf_java.BUILD",
- path = "./third_party/protobuf/3.6.0/",
+ build_file = "./third_party/protobuf/3.4.0/com_google_protobuf_java.BUILD",
+ path = "./third_party/protobuf/3.4.0/",
)
new_local_repository(
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD b/src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD
index a8adee5f2b..10db971120 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD
@@ -29,7 +29,7 @@ java_library(
"//third_party/grpc:grpc-jar",
"@com_google_protobuf//:protobuf_java",
"@com_google_protobuf//:protobuf_java_util",
- "@com_google_protobuf//:any_proto",
+ "@com_google_protobuf//:well_known_types_any_proto",
"@googleapis//:google_devtools_build_v1_build_events_java_proto",
"@googleapis//:google_devtools_build_v1_build_status_java_proto",
"@googleapis//:google_devtools_build_v1_publish_build_event_java_proto",
diff --git a/src/main/protobuf/BUILD b/src/main/protobuf/BUILD
index fbb1374348..85aaa24a67 100644
--- a/src/main/protobuf/BUILD
+++ b/src/main/protobuf/BUILD
@@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])
load("//tools/build_rules:genproto.bzl", "cc_grpc_library")
load("//tools/build_rules:utilities.bzl", "java_library_srcs")
-load("//third_party/protobuf/3.6.0:protobuf.bzl", "py_proto_library")
+load("//third_party/protobuf/3.4.0:protobuf.bzl", "py_proto_library")
load("//third_party/grpc:build_defs.bzl", "java_grpc_library")
exports_files(
@@ -148,7 +148,7 @@ proto_library(
name = "remote_execution_log_proto",
srcs = ["remote_execution_log.proto"],
deps = [
- "@com_google_protobuf//:timestamp_proto",
+ "@com_google_protobuf//:well_known_types_timestamp_proto",
"@googleapis//:google_bytestream_bytestream_proto",
"@googleapis//:google_devtools_remoteexecution_v1test_remote_execution_proto",
"@googleapis//:google_longrunning_operations_proto",
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD b/src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD
index 8fa0c86c49..fe502fd67e 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD
@@ -83,7 +83,7 @@ java_library(
"//third_party:junit4",
"//third_party:truth",
"//third_party/java/dd_plist",
- "//third_party/protobuf:protobuf_java",
+ "//third_party/protobuf/3.4.0:protobuf_java",
],
)
diff --git a/src/test/shell/integration/bazel_command_log_test.sh b/src/test/shell/integration/bazel_command_log_test.sh
index 3e7443c353..91294daa89 100755
--- a/src/test/shell/integration/bazel_command_log_test.sh
+++ b/src/test/shell/integration/bazel_command_log_test.sh
@@ -46,29 +46,12 @@ function strip_lines_from_bazel_cc() {
echo "$clean_log" > $TEST_log
}
-function strip_protobuf_unsafe_warning() {
- # TODO: Protobuf triggers illegal reflective access warning in JDK 9.
- # Remove this workaround when protobuf fixes this.
- # See https://github.com/google/protobuf/issues/3781
- clean_log=$(\
- sed \
- -e "/^WARNING: An illegal reflective access operation has occurred/d" \
- -e "/^WARNING: Illegal reflective access by com\.google\.protobuf\.UnsafeUtil /d" \
- -e "/^WARNING: Please consider reporting this to the maintainers of com\.google\.protobuf\.UnsafeUtil/d" \
- -e "/^WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations/d" \
- -e "/^WARNING: All illegal access operations will be denied in a future release/d" \
- $TEST_log)
-
- echo "$clean_log" > $TEST_log
-}
-
function test_batch_mode() {
# capture stdout/stderr in $TEST_log
bazel --batch info >&$TEST_log || fail "Expected success"
# strip extra lines printed by bazel.cc
strip_lines_from_bazel_cc
- strip_protobuf_unsafe_warning
# compare $TEST_log with command.log
assert_equals "" "$(diff $TEST_log $log 2>&1)"
@@ -85,7 +68,6 @@ function test_batch_mode_with_logging_flag() {
# strip extra lines printed by bazel.cc
strip_lines_from_bazel_cc
- strip_protobuf_unsafe_warning
# compare $TEST_log with command.log
assert_equals "" "$(diff $TEST_log $log 2>&1)"
diff --git a/src/test/shell/testenv.sh b/src/test/shell/testenv.sh
index c4a0c5599d..b2f6e24147 100755
--- a/src/test/shell/testenv.sh
+++ b/src/test/shell/testenv.sh
@@ -115,7 +115,7 @@ if [ "${MACHINE_TYPE}" = 's390x' ]; then
fi
# Requires //third_party/protobuf:protoc
-protoc_compiler="${BAZEL_RUNFILES}/third_party/protobuf/3.6.0/protoc"
+protoc_compiler="${BAZEL_RUNFILES}/third_party/protobuf/3.4.0/protoc"
if [ -z ${RUNFILES_MANIFEST_ONLY+x} ]; then
junit_jar="${BAZEL_RUNFILES}/third_party/junit/junit-*.jar"
diff --git a/third_party/googleapis/BUILD b/third_party/googleapis/BUILD
index d26d534199..05784ef2c4 100644
--- a/third_party/googleapis/BUILD
+++ b/third_party/googleapis/BUILD
@@ -146,8 +146,8 @@ proto_library(
":google_api_annotations_proto",
":google_longrunning_operations_proto",
":google_rpc_status_proto",
- "@com_google_protobuf//:any_proto",
- "@com_google_protobuf//:duration_proto",
+ "@com_google_protobuf//:well_known_types_any_proto",
+ "@com_google_protobuf//:well_known_types_duration_proto",
],
)
@@ -160,8 +160,8 @@ proto_library(
name = "google_rpc_error_details_proto",
srcs = ["google/rpc/error_details.proto"],
deps = [
- "@com_google_protobuf//:any_proto",
- "@com_google_protobuf//:duration_proto",
+ "@com_google_protobuf//:well_known_types_any_proto",
+ "@com_google_protobuf//:well_known_types_duration_proto",
],
)
@@ -170,8 +170,8 @@ proto_library(
srcs = ["google/watcher/v1/watch.proto"],
deps = [
":google_api_annotations_proto",
- "@com_google_protobuf//:any_proto",
- "@com_google_protobuf//:empty_proto",
+ "@com_google_protobuf//:well_known_types_any_proto",
+ "@com_google_protobuf//:well_known_types_empty_proto",
],
)
@@ -180,7 +180,7 @@ proto_library(
srcs = ["google/bytestream/bytestream.proto"],
deps = [
":google_api_annotations_proto",
- "@com_google_protobuf//:wrappers_proto",
+ "@com_google_protobuf//:well_known_types_wrappers_proto",
],
)
@@ -191,8 +191,8 @@ proto_library(
":google_api_annotations_proto",
":google_api_http_proto",
":google_rpc_status_proto",
- "@com_google_protobuf//:any_proto",
- "@com_google_protobuf//:empty_proto",
+ "@com_google_protobuf//:well_known_types_any_proto",
+ "@com_google_protobuf//:well_known_types_empty_proto",
],
)
@@ -201,7 +201,7 @@ proto_library(
srcs = ["google/devtools/build/v1/build_status.proto"],
deps = [
":google_api_annotations_proto",
- "@com_google_protobuf//:any_proto",
+ "@com_google_protobuf//:well_known_types_any_proto",
],
)
@@ -212,9 +212,9 @@ proto_library(
":google_api_annotations_proto",
":google_devtools_build_v1_build_status_proto",
":google_rpc_status_proto",
- "@com_google_protobuf//:any_proto",
- "@com_google_protobuf//:timestamp_proto",
- "@com_google_protobuf//:wrappers_proto",
+ "@com_google_protobuf//:well_known_types_any_proto",
+ "@com_google_protobuf//:well_known_types_timestamp_proto",
+ "@com_google_protobuf//:well_known_types_wrappers_proto",
],
)
@@ -225,9 +225,9 @@ proto_library(
":google_api_annotations_proto",
":google_api_auth_proto",
":google_devtools_build_v1_build_events_proto",
- "@com_google_protobuf//:any_proto",
- "@com_google_protobuf//:duration_proto",
- "@com_google_protobuf//:empty_proto",
+ "@com_google_protobuf//:well_known_types_any_proto",
+ "@com_google_protobuf//:well_known_types_duration_proto",
+ "@com_google_protobuf//:well_known_types_empty_proto",
],
)
@@ -236,7 +236,7 @@ proto_library(
srcs = ["google/api/annotations.proto"],
deps = [
":google_api_http_proto",
- "@com_google_protobuf//:descriptor_proto",
+ "@com_google_protobuf//:well_known_types_descriptor_proto",
],
)
@@ -248,7 +248,7 @@ proto_library(
proto_library(
name = "google_rpc_status_proto",
srcs = ["google/rpc/status.proto"],
- deps = ["@com_google_protobuf//:any_proto"],
+ deps = ["@com_google_protobuf//:well_known_types_any_proto"],
)
proto_library(
diff --git a/third_party/grpc/build_defs.bzl b/third_party/grpc/build_defs.bzl
index 8ae42acad2..4240c1debf 100644
--- a/third_party/grpc/build_defs.bzl
+++ b/third_party/grpc/build_defs.bzl
@@ -6,9 +6,7 @@ load("//third_party/grpc:build_defs.bzl", "java_grpc_library")
def _path_ignoring_repository(f):
if (len(f.owner.workspace_root) == 0):
return f.short_path
- # If |f| is a generated file, it will have "bazel-out/*/genfiles" prefix
- # before "external/workspace", so we need to add the starting index of "external/workspace"
- return f.path[f.path.find(f.owner.workspace_root)+len(f.owner.workspace_root)+1:]
+ return f.path[len(f.owner.workspace_root)+1:]
def _gensource_impl(ctx):
if len(ctx.attr.srcs) > 1:
diff --git a/third_party/protobuf/3.4.0/.travis.yml b/third_party/protobuf/3.4.0/.travis.yml
new file mode 100644
index 0000000000..d49e0a7131
--- /dev/null
+++ b/third_party/protobuf/3.4.0/.travis.yml
@@ -0,0 +1,91 @@
+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.
+language: cpp
+os:
+ - osx
+# The Objective C build needs Xcode 7.0 or later.
+osx_image: xcode8.1
+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
+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.
+ - os: osx
+ env: CONFIG=java_jdk7
+ - os: osx
+ env: CONFIG=java_oracle7
+ - os: osx
+ env: CONFIG=javanano_jdk7
+ - 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.
+ - os: osx
+ env: CONFIG=golang
+ include:
+ # The dotnet environment requires Ubuntu 14.04 or 16.04. This
+ # configuration is effectively an "extra" one, outside the
+ # autogenerated matrix.
+ - os: linux
+ env: CONFIG=csharp
+ language: csharp
+ dist: trusty
+ dotnet: 1.0.1
+ mono: none
+ # This test is kept on travis because it doesn't play nicely with other
+ # tests on jenkins running in parallel.
+ - os: linux
+ env: CONFIG=cpp_distcheck
+ # The Java compatibility test currently only runs on Linux because it will
+ # fetch pre-built Linux protoc binaries in the test.
+ - os: linux
+ env: CONFIG=java_compatibility
+ # 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
+notifications:
+ email: false
diff --git a/third_party/protobuf/3.6.0/BUILD b/third_party/protobuf/3.4.0/BUILD
index ca503be57d..84f90e5474 100644
--- a/third_party/protobuf/3.6.0/BUILD
+++ b/third_party/protobuf/3.4.0/BUILD
@@ -5,17 +5,6 @@ licenses(["notice"])
exports_files(["LICENSE"])
################################################################################
-# Java 9 configuration
-################################################################################
-
-config_setting(
- name = "jdk9",
- values = {
- "java_toolchain": "@bazel_tools//tools/jdk:toolchain_jdk9",
- },
-)
-
-################################################################################
# Modifications made by bazel
################################################################################
@@ -31,8 +20,7 @@ filegroup(
"src/google/protobuf/**/*.proto",
],
) + [
- "//third_party/protobuf/3.6.0/examples:srcs",
- "//third_party/protobuf/3.6.0/util/python:srcs",
+ "//third_party/protobuf/3.4.0/util/python:srcs",
],
visibility = ["//visibility:public"],
)
@@ -59,6 +47,95 @@ filegroup(
visibility = ["//visibility:public"],
)
+# Well Known Types
+
+proto_library(
+ name = "well_known_types_any_proto",
+ srcs = ["google/protobuf/any.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_timestamp_proto",
+ srcs = ["google/protobuf/timestamp.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_api_proto",
+ srcs = ["google/protobuf/api.proto"],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":well_known_types_source_context_proto",
+ ":well_known_types_type_proto",
+ ],
+)
+
+proto_library(
+ name = "well_known_types_type_proto",
+ srcs = ["google/protobuf/type.proto"],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":well_known_types_any_proto",
+ ":well_known_types_source_context_proto",
+ ],
+)
+
+proto_library(
+ name = "well_known_types_source_context_proto",
+ srcs = ["google/protobuf/source_context.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_compiler_plugin_proto",
+ srcs = ["google/protobuf/compiler/plugin.proto"],
+ visibility = ["//visibility:public"],
+ deps = [":well_known_types_descriptor_proto"],
+)
+
+proto_library(
+ name = "well_known_types_descriptor_proto",
+ srcs = ["google/protobuf/descriptor.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_duration_proto",
+ srcs = ["google/protobuf/duration.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_empty_proto",
+ srcs = ["google/protobuf/empty.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_field_mask_proto",
+ srcs = ["google/protobuf/field_mask.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_struct_proto",
+ srcs = ["google/protobuf/struct.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_wrappers_proto",
+ srcs = ["google/protobuf/wrappers.proto"],
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "well_known_types_compiler_profile_proto",
+ srcs = ["google/protobuf/compiler/profile.proto"],
+ visibility = ["//visibility:public"],
+)
+
################################################################################
# The below build rules are a copy of the upstream protobuf BUILD file with
# # Java support removed.
@@ -68,27 +145,14 @@ filegroup(
# Protobuf Runtime Library
################################################################################
-MSVC_COPTS = [
+WIN_COPTS = [
"/DHAVE_PTHREAD",
- "/wd4018", # -Wno-sign-compare
- "/wd4065", # switch statement contains 'default' but no 'case' labels
- "/wd4146", # unary minus operator applied to unsigned type, result still unsigned
- "/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data
- "/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
- "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data
- "/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
- "/wd4307", # 'operator' : integral constant overflow
- "/wd4309", # 'conversion' : truncation of constant value
- "/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
- "/wd4355", # 'this' : used in base member initializer list
- "/wd4506", # no definition for inline function 'function'
- "/wd4514", # -Wno-unused-function
- "/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
- "/wd4996", # The compiler encountered a deprecated declaration.
+ "/wd4018", # -Wno-sign-compare
+ "/wd4514", # -Wno-unused-function
]
COPTS = select({
- ":msvc" : MSVC_COPTS,
+ ":windows": WIN_COPTS,
"//conditions:default": [
"-DHAVE_PTHREAD",
"-Wall",
@@ -96,14 +160,12 @@ COPTS = select({
"-Woverloaded-virtual",
"-Wno-sign-compare",
"-Wno-unused-function",
- # Prevents ISO C++ const string assignment warnings for pyext sources.
- "-Wno-writable-strings",
],
})
config_setting(
- name = "msvc",
- values = { "compiler": "msvc-cl" },
+ name = "windows",
+ values = {"cpu": "x64_windows"},
)
config_setting(
@@ -113,11 +175,13 @@ config_setting(
},
)
-# Android and MSVC builds do not need to link in a separate pthread library.
+# Android builds do not need to link in a separate pthread library.
LINK_OPTS = select({
":android": [],
- ":msvc": [],
- "//conditions:default": ["-lpthread", "-lm"],
+ "//conditions:default": [
+ "-lpthread",
+ "-lm",
+ ],
})
load(
@@ -129,6 +193,37 @@ load(
"internal_protobuf_py_tests",
)
+config_setting(
+ name = "ios_armv7",
+ values = {
+ "ios_cpu": "armv7",
+ },
+)
+
+config_setting(
+ name = "ios_armv7s",
+ values = {
+ "ios_cpu": "armv7s",
+ },
+)
+
+config_setting(
+ name = "ios_arm64",
+ values = {
+ "ios_cpu": "arm64",
+ },
+)
+
+IOS_ARM_COPTS = [
+ "-DOS_IOS",
+ "-miphoneos-version-min=7.0",
+ "-arch armv7",
+ "-arch armv7s",
+ "-arch arm64",
+ "-D__thread=",
+ "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/",
+]
+
cc_library(
name = "protobuf_lite",
srcs = [
@@ -138,16 +233,18 @@ 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",
"src/google/protobuf/message_lite.cc",
"src/google/protobuf/repeated_field.cc",
+ "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
+ "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
"src/google/protobuf/stubs/bytestream.cc",
"src/google/protobuf/stubs/common.cc",
"src/google/protobuf/stubs/int128.cc",
"src/google/protobuf/stubs/io_win32.cc",
+ "src/google/protobuf/stubs/once.cc",
"src/google/protobuf/stubs/status.cc",
"src/google/protobuf/stubs/statusor.cc",
"src/google/protobuf/stubs/stringpiece.cc",
@@ -158,7 +255,12 @@ cc_library(
"src/google/protobuf/wire_format_lite.cc",
],
hdrs = glob(["src/google/protobuf/**/*.h"]),
- copts = COPTS,
+ copts = select({
+ ":ios_armv7": IOS_ARM_COPTS,
+ ":ios_armv7s": IOS_ARM_COPTS,
+ ":ios_arm64": IOS_ARM_COPTS,
+ "//conditions:default": [],
+ }) + COPTS,
includes = ["src/"],
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
@@ -225,7 +327,12 @@ cc_library(
"src/google/protobuf/wrappers.pb.cc",
],
hdrs = glob(["src/**/*.h"]),
- copts = COPTS,
+ copts = select({
+ ":ios_armv7": IOS_ARM_COPTS,
+ ":ios_armv7s": IOS_ARM_COPTS,
+ ":ios_arm64": IOS_ARM_COPTS,
+ "//conditions:default": [],
+ }) + COPTS,
includes = ["src/"],
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
@@ -251,24 +358,21 @@ objc_library(
visibility = ["//visibility:public"],
)
-# Map of all well known protos.
-# name => (include path, imports)
-WELL_KNOWN_PROTO_MAP = {
- "any" : ("google/protobuf/any.proto", []),
- "api" : ("google/protobuf/api.proto", ["source_context", "type"]),
- "compiler_plugin" : ("google/protobuf/compiler/plugin.proto", ["descriptor"]),
- "descriptor" : ("google/protobuf/descriptor.proto", []),
- "duration" : ("google/protobuf/duration.proto", []),
- "empty" : ("google/protobuf/empty.proto", []),
- "field_mask" : ("google/protobuf/field_mask.proto", []),
- "source_context" : ("google/protobuf/source_context.proto", []),
- "struct" : ("google/protobuf/struct.proto", []),
- "timestamp" : ("google/protobuf/timestamp.proto", []),
- "type" : ("google/protobuf/type.proto", ["any", "source_context"]),
- "wrappers" : ("google/protobuf/wrappers.proto", []),
-}
-
-RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()]
+RELATIVE_WELL_KNOWN_PROTOS = [
+ # AUTOGEN(well_known_protos)
+ "google/protobuf/any.proto",
+ "google/protobuf/api.proto",
+ "google/protobuf/compiler/plugin.proto",
+ "google/protobuf/descriptor.proto",
+ "google/protobuf/duration.proto",
+ "google/protobuf/empty.proto",
+ "google/protobuf/field_mask.proto",
+ "google/protobuf/source_context.proto",
+ "google/protobuf/struct.proto",
+ "google/protobuf/timestamp.proto",
+ "google/protobuf/type.proto",
+ "google/protobuf/wrappers.proto",
+]
WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]
@@ -289,25 +393,6 @@ cc_proto_library(
)
################################################################################
-# Well Known Types Proto Library Rules
-################################################################################
-
-internal_copied_filegroup(
- name = "_internal_wkt_protos",
- srcs = WELL_KNOWN_PROTOS,
- dest = "",
- strip_prefix = "src",
- visibility = ["//visibility:hidden"],
-)
-
-[proto_library(
- name = proto[0] + "_proto",
- srcs = [proto[1][0]],
- deps = [dep + "_proto" for dep in proto[1][1]],
- visibility = ["//visibility:public"],
- ) for proto in WELL_KNOWN_PROTO_MAP.items()]
-
-################################################################################
# Protocol Buffers Compiler
################################################################################
@@ -345,7 +430,6 @@ cc_library(
"src/google/protobuf/compiler/cpp/cpp_map_field.cc",
"src/google/protobuf/compiler/cpp/cpp_message.cc",
"src/google/protobuf/compiler/cpp/cpp_message_field.cc",
- "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
"src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
"src/google/protobuf/compiler/cpp/cpp_service.cc",
"src/google/protobuf/compiler/cpp/cpp_string_field.cc",
@@ -395,6 +479,17 @@ cc_library(
"src/google/protobuf/compiler/java/java_shared_code_generator.cc",
"src/google/protobuf/compiler/java/java_string_field.cc",
"src/google/protobuf/compiler/java/java_string_field_lite.cc",
+ "src/google/protobuf/compiler/javanano/javanano_enum.cc",
+ "src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
+ "src/google/protobuf/compiler/javanano/javanano_extension.cc",
+ "src/google/protobuf/compiler/javanano/javanano_field.cc",
+ "src/google/protobuf/compiler/javanano/javanano_file.cc",
+ "src/google/protobuf/compiler/javanano/javanano_generator.cc",
+ "src/google/protobuf/compiler/javanano/javanano_helpers.cc",
+ "src/google/protobuf/compiler/javanano/javanano_map_field.cc",
+ "src/google/protobuf/compiler/javanano/javanano_message.cc",
+ "src/google/protobuf/compiler/javanano/javanano_message_field.cc",
+ "src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
"src/google/protobuf/compiler/js/js_generator.cc",
"src/google/protobuf/compiler/js/well_known_types_embed.cc",
"src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
@@ -511,7 +606,6 @@ COMMON_TEST_SRCS = [
"src/google/protobuf/arena_test_util.cc",
"src/google/protobuf/map_test_util.cc",
"src/google/protobuf/test_util.cc",
- "src/google/protobuf/test_util.inc",
"src/google/protobuf/testing/file.cc",
"src/google/protobuf/testing/googletest.cc",
]
@@ -534,11 +628,14 @@ cc_binary(
cc_test(
name = "win32_test",
srcs = ["src/google/protobuf/stubs/io_win32_unittest.cc"],
+ tags = [
+ "manual",
+ "windows",
+ ],
deps = [
":protobuf_lite",
"//external:gtest_main",
],
- tags = ["manual", "windows"],
)
cc_test(
@@ -548,13 +645,11 @@ cc_test(
"src/google/protobuf/any_test.cc",
"src/google/protobuf/arena_unittest.cc",
"src/google/protobuf/arenastring_unittest.cc",
- "src/google/protobuf/compiler/annotation_test_util.cc",
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_unittest.cc",
- "src/google/protobuf/compiler/cpp/cpp_unittest.inc",
"src/google/protobuf/compiler/cpp/metadata_test.cc",
"src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc",
"src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
@@ -579,7 +674,6 @@ cc_test(
"src/google/protobuf/map_field_test.cc",
"src/google/protobuf/map_test.cc",
"src/google/protobuf/message_unittest.cc",
- "src/google/protobuf/message_unittest.inc",
"src/google/protobuf/no_field_presence_test.cc",
"src/google/protobuf/preserve_unknown_enum_test.cc",
"src/google/protobuf/proto3_arena_lite_unittest.cc",
@@ -592,6 +686,7 @@ cc_test(
"src/google/protobuf/stubs/common_unittest.cc",
"src/google/protobuf/stubs/int128_unittest.cc",
"src/google/protobuf/stubs/io_win32_unittest.cc",
+ "src/google/protobuf/stubs/once_unittest.cc",
"src/google/protobuf/stubs/status_test.cc",
"src/google/protobuf/stubs/statusor_test.cc",
"src/google/protobuf/stubs/stringpiece_unittest.cc",
@@ -600,6 +695,7 @@ cc_test(
"src/google/protobuf/stubs/strutil_unittest.cc",
"src/google/protobuf/stubs/template_util_unittest.cc",
"src/google/protobuf/stubs/time_test.cc",
+ "src/google/protobuf/stubs/type_traits_unittest.cc",
"src/google/protobuf/text_format_unittest.cc",
"src/google/protobuf/unknown_field_set_unittest.cc",
"src/google/protobuf/util/delimited_message_util_test.cc",
@@ -626,6 +722,7 @@ cc_test(
# Files for csharp_bootstrap_unittest.cc.
"conformance/**/*",
"csharp/src/**/*",
+ "examples/**/*",
]),
includes = [
"src/",
@@ -748,7 +845,6 @@ py_proto_library(
":python_srcs",
"//external:six",
],
- py_extra_srcs = glob(["python/**/__init__.py"]),
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)
@@ -842,7 +938,6 @@ proto_lang_toolchain(
command_line = "--cpp_out=$(OUT)",
runtime = ":protobuf",
visibility = ["//visibility:public"],
- blacklisted_protos = [":_internal_wkt_protos_genrule"],
)
proto_lang_toolchain(
diff --git a/third_party/protobuf/3.6.0/CHANGES.txt b/third_party/protobuf/3.4.0/CHANGES.txt
index c18c6377d3..1f1dd6d599 100644
--- a/third_party/protobuf/3.6.0/CHANGES.txt
+++ b/third_party/protobuf/3.4.0/CHANGES.txt
@@ -1,198 +1,3 @@
-2018-06-01 version 3.6.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
-
- C++
- * Starting from this release, we now require C++11. For those we cannot yet
- upgrade to C++11, we will try to keep the 3.5.x branch updated with
- critical bug fixes only. If you have any concerns about this, please
- comment on issue #2780.
- * Moved to C++11 types like std::atomic and std::unique_ptr and away from our
- old custom-built equivalents.
- * Added support for repeated message fields in lite protos using implicit
- weak fields. This is an experimental feature that allows the linker to
- strip out more unused messages than previously was possible.
- * Fixed SourceCodeInfo for interpreted options and extension range options.
- * Fixed always_print_enums_as_ints option for JSON serialization.
- * Added support for ignoring unknown enum values when parsing JSON.
- * Create std::string in Arena memory.
- * Fixed ValidateDateTime to correctly check the day.
- * Fixed bug in ZeroCopyStreamByteSink.
- * Various other cleanups and fixes.
-
- Java
- * Dropped support for Java 6.
- * Added a UTF-8 decoder that uses Unsafe to directly decode a byte buffer.
- * Added deprecation annotations to generated code for deprecated oneof
- fields.
- * Fixed map field serialization in DynamicMessage.
- * Cleanup and documentation for Java Lite runtime.
- * Various other fixes and cleanups
- * Fixed unboxed arraylists to handle an edge case
- * Improved performance for copying between unboxed arraylists
- * Fixed lite protobuf to avoid Java compiler warnings
- * Improved test coverage for lite runtime
- * Performance improvements for lite runtime
-
- Python
- * Fixed bytes/string map key incompatibility between C++ and pure-Python
- implementations (issue #4029)
- * Added __init__.py files to compiler and util subpackages
- * Use /MT for all Windows versions
- * Fixed an issue affecting the Python-C++ implementation when used with
- Cython (issue #2896)
- * Various text format fixes
- * Various fixes to resolve behavior differences between the pure-Python and
- Python-C++ implementations
-
- PHP
- * Added php_metadata_namespace to control the file path of generated metadata
- file.
- * Changed generated classes of nested message/enum. E.g., Foo.Bar, which
- previously generates Foo_Bar, now generates Foo/Bar
- * Added array constructor. When creating a message, users can pass a php
- array whose content is field name to value pairs into constructor. The
- created message will be initialized according to the array. Note that
- message field should use a message value instead of a sub-array.
- * Various bug fixes.
-
- Objective-C
- * We removed some helper class methods from GPBDictionary to shrink the size
- of the library, the functionary is still there, but you may need to do some
- specific +alloc / -init… methods instead.
- * Minor improvements in the performance of object field getters/setters by
- avoiding some memory management overhead.
- * Fix a memory leak during the raising of some errors.
- * Make header importing completely order independent.
- * Small code improvements for things the undefined behaviors compiler option
- was flagging.
-
- Ruby
- * Added ruby_package file option to control the module of generated class.
- * Various bug fixes.
-
- Javascript
- * Allow setting string to int64 field.
-
- Csharp
- * Unknown fields are now parsed and then sent back on the wire. They can be
- discarded at parse time via a CodedInputStream option.
- * Movement towards working with .NET 3.5 and Unity
- * Expression trees are no longer used
- * AOT generics issues in Unity/il2cpp have a workaround (see this commit for
- details)
- * Floating point values are now compared bitwise (affects NaN value
- comparisons)
- * The default size limit when parsing is now 2GB rather than 64MB
- * MessageParser now supports parsing from a slice of a byte array
- * JSON list parsing now accepts null values where the underlying proto
- representation does
-
-2017-12-20 version 3.5.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
- Planned Future Changes
- * Make C++ implementation C++11 only: we plan to require C++11 to build
- protobuf code starting from 3.6.0 release. Please join this github issue:
- https://github.com/google/protobuf/issues/2780 to provide your feedback.
-
- protoc
- * Fixed a bug introduced in 3.5.0 and protoc in Windows now accepts non-ascii
- characters in paths again.
-
- C++
- * Removed several usages of C++11 features in the code base.
- * Fixed some compiler warnings.
-
- PHP
- * Fixed memory leak in C-extension implementation.
- * Added discardUnknokwnFields API.
- * Removed duplicatd typedef in C-extension headers.
- * Avoided calling private php methods (timelib_update_ts).
- * Fixed Any.php to use fully-qualified name for DescriptorPool.
-
- Ruby
- * Added Google_Protobuf_discard_unknown for discarding unknown fields in
- messages.
-
- C#
- * Unknown fields are now preserved by default.
- * Floating point values are now bitwise compared, affecting message equality
- check and Contains() API in map and repeated fields.
-
-
-2017-11-13 version 3.5.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
- Planned Future Changes
- * Make C++ implementation C++11 only: we plan to require C++11 to build
- protobuf code starting from 3.6.0 release. Please join this github issue:
- https://github.com/google/protobuf/issues/2780 to provide your feedback.
-
- General
- * Unknown fields are now preserved in proto3 for most of the language
- implementations for proto3 by default. See the per-language section for
- details.
- * reserve keyword are now supported in enums
-
- C++
- * Proto3 messages are now preserving unknown fields by default. If you rely on
- unknowns fields being dropped. Please use DiscardUnknownFields() explicitly.
- * Deprecated the unsafe_arena_release_* and unsafe_arena_add_allocated_*
- methods for string fields.
- * Added move constructor and move assignment to RepeatedField,
- RepeatedPtrField and google::protobuf::Any.
- * Added perfect forwarding in Arena::CreateMessage
- * In-progress experimental support for implicit weak fields with lite protos.
- This feature allows the linker to strip out more unused messages and reduce
- binary size.
- * Various performance optimizations.
-
- Java
- * Proto3 messages are now preserving unknown fields by default. If you’d like
- to drop unknown fields, please use the DiscardUnknownFieldsParser API. For
- example:
- Parser<Foo> parser = DiscardUnknownFieldsParser.wrap(Foo.parser());
- Foo foo = parser.parseFrom(input);
- * Added a new CodedInputStream decoder for Iterable<ByteBuffer> with direct
- ByteBuffers.
- * TextFormat now prints unknown length-delimited fields as messages if
- possible.
- * FieldMaskUtil.merge() no longer creates unnecessary empty messages when a
- message field is unset in both source message and destination message.
- * Various performance optimizations.
-
- Python
- * Proto3 messages are now preserving unknown fields by default. Use
- message.DiscardUnknownFields() to drop unknown fields.
- * Add FieldDescriptor.file in generated code.
- * Add descriptor pool FindOneofByName in pure python.
- * Change unknown enum values into unknown field set .
- * Add more Python dict/list compatibility for Struct/ListValue.
- * Add utf-8 support for text_format.Merge()/Parse().
- * Support numeric unknown enum values for proto3 JSON format.
- * Add warning for Unexpected end-group tag in cpp extension.
-
- PHP
- * Proto3 messages are now preserving unknown fields.
- * Provide well known type messages in runtime.
- * Add prefix ‘PB’ to generated class of reserved names.
- * Fixed all conformance tests for encode/decode json in php runtime. C
- extension needs more work.
-
- Objective-C
- * Fixed some issues around copying of messages with unknown fields and then
- mutating the unknown fields in the copy.
-
- C#
- * Added unknown field support in JsonParser.
- * Fixed oneof message field merge.
- * Simplify parsing messages from array slices.
-
- Ruby
- * Unknown fields are now preserved by default.
- * Fixed several bugs for segment fault.
-
- Javascript
- * Decoder can handle both paced and unpacked data no matter how the proto is
- defined.
- * Decoder now accept long varint for 32 bit integers.
-
-
2017-08-14 version 3.4.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Planned Future Changes
* There are some changes that are not included in this release but are planned
@@ -284,9 +89,6 @@
* Added pretty-print filter to text format.
* Services and method descriptors are always printed even if generic_service
option is turned off.
- * Note: AppEngine 2.5 is deprecated on June 2017 that AppEngine 2.5 will
- never update protobuf runtime. Users who depend on AppEngine 2.5 should use
- old protoc.
PHP
* Support PHP generic services. Specify file option php_generic_service=true
diff --git a/third_party/protobuf/3.6.0/CONTRIBUTORS.txt b/third_party/protobuf/3.4.0/CONTRIBUTORS.txt
index b8d97fc23d..b8d97fc23d 100644
--- a/third_party/protobuf/3.6.0/CONTRIBUTORS.txt
+++ b/third_party/protobuf/3.4.0/CONTRIBUTORS.txt
diff --git a/third_party/protobuf/3.6.0/LICENSE b/third_party/protobuf/3.4.0/LICENSE
index 19b305b000..f028c82324 100644
--- a/third_party/protobuf/3.6.0/LICENSE
+++ b/third_party/protobuf/3.4.0/LICENSE
@@ -1,4 +1,14 @@
-Copyright 2008 Google Inc. All rights reserved.
+This license applies to all parts of Protocol Buffers except the following:
+
+ - Atomicops support for generic gcc, located in
+ src/google/protobuf/stubs/atomicops_internals_generic_gcc.h.
+ This file is copyrighted by Red Hat Inc.
+
+ - Atomicops support for AIX/POWER, located in
+ src/google/protobuf/stubs/atomicops_internals_power.h.
+ This file is copyrighted by Bloomberg Finance LP.
+
+Copyright 2014, Google Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
diff --git a/third_party/protobuf/3.6.0/Makefile.am b/third_party/protobuf/3.4.0/Makefile.am
index ae4ac858cd..52d7ce9d69 100644
--- a/third_party/protobuf/3.6.0/Makefile.am
+++ b/third_party/protobuf/3.4.0/Makefile.am
@@ -8,8 +8,8 @@ AUTOMAKE_OPTIONS = foreign
# the right time.
SUBDIRS = . src
-# Always include third_party directories in distributions.
-DIST_SUBDIRS = src conformance benchmarks third_party/googletest
+# Always include gmock in distributions.
+DIST_SUBDIRS = $(subdirs) src conformance benchmarks
# Build gmock before we build protobuf tests. We don't add gmock to SUBDIRS
# because then "make check" would also build and run all of gmock's own tests,
@@ -18,8 +18,8 @@ DIST_SUBDIRS = src conformance benchmarks third_party/googletest
# the installed version of gmock if there is one.
check-local:
@echo "Making lib/libgmock.a lib/libgmock_main.a in gmock"
- @cd third_party/googletest/googletest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la
- @cd third_party/googletest/googlemock && $(MAKE) $(AM_MAKEFLAGS) lib/libgmock.la lib/libgmock_main.la
+ @cd gmock && $(MAKE) $(AM_MAKEFLAGS) lib/libgmock.la lib/libgmock_main.la
+ @cd gmock/gtest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la
# We would like to clean gmock when "make clean" is invoked. But we have to
# be careful because clean-local is also invoked during "make distclean", but
@@ -28,9 +28,9 @@ check-local:
# cd to the directory again and "make clean" it will fail. So, check that the
# Makefile exists before recursing.
clean-local:
- @if test -e third_party/googletest/Makefile; then \
- echo "Making clean in googletest"; \
- cd third_party/googletest && $(MAKE) $(AM_MAKEFLAGS) clean; \
+ @if test -e gmock/Makefile; then \
+ echo "Making clean in gmock"; \
+ cd gmock && $(MAKE) $(AM_MAKEFLAGS) clean; \
fi; \
if test -e conformance/Makefile; then \
echo "Making clean in conformance"; \
@@ -61,13 +61,8 @@ csharp_EXTRA_DIST= \
csharp/keys/Google.Protobuf.public.snk \
csharp/keys/Google.Protobuf.snk \
csharp/keys/README.md \
- csharp/protos/README.md \
- csharp/protos/map_unittest_proto3.proto \
csharp/protos/unittest_custom_options_proto3.proto \
- csharp/protos/unittest_import_public_proto3.proto \
- csharp/protos/unittest_import_proto3.proto \
csharp/protos/unittest_issues.proto \
- csharp/protos/unittest_proto3.proto \
csharp/src/AddressBook/AddPerson.cs \
csharp/src/AddressBook/Addressbook.cs \
csharp/src/AddressBook/AddressBook.csproj \
@@ -84,7 +79,6 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs \
csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs \
csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs \
- csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs \
csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs \
csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs \
csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs \
@@ -98,13 +92,13 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs \
csharp/src/Google.Protobuf.Test/JsonParserTest.cs \
csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs \
+ csharp/src/Google.Protobuf.Test/Program.cs \
csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs \
csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs \
csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs \
csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs \
csharp/src/Google.Protobuf.Test/SampleEnum.cs \
csharp/src/Google.Protobuf.Test/SampleMessages.cs \
- csharp/src/Google.Protobuf.Test/SampleNaNs.cs \
csharp/src/Google.Protobuf.Test/TestCornerCases.cs \
csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs \
csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs \
@@ -120,19 +114,15 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs \
- csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs \
csharp/src/Google.Protobuf.sln \
csharp/src/Google.Protobuf/ByteArray.cs \
csharp/src/Google.Protobuf/ByteString.cs \
csharp/src/Google.Protobuf/CodedInputStream.cs \
csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs \
csharp/src/Google.Protobuf/CodedOutputStream.cs \
- csharp/src/Google.Protobuf/Collections/Lists.cs \
csharp/src/Google.Protobuf/Collections/MapField.cs \
- csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs \
csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs \
csharp/src/Google.Protobuf/Collections/RepeatedField.cs \
- csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs \
csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs \
csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs \
csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs \
@@ -198,9 +188,7 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs \
csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \
csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \
- csharp/src/Google.Protobuf/WireFormat.cs \
- csharp/src/Google.Protobuf/UnknownField.cs \
- csharp/src/Google.Protobuf/UnknownFieldSet.cs
+ csharp/src/Google.Protobuf/WireFormat.cs
java_EXTRA_DIST= \
java/README.md \
@@ -211,7 +199,6 @@ 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 \
@@ -238,7 +225,6 @@ java_EXTRA_DIST=
java/core/src/main/java/com/google/protobuf/IntArrayList.java \
java/core/src/main/java/com/google/protobuf/Internal.java \
java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \
- java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java \
java/core/src/main/java/com/google/protobuf/LazyField.java \
java/core/src/main/java/com/google/protobuf/LazyFieldLite.java \
java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java \
@@ -294,7 +280,6 @@ 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 \
@@ -347,14 +332,12 @@ java_EXTRA_DIST=
java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java \
java/core/src/test/java/com/google/protobuf/WireFormatTest.java \
java/core/src/test/proto/com/google/protobuf/any_test.proto \
- java/core/src/test/proto/com/google/protobuf/deprecated_file.proto \
java/core/src/test/proto/com/google/protobuf/field_presence_test.proto \
java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto \
java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto \
java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto \
java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto \
java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto \
- java/core/src/test/proto/com/google/protobuf/map_lite_test.proto \
java/core/src/test/proto/com/google/protobuf/map_test.proto \
java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto \
java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto \
@@ -370,7 +353,9 @@ java_EXTRA_DIST=
java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto \
java/core/src/test/proto/com/google/protobuf/test_custom_options.proto \
java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto \
- java/lite.md \
+ java/lite/generate-sources-build.xml \
+ java/lite/generate-test-sources-build.xml \
+ java/lite/pom.xml \
java/pom.xml \
java/util/pom.xml \
java/util/src/main/java/com/google/protobuf/util/Durations.java \
@@ -385,6 +370,45 @@ java_EXTRA_DIST=
java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java \
java/util/src/test/proto/com/google/protobuf/util/json_test.proto
+javanano_EXTRA_DIST= \
+ javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java \
+ javanano/src/main/java/com/google/protobuf/nano/FieldData.java \
+ javanano/src/main/java/com/google/protobuf/nano/FieldArray.java \
+ javanano/src/main/java/com/google/protobuf/nano/WireFormatNano.java \
+ javanano/src/main/java/com/google/protobuf/nano/Extension.java \
+ javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java \
+ javanano/src/main/java/com/google/protobuf/nano/UnknownFieldData.java \
+ javanano/src/main/java/com/google/protobuf/nano/MessageNano.java \
+ javanano/src/main/java/com/google/protobuf/nano/InternalNano.java \
+ javanano/src/main/java/com/google/protobuf/nano/InvalidProtocolBufferNanoException.java \
+ javanano/src/main/java/com/google/protobuf/nano/MapFactories.java \
+ javanano/src/main/java/com/google/protobuf/nano/ExtendableMessageNano.java \
+ javanano/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_accessors_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_reference_types_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_extension_repeated_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_has_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nameclash_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_single_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/NanoTest.java \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_simple_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_import_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_merge_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_extension_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_packables_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_extension_singular_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_recursive_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_extension_packed_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_enum_validity_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_stringutf8_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_multiple_nano.proto \
+ javanano/src/test/java/com/google/protobuf/nano/map_test.proto \
+ javanano/README.md \
+ javanano/pom.xml
+
objectivec_EXTRA_DIST= \
objectivec/DevTools/check_version_stamps.sh \
objectivec/DevTools/compile_testing_protos.sh \
@@ -457,13 +481,11 @@ objectivec_EXTRA_DIST= \
objectivec/GPBWireFormat.m \
objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj \
objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
- objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \
objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \
objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj \
objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
- objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \
objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \
@@ -501,31 +523,6 @@ objectivec_EXTRA_DIST= \
objectivec/Tests/GPBArrayTests.m \
objectivec/Tests/GPBCodedInputStreamTests.m \
objectivec/Tests/GPBCodedOuputStreamTests.m \
- objectivec/Tests/GPBCompileTest01.m \
- objectivec/Tests/GPBCompileTest02.m \
- objectivec/Tests/GPBCompileTest03.m \
- objectivec/Tests/GPBCompileTest04.m \
- objectivec/Tests/GPBCompileTest05.m \
- objectivec/Tests/GPBCompileTest06.m \
- objectivec/Tests/GPBCompileTest07.m \
- objectivec/Tests/GPBCompileTest08.m \
- objectivec/Tests/GPBCompileTest09.m \
- objectivec/Tests/GPBCompileTest10.m \
- objectivec/Tests/GPBCompileTest11.m \
- objectivec/Tests/GPBCompileTest12.m \
- objectivec/Tests/GPBCompileTest13.m \
- objectivec/Tests/GPBCompileTest14.m \
- objectivec/Tests/GPBCompileTest15.m \
- objectivec/Tests/GPBCompileTest16.m \
- objectivec/Tests/GPBCompileTest17.m \
- objectivec/Tests/GPBCompileTest18.m \
- objectivec/Tests/GPBCompileTest19.m \
- objectivec/Tests/GPBCompileTest20.m \
- objectivec/Tests/GPBCompileTest21.m \
- objectivec/Tests/GPBCompileTest22.m \
- objectivec/Tests/GPBCompileTest23.m \
- objectivec/Tests/GPBCompileTest24.m \
- objectivec/Tests/GPBCompileTest25.m \
objectivec/Tests/GPBConcurrencyTests.m \
objectivec/Tests/GPBDescriptorTests.m \
objectivec/Tests/GPBDictionaryTests+Bool.m \
@@ -552,6 +549,20 @@ objectivec_EXTRA_DIST= \
objectivec/Tests/GPBUtilitiesTests.m \
objectivec/Tests/GPBWellKnownTypesTest.m \
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/LaunchImage.launchimage/Contents.json \
+ objectivec/Tests/iOSTestHarness/Info.plist \
+ objectivec/Tests/iOSTestHarness/LaunchScreen.xib \
objectivec/Tests/text_format_map_unittest_data.txt \
objectivec/Tests/text_format_unittest_data.txt \
objectivec/Tests/unittest_cycle.proto \
@@ -573,140 +584,89 @@ objectivec_EXTRA_DIST= \
Protobuf.podspec
php_EXTRA_DIST= \
- composer.json \
- php/README.md \
- php/composer.json \
- php/ext/google/protobuf/array.c \
- php/ext/google/protobuf/config.m4 \
- php/ext/google/protobuf/def.c \
- php/ext/google/protobuf/encode_decode.c \
- php/ext/google/protobuf/map.c \
+ php/ext/google/protobuf/utf8.h \
php/ext/google/protobuf/message.c \
+ php/ext/google/protobuf/utf8.c \
php/ext/google/protobuf/package.xml \
- php/ext/google/protobuf/protobuf.c \
+ php/ext/google/protobuf/upb.h \
+ php/ext/google/protobuf/array.c \
+ php/ext/google/protobuf/encode_decode.c \
php/ext/google/protobuf/protobuf.h \
- php/ext/google/protobuf/storage.c \
php/ext/google/protobuf/type_check.c \
+ php/ext/google/protobuf/def.c \
+ php/ext/google/protobuf/storage.c \
+ php/ext/google/protobuf/map.c \
+ php/ext/google/protobuf/config.m4 \
php/ext/google/protobuf/upb.c \
- php/ext/google/protobuf/upb.h \
- php/ext/google/protobuf/utf8.c \
- php/ext/google/protobuf/utf8.h \
- php/generate_descriptor_protos.sh \
- php/phpunit.xml \
- php/src/GPBMetadata/Google/Protobuf/Any.php \
- php/src/GPBMetadata/Google/Protobuf/Api.php \
- php/src/GPBMetadata/Google/Protobuf/Duration.php \
- php/src/GPBMetadata/Google/Protobuf/FieldMask.php \
- php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php \
- php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php \
- php/src/GPBMetadata/Google/Protobuf/SourceContext.php \
- php/src/GPBMetadata/Google/Protobuf/Struct.php \
- php/src/GPBMetadata/Google/Protobuf/Timestamp.php \
- php/src/GPBMetadata/Google/Protobuf/Type.php \
- php/src/GPBMetadata/Google/Protobuf/Wrappers.php \
- php/src/Google/Protobuf/Any.php \
- php/src/Google/Protobuf/Api.php \
- php/src/Google/Protobuf/BoolValue.php \
- php/src/Google/Protobuf/BytesValue.php \
+ php/ext/google/protobuf/protobuf.c \
+ php/src/phpdoc.dist.xml \
php/src/Google/Protobuf/Descriptor.php \
php/src/Google/Protobuf/DescriptorPool.php \
- php/src/Google/Protobuf/DoubleValue.php \
- php/src/Google/Protobuf/Duration.php \
- php/src/Google/Protobuf/Enum.php \
php/src/Google/Protobuf/EnumDescriptor.php \
- php/src/Google/Protobuf/EnumValue.php \
php/src/Google/Protobuf/EnumValueDescriptor.php \
- php/src/Google/Protobuf/Field.php \
php/src/Google/Protobuf/FieldDescriptor.php \
- php/src/Google/Protobuf/FieldMask.php \
- php/src/Google/Protobuf/Field/Cardinality.php \
- php/src/Google/Protobuf/Field_Cardinality.php \
- php/src/Google/Protobuf/Field/Kind.php \
- php/src/Google/Protobuf/Field_Kind.php \
- php/src/Google/Protobuf/FloatValue.php \
- php/src/Google/Protobuf/GPBEmpty.php \
- php/src/Google/Protobuf/Int32Value.php \
- php/src/Google/Protobuf/Int64Value.php \
+ php/src/Google/Protobuf/OneofDescriptor.php \
php/src/Google/Protobuf/Internal/CodedInputStream.php \
php/src/Google/Protobuf/Internal/CodedOutputStream.php \
- php/src/Google/Protobuf/Internal/Descriptor.php \
php/src/Google/Protobuf/Internal/DescriptorPool.php \
+ php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php \
+ php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php \
php/src/Google/Protobuf/Internal/DescriptorProto.php \
- php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php \
- php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php \
+ php/src/Google/Protobuf/Internal/Descriptor.php \
php/src/Google/Protobuf/Internal/EnumBuilderContext.php \
php/src/Google/Protobuf/Internal/EnumDescriptor.php \
php/src/Google/Protobuf/Internal/EnumDescriptorProto.php \
- php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php \
php/src/Google/Protobuf/Internal/EnumOptions.php \
php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php \
php/src/Google/Protobuf/Internal/EnumValueOptions.php \
- php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php \
+ php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php \
php/src/Google/Protobuf/Internal/FieldDescriptorProto.php \
php/src/Google/Protobuf/Internal/FieldDescriptor.php \
- php/src/Google/Protobuf/Internal/FieldDescriptorProto.php \
- php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php \
- php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php \
+ php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php \
+ php/src/Google/Protobuf/Internal/FieldOptions_CType.php \
+ php/src/Google/Protobuf/Internal/FieldOptions_JSType.php \
php/src/Google/Protobuf/Internal/FieldOptions.php \
- php/src/Google/Protobuf/Internal/FieldOptions/CType.php \
- php/src/Google/Protobuf/Internal/FieldOptions/JSType.php \
- php/src/Google/Protobuf/Internal/FileDescriptor.php \
php/src/Google/Protobuf/Internal/FileDescriptorProto.php \
php/src/Google/Protobuf/Internal/FileDescriptorSet.php \
+ php/src/Google/Protobuf/Internal/FileDescriptor.php \
+ php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php \
php/src/Google/Protobuf/Internal/FileOptions.php \
- php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php \
+ php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php \
+ php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php \
+ php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php \
php/src/Google/Protobuf/Internal/GPBDecodeException.php \
php/src/Google/Protobuf/Internal/GPBJsonWire.php \
php/src/Google/Protobuf/Internal/GPBLabel.php \
php/src/Google/Protobuf/Internal/GPBType.php \
php/src/Google/Protobuf/Internal/GPBUtil.php \
- php/src/Google/Protobuf/Internal/GPBWire.php \
php/src/Google/Protobuf/Internal/GPBWireType.php \
- php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php \
- php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php \
- php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php \
+ php/src/Google/Protobuf/Internal/GPBWire.php \
php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php \
php/src/Google/Protobuf/Internal/MapEntry.php \
- php/src/Google/Protobuf/Internal/MapField.php \
php/src/Google/Protobuf/Internal/MapFieldIter.php \
- php/src/Google/Protobuf/Internal/Message.php \
+ php/src/Google/Protobuf/Internal/MapField.php \
php/src/Google/Protobuf/Internal/MessageBuilderContext.php \
php/src/Google/Protobuf/Internal/MessageOptions.php \
+ php/src/Google/Protobuf/Internal/Message.php \
php/src/Google/Protobuf/Internal/MethodDescriptorProto.php \
+ php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php \
php/src/Google/Protobuf/Internal/MethodOptions.php \
- php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php \
- php/src/Google/Protobuf/Internal/OneofDescriptor.php \
php/src/Google/Protobuf/Internal/OneofDescriptorProto.php \
+ php/src/Google/Protobuf/Internal/OneofDescriptor.php \
php/src/Google/Protobuf/Internal/OneofField.php \
php/src/Google/Protobuf/Internal/OneofOptions.php \
php/src/Google/Protobuf/Internal/RawInputStream.php \
- php/src/Google/Protobuf/Internal/RepeatedField.php \
php/src/Google/Protobuf/Internal/RepeatedFieldIter.php \
+ php/src/Google/Protobuf/Internal/RepeatedField.php \
php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php \
php/src/Google/Protobuf/Internal/ServiceOptions.php \
+ php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php \
php/src/Google/Protobuf/Internal/SourceCodeInfo.php \
- php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php \
+ php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php \
php/src/Google/Protobuf/Internal/UninterpretedOption.php \
- php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php \
- php/src/Google/Protobuf/ListValue.php \
- php/src/Google/Protobuf/Method.php \
- php/src/Google/Protobuf/Mixin.php \
- php/src/Google/Protobuf/NullValue.php \
- php/src/Google/Protobuf/OneofDescriptor.php \
- php/src/Google/Protobuf/Option.php \
- php/src/Google/Protobuf/SourceContext.php \
- php/src/Google/Protobuf/StringValue.php \
- php/src/Google/Protobuf/Struct.php \
- php/src/Google/Protobuf/Syntax.php \
- php/src/Google/Protobuf/Timestamp.php \
- php/src/Google/Protobuf/Type.php \
- php/src/Google/Protobuf/UInt32Value.php \
- php/src/Google/Protobuf/UInt64Value.php \
- php/src/Google/Protobuf/Value.php \
- php/src/phpdoc.dist.xml \
+ php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php \
php/tests/array_test.php \
php/tests/autoload.php \
- php/tests/bootstrap_phpunit.php \
php/tests/compatibility_test.sh \
php/tests/descriptors_test.php \
php/tests/encode_decode_test.php \
@@ -717,34 +677,31 @@ php_EXTRA_DIST= \
php/tests/map_field_test.php \
php/tests/memory_leak_test.php \
php/tests/php_implementation_test.php \
- php/tests/proto/empty/echo.proto \
- php/tests/proto/test.proto \
php/tests/proto/test_descriptors.proto \
php/tests/proto/test_empty_php_namespace.proto \
php/tests/proto/test_import_descriptor_proto.proto \
php/tests/proto/test_include.proto \
+ php/tests/proto/test.proto \
php/tests/proto/test_no_namespace.proto \
php/tests/proto/test_php_namespace.proto \
php/tests/proto/test_prefix.proto \
- php/tests/proto/test_reserved_enum_lower.proto \
- php/tests/proto/test_reserved_enum_upper.proto \
- php/tests/proto/test_reserved_enum_value_lower.proto \
- php/tests/proto/test_reserved_enum_value_upper.proto \
- php/tests/proto/test_reserved_message_lower.proto \
- php/tests/proto/test_reserved_message_upper.proto \
php/tests/proto/test_service.proto \
php/tests/proto/test_service_namespace.proto \
php/tests/test.sh \
php/tests/test_base.php \
php/tests/test_util.php \
+ php/tests/well_known_test.php \
php/tests/undefined_test.php \
- php/tests/well_known_test.php
+ php/README.md \
+ php/composer.json \
+ php/generate_descriptor_protos.sh \
+ php/phpunit.xml \
+ composer.json
python_EXTRA_DIST= \
python/MANIFEST.in \
python/google/__init__.py \
python/google/protobuf/__init__.py \
- python/google/protobuf/compiler/__init__.py \
python/google/protobuf/descriptor.py \
python/google/protobuf/descriptor_database.py \
python/google/protobuf/descriptor_pool.py \
@@ -779,7 +736,6 @@ python_EXTRA_DIST= \
python/google/protobuf/internal/more_extensions.proto \
python/google/protobuf/internal/more_extensions_dynamic.proto \
python/google/protobuf/internal/more_messages.proto \
- python/google/protobuf/internal/no_package.proto \
python/google/protobuf/internal/packed_field_test.proto \
python/google/protobuf/internal/proto_builder_test.py \
python/google/protobuf/internal/python_message.py \
@@ -833,14 +789,12 @@ python_EXTRA_DIST= \
python/google/protobuf/pyext/repeated_scalar_container.h \
python/google/protobuf/pyext/safe_numerics.h \
python/google/protobuf/pyext/scoped_pyobject_ptr.h \
- python/google/protobuf/pyext/thread_unsafe_shared_ptr.h \
python/google/protobuf/reflection.py \
python/google/protobuf/service.py \
python/google/protobuf/service_reflection.py \
python/google/protobuf/symbol_database.py \
python/google/protobuf/text_encoding.py \
python/google/protobuf/text_format.py \
- python/google/protobuf/util/__init__.py \
python/release.sh \
python/mox.py \
python/setup.cfg \
@@ -900,13 +854,10 @@ ruby_EXTRA_DIST= \
ruby/src/main/java/google/ProtobufJavaService.java \
ruby/src/main/sentinel.proto \
ruby/tests/basic.rb \
- ruby/tests/encode_decode_test.rb \
- ruby/tests/gc_test.rb \
ruby/tests/repeated_field_test.rb \
ruby/tests/stress.rb \
ruby/tests/generated_code.proto \
ruby/tests/test_import.proto \
- ruby/tests/test_ruby_package.proto \
ruby/tests/generated_code_test.rb \
ruby/tests/well_known_types_test.rb \
ruby/travis-test.sh
@@ -1008,7 +959,7 @@ js_EXTRA_DIST= \
js/testbinary.proto \
js/testempty.proto
-all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(php_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) $(js_EXTRA_DIST)
+all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(javanano_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(php_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) $(js_EXTRA_DIST)
EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
autogen.sh \
@@ -1019,6 +970,7 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
CHANGES.txt \
update_file_lists.sh \
BUILD \
+ gmock.BUILD \
WORKSPACE \
cmake/CMakeLists.txt \
cmake/README.md \
@@ -1030,29 +982,26 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
cmake/libprotoc.cmake \
cmake/protobuf-config-version.cmake.in \
cmake/protobuf-config.cmake.in \
- cmake/protobuf-lite.pc.cmake \
cmake/protobuf-module.cmake.in \
cmake/protobuf-options.cmake \
- cmake/protobuf.pc.cmake \
cmake/protoc.cmake \
cmake/tests.cmake \
editors/README.txt \
editors/proto.vim \
editors/protobuf-mode.el \
- examples/AddPerson.java \
- examples/BUILD \
examples/CMakeLists.txt \
- examples/ListPeople.java \
+ examples/README.txt \
examples/Makefile \
- examples/README.md \
- examples/WORKSPACE \
+ examples/addressbook.proto \
examples/add_person.cc \
examples/add_person.go \
- examples/add_person.py \
examples/add_person_test.go \
- examples/addressbook.proto \
examples/list_people.cc \
examples/list_people.go \
+ examples/AddPerson.java \
+ examples/CMakeLists.txt \
+ examples/ListPeople.java \
+ examples/add_person.py \
examples/list_people.py \
examples/list_people_test.go \
protobuf.bzl \
diff --git a/third_party/protobuf/3.6.0/Protobuf.podspec b/third_party/protobuf/3.4.0/Protobuf.podspec
index b5bb673ee1..88bd5b7d72 100644
--- a/third_party/protobuf/3.6.0/Protobuf.podspec
+++ b/third_party/protobuf/3.4.0/Protobuf.podspec
@@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
- s.version = '3.6.0'
+ s.version = '3.4.0'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/google/protobuf'
s.license = '3-Clause BSD License'
diff --git a/third_party/protobuf/3.4.0/README.md b/third_party/protobuf/3.4.0/README.md
new file mode 100644
index 0000000000..653f663276
--- /dev/null
+++ b/third_party/protobuf/3.4.0/README.md
@@ -0,0 +1,78 @@
+Protocol Buffers - Google's data interchange format
+===================================================
+
+[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf) [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) [![Build Status](https://grpc-testing.appspot.com/buildStatus/icon?job=protobuf_branch)](https://grpc-testing.appspot.com/job/protobuf_branch) [![Build Status](https://grpc-testing.appspot.com/job/protobuf_branch_32/badge/icon)](https://grpc-testing.appspot.com/job/protobuf_branch_32) [![Build Status](http://ci.bazel.io/buildStatus/icon?job=protobuf)](http://ci.bazel.io/job/protobuf/)
+
+Copyright 2008 Google Inc.
+
+https://developers.google.com/protocol-buffers/
+
+Overview
+--------
+
+Protocol Buffers (a.k.a., protobuf) are Google's language-neutral,
+platform-neutral, extensible mechanism for serializing structured data. You
+can find [protobuf's documentation on the Google Developers site](https://developers.google.com/protocol-buffers/).
+
+This README file contains protobuf installation instructions. To install
+protobuf, you need to install the protocol compiler (used to compile .proto
+files) and the protobuf runtime for your chosen programming language.
+
+Protocol Compiler Installation
+------------------------------
+
+The protocol compiler is written in C++. If you are using C++, please follow
+the [C++ Installation Instructions](src/README.md) to install protoc along
+with the C++ runtime.
+
+For non-C++ users, the simplest way to install the protocol compiler is to
+download a pre-built binary from our release page:
+
+ [https://github.com/google/protobuf/releases](https://github.com/google/protobuf/releases)
+
+In the downloads section of each release, you can find pre-built binaries in
+zip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binary
+as well as a set of standard .proto files distributed along with protobuf.
+
+If you are looking for an old version that is not available in the release
+page, check out the maven repo here:
+
+ [https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/)
+
+These pre-built binaries are only provided for released versions. If you want
+to use the github master version at HEAD, or you need to modify protobuf code,
+or you are using C++, it's recommended to build your own protoc binary from
+source.
+
+If you would like to build protoc binary from source, see the [C++ Installation
+Instructions](src/README.md).
+
+Protobuf Runtime Installation
+-----------------------------
+
+Protobuf supports several different programming languages. For each programming
+language, you can find instructions in the corresponding source directory about
+how to install protobuf runtime for that specific language:
+
+| Language | Source |
+|--------------------------------------|-------------------------------------------------------------|
+| C++ (include C++ runtime and protoc) | [src](src) |
+| Java | [java](java) |
+| Python | [python](python) |
+| Objective-C | [objectivec](objectivec) |
+| C# | [csharp](csharp) |
+| JavaNano | [javanano](javanano) |
+| JavaScript | [js](js) |
+| Ruby | [ruby](ruby) |
+| Go | [golang/protobuf](https://github.com/golang/protobuf) |
+| PHP | [php](php) |
+| Dart | [dart-lang/protobuf](https://github.com/dart-lang/protobuf) |
+
+
+Usage
+-----
+
+The complete documentation for Protocol Buffers is available via the
+web at:
+
+https://developers.google.com/protocol-buffers/
diff --git a/third_party/protobuf/3.6.0/WORKSPACE b/third_party/protobuf/3.4.0/WORKSPACE
index 06a8a84166..2a49e3723a 100644
--- a/third_party/protobuf/3.6.0/WORKSPACE
+++ b/third_party/protobuf/3.4.0/WORKSPACE
@@ -1,9 +1,8 @@
-workspace(name = "com_google_protobuf")
-
-new_local_repository(
- name = "submodule_gmock",
- path = "third_party/googletest",
- build_file = "third_party/googletest/BUILD.bazel"
+new_git_repository(
+ name = "googletest",
+ build_file = "gmock.BUILD",
+ remote = "https://github.com/google/googletest",
+ tag = "release-1.8.0",
)
new_http_archive(
@@ -20,12 +19,12 @@ bind(
bind(
name = "gtest",
- actual = "@submodule_gmock//:gtest",
+ actual = "@googletest//:gtest",
)
bind(
name = "gtest_main",
- actual = "@submodule_gmock//:gtest_main",
+ actual = "@googletest//:gtest_main",
)
bind(
diff --git a/third_party/protobuf/3.6.0/appveyor.bat b/third_party/protobuf/3.4.0/appveyor.bat
index e59ebccc2a..ca88b25c3e 100644
--- a/third_party/protobuf/3.6.0/appveyor.bat
+++ b/third_party/protobuf/3.4.0/appveyor.bat
@@ -26,8 +26,8 @@ dotnet restore
dotnet build -c %configuration% || goto error
echo Testing C#
-dotnet test -c %configuration% -f netcoreapp1.0 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
-dotnet test -c %configuration% -f net451 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
+dotnet run -c %configuration% -f netcoreapp1.0 -p Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
+dotnet run -c %configuration% -f net451 -p Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
goto :EOF
diff --git a/third_party/protobuf/3.6.0/appveyor.yml b/third_party/protobuf/3.4.0/appveyor.yml
index 02e0d31356..8b440b6396 100644
--- a/third_party/protobuf/3.6.0/appveyor.yml
+++ b/third_party/protobuf/3.4.0/appveyor.yml
@@ -10,7 +10,6 @@ configuration:
environment:
matrix:
- language: cpp
- image: Visual Studio 2015
BUILD_DLL: ON
UNICODE: ON
@@ -22,11 +21,19 @@ environment:
test: off
install:
- - git submodule update --init --recursive
+ - curl -L -o release-1.7.0.zip https://github.com/google/googlemock/archive/release-1.7.0.zip
+ - 7z x release-1.7.0.zip
+ - del /Q release-1.7.0.zip
+ - rename googlemock-release-1.7.0 gmock
+ - curl -L -o release-1.7.0.zip "https://github.com/google/googletest/archive/release-1.7.0.zip"
+ - 7z x release-1.7.0.zip
+ - del /Q release-1.7.0.zip
+ - rename googletest-release-1.7.0 gtest
+ - move gtest gmock
before_build:
- - if %platform%==Win32 set generator=Visual Studio 14
- - if %platform%==Win64 set generator=Visual Studio 14 Win64
+ - if %platform%==Win32 set generator=Visual Studio 12
+ - if %platform%==Win64 set generator=Visual Studio 12 Win64
- if %platform%==Win32 set vcplatform=Win32
- if %platform%==Win64 set vcplatform=x64
diff --git a/third_party/protobuf/3.6.0/autogen.sh b/third_party/protobuf/3.4.0/autogen.sh
index 580714b9a5..9f26642585 100644..100755
--- a/third_party/protobuf/3.6.0/autogen.sh
+++ b/third_party/protobuf/3.4.0/autogen.sh
@@ -17,6 +17,7 @@ if [ ! -z "$@" ]; then
done
fi
+
# Check that we're being run from the right directory.
if test ! -f src/google/protobuf/stubs/common.h; then
cat >&2 << __EOF__
@@ -26,6 +27,21 @@ __EOF__
exit 1
fi
+# Check that gmock is present. Usually it is already there since the
+# directory is set up as an SVN external.
+if test ! -e gmock; then
+ echo "Google Mock not present. Fetching gmock-1.7.0 from the web..."
+ curl $curlopts -L -O https://github.com/google/googlemock/archive/release-1.7.0.zip
+ unzip -q release-1.7.0.zip
+ rm release-1.7.0.zip
+ mv googlemock-release-1.7.0 gmock
+
+ curl $curlopts -L -O https://github.com/google/googletest/archive/release-1.7.0.zip
+ unzip -q release-1.7.0.zip
+ rm release-1.7.0.zip
+ mv googletest-release-1.7.0 gmock/gtest
+fi
+
set -ex
# TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings.
diff --git a/third_party/protobuf/3.4.0/benchmarks/Makefile.am b/third_party/protobuf/3.4.0/benchmarks/Makefile.am
new file mode 100644
index 0000000000..d98eae5ead
--- /dev/null
+++ b/third_party/protobuf/3.4.0/benchmarks/Makefile.am
@@ -0,0 +1,78 @@
+
+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
+
+if USE_EXTERNAL_PROTOC
+
+protoc_middleman: $(benchmarks_protoc_inputs)
+ $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. $(benchmarks_protoc_inputs)
+ touch protoc_middleman
+
+protoc_middleman2: $(benchmarks_protoc_inputs_proto2)
+ $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. $(benchmarks_protoc_inputs_proto2)
+ touch protoc_middleman2
+
+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) )
+ touch protoc_middleman
+
+endif
diff --git a/third_party/protobuf/3.4.0/benchmarks/ProtoBench.java b/third_party/protobuf/3.4.0/benchmarks/ProtoBench.java
new file mode 100644
index 0000000000..86d62feb67
--- /dev/null
+++ b/third_party/protobuf/3.4.0/benchmarks/ProtoBench.java
@@ -0,0 +1,203 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2009 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protocolbuffers;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+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;
+
+public class ProtoBench {
+
+ private static final long MIN_SAMPLE_TIME_MS = 2 * 1000;
+ private static final long TARGET_TIME_MS = 30 * 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.)");
+ System.exit(1);
+ }
+ boolean success = true;
+ for (int i = 0; i < args.length; i += 2) {
+ success &= runTest(args[i], args[i + 1]);
+ }
+ System.exit(success ? 0 : 1);
+ }
+
+ /**
+ * 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);
+ final Message defaultMessage;
+ 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);
+ return false;
+ }
+
+ 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();
+ FileOutputStream devNullTemp = null;
+ CodedOutputStream reuseDevNullTemp = null;
+ try {
+ devNullTemp = new FileOutputStream("/dev/null");
+ reuseDevNullTemp = CodedOutputStream.newInstance(devNullTemp);
+ } catch (FileNotFoundException e) {
+ // ignore: this is probably Windows, where /dev/null does not exist
+ }
+ 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());
+ }
+ });
+ 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("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();
+ }
+ });
+ System.out.println();
+ return true;
+ } catch (Exception e) {
+ System.err.println("Error: " + e.getMessage());
+ System.err.println("Detailed exception information:");
+ e.printStackTrace(System.err);
+ return false;
+ }
+ }
+
+ private static void benchmark(String name, long dataSize, Action action) throws IOException {
+ // Make sure it's JITted "reasonably" hard before running the first progress test
+ for (int i=0; i < 100; i++) {
+ action.execute();
+ }
+
+ // Run it progressively more times until we've got a reasonable sample
+ int iterations = 1;
+ long elapsed = timeAction(action, iterations);
+ while (elapsed < MIN_SAMPLE_TIME_MS) {
+ iterations *= 2;
+ elapsed = timeAction(action, iterations);
+ }
+
+ // Upscale the sample to the target time. Do this in floating point arithmetic
+ // to avoid overflow issues.
+ iterations = (int) ((TARGET_TIME_MS / (double) elapsed) * iterations);
+ elapsed = timeAction(action, iterations);
+ System.out.println(name + ": " + iterations + " iterations in "
+ + (elapsed/1000f) + "s; "
+ + (iterations * dataSize) / (elapsed * 1024 * 1024 / 1000f)
+ + "MB/s");
+ }
+
+ private static long timeAction(Action action, int iterations) throws IOException {
+ System.gc();
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < iterations; i++) {
+ action.execute();
+ }
+ long end = System.currentTimeMillis();
+ return end - start;
+ }
+
+ private static byte[] readAllBytes(String filename) throws IOException {
+ RandomAccessFile file = new RandomAccessFile(new File(filename), "r");
+ byte[] content = new byte[(int) file.length()];
+ file.readFully(content);
+ return content;
+ }
+
+ /**
+ * Interface used to capture a single action to benchmark.
+ */
+ interface Action {
+ void execute() throws IOException;
+ }
+}
diff --git a/third_party/protobuf/3.4.0/benchmarks/README.md b/third_party/protobuf/3.4.0/benchmarks/README.md
new file mode 100644
index 0000000000..c902780582
--- /dev/null
+++ b/third_party/protobuf/3.4.0/benchmarks/README.md
@@ -0,0 +1,28 @@
+
+# Protocol Buffers Benchmarks
+
+This directory contains benchmarking schemas and data sets that you
+can use to test a variety of performance scenarios against your
+protobuf language runtime.
+
+The schema for the datasets is described in `benchmarks.proto`.
+
+Generate the data sets like so:
+
+```
+$ make
+$ ./generate-datasets
+Wrote dataset: dataset.google_message1_proto3.pb
+Wrote dataset: dataset.google_message1_proto2.pb
+Wrote dataset: dataset.google_message2.pb
+$
+```
+
+Each data set will be written to its own file. Benchmarks will
+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
+that make the overall suite diverse without being too large or having
+too many similar tests. Ideally everyone can run through the entire
+suite without the test run getting too long.
diff --git a/third_party/protobuf/3.4.0/benchmarks/benchmark_messages_proto2.proto b/third_party/protobuf/3.4.0/benchmarks/benchmark_messages_proto2.proto
new file mode 100644
index 0000000000..590855033c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/benchmarks/benchmark_messages_proto2.proto
@@ -0,0 +1,143 @@
+// 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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto b/third_party/protobuf/3.4.0/benchmarks/benchmark_messages_proto3.proto
index 090b554be9..090b554be9 100644
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto
+++ b/third_party/protobuf/3.4.0/benchmarks/benchmark_messages_proto3.proto
diff --git a/third_party/protobuf/3.6.0/benchmarks/benchmarks.proto b/third_party/protobuf/3.4.0/benchmarks/benchmarks.proto
index 51c0b54877..51c0b54877 100644
--- a/third_party/protobuf/3.6.0/benchmarks/benchmarks.proto
+++ b/third_party/protobuf/3.4.0/benchmarks/benchmarks.proto
diff --git a/third_party/protobuf/3.6.0/benchmarks/cpp/cpp_benchmark.cc b/third_party/protobuf/3.4.0/benchmarks/cpp_benchmark.cc
index f8b552917f..0e6febc2f1 100644
--- a/third_party/protobuf/3.6.0/benchmarks/cpp/cpp_benchmark.cc
+++ b/third_party/protobuf/3.4.0/benchmarks/cpp_benchmark.cc
@@ -28,16 +28,13 @@
// (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 <glob.h>
#include <iostream>
+#include <fstream>
#include "benchmark/benchmark_api.h"
#include "benchmarks.pb.h"
-#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h"
-#include "datasets/google_message1/proto3/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"
-
+#include "benchmark_messages_proto2.pb.h"
+#include "benchmark_messages_proto3.pb.h"
#define PREFIX "dataset."
#define SUFFIX ".pb"
@@ -121,10 +118,9 @@ class ParseNewArenaFixture : public Fixture {
virtual void BenchmarkCase(benchmark::State& state) {
WrappingCounter i(payloads_.size());
size_t total = 0;
- Arena arena;
while (state.KeepRunning()) {
- arena.Reset();
+ Arena arena;
Message* m = Arena::CreateMessage<T>(&arena);
const std::string& payload = payloads_[i.Next()];
total += payload.size();
@@ -223,14 +219,6 @@ 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);
@@ -238,17 +226,17 @@ void RegisterBenchmarks(const std::string& dataset_bytes) {
}
int main(int argc, char *argv[]) {
- ::benchmark::Initialize(&argc, argv);
- 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;
+ glob_t glob_result;
+ if (glob("dataset.*.pb", 0, NULL, &glob_result) != 0) {
+ fprintf(stderr, "No dataset files found.\n");
return 1;
- } else {
- for (int i = 1; i < argc; i++) {
- RegisterBenchmarks(ReadFile(argv[i]));
- }
}
+ 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]));
+ }
+
+ ::benchmark::Initialize(&argc, argv);
::benchmark::RunSpecifiedBenchmarks();
}
diff --git a/third_party/protobuf/3.4.0/benchmarks/generate_datasets.cc b/third_party/protobuf/3.4.0/benchmarks/generate_datasets.cc
new file mode 100644
index 0000000000..61e7adf1ba
--- /dev/null
+++ b/third_party/protobuf/3.4.0/benchmarks/generate_datasets.cc
@@ -0,0 +1,117 @@
+// 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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto2/dataset.google_message1_proto2.pb b/third_party/protobuf/3.4.0/benchmarks/google_message1.dat
index f6fe7848cb..bc0f064cc2 100644
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto2/dataset.google_message1_proto2.pb
+++ b/third_party/protobuf/3.4.0/benchmarks/google_message1.dat
Binary files differ
diff --git a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message2/dataset.google_message2.pb b/third_party/protobuf/3.4.0/benchmarks/google_message2.dat
index 3fa0e49e57..06c09441b9 100644
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message2/dataset.google_message2.pb
+++ b/third_party/protobuf/3.4.0/benchmarks/google_message2.dat
Binary files differ
diff --git a/third_party/protobuf/3.6.0/benchmarks/google_size.proto b/third_party/protobuf/3.4.0/benchmarks/google_size.proto
index d2d319f31c..d2d319f31c 100644
--- a/third_party/protobuf/3.6.0/benchmarks/google_size.proto
+++ b/third_party/protobuf/3.4.0/benchmarks/google_size.proto
diff --git a/third_party/protobuf/3.4.0/benchmarks/readme.txt b/third_party/protobuf/3.4.0/benchmarks/readme.txt
new file mode 100644
index 0000000000..b08b8bc09c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/benchmarks/readme.txt
@@ -0,0 +1,46 @@
+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/third_party/protobuf/3.6.0/cmake/CMakeLists.txt b/third_party/protobuf/3.4.0/cmake/CMakeLists.txt
index 02174e96aa..7618ba21a1 100644
--- a/third_party/protobuf/3.6.0/cmake/CMakeLists.txt
+++ b/third_party/protobuf/3.4.0/cmake/CMakeLists.txt
@@ -1,5 +1,5 @@
# Minimum CMake required
-cmake_minimum_required(VERSION 3.1.3)
+cmake_minimum_required(VERSION 2.8.12)
if(protobuf_VERBOSE)
message(STATUS "Protocol Buffers Configuring...")
@@ -8,26 +8,12 @@ endif()
# CMake policies
cmake_policy(SET CMP0022 NEW)
-if(POLICY CMP0048)
- cmake_policy(SET CMP0048 NEW)
-endif()
-
# Project
project(protobuf C CXX)
-# Add c++11 flags
-if (CYGWIN)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
-else()
- set(CMAKE_CXX_STANDARD 11)
- set(CMAKE_CXX_STANDARD_REQUIRED ON)
- set(CMAKE_CXX_EXTENSIONS OFF)
-endif()
-
# 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)
@@ -37,7 +23,11 @@ option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHAR
include(CMakeDependentOption)
cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON
"NOT protobuf_BUILD_SHARED_LIBS" OFF)
-set(protobuf_WITH_ZLIB_DEFAULT ON)
+if (MSVC)
+ set(protobuf_WITH_ZLIB_DEFAULT OFF)
+else (MSVC)
+ set(protobuf_WITH_ZLIB_DEFAULT ON)
+endif (MSVC)
option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT})
set(protobuf_DEBUG_POSTFIX "d"
CACHE STRING "Default debug postfix")
@@ -145,31 +135,12 @@ endif (protobuf_BUILD_SHARED_LIBS)
if (MSVC)
# Build with multiple processes
add_definitions(/MP)
- # MSVC warning suppressions
- add_definitions(
- /wd4018 # 'expression' : signed/unsigned mismatch
- /wd4065 # switch statement contains 'default' but no 'case' labels
- /wd4146 # unary minus operator applied to unsigned type, result still unsigned
- /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
- /wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
- /wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
- /wd4305 # 'identifier' : truncation from 'type1' to 'type2'
- /wd4307 # 'operator' : integral constant overflow
- /wd4309 # 'conversion' : truncation of constant value
- /wd4334 # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
- /wd4355 # 'this' : used in base member initializer list
- /wd4506 # no definition for inline function 'function'
- /wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning)
- /wd4996 # The compiler encountered a deprecated declaration.
- )
+ add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305 /wd4309)
# Allow big object
add_definitions(/bigobj)
string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR})
string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR})
configure_file(extract_includes.bat.in extract_includes.bat)
-
- # Suppress linker warnings about files with no symbols defined.
- set(CMAKE_STATIC_LINKER_FLAGS /ignore:4221)
endif (MSVC)
get_filename_component(protobuf_source_dir ${protobuf_SOURCE_DIR} PATH)
@@ -194,10 +165,8 @@ endif (protobuf_UNICODE)
include(libprotobuf-lite.cmake)
include(libprotobuf.cmake)
-if (protobuf_BUILD_PROTOC_BINARIES)
- include(libprotoc.cmake)
- include(protoc.cmake)
-endif (protobuf_BUILD_PROTOC_BINARIES)
+include(libprotoc.cmake)
+include(protoc.cmake)
if (protobuf_BUILD_TESTS)
include(tests.cmake)
diff --git a/third_party/protobuf/3.6.0/cmake/README.md b/third_party/protobuf/3.4.0/cmake/README.md
index 26a516c7dd..1e7410d828 100644
--- a/third_party/protobuf/3.6.0/cmake/README.md
+++ b/third_party/protobuf/3.4.0/cmake/README.md
@@ -41,16 +41,9 @@ Good. Now you are ready to continue.
Getting Sources
===============
-You can get the latest stable source packages from the release page:
-
- https://github.com/google/protobuf/releases/latest
-
-For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if
-you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package
-contains C++ source already); if you need C++ and multiple other languages,
-download `protobuf-all-[VERSION].tar.gz`.
-
-Or you can use git to clone from protobuf git repository.
+You can get the latest stable source packages from the
+[releases](https://github.com/google/protobuf/releases) page.
+Or you can type:
C:\Path\to> git clone -b [release_tag] https://github.com/google/protobuf.git
@@ -62,16 +55,26 @@ Go to the project folder:
C:\Path\to>cd protobuf
C:\Path\to\protobuf>
-Remember to update any submodules if you are using git clone (you can skip this
-step if you are using a release .tar.gz or .zip package):
+Protobuf unit-tests require gmock to build. If you download protobuf source code
+from the *releases* page, the *gmock* directory should already be there. If you checkout
+the code via `git clone`, this *gmock* directory won't exist and you will have to
+download it manually or skip building protobuf unit-tests.
+
+You can download gmock as follows:
-```console
-C:\Path\to> git submodule update --init --recursive
-```
+ C:\Path\to\protobuf>git clone -b release-1.7.0 https://github.com/google/googlemock.git gmock
+
+Then go to *gmock* folder and download gtest:
+
+ C:\Path\to\protobuf>cd gmock
+ C:\Path\to\protobuf\gmock>git clone -b release-1.7.0 https://github.com/google/googletest.git gtest
+
+If you absolutely don't want to build and run protobuf unit-tests, skip
+this steps and use protobuf at your own risk.
Now go to *cmake* folder in protobuf sources:
- C:\Path\to\protobuf>cd cmake
+ C:\Path\to\protobuf\gmock>cd ..\cmake
C:\Path\to\protobuf\cmake>
Good. Now you are ready to *CMake* configuration.
@@ -121,7 +124,7 @@ It will generate *nmake* *Makefile* in current directory.
To create *Visual Studio* solution file:
C:\Path\to\protobuf\cmake\build>mkdir solution & cd solution
- C:\Path\to\protobuf\cmake\build\solution>cmake -G "Visual Studio 14 2015 Win64" ^
+ C:\Path\to\protobuf\cmake\build\solution>cmake -G "Visual Studio 12 2013 Win64" ^
-DCMAKE_INSTALL_PREFIX=../../../../install ^
../..
@@ -299,11 +302,6 @@ further disable the option `-Dprotobuf_MSVC_STATIC_RUNTIME=OFF`.
If it reports NOTFOUND for zlib_include or zlib_lib, you might haven't put
the headers or the .lib file in the right directory.
-If you already have ZLIB library and headers at some other location on your system then alternatively you can define following configuration flags to locate them:
-
- -DZLIB_INCLUDE_DIR=<path to dir containing zlib headers>
- -DZLIB_LIB=<path to dir containing zlib>
-
Build and testing protobuf as usual.
Notes on Compiler Warnings
diff --git a/third_party/protobuf/3.6.0/cmake/examples.cmake b/third_party/protobuf/3.4.0/cmake/examples.cmake
index e5cad63f67..e5cad63f67 100644
--- a/third_party/protobuf/3.6.0/cmake/examples.cmake
+++ b/third_party/protobuf/3.4.0/cmake/examples.cmake
diff --git a/third_party/protobuf/3.6.0/cmake/extract_includes.bat.in b/third_party/protobuf/3.4.0/cmake/extract_includes.bat.in
index 9fd9de0dae..deb6de3bfb 100644
--- a/third_party/protobuf/3.6.0/cmake/extract_includes.bat.in
+++ b/third_party/protobuf/3.4.0/cmake/extract_includes.bat.in
@@ -5,6 +5,7 @@ mkdir include\google\protobuf\compiler
mkdir include\google\protobuf\compiler\cpp
mkdir include\google\protobuf\compiler\csharp
mkdir include\google\protobuf\compiler\java
+mkdir include\google\protobuf\compiler\javanano
mkdir include\google\protobuf\compiler\js
mkdir include\google\protobuf\compiler\objectivec
mkdir include\google\protobuf\compiler\php
@@ -27,6 +28,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\cshar
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\javanano\javanano_generator.h" include\google\protobuf\compiler\javanano\javanano_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\well_known_types_embed.h" include\google\protobuf\compiler\js\well_known_types_embed.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h
@@ -51,8 +53,6 @@ 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\inlined_string_field.h" include\google\protobuf\inlined_string_field.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
@@ -78,6 +78,21 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h" inc
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h" include\google\protobuf\service.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h" include\google\protobuf\source_context.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h" include\google\protobuf\struct.pb.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomic_sequence_num.h" include\google\protobuf\stubs\atomic_sequence_num.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops.h" include\google\protobuf\stubs\atomicops.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm64_gcc.h" include\google\protobuf\stubs\atomicops_internals_arm64_gcc.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_gcc.h" include\google\protobuf\stubs\atomicops_internals_arm_gcc.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_qnx.h" include\google\protobuf\stubs\atomicops_internals_arm_qnx.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_atomicword_compat.h" include\google\protobuf\stubs\atomicops_internals_atomicword_compat.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_c11_atomic.h" include\google\protobuf\stubs\atomicops_internals_generic_c11_atomic.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_gcc.h" include\google\protobuf\stubs\atomicops_internals_generic_gcc.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_mips_gcc.h" include\google\protobuf\stubs\atomicops_internals_mips_gcc.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_power.h" include\google\protobuf\stubs\atomicops_internals_power.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_ppc_gcc.h" include\google\protobuf\stubs\atomicops_internals_ppc_gcc.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_solaris.h" include\google\protobuf\stubs\atomicops_internals_solaris.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_tsan.h" include\google\protobuf\stubs\atomicops_internals_tsan.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_gcc.h" include\google\protobuf\stubs\atomicops_internals_x86_gcc.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_msvc.h" include\google\protobuf\stubs\atomicops_internals_x86_msvc.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h" include\google\protobuf\stubs\bytestream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\callback.h" include\google\protobuf\stubs\callback.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h" include\google\protobuf\stubs\casts.h
@@ -90,11 +105,14 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\mutex.h" includ
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h" include\google\protobuf\stubs\once.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h" include\google\protobuf\stubs\platform_macros.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\port.h" include\google\protobuf\stubs\port.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\scoped_ptr.h" include\google\protobuf\stubs\scoped_ptr.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\shared_ptr.h" include\google\protobuf\stubs\shared_ptr.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h" include\google\protobuf\stubs\singleton.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\status.h" include\google\protobuf\stubs\status.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h" include\google\protobuf\stubs\stl_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stringpiece.h" include\google\protobuf\stubs\stringpiece.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h" include\google\protobuf\stubs\template_util.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\type_traits.h" include\google\protobuf\stubs\type_traits.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h" include\google\protobuf\text_format.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h" include\google\protobuf\timestamp.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.pb.h" include\google\protobuf\type.pb.h
@@ -111,15 +129,3 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h" includ
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h" include\google\protobuf\wire_format_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite_inl.h" include\google\protobuf\wire_format_lite_inl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.proto" include\google\protobuf\any.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.proto" include\google\protobuf\api.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.proto" include\google\protobuf\compiler\plugin.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.proto" include\google\protobuf\descriptor.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.proto" include\google\protobuf\duration.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.proto" include\google\protobuf\empty.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.proto" include\google\protobuf\field_mask.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.proto" include\google\protobuf\source_context.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.proto" include\google\protobuf\struct.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.proto" include\google\protobuf\timestamp.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.proto" include\google\protobuf\type.proto
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.proto" include\google\protobuf\wrappers.proto
diff --git a/third_party/protobuf/3.6.0/cmake/install.cmake b/third_party/protobuf/3.4.0/cmake/install.cmake
index 82036cb687..441bf5532a 100644
--- a/third_party/protobuf/3.6.0/cmake/install.cmake
+++ b/third_party/protobuf/3.4.0/cmake/install.cmake
@@ -5,12 +5,10 @@ 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)
-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})
+foreach(_library
+ libprotobuf-lite
+ libprotobuf
+ libprotoc)
set_property(TARGET ${_library}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${protobuf_source_dir}/src>
@@ -21,10 +19,8 @@ foreach(_library ${_protobuf_libraries})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
endforeach()
-if (protobuf_BUILD_PROTOC_BINARIES)
- install(TARGETS protoc EXPORT protobuf-targets
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
-endif (protobuf_BUILD_PROTOC_BINARIES)
+install(TARGETS protoc EXPORT protobuf-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
@@ -105,18 +101,10 @@ configure_file(protobuf-options.cmake
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
# Allows the build directory to be used as a find directory.
-
-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)
+export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
+ NAMESPACE protobuf::
+ FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
+)
install(EXPORT protobuf-targets
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
diff --git a/third_party/protobuf/3.6.0/cmake/libprotobuf-lite.cmake b/third_party/protobuf/3.4.0/cmake/libprotobuf-lite.cmake
index 911fce5e5d..9e1fab0a79 100644
--- a/third_party/protobuf/3.6.0/cmake/libprotobuf-lite.cmake
+++ b/third_party/protobuf/3.4.0/cmake/libprotobuf-lite.cmake
@@ -4,16 +4,18 @@ 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
${protobuf_source_dir}/src/google/protobuf/message_lite.cc
${protobuf_source_dir}/src/google/protobuf/repeated_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc
${protobuf_source_dir}/src/google/protobuf/stubs/common.cc
${protobuf_source_dir}/src/google/protobuf/stubs/int128.cc
${protobuf_source_dir}/src/google/protobuf/stubs/io_win32.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/once.cc
${protobuf_source_dir}/src/google/protobuf/stubs/status.cc
${protobuf_source_dir}/src/google/protobuf/stubs/statusor.cc
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.cc
@@ -29,12 +31,12 @@ 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
${protobuf_source_dir}/src/google/protobuf/message_lite.h
${protobuf_source_dir}/src/google/protobuf/repeated_field.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h
${protobuf_source_dir}/src/google/protobuf/stubs/common.h
${protobuf_source_dir}/src/google/protobuf/stubs/int128.h
@@ -58,7 +60,5 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS)
PRIVATE LIBPROTOBUF_EXPORTS)
endif()
set_target_properties(libprotobuf-lite PROPERTIES
- VERSION ${protobuf_VERSION}
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
-add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)
diff --git a/third_party/protobuf/3.6.0/cmake/libprotobuf.cmake b/third_party/protobuf/3.4.0/cmake/libprotobuf.cmake
index 65d05c1944..72db915bc9 100644
--- a/third_party/protobuf/3.6.0/cmake/libprotobuf.cmake
+++ b/third_party/protobuf/3.4.0/cmake/libprotobuf.cmake
@@ -125,7 +125,5 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS)
PRIVATE LIBPROTOBUF_EXPORTS)
endif()
set_target_properties(libprotobuf PROPERTIES
- VERSION ${protobuf_VERSION}
OUTPUT_NAME ${LIB_PREFIX}protobuf
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
-add_library(protobuf::libprotobuf ALIAS libprotobuf)
diff --git a/third_party/protobuf/3.6.0/cmake/libprotoc.cmake b/third_party/protobuf/3.4.0/cmake/libprotoc.cmake
index ec6958bce2..9f2aa0c79f 100644
--- a/third_party/protobuf/3.6.0/cmake/libprotoc.cmake
+++ b/third_party/protobuf/3.4.0/cmake/libprotoc.cmake
@@ -11,7 +11,6 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -61,6 +60,17 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_enum.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_extension.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_file.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_generator.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_helpers.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_map_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
@@ -85,29 +95,41 @@ set(libprotoc_files
)
set(libprotoc_headers
+ ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/package_info.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/parser.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_names.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h
@@ -126,6 +148,7 @@ set(libprotoc_headers
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field.h
@@ -138,6 +161,7 @@ set(libprotoc_headers
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_names.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h
@@ -146,19 +170,36 @@ set(libprotoc_headers
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_enum.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_enum_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_extension.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_file.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_helpers.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_map_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_params.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_primitive_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.h
)
set(js_well_known_types_sources
@@ -183,7 +224,5 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS)
endif()
set_target_properties(libprotoc PROPERTIES
COMPILE_DEFINITIONS LIBPROTOC_EXPORTS
- VERSION ${protobuf_VERSION}
OUTPUT_NAME ${LIB_PREFIX}protoc
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
-add_library(protobuf::libprotoc ALIAS libprotoc)
diff --git a/third_party/protobuf/3.6.0/cmake/protobuf-config-version.cmake.in b/third_party/protobuf/3.4.0/cmake/protobuf-config-version.cmake.in
index 3fa01763ee..ca6da09ad7 100644
--- a/third_party/protobuf/3.6.0/cmake/protobuf-config-version.cmake.in
+++ b/third_party/protobuf/3.4.0/cmake/protobuf-config-version.cmake.in
@@ -49,9 +49,9 @@ _check_and_save_build_option(MSVC_STATIC_RUNTIME @protobuf_MSVC_STATIC_RUNTIME@)
_check_and_save_build_option(BUILD_SHARED_LIBS @protobuf_BUILD_SHARED_LIBS@)
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if(CMAKE_SIZEOF_VOID_P AND "@CMAKE_SIZEOF_VOID_P@")
+if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "" AND NOT "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
- if(NOT CMAKE_SIZEOF_VOID_P EQUAL "@CMAKE_SIZEOF_VOID_P@")
+ if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
diff --git a/third_party/protobuf/3.6.0/cmake/protobuf-config.cmake.in b/third_party/protobuf/3.4.0/cmake/protobuf-config.cmake.in
index acedcc7ae2..8321354781 100644
--- a/third_party/protobuf/3.6.0/cmake/protobuf-config.cmake.in
+++ b/third_party/protobuf/3.4.0/cmake/protobuf-config.cmake.in
@@ -9,17 +9,14 @@ include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake")
function(protobuf_generate)
include(CMakeParseArguments)
-
- set(_options APPEND_PATH)
- set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO)
+ set(_singleargs LANGUAGE OUT_VAR)
if(COMMAND target_sources)
list(APPEND _singleargs TARGET)
endif()
- set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS)
- cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}")
+ cmake_parse_arguments(protobuf_generate "APPEND_PATH" "${_singleargs}" "PROTOS IMPORT_DIRS GENERATE_EXTENSIONS" "${ARGN}")
- if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET)
+ if(protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET)
message(SEND_ERROR "Error: protobuf_generate called without any targets or source files")
return()
endif()
@@ -34,10 +31,6 @@ function(protobuf_generate)
endif()
string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE)
- if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp)
- set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:")
- endif()
-
if(NOT protobuf_GENERATE_EXTENSIONS)
if(protobuf_generate_LANGUAGE STREQUAL cpp)
set(protobuf_GENERATE_EXTENSIONS .pb.h .pb.cc)
@@ -49,23 +42,9 @@ function(protobuf_generate)
endif()
endif()
- if(protobuf_generate_TARGET)
- get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES)
- foreach(_file ${_source_list})
- if(_file MATCHES "proto$")
- list(APPEND protobuf_generate_PROTOS ${_file})
- endif()
- endforeach()
- endif()
-
- if(NOT protobuf_generate_PROTOS)
- message(SEND_ERROR "Error: protobuf_generate could not find any .proto files")
- return()
- endif()
-
if(protobuf_generate_APPEND_PATH)
# Create an include path for each file specified
- foreach(_file ${protobuf_generate_PROTOS})
+ foreach(_file ${ARGN})
get_filename_component(_abs_file ${_file} ABSOLUTE)
get_filename_component(_abs_path ${_abs_file} PATH)
list(FIND _protobuf_include_path ${_abs_path} _contains_already)
@@ -85,32 +64,44 @@ function(protobuf_generate)
endif()
endforeach()
- set(_generated_srcs_all)
+ if(protobuf_generate_TARGET)
+ get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES)
+ foreach(_file ${_source_list})
+ if(_file MATCHES "proto$")
+ list(APPEND protobuf_generate_PROTOS ${_file})
+ endif()
+ endforeach()
+ endif()
+
+ if(NOT protobuf_generate_PROTOS)
+ message(SEND_ERROR "Error: protobuf_generate could not find any .proto files")
+ return()
+ endif()
+
+ set(_generated_srcs)
foreach(_proto ${protobuf_generate_PROTOS})
get_filename_component(_abs_file ${_proto} ABSOLUTE)
get_filename_component(_basename ${_proto} NAME_WE)
- set(_generated_srcs)
- foreach(_ext ${protobuf_GENERATE_EXTENSIONS})
+ foreach(_ext ${_output_extensions})
list(APPEND _generated_srcs "${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_ext}")
endforeach()
- list(APPEND _generated_srcs_all ${_generated_srcs})
add_custom_command(
OUTPUT ${_generated_srcs}
COMMAND protobuf::protoc
- ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${_abs_file}
+ ARGS --${protobuf_generate_LANGUAGE}_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${_abs_file}
DEPENDS ${ABS_FIL} protobuf::protoc
COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}"
VERBATIM )
endforeach()
- set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE)
+ set_source_files_properties(${_generated_srcs} PROPERTIES GENERATED TRUE)
if(protobuf_generate_OUT_VAR)
- set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE)
+ set(${protobuf_generate_OUT_VAR} ${_generated_srcs} PARENT_SCOPE)
endif()
if(protobuf_generate_TARGET)
- target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all})
+ target_sources(${protobuf_generate_TARGET} PUBLIC ${_generated_srcs})
endif()
endfunction()
diff --git a/third_party/protobuf/3.6.0/cmake/protobuf-lite.pc.cmake b/third_party/protobuf/3.4.0/cmake/protobuf-lite.pc.cmake
index cbe5426afa..cbe5426afa 100644
--- a/third_party/protobuf/3.6.0/cmake/protobuf-lite.pc.cmake
+++ b/third_party/protobuf/3.4.0/cmake/protobuf-lite.pc.cmake
diff --git a/third_party/protobuf/3.6.0/cmake/protobuf-module.cmake.in b/third_party/protobuf/3.4.0/cmake/protobuf-module.cmake.in
index 74c5488729..8e4920aa80 100644
--- a/third_party/protobuf/3.6.0/cmake/protobuf-module.cmake.in
+++ b/third_party/protobuf/3.4.0/cmake/protobuf-module.cmake.in
@@ -2,10 +2,7 @@
# Functions
function(PROTOBUF_GENERATE_CPP SRCS HDRS)
- cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO" "" ${ARGN})
-
- set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}")
- if(NOT _proto_files)
+ if(NOT ARGN)
message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
return()
endif()
@@ -19,7 +16,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
endif()
set(_outvar)
- protobuf_generate(${_append_arg} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files})
+ protobuf_generate(${append_arg} LANGUAGE cpp OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN})
set(${SRCS})
set(${HDRS})
@@ -49,7 +46,7 @@ function(PROTOBUF_GENERATE_PYTHON SRCS)
endif()
set(_outvar)
- protobuf_generate(${_append_arg} LANGUAGE python OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN})
+ protobuf_generate(${append_arg} LANGUAGE cpp OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN})
set(${SRCS} ${_outvar} PARENT_SCOPE)
endfunction()
@@ -150,10 +147,6 @@ if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_DEBUG)
endif()
-if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
- get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
- IMPORTED_LOCATION_NOCONFIG)
-endif()
# Version info variable
set(Protobuf_VERSION "@protobuf_VERSION@")
diff --git a/third_party/protobuf/3.6.0/cmake/protobuf-options.cmake b/third_party/protobuf/3.4.0/cmake/protobuf-options.cmake
index 47fb158257..47fb158257 100644
--- a/third_party/protobuf/3.6.0/cmake/protobuf-options.cmake
+++ b/third_party/protobuf/3.4.0/cmake/protobuf-options.cmake
diff --git a/third_party/protobuf/3.6.0/cmake/protobuf.pc.cmake b/third_party/protobuf/3.4.0/cmake/protobuf.pc.cmake
index d33e98cca8..d33e98cca8 100644
--- a/third_party/protobuf/3.6.0/cmake/protobuf.pc.cmake
+++ b/third_party/protobuf/3.4.0/cmake/protobuf.pc.cmake
diff --git a/third_party/protobuf/3.6.0/cmake/protoc.cmake b/third_party/protobuf/3.4.0/cmake/protoc.cmake
index 5777b16ed2..4f07c389c9 100644
--- a/third_party/protobuf/3.6.0/cmake/protoc.cmake
+++ b/third_party/protobuf/3.4.0/cmake/protoc.cmake
@@ -4,4 +4,3 @@ set(protoc_files
add_executable(protoc ${protoc_files})
target_link_libraries(protoc libprotobuf libprotoc)
-add_executable(protobuf::protoc ALIAS protoc)
diff --git a/third_party/protobuf/3.6.0/cmake/tests.cmake b/third_party/protobuf/3.4.0/cmake/tests.cmake
index ec790e339f..389f6a7bcd 100644
--- a/third_party/protobuf/3.6.0/cmake/tests.cmake
+++ b/third_party/protobuf/3.4.0/cmake/tests.cmake
@@ -1,31 +1,24 @@
-if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../third_party/googletest/CMakeLists.txt")
- message(FATAL_ERROR
- "Cannot find third_party/googletest directory that's needed to "
- "build tests. If you use git, make sure you have cloned submodules:\n"
- " git submodule update --init --recursive\n"
- "If instead you want to skip tests, run cmake with:\n"
- " cmake -Dprotobuf_BUILD_TESTS=OFF\n")
+if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../gmock/CMakeLists.txt")
+ message(FATAL_ERROR "Cannot find gmock directory.")
endif()
option(protobuf_ABSOLUTE_TEST_PLUGIN_PATH
"Using absolute test_plugin path in tests" ON)
mark_as_advanced(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
-set(googlemock_source_dir "${protobuf_source_dir}/third_party/googletest/googlemock")
-set(googletest_source_dir "${protobuf_source_dir}/third_party/googletest/googletest")
include_directories(
- ${googlemock_source_dir}
- ${googletest_source_dir}
- ${googletest_source_dir}/include
- ${googlemock_source_dir}/include
+ ${protobuf_source_dir}/gmock
+ ${protobuf_source_dir}/gmock/gtest
+ ${protobuf_source_dir}/gmock/gtest/include
+ ${protobuf_source_dir}/gmock/include
)
add_library(gmock STATIC
- "${googlemock_source_dir}/src/gmock-all.cc"
- "${googletest_source_dir}/src/gtest-all.cc"
+ ${protobuf_source_dir}/gmock/src/gmock-all.cc
+ ${protobuf_source_dir}/gmock/gtest/src/gtest-all.cc
)
target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT})
-add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc")
+add_library(gmock_main STATIC ${protobuf_source_dir}/gmock/src/gmock_main.cc)
target_link_libraries(gmock_main gmock)
set(lite_test_protos
@@ -114,7 +107,6 @@ set(common_test_files
${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
${protobuf_source_dir}/src/google/protobuf/map_test_util.cc
${protobuf_source_dir}/src/google/protobuf/test_util.cc
- ${protobuf_source_dir}/src/google/protobuf/test_util.inc
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc
)
@@ -129,13 +121,11 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/any_test.cc
${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc
${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.inc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/metadata_test.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
@@ -160,7 +150,6 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/map_field_test.cc
${protobuf_source_dir}/src/google/protobuf/map_test.cc
${protobuf_source_dir}/src/google/protobuf/message_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/message_unittest.inc
${protobuf_source_dir}/src/google/protobuf/no_field_presence_test.cc
${protobuf_source_dir}/src/google/protobuf/preserve_unknown_enum_test.cc
${protobuf_source_dir}/src/google/protobuf/proto3_arena_lite_unittest.cc
@@ -173,6 +162,7 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/stubs/common_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/int128_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/io_win32_unittest.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/once_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/status_test.cc
${protobuf_source_dir}/src/google/protobuf/stubs/statusor_test.cc
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece_unittest.cc
@@ -181,6 +171,7 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/stubs/strutil_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/template_util_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/time_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/type_traits_unittest.cc
${protobuf_source_dir}/src/google/protobuf/text_format_unittest.cc
${protobuf_source_dir}/src/google/protobuf/unknown_field_set_unittest.cc
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util_test.cc
diff --git a/third_party/protobuf/3.6.0/com_google_protobuf_java.BUILD b/third_party/protobuf/3.4.0/com_google_protobuf_java.BUILD
index d97eafe623..d97eafe623 100644
--- a/third_party/protobuf/3.6.0/com_google_protobuf_java.BUILD
+++ b/third_party/protobuf/3.4.0/com_google_protobuf_java.BUILD
diff --git a/third_party/protobuf/3.6.0/composer.json b/third_party/protobuf/3.4.0/composer.json
index 2c64ad220f..2c64ad220f 100644
--- a/third_party/protobuf/3.6.0/composer.json
+++ b/third_party/protobuf/3.4.0/composer.json
diff --git a/third_party/protobuf/3.6.0/configure.ac b/third_party/protobuf/3.4.0/configure.ac
index aec10cface..04f7eb7a4a 100644
--- a/third_party/protobuf/3.6.0/configure.ac
+++ b/third_party/protobuf/3.4.0/configure.ac
@@ -17,7 +17,7 @@ AC_PREREQ(2.59)
# In the SVN trunk, the version should always be the next anticipated release
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
# the size of one file name in the dist tarfile over the 99-char limit.)
-AC_INIT([Protocol Buffers],[3.6.0],[protobuf@googlegroups.com],[protobuf])
+AC_INIT([Protocol Buffers],[3.4.0],[protobuf@googlegroups.com],[protobuf])
AM_MAINTAINER_MODE([enable])
@@ -52,16 +52,6 @@ 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)])],
@@ -88,7 +78,7 @@ AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
# Protocol Buffers contains several checks that are intended to be used only
# for debugging and which might hurt performance. Most users are probably
# end users who don't want these checks, so add -DNDEBUG by default.
- CXXFLAGS="$CXXFLAGS -std=c++11 -DNDEBUG"
+ CXXFLAGS="$CXXFLAGS -DNDEBUG"
AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS])
],[
@@ -184,13 +174,14 @@ AS_IF([test "$with_protoc" != "no"], [
])
AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"])
-AX_PTHREAD
-AM_CONDITIONAL([HAVE_PTHREAD], [test "x$ax_pthread_ok" = "xyes"])
+ACX_PTHREAD
+AM_CONDITIONAL([HAVE_PTHREAD], [test "x$acx_pthread_ok" = "xyes"])
+
# We still keep this for improving pbconfig.h for unsupported platforms.
AC_CXX_STL_HASH
case "$target_os" in
- mingw* | cygwin* | win* | aix*)
+ mingw* | cygwin* | win*)
;;
*)
# Need to link against rt on Solaris
@@ -207,14 +198,14 @@ case "$target_os" in
esac
AM_CONDITIONAL([OBJC_CONFORMANCE_TEST], [test $OBJC_CONFORMANCE_TEST = 1])
-AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
+AX_CXX_COMPILE_STDCXX([11], [noext], [optional])
# HACK: Make gmock's configure script pick up our copy of CFLAGS and CXXFLAGS,
# since the flags added by ACX_CHECK_SUNCC must be used when compiling gmock
# too.
export CFLAGS
export CXXFLAGS
-AC_CONFIG_SUBDIRS([third_party/googletest])
+AC_CONFIG_SUBDIRS([gmock])
AC_CONFIG_FILES([Makefile src/Makefile benchmarks/Makefile conformance/Makefile protobuf.pc protobuf-lite.pc])
AC_OUTPUT
diff --git a/third_party/protobuf/3.6.0/conformance/ConformanceJava.java b/third_party/protobuf/3.4.0/conformance/ConformanceJava.java
index 596d113a92..596d113a92 100644
--- a/third_party/protobuf/3.6.0/conformance/ConformanceJava.java
+++ b/third_party/protobuf/3.4.0/conformance/ConformanceJava.java
diff --git a/third_party/protobuf/3.6.0/conformance/ConformanceJavaLite.java b/third_party/protobuf/3.4.0/conformance/ConformanceJavaLite.java
index 016f79326f..016f79326f 100644
--- a/third_party/protobuf/3.6.0/conformance/ConformanceJavaLite.java
+++ b/third_party/protobuf/3.4.0/conformance/ConformanceJavaLite.java
diff --git a/third_party/protobuf/3.6.0/conformance/Makefile.am b/third_party/protobuf/3.4.0/conformance/Makefile.am
index 765f3588ff..f7ce053bda 100644
--- a/third_party/protobuf/3.6.0/conformance/Makefile.am
+++ b/third_party/protobuf/3.4.0/conformance/Makefile.am
@@ -256,7 +256,7 @@ if USE_EXTERNAL_PROTOC
protoc_middleman: $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. --php_out=. --js_out=import_style=commonjs,binary:. $(conformance_protoc_inputs)
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --objc_out=. --python_out=. --js_out=import_style=commonjs,binary:. $(conformance_proto2_protoc_inputs)
- $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --python_out=. --js_out=import_style=commonjs,binary:google-protobuf $(well_known_type_protoc_inputs)
+ $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --python_out=. --php_out=. --js_out=import_style=commonjs,binary:google-protobuf $(well_known_type_protoc_inputs)
## $(PROTOC) -I$(srcdir) -I$(top_srcdir) --java_out=lite:lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs)
touch protoc_middleman
@@ -268,7 +268,7 @@ else
protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd --php_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_protoc_inputs) )
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --objc_out=. --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_proto2_protoc_inputs) )
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd/google-protobuf $(well_known_type_protoc_inputs) )
+ oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --python_out=$$oldpwd --php_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd/google-protobuf $(well_known_type_protoc_inputs) )
## @mkdir -p lite
## oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --java_out=lite:$$oldpwd/lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) )
touch protoc_middleman
diff --git a/third_party/protobuf/3.6.0/conformance/README.md b/third_party/protobuf/3.4.0/conformance/README.md
index 971fe8f60d..971fe8f60d 100644
--- a/third_party/protobuf/3.6.0/conformance/README.md
+++ b/third_party/protobuf/3.4.0/conformance/README.md
diff --git a/third_party/protobuf/3.6.0/conformance/autoload.php b/third_party/protobuf/3.4.0/conformance/autoload.php
index 0f49aecb16..2cee31c476 100644
--- a/third_party/protobuf/3.6.0/conformance/autoload.php
+++ b/third_party/protobuf/3.4.0/conformance/autoload.php
@@ -2,7 +2,7 @@
define("GOOGLE_INTERNAL_NAMESPACE", "Google\\Protobuf\\Internal\\");
define("GOOGLE_NAMESPACE", "Google\\Protobuf\\");
-define("GOOGLE_GPBMETADATA_NAMESPACE", "GPBMetadata\\Google\\Protobuf\\");
+define("GOOGLE_GPBMETADATA_NAMESPACE", "GPBMetadata\\Google\\Protobuf\\Internal\\");
function protobuf_autoloader_impl($class, $prefix) {
$length = strlen($prefix);
diff --git a/third_party/protobuf/3.6.0/conformance/conformance.proto b/third_party/protobuf/3.4.0/conformance/conformance.proto
index 525140e946..525140e946 100644
--- a/third_party/protobuf/3.6.0/conformance/conformance.proto
+++ b/third_party/protobuf/3.4.0/conformance/conformance.proto
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_cpp.cc b/third_party/protobuf/3.4.0/conformance/conformance_cpp.cc
index 97ae1a7a20..bf70309a69 100644
--- a/third_party/protobuf/3.6.0/conformance/conformance_cpp.cc
+++ b/third_party/protobuf/3.4.0/conformance/conformance_cpp.cc
@@ -45,13 +45,13 @@ using google::protobuf::Descriptor;
using google::protobuf::DescriptorPool;
using google::protobuf::Message;
using google::protobuf::MessageFactory;
+using google::protobuf::internal::scoped_ptr;
using google::protobuf::util::BinaryToJsonString;
using google::protobuf::util::JsonToBinaryString;
using google::protobuf::util::NewTypeResolverForDescriptorPool;
using google::protobuf::util::Status;
using google::protobuf::util::TypeResolver;
using protobuf_test_messages::proto3::TestAllTypesProto3;
-using protobuf_test_messages::proto2::TestAllTypesProto2;
using std::string;
static const char kTypeUrlPrefix[] = "type.googleapis.com";
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_nodejs.js b/third_party/protobuf/3.4.0/conformance/conformance_nodejs.js
index 5d3955f77b..5d3955f77b 100644..100755
--- a/third_party/protobuf/3.6.0/conformance/conformance_nodejs.js
+++ b/third_party/protobuf/3.4.0/conformance/conformance_nodejs.js
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_objc.m b/third_party/protobuf/3.4.0/conformance/conformance_objc.m
index 84a43811fa..84a43811fa 100644
--- a/third_party/protobuf/3.6.0/conformance/conformance_objc.m
+++ b/third_party/protobuf/3.4.0/conformance/conformance_objc.m
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_php.php b/third_party/protobuf/3.4.0/conformance/conformance_php.php
index 19f9a0926c..b6e12c01e1 100644..100755
--- a/third_party/protobuf/3.6.0/conformance/conformance_php.php
+++ b/third_party/protobuf/3.4.0/conformance/conformance_php.php
@@ -3,6 +3,24 @@
require_once("Conformance/WireFormat.php");
require_once("Conformance/ConformanceResponse.php");
require_once("Conformance/ConformanceRequest.php");
+require_once("Google/Protobuf/Any.php");
+require_once("Google/Protobuf/Duration.php");
+require_once("Google/Protobuf/FieldMask.php");
+require_once("Google/Protobuf/Struct.php");
+require_once("Google/Protobuf/Value.php");
+require_once("Google/Protobuf/ListValue.php");
+require_once("Google/Protobuf/NullValue.php");
+require_once("Google/Protobuf/Timestamp.php");
+require_once("Google/Protobuf/DoubleValue.php");
+require_once("Google/Protobuf/BytesValue.php");
+require_once("Google/Protobuf/FloatValue.php");
+require_once("Google/Protobuf/Int64Value.php");
+require_once("Google/Protobuf/UInt32Value.php");
+require_once("Google/Protobuf/BoolValue.php");
+require_once("Google/Protobuf/DoubleValue.php");
+require_once("Google/Protobuf/Int32Value.php");
+require_once("Google/Protobuf/StringValue.php");
+require_once("Google/Protobuf/UInt64Value.php");
require_once("Protobuf_test_messages/Proto3/ForeignMessage.php");
require_once("Protobuf_test_messages/Proto3/ForeignEnum.php");
require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3.php");
@@ -10,14 +28,16 @@ require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3_NestedMessage.php
require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3_NestedEnum.php");
require_once("GPBMetadata/Conformance.php");
+require_once("GPBMetadata/Google/Protobuf/Any.php");
+require_once("GPBMetadata/Google/Protobuf/Duration.php");
+require_once("GPBMetadata/Google/Protobuf/FieldMask.php");
+require_once("GPBMetadata/Google/Protobuf/Struct.php");
+require_once("GPBMetadata/Google/Protobuf/Timestamp.php");
+require_once("GPBMetadata/Google/Protobuf/Wrappers.php");
require_once("GPBMetadata/Google/Protobuf/TestMessagesProto3.php");
use \Conformance\WireFormat;
-if (!ini_get("date.timezone")) {
- ini_set("date.timezone", "UTC");
-}
-
$test_count = 0;
function doTest($request)
@@ -33,10 +53,10 @@ function doTest($request)
return $response;
}
} elseif ($request->getMessageType() == "protobuf_test_messages.proto2.TestAllTypesProto2") {
- $response->setSkipped("PHP doesn't support proto2");
- return $response;
+ $response->setSkipped("PHP doesn't support proto2");
+ return $response;
} else {
- trigger_error("Protobuf request doesn't have specific payload type", E_USER_ERROR);
+ trigger_error("Protobuf request doesn't have specific payload type", E_USER_ERROR);
}
} elseif ($request->getPayload() == "json_payload") {
try {
@@ -54,12 +74,7 @@ function doTest($request)
} elseif ($request->getRequestedOutputFormat() == WireFormat::PROTOBUF) {
$response->setProtobufPayload($test_message->serializeToString());
} elseif ($request->getRequestedOutputFormat() == WireFormat::JSON) {
- try {
- $response->setJsonPayload($test_message->serializeToJsonString());
- } catch (Exception $e) {
- $response->setSerializeError($e->getMessage());
- return $response;
- }
+ $response->setJsonPayload($test_message->serializeToJsonString());
}
return $response;
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_python.py b/third_party/protobuf/3.4.0/conformance/conformance_python.py
index c5ba2467a6..c5ba2467a6 100644..100755
--- a/third_party/protobuf/3.6.0/conformance/conformance_python.py
+++ b/third_party/protobuf/3.4.0/conformance/conformance_python.py
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_ruby.rb b/third_party/protobuf/3.4.0/conformance/conformance_ruby.rb
index df63bf7ced..df63bf7ced 100644..100755
--- a/third_party/protobuf/3.6.0/conformance/conformance_ruby.rb
+++ b/third_party/protobuf/3.4.0/conformance/conformance_ruby.rb
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_test.cc b/third_party/protobuf/3.4.0/conformance/conformance_test.cc
index 22bbbfb38c..b1ff688353 100644
--- a/third_party/protobuf/3.6.0/conformance/conformance_test.cc
+++ b/third_party/protobuf/3.4.0/conformance/conformance_test.cc
@@ -290,28 +290,6 @@ void ConformanceTestSuite::RunValidInputTest(
TextFormat::ParseFromString(equivalent_text_format, reference_message))
<< "Failed to parse data for test case: " << test_name
<< ", data: " << equivalent_text_format;
- const string equivalent_wire_format = reference_message->SerializeAsString();
- RunValidBinaryInputTest(test_name, level, input, input_format,
- equivalent_wire_format, requested_output, isProto3);
-}
-
-void ConformanceTestSuite::RunValidBinaryInputTest(
- const string& test_name, ConformanceLevel level, const string& input,
- WireFormat input_format, const string& equivalent_wire_format,
- WireFormat requested_output, bool isProto3) {
- auto newTestMessage = [&isProto3]() {
- Message* newMessage;
- if (isProto3) {
- newMessage = new TestAllTypesProto3;
- } else {
- newMessage = new TestAllTypesProto2;
- }
- return newMessage;
- };
- Message* reference_message = newTestMessage();
- GOOGLE_CHECK(
- reference_message->ParseFromString(equivalent_wire_format))
- << "Failed to parse wire data for test case: " << test_name;
ConformanceRequest request;
ConformanceResponse response;
@@ -515,19 +493,6 @@ void ConformanceTestSuite::RunValidProtobufTest(
}
}
-void ConformanceTestSuite::RunValidBinaryProtobufTest(
- const string& test_name, ConformanceLevel level,
- const string& input_protobuf, bool isProto3) {
- string rname = ".Proto3";
- if (!isProto3) {
- rname = ".Proto2";
- }
- RunValidBinaryInputTest(
- ConformanceLevelToString(level) + rname + ".ProtobufInput." + test_name +
- ".ProtobufOutput", level, input_protobuf, conformance::PROTOBUF,
- input_protobuf, conformance::PROTOBUF, isProto3);
-}
-
void ConformanceTestSuite::RunValidProtobufTestWithMessage(
const string& test_name, ConformanceLevel level, const Message *input,
const string& equivalent_text_format, bool isProto3) {
@@ -754,7 +719,7 @@ void ConformanceTestSuite::TestValidDataForType(
}
void ConformanceTestSuite::SetFailureList(const string& filename,
- const std::vector<string>& failure_list) {
+ const vector<string>& failure_list) {
failure_list_filename_ = filename;
expected_to_fail_.clear();
std::copy(failure_list.begin(), failure_list.end(),
@@ -846,14 +811,6 @@ void ConformanceTestSuite::TestOneofMessage (MessageType &message,
"OneofZeroEnum", RECOMMENDED, &message, "oneof_enum: FOO", isProto3);
}
-template <class MessageType>
-void ConformanceTestSuite::TestUnknownMessage(MessageType& message,
- bool isProto3) {
- message.ParseFromString("\xA8\x1F\x01");
- RunValidBinaryProtobufTest("UnknownVarint", REQUIRED,
- message.SerializeAsString(), isProto3);
-}
-
bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
std::string* output) {
runner_ = runner;
@@ -1842,14 +1799,6 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"optionalInt64": null,
"optionalUint32": null,
"optionalUint64": null,
- "optionalSint32": null,
- "optionalSint64": null,
- "optionalFixed32": null,
- "optionalFixed64": null,
- "optionalSfixed32": null,
- "optionalSfixed64": null,
- "optionalFloat": null,
- "optionalDouble": null,
"optionalBool": null,
"optionalString": null,
"optionalBytes": null,
@@ -1859,14 +1808,6 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"repeatedInt64": null,
"repeatedUint32": null,
"repeatedUint64": null,
- "repeatedSint32": null,
- "repeatedSint64": null,
- "repeatedFixed32": null,
- "repeatedFixed64": null,
- "repeatedSfixed32": null,
- "repeatedSfixed64": null,
- "repeatedFloat": null,
- "repeatedDouble": null,
"repeatedBool": null,
"repeatedString": null,
"repeatedBytes": null,
@@ -1906,18 +1847,6 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"StringFieldSingleQuoteBoth", RECOMMENDED,
R"({'optionalString': 'Hello world!'})");
- // Unknown fields.
- {
- TestAllTypesProto3 messageProto3;
- TestAllTypesProto2 messageProto2;
- //TODO(yilunchong): update this behavior when unknown field's behavior
- // changed in open source. Also delete
- // Required.Proto3.ProtobufInput.UnknownVarint.ProtobufOutput
- // from failure list of python_cpp python java
- TestUnknownMessage(messageProto3, true);
- TestUnknownMessage(messageProto2, false);
- }
-
// Wrapper types.
RunValidJsonTest(
"OptionalBoolWrapper", REQUIRED,
@@ -2066,10 +1995,6 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
R"({"repeatedDuration": ["1.5s", "-1.5s"]})",
"repeated_duration: {seconds: 1 nanos: 500000000}"
"repeated_duration: {seconds: -1 nanos: -500000000}");
- RunValidJsonTest(
- "DurationNull", REQUIRED,
- R"({"optionalDuration": null})",
- "");
ExpectParseFailureForJson(
"DurationMissingS", REQUIRED,
@@ -2139,10 +2064,6 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"TimestampWithNegativeOffset", REQUIRED,
R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})",
"optional_timestamp: {seconds: 0}");
- RunValidJsonTest(
- "TimestampNull", REQUIRED,
- R"({"optionalTimestamp": null})",
- "");
ExpectParseFailureForJson(
"TimestampJsonInputTooSmall", REQUIRED,
@@ -2325,24 +2246,6 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
}
)");
RunValidJsonTest(
- "ValueAcceptListWithNull", REQUIRED,
- R"({"optionalValue": ["x", null, "y"]})",
- R"(
- optional_value: {
- list_value: {
- values: {
- string_value: "x"
- }
- values: {
- null_value: NULL_VALUE
- }
- values: {
- string_value: "y"
- }
- }
- }
- )");
- RunValidJsonTest(
"ValueAcceptObject", REQUIRED,
R"({"optionalValue": {"value": 1}})",
R"(
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_test.h b/third_party/protobuf/3.4.0/conformance/conformance_test.h
index 2649f8b252..d1a822eba6 100644
--- a/third_party/protobuf/3.6.0/conformance/conformance_test.h
+++ b/third_party/protobuf/3.4.0/conformance/conformance_test.h
@@ -167,13 +167,6 @@ class ConformanceTestSuite {
const string& equivalent_text_format,
conformance::WireFormat requested_output,
bool isProto3);
- void RunValidBinaryInputTest(const string& test_name,
- ConformanceLevel level,
- const string& input,
- conformance::WireFormat input_format,
- const string& equivalent_wire_format,
- conformance::WireFormat requested_output,
- bool isProto3);
void RunValidJsonTest(const string& test_name,
ConformanceLevel level,
const string& input_json,
@@ -187,10 +180,6 @@ class ConformanceTestSuite {
const string& input_protobuf,
const string& equivalent_text_format,
bool isProto3);
- void RunValidBinaryProtobufTest(const string& test_name,
- ConformanceLevel level,
- const string& input_protobuf,
- bool isProto3);
void RunValidProtobufTestWithMessage(
const string& test_name, ConformanceLevel level,
const Message *input,
@@ -223,9 +212,6 @@ class ConformanceTestSuite {
template <class MessageType>
void TestOneofMessage (MessageType &message,
bool isProto3);
- template <class MessageType>
- void TestUnknownMessage (MessageType &message,
- bool isProto3);
void TestValidDataForType(
google::protobuf::FieldDescriptor::Type,
std::vector<std::pair<std::string, std::string>> values);
@@ -256,7 +242,8 @@ class ConformanceTestSuite {
// The set of tests that the testee opted out of;
std::set<std::string> skipped_;
- std::unique_ptr<google::protobuf::util::TypeResolver> type_resolver_;
+ google::protobuf::internal::scoped_ptr<google::protobuf::util::TypeResolver>
+ type_resolver_;
std::string type_url_;
};
diff --git a/third_party/protobuf/3.6.0/conformance/conformance_test_runner.cc b/third_party/protobuf/3.4.0/conformance/conformance_test_runner.cc
index b0357b87b1..7e91d388b0 100644
--- a/third_party/protobuf/3.6.0/conformance/conformance_test_runner.cc
+++ b/third_party/protobuf/3.4.0/conformance/conformance_test_runner.cc
@@ -68,6 +68,7 @@
using conformance::ConformanceRequest;
using conformance::ConformanceResponse;
+using google::protobuf::internal::scoped_array;
using google::protobuf::StringAppendF;
using std::string;
using std::vector;
@@ -182,7 +183,7 @@ class ForkPipeRunner : public google::protobuf::ConformanceTestRunner {
CHECK_SYSCALL(close(toproc_pipe_fd[1]));
CHECK_SYSCALL(close(fromproc_pipe_fd[0]));
- std::unique_ptr<char[]> executable(new char[executable_.size() + 1]);
+ scoped_array<char> executable(new char[executable_.size() + 1]);
memcpy(executable.get(), executable_.c_str(), executable_.size());
executable[executable_.size()] = '\0';
@@ -263,7 +264,7 @@ void UsageError() {
exit(1);
}
-void ParseFailureList(const char *filename, std::vector<string>* failure_list) {
+void ParseFailureList(const char *filename, vector<string>* failure_list) {
std::ifstream infile(filename);
if (!infile.is_open()) {
@@ -290,7 +291,7 @@ int main(int argc, char *argv[]) {
google::protobuf::ConformanceTestSuite suite;
string failure_list_filename;
- std::vector<string> failure_list;
+ vector<string> failure_list;
for (int arg = 1; arg < argc; ++arg) {
if (strcmp(argv[arg], "--failure_list") == 0) {
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_cpp.txt b/third_party/protobuf/3.4.0/conformance/failure_list_cpp.txt
index 752fbb5d9b..8c328890d4 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_cpp.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_cpp.txt
@@ -54,3 +54,4 @@ Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64
Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64
+
diff --git a/third_party/protobuf/3.4.0/conformance/failure_list_csharp.txt b/third_party/protobuf/3.4.0/conformance/failure_list_csharp.txt
new file mode 100644
index 0000000000..a938e5bd9f
--- /dev/null
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_csharp.txt
@@ -0,0 +1,7 @@
+Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
+Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
+Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_0
+Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_1
+Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_2
+Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_3
+
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_java.txt b/third_party/protobuf/3.4.0/conformance/failure_list_java.txt
index dc1f9ba5c9..5116c569ca 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_java.txt
+++ b/third_party/protobuf/3.4.0/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
+Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_js.txt b/third_party/protobuf/3.4.0/conformance/failure_list_js.txt
index f8f6a578fa..eb20f659a2 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_js.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_js.txt
@@ -1,3 +1,5 @@
+Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT32.ProtobufOutput
+Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT32.ProtobufOutput
Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.ProtobufOutput
Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.ProtobufOutput
Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.ProtobufOutput
@@ -11,3 +13,7 @@ Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.ProtobufOutput
Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.ProtobufOutput
Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.ProtobufOutput
Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.ProtobufOutput
+Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.INT32.ProtobufOutput
+Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.UINT32.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.ProtobufOutput
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_objc.txt b/third_party/protobuf/3.4.0/conformance/failure_list_objc.txt
index e34501ead7..e34501ead7 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_objc.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_objc.txt
diff --git a/third_party/protobuf/3.4.0/conformance/failure_list_php.txt b/third_party/protobuf/3.4.0/conformance/failure_list_php.txt
new file mode 100644
index 0000000000..2f91a3f589
--- /dev/null
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_php.txt
@@ -0,0 +1,120 @@
+Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput
+Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
+Recommended.FieldMaskTooManyUnderscore.JsonOutput
+Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
+Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
+Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
+Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
+Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator
+Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator
+Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator
+Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator
+Recommended.Proto3.JsonInput.TimestampHas9FractionalDigits.Validator
+Recommended.Proto3.JsonInput.TimestampHasZeroFractionalDigit.Validator
+Recommended.Proto3.JsonInput.TimestampZeroNormalized.Validator
+Required.DurationProtoInputTooLarge.JsonOutput
+Required.DurationProtoInputTooSmall.JsonOutput
+Required.Proto3.JsonInput.Any.JsonOutput
+Required.Proto3.JsonInput.Any.ProtobufOutput
+Required.Proto3.JsonInput.AnyNested.JsonOutput
+Required.Proto3.JsonInput.AnyNested.ProtobufOutput
+Required.Proto3.JsonInput.AnyUnorderedTypeTag.JsonOutput
+Required.Proto3.JsonInput.AnyUnorderedTypeTag.ProtobufOutput
+Required.Proto3.JsonInput.AnyWithDuration.JsonOutput
+Required.Proto3.JsonInput.AnyWithDuration.ProtobufOutput
+Required.Proto3.JsonInput.AnyWithFieldMask.JsonOutput
+Required.Proto3.JsonInput.AnyWithFieldMask.ProtobufOutput
+Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.JsonOutput
+Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput
+Required.Proto3.JsonInput.AnyWithStruct.JsonOutput
+Required.Proto3.JsonInput.AnyWithStruct.ProtobufOutput
+Required.Proto3.JsonInput.AnyWithTimestamp.JsonOutput
+Required.Proto3.JsonInput.AnyWithTimestamp.ProtobufOutput
+Required.Proto3.JsonInput.AnyWithValueForInteger.JsonOutput
+Required.Proto3.JsonInput.AnyWithValueForInteger.ProtobufOutput
+Required.Proto3.JsonInput.AnyWithValueForJsonObject.JsonOutput
+Required.Proto3.JsonInput.AnyWithValueForJsonObject.ProtobufOutput
+Required.Proto3.JsonInput.DurationMaxValue.JsonOutput
+Required.Proto3.JsonInput.DurationMaxValue.ProtobufOutput
+Required.Proto3.JsonInput.DurationMinValue.JsonOutput
+Required.Proto3.JsonInput.DurationMinValue.ProtobufOutput
+Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput
+Required.Proto3.JsonInput.DurationRepeatedValue.ProtobufOutput
+Required.Proto3.JsonInput.FieldMask.JsonOutput
+Required.Proto3.JsonInput.FieldMask.ProtobufOutput
+Required.Proto3.JsonInput.OptionalBoolWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalBoolWrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalBytesWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalBytesWrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalDoubleWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalDoubleWrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalFloatWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalFloatWrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalInt32Wrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalInt32Wrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalInt64Wrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalInt64Wrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalStringWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalStringWrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalUint32Wrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalUint32Wrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalUint64Wrapper.ProtobufOutput
+Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
+Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedBoolWrapper.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedBytesWrapper.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedDoubleWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedDoubleWrapper.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedFloatWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedFloatWrapper.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedInt32Wrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedInt32Wrapper.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedInt64Wrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedInt64Wrapper.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedStringWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedStringWrapper.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedUint32Wrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedUint32Wrapper.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedUint64Wrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedUint64Wrapper.ProtobufOutput
+Required.Proto3.JsonInput.Struct.JsonOutput
+Required.Proto3.JsonInput.Struct.ProtobufOutput
+Required.Proto3.JsonInput.TimestampMaxValue.JsonOutput
+Required.Proto3.JsonInput.TimestampMaxValue.ProtobufOutput
+Required.Proto3.JsonInput.TimestampMinValue.JsonOutput
+Required.Proto3.JsonInput.TimestampMinValue.ProtobufOutput
+Required.Proto3.JsonInput.TimestampRepeatedValue.JsonOutput
+Required.Proto3.JsonInput.TimestampRepeatedValue.ProtobufOutput
+Required.Proto3.JsonInput.TimestampWithNegativeOffset.JsonOutput
+Required.Proto3.JsonInput.TimestampWithNegativeOffset.ProtobufOutput
+Required.Proto3.JsonInput.TimestampWithPositiveOffset.JsonOutput
+Required.Proto3.JsonInput.TimestampWithPositiveOffset.ProtobufOutput
+Required.Proto3.JsonInput.ValueAcceptBool.JsonOutput
+Required.Proto3.JsonInput.ValueAcceptBool.ProtobufOutput
+Required.Proto3.JsonInput.ValueAcceptFloat.JsonOutput
+Required.Proto3.JsonInput.ValueAcceptFloat.ProtobufOutput
+Required.Proto3.JsonInput.ValueAcceptInteger.JsonOutput
+Required.Proto3.JsonInput.ValueAcceptInteger.ProtobufOutput
+Required.Proto3.JsonInput.ValueAcceptList.JsonOutput
+Required.Proto3.JsonInput.ValueAcceptList.ProtobufOutput
+Required.Proto3.JsonInput.ValueAcceptNull.JsonOutput
+Required.Proto3.JsonInput.ValueAcceptNull.ProtobufOutput
+Required.Proto3.JsonInput.ValueAcceptObject.JsonOutput
+Required.Proto3.JsonInput.ValueAcceptObject.ProtobufOutput
+Required.Proto3.JsonInput.ValueAcceptString.JsonOutput
+Required.Proto3.JsonInput.ValueAcceptString.ProtobufOutput
+Required.TimestampProtoInputTooLarge.JsonOutput
+Required.TimestampProtoInputTooSmall.JsonOutput
+Required.Proto3.JsonInput.FloatFieldTooLarge
+Required.Proto3.JsonInput.FloatFieldTooSmall
+Required.Proto3.JsonInput.DoubleFieldTooSmall
+Required.Proto3.JsonInput.Int32FieldNotInteger
+Required.Proto3.JsonInput.Int64FieldNotInteger
+Required.Proto3.JsonInput.Uint32FieldNotInteger
+Required.Proto3.JsonInput.Uint64FieldNotInteger
+Required.Proto3.JsonInput.Int32FieldLeadingSpace
+Required.Proto3.JsonInput.OneofFieldDuplicate
+Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_php_c.txt b/third_party/protobuf/3.4.0/conformance/failure_list_php_c.txt
index 088708e9b5..2e37884298 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_php_c.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_php_c.txt
@@ -19,6 +19,11 @@ Recommended.Proto3.JsonInput.StringEndsWithEscapeChar
Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder
Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate
Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate
+Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator
+Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator
+Recommended.Proto3.JsonInput.TimestampHas9FractionalDigits.Validator
+Recommended.Proto3.JsonInput.TimestampHasZeroFractionalDigit.Validator
+Recommended.Proto3.JsonInput.TimestampZeroNormalized.Validator
Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator
Recommended.Proto3.ProtobufInput.OneofZeroBytes.JsonOutput
Recommended.Proto3.ProtobufInput.OneofZeroBytes.ProtobufOutput
@@ -155,6 +160,16 @@ Required.Proto3.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.JsonOu
Required.Proto3.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.ProtobufOutput
Required.Proto3.JsonInput.Struct.JsonOutput
Required.Proto3.JsonInput.Struct.ProtobufOutput
+Required.Proto3.JsonInput.TimestampMaxValue.JsonOutput
+Required.Proto3.JsonInput.TimestampMaxValue.ProtobufOutput
+Required.Proto3.JsonInput.TimestampMinValue.JsonOutput
+Required.Proto3.JsonInput.TimestampMinValue.ProtobufOutput
+Required.Proto3.JsonInput.TimestampRepeatedValue.JsonOutput
+Required.Proto3.JsonInput.TimestampRepeatedValue.ProtobufOutput
+Required.Proto3.JsonInput.TimestampWithNegativeOffset.JsonOutput
+Required.Proto3.JsonInput.TimestampWithNegativeOffset.ProtobufOutput
+Required.Proto3.JsonInput.TimestampWithPositiveOffset.JsonOutput
+Required.Proto3.JsonInput.TimestampWithPositiveOffset.ProtobufOutput
Required.Proto3.JsonInput.Uint32FieldMaxFloatValue.JsonOutput
Required.Proto3.JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput
Required.Proto3.JsonInput.Uint64FieldMaxValue.JsonOutput
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_php_zts_c.txt b/third_party/protobuf/3.4.0/conformance/failure_list_php_zts_c.txt
index d9a8fe36d9..d9a8fe36d9 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_php_zts_c.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_php_zts_c.txt
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_python-post26.txt b/third_party/protobuf/3.4.0/conformance/failure_list_python-post26.txt
index 19d99b044a..19d99b044a 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_python-post26.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_python-post26.txt
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_python.txt b/third_party/protobuf/3.4.0/conformance/failure_list_python.txt
index e3ce7af759..062c22a8dc 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_python.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_python.txt
@@ -7,6 +7,7 @@ Recommended.Proto3.JsonInput.FloatFieldInfinityNotQuoted
Recommended.Proto3.JsonInput.FloatFieldNanNotQuoted
Recommended.Proto3.JsonInput.FloatFieldNegativeInfinityNotQuoted
Required.Proto3.JsonInput.DoubleFieldTooSmall
+Required.Proto3.JsonInput.EnumFieldUnknownValue.Validator
Required.Proto3.JsonInput.FloatFieldTooLarge
Required.Proto3.JsonInput.FloatFieldTooSmall
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_python_cpp.txt b/third_party/protobuf/3.4.0/conformance/failure_list_python_cpp.txt
index a498ad1a3e..e2c258de50 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_python_cpp.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_python_cpp.txt
@@ -16,6 +16,7 @@ Recommended.Proto3.JsonInput.FloatFieldInfinityNotQuoted
Recommended.Proto3.JsonInput.FloatFieldNanNotQuoted
Recommended.Proto3.JsonInput.FloatFieldNegativeInfinityNotQuoted
Required.Proto3.JsonInput.DoubleFieldTooSmall
+Required.Proto3.JsonInput.EnumFieldUnknownValue.Validator
Required.Proto3.JsonInput.FloatFieldTooLarge
Required.Proto3.JsonInput.FloatFieldTooSmall
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_ruby.txt b/third_party/protobuf/3.4.0/conformance/failure_list_ruby.txt
index b2683372f9..45cfaca659 100644
--- a/third_party/protobuf/3.6.0/conformance/failure_list_ruby.txt
+++ b/third_party/protobuf/3.4.0/conformance/failure_list_ruby.txt
@@ -59,6 +59,8 @@ Required.Proto3.JsonInput.FieldMask.ProtobufOutput
Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput
Required.Proto3.JsonInput.FloatFieldNan.JsonOutput
Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput
+Required.Proto3.JsonInput.FloatFieldTooLarge
+Required.Proto3.JsonInput.FloatFieldTooSmall
Required.Proto3.JsonInput.OneofFieldDuplicate
Required.Proto3.JsonInput.OptionalBoolWrapper.JsonOutput
Required.Proto3.JsonInput.OptionalBoolWrapper.ProtobufOutput
@@ -120,8 +122,6 @@ Required.Proto3.JsonInput.ValueAcceptInteger.JsonOutput
Required.Proto3.JsonInput.ValueAcceptInteger.ProtobufOutput
Required.Proto3.JsonInput.ValueAcceptList.JsonOutput
Required.Proto3.JsonInput.ValueAcceptList.ProtobufOutput
-Required.Proto3.JsonInput.ValueAcceptListWithNull.JsonOutput
-Required.Proto3.JsonInput.ValueAcceptListWithNull.ProtobufOutput
Required.Proto3.JsonInput.ValueAcceptNull.JsonOutput
Required.Proto3.JsonInput.ValueAcceptNull.ProtobufOutput
Required.Proto3.JsonInput.ValueAcceptObject.JsonOutput
diff --git a/third_party/protobuf/3.6.0/conformance/third_party/jsoncpp/json.h b/third_party/protobuf/3.4.0/conformance/third_party/jsoncpp/json.h
index 42e7e7f4ad..42e7e7f4ad 100644
--- a/third_party/protobuf/3.6.0/conformance/third_party/jsoncpp/json.h
+++ b/third_party/protobuf/3.4.0/conformance/third_party/jsoncpp/json.h
diff --git a/third_party/protobuf/3.6.0/conformance/third_party/jsoncpp/jsoncpp.cpp b/third_party/protobuf/3.4.0/conformance/third_party/jsoncpp/jsoncpp.cpp
index f803962ade..f803962ade 100644
--- a/third_party/protobuf/3.6.0/conformance/third_party/jsoncpp/jsoncpp.cpp
+++ b/third_party/protobuf/3.4.0/conformance/third_party/jsoncpp/jsoncpp.cpp
diff --git a/third_party/protobuf/3.6.0/conformance/update_failure_list.py b/third_party/protobuf/3.4.0/conformance/update_failure_list.py
index ad42ed3c18..63f453df1b 100644..100755
--- a/third_party/protobuf/3.6.0/conformance/update_failure_list.py
+++ b/third_party/protobuf/3.4.0/conformance/update_failure_list.py
@@ -35,6 +35,7 @@ This is sort of like comm(1), except it recognizes comments and ignores them.
"""
import argparse
+import fileinput
parser = argparse.ArgumentParser(
description='Adds/removes failures from the failure list.')
@@ -61,8 +62,7 @@ for remove_file in (args.remove_list or []):
add_list = sorted(add_set, reverse=True)
-with open(args.filename) as in_file:
- existing_list = in_file.read()
+existing_list = file(args.filename).read()
with open(args.filename, "w") as f:
for line in existing_list.splitlines(True):
diff --git a/third_party/protobuf/3.6.0/csharp/.gitignore b/third_party/protobuf/3.4.0/csharp/.gitignore
index 8ba8849985..8ba8849985 100644
--- a/third_party/protobuf/3.6.0/csharp/.gitignore
+++ b/third_party/protobuf/3.4.0/csharp/.gitignore
diff --git a/third_party/protobuf/3.6.0/csharp/CHANGES.txt b/third_party/protobuf/3.4.0/csharp/CHANGES.txt
index a87cd4d5df..a87cd4d5df 100644
--- a/third_party/protobuf/3.6.0/csharp/CHANGES.txt
+++ b/third_party/protobuf/3.4.0/csharp/CHANGES.txt
diff --git a/third_party/protobuf/3.6.0/csharp/Google.Protobuf.Tools.nuspec b/third_party/protobuf/3.4.0/csharp/Google.Protobuf.Tools.nuspec
index ae8cdd74ae..d32fd943c6 100644
--- a/third_party/protobuf/3.6.0/csharp/Google.Protobuf.Tools.nuspec
+++ b/third_party/protobuf/3.4.0/csharp/Google.Protobuf.Tools.nuspec
@@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description>
- <version>3.6.0</version>
+ <version>3.4.0</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl>
diff --git a/third_party/protobuf/3.6.0/csharp/README.md b/third_party/protobuf/3.4.0/csharp/README.md
index 9d1225f1a8..c1d124194a 100644
--- a/third_party/protobuf/3.6.0/csharp/README.md
+++ b/third_party/protobuf/3.4.0/csharp/README.md
@@ -41,17 +41,13 @@ in its implementation, as well as the new Visual Studio 2017 csproj
format. These features have no impact when using the compiled code -
they're only relevant when building the `Google.Protobuf` assembly.
-In order to run and debug the AddressBook example in the IDE, you must
-install the optional component, ".Net Core 1.0 - 1.1 development tools
-for Web" (as it's labelled in current versions of the VS2017
-installer), above and beyond the main .NET Core cross-platform
-development feature.
-
Testing
=======
-The unit tests use [NUnit 3](https://github.com/nunit/nunit). Tests can be
-run using the Visual Studio Test Explorer or `dotnet test`.
+The unit tests use [NUnit 3](https://github.com/nunit/nunit). NUnit doesn't yet
+support `dotnet test`, so for now the test project is a console application
+using NUnitLite. Simply run `Google.Protobuf.Test.exe` to run the unit tests
+directly, or else use `dotnet run`.
.NET 3.5
========
diff --git a/third_party/protobuf/3.6.0/csharp/build_packages.bat b/third_party/protobuf/3.4.0/csharp/build_packages.bat
index d7205659f1..d7205659f1 100644
--- a/third_party/protobuf/3.6.0/csharp/build_packages.bat
+++ b/third_party/protobuf/3.4.0/csharp/build_packages.bat
diff --git a/third_party/protobuf/3.6.0/csharp/build_tools.sh b/third_party/protobuf/3.4.0/csharp/build_tools.sh
index 182c5c5c82..182c5c5c82 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/build_tools.sh
+++ b/third_party/protobuf/3.4.0/csharp/build_tools.sh
diff --git a/third_party/protobuf/3.6.0/csharp/buildall.sh b/third_party/protobuf/3.4.0/csharp/buildall.sh
index 50d8906dce..dd4b463ddf 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/buildall.sh
+++ b/third_party/protobuf/3.4.0/csharp/buildall.sh
@@ -14,4 +14,4 @@ echo Running tests.
# If we want to test the .NET 4.5 version separately, we could
# run Mono explicitly. However, we don't have any differences between
# the .NET 4.5 and netstandard1.0 assemblies.
-dotnet test -c $CONFIG -f netcoreapp1.0 $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+dotnet run -c $CONFIG -f netcoreapp1.0 -p $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto
index 6c9f76344a..6c9f76344a 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto
index 16be277304..16be277304 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto
index 59673eaf9d..59673eaf9d 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto
index d6f11e28bd..d6f11e28bd 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto
index f59d217864..f59d217864 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto
index c90752440b..c90752440b 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs
index 8935b7829d..8935b7829d 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs
index 23af28870a..23af28870a 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs
index db0a180949..db0a180949 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs
index 3653d4f337..3653d4f337 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
index 9c8459073c..9c8459073c 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
index 6852f75f8e..6852f75f8e 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs
index df23a09cd4..df23a09cd4 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
index f430b06bed..f430b06bed 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
index 8dfad8b331..8dfad8b331 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs
index a669baba17..a669baba17 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs
index 0e2bad59e5..0e2bad59e5 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs
index 95eef983a2..b029551c0b 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs
@@ -638,7 +638,7 @@ namespace Google.Protobuf
}
[Test]
- public void DiscardUnknownFields_RealDataStillRead()
+ public void IgnoreUnknownFields_RealDataStillRead()
{
var message = SampleMessages.CreateFullTestAllTypes();
var stream = new MemoryStream();
@@ -652,18 +652,16 @@ namespace Google.Protobuf
stream.Position = 0;
var parsed = TestAllTypes.Parser.ParseFrom(stream);
- // TODO(jieluo): Add test back after DiscardUnknownFields is supported
- // Assert.AreEqual(message, parsed);
+ Assert.AreEqual(message, parsed);
}
[Test]
- public void DiscardUnknownFields_AllTypes()
+ public void IgnoreUnknownFields_AllTypes()
{
// Simple way of ensuring we can skip all kinds of fields.
var data = SampleMessages.CreateFullTestAllTypes().ToByteArray();
var empty = Empty.Parser.ParseFrom(data);
- // TODO(jieluo): Add test back after DiscardUnknownField is supported.
- // Assert.AreEqual(new Empty(), empty);
+ Assert.AreEqual(new Empty(), empty);
}
// This was originally seen as a conformance test failure.
@@ -722,4 +720,4 @@ namespace Google.Protobuf
Assert.AreEqual("{ \"c\": 31 }", writer.ToString());
}
}
-}
+} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
index 06d07b9f4a..06d07b9f4a 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs
index ddb23aa685..ddb23aa685 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs
index f595455aa1..f595455aa1 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs
index 527ab3361e..527ab3361e 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs
index 9078e59b1d..9078e59b1d 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
index 52d5a67697..52d5a67697 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
index a488af30d4..a488af30d4 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs
index 5be7ca2361..5be7ca2361 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs
index 77447afa12..77447afa12 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs
index ffa4e2a7c2..ffa4e2a7c2 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs
index fd75b19f42..fd75b19f42 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs
index 5663a69902..5663a69902 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
index 4aecc998de..4aecc998de 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
index 141faf80e0..141faf80e0 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
index 1d9908b4d3..1d9908b4d3 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs
index 9ecd24c62a..9ecd24c62a 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
index 5b7185dcd2..5b7185dcd2 100644
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/test.sh b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/test.sh
index 54d28dfc26..54d28dfc26 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/compatibility_tests/v3.0.0/test.sh
+++ b/third_party/protobuf/3.4.0/csharp/compatibility_tests/v3.0.0/test.sh
diff --git a/third_party/protobuf/3.6.0/csharp/generate_protos.sh b/third_party/protobuf/3.4.0/csharp/generate_protos.sh
index 5c748e35cf..d2f474796f 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/generate_protos.sh
+++ b/third_party/protobuf/3.4.0/csharp/generate_protos.sh
@@ -3,7 +3,7 @@
# You first need to make sure protoc has been built (see instructions on
# building protoc in root of this repository)
-set -e
+set -ex
# cd to repository root
pushd $(dirname $0)/..
@@ -40,20 +40,28 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
src/google/protobuf/type.proto \
src/google/protobuf/wrappers.proto
-# Test protos
-$PROTOC -Isrc -Icsharp/protos \
- --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \
- csharp/protos/map_unittest_proto3.proto \
+# Test protos where the namespace matches the target location
+$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test \
+ --csharp_opt=base_namespace=Google.Protobuf \
+ src/google/protobuf/map_unittest_proto3.proto \
+ src/google/protobuf/unittest_proto3.proto \
+ src/google/protobuf/unittest_import_proto3.proto \
+ src/google/protobuf/unittest_import_public_proto3.proto \
+ src/google/protobuf/unittest_well_known_types.proto
+
+# Different base namespace to the protos above
+$PROTOC -Isrc -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \
+ --csharp_opt=base_namespace=UnitTest.Issues \
csharp/protos/unittest_issues.proto \
- csharp/protos/unittest_custom_options_proto3.proto \
- csharp/protos/unittest_proto3.proto \
- csharp/protos/unittest_import_proto3.proto \
- csharp/protos/unittest_import_public_proto3.proto \
- src/google/protobuf/unittest_well_known_types.proto \
+ csharp/protos/unittest_custom_options_proto3.proto
+
+# Don't specify a base namespace at all; we just want to make sure the
+# results end up in TestProtos.
+$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \
src/google/protobuf/test_messages_proto3.proto
# AddressBook sample protos
-$PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \
+$PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \
examples/addressbook.proto
$PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance \
diff --git a/third_party/protobuf/3.4.0/csharp/global.json b/third_party/protobuf/3.4.0/csharp/global.json
new file mode 100644
index 0000000000..3622b56494
--- /dev/null
+++ b/third_party/protobuf/3.4.0/csharp/global.json
@@ -0,0 +1,5 @@
+{
+ "sdk": {
+ "version": "1.0.0"
+ }
+}
diff --git a/third_party/protobuf/3.6.0/csharp/keys/Google.Protobuf.public.snk b/third_party/protobuf/3.4.0/csharp/keys/Google.Protobuf.public.snk
index 59cd36985f..59cd36985f 100644
--- a/third_party/protobuf/3.6.0/csharp/keys/Google.Protobuf.public.snk
+++ b/third_party/protobuf/3.4.0/csharp/keys/Google.Protobuf.public.snk
Binary files differ
diff --git a/third_party/protobuf/3.6.0/csharp/keys/Google.Protobuf.snk b/third_party/protobuf/3.4.0/csharp/keys/Google.Protobuf.snk
index 7515443ca9..7515443ca9 100644
--- a/third_party/protobuf/3.6.0/csharp/keys/Google.Protobuf.snk
+++ b/third_party/protobuf/3.4.0/csharp/keys/Google.Protobuf.snk
Binary files differ
diff --git a/third_party/protobuf/3.6.0/csharp/keys/README.md b/third_party/protobuf/3.4.0/csharp/keys/README.md
index ede673573e..ede673573e 100644
--- a/third_party/protobuf/3.6.0/csharp/keys/README.md
+++ b/third_party/protobuf/3.4.0/csharp/keys/README.md
diff --git a/third_party/protobuf/3.6.0/csharp/protos/unittest_custom_options_proto3.proto b/third_party/protobuf/3.4.0/csharp/protos/unittest_custom_options_proto3.proto
index 87bd0f7a84..87bd0f7a84 100644
--- a/third_party/protobuf/3.6.0/csharp/protos/unittest_custom_options_proto3.proto
+++ b/third_party/protobuf/3.4.0/csharp/protos/unittest_custom_options_proto3.proto
diff --git a/third_party/protobuf/3.6.0/csharp/protos/unittest_issues.proto b/third_party/protobuf/3.4.0/csharp/protos/unittest_issues.proto
index 0d8793e1e9..6c9f76344a 100644
--- a/third_party/protobuf/3.6.0/csharp/protos/unittest_issues.proto
+++ b/third_party/protobuf/3.4.0/csharp/protos/unittest_issues.proto
@@ -7,6 +7,7 @@ syntax = "proto3";
option csharp_namespace = "UnitTest.Issues.TestProtos";
package unittest_issues;
+option optimize_for = SPEED;
// Issue 307: when generating doubly-nested types, any references
// should be of the form A.Types.B.Types.C.
@@ -123,18 +124,3 @@ message TestJsonName {
string description = 2 [json_name = "desc"];
string guid = 3 [json_name = "exid"];
}
-
-// Issue 3200: When merging two messages which use the same
-// oneof case, which is itself a message type, the submessages should
-// be merged.
-message OneofMerging {
- message Nested {
- int32 x = 1;
- int32 y = 2;
- }
-
- oneof value {
- string text = 1;
- Nested nested = 2;
- }
-} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/csharp/src/AddressBook/AddPerson.cs b/third_party/protobuf/3.4.0/csharp/src/AddressBook/AddPerson.cs
index 484f1ea25d..484f1ea25d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/AddressBook/AddPerson.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/AddressBook/AddPerson.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/AddressBook/AddressBook.csproj b/third_party/protobuf/3.4.0/csharp/src/AddressBook/AddressBook.csproj
index 6edfdcabb3..6edfdcabb3 100644
--- a/third_party/protobuf/3.6.0/csharp/src/AddressBook/AddressBook.csproj
+++ b/third_party/protobuf/3.4.0/csharp/src/AddressBook/AddressBook.csproj
diff --git a/third_party/protobuf/3.6.0/csharp/src/AddressBook/Addressbook.cs b/third_party/protobuf/3.4.0/csharp/src/AddressBook/Addressbook.cs
index 21a8ce02d1..75ed071b74 100644
--- a/third_party/protobuf/3.6.0/csharp/src/AddressBook/Addressbook.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/AddressBook/Addressbook.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: addressbook.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: addressbook.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -24,21 +22,19 @@ namespace Google.Protobuf.Examples.AddressBook {
static AddressbookReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwaH2dvb2dsZS9wcm90b2J1",
- "Zi90aW1lc3RhbXAucHJvdG8ihwIKBlBlcnNvbhIMCgRuYW1lGAEgASgJEgoK",
- "AmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25lcxgEIAMoCzIcLnR1",
- "dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchIwCgxsYXN0X3VwZGF0ZWQYBSAB",
- "KAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wGkcKC1Bob25lTnVtYmVy",
- "Eg4KBm51bWJlchgBIAEoCRIoCgR0eXBlGAIgASgOMhoudHV0b3JpYWwuUGVy",
- "c29uLlBob25lVHlwZSIrCglQaG9uZVR5cGUSCgoGTU9CSUxFEAASCAoESE9N",
- "RRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZwZW9wbGUYASADKAsy",
- "EC50dXRvcmlhbC5QZXJzb25CUAoUY29tLmV4YW1wbGUudHV0b3JpYWxCEUFk",
- "ZHJlc3NCb29rUHJvdG9zqgIkR29vZ2xlLlByb3RvYnVmLkV4YW1wbGVzLkFk",
- "ZHJlc3NCb29rYgZwcm90bzM="));
+ "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi1QEKBlBlcnNvbhIMCgRu",
+ "YW1lGAEgASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25l",
+ "cxgEIAMoCzIcLnR1dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchpHCgtQaG9u",
+ "ZU51bWJlchIOCgZudW1iZXIYASABKAkSKAoEdHlwZRgCIAEoDjIaLnR1dG9y",
+ "aWFsLlBlcnNvbi5QaG9uZVR5cGUiKwoJUGhvbmVUeXBlEgoKBk1PQklMRRAA",
+ "EggKBEhPTUUQARIICgRXT1JLEAIiLwoLQWRkcmVzc0Jvb2sSIAoGcGVvcGxl",
+ "GAEgAygLMhAudHV0b3JpYWwuUGVyc29uQlAKFGNvbS5leGFtcGxlLnR1dG9y",
+ "aWFsQhFBZGRyZXNzQm9va1Byb3Rvc6oCJEdvb2dsZS5Qcm90b2J1Zi5FeGFt",
+ "cGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
- new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, },
+ new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones", "LastUpdated" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null)
}));
}
@@ -51,7 +47,6 @@ namespace Google.Protobuf.Examples.AddressBook {
/// </summary>
public sealed partial class Person : pb::IMessage<Person> {
private static readonly pb::MessageParser<Person> _parser = new pb::MessageParser<Person>(() => new Person());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Person> Parser { get { return _parser; } }
@@ -78,8 +73,6 @@ namespace Google.Protobuf.Examples.AddressBook {
id_ = other.id_;
email_ = other.email_;
phones_ = other.phones_.Clone();
- lastUpdated_ = other.lastUpdated_ != null ? other.lastUpdated_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -133,17 +126,6 @@ namespace Google.Protobuf.Examples.AddressBook {
get { return phones_; }
}
- /// <summary>Field number for the "last_updated" field.</summary>
- public const int LastUpdatedFieldNumber = 5;
- private global::Google.Protobuf.WellKnownTypes.Timestamp lastUpdated_;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public global::Google.Protobuf.WellKnownTypes.Timestamp LastUpdated {
- get { return lastUpdated_; }
- set {
- lastUpdated_ = value;
- }
- }
-
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Person);
@@ -161,8 +143,7 @@ namespace Google.Protobuf.Examples.AddressBook {
if (Id != other.Id) return false;
if (Email != other.Email) return false;
if(!phones_.Equals(other.phones_)) return false;
- if (!object.Equals(LastUpdated, other.LastUpdated)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -172,10 +153,6 @@ namespace Google.Protobuf.Examples.AddressBook {
if (Id != 0) hash ^= Id.GetHashCode();
if (Email.Length != 0) hash ^= Email.GetHashCode();
hash ^= phones_.GetHashCode();
- if (lastUpdated_ != null) hash ^= LastUpdated.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -199,13 +176,6 @@ namespace Google.Protobuf.Examples.AddressBook {
output.WriteString(Email);
}
phones_.WriteTo(output, _repeated_phones_codec);
- if (lastUpdated_ != null) {
- output.WriteRawTag(42);
- output.WriteMessage(LastUpdated);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -221,12 +191,6 @@ namespace Google.Protobuf.Examples.AddressBook {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Email);
}
size += phones_.CalculateSize(_repeated_phones_codec);
- if (lastUpdated_ != null) {
- size += 1 + pb::CodedOutputStream.ComputeMessageSize(LastUpdated);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -245,13 +209,6 @@ namespace Google.Protobuf.Examples.AddressBook {
Email = other.Email;
}
phones_.Add(other.phones_);
- if (other.lastUpdated_ != null) {
- if (lastUpdated_ == null) {
- lastUpdated_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
- }
- LastUpdated.MergeFrom(other.LastUpdated);
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -260,7 +217,7 @@ namespace Google.Protobuf.Examples.AddressBook {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -278,13 +235,6 @@ namespace Google.Protobuf.Examples.AddressBook {
phones_.AddEntriesFrom(input, _repeated_phones_codec);
break;
}
- case 42: {
- if (lastUpdated_ == null) {
- lastUpdated_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
- }
- input.ReadMessage(lastUpdated_);
- break;
- }
}
}
}
@@ -301,7 +251,6 @@ namespace Google.Protobuf.Examples.AddressBook {
public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber> {
private static readonly pb::MessageParser<PhoneNumber> _parser = new pb::MessageParser<PhoneNumber>(() => new PhoneNumber());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<PhoneNumber> Parser { get { return _parser; } }
@@ -326,7 +275,6 @@ namespace Google.Protobuf.Examples.AddressBook {
public PhoneNumber(PhoneNumber other) : this() {
number_ = other.number_;
type_ = other.type_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -371,7 +319,7 @@ namespace Google.Protobuf.Examples.AddressBook {
}
if (Number != other.Number) return false;
if (Type != other.Type) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -379,9 +327,6 @@ namespace Google.Protobuf.Examples.AddressBook {
int hash = 1;
if (Number.Length != 0) hash ^= Number.GetHashCode();
if (Type != 0) hash ^= Type.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -400,9 +345,6 @@ namespace Google.Protobuf.Examples.AddressBook {
output.WriteRawTag(16);
output.WriteEnum((int) Type);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -414,9 +356,6 @@ namespace Google.Protobuf.Examples.AddressBook {
if (Type != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -431,7 +370,6 @@ namespace Google.Protobuf.Examples.AddressBook {
if (other.Type != 0) {
Type = other.Type;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -440,7 +378,7 @@ namespace Google.Protobuf.Examples.AddressBook {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Number = input.ReadString();
@@ -466,7 +404,6 @@ namespace Google.Protobuf.Examples.AddressBook {
/// </summary>
public sealed partial class AddressBook : pb::IMessage<AddressBook> {
private static readonly pb::MessageParser<AddressBook> _parser = new pb::MessageParser<AddressBook>(() => new AddressBook());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<AddressBook> Parser { get { return _parser; } }
@@ -490,7 +427,6 @@ namespace Google.Protobuf.Examples.AddressBook {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public AddressBook(AddressBook other) : this() {
people_ = other.people_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -522,16 +458,13 @@ namespace Google.Protobuf.Examples.AddressBook {
return true;
}
if(!people_.Equals(other.people_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= people_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -543,18 +476,12 @@ namespace Google.Protobuf.Examples.AddressBook {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
people_.WriteTo(output, _repeated_people_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += people_.CalculateSize(_repeated_people_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -564,7 +491,6 @@ namespace Google.Protobuf.Examples.AddressBook {
return;
}
people_.Add(other.people_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -573,7 +499,7 @@ namespace Google.Protobuf.Examples.AddressBook {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
people_.AddEntriesFrom(input, _repeated_people_codec);
diff --git a/third_party/protobuf/3.6.0/csharp/src/AddressBook/ListPeople.cs b/third_party/protobuf/3.4.0/csharp/src/AddressBook/ListPeople.cs
index 71572289d4..71572289d4 100644
--- a/third_party/protobuf/3.6.0/csharp/src/AddressBook/ListPeople.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/AddressBook/ListPeople.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/AddressBook/Program.cs b/third_party/protobuf/3.4.0/csharp/src/AddressBook/Program.cs
index 8164f44179..8164f44179 100644
--- a/third_party/protobuf/3.6.0/csharp/src/AddressBook/Program.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/AddressBook/Program.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/AddressBook/SampleUsage.cs b/third_party/protobuf/3.4.0/csharp/src/AddressBook/SampleUsage.cs
index b4ab8d8f36..b4ab8d8f36 100644
--- a/third_party/protobuf/3.6.0/csharp/src/AddressBook/SampleUsage.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/AddressBook/SampleUsage.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Conformance.cs
index f6118ea278..394607b90a 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Conformance.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Conformance.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: conformance.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: conformance.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -64,7 +62,6 @@ namespace Conformance {
/// </summary>
public sealed partial class ConformanceRequest : pb::IMessage<ConformanceRequest> {
private static readonly pb::MessageParser<ConformanceRequest> _parser = new pb::MessageParser<ConformanceRequest>(() => new ConformanceRequest());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ConformanceRequest> Parser { get { return _parser; } }
@@ -98,7 +95,6 @@ namespace Conformance {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -195,7 +191,7 @@ namespace Conformance {
if (RequestedOutputFormat != other.RequestedOutputFormat) return false;
if (MessageType != other.MessageType) return false;
if (PayloadCase != other.PayloadCase) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -206,9 +202,6 @@ namespace Conformance {
if (RequestedOutputFormat != 0) hash ^= RequestedOutputFormat.GetHashCode();
if (MessageType.Length != 0) hash ^= MessageType.GetHashCode();
hash ^= (int) payloadCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -235,9 +228,6 @@ namespace Conformance {
output.WriteRawTag(34);
output.WriteString(MessageType);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -255,9 +245,6 @@ namespace Conformance {
if (MessageType.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(MessageType);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -281,7 +268,6 @@ namespace Conformance {
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -290,7 +276,7 @@ namespace Conformance {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
ProtobufPayload = input.ReadBytes();
@@ -319,7 +305,6 @@ namespace Conformance {
/// </summary>
public sealed partial class ConformanceResponse : pb::IMessage<ConformanceResponse> {
private static readonly pb::MessageParser<ConformanceResponse> _parser = new pb::MessageParser<ConformanceResponse>(() => new ConformanceResponse());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ConformanceResponse> Parser { get { return _parser; } }
@@ -363,7 +348,6 @@ namespace Conformance {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -509,7 +493,7 @@ namespace Conformance {
if (JsonPayload != other.JsonPayload) return false;
if (Skipped != other.Skipped) return false;
if (ResultCase != other.ResultCase) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -522,9 +506,6 @@ namespace Conformance {
if (resultCase_ == ResultOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode();
if (resultCase_ == ResultOneofCase.Skipped) hash ^= Skipped.GetHashCode();
hash ^= (int) resultCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -559,9 +540,6 @@ namespace Conformance {
output.WriteRawTag(50);
output.WriteString(SerializeError);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -585,9 +563,6 @@ namespace Conformance {
if (resultCase_ == ResultOneofCase.Skipped) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Skipped);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -617,7 +592,6 @@ namespace Conformance {
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -626,7 +600,7 @@ namespace Conformance {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
ParseError = input.ReadString();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
index b654c0b2cf..b654c0b2cf 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Program.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Program.cs
index 96dc354e99..96dc354e99 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Conformance/Program.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Conformance/Program.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
index 4eda641ad6..4eda641ad6 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.JsonDump/Program.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.JsonDump/Program.cs
index 56e32ad86e..56e32ad86e 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.JsonDump/Program.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.JsonDump/Program.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/ByteStringTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
index da467ce519..da467ce519 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs
index 23af28870a..23af28870a 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs
index e76c4286dd..65bc871a50 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs
@@ -284,20 +284,6 @@ namespace Google.Protobuf
Assert.Throws<InvalidProtocolBufferException>(() => input.ReadBytes());
}
- // Representations of a tag for field 0 with various wire types
- [Test]
- [TestCase(0)]
- [TestCase(1)]
- [TestCase(2)]
- [TestCase(3)]
- [TestCase(4)]
- [TestCase(5)]
- public void ReadTag_ZeroFieldRejected(byte tag)
- {
- CodedInputStream cis = new CodedInputStream(new byte[] { tag });
- Assert.Throws<InvalidProtocolBufferException>(() => cis.ReadTag());
- }
-
internal static TestRecursiveMessage MakeRecursiveMessage(int depth)
{
if (depth == 0)
@@ -615,88 +601,5 @@ namespace Google.Protobuf
var stream = new CodedInputStream(new byte[10]);
stream.Dispose();
}
-
- [Test]
- public void TestParseMessagesCloseTo2G()
- {
- byte[] serializedMessage = GenerateBigSerializedMessage();
- // How many of these big messages do we need to take us near our 2GB limit?
- int count = Int32.MaxValue / serializedMessage.Length;
- // Now make a MemoryStream that will fake a near-2GB stream of messages by returning
- // our big serialized message 'count' times.
- using (RepeatingMemoryStream stream = new RepeatingMemoryStream(serializedMessage, count))
- {
- Assert.DoesNotThrow(()=>TestAllTypes.Parser.ParseFrom(stream));
- }
- }
-
- [Test]
- public void TestParseMessagesOver2G()
- {
- byte[] serializedMessage = GenerateBigSerializedMessage();
- // How many of these big messages do we need to take us near our 2GB limit?
- int count = Int32.MaxValue / serializedMessage.Length;
- // Now add one to take us over the 2GB limit
- count++;
- // Now make a MemoryStream that will fake a near-2GB stream of messages by returning
- // our big serialized message 'count' times.
- using (RepeatingMemoryStream stream = new RepeatingMemoryStream(serializedMessage, count))
- {
- Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseFrom(stream),
- "Protocol message was too large. May be malicious. " +
- "Use CodedInputStream.SetSizeLimit() to increase the size limit.");
- }
- }
-
- /// <returns>A serialized big message</returns>
- private static byte[] GenerateBigSerializedMessage()
- {
- byte[] value = new byte[16 * 1024 * 1024];
- TestAllTypes message = SampleMessages.CreateFullTestAllTypes();
- message.SingleBytes = ByteString.CopyFrom(value);
- return message.ToByteArray();
- }
-
- /// <summary>
- /// A MemoryStream that repeats a byte arrays' content a number of times.
- /// Simulates really large input without consuming loads of memory. Used above
- /// to test the parsing behavior when the input size exceeds 2GB or close to it.
- /// </summary>
- private class RepeatingMemoryStream: MemoryStream
- {
- private readonly byte[] bytes;
- private readonly int maxIterations;
- private int index = 0;
-
- public RepeatingMemoryStream(byte[] bytes, int maxIterations)
- {
- this.bytes = bytes;
- this.maxIterations = maxIterations;
- }
-
- public override int Read(byte[] buffer, int offset, int count)
- {
- if (bytes.Length == 0)
- {
- return 0;
- }
- int numBytesCopiedTotal = 0;
- while (numBytesCopiedTotal < count && index < maxIterations)
- {
- int numBytesToCopy = Math.Min(bytes.Length - (int)Position, count);
- Array.Copy(bytes, (int)Position, buffer, offset, numBytesToCopy);
- numBytesCopiedTotal += numBytesToCopy;
- offset += numBytesToCopy;
- count -= numBytesCopiedTotal;
- Position += numBytesToCopy;
- if (Position >= bytes.Length)
- {
- Position = 0;
- index++;
- }
- }
- return numBytesCopiedTotal;
- }
- }
}
} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs
index 32926e930f..32926e930f 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
index 8791dffc35..68b4de45f6 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
@@ -540,49 +540,6 @@ namespace Google.Protobuf.Collections
Assert.Throws<ArgumentException>(() => map.ToString());
}
- [Test]
- public void NaNValuesComparedBitwise()
- {
- var map1 = new MapField<string, double>
- {
- { "x", SampleNaNs.Regular },
- { "y", SampleNaNs.SignallingFlipped }
- };
-
- var map2 = new MapField<string, double>
- {
- { "x", SampleNaNs.Regular },
- { "y", SampleNaNs.PayloadFlipped }
- };
-
- var map3 = new MapField<string, double>
- {
- { "x", SampleNaNs.Regular },
- { "y", SampleNaNs.SignallingFlipped }
- };
-
- EqualityTester.AssertInequality(map1, map2);
- EqualityTester.AssertEquality(map1, map3);
- Assert.True(map1.Values.Contains(SampleNaNs.SignallingFlipped));
- Assert.False(map2.Values.Contains(SampleNaNs.SignallingFlipped));
- }
-
- // This wouldn't usually happen, as protos can't use doubles as map keys,
- // but let's be consistent.
- [Test]
- public void NaNKeysComparedBitwise()
- {
- var map = new MapField<double, string>
- {
- { SampleNaNs.Regular, "x" },
- { SampleNaNs.SignallingFlipped, "y" }
- };
- Assert.AreEqual("x", map[SampleNaNs.Regular]);
- Assert.AreEqual("y", map[SampleNaNs.SignallingFlipped]);
- string ignored;
- Assert.False(map.TryGetValue(SampleNaNs.PayloadFlipped, out ignored));
- }
-
#if !NET35
[Test]
public void IDictionaryKeys_Equals_IReadOnlyDictionaryKeys()
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
index 129923b609..6852f75f8e 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
@@ -742,18 +742,5 @@ namespace Google.Protobuf.Collections
var text = list.ToString();
Assert.AreEqual(text, "[ { \"foo\": 20 } ]", message.ToString());
}
-
- [Test]
- public void NaNValuesComparedBitwise()
- {
- var list1 = new RepeatedField<double> { SampleNaNs.Regular, SampleNaNs.SignallingFlipped };
- var list2 = new RepeatedField<double> { SampleNaNs.Regular, SampleNaNs.PayloadFlipped };
- var list3 = new RepeatedField<double> { SampleNaNs.Regular, SampleNaNs.SignallingFlipped };
-
- EqualityTester.AssertInequality(list1, list2);
- EqualityTester.AssertEquality(list1, list3);
- Assert.True(list1.Contains(SampleNaNs.SignallingFlipped));
- Assert.False(list2.Contains(SampleNaNs.SignallingFlipped));
- }
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs
index df23a09cd4..df23a09cd4 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs
index 48c0725fa6..48c0725fa6 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
index abbe3c955f..abbe3c955f 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
index 8dfad8b331..8dfad8b331 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/EqualityTester.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/EqualityTester.cs
index a669baba17..a669baba17 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/EqualityTester.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/EqualityTester.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
index 3c5e32d2e0..3c5e32d2e0 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
index d5ae8ff997..b029551c0b 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
@@ -638,7 +638,7 @@ namespace Google.Protobuf
}
[Test]
- public void DiscardUnknownFields_RealDataStillRead()
+ public void IgnoreUnknownFields_RealDataStillRead()
{
var message = SampleMessages.CreateFullTestAllTypes();
var stream = new MemoryStream();
@@ -652,18 +652,16 @@ namespace Google.Protobuf
stream.Position = 0;
var parsed = TestAllTypes.Parser.ParseFrom(stream);
- // TODO(jieluo): Add test back when DiscardUnknownFields API is supported.
- // Assert.AreEqual(message, parsed);
+ Assert.AreEqual(message, parsed);
}
[Test]
- public void DiscardUnknownFields_AllTypes()
+ public void IgnoreUnknownFields_AllTypes()
{
// Simple way of ensuring we can skip all kinds of fields.
var data = SampleMessages.CreateFullTestAllTypes().ToByteArray();
var empty = Empty.Parser.ParseFrom(data);
- // TODO(jieluo): Add test back when DiscardUnknownFields API is supported.
- // Assert.AreNotEqual(new Empty(), empty);
+ Assert.AreEqual(new Empty(), empty);
}
// This was originally seen as a conformance test failure.
@@ -721,16 +719,5 @@ namespace Google.Protobuf
JsonFormatter.Default.Format(message, writer);
Assert.AreEqual("{ \"c\": 31 }", writer.ToString());
}
-
- [Test]
- public void NaNComparisons()
- {
- var message1 = new TestAllTypes { SingleDouble = SampleNaNs.Regular };
- var message2 = new TestAllTypes { SingleDouble = SampleNaNs.PayloadFlipped };
- var message3 = new TestAllTypes { SingleDouble = SampleNaNs.Regular };
-
- EqualityTester.AssertInequality(message1, message2);
- EqualityTester.AssertEquality(message1, message3);
- }
}
} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
index 6a430116be..06d07b9f4a 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <OutputType>Exe</OutputType>
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
@@ -13,9 +14,8 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
- <PackageReference Include="NUnit" Version="3.9.0" />
- <PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
+ <PackageReference Include="NUnit" Version="3.6.1" />
+ <PackageReference Include="NUnitLite" Version="3.6.1" />
</ItemGroup>
<!--
@@ -26,5 +26,5 @@
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<TargetFrameworks>netcoreapp1.0</TargetFrameworks>
</PropertyGroup>
-
+
</Project>
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/IssuesTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/IssuesTest.cs
index d66584e361..ddb23aa685 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/IssuesTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/IssuesTest.cs
@@ -33,7 +33,7 @@
using Google.Protobuf.Reflection;
using UnitTest.Issues.TestProtos;
using NUnit.Framework;
-using static UnitTest.Issues.TestProtos.OneofMerging.Types;
+
namespace Google.Protobuf
{
@@ -78,17 +78,5 @@ namespace Google.Protobuf
Assert.AreEqual("{ \"name\": \"test\", \"desc\": \"test2\", \"exid\": \"test3\" }",
JsonFormatter.Default.Format(message));
}
-
- [Test]
- public void OneofMerging()
- {
- var message1 = new OneofMerging { Nested = new Nested { X = 10 } };
- var message2 = new OneofMerging { Nested = new Nested { Y = 20 } };
- var expected = new OneofMerging { Nested = new Nested { X = 10, Y = 20 } };
-
- var merged = message1.Clone();
- merged.MergeFrom(message2);
- Assert.AreEqual(expected, merged);
- }
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
index 1c7a8cdf24..53ac3dc9be 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
@@ -514,7 +514,7 @@ namespace Google.Protobuf
var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithTypeRegistry(TypeRegistry.FromMessages(TestAllTypes.Descriptor)));
var message = new TestAllTypes { SingleInt32 = 10, SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } };
var any = Any.Pack(message);
- AssertJson("{ '@type': 'type.googleapis.com/protobuf_unittest3.TestAllTypes', 'singleInt32': 10, 'singleNestedMessage': { 'bb': 20 } }", formatter.Format(any));
+ AssertJson("{ '@type': 'type.googleapis.com/protobuf_unittest.TestAllTypes', 'singleInt32': 10, 'singleNestedMessage': { 'bb': 20 } }", formatter.Format(any));
}
[Test]
@@ -523,7 +523,7 @@ namespace Google.Protobuf
var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithTypeRegistry(TypeRegistry.FromMessages(TestAllTypes.Descriptor)));
var message = new TestAllTypes { SingleInt32 = 10 };
var any = Any.Pack(message, "foo.bar/baz");
- AssertJson("{ '@type': 'foo.bar/baz/protobuf_unittest3.TestAllTypes', 'singleInt32': 10 }", formatter.Format(any));
+ AssertJson("{ '@type': 'foo.bar/baz/protobuf_unittest.TestAllTypes', 'singleInt32': 10 }", formatter.Format(any));
}
[Test]
@@ -536,7 +536,7 @@ namespace Google.Protobuf
var doubleNestedMessage = new TestAllTypes { SingleInt32 = 20 };
var nestedMessage = Any.Pack(doubleNestedMessage);
var message = new TestWellKnownTypes { AnyField = Any.Pack(nestedMessage) };
- AssertJson("{ 'anyField': { '@type': 'type.googleapis.com/google.protobuf.Any', 'value': { '@type': 'type.googleapis.com/protobuf_unittest3.TestAllTypes', 'singleInt32': 20 } } }",
+ AssertJson("{ 'anyField': { '@type': 'type.googleapis.com/google.protobuf.Any', 'value': { '@type': 'type.googleapis.com/protobuf_unittest.TestAllTypes', 'singleInt32': 20 } } }",
formatter.Format(message));
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
index a6cf04ab7a..f595455aa1 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
@@ -696,22 +696,6 @@ namespace Google.Protobuf
}
[Test]
- public void Value_List_WithNullElement()
- {
- var expected = Value.ForList(Value.ForString("x"), Value.ForNull(), Value.ForString("y"));
- var actual = Value.Parser.ParseJson("[\"x\", null, \"y\"]");
- Assert.AreEqual(expected, actual);
- }
-
- [Test]
- public void StructValue_NullElement()
- {
- var expected = Value.ForStruct(new Struct { Fields = { { "x", Value.ForNull() } } });
- var actual = Value.Parser.ParseJson("{ \"x\": null }");
- Assert.AreEqual(expected, actual);
- }
-
- [Test]
public void ParseListValue()
{
Assert.AreEqual(new ListValue { Values = { Value.ForNumber(1), Value.ForString("x") } }, ListValue.Parser.ParseJson("[1, \"x\"]"));
@@ -825,7 +809,7 @@ namespace Google.Protobuf
var json = formatter.Format(original); // This is tested in JsonFormatterTest
var parser = new JsonParser(new JsonParser.Settings(10, registry));
Assert.AreEqual(original, parser.Parse<Any>(json));
- string valueFirstJson = "{ \"singleInt32\": 10, \"singleNestedMessage\": { \"bb\": 20 }, \"@type\": \"type.googleapis.com/protobuf_unittest3.TestAllTypes\" }";
+ string valueFirstJson = "{ \"singleInt32\": 10, \"singleNestedMessage\": { \"bb\": 20 }, \"@type\": \"type.googleapis.com/protobuf_unittest.TestAllTypes\" }";
Assert.AreEqual(original, parser.Parse<Any>(valueFirstJson));
}
@@ -836,7 +820,7 @@ namespace Google.Protobuf
var message = new TestAllTypes { SingleInt32 = 10 };
var original = Any.Pack(message, "custom.prefix/middle-part");
var parser = new JsonParser(new JsonParser.Settings(10, registry));
- string json = "{ \"@type\": \"custom.prefix/middle-part/protobuf_unittest3.TestAllTypes\", \"singleInt32\": 10 }";
+ string json = "{ \"@type\": \"custom.prefix/middle-part/protobuf_unittest.TestAllTypes\", \"singleInt32\": 10 }";
Assert.AreEqual(original, parser.Parse<Any>(json));
}
@@ -942,27 +926,6 @@ namespace Google.Protobuf
Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
}
- [Test]
- public void UnknownField_NotIgnored()
- {
- string json = "{ \"unknownField\": 10, \"singleString\": \"x\" }";
- Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
- }
-
- [Test]
- [TestCase("5")]
- [TestCase("\"text\"")]
- [TestCase("[0, 1, 2]")]
- [TestCase("{ \"a\": { \"b\": 10 } }")]
- public void UnknownField_Ignored(string value)
- {
- var parser = new JsonParser(JsonParser.Settings.Default.WithIgnoreUnknownFields(true));
- string json = "{ \"unknownField\": " + value + ", \"singleString\": \"x\" }";
- var actual = parser.Parse<TestAllTypes>(json);
- var expected = new TestAllTypes { SingleString = "x" };
- Assert.AreEqual(expected, actual);
- }
-
/// <summary>
/// Various tests use strings which have quotes round them for parsing or as the result
/// of formatting, but without those quotes being specified in the tests (for the sake of readability).
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs
index 33d3503651..527ab3361e 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs
@@ -349,22 +349,6 @@ namespace Google.Protobuf
Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next());
Assert.Throws<InvalidOperationException>(() => tokenizer.Next());
}
-
- [Test]
- [TestCase("{ 'skip': 0, 'next': 1")]
- [TestCase("{ 'skip': [0, 1, 2], 'next': 1")]
- [TestCase("{ 'skip': 'x', 'next': 1")]
- [TestCase("{ 'skip': ['x', 'y'], 'next': 1")]
- [TestCase("{ 'skip': {'a': 0}, 'next': 1")]
- [TestCase("{ 'skip': {'a': [0, {'b':[]}]}, 'next': 1")]
- public void SkipValue(string json)
- {
- var tokenizer = JsonTokenizer.FromTextReader(new StringReader(json.Replace('\'', '"')));
- Assert.AreEqual(JsonToken.StartObject, tokenizer.Next());
- Assert.AreEqual("skip", tokenizer.Next().StringValue);
- tokenizer.SkipValue();
- Assert.AreEqual("next", tokenizer.Next().StringValue);
- }
/// <summary>
/// Asserts that the specified JSON is tokenized into the given sequence of tokens.
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Program.cs
index 7b946cb631..254fb7b8ef 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Program.cs
@@ -1,4 +1,4 @@
-#region Copyright notice and license
+#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2017 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
@@ -29,19 +29,20 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-
-#if NET35
-using System;
+using NUnitLite;
using System.Reflection;
-namespace Google.Protobuf.Compatibility
+namespace Google.Protobuf.Test
{
- // .NET Core (at least netstandard1.0) doesn't have Delegate.CreateDelegate, and .NET 3.5 doesn't have
- // MethodInfo.CreateDelegate. Proxy from one to the other on .NET 3.5...
- internal static class MethodInfoExtensions
+ class Program
{
- internal static Delegate CreateDelegate(this MethodInfo method, Type type) =>
- Delegate.CreateDelegate(type, method);
+ public static int Main(string[] args)
+ {
+ #if NET35
+ return new AutoRun(typeof(Program).Assembly).Execute(args);
+ #else
+ return new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args);
+ #endif
+ }
}
-}
-#endif
+} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs
index 68b4d6af7c..68b4d6af7c 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
index 29a376e049..52d5a67697 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
@@ -48,13 +48,13 @@ namespace Google.Protobuf.Reflection
{
FileDescriptor file = UnittestProto3Reflection.Descriptor;
- Assert.AreEqual("unittest_proto3.proto", file.Name);
- Assert.AreEqual("protobuf_unittest3", file.Package);
+ Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Name);
+ Assert.AreEqual("protobuf_unittest", file.Package);
Assert.AreEqual("UnittestProto", file.Proto.Options.JavaOuterClassname);
- Assert.AreEqual("unittest_proto3.proto", file.Proto.Name);
+ Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Proto.Name);
- // unittest_proto3.proto doesn't have any public imports, but unittest_import_proto3.proto does.
+ // unittest.proto doesn't have any public imports, but unittest_import.proto does.
Assert.AreEqual(0, file.PublicDependencies.Count);
Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.PublicDependencies.Count);
Assert.AreEqual(UnittestImportPublicProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor.PublicDependencies[0]);
@@ -68,7 +68,7 @@ namespace Google.Protobuf.Reflection
Assert.AreEqual(messageType, file.MessageTypes[0]);
Assert.AreEqual(messageType, file.FindTypeByName<MessageDescriptor>("TestAllTypes"));
Assert.Null(file.FindTypeByName<MessageDescriptor>("NoSuchType"));
- Assert.Null(file.FindTypeByName<MessageDescriptor>("protobuf_unittest3.TestAllTypes"));
+ Assert.Null(file.FindTypeByName<MessageDescriptor>("protobuf_unittest.TestAllTypes"));
for (int i = 0; i < file.MessageTypes.Count; i++)
{
Assert.AreEqual(i, file.MessageTypes[i].Index);
@@ -76,7 +76,7 @@ namespace Google.Protobuf.Reflection
Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName<EnumDescriptor>("ForeignEnum"));
Assert.Null(file.FindTypeByName<EnumDescriptor>("NoSuchType"));
- Assert.Null(file.FindTypeByName<EnumDescriptor>("protobuf_unittest3.ForeignEnum"));
+ Assert.Null(file.FindTypeByName<EnumDescriptor>("protobuf_unittest.ForeignEnum"));
Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.EnumTypes.Count);
Assert.AreEqual("ImportEnum", UnittestImportProto3Reflection.Descriptor.EnumTypes[0].Name);
for (int i = 0; i < file.EnumTypes.Count; i++)
@@ -88,23 +88,13 @@ namespace Google.Protobuf.Reflection
}
[Test]
- public void FileDescriptor_NonRootPath()
- {
- // unittest_proto3.proto used to be in google/protobuf. Now it's in the C#-specific location,
- // let's test something that's still in a directory.
- FileDescriptor file = UnittestWellKnownTypesReflection.Descriptor;
- Assert.AreEqual("google/protobuf/unittest_well_known_types.proto", file.Name);
- Assert.AreEqual("protobuf_unittest", file.Package);
- }
-
- [Test]
public void MessageDescriptor()
{
MessageDescriptor messageType = TestAllTypes.Descriptor;
MessageDescriptor nestedType = TestAllTypes.Types.NestedMessage.Descriptor;
Assert.AreEqual("TestAllTypes", messageType.Name);
- Assert.AreEqual("protobuf_unittest3.TestAllTypes", messageType.FullName);
+ Assert.AreEqual("protobuf_unittest.TestAllTypes", messageType.FullName);
Assert.AreEqual(UnittestProto3Reflection.Descriptor, messageType.File);
Assert.IsNull(messageType.ContainingType);
Assert.IsNull(messageType.Proto.Options);
@@ -112,7 +102,7 @@ namespace Google.Protobuf.Reflection
Assert.AreEqual("TestAllTypes", messageType.Name);
Assert.AreEqual("NestedMessage", nestedType.Name);
- Assert.AreEqual("protobuf_unittest3.TestAllTypes.NestedMessage", nestedType.FullName);
+ Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedMessage", nestedType.FullName);
Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File);
Assert.AreEqual(messageType, nestedType.ContainingType);
@@ -153,7 +143,7 @@ namespace Google.Protobuf.Reflection
FieldDescriptor messageField = messageType.FindDescriptor<FieldDescriptor>("single_foreign_message");
Assert.AreEqual("single_int32", primitiveField.Name);
- Assert.AreEqual("protobuf_unittest3.TestAllTypes.single_int32",
+ Assert.AreEqual("protobuf_unittest.TestAllTypes.single_int32",
primitiveField.FullName);
Assert.AreEqual(1, primitiveField.FieldNumber);
Assert.AreEqual(messageType, primitiveField.ContainingType);
@@ -190,13 +180,13 @@ namespace Google.Protobuf.Reflection
EnumDescriptor nestedType = TestAllTypes.Descriptor.FindDescriptor<EnumDescriptor>("NestedEnum");
Assert.AreEqual("ForeignEnum", enumType.Name);
- Assert.AreEqual("protobuf_unittest3.ForeignEnum", enumType.FullName);
+ Assert.AreEqual("protobuf_unittest.ForeignEnum", enumType.FullName);
Assert.AreEqual(UnittestProto3Reflection.Descriptor, enumType.File);
Assert.Null(enumType.ContainingType);
Assert.Null(enumType.Proto.Options);
Assert.AreEqual("NestedEnum", nestedType.Name);
- Assert.AreEqual("protobuf_unittest3.TestAllTypes.NestedEnum",
+ Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum",
nestedType.FullName);
Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File);
Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType);
@@ -219,7 +209,7 @@ namespace Google.Protobuf.Reflection
{
OneofDescriptor descriptor = TestAllTypes.Descriptor.FindDescriptor<OneofDescriptor>("oneof_field");
Assert.AreEqual("oneof_field", descriptor.Name);
- Assert.AreEqual("protobuf_unittest3.TestAllTypes.oneof_field", descriptor.FullName);
+ Assert.AreEqual("protobuf_unittest.TestAllTypes.oneof_field", descriptor.FullName);
var expectedFields = new[] {
TestAllTypes.OneofBytesFieldNumber,
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
index a488af30d4..a488af30d4 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs
index 5be7ca2361..5be7ca2361 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleEnum.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/SampleEnum.cs
index 77447afa12..77447afa12 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleEnum.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/SampleEnum.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleMessages.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/SampleMessages.cs
index ffa4e2a7c2..ffa4e2a7c2 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleMessages.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/SampleMessages.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestCornerCases.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
index fd75b19f42..fd75b19f42 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs
index 5663a69902..5663a69902 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
index 51715a0c03..9c0518a399 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: map_unittest_proto3.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/map_unittest_proto3.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -11,11 +9,11 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
- /// <summary>Holder for reflection information generated from map_unittest_proto3.proto</summary>
+ /// <summary>Holder for reflection information generated from google/protobuf/map_unittest_proto3.proto</summary>
public static partial class MapUnittestProto3Reflection {
#region Descriptor
- /// <summary>File descriptor for map_unittest_proto3.proto</summary>
+ /// <summary>File descriptor for google/protobuf/map_unittest_proto3.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -24,130 +22,130 @@ namespace Google.Protobuf.TestProtos {
static MapUnittestProto3Reflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChltYXBfdW5pdHRlc3RfcHJvdG8zLnByb3RvEhJwcm90b2J1Zl91bml0dGVz",
- "dDMaFXVuaXR0ZXN0X3Byb3RvMy5wcm90byKpEgoHVGVzdE1hcBJHCg9tYXBf",
- "aW50MzJfaW50MzIYASADKAsyLi5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE1h",
- "cC5NYXBJbnQzMkludDMyRW50cnkSRwoPbWFwX2ludDY0X2ludDY0GAIgAygL",
- "Mi4ucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RNYXAuTWFwSW50NjRJbnQ2NEVu",
- "dHJ5EksKEW1hcF91aW50MzJfdWludDMyGAMgAygLMjAucHJvdG9idWZfdW5p",
- "dHRlc3QzLlRlc3RNYXAuTWFwVWludDMyVWludDMyRW50cnkSSwoRbWFwX3Vp",
- "bnQ2NF91aW50NjQYBCADKAsyMC5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE1h",
- "cC5NYXBVaW50NjRVaW50NjRFbnRyeRJLChFtYXBfc2ludDMyX3NpbnQzMhgF",
- "IAMoCzIwLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TWFwLk1hcFNpbnQzMlNp",
- "bnQzMkVudHJ5EksKEW1hcF9zaW50NjRfc2ludDY0GAYgAygLMjAucHJvdG9i",
- "dWZfdW5pdHRlc3QzLlRlc3RNYXAuTWFwU2ludDY0U2ludDY0RW50cnkSTwoT",
- "bWFwX2ZpeGVkMzJfZml4ZWQzMhgHIAMoCzIyLnByb3RvYnVmX3VuaXR0ZXN0",
- "My5UZXN0TWFwLk1hcEZpeGVkMzJGaXhlZDMyRW50cnkSTwoTbWFwX2ZpeGVk",
- "NjRfZml4ZWQ2NBgIIAMoCzIyLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TWFw",
- "Lk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSUwoVbWFwX3NmaXhlZDMyX3NmaXhl",
- "ZDMyGAkgAygLMjQucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RNYXAuTWFwU2Zp",
- "eGVkMzJTZml4ZWQzMkVudHJ5ElMKFW1hcF9zZml4ZWQ2NF9zZml4ZWQ2NBgK",
- "IAMoCzI0LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TWFwLk1hcFNmaXhlZDY0",
- "U2ZpeGVkNjRFbnRyeRJHCg9tYXBfaW50MzJfZmxvYXQYCyADKAsyLi5wcm90",
- "b2J1Zl91bml0dGVzdDMuVGVzdE1hcC5NYXBJbnQzMkZsb2F0RW50cnkSSQoQ",
- "bWFwX2ludDMyX2RvdWJsZRgMIAMoCzIvLnByb3RvYnVmX3VuaXR0ZXN0My5U",
- "ZXN0TWFwLk1hcEludDMyRG91YmxlRW50cnkSQwoNbWFwX2Jvb2xfYm9vbBgN",
- "IAMoCzIsLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TWFwLk1hcEJvb2xCb29s",
- "RW50cnkSSwoRbWFwX3N0cmluZ19zdHJpbmcYDiADKAsyMC5wcm90b2J1Zl91",
- "bml0dGVzdDMuVGVzdE1hcC5NYXBTdHJpbmdTdHJpbmdFbnRyeRJHCg9tYXBf",
- "aW50MzJfYnl0ZXMYDyADKAsyLi5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE1h",
- "cC5NYXBJbnQzMkJ5dGVzRW50cnkSRQoObWFwX2ludDMyX2VudW0YECADKAsy",
- "LS5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE1hcC5NYXBJbnQzMkVudW1FbnRy",
- "eRJaChltYXBfaW50MzJfZm9yZWlnbl9tZXNzYWdlGBEgAygLMjcucHJvdG9i",
- "dWZfdW5pdHRlc3QzLlRlc3RNYXAuTWFwSW50MzJGb3JlaWduTWVzc2FnZUVu",
- "dHJ5GjQKEk1hcEludDMySW50MzJFbnRyeRILCgNrZXkYASABKAUSDQoFdmFs",
- "dWUYAiABKAU6AjgBGjQKEk1hcEludDY0SW50NjRFbnRyeRILCgNrZXkYASAB",
- "KAMSDQoFdmFsdWUYAiABKAM6AjgBGjYKFE1hcFVpbnQzMlVpbnQzMkVudHJ5",
- "EgsKA2tleRgBIAEoDRINCgV2YWx1ZRgCIAEoDToCOAEaNgoUTWFwVWludDY0",
- "VWludDY0RW50cnkSCwoDa2V5GAEgASgEEg0KBXZhbHVlGAIgASgEOgI4ARo2",
- "ChRNYXBTaW50MzJTaW50MzJFbnRyeRILCgNrZXkYASABKBESDQoFdmFsdWUY",
- "AiABKBE6AjgBGjYKFE1hcFNpbnQ2NFNpbnQ2NEVudHJ5EgsKA2tleRgBIAEo",
- "EhINCgV2YWx1ZRgCIAEoEjoCOAEaOAoWTWFwRml4ZWQzMkZpeGVkMzJFbnRy",
- "eRILCgNrZXkYASABKAcSDQoFdmFsdWUYAiABKAc6AjgBGjgKFk1hcEZpeGVk",
- "NjRGaXhlZDY0RW50cnkSCwoDa2V5GAEgASgGEg0KBXZhbHVlGAIgASgGOgI4",
- "ARo6ChhNYXBTZml4ZWQzMlNmaXhlZDMyRW50cnkSCwoDa2V5GAEgASgPEg0K",
- "BXZhbHVlGAIgASgPOgI4ARo6ChhNYXBTZml4ZWQ2NFNmaXhlZDY0RW50cnkS",
- "CwoDa2V5GAEgASgQEg0KBXZhbHVlGAIgASgQOgI4ARo0ChJNYXBJbnQzMkZs",
- "b2F0RW50cnkSCwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgCOgI4ARo1ChNN",
- "YXBJbnQzMkRvdWJsZUVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEo",
- "AToCOAEaMgoQTWFwQm9vbEJvb2xFbnRyeRILCgNrZXkYASABKAgSDQoFdmFs",
- "dWUYAiABKAg6AjgBGjYKFE1hcFN0cmluZ1N0cmluZ0VudHJ5EgsKA2tleRgB",
- "IAEoCRINCgV2YWx1ZRgCIAEoCToCOAEaNAoSTWFwSW50MzJCeXRlc0VudHJ5",
- "EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoDDoCOAEaUAoRTWFwSW50MzJF",
- "bnVtRW50cnkSCwoDa2V5GAEgASgFEioKBXZhbHVlGAIgASgOMhsucHJvdG9i",
- "dWZfdW5pdHRlc3QzLk1hcEVudW06AjgBGmEKG01hcEludDMyRm9yZWlnbk1l",
- "c3NhZ2VFbnRyeRILCgNrZXkYASABKAUSMQoFdmFsdWUYAiABKAsyIi5wcm90",
- "b2J1Zl91bml0dGVzdDMuRm9yZWlnbk1lc3NhZ2U6AjgBIkIKEVRlc3RNYXBT",
- "dWJtZXNzYWdlEi0KCHRlc3RfbWFwGAEgASgLMhsucHJvdG9idWZfdW5pdHRl",
- "c3QzLlRlc3RNYXAivgEKDlRlc3RNZXNzYWdlTWFwElIKEW1hcF9pbnQzMl9t",
- "ZXNzYWdlGAEgAygLMjcucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RNZXNzYWdl",
- "TWFwLk1hcEludDMyTWVzc2FnZUVudHJ5GlgKFE1hcEludDMyTWVzc2FnZUVu",
- "dHJ5EgsKA2tleRgBIAEoBRIvCgV2YWx1ZRgCIAEoCzIgLnByb3RvYnVmX3Vu",
- "aXR0ZXN0My5UZXN0QWxsVHlwZXM6AjgBIuUBCg9UZXN0U2FtZVR5cGVNYXAS",
- "OwoEbWFwMRgBIAMoCzItLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0U2FtZVR5",
- "cGVNYXAuTWFwMUVudHJ5EjsKBG1hcDIYAiADKAsyLS5wcm90b2J1Zl91bml0",
- "dGVzdDMuVGVzdFNhbWVUeXBlTWFwLk1hcDJFbnRyeRorCglNYXAxRW50cnkS",
- "CwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgFOgI4ARorCglNYXAyRW50cnkS",
- "CwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgFOgI4ASL1EAoMVGVzdEFyZW5h",
- "TWFwEkwKD21hcF9pbnQzMl9pbnQzMhgBIAMoCzIzLnByb3RvYnVmX3VuaXR0",
- "ZXN0My5UZXN0QXJlbmFNYXAuTWFwSW50MzJJbnQzMkVudHJ5EkwKD21hcF9p",
- "bnQ2NF9pbnQ2NBgCIAMoCzIzLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QXJl",
- "bmFNYXAuTWFwSW50NjRJbnQ2NEVudHJ5ElAKEW1hcF91aW50MzJfdWludDMy",
- "GAMgAygLMjUucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVuYU1hcC5NYXBV",
- "aW50MzJVaW50MzJFbnRyeRJQChFtYXBfdWludDY0X3VpbnQ2NBgEIAMoCzI1",
- "LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QXJlbmFNYXAuTWFwVWludDY0VWlu",
- "dDY0RW50cnkSUAoRbWFwX3NpbnQzMl9zaW50MzIYBSADKAsyNS5wcm90b2J1",
- "Zl91bml0dGVzdDMuVGVzdEFyZW5hTWFwLk1hcFNpbnQzMlNpbnQzMkVudHJ5",
- "ElAKEW1hcF9zaW50NjRfc2ludDY0GAYgAygLMjUucHJvdG9idWZfdW5pdHRl",
- "c3QzLlRlc3RBcmVuYU1hcC5NYXBTaW50NjRTaW50NjRFbnRyeRJUChNtYXBf",
- "Zml4ZWQzMl9maXhlZDMyGAcgAygLMjcucHJvdG9idWZfdW5pdHRlc3QzLlRl",
- "c3RBcmVuYU1hcC5NYXBGaXhlZDMyRml4ZWQzMkVudHJ5ElQKE21hcF9maXhl",
- "ZDY0X2ZpeGVkNjQYCCADKAsyNy5wcm90b2J1Zl91bml0dGVzdDMuVGVzdEFy",
- "ZW5hTWFwLk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSWAoVbWFwX3NmaXhlZDMy",
- "X3NmaXhlZDMyGAkgAygLMjkucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVu",
- "YU1hcC5NYXBTZml4ZWQzMlNmaXhlZDMyRW50cnkSWAoVbWFwX3NmaXhlZDY0",
- "X3NmaXhlZDY0GAogAygLMjkucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVu",
- "YU1hcC5NYXBTZml4ZWQ2NFNmaXhlZDY0RW50cnkSTAoPbWFwX2ludDMyX2Zs",
- "b2F0GAsgAygLMjMucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVuYU1hcC5N",
- "YXBJbnQzMkZsb2F0RW50cnkSTgoQbWFwX2ludDMyX2RvdWJsZRgMIAMoCzI0",
- "LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QXJlbmFNYXAuTWFwSW50MzJEb3Vi",
- "bGVFbnRyeRJICg1tYXBfYm9vbF9ib29sGA0gAygLMjEucHJvdG9idWZfdW5p",
- "dHRlc3QzLlRlc3RBcmVuYU1hcC5NYXBCb29sQm9vbEVudHJ5EkoKDm1hcF9p",
- "bnQzMl9lbnVtGA4gAygLMjIucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVu",
- "YU1hcC5NYXBJbnQzMkVudW1FbnRyeRJfChltYXBfaW50MzJfZm9yZWlnbl9t",
- "ZXNzYWdlGA8gAygLMjwucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVuYU1h",
- "cC5NYXBJbnQzMkZvcmVpZ25NZXNzYWdlRW50cnkaNAoSTWFwSW50MzJJbnQz",
- "MkVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaNAoSTWFw",
- "SW50NjRJbnQ2NEVudHJ5EgsKA2tleRgBIAEoAxINCgV2YWx1ZRgCIAEoAzoC",
- "OAEaNgoUTWFwVWludDMyVWludDMyRW50cnkSCwoDa2V5GAEgASgNEg0KBXZh",
- "bHVlGAIgASgNOgI4ARo2ChRNYXBVaW50NjRVaW50NjRFbnRyeRILCgNrZXkY",
- "ASABKAQSDQoFdmFsdWUYAiABKAQ6AjgBGjYKFE1hcFNpbnQzMlNpbnQzMkVu",
- "dHJ5EgsKA2tleRgBIAEoERINCgV2YWx1ZRgCIAEoEToCOAEaNgoUTWFwU2lu",
- "dDY0U2ludDY0RW50cnkSCwoDa2V5GAEgASgSEg0KBXZhbHVlGAIgASgSOgI4",
- "ARo4ChZNYXBGaXhlZDMyRml4ZWQzMkVudHJ5EgsKA2tleRgBIAEoBxINCgV2",
- "YWx1ZRgCIAEoBzoCOAEaOAoWTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRILCgNr",
- "ZXkYASABKAYSDQoFdmFsdWUYAiABKAY6AjgBGjoKGE1hcFNmaXhlZDMyU2Zp",
- "eGVkMzJFbnRyeRILCgNrZXkYASABKA8SDQoFdmFsdWUYAiABKA86AjgBGjoK",
- "GE1hcFNmaXhlZDY0U2ZpeGVkNjRFbnRyeRILCgNrZXkYASABKBASDQoFdmFs",
- "dWUYAiABKBA6AjgBGjQKEk1hcEludDMyRmxvYXRFbnRyeRILCgNrZXkYASAB",
- "KAUSDQoFdmFsdWUYAiABKAI6AjgBGjUKE01hcEludDMyRG91YmxlRW50cnkS",
- "CwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgBOgI4ARoyChBNYXBCb29sQm9v",
- "bEVudHJ5EgsKA2tleRgBIAEoCBINCgV2YWx1ZRgCIAEoCDoCOAEaUAoRTWFw",
- "SW50MzJFbnVtRW50cnkSCwoDa2V5GAEgASgFEioKBXZhbHVlGAIgASgOMhsu",
- "cHJvdG9idWZfdW5pdHRlc3QzLk1hcEVudW06AjgBGmEKG01hcEludDMyRm9y",
- "ZWlnbk1lc3NhZ2VFbnRyeRILCgNrZXkYASABKAUSMQoFdmFsdWUYAiABKAsy",
- "Ii5wcm90b2J1Zl91bml0dGVzdDMuRm9yZWlnbk1lc3NhZ2U6AjgBIuYBCh9N",
- "ZXNzYWdlQ29udGFpbmluZ0VudW1DYWxsZWRUeXBlEksKBHR5cGUYASADKAsy",
- "PS5wcm90b2J1Zl91bml0dGVzdDMuTWVzc2FnZUNvbnRhaW5pbmdFbnVtQ2Fs",
- "bGVkVHlwZS5UeXBlRW50cnkaYAoJVHlwZUVudHJ5EgsKA2tleRgBIAEoBRJC",
- "CgV2YWx1ZRgCIAEoCzIzLnByb3RvYnVmX3VuaXR0ZXN0My5NZXNzYWdlQ29u",
- "dGFpbmluZ0VudW1DYWxsZWRUeXBlOgI4ASIUCgRUeXBlEgwKCFRZUEVfRk9P",
- "EAAingEKH01lc3NhZ2VDb250YWluaW5nTWFwQ2FsbGVkRW50cnkSTQoFZW50",
- "cnkYASADKAsyPi5wcm90b2J1Zl91bml0dGVzdDMuTWVzc2FnZUNvbnRhaW5p",
- "bmdNYXBDYWxsZWRFbnRyeS5FbnRyeUVudHJ5GiwKCkVudHJ5RW50cnkSCwoD",
- "a2V5GAEgASgFEg0KBXZhbHVlGAIgASgFOgI4ASo/CgdNYXBFbnVtEhAKDE1B",
- "UF9FTlVNX0ZPTxAAEhAKDE1BUF9FTlVNX0JBUhABEhAKDE1BUF9FTlVNX0JB",
- "WhACQh2qAhpHb29nbGUuUHJvdG9idWYuVGVzdFByb3Rvc2IGcHJvdG8z"));
+ "Cilnb29nbGUvcHJvdG9idWYvbWFwX3VuaXR0ZXN0X3Byb3RvMy5wcm90bxIR",
+ "cHJvdG9idWZfdW5pdHRlc3QaJWdvb2dsZS9wcm90b2J1Zi91bml0dGVzdF9w",
+ "cm90bzMucHJvdG8ilhIKB1Rlc3RNYXASRgoPbWFwX2ludDMyX2ludDMyGAEg",
+ "AygLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkludDMy",
+ "RW50cnkSRgoPbWFwX2ludDY0X2ludDY0GAIgAygLMi0ucHJvdG9idWZfdW5p",
+ "dHRlc3QuVGVzdE1hcC5NYXBJbnQ2NEludDY0RW50cnkSSgoRbWFwX3VpbnQz",
+ "Ml91aW50MzIYAyADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1h",
+ "cFVpbnQzMlVpbnQzMkVudHJ5EkoKEW1hcF91aW50NjRfdWludDY0GAQgAygL",
+ "Mi8ucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBVaW50NjRVaW50NjRF",
+ "bnRyeRJKChFtYXBfc2ludDMyX3NpbnQzMhgFIAMoCzIvLnByb3RvYnVmX3Vu",
+ "aXR0ZXN0LlRlc3RNYXAuTWFwU2ludDMyU2ludDMyRW50cnkSSgoRbWFwX3Np",
+ "bnQ2NF9zaW50NjQYBiADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFw",
+ "Lk1hcFNpbnQ2NFNpbnQ2NEVudHJ5Ek4KE21hcF9maXhlZDMyX2ZpeGVkMzIY",
+ "ByADKAsyMS5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1hcEZpeGVkMzJG",
+ "aXhlZDMyRW50cnkSTgoTbWFwX2ZpeGVkNjRfZml4ZWQ2NBgIIAMoCzIxLnBy",
+ "b3RvYnVmX3VuaXR0ZXN0LlRlc3RNYXAuTWFwRml4ZWQ2NEZpeGVkNjRFbnRy",
+ "eRJSChVtYXBfc2ZpeGVkMzJfc2ZpeGVkMzIYCSADKAsyMy5wcm90b2J1Zl91",
+ "bml0dGVzdC5UZXN0TWFwLk1hcFNmaXhlZDMyU2ZpeGVkMzJFbnRyeRJSChVt",
+ "YXBfc2ZpeGVkNjRfc2ZpeGVkNjQYCiADKAsyMy5wcm90b2J1Zl91bml0dGVz",
+ "dC5UZXN0TWFwLk1hcFNmaXhlZDY0U2ZpeGVkNjRFbnRyeRJGCg9tYXBfaW50",
+ "MzJfZmxvYXQYCyADKAsyLS5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1h",
+ "cEludDMyRmxvYXRFbnRyeRJIChBtYXBfaW50MzJfZG91YmxlGAwgAygLMi4u",
+ "cHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkRvdWJsZUVudHJ5",
+ "EkIKDW1hcF9ib29sX2Jvb2wYDSADKAsyKy5wcm90b2J1Zl91bml0dGVzdC5U",
+ "ZXN0TWFwLk1hcEJvb2xCb29sRW50cnkSSgoRbWFwX3N0cmluZ19zdHJpbmcY",
+ "DiADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1hcFN0cmluZ1N0",
+ "cmluZ0VudHJ5EkYKD21hcF9pbnQzMl9ieXRlcxgPIAMoCzItLnByb3RvYnVm",
+ "X3VuaXR0ZXN0LlRlc3RNYXAuTWFwSW50MzJCeXRlc0VudHJ5EkQKDm1hcF9p",
+ "bnQzMl9lbnVtGBAgAygLMiwucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5N",
+ "YXBJbnQzMkVudW1FbnRyeRJZChltYXBfaW50MzJfZm9yZWlnbl9tZXNzYWdl",
+ "GBEgAygLMjYucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkZv",
+ "cmVpZ25NZXNzYWdlRW50cnkaNAoSTWFwSW50MzJJbnQzMkVudHJ5EgsKA2tl",
+ "eRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaNAoSTWFwSW50NjRJbnQ2NEVu",
+ "dHJ5EgsKA2tleRgBIAEoAxINCgV2YWx1ZRgCIAEoAzoCOAEaNgoUTWFwVWlu",
+ "dDMyVWludDMyRW50cnkSCwoDa2V5GAEgASgNEg0KBXZhbHVlGAIgASgNOgI4",
+ "ARo2ChRNYXBVaW50NjRVaW50NjRFbnRyeRILCgNrZXkYASABKAQSDQoFdmFs",
+ "dWUYAiABKAQ6AjgBGjYKFE1hcFNpbnQzMlNpbnQzMkVudHJ5EgsKA2tleRgB",
+ "IAEoERINCgV2YWx1ZRgCIAEoEToCOAEaNgoUTWFwU2ludDY0U2ludDY0RW50",
+ "cnkSCwoDa2V5GAEgASgSEg0KBXZhbHVlGAIgASgSOgI4ARo4ChZNYXBGaXhl",
+ "ZDMyRml4ZWQzMkVudHJ5EgsKA2tleRgBIAEoBxINCgV2YWx1ZRgCIAEoBzoC",
+ "OAEaOAoWTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRILCgNrZXkYASABKAYSDQoF",
+ "dmFsdWUYAiABKAY6AjgBGjoKGE1hcFNmaXhlZDMyU2ZpeGVkMzJFbnRyeRIL",
+ "CgNrZXkYASABKA8SDQoFdmFsdWUYAiABKA86AjgBGjoKGE1hcFNmaXhlZDY0",
+ "U2ZpeGVkNjRFbnRyeRILCgNrZXkYASABKBASDQoFdmFsdWUYAiABKBA6AjgB",
+ "GjQKEk1hcEludDMyRmxvYXRFbnRyeRILCgNrZXkYASABKAUSDQoFdmFsdWUY",
+ "AiABKAI6AjgBGjUKE01hcEludDMyRG91YmxlRW50cnkSCwoDa2V5GAEgASgF",
+ "Eg0KBXZhbHVlGAIgASgBOgI4ARoyChBNYXBCb29sQm9vbEVudHJ5EgsKA2tl",
+ "eRgBIAEoCBINCgV2YWx1ZRgCIAEoCDoCOAEaNgoUTWFwU3RyaW5nU3RyaW5n",
+ "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ARo0ChJNYXBJ",
+ "bnQzMkJ5dGVzRW50cnkSCwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgMOgI4",
+ "ARpPChFNYXBJbnQzMkVudW1FbnRyeRILCgNrZXkYASABKAUSKQoFdmFsdWUY",
+ "AiABKA4yGi5wcm90b2J1Zl91bml0dGVzdC5NYXBFbnVtOgI4ARpgChtNYXBJ",
+ "bnQzMkZvcmVpZ25NZXNzYWdlRW50cnkSCwoDa2V5GAEgASgFEjAKBXZhbHVl",
+ "GAIgASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2U6AjgB",
+ "IkEKEVRlc3RNYXBTdWJtZXNzYWdlEiwKCHRlc3RfbWFwGAEgASgLMhoucHJv",
+ "dG9idWZfdW5pdHRlc3QuVGVzdE1hcCK8AQoOVGVzdE1lc3NhZ2VNYXASUQoR",
+ "bWFwX2ludDMyX21lc3NhZ2UYASADKAsyNi5wcm90b2J1Zl91bml0dGVzdC5U",
+ "ZXN0TWVzc2FnZU1hcC5NYXBJbnQzMk1lc3NhZ2VFbnRyeRpXChRNYXBJbnQz",
+ "Mk1lc3NhZ2VFbnRyeRILCgNrZXkYASABKAUSLgoFdmFsdWUYAiABKAsyHy5w",
+ "cm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXM6AjgBIuMBCg9UZXN0U2Ft",
+ "ZVR5cGVNYXASOgoEbWFwMRgBIAMoCzIsLnByb3RvYnVmX3VuaXR0ZXN0LlRl",
+ "c3RTYW1lVHlwZU1hcC5NYXAxRW50cnkSOgoEbWFwMhgCIAMoCzIsLnByb3Rv",
+ "YnVmX3VuaXR0ZXN0LlRlc3RTYW1lVHlwZU1hcC5NYXAyRW50cnkaKwoJTWFw",
+ "MUVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaKwoJTWFw",
+ "MkVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEi5BAKDFRl",
+ "c3RBcmVuYU1hcBJLCg9tYXBfaW50MzJfaW50MzIYASADKAsyMi5wcm90b2J1",
+ "Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwSW50MzJJbnQzMkVudHJ5EksK",
+ "D21hcF9pbnQ2NF9pbnQ2NBgCIAMoCzIyLnByb3RvYnVmX3VuaXR0ZXN0LlRl",
+ "c3RBcmVuYU1hcC5NYXBJbnQ2NEludDY0RW50cnkSTwoRbWFwX3VpbnQzMl91",
+ "aW50MzIYAyADKAsyNC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAu",
+ "TWFwVWludDMyVWludDMyRW50cnkSTwoRbWFwX3VpbnQ2NF91aW50NjQYBCAD",
+ "KAsyNC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwVWludDY0",
+ "VWludDY0RW50cnkSTwoRbWFwX3NpbnQzMl9zaW50MzIYBSADKAsyNC5wcm90",
+ "b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwU2ludDMyU2ludDMyRW50",
+ "cnkSTwoRbWFwX3NpbnQ2NF9zaW50NjQYBiADKAsyNC5wcm90b2J1Zl91bml0",
+ "dGVzdC5UZXN0QXJlbmFNYXAuTWFwU2ludDY0U2ludDY0RW50cnkSUwoTbWFw",
+ "X2ZpeGVkMzJfZml4ZWQzMhgHIAMoCzI2LnByb3RvYnVmX3VuaXR0ZXN0LlRl",
+ "c3RBcmVuYU1hcC5NYXBGaXhlZDMyRml4ZWQzMkVudHJ5ElMKE21hcF9maXhl",
+ "ZDY0X2ZpeGVkNjQYCCADKAsyNi5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJl",
+ "bmFNYXAuTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRJXChVtYXBfc2ZpeGVkMzJf",
+ "c2ZpeGVkMzIYCSADKAsyOC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFN",
+ "YXAuTWFwU2ZpeGVkMzJTZml4ZWQzMkVudHJ5ElcKFW1hcF9zZml4ZWQ2NF9z",
+ "Zml4ZWQ2NBgKIAMoCzI4LnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBcmVuYU1h",
+ "cC5NYXBTZml4ZWQ2NFNmaXhlZDY0RW50cnkSSwoPbWFwX2ludDMyX2Zsb2F0",
+ "GAsgAygLMjIucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1hcElu",
+ "dDMyRmxvYXRFbnRyeRJNChBtYXBfaW50MzJfZG91YmxlGAwgAygLMjMucHJv",
+ "dG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1hcEludDMyRG91YmxlRW50",
+ "cnkSRwoNbWFwX2Jvb2xfYm9vbBgNIAMoCzIwLnByb3RvYnVmX3VuaXR0ZXN0",
+ "LlRlc3RBcmVuYU1hcC5NYXBCb29sQm9vbEVudHJ5EkkKDm1hcF9pbnQzMl9l",
+ "bnVtGA4gAygLMjEucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1h",
+ "cEludDMyRW51bUVudHJ5El4KGW1hcF9pbnQzMl9mb3JlaWduX21lc3NhZ2UY",
+ "DyADKAsyOy5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwSW50",
+ "MzJGb3JlaWduTWVzc2FnZUVudHJ5GjQKEk1hcEludDMySW50MzJFbnRyeRIL",
+ "CgNrZXkYASABKAUSDQoFdmFsdWUYAiABKAU6AjgBGjQKEk1hcEludDY0SW50",
+ "NjRFbnRyeRILCgNrZXkYASABKAMSDQoFdmFsdWUYAiABKAM6AjgBGjYKFE1h",
+ "cFVpbnQzMlVpbnQzMkVudHJ5EgsKA2tleRgBIAEoDRINCgV2YWx1ZRgCIAEo",
+ "DToCOAEaNgoUTWFwVWludDY0VWludDY0RW50cnkSCwoDa2V5GAEgASgEEg0K",
+ "BXZhbHVlGAIgASgEOgI4ARo2ChRNYXBTaW50MzJTaW50MzJFbnRyeRILCgNr",
+ "ZXkYASABKBESDQoFdmFsdWUYAiABKBE6AjgBGjYKFE1hcFNpbnQ2NFNpbnQ2",
+ "NEVudHJ5EgsKA2tleRgBIAEoEhINCgV2YWx1ZRgCIAEoEjoCOAEaOAoWTWFw",
+ "Rml4ZWQzMkZpeGVkMzJFbnRyeRILCgNrZXkYASABKAcSDQoFdmFsdWUYAiAB",
+ "KAc6AjgBGjgKFk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSCwoDa2V5GAEgASgG",
+ "Eg0KBXZhbHVlGAIgASgGOgI4ARo6ChhNYXBTZml4ZWQzMlNmaXhlZDMyRW50",
+ "cnkSCwoDa2V5GAEgASgPEg0KBXZhbHVlGAIgASgPOgI4ARo6ChhNYXBTZml4",
+ "ZWQ2NFNmaXhlZDY0RW50cnkSCwoDa2V5GAEgASgQEg0KBXZhbHVlGAIgASgQ",
+ "OgI4ARo0ChJNYXBJbnQzMkZsb2F0RW50cnkSCwoDa2V5GAEgASgFEg0KBXZh",
+ "bHVlGAIgASgCOgI4ARo1ChNNYXBJbnQzMkRvdWJsZUVudHJ5EgsKA2tleRgB",
+ "IAEoBRINCgV2YWx1ZRgCIAEoAToCOAEaMgoQTWFwQm9vbEJvb2xFbnRyeRIL",
+ "CgNrZXkYASABKAgSDQoFdmFsdWUYAiABKAg6AjgBGk8KEU1hcEludDMyRW51",
+ "bUVudHJ5EgsKA2tleRgBIAEoBRIpCgV2YWx1ZRgCIAEoDjIaLnByb3RvYnVm",
+ "X3VuaXR0ZXN0Lk1hcEVudW06AjgBGmAKG01hcEludDMyRm9yZWlnbk1lc3Nh",
+ "Z2VFbnRyeRILCgNrZXkYASABKAUSMAoFdmFsdWUYAiABKAsyIS5wcm90b2J1",
+ "Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZToCOAEi5AEKH01lc3NhZ2VDb250",
+ "YWluaW5nRW51bUNhbGxlZFR5cGUSSgoEdHlwZRgBIAMoCzI8LnByb3RvYnVm",
+ "X3VuaXR0ZXN0Lk1lc3NhZ2VDb250YWluaW5nRW51bUNhbGxlZFR5cGUuVHlw",
+ "ZUVudHJ5Gl8KCVR5cGVFbnRyeRILCgNrZXkYASABKAUSQQoFdmFsdWUYAiAB",
+ "KAsyMi5wcm90b2J1Zl91bml0dGVzdC5NZXNzYWdlQ29udGFpbmluZ0VudW1D",
+ "YWxsZWRUeXBlOgI4ASIUCgRUeXBlEgwKCFRZUEVfRk9PEAAinQEKH01lc3Nh",
+ "Z2VDb250YWluaW5nTWFwQ2FsbGVkRW50cnkSTAoFZW50cnkYASADKAsyPS5w",
+ "cm90b2J1Zl91bml0dGVzdC5NZXNzYWdlQ29udGFpbmluZ01hcENhbGxlZEVu",
+ "dHJ5LkVudHJ5RW50cnkaLAoKRW50cnlFbnRyeRILCgNrZXkYASABKAUSDQoF",
+ "dmFsdWUYAiABKAU6AjgBKj8KB01hcEVudW0SEAoMTUFQX0VOVU1fRk9PEAAS",
+ "EAoMTUFQX0VOVU1fQkFSEAESEAoMTUFQX0VOVU1fQkFaEAJCIPgBAaoCGkdv",
+ "b2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.MapEnum), }, new pbr::GeneratedClrTypeInfo[] {
@@ -178,7 +176,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestMap : pb::IMessage<TestMap> {
private static readonly pb::MessageParser<TestMap> _parser = new pb::MessageParser<TestMap>(() => new TestMap());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestMap> Parser { get { return _parser; } }
@@ -218,7 +215,6 @@ namespace Google.Protobuf.TestProtos {
mapInt32Bytes_ = other.mapInt32Bytes_.Clone();
mapInt32Enum_ = other.mapInt32Enum_.Clone();
mapInt32ForeignMessage_ = other.mapInt32ForeignMessage_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -426,7 +422,7 @@ namespace Google.Protobuf.TestProtos {
if (!MapInt32Bytes.Equals(other.MapInt32Bytes)) return false;
if (!MapInt32Enum.Equals(other.MapInt32Enum)) return false;
if (!MapInt32ForeignMessage.Equals(other.MapInt32ForeignMessage)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -449,9 +445,6 @@ namespace Google.Protobuf.TestProtos {
hash ^= MapInt32Bytes.GetHashCode();
hash ^= MapInt32Enum.GetHashCode();
hash ^= MapInt32ForeignMessage.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -479,9 +472,6 @@ namespace Google.Protobuf.TestProtos {
mapInt32Bytes_.WriteTo(output, _map_mapInt32Bytes_codec);
mapInt32Enum_.WriteTo(output, _map_mapInt32Enum_codec);
mapInt32ForeignMessage_.WriteTo(output, _map_mapInt32ForeignMessage_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -504,9 +494,6 @@ namespace Google.Protobuf.TestProtos {
size += mapInt32Bytes_.CalculateSize(_map_mapInt32Bytes_codec);
size += mapInt32Enum_.CalculateSize(_map_mapInt32Enum_codec);
size += mapInt32ForeignMessage_.CalculateSize(_map_mapInt32ForeignMessage_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -532,7 +519,6 @@ namespace Google.Protobuf.TestProtos {
mapInt32Bytes_.Add(other.mapInt32Bytes_);
mapInt32Enum_.Add(other.mapInt32Enum_);
mapInt32ForeignMessage_.Add(other.mapInt32ForeignMessage_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -541,7 +527,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
@@ -619,7 +605,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestMapSubmessage : pb::IMessage<TestMapSubmessage> {
private static readonly pb::MessageParser<TestMapSubmessage> _parser = new pb::MessageParser<TestMapSubmessage>(() => new TestMapSubmessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestMapSubmessage> Parser { get { return _parser; } }
@@ -642,8 +627,7 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestMapSubmessage(TestMapSubmessage other) : this() {
- testMap_ = other.testMap_ != null ? other.testMap_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ TestMap = other.testMap_ != null ? other.TestMap.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -676,16 +660,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (!object.Equals(TestMap, other.TestMap)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (testMap_ != null) hash ^= TestMap.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -700,9 +681,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(10);
output.WriteMessage(TestMap);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -711,9 +689,6 @@ namespace Google.Protobuf.TestProtos {
if (testMap_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(TestMap);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -728,7 +703,6 @@ namespace Google.Protobuf.TestProtos {
}
TestMap.MergeFrom(other.TestMap);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -737,7 +711,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
if (testMap_ == null) {
@@ -754,7 +728,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestMessageMap : pb::IMessage<TestMessageMap> {
private static readonly pb::MessageParser<TestMessageMap> _parser = new pb::MessageParser<TestMessageMap>(() => new TestMessageMap());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestMessageMap> Parser { get { return _parser; } }
@@ -778,7 +751,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestMessageMap(TestMessageMap other) : this() {
mapInt32Message_ = other.mapInt32Message_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -810,16 +782,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (!MapInt32Message.Equals(other.MapInt32Message)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= MapInt32Message.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -831,18 +800,12 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
mapInt32Message_.WriteTo(output, _map_mapInt32Message_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += mapInt32Message_.CalculateSize(_map_mapInt32Message_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -852,7 +815,6 @@ namespace Google.Protobuf.TestProtos {
return;
}
mapInt32Message_.Add(other.mapInt32Message_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -861,7 +823,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
mapInt32Message_.AddEntriesFrom(input, _map_mapInt32Message_codec);
@@ -878,7 +840,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestSameTypeMap : pb::IMessage<TestSameTypeMap> {
private static readonly pb::MessageParser<TestSameTypeMap> _parser = new pb::MessageParser<TestSameTypeMap>(() => new TestSameTypeMap());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestSameTypeMap> Parser { get { return _parser; } }
@@ -903,7 +864,6 @@ namespace Google.Protobuf.TestProtos {
public TestSameTypeMap(TestSameTypeMap other) : this() {
map1_ = other.map1_.Clone();
map2_ = other.map2_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -946,7 +906,7 @@ namespace Google.Protobuf.TestProtos {
}
if (!Map1.Equals(other.Map1)) return false;
if (!Map2.Equals(other.Map2)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -954,9 +914,6 @@ namespace Google.Protobuf.TestProtos {
int hash = 1;
hash ^= Map1.GetHashCode();
hash ^= Map2.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -969,9 +926,6 @@ namespace Google.Protobuf.TestProtos {
public void WriteTo(pb::CodedOutputStream output) {
map1_.WriteTo(output, _map_map1_codec);
map2_.WriteTo(output, _map_map2_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -979,9 +933,6 @@ namespace Google.Protobuf.TestProtos {
int size = 0;
size += map1_.CalculateSize(_map_map1_codec);
size += map2_.CalculateSize(_map_map2_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -992,7 +943,6 @@ namespace Google.Protobuf.TestProtos {
}
map1_.Add(other.map1_);
map2_.Add(other.map2_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1001,7 +951,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
map1_.AddEntriesFrom(input, _map_map1_codec);
@@ -1019,7 +969,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestArenaMap : pb::IMessage<TestArenaMap> {
private static readonly pb::MessageParser<TestArenaMap> _parser = new pb::MessageParser<TestArenaMap>(() => new TestArenaMap());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestArenaMap> Parser { get { return _parser; } }
@@ -1057,7 +1006,6 @@ namespace Google.Protobuf.TestProtos {
mapBoolBool_ = other.mapBoolBool_.Clone();
mapInt32Enum_ = other.mapInt32Enum_.Clone();
mapInt32ForeignMessage_ = other.mapInt32ForeignMessage_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1243,7 +1191,7 @@ namespace Google.Protobuf.TestProtos {
if (!MapBoolBool.Equals(other.MapBoolBool)) return false;
if (!MapInt32Enum.Equals(other.MapInt32Enum)) return false;
if (!MapInt32ForeignMessage.Equals(other.MapInt32ForeignMessage)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1264,9 +1212,6 @@ namespace Google.Protobuf.TestProtos {
hash ^= MapBoolBool.GetHashCode();
hash ^= MapInt32Enum.GetHashCode();
hash ^= MapInt32ForeignMessage.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1292,9 +1237,6 @@ namespace Google.Protobuf.TestProtos {
mapBoolBool_.WriteTo(output, _map_mapBoolBool_codec);
mapInt32Enum_.WriteTo(output, _map_mapInt32Enum_codec);
mapInt32ForeignMessage_.WriteTo(output, _map_mapInt32ForeignMessage_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1315,9 +1257,6 @@ namespace Google.Protobuf.TestProtos {
size += mapBoolBool_.CalculateSize(_map_mapBoolBool_codec);
size += mapInt32Enum_.CalculateSize(_map_mapInt32Enum_codec);
size += mapInt32ForeignMessage_.CalculateSize(_map_mapInt32ForeignMessage_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1341,7 +1280,6 @@ namespace Google.Protobuf.TestProtos {
mapBoolBool_.Add(other.mapBoolBool_);
mapInt32Enum_.Add(other.mapInt32Enum_);
mapInt32ForeignMessage_.Add(other.mapInt32ForeignMessage_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1350,7 +1288,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
@@ -1424,7 +1362,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class MessageContainingEnumCalledType : pb::IMessage<MessageContainingEnumCalledType> {
private static readonly pb::MessageParser<MessageContainingEnumCalledType> _parser = new pb::MessageParser<MessageContainingEnumCalledType>(() => new MessageContainingEnumCalledType());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<MessageContainingEnumCalledType> Parser { get { return _parser; } }
@@ -1448,7 +1385,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public MessageContainingEnumCalledType(MessageContainingEnumCalledType other) : this() {
type_ = other.type_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1480,16 +1416,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (!Type.Equals(other.Type)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= Type.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1501,18 +1434,12 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
type_.WriteTo(output, _map_type_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += type_.CalculateSize(_map_type_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1522,7 +1449,6 @@ namespace Google.Protobuf.TestProtos {
return;
}
type_.Add(other.type_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1531,7 +1457,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
type_.AddEntriesFrom(input, _map_type_codec);
@@ -1559,7 +1485,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class MessageContainingMapCalledEntry : pb::IMessage<MessageContainingMapCalledEntry> {
private static readonly pb::MessageParser<MessageContainingMapCalledEntry> _parser = new pb::MessageParser<MessageContainingMapCalledEntry>(() => new MessageContainingMapCalledEntry());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<MessageContainingMapCalledEntry> Parser { get { return _parser; } }
@@ -1583,7 +1508,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public MessageContainingMapCalledEntry(MessageContainingMapCalledEntry other) : this() {
entry_ = other.entry_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1615,16 +1539,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (!Entry.Equals(other.Entry)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= Entry.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1636,18 +1557,12 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
entry_.WriteTo(output, _map_entry_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += entry_.CalculateSize(_map_entry_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1657,7 +1572,6 @@ namespace Google.Protobuf.TestProtos {
return;
}
entry_.Add(other.entry_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1666,7 +1580,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
entry_.AddEntriesFrom(input, _map_entry_codec);
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
index 7353be7ba9..6607be7a1d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/test_messages_proto3.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/test_messages_proto3.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -29,7 +27,7 @@ namespace ProtobufTestMessages.Proto3 {
"dWYvYW55LnByb3RvGh5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8a",
"IGdvb2dsZS9wcm90b2J1Zi9maWVsZF9tYXNrLnByb3RvGhxnb29nbGUvcHJv",
"dG9idWYvc3RydWN0LnByb3RvGh9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1w",
- "LnByb3RvGh5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8itDsKElRl",
+ "LnByb3RvGh5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8irDsKElRl",
"c3RBbGxUeXBlc1Byb3RvMxIWCg5vcHRpb25hbF9pbnQzMhgBIAEoBRIWCg5v",
"cHRpb25hbF9pbnQ2NBgCIAEoAxIXCg9vcHRpb25hbF91aW50MzIYAyABKA0S",
"FwoPb3B0aW9uYWxfdWludDY0GAQgASgEEhcKD29wdGlvbmFsX3NpbnQzMhgF",
@@ -198,11 +196,11 @@ namespace ProtobufTestMessages.Proto3 {
"Z0ZvcmVpZ25FbnVtRW50cnkSCwoDa2V5GAEgASgJEjkKBXZhbHVlGAIgASgO",
"MioucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzMuRm9yZWlnbkVudW06",
"AjgBIjkKCk5lc3RlZEVudW0SBwoDRk9PEAASBwoDQkFSEAESBwoDQkFaEAIS",
- "EAoDTkVHEP///////////wFCDQoLb25lb2ZfZmllbGRKBgj1AxD/AyIbCg5G",
- "b3JlaWduTWVzc2FnZRIJCgFjGAEgASgFKkAKC0ZvcmVpZ25FbnVtEg8KC0ZP",
- "UkVJR05fRk9PEAASDwoLRk9SRUlHTl9CQVIQARIPCgtGT1JFSUdOX0JBWhAC",
- "QjgKKGNvbS5nb29nbGUucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzNI",
- "AfgBAaICBlByb3RvM2IGcHJvdG8z"));
+ "EAoDTkVHEP///////////wFCDQoLb25lb2ZfZmllbGQiGwoORm9yZWlnbk1l",
+ "c3NhZ2USCQoBYxgBIAEoBSpACgtGb3JlaWduRW51bRIPCgtGT1JFSUdOX0ZP",
+ "TxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAkI4Cihjb20u",
+ "Z29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zSAH4AQGiAgZQ",
+ "cm90bzNiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto3.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] {
@@ -235,7 +233,6 @@ namespace ProtobufTestMessages.Proto3 {
/// </summary>
public sealed partial class TestAllTypesProto3 : pb::IMessage<TestAllTypesProto3> {
private static readonly pb::MessageParser<TestAllTypesProto3> _parser = new pb::MessageParser<TestAllTypesProto3>(() => new TestAllTypesProto3());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestAllTypesProto3> Parser { get { return _parser; } }
@@ -273,13 +270,13 @@ namespace ProtobufTestMessages.Proto3 {
optionalBool_ = other.optionalBool_;
optionalString_ = other.optionalString_;
optionalBytes_ = other.optionalBytes_;
- optionalNestedMessage_ = other.optionalNestedMessage_ != null ? other.optionalNestedMessage_.Clone() : null;
- optionalForeignMessage_ = other.optionalForeignMessage_ != null ? other.optionalForeignMessage_.Clone() : null;
+ OptionalNestedMessage = other.optionalNestedMessage_ != null ? other.OptionalNestedMessage.Clone() : null;
+ OptionalForeignMessage = other.optionalForeignMessage_ != null ? other.OptionalForeignMessage.Clone() : null;
optionalNestedEnum_ = other.optionalNestedEnum_;
optionalForeignEnum_ = other.optionalForeignEnum_;
optionalStringPiece_ = other.optionalStringPiece_;
optionalCord_ = other.optionalCord_;
- recursiveMessage_ = other.recursiveMessage_ != null ? other.recursiveMessage_.Clone() : null;
+ RecursiveMessage = other.recursiveMessage_ != null ? other.RecursiveMessage.Clone() : null;
repeatedInt32_ = other.repeatedInt32_.Clone();
repeatedInt64_ = other.repeatedInt64_.Clone();
repeatedUint32_ = other.repeatedUint32_.Clone();
@@ -338,12 +335,12 @@ namespace ProtobufTestMessages.Proto3 {
repeatedDoubleWrapper_ = other.repeatedDoubleWrapper_.Clone();
repeatedStringWrapper_ = other.repeatedStringWrapper_.Clone();
repeatedBytesWrapper_ = other.repeatedBytesWrapper_.Clone();
- optionalDuration_ = other.optionalDuration_ != null ? other.optionalDuration_.Clone() : null;
- optionalTimestamp_ = other.optionalTimestamp_ != null ? other.optionalTimestamp_.Clone() : null;
- optionalFieldMask_ = other.optionalFieldMask_ != null ? other.optionalFieldMask_.Clone() : null;
- optionalStruct_ = other.optionalStruct_ != null ? other.optionalStruct_.Clone() : null;
- optionalAny_ = other.optionalAny_ != null ? other.optionalAny_.Clone() : null;
- optionalValue_ = other.optionalValue_ != null ? other.optionalValue_.Clone() : null;
+ OptionalDuration = other.optionalDuration_ != null ? other.OptionalDuration.Clone() : null;
+ OptionalTimestamp = other.optionalTimestamp_ != null ? other.OptionalTimestamp.Clone() : null;
+ OptionalFieldMask = other.optionalFieldMask_ != null ? other.OptionalFieldMask.Clone() : null;
+ OptionalStruct = other.optionalStruct_ != null ? other.OptionalStruct.Clone() : null;
+ OptionalAny = other.optionalAny_ != null ? other.OptionalAny.Clone() : null;
+ OptionalValue = other.optionalValue_ != null ? other.OptionalValue.Clone() : null;
repeatedDuration_ = other.repeatedDuration_.Clone();
repeatedTimestamp_ = other.repeatedTimestamp_.Clone();
repeatedFieldmask_ = other.repeatedFieldmask_.Clone();
@@ -398,7 +395,6 @@ namespace ProtobufTestMessages.Proto3 {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1734,8 +1730,8 @@ namespace ProtobufTestMessages.Proto3 {
if (OptionalFixed64 != other.OptionalFixed64) return false;
if (OptionalSfixed32 != other.OptionalSfixed32) return false;
if (OptionalSfixed64 != other.OptionalSfixed64) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(OptionalFloat, other.OptionalFloat)) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(OptionalDouble, other.OptionalDouble)) return false;
+ if (OptionalFloat != other.OptionalFloat) return false;
+ if (OptionalDouble != other.OptionalDouble) return false;
if (OptionalBool != other.OptionalBool) return false;
if (OptionalString != other.OptionalString) return false;
if (OptionalBytes != other.OptionalBytes) return false;
@@ -1792,16 +1788,16 @@ namespace ProtobufTestMessages.Proto3 {
if (OneofBytes != other.OneofBytes) return false;
if (OneofBool != other.OneofBool) return false;
if (OneofUint64 != other.OneofUint64) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(OneofFloat, other.OneofFloat)) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(OneofDouble, other.OneofDouble)) return false;
+ if (OneofFloat != other.OneofFloat) return false;
+ if (OneofDouble != other.OneofDouble) return false;
if (OneofEnum != other.OneofEnum) return false;
if (OptionalBoolWrapper != other.OptionalBoolWrapper) return false;
if (OptionalInt32Wrapper != other.OptionalInt32Wrapper) return false;
if (OptionalInt64Wrapper != other.OptionalInt64Wrapper) return false;
if (OptionalUint32Wrapper != other.OptionalUint32Wrapper) return false;
if (OptionalUint64Wrapper != other.OptionalUint64Wrapper) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals(OptionalFloatWrapper, other.OptionalFloatWrapper)) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.Equals(OptionalDoubleWrapper, other.OptionalDoubleWrapper)) return false;
+ if (OptionalFloatWrapper != other.OptionalFloatWrapper) return false;
+ if (OptionalDoubleWrapper != other.OptionalDoubleWrapper) return false;
if (OptionalStringWrapper != other.OptionalStringWrapper) return false;
if (OptionalBytesWrapper != other.OptionalBytesWrapper) return false;
if(!repeatedBoolWrapper_.Equals(other.repeatedBoolWrapper_)) return false;
@@ -1844,7 +1840,7 @@ namespace ProtobufTestMessages.Proto3 {
if (FieldName17 != other.FieldName17) return false;
if (FieldName18 != other.FieldName18) return false;
if (OneofFieldCase != other.OneofFieldCase) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1860,8 +1856,8 @@ namespace ProtobufTestMessages.Proto3 {
if (OptionalFixed64 != 0UL) hash ^= OptionalFixed64.GetHashCode();
if (OptionalSfixed32 != 0) hash ^= OptionalSfixed32.GetHashCode();
if (OptionalSfixed64 != 0L) hash ^= OptionalSfixed64.GetHashCode();
- if (OptionalFloat != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(OptionalFloat);
- if (OptionalDouble != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OptionalDouble);
+ if (OptionalFloat != 0F) hash ^= OptionalFloat.GetHashCode();
+ if (OptionalDouble != 0D) hash ^= OptionalDouble.GetHashCode();
if (OptionalBool != false) hash ^= OptionalBool.GetHashCode();
if (OptionalString.Length != 0) hash ^= OptionalString.GetHashCode();
if (OptionalBytes.Length != 0) hash ^= OptionalBytes.GetHashCode();
@@ -1918,16 +1914,16 @@ namespace ProtobufTestMessages.Proto3 {
if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) hash ^= OneofBytes.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.OneofBool) hash ^= OneofBool.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint64) hash ^= OneofUint64.GetHashCode();
- if (oneofFieldCase_ == OneofFieldOneofCase.OneofFloat) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(OneofFloat);
- if (oneofFieldCase_ == OneofFieldOneofCase.OneofDouble) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OneofDouble);
+ if (oneofFieldCase_ == OneofFieldOneofCase.OneofFloat) hash ^= OneofFloat.GetHashCode();
+ if (oneofFieldCase_ == OneofFieldOneofCase.OneofDouble) hash ^= OneofDouble.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.OneofEnum) hash ^= OneofEnum.GetHashCode();
if (optionalBoolWrapper_ != null) hash ^= OptionalBoolWrapper.GetHashCode();
if (optionalInt32Wrapper_ != null) hash ^= OptionalInt32Wrapper.GetHashCode();
if (optionalInt64Wrapper_ != null) hash ^= OptionalInt64Wrapper.GetHashCode();
if (optionalUint32Wrapper_ != null) hash ^= OptionalUint32Wrapper.GetHashCode();
if (optionalUint64Wrapper_ != null) hash ^= OptionalUint64Wrapper.GetHashCode();
- if (optionalFloatWrapper_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode(OptionalFloatWrapper);
- if (optionalDoubleWrapper_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode(OptionalDoubleWrapper);
+ if (optionalFloatWrapper_ != null) hash ^= OptionalFloatWrapper.GetHashCode();
+ if (optionalDoubleWrapper_ != null) hash ^= OptionalDoubleWrapper.GetHashCode();
if (optionalStringWrapper_ != null) hash ^= OptionalStringWrapper.GetHashCode();
if (optionalBytesWrapper_ != null) hash ^= OptionalBytesWrapper.GetHashCode();
hash ^= repeatedBoolWrapper_.GetHashCode();
@@ -1970,9 +1966,6 @@ namespace ProtobufTestMessages.Proto3 {
if (FieldName17 != 0) hash ^= FieldName17.GetHashCode();
if (FieldName18 != 0) hash ^= FieldName18.GetHashCode();
hash ^= (int) oneofFieldCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2285,9 +2278,6 @@ namespace ProtobufTestMessages.Proto3 {
output.WriteRawTag(144, 26);
output.WriteInt32(FieldName18);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2540,9 +2530,6 @@ namespace ProtobufTestMessages.Proto3 {
if (FieldName18 != 0) {
size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName18);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2821,10 +2808,7 @@ namespace ProtobufTestMessages.Proto3 {
OneofUint32 = other.OneofUint32;
break;
case OneofFieldOneofCase.OneofNestedMessage:
- if (OneofNestedMessage == null) {
- OneofNestedMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage();
- }
- OneofNestedMessage.MergeFrom(other.OneofNestedMessage);
+ OneofNestedMessage = other.OneofNestedMessage;
break;
case OneofFieldOneofCase.OneofString:
OneofString = other.OneofString;
@@ -2849,7 +2833,6 @@ namespace ProtobufTestMessages.Proto3 {
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2858,7 +2841,7 @@ namespace ProtobufTestMessages.Proto3 {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
OptionalInt32 = input.ReadInt32();
@@ -3431,7 +3414,6 @@ namespace ProtobufTestMessages.Proto3 {
public sealed partial class NestedMessage : pb::IMessage<NestedMessage> {
private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } }
@@ -3455,8 +3437,7 @@ namespace ProtobufTestMessages.Proto3 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public NestedMessage(NestedMessage other) : this() {
a_ = other.a_;
- corecursive_ = other.corecursive_ != null ? other.corecursive_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Corecursive = other.corecursive_ != null ? other.Corecursive.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3501,7 +3482,7 @@ namespace ProtobufTestMessages.Proto3 {
}
if (A != other.A) return false;
if (!object.Equals(Corecursive, other.Corecursive)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3509,9 +3490,6 @@ namespace ProtobufTestMessages.Proto3 {
int hash = 1;
if (A != 0) hash ^= A.GetHashCode();
if (corecursive_ != null) hash ^= Corecursive.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3530,9 +3508,6 @@ namespace ProtobufTestMessages.Proto3 {
output.WriteRawTag(18);
output.WriteMessage(Corecursive);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3544,9 +3519,6 @@ namespace ProtobufTestMessages.Proto3 {
if (corecursive_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Corecursive);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3564,7 +3536,6 @@ namespace ProtobufTestMessages.Proto3 {
}
Corecursive.MergeFrom(other.Corecursive);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3573,7 +3544,7 @@ namespace ProtobufTestMessages.Proto3 {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
A = input.ReadInt32();
@@ -3599,7 +3570,6 @@ namespace ProtobufTestMessages.Proto3 {
public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage> {
private static readonly pb::MessageParser<ForeignMessage> _parser = new pb::MessageParser<ForeignMessage>(() => new ForeignMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ForeignMessage> Parser { get { return _parser; } }
@@ -3623,7 +3593,6 @@ namespace ProtobufTestMessages.Proto3 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ForeignMessage(ForeignMessage other) : this() {
c_ = other.c_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3656,16 +3625,13 @@ namespace ProtobufTestMessages.Proto3 {
return true;
}
if (C != other.C) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (C != 0) hash ^= C.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3680,9 +3646,6 @@ namespace ProtobufTestMessages.Proto3 {
output.WriteRawTag(8);
output.WriteInt32(C);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3691,9 +3654,6 @@ namespace ProtobufTestMessages.Proto3 {
if (C != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(C);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3705,7 +3665,6 @@ namespace ProtobufTestMessages.Proto3 {
if (other.C != 0) {
C = other.C;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3714,7 +3673,7 @@ namespace ProtobufTestMessages.Proto3 {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
C = input.ReadInt32();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
index 3ab5a48b84..e21ede9c54 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: unittest_custom_options_proto3.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: unittest_custom_options_proto3.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -185,7 +183,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class TestMessageWithCustomOptions : pb::IMessage<TestMessageWithCustomOptions> {
private static readonly pb::MessageParser<TestMessageWithCustomOptions> _parser = new pb::MessageParser<TestMessageWithCustomOptions>(() => new TestMessageWithCustomOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestMessageWithCustomOptions> Parser { get { return _parser; } }
@@ -215,7 +212,6 @@ namespace UnitTest.Issues.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -279,7 +275,7 @@ namespace UnitTest.Issues.TestProtos {
if (Field1 != other.Field1) return false;
if (OneofField != other.OneofField) return false;
if (AnOneofCase != other.AnOneofCase) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -288,9 +284,6 @@ namespace UnitTest.Issues.TestProtos {
if (Field1.Length != 0) hash ^= Field1.GetHashCode();
if (anOneofCase_ == AnOneofOneofCase.OneofField) hash ^= OneofField.GetHashCode();
hash ^= (int) anOneofCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -309,9 +302,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(16);
output.WriteInt32(OneofField);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -323,9 +313,6 @@ namespace UnitTest.Issues.TestProtos {
if (anOneofCase_ == AnOneofOneofCase.OneofField) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofField);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -343,7 +330,6 @@ namespace UnitTest.Issues.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -352,7 +338,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Field1 = input.ReadString();
@@ -387,7 +373,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class CustomOptionFooRequest : pb::IMessage<CustomOptionFooRequest> {
private static readonly pb::MessageParser<CustomOptionFooRequest> _parser = new pb::MessageParser<CustomOptionFooRequest>(() => new CustomOptionFooRequest());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<CustomOptionFooRequest> Parser { get { return _parser; } }
@@ -410,7 +395,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public CustomOptionFooRequest(CustomOptionFooRequest other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -431,15 +415,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -450,17 +431,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -469,7 +444,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -478,7 +452,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -488,7 +462,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class CustomOptionFooResponse : pb::IMessage<CustomOptionFooResponse> {
private static readonly pb::MessageParser<CustomOptionFooResponse> _parser = new pb::MessageParser<CustomOptionFooResponse>(() => new CustomOptionFooResponse());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<CustomOptionFooResponse> Parser { get { return _parser; } }
@@ -511,7 +484,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public CustomOptionFooResponse(CustomOptionFooResponse other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -532,15 +504,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -551,17 +520,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -570,7 +533,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -579,7 +541,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -589,7 +551,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class CustomOptionFooClientMessage : pb::IMessage<CustomOptionFooClientMessage> {
private static readonly pb::MessageParser<CustomOptionFooClientMessage> _parser = new pb::MessageParser<CustomOptionFooClientMessage>(() => new CustomOptionFooClientMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<CustomOptionFooClientMessage> Parser { get { return _parser; } }
@@ -612,7 +573,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public CustomOptionFooClientMessage(CustomOptionFooClientMessage other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -633,15 +593,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -652,17 +609,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -671,7 +622,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -680,7 +630,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -690,7 +640,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class CustomOptionFooServerMessage : pb::IMessage<CustomOptionFooServerMessage> {
private static readonly pb::MessageParser<CustomOptionFooServerMessage> _parser = new pb::MessageParser<CustomOptionFooServerMessage>(() => new CustomOptionFooServerMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<CustomOptionFooServerMessage> Parser { get { return _parser; } }
@@ -713,7 +662,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public CustomOptionFooServerMessage(CustomOptionFooServerMessage other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -734,15 +682,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -753,17 +698,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -772,7 +711,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -781,7 +719,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -791,7 +729,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class DummyMessageContainingEnum : pb::IMessage<DummyMessageContainingEnum> {
private static readonly pb::MessageParser<DummyMessageContainingEnum> _parser = new pb::MessageParser<DummyMessageContainingEnum>(() => new DummyMessageContainingEnum());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<DummyMessageContainingEnum> Parser { get { return _parser; } }
@@ -814,7 +751,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public DummyMessageContainingEnum(DummyMessageContainingEnum other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -835,15 +771,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -854,17 +787,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -873,7 +800,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -882,7 +808,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -905,7 +831,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class DummyMessageInvalidAsOptionType : pb::IMessage<DummyMessageInvalidAsOptionType> {
private static readonly pb::MessageParser<DummyMessageInvalidAsOptionType> _parser = new pb::MessageParser<DummyMessageInvalidAsOptionType>(() => new DummyMessageInvalidAsOptionType());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<DummyMessageInvalidAsOptionType> Parser { get { return _parser; } }
@@ -928,7 +853,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public DummyMessageInvalidAsOptionType(DummyMessageInvalidAsOptionType other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -949,15 +873,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -968,17 +889,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -987,7 +902,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -996,7 +910,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -1006,7 +920,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class CustomOptionMinIntegerValues : pb::IMessage<CustomOptionMinIntegerValues> {
private static readonly pb::MessageParser<CustomOptionMinIntegerValues> _parser = new pb::MessageParser<CustomOptionMinIntegerValues>(() => new CustomOptionMinIntegerValues());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<CustomOptionMinIntegerValues> Parser { get { return _parser; } }
@@ -1029,7 +942,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public CustomOptionMinIntegerValues(CustomOptionMinIntegerValues other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1050,15 +962,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1069,17 +978,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1088,7 +991,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1097,7 +999,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -1107,7 +1009,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class CustomOptionMaxIntegerValues : pb::IMessage<CustomOptionMaxIntegerValues> {
private static readonly pb::MessageParser<CustomOptionMaxIntegerValues> _parser = new pb::MessageParser<CustomOptionMaxIntegerValues>(() => new CustomOptionMaxIntegerValues());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<CustomOptionMaxIntegerValues> Parser { get { return _parser; } }
@@ -1130,7 +1031,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public CustomOptionMaxIntegerValues(CustomOptionMaxIntegerValues other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1151,15 +1051,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1170,17 +1067,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1189,7 +1080,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1198,7 +1088,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -1208,7 +1098,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class CustomOptionOtherValues : pb::IMessage<CustomOptionOtherValues> {
private static readonly pb::MessageParser<CustomOptionOtherValues> _parser = new pb::MessageParser<CustomOptionOtherValues>(() => new CustomOptionOtherValues());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<CustomOptionOtherValues> Parser { get { return _parser; } }
@@ -1231,7 +1120,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public CustomOptionOtherValues(CustomOptionOtherValues other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1252,15 +1140,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1271,17 +1156,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1290,7 +1169,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1299,7 +1177,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -1309,7 +1187,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class SettingRealsFromPositiveInts : pb::IMessage<SettingRealsFromPositiveInts> {
private static readonly pb::MessageParser<SettingRealsFromPositiveInts> _parser = new pb::MessageParser<SettingRealsFromPositiveInts>(() => new SettingRealsFromPositiveInts());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<SettingRealsFromPositiveInts> Parser { get { return _parser; } }
@@ -1332,7 +1209,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public SettingRealsFromPositiveInts(SettingRealsFromPositiveInts other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1353,15 +1229,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1372,17 +1245,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1391,7 +1258,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1400,7 +1266,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -1410,7 +1276,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class SettingRealsFromNegativeInts : pb::IMessage<SettingRealsFromNegativeInts> {
private static readonly pb::MessageParser<SettingRealsFromNegativeInts> _parser = new pb::MessageParser<SettingRealsFromNegativeInts>(() => new SettingRealsFromNegativeInts());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<SettingRealsFromNegativeInts> Parser { get { return _parser; } }
@@ -1433,7 +1298,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public SettingRealsFromNegativeInts(SettingRealsFromNegativeInts other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1454,15 +1318,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1473,17 +1334,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1492,7 +1347,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1501,7 +1355,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -1511,7 +1365,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class ComplexOptionType1 : pb::IMessage<ComplexOptionType1> {
private static readonly pb::MessageParser<ComplexOptionType1> _parser = new pb::MessageParser<ComplexOptionType1>(() => new ComplexOptionType1());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ComplexOptionType1> Parser { get { return _parser; } }
@@ -1538,7 +1391,6 @@ namespace UnitTest.Issues.TestProtos {
foo2_ = other.foo2_;
foo3_ = other.foo3_;
foo4_ = other.foo4_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1606,7 +1458,7 @@ namespace UnitTest.Issues.TestProtos {
if (Foo2 != other.Foo2) return false;
if (Foo3 != other.Foo3) return false;
if(!foo4_.Equals(other.foo4_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1616,9 +1468,6 @@ namespace UnitTest.Issues.TestProtos {
if (Foo2 != 0) hash ^= Foo2.GetHashCode();
if (Foo3 != 0) hash ^= Foo3.GetHashCode();
hash ^= foo4_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1642,9 +1491,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteInt32(Foo3);
}
foo4_.WriteTo(output, _repeated_foo4_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1660,9 +1506,6 @@ namespace UnitTest.Issues.TestProtos {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Foo3);
}
size += foo4_.CalculateSize(_repeated_foo4_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1681,7 +1524,6 @@ namespace UnitTest.Issues.TestProtos {
Foo3 = other.Foo3;
}
foo4_.Add(other.foo4_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1690,7 +1532,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Foo = input.ReadInt32();
@@ -1717,7 +1559,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class ComplexOptionType2 : pb::IMessage<ComplexOptionType2> {
private static readonly pb::MessageParser<ComplexOptionType2> _parser = new pb::MessageParser<ComplexOptionType2>(() => new ComplexOptionType2());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ComplexOptionType2> Parser { get { return _parser; } }
@@ -1740,11 +1581,10 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ComplexOptionType2(ComplexOptionType2 other) : this() {
- bar_ = other.bar_ != null ? other.bar_.Clone() : null;
+ Bar = other.bar_ != null ? other.Bar.Clone() : null;
baz_ = other.baz_;
- fred_ = other.fred_ != null ? other.fred_.Clone() : null;
+ Fred = other.fred_ != null ? other.Fred.Clone() : null;
barney_ = other.barney_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1812,7 +1652,7 @@ namespace UnitTest.Issues.TestProtos {
if (Baz != other.Baz) return false;
if (!object.Equals(Fred, other.Fred)) return false;
if(!barney_.Equals(other.barney_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1822,9 +1662,6 @@ namespace UnitTest.Issues.TestProtos {
if (Baz != 0) hash ^= Baz.GetHashCode();
if (fred_ != null) hash ^= Fred.GetHashCode();
hash ^= barney_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1848,9 +1685,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteMessage(Fred);
}
barney_.WriteTo(output, _repeated_barney_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1866,9 +1700,6 @@ namespace UnitTest.Issues.TestProtos {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Fred);
}
size += barney_.CalculateSize(_repeated_barney_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1893,7 +1724,6 @@ namespace UnitTest.Issues.TestProtos {
Fred.MergeFrom(other.Fred);
}
barney_.Add(other.barney_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1902,7 +1732,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
if (bar_ == null) {
@@ -1936,7 +1766,6 @@ namespace UnitTest.Issues.TestProtos {
public static partial class Types {
public sealed partial class ComplexOptionType4 : pb::IMessage<ComplexOptionType4> {
private static readonly pb::MessageParser<ComplexOptionType4> _parser = new pb::MessageParser<ComplexOptionType4>(() => new ComplexOptionType4());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ComplexOptionType4> Parser { get { return _parser; } }
@@ -1960,7 +1789,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ComplexOptionType4(ComplexOptionType4 other) : this() {
waldo_ = other.waldo_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1993,16 +1821,13 @@ namespace UnitTest.Issues.TestProtos {
return true;
}
if (Waldo != other.Waldo) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Waldo != 0) hash ^= Waldo.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2017,9 +1842,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(Waldo);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2028,9 +1850,6 @@ namespace UnitTest.Issues.TestProtos {
if (Waldo != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Waldo);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2042,7 +1861,6 @@ namespace UnitTest.Issues.TestProtos {
if (other.Waldo != 0) {
Waldo = other.Waldo;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2051,7 +1869,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Waldo = input.ReadInt32();
@@ -2070,7 +1888,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class ComplexOptionType3 : pb::IMessage<ComplexOptionType3> {
private static readonly pb::MessageParser<ComplexOptionType3> _parser = new pb::MessageParser<ComplexOptionType3>(() => new ComplexOptionType3());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ComplexOptionType3> Parser { get { return _parser; } }
@@ -2094,7 +1911,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ComplexOptionType3(ComplexOptionType3 other) : this() {
qux_ = other.qux_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2127,16 +1943,13 @@ namespace UnitTest.Issues.TestProtos {
return true;
}
if (Qux != other.Qux) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Qux != 0) hash ^= Qux.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2151,9 +1964,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(Qux);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2162,9 +1972,6 @@ namespace UnitTest.Issues.TestProtos {
if (Qux != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Qux);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2176,7 +1983,6 @@ namespace UnitTest.Issues.TestProtos {
if (other.Qux != 0) {
Qux = other.Qux;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2185,7 +1991,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Qux = input.ReadInt32();
@@ -2202,7 +2008,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class VariousComplexOptions : pb::IMessage<VariousComplexOptions> {
private static readonly pb::MessageParser<VariousComplexOptions> _parser = new pb::MessageParser<VariousComplexOptions>(() => new VariousComplexOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<VariousComplexOptions> Parser { get { return _parser; } }
@@ -2225,7 +2030,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public VariousComplexOptions(VariousComplexOptions other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2246,15 +2050,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2265,17 +2066,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2284,7 +2079,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2293,7 +2087,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -2306,7 +2100,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class Aggregate : pb::IMessage<Aggregate> {
private static readonly pb::MessageParser<Aggregate> _parser = new pb::MessageParser<Aggregate>(() => new Aggregate());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Aggregate> Parser { get { return _parser; } }
@@ -2331,8 +2124,7 @@ namespace UnitTest.Issues.TestProtos {
public Aggregate(Aggregate other) : this() {
i_ = other.i_;
s_ = other.s_;
- sub_ = other.sub_ != null ? other.sub_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Sub = other.sub_ != null ? other.Sub.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2392,7 +2184,7 @@ namespace UnitTest.Issues.TestProtos {
if (I != other.I) return false;
if (S != other.S) return false;
if (!object.Equals(Sub, other.Sub)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2401,9 +2193,6 @@ namespace UnitTest.Issues.TestProtos {
if (I != 0) hash ^= I.GetHashCode();
if (S.Length != 0) hash ^= S.GetHashCode();
if (sub_ != null) hash ^= Sub.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2426,9 +2215,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(26);
output.WriteMessage(Sub);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2443,9 +2229,6 @@ namespace UnitTest.Issues.TestProtos {
if (sub_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Sub);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2466,7 +2249,6 @@ namespace UnitTest.Issues.TestProtos {
}
Sub.MergeFrom(other.Sub);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2475,7 +2257,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
I = input.ReadInt32();
@@ -2500,7 +2282,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class AggregateMessage : pb::IMessage<AggregateMessage> {
private static readonly pb::MessageParser<AggregateMessage> _parser = new pb::MessageParser<AggregateMessage>(() => new AggregateMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<AggregateMessage> Parser { get { return _parser; } }
@@ -2524,7 +2305,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public AggregateMessage(AggregateMessage other) : this() {
fieldname_ = other.fieldname_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2557,16 +2337,13 @@ namespace UnitTest.Issues.TestProtos {
return true;
}
if (Fieldname != other.Fieldname) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Fieldname != 0) hash ^= Fieldname.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2581,9 +2358,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(Fieldname);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2592,9 +2366,6 @@ namespace UnitTest.Issues.TestProtos {
if (Fieldname != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Fieldname);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2606,7 +2377,6 @@ namespace UnitTest.Issues.TestProtos {
if (other.Fieldname != 0) {
Fieldname = other.Fieldname;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2615,7 +2385,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Fieldname = input.ReadInt32();
@@ -2632,7 +2402,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class NestedOptionType : pb::IMessage<NestedOptionType> {
private static readonly pb::MessageParser<NestedOptionType> _parser = new pb::MessageParser<NestedOptionType>(() => new NestedOptionType());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NestedOptionType> Parser { get { return _parser; } }
@@ -2655,7 +2424,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public NestedOptionType(NestedOptionType other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2676,15 +2444,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2695,17 +2460,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2714,7 +2473,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2723,7 +2481,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -2740,7 +2498,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class NestedMessage : pb::IMessage<NestedMessage> {
private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } }
@@ -2764,7 +2521,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public NestedMessage(NestedMessage other) : this() {
nestedField_ = other.nestedField_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2797,16 +2553,13 @@ namespace UnitTest.Issues.TestProtos {
return true;
}
if (NestedField != other.NestedField) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (NestedField != 0) hash ^= NestedField.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2821,9 +2574,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(NestedField);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2832,9 +2582,6 @@ namespace UnitTest.Issues.TestProtos {
if (NestedField != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(NestedField);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2846,7 +2593,6 @@ namespace UnitTest.Issues.TestProtos {
if (other.NestedField != 0) {
NestedField = other.NestedField;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2855,7 +2601,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
NestedField = input.ReadInt32();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
index 6bf9715171..f6df4e8726 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: unittest_import_proto3.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/unittest_import_proto3.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -11,11 +9,11 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
- /// <summary>Holder for reflection information generated from unittest_import_proto3.proto</summary>
+ /// <summary>Holder for reflection information generated from google/protobuf/unittest_import_proto3.proto</summary>
public static partial class UnittestImportProto3Reflection {
#region Descriptor
- /// <summary>File descriptor for unittest_import_proto3.proto</summary>
+ /// <summary>File descriptor for google/protobuf/unittest_import_proto3.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -24,12 +22,14 @@ namespace Google.Protobuf.TestProtos {
static UnittestImportProto3Reflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Chx1bml0dGVzdF9pbXBvcnRfcHJvdG8zLnByb3RvEhhwcm90b2J1Zl91bml0",
- "dGVzdF9pbXBvcnQaI3VuaXR0ZXN0X2ltcG9ydF9wdWJsaWNfcHJvdG8zLnBy",
- "b3RvIhoKDUltcG9ydE1lc3NhZ2USCQoBZBgBIAEoBSpZCgpJbXBvcnRFbnVt",
- "EhsKF0lNUE9SVF9FTlVNX1VOU1BFQ0lGSUVEEAASDgoKSU1QT1JUX0ZPTxAH",
- "Eg4KCklNUE9SVF9CQVIQCBIOCgpJTVBPUlRfQkFaEAlCHaoCGkdvb2dsZS5Q",
- "cm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3RvMw=="));
+ "Cixnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3Byb3RvMy5wcm90",
+ "bxIYcHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0GjNnb29nbGUvcHJvdG9idWYv",
+ "dW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90bzMucHJvdG8iGgoNSW1wb3J0",
+ "TWVzc2FnZRIJCgFkGAEgASgFKlkKCkltcG9ydEVudW0SGwoXSU1QT1JUX0VO",
+ "VU1fVU5TUEVDSUZJRUQQABIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JB",
+ "UhAIEg4KCklNUE9SVF9CQVoQCUI8Chhjb20uZ29vZ2xlLnByb3RvYnVmLnRl",
+ "c3RIAfgBAaoCGkdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3Rv",
+ "Mw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportPublicProto3Reflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ImportEnum), }, new pbr::GeneratedClrTypeInfo[] {
@@ -52,7 +52,6 @@ namespace Google.Protobuf.TestProtos {
#region Messages
public sealed partial class ImportMessage : pb::IMessage<ImportMessage> {
private static readonly pb::MessageParser<ImportMessage> _parser = new pb::MessageParser<ImportMessage>(() => new ImportMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ImportMessage> Parser { get { return _parser; } }
@@ -76,7 +75,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ImportMessage(ImportMessage other) : this() {
d_ = other.d_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -109,16 +107,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (D != other.D) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (D != 0) hash ^= D.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -133,9 +128,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(D);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -144,9 +136,6 @@ namespace Google.Protobuf.TestProtos {
if (D != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(D);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -158,7 +147,6 @@ namespace Google.Protobuf.TestProtos {
if (other.D != 0) {
D = other.D;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -167,7 +155,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
D = input.ReadInt32();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
index 97d181aff4..67b8edf464 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: unittest_import_public_proto3.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/unittest_import_public_proto3.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -11,11 +9,11 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
- /// <summary>Holder for reflection information generated from unittest_import_public_proto3.proto</summary>
+ /// <summary>Holder for reflection information generated from google/protobuf/unittest_import_public_proto3.proto</summary>
public static partial class UnittestImportPublicProto3Reflection {
#region Descriptor
- /// <summary>File descriptor for unittest_import_public_proto3.proto</summary>
+ /// <summary>File descriptor for google/protobuf/unittest_import_public_proto3.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -24,10 +22,10 @@ namespace Google.Protobuf.TestProtos {
static UnittestImportPublicProto3Reflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiN1bml0dGVzdF9pbXBvcnRfcHVibGljX3Byb3RvMy5wcm90bxIYcHJvdG9i",
- "dWZfdW5pdHRlc3RfaW1wb3J0IiAKE1B1YmxpY0ltcG9ydE1lc3NhZ2USCQoB",
- "ZRgBIAEoBUIdqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3Rv",
- "Mw=="));
+ "CjNnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90",
+ "bzMucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydCIgChNQdWJsaWNJ",
+ "bXBvcnRNZXNzYWdlEgkKAWUYASABKAVCNwoYY29tLmdvb2dsZS5wcm90b2J1",
+ "Zi50ZXN0qgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
@@ -40,7 +38,6 @@ namespace Google.Protobuf.TestProtos {
#region Messages
public sealed partial class PublicImportMessage : pb::IMessage<PublicImportMessage> {
private static readonly pb::MessageParser<PublicImportMessage> _parser = new pb::MessageParser<PublicImportMessage>(() => new PublicImportMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<PublicImportMessage> Parser { get { return _parser; } }
@@ -64,7 +61,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public PublicImportMessage(PublicImportMessage other) : this() {
e_ = other.e_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -97,16 +93,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (E != other.E) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (E != 0) hash ^= E.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -121,9 +114,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(E);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -132,9 +122,6 @@ namespace Google.Protobuf.TestProtos {
if (E != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(E);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -146,7 +133,6 @@ namespace Google.Protobuf.TestProtos {
if (other.E != 0) {
E = other.E;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -155,7 +141,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
E = input.ReadInt32();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
index 819fc2019f..7c0ba8a677 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: unittest_issues.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: unittest_issues.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -44,14 +42,11 @@ namespace UnitTest.Issues.TestProtos {
"MV9pbnQzMhgFIAEoBUgAEhQKDHBsYWluX3N0cmluZxgBIAEoCRISCghvMl9p",
"bnQzMhgGIAEoBUgBEhMKCW8yX3N0cmluZxgDIAEoCUgBQgQKAm8xQgQKAm8y",
"IksKDFRlc3RKc29uTmFtZRIMCgRuYW1lGAEgASgJEhkKC2Rlc2NyaXB0aW9u",
- "GAIgASgJUgRkZXNjEhIKBGd1aWQYAyABKAlSBGV4aWQifwoMT25lb2ZNZXJn",
- "aW5nEg4KBHRleHQYASABKAlIABI2CgZuZXN0ZWQYAiABKAsyJC51bml0dGVz",
- "dF9pc3N1ZXMuT25lb2ZNZXJnaW5nLk5lc3RlZEgAGh4KBk5lc3RlZBIJCgF4",
- "GAEgASgFEgkKAXkYAiABKAVCBwoFdmFsdWUqVQoMTmVnYXRpdmVFbnVtEhYK",
- "Ek5FR0FUSVZFX0VOVU1fWkVSTxAAEhYKCUZpdmVCZWxvdxD7//////////8B",
- "EhUKCE1pbnVzT25lEP///////////wEqLgoORGVwcmVjYXRlZEVudW0SEwoP",
- "REVQUkVDQVRFRF9aRVJPEAASBwoDb25lEAFCHaoCGlVuaXRUZXN0Lklzc3Vl",
- "cy5UZXN0UHJvdG9zYgZwcm90bzM="));
+ "GAIgASgJUgRkZXNjEhIKBGd1aWQYAyABKAlSBGV4aWQqVQoMTmVnYXRpdmVF",
+ "bnVtEhYKEk5FR0FUSVZFX0VOVU1fWkVSTxAAEhYKCUZpdmVCZWxvdxD7////",
+ "//////8BEhUKCE1pbnVzT25lEP///////////wEqLgoORGVwcmVjYXRlZEVu",
+ "dW0SEwoPREVQUkVDQVRFRF9aRVJPEAASBwoDb25lEAFCH0gBqgIaVW5pdFRl",
+ "c3QuSXNzdWVzLlRlc3RQcm90b3NiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.NegativeEnum), typeof(global::UnitTest.Issues.TestProtos.DeprecatedEnum), }, new pbr::GeneratedClrTypeInfo[] {
@@ -62,8 +57,7 @@ namespace UnitTest.Issues.TestProtos {
new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ItemField), global::UnitTest.Issues.TestProtos.ItemField.Parser, new[]{ "Item" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames), global::UnitTest.Issues.TestProtos.ReservedNames.Parser, new[]{ "Types_", "Descriptor_" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType), global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType.Parser, null, null, null, null)}),
new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonFieldOrdering), global::UnitTest.Issues.TestProtos.TestJsonFieldOrdering.Parser, new[]{ "PlainInt32", "O1String", "O1Int32", "PlainString", "O2Int32", "O2String" }, new[]{ "O1", "O2" }, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonName), global::UnitTest.Issues.TestProtos.TestJsonName.Parser, new[]{ "Name", "Description", "Guid" }, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.OneofMerging), global::UnitTest.Issues.TestProtos.OneofMerging.Parser, new[]{ "Text", "Nested" }, new[]{ "Value" }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested), global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested.Parser, new[]{ "X", "Y" }, null, null, null)})
+ new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonName), global::UnitTest.Issues.TestProtos.TestJsonName.Parser, new[]{ "Name", "Description", "Guid" }, null, null, null)
}));
}
#endregion
@@ -90,7 +84,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class Issue307 : pb::IMessage<Issue307> {
private static readonly pb::MessageParser<Issue307> _parser = new pb::MessageParser<Issue307>(() => new Issue307());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Issue307> Parser { get { return _parser; } }
@@ -113,7 +106,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Issue307(Issue307 other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -134,15 +126,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -153,17 +142,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -172,7 +155,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -181,7 +163,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -193,7 +175,6 @@ namespace UnitTest.Issues.TestProtos {
public static partial class Types {
public sealed partial class NestedOnce : pb::IMessage<NestedOnce> {
private static readonly pb::MessageParser<NestedOnce> _parser = new pb::MessageParser<NestedOnce>(() => new NestedOnce());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NestedOnce> Parser { get { return _parser; } }
@@ -216,7 +197,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public NestedOnce(NestedOnce other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -237,15 +217,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -256,17 +233,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -275,7 +246,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -284,7 +254,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -296,7 +266,6 @@ namespace UnitTest.Issues.TestProtos {
public static partial class Types {
public sealed partial class NestedTwice : pb::IMessage<NestedTwice> {
private static readonly pb::MessageParser<NestedTwice> _parser = new pb::MessageParser<NestedTwice>(() => new NestedTwice());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NestedTwice> Parser { get { return _parser; } }
@@ -319,7 +288,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public NestedTwice(NestedTwice other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -340,15 +308,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -359,17 +324,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -378,7 +337,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -387,7 +345,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -407,7 +365,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class NegativeEnumMessage : pb::IMessage<NegativeEnumMessage> {
private static readonly pb::MessageParser<NegativeEnumMessage> _parser = new pb::MessageParser<NegativeEnumMessage>(() => new NegativeEnumMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NegativeEnumMessage> Parser { get { return _parser; } }
@@ -433,7 +390,6 @@ namespace UnitTest.Issues.TestProtos {
value_ = other.value_;
values_ = other.values_.Clone();
packedValues_ = other.packedValues_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -488,7 +444,7 @@ namespace UnitTest.Issues.TestProtos {
if (Value != other.Value) return false;
if(!values_.Equals(other.values_)) return false;
if(!packedValues_.Equals(other.packedValues_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -497,9 +453,6 @@ namespace UnitTest.Issues.TestProtos {
if (Value != 0) hash ^= Value.GetHashCode();
hash ^= values_.GetHashCode();
hash ^= packedValues_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -516,9 +469,6 @@ namespace UnitTest.Issues.TestProtos {
}
values_.WriteTo(output, _repeated_values_codec);
packedValues_.WriteTo(output, _repeated_packedValues_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -529,9 +479,6 @@ namespace UnitTest.Issues.TestProtos {
}
size += values_.CalculateSize(_repeated_values_codec);
size += packedValues_.CalculateSize(_repeated_packedValues_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -545,7 +492,6 @@ namespace UnitTest.Issues.TestProtos {
}
values_.Add(other.values_);
packedValues_.Add(other.packedValues_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -554,7 +500,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
value_ = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum();
@@ -578,7 +524,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class DeprecatedChild : pb::IMessage<DeprecatedChild> {
private static readonly pb::MessageParser<DeprecatedChild> _parser = new pb::MessageParser<DeprecatedChild>(() => new DeprecatedChild());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<DeprecatedChild> Parser { get { return _parser; } }
@@ -601,7 +546,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public DeprecatedChild(DeprecatedChild other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -622,15 +566,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -641,17 +582,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -660,7 +595,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -669,7 +603,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -679,7 +613,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class DeprecatedFieldsMessage : pb::IMessage<DeprecatedFieldsMessage> {
private static readonly pb::MessageParser<DeprecatedFieldsMessage> _parser = new pb::MessageParser<DeprecatedFieldsMessage>(() => new DeprecatedFieldsMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<DeprecatedFieldsMessage> Parser { get { return _parser; } }
@@ -704,11 +637,10 @@ namespace UnitTest.Issues.TestProtos {
public DeprecatedFieldsMessage(DeprecatedFieldsMessage other) : this() {
primitiveValue_ = other.primitiveValue_;
primitiveArray_ = other.primitiveArray_.Clone();
- messageValue_ = other.messageValue_ != null ? other.messageValue_.Clone() : null;
+ MessageValue = other.messageValue_ != null ? other.MessageValue.Clone() : null;
messageArray_ = other.messageArray_.Clone();
enumValue_ = other.enumValue_;
enumArray_ = other.enumArray_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -804,7 +736,7 @@ namespace UnitTest.Issues.TestProtos {
if(!messageArray_.Equals(other.messageArray_)) return false;
if (EnumValue != other.EnumValue) return false;
if(!enumArray_.Equals(other.enumArray_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -816,9 +748,6 @@ namespace UnitTest.Issues.TestProtos {
hash ^= messageArray_.GetHashCode();
if (EnumValue != 0) hash ^= EnumValue.GetHashCode();
hash ^= enumArray_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -844,9 +773,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteEnum((int) EnumValue);
}
enumArray_.WriteTo(output, _repeated_enumArray_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -864,9 +790,6 @@ namespace UnitTest.Issues.TestProtos {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EnumValue);
}
size += enumArray_.CalculateSize(_repeated_enumArray_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -890,7 +813,6 @@ namespace UnitTest.Issues.TestProtos {
EnumValue = other.EnumValue;
}
enumArray_.Add(other.enumArray_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -899,7 +821,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
PrimitiveValue = input.ReadInt32();
@@ -941,7 +863,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class ItemField : pb::IMessage<ItemField> {
private static readonly pb::MessageParser<ItemField> _parser = new pb::MessageParser<ItemField>(() => new ItemField());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ItemField> Parser { get { return _parser; } }
@@ -965,7 +886,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ItemField(ItemField other) : this() {
item_ = other.item_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -998,16 +918,13 @@ namespace UnitTest.Issues.TestProtos {
return true;
}
if (Item != other.Item) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Item != 0) hash ^= Item.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1022,9 +939,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(Item);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1033,9 +947,6 @@ namespace UnitTest.Issues.TestProtos {
if (Item != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Item);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1047,7 +958,6 @@ namespace UnitTest.Issues.TestProtos {
if (other.Item != 0) {
Item = other.Item;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1056,7 +966,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Item = input.ReadInt32();
@@ -1070,7 +980,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class ReservedNames : pb::IMessage<ReservedNames> {
private static readonly pb::MessageParser<ReservedNames> _parser = new pb::MessageParser<ReservedNames>(() => new ReservedNames());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ReservedNames> Parser { get { return _parser; } }
@@ -1095,7 +1004,6 @@ namespace UnitTest.Issues.TestProtos {
public ReservedNames(ReservedNames other) : this() {
types_ = other.types_;
descriptor_ = other.descriptor_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1140,7 +1048,7 @@ namespace UnitTest.Issues.TestProtos {
}
if (Types_ != other.Types_) return false;
if (Descriptor_ != other.Descriptor_) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1148,9 +1056,6 @@ namespace UnitTest.Issues.TestProtos {
int hash = 1;
if (Types_ != 0) hash ^= Types_.GetHashCode();
if (Descriptor_ != 0) hash ^= Descriptor_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1169,9 +1074,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(16);
output.WriteInt32(Descriptor_);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1183,9 +1085,6 @@ namespace UnitTest.Issues.TestProtos {
if (Descriptor_ != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Descriptor_);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1200,7 +1099,6 @@ namespace UnitTest.Issues.TestProtos {
if (other.Descriptor_ != 0) {
Descriptor_ = other.Descriptor_;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1209,7 +1107,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Types_ = input.ReadInt32();
@@ -1232,7 +1130,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class SomeNestedType : pb::IMessage<SomeNestedType> {
private static readonly pb::MessageParser<SomeNestedType> _parser = new pb::MessageParser<SomeNestedType>(() => new SomeNestedType());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<SomeNestedType> Parser { get { return _parser; } }
@@ -1255,7 +1152,6 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public SomeNestedType(SomeNestedType other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1276,15 +1172,12 @@ namespace UnitTest.Issues.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1295,17 +1188,11 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1314,7 +1201,6 @@ namespace UnitTest.Issues.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1323,7 +1209,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -1350,7 +1236,6 @@ namespace UnitTest.Issues.TestProtos {
/// </summary>
public sealed partial class TestJsonFieldOrdering : pb::IMessage<TestJsonFieldOrdering> {
private static readonly pb::MessageParser<TestJsonFieldOrdering> _parser = new pb::MessageParser<TestJsonFieldOrdering>(() => new TestJsonFieldOrdering());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestJsonFieldOrdering> Parser { get { return _parser; } }
@@ -1393,7 +1278,6 @@ namespace UnitTest.Issues.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1526,7 +1410,7 @@ namespace UnitTest.Issues.TestProtos {
if (O2String != other.O2String) return false;
if (O1Case != other.O1Case) return false;
if (O2Case != other.O2Case) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1540,9 +1424,6 @@ namespace UnitTest.Issues.TestProtos {
if (o2Case_ == O2OneofCase.O2String) hash ^= O2String.GetHashCode();
hash ^= (int) o1Case_;
hash ^= (int) o2Case_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1577,9 +1458,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(48);
output.WriteInt32(O2Int32);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1603,9 +1481,6 @@ namespace UnitTest.Issues.TestProtos {
if (o2Case_ == O2OneofCase.O2String) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(O2String);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1638,7 +1513,6 @@ namespace UnitTest.Issues.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1647,7 +1521,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
PlainString = input.ReadString();
@@ -1681,7 +1555,6 @@ namespace UnitTest.Issues.TestProtos {
public sealed partial class TestJsonName : pb::IMessage<TestJsonName> {
private static readonly pb::MessageParser<TestJsonName> _parser = new pb::MessageParser<TestJsonName>(() => new TestJsonName());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestJsonName> Parser { get { return _parser; } }
@@ -1707,7 +1580,6 @@ namespace UnitTest.Issues.TestProtos {
name_ = other.name_;
description_ = other.description_;
guid_ = other.guid_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1767,7 +1639,7 @@ namespace UnitTest.Issues.TestProtos {
if (Name != other.Name) return false;
if (Description != other.Description) return false;
if (Guid != other.Guid) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1776,9 +1648,6 @@ namespace UnitTest.Issues.TestProtos {
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Description.Length != 0) hash ^= Description.GetHashCode();
if (Guid.Length != 0) hash ^= Guid.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1801,9 +1670,6 @@ namespace UnitTest.Issues.TestProtos {
output.WriteRawTag(26);
output.WriteString(Guid);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1818,9 +1684,6 @@ namespace UnitTest.Issues.TestProtos {
if (Guid.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Guid);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1838,7 +1701,6 @@ namespace UnitTest.Issues.TestProtos {
if (other.Guid.Length != 0) {
Guid = other.Guid;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1847,7 +1709,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -1867,371 +1729,6 @@ namespace UnitTest.Issues.TestProtos {
}
- /// <summary>
- /// Issue 3200: When merging two messages which use the same
- /// oneof case, which is itself a message type, the submessages should
- /// be merged.
- /// </summary>
- public sealed partial class OneofMerging : pb::IMessage<OneofMerging> {
- private static readonly pb::MessageParser<OneofMerging> _parser = new pb::MessageParser<OneofMerging>(() => new OneofMerging());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser<OneofMerging> Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[8]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public OneofMerging() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public OneofMerging(OneofMerging other) : this() {
- switch (other.ValueCase) {
- case ValueOneofCase.Text:
- Text = other.Text;
- break;
- case ValueOneofCase.Nested:
- Nested = other.Nested.Clone();
- break;
- }
-
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public OneofMerging Clone() {
- return new OneofMerging(this);
- }
-
- /// <summary>Field number for the "text" field.</summary>
- public const int TextFieldNumber = 1;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public string Text {
- get { return valueCase_ == ValueOneofCase.Text ? (string) value_ : ""; }
- set {
- value_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
- valueCase_ = ValueOneofCase.Text;
- }
- }
-
- /// <summary>Field number for the "nested" field.</summary>
- public const int NestedFieldNumber = 2;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested Nested {
- get { return valueCase_ == ValueOneofCase.Nested ? (global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested) value_ : null; }
- set {
- value_ = value;
- valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.Nested;
- }
- }
-
- private object value_;
- /// <summary>Enum of possible cases for the "value" oneof.</summary>
- public enum ValueOneofCase {
- None = 0,
- Text = 1,
- Nested = 2,
- }
- private ValueOneofCase valueCase_ = ValueOneofCase.None;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public ValueOneofCase ValueCase {
- get { return valueCase_; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void ClearValue() {
- valueCase_ = ValueOneofCase.None;
- value_ = null;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as OneofMerging);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(OneofMerging other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (Text != other.Text) return false;
- if (!object.Equals(Nested, other.Nested)) return false;
- if (ValueCase != other.ValueCase) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (valueCase_ == ValueOneofCase.Text) hash ^= Text.GetHashCode();
- if (valueCase_ == ValueOneofCase.Nested) hash ^= Nested.GetHashCode();
- hash ^= (int) valueCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- if (valueCase_ == ValueOneofCase.Text) {
- output.WriteRawTag(10);
- output.WriteString(Text);
- }
- if (valueCase_ == ValueOneofCase.Nested) {
- output.WriteRawTag(18);
- output.WriteMessage(Nested);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (valueCase_ == ValueOneofCase.Text) {
- size += 1 + pb::CodedOutputStream.ComputeStringSize(Text);
- }
- if (valueCase_ == ValueOneofCase.Nested) {
- size += 1 + pb::CodedOutputStream.ComputeMessageSize(Nested);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(OneofMerging other) {
- if (other == null) {
- return;
- }
- switch (other.ValueCase) {
- case ValueOneofCase.Text:
- Text = other.Text;
- break;
- case ValueOneofCase.Nested:
- if (Nested == null) {
- Nested = new global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested();
- }
- Nested.MergeFrom(other.Nested);
- break;
- }
-
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 10: {
- Text = input.ReadString();
- break;
- }
- case 18: {
- global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested subBuilder = new global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested();
- if (valueCase_ == ValueOneofCase.Nested) {
- subBuilder.MergeFrom(Nested);
- }
- input.ReadMessage(subBuilder);
- Nested = subBuilder;
- break;
- }
- }
- }
- }
-
- #region Nested types
- /// <summary>Container for nested types declared in the OneofMerging message type.</summary>
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static partial class Types {
- public sealed partial class Nested : pb::IMessage<Nested> {
- private static readonly pb::MessageParser<Nested> _parser = new pb::MessageParser<Nested>(() => new Nested());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser<Nested> Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::UnitTest.Issues.TestProtos.OneofMerging.Descriptor.NestedTypes[0]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Nested() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Nested(Nested other) : this() {
- x_ = other.x_;
- y_ = other.y_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Nested Clone() {
- return new Nested(this);
- }
-
- /// <summary>Field number for the "x" field.</summary>
- public const int XFieldNumber = 1;
- private int x_;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int X {
- get { return x_; }
- set {
- x_ = value;
- }
- }
-
- /// <summary>Field number for the "y" field.</summary>
- public const int YFieldNumber = 2;
- private int y_;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int Y {
- get { return y_; }
- set {
- y_ = value;
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as Nested);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(Nested other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (X != other.X) return false;
- if (Y != other.Y) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (X != 0) hash ^= X.GetHashCode();
- if (Y != 0) hash ^= Y.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- if (X != 0) {
- output.WriteRawTag(8);
- output.WriteInt32(X);
- }
- if (Y != 0) {
- output.WriteRawTag(16);
- output.WriteInt32(Y);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (X != 0) {
- size += 1 + pb::CodedOutputStream.ComputeInt32Size(X);
- }
- if (Y != 0) {
- size += 1 + pb::CodedOutputStream.ComputeInt32Size(Y);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(Nested other) {
- if (other == null) {
- return;
- }
- if (other.X != 0) {
- X = other.X;
- }
- if (other.Y != 0) {
- Y = other.Y;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 8: {
- X = input.ReadInt32();
- break;
- }
- case 16: {
- Y = input.ReadInt32();
- break;
- }
- }
- }
- }
-
- }
-
- }
- #endregion
-
- }
-
#endregion
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
index d5dbe866df..c11ab84d01 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: unittest_proto3.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/unittest_proto3.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -11,11 +9,11 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
- /// <summary>Holder for reflection information generated from unittest_proto3.proto</summary>
+ /// <summary>Holder for reflection information generated from google/protobuf/unittest_proto3.proto</summary>
public static partial class UnittestProto3Reflection {
#region Descriptor
- /// <summary>File descriptor for unittest_proto3.proto</summary>
+ /// <summary>File descriptor for google/protobuf/unittest_proto3.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -24,135 +22,135 @@ namespace Google.Protobuf.TestProtos {
static UnittestProto3Reflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChV1bml0dGVzdF9wcm90bzMucHJvdG8SEnByb3RvYnVmX3VuaXR0ZXN0Mxoc",
- "dW5pdHRlc3RfaW1wb3J0X3Byb3RvMy5wcm90byL5DwoMVGVzdEFsbFR5cGVz",
- "EhQKDHNpbmdsZV9pbnQzMhgBIAEoBRIUCgxzaW5nbGVfaW50NjQYAiABKAMS",
- "FQoNc2luZ2xlX3VpbnQzMhgDIAEoDRIVCg1zaW5nbGVfdWludDY0GAQgASgE",
- "EhUKDXNpbmdsZV9zaW50MzIYBSABKBESFQoNc2luZ2xlX3NpbnQ2NBgGIAEo",
- "EhIWCg5zaW5nbGVfZml4ZWQzMhgHIAEoBxIWCg5zaW5nbGVfZml4ZWQ2NBgI",
- "IAEoBhIXCg9zaW5nbGVfc2ZpeGVkMzIYCSABKA8SFwoPc2luZ2xlX3NmaXhl",
- "ZDY0GAogASgQEhQKDHNpbmdsZV9mbG9hdBgLIAEoAhIVCg1zaW5nbGVfZG91",
- "YmxlGAwgASgBEhMKC3NpbmdsZV9ib29sGA0gASgIEhUKDXNpbmdsZV9zdHJp",
- "bmcYDiABKAkSFAoMc2luZ2xlX2J5dGVzGA8gASgMEk0KFXNpbmdsZV9uZXN0",
- "ZWRfbWVzc2FnZRgSIAEoCzIuLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxs",
- "VHlwZXMuTmVzdGVkTWVzc2FnZRJCChZzaW5nbGVfZm9yZWlnbl9tZXNzYWdl",
- "GBMgASgLMiIucHJvdG9idWZfdW5pdHRlc3QzLkZvcmVpZ25NZXNzYWdlEkYK",
- "FXNpbmdsZV9pbXBvcnRfbWVzc2FnZRgUIAEoCzInLnByb3RvYnVmX3VuaXR0",
- "ZXN0X2ltcG9ydC5JbXBvcnRNZXNzYWdlEkcKEnNpbmdsZV9uZXN0ZWRfZW51",
- "bRgVIAEoDjIrLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMuTmVz",
- "dGVkRW51bRI8ChNzaW5nbGVfZm9yZWlnbl9lbnVtGBYgASgOMh8ucHJvdG9i",
- "dWZfdW5pdHRlc3QzLkZvcmVpZ25FbnVtEkAKEnNpbmdsZV9pbXBvcnRfZW51",
- "bRgXIAEoDjIkLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRFbnVt",
- "ElMKHHNpbmdsZV9wdWJsaWNfaW1wb3J0X21lc3NhZ2UYGiABKAsyLS5wcm90",
- "b2J1Zl91bml0dGVzdF9pbXBvcnQuUHVibGljSW1wb3J0TWVzc2FnZRIWCg5y",
- "ZXBlYXRlZF9pbnQzMhgfIAMoBRIWCg5yZXBlYXRlZF9pbnQ2NBggIAMoAxIX",
- "Cg9yZXBlYXRlZF91aW50MzIYISADKA0SFwoPcmVwZWF0ZWRfdWludDY0GCIg",
- "AygEEhcKD3JlcGVhdGVkX3NpbnQzMhgjIAMoERIXCg9yZXBlYXRlZF9zaW50",
- "NjQYJCADKBISGAoQcmVwZWF0ZWRfZml4ZWQzMhglIAMoBxIYChByZXBlYXRl",
- "ZF9maXhlZDY0GCYgAygGEhkKEXJlcGVhdGVkX3NmaXhlZDMyGCcgAygPEhkK",
- "EXJlcGVhdGVkX3NmaXhlZDY0GCggAygQEhYKDnJlcGVhdGVkX2Zsb2F0GCkg",
- "AygCEhcKD3JlcGVhdGVkX2RvdWJsZRgqIAMoARIVCg1yZXBlYXRlZF9ib29s",
- "GCsgAygIEhcKD3JlcGVhdGVkX3N0cmluZxgsIAMoCRIWCg5yZXBlYXRlZF9i",
- "eXRlcxgtIAMoDBJPChdyZXBlYXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMoCzIu",
- "LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2Fn",
- "ZRJEChhyZXBlYXRlZF9mb3JlaWduX21lc3NhZ2UYMSADKAsyIi5wcm90b2J1",
- "Zl91bml0dGVzdDMuRm9yZWlnbk1lc3NhZ2USSAoXcmVwZWF0ZWRfaW1wb3J0",
- "X21lc3NhZ2UYMiADKAsyJy5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1w",
- "b3J0TWVzc2FnZRJJChRyZXBlYXRlZF9uZXN0ZWRfZW51bRgzIAMoDjIrLnBy",
- "b3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMuTmVzdGVkRW51bRI+ChVy",
- "ZXBlYXRlZF9mb3JlaWduX2VudW0YNCADKA4yHy5wcm90b2J1Zl91bml0dGVz",
- "dDMuRm9yZWlnbkVudW0SQgoUcmVwZWF0ZWRfaW1wb3J0X2VudW0YNSADKA4y",
- "JC5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0RW51bRJVCh5yZXBl",
- "YXRlZF9wdWJsaWNfaW1wb3J0X21lc3NhZ2UYNiADKAsyLS5wcm90b2J1Zl91",
- "bml0dGVzdF9pbXBvcnQuUHVibGljSW1wb3J0TWVzc2FnZRIWCgxvbmVvZl91",
- "aW50MzIYbyABKA1IABJOChRvbmVvZl9uZXN0ZWRfbWVzc2FnZRhwIAEoCzIu",
- "LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2Fn",
- "ZUgAEhYKDG9uZW9mX3N0cmluZxhxIAEoCUgAEhUKC29uZW9mX2J5dGVzGHIg",
- "ASgMSAAaGwoNTmVzdGVkTWVzc2FnZRIKCgJiYhgBIAEoBSJWCgpOZXN0ZWRF",
- "bnVtEhsKF05FU1RFRF9FTlVNX1VOU1BFQ0lGSUVEEAASBwoDRk9PEAESBwoD",
- "QkFSEAISBwoDQkFaEAMSEAoDTkVHEP///////////wFCDQoLb25lb2ZfZmll",
- "bGQivgEKEk5lc3RlZFRlc3RBbGxUeXBlcxI1CgVjaGlsZBgBIAEoCzImLnBy",
- "b3RvYnVmX3VuaXR0ZXN0My5OZXN0ZWRUZXN0QWxsVHlwZXMSMQoHcGF5bG9h",
- "ZBgCIAEoCzIgLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMSPgoO",
- "cmVwZWF0ZWRfY2hpbGQYAyADKAsyJi5wcm90b2J1Zl91bml0dGVzdDMuTmVz",
- "dGVkVGVzdEFsbFR5cGVzIjQKFFRlc3REZXByZWNhdGVkRmllbGRzEhwKEGRl",
- "cHJlY2F0ZWRfaW50MzIYASABKAVCAhgBIhsKDkZvcmVpZ25NZXNzYWdlEgkK",
- "AWMYASABKAUiMAoSVGVzdFJlc2VydmVkRmllbGRzSgQIAhADSgQIDxAQSgQI",
- "CRAMUgNiYXJSA2JheiJbChFUZXN0Rm9yZWlnbk5lc3RlZBJGCg5mb3JlaWdu",
- "X25lc3RlZBgBIAEoCzIuLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlw",
- "ZXMuTmVzdGVkTWVzc2FnZSI0ChhUZXN0UmVhbGx5TGFyZ2VUYWdOdW1iZXIS",
- "CQoBYRgBIAEoBRINCgJiYhj///9/IAEoBSJWChRUZXN0UmVjdXJzaXZlTWVz",
- "c2FnZRIzCgFhGAEgASgLMigucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RSZWN1",
- "cnNpdmVNZXNzYWdlEgkKAWkYAiABKAUiTAoUVGVzdE11dHVhbFJlY3Vyc2lv",
- "bkESNAoCYmIYASABKAsyKC5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE11dHVh",
- "bFJlY3Vyc2lvbkIiYwoUVGVzdE11dHVhbFJlY3Vyc2lvbkISMwoBYRgBIAEo",
- "CzIoLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TXV0dWFsUmVjdXJzaW9uQRIW",
- "Cg5vcHRpb25hbF9pbnQzMhgCIAEoBSJNChJUZXN0RW51bUFsbG93QWxpYXMS",
- "NwoFdmFsdWUYASABKA4yKC5wcm90b2J1Zl91bml0dGVzdDMuVGVzdEVudW1X",
- "aXRoRHVwVmFsdWUi7wIKF1Rlc3RDYW1lbENhc2VGaWVsZE5hbWVzEhYKDlBy",
- "aW1pdGl2ZUZpZWxkGAEgASgFEhMKC1N0cmluZ0ZpZWxkGAIgASgJEjIKCUVu",
- "dW1GaWVsZBgDIAEoDjIfLnByb3RvYnVmX3VuaXR0ZXN0My5Gb3JlaWduRW51",
- "bRI4CgxNZXNzYWdlRmllbGQYBCABKAsyIi5wcm90b2J1Zl91bml0dGVzdDMu",
- "Rm9yZWlnbk1lc3NhZ2USHgoWUmVwZWF0ZWRQcmltaXRpdmVGaWVsZBgHIAMo",
- "BRIbChNSZXBlYXRlZFN0cmluZ0ZpZWxkGAggAygJEjoKEVJlcGVhdGVkRW51",
- "bUZpZWxkGAkgAygOMh8ucHJvdG9idWZfdW5pdHRlc3QzLkZvcmVpZ25FbnVt",
- "EkAKFFJlcGVhdGVkTWVzc2FnZUZpZWxkGAogAygLMiIucHJvdG9idWZfdW5p",
- "dHRlc3QzLkZvcmVpZ25NZXNzYWdlIsgBChJUZXN0RmllbGRPcmRlcmluZ3MS",
- "EQoJbXlfc3RyaW5nGAsgASgJEg4KBm15X2ludBgBIAEoAxIQCghteV9mbG9h",
- "dBhlIAEoAhJUChVzaW5nbGVfbmVzdGVkX21lc3NhZ2UYyAEgASgLMjQucHJv",
- "dG9idWZfdW5pdHRlc3QzLlRlc3RGaWVsZE9yZGVyaW5ncy5OZXN0ZWRNZXNz",
- "YWdlGicKDU5lc3RlZE1lc3NhZ2USCgoCb28YAiABKAMSCgoCYmIYASABKAUi",
- "TAoRU3BhcnNlRW51bU1lc3NhZ2USNwoLc3BhcnNlX2VudW0YASABKA4yIi5w",
- "cm90b2J1Zl91bml0dGVzdDMuVGVzdFNwYXJzZUVudW0iGQoJT25lU3RyaW5n",
- "EgwKBGRhdGEYASABKAkiGgoKTW9yZVN0cmluZxIMCgRkYXRhGAEgAygJIhgK",
- "CE9uZUJ5dGVzEgwKBGRhdGEYASABKAwiGQoJTW9yZUJ5dGVzEgwKBGRhdGEY",
- "ASABKAwiHAoMSW50MzJNZXNzYWdlEgwKBGRhdGEYASABKAUiHQoNVWludDMy",
- "TWVzc2FnZRIMCgRkYXRhGAEgASgNIhwKDEludDY0TWVzc2FnZRIMCgRkYXRh",
- "GAEgASgDIh0KDVVpbnQ2NE1lc3NhZ2USDAoEZGF0YRgBIAEoBCIbCgtCb29s",
- "TWVzc2FnZRIMCgRkYXRhGAEgASgIInQKCVRlc3RPbmVvZhIRCgdmb29faW50",
- "GAEgASgFSAASFAoKZm9vX3N0cmluZxgCIAEoCUgAEjcKC2Zvb19tZXNzYWdl",
- "GAMgASgLMiAucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBbGxUeXBlc0gAQgUK",
- "A2ZvbyKrAwoPVGVzdFBhY2tlZFR5cGVzEhgKDHBhY2tlZF9pbnQzMhhaIAMo",
- "BUICEAESGAoMcGFja2VkX2ludDY0GFsgAygDQgIQARIZCg1wYWNrZWRfdWlu",
- "dDMyGFwgAygNQgIQARIZCg1wYWNrZWRfdWludDY0GF0gAygEQgIQARIZCg1w",
- "YWNrZWRfc2ludDMyGF4gAygRQgIQARIZCg1wYWNrZWRfc2ludDY0GF8gAygS",
- "QgIQARIaCg5wYWNrZWRfZml4ZWQzMhhgIAMoB0ICEAESGgoOcGFja2VkX2Zp",
- "eGVkNjQYYSADKAZCAhABEhsKD3BhY2tlZF9zZml4ZWQzMhhiIAMoD0ICEAES",
- "GwoPcGFja2VkX3NmaXhlZDY0GGMgAygQQgIQARIYCgxwYWNrZWRfZmxvYXQY",
- "ZCADKAJCAhABEhkKDXBhY2tlZF9kb3VibGUYZSADKAFCAhABEhcKC3BhY2tl",
- "ZF9ib29sGGYgAygIQgIQARI4CgtwYWNrZWRfZW51bRhnIAMoDjIfLnByb3Rv",
- "YnVmX3VuaXR0ZXN0My5Gb3JlaWduRW51bUICEAEiyQMKEVRlc3RVbnBhY2tl",
- "ZFR5cGVzEhoKDnVucGFja2VkX2ludDMyGFogAygFQgIQABIaCg51bnBhY2tl",
- "ZF9pbnQ2NBhbIAMoA0ICEAASGwoPdW5wYWNrZWRfdWludDMyGFwgAygNQgIQ",
- "ABIbCg91bnBhY2tlZF91aW50NjQYXSADKARCAhAAEhsKD3VucGFja2VkX3Np",
- "bnQzMhheIAMoEUICEAASGwoPdW5wYWNrZWRfc2ludDY0GF8gAygSQgIQABIc",
- "ChB1bnBhY2tlZF9maXhlZDMyGGAgAygHQgIQABIcChB1bnBhY2tlZF9maXhl",
- "ZDY0GGEgAygGQgIQABIdChF1bnBhY2tlZF9zZml4ZWQzMhhiIAMoD0ICEAAS",
- "HQoRdW5wYWNrZWRfc2ZpeGVkNjQYYyADKBBCAhAAEhoKDnVucGFja2VkX2Zs",
- "b2F0GGQgAygCQgIQABIbCg91bnBhY2tlZF9kb3VibGUYZSADKAFCAhAAEhkK",
- "DXVucGFja2VkX2Jvb2wYZiADKAhCAhAAEjoKDXVucGFja2VkX2VudW0YZyAD",
- "KA4yHy5wcm90b2J1Zl91bml0dGVzdDMuRm9yZWlnbkVudW1CAhAAIsABCiNU",
- "ZXN0UmVwZWF0ZWRTY2FsYXJEaWZmZXJlbnRUYWdTaXplcxIYChByZXBlYXRl",
- "ZF9maXhlZDMyGAwgAygHEhYKDnJlcGVhdGVkX2ludDMyGA0gAygFEhkKEHJl",
- "cGVhdGVkX2ZpeGVkNjQY/g8gAygGEhcKDnJlcGVhdGVkX2ludDY0GP8PIAMo",
- "AxIYCg5yZXBlYXRlZF9mbG9hdBj+/w8gAygCEhkKD3JlcGVhdGVkX3VpbnQ2",
- "NBj//w8gAygEIigKG1Rlc3RDb21tZW50SW5qZWN0aW9uTWVzc2FnZRIJCgFh",
- "GAEgASgJIgwKCkZvb1JlcXVlc3QiDQoLRm9vUmVzcG9uc2UiEgoQRm9vQ2xp",
- "ZW50TWVzc2FnZSISChBGb29TZXJ2ZXJNZXNzYWdlIgwKCkJhclJlcXVlc3Qi",
- "DQoLQmFyUmVzcG9uc2UiEgoQVGVzdEVtcHR5TWVzc2FnZSpZCgtGb3JlaWdu",
- "RW51bRIXChNGT1JFSUdOX1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08Q",
- "BBIPCgtGT1JFSUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVu",
- "dW1XaXRoRHVwVmFsdWUSKAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VO",
- "U1BFQ0lGSUVEEAASCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRG",
- "T08yEAESCAoEQkFSMhACGgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVT",
- "VF9TUEFSU0VfRU5VTV9VTlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoI",
- "U1BBUlNFX0IQpucDEg8KCFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//",
- "////////ARIVCghTUEFSU0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIy",
- "nQEKC1Rlc3RTZXJ2aWNlEkYKA0ZvbxIeLnByb3RvYnVmX3VuaXR0ZXN0My5G",
- "b29SZXF1ZXN0Gh8ucHJvdG9idWZfdW5pdHRlc3QzLkZvb1Jlc3BvbnNlEkYK",
- "A0JhchIeLnByb3RvYnVmX3VuaXR0ZXN0My5CYXJSZXF1ZXN0Gh8ucHJvdG9i",
- "dWZfdW5pdHRlc3QzLkJhclJlc3BvbnNlQixCDVVuaXR0ZXN0UHJvdG+qAhpH",
- "b29nbGUuUHJvdG9idWYuVGVzdFByb3Rvc2IGcHJvdG8z"));
+ "CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcHJvdG8zLnByb3RvEhFwcm90",
+ "b2J1Zl91bml0dGVzdBosZ29vZ2xlL3Byb3RvYnVmL3VuaXR0ZXN0X2ltcG9y",
+ "dF9wcm90bzMucHJvdG8i8A8KDFRlc3RBbGxUeXBlcxIUCgxzaW5nbGVfaW50",
+ "MzIYASABKAUSFAoMc2luZ2xlX2ludDY0GAIgASgDEhUKDXNpbmdsZV91aW50",
+ "MzIYAyABKA0SFQoNc2luZ2xlX3VpbnQ2NBgEIAEoBBIVCg1zaW5nbGVfc2lu",
+ "dDMyGAUgASgREhUKDXNpbmdsZV9zaW50NjQYBiABKBISFgoOc2luZ2xlX2Zp",
+ "eGVkMzIYByABKAcSFgoOc2luZ2xlX2ZpeGVkNjQYCCABKAYSFwoPc2luZ2xl",
+ "X3NmaXhlZDMyGAkgASgPEhcKD3NpbmdsZV9zZml4ZWQ2NBgKIAEoEBIUCgxz",
+ "aW5nbGVfZmxvYXQYCyABKAISFQoNc2luZ2xlX2RvdWJsZRgMIAEoARITCgtz",
+ "aW5nbGVfYm9vbBgNIAEoCBIVCg1zaW5nbGVfc3RyaW5nGA4gASgJEhQKDHNp",
+ "bmdsZV9ieXRlcxgPIAEoDBJMChVzaW5nbGVfbmVzdGVkX21lc3NhZ2UYEiAB",
+ "KAsyLS5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVz",
+ "c2FnZRJBChZzaW5nbGVfZm9yZWlnbl9tZXNzYWdlGBMgASgLMiEucHJvdG9i",
+ "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USRgoVc2luZ2xlX2ltcG9ydF9t",
+ "ZXNzYWdlGBQgASgLMicucHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9y",
+ "dE1lc3NhZ2USRgoSc2luZ2xlX25lc3RlZF9lbnVtGBUgASgOMioucHJvdG9i",
+ "dWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW0SOwoTc2luZ2xl",
+ "X2ZvcmVpZ25fZW51bRgWIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp",
+ "Z25FbnVtEkAKEnNpbmdsZV9pbXBvcnRfZW51bRgXIAEoDjIkLnByb3RvYnVm",
+ "X3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRFbnVtElMKHHNpbmdsZV9wdWJsaWNf",
+ "aW1wb3J0X21lc3NhZ2UYGiABKAsyLS5wcm90b2J1Zl91bml0dGVzdF9pbXBv",
+ "cnQuUHVibGljSW1wb3J0TWVzc2FnZRIWCg5yZXBlYXRlZF9pbnQzMhgfIAMo",
+ "BRIWCg5yZXBlYXRlZF9pbnQ2NBggIAMoAxIXCg9yZXBlYXRlZF91aW50MzIY",
+ "ISADKA0SFwoPcmVwZWF0ZWRfdWludDY0GCIgAygEEhcKD3JlcGVhdGVkX3Np",
+ "bnQzMhgjIAMoERIXCg9yZXBlYXRlZF9zaW50NjQYJCADKBISGAoQcmVwZWF0",
+ "ZWRfZml4ZWQzMhglIAMoBxIYChByZXBlYXRlZF9maXhlZDY0GCYgAygGEhkK",
+ "EXJlcGVhdGVkX3NmaXhlZDMyGCcgAygPEhkKEXJlcGVhdGVkX3NmaXhlZDY0",
+ "GCggAygQEhYKDnJlcGVhdGVkX2Zsb2F0GCkgAygCEhcKD3JlcGVhdGVkX2Rv",
+ "dWJsZRgqIAMoARIVCg1yZXBlYXRlZF9ib29sGCsgAygIEhcKD3JlcGVhdGVk",
+ "X3N0cmluZxgsIAMoCRIWCg5yZXBlYXRlZF9ieXRlcxgtIAMoDBJOChdyZXBl",
+ "YXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMoCzItLnByb3RvYnVmX3VuaXR0ZXN0",
+ "LlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlEkMKGHJlcGVhdGVkX2ZvcmVp",
+ "Z25fbWVzc2FnZRgxIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25N",
+ "ZXNzYWdlEkgKF3JlcGVhdGVkX2ltcG9ydF9tZXNzYWdlGDIgAygLMicucHJv",
+ "dG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9ydE1lc3NhZ2USSAoUcmVwZWF0",
+ "ZWRfbmVzdGVkX2VudW0YMyADKA4yKi5wcm90b2J1Zl91bml0dGVzdC5UZXN0",
+ "QWxsVHlwZXMuTmVzdGVkRW51bRI9ChVyZXBlYXRlZF9mb3JlaWduX2VudW0Y",
+ "NCADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bRJCChRyZXBl",
+ "YXRlZF9pbXBvcnRfZW51bRg1IAMoDjIkLnByb3RvYnVmX3VuaXR0ZXN0X2lt",
+ "cG9ydC5JbXBvcnRFbnVtElUKHnJlcGVhdGVkX3B1YmxpY19pbXBvcnRfbWVz",
+ "c2FnZRg2IAMoCzItLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5QdWJsaWNJ",
+ "bXBvcnRNZXNzYWdlEhYKDG9uZW9mX3VpbnQzMhhvIAEoDUgAEk0KFG9uZW9m",
+ "X25lc3RlZF9tZXNzYWdlGHAgASgLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVz",
+ "dEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2VIABIWCgxvbmVvZl9zdHJpbmcYcSAB",
+ "KAlIABIVCgtvbmVvZl9ieXRlcxhyIAEoDEgAGhsKDU5lc3RlZE1lc3NhZ2US",
+ "CgoCYmIYASABKAUiVgoKTmVzdGVkRW51bRIbChdORVNURURfRU5VTV9VTlNQ",
+ "RUNJRklFRBAAEgcKA0ZPTxABEgcKA0JBUhACEgcKA0JBWhADEhAKA05FRxD/",
+ "//////////8BQg0KC29uZW9mX2ZpZWxkIrsBChJOZXN0ZWRUZXN0QWxsVHlw",
+ "ZXMSNAoFY2hpbGQYASABKAsyJS5wcm90b2J1Zl91bml0dGVzdC5OZXN0ZWRU",
+ "ZXN0QWxsVHlwZXMSMAoHcGF5bG9hZBgCIAEoCzIfLnByb3RvYnVmX3VuaXR0",
+ "ZXN0LlRlc3RBbGxUeXBlcxI9Cg5yZXBlYXRlZF9jaGlsZBgDIAMoCzIlLnBy",
+ "b3RvYnVmX3VuaXR0ZXN0Lk5lc3RlZFRlc3RBbGxUeXBlcyI0ChRUZXN0RGVw",
+ "cmVjYXRlZEZpZWxkcxIcChBkZXByZWNhdGVkX2ludDMyGAEgASgFQgIYASIb",
+ "Cg5Gb3JlaWduTWVzc2FnZRIJCgFjGAEgASgFIjAKElRlc3RSZXNlcnZlZEZp",
+ "ZWxkc0oECAIQA0oECA8QEEoECAkQDFIDYmFyUgNiYXoiWgoRVGVzdEZvcmVp",
+ "Z25OZXN0ZWQSRQoOZm9yZWlnbl9uZXN0ZWQYASABKAsyLS5wcm90b2J1Zl91",
+ "bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZSI0ChhUZXN0UmVh",
+ "bGx5TGFyZ2VUYWdOdW1iZXISCQoBYRgBIAEoBRINCgJiYhj///9/IAEoBSJV",
+ "ChRUZXN0UmVjdXJzaXZlTWVzc2FnZRIyCgFhGAEgASgLMicucHJvdG9idWZf",
+ "dW5pdHRlc3QuVGVzdFJlY3Vyc2l2ZU1lc3NhZ2USCQoBaRgCIAEoBSJLChRU",
+ "ZXN0TXV0dWFsUmVjdXJzaW9uQRIzCgJiYhgBIAEoCzInLnByb3RvYnVmX3Vu",
+ "aXR0ZXN0LlRlc3RNdXR1YWxSZWN1cnNpb25CImIKFFRlc3RNdXR1YWxSZWN1",
+ "cnNpb25CEjIKAWEYASABKAsyJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TXV0",
+ "dWFsUmVjdXJzaW9uQRIWCg5vcHRpb25hbF9pbnQzMhgCIAEoBSJMChJUZXN0",
+ "RW51bUFsbG93QWxpYXMSNgoFdmFsdWUYASABKA4yJy5wcm90b2J1Zl91bml0",
+ "dGVzdC5UZXN0RW51bVdpdGhEdXBWYWx1ZSLrAgoXVGVzdENhbWVsQ2FzZUZp",
+ "ZWxkTmFtZXMSFgoOUHJpbWl0aXZlRmllbGQYASABKAUSEwoLU3RyaW5nRmll",
+ "bGQYAiABKAkSMQoJRW51bUZpZWxkGAMgASgOMh4ucHJvdG9idWZfdW5pdHRl",
+ "c3QuRm9yZWlnbkVudW0SNwoMTWVzc2FnZUZpZWxkGAQgASgLMiEucHJvdG9i",
+ "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USHgoWUmVwZWF0ZWRQcmltaXRp",
+ "dmVGaWVsZBgHIAMoBRIbChNSZXBlYXRlZFN0cmluZ0ZpZWxkGAggAygJEjkK",
+ "EVJlcGVhdGVkRW51bUZpZWxkGAkgAygOMh4ucHJvdG9idWZfdW5pdHRlc3Qu",
+ "Rm9yZWlnbkVudW0SPwoUUmVwZWF0ZWRNZXNzYWdlRmllbGQYCiADKAsyIS5w",
+ "cm90b2J1Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZSLHAQoSVGVzdEZpZWxk",
+ "T3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEoCRIOCgZteV9pbnQYASABKAMS",
+ "EAoIbXlfZmxvYXQYZSABKAISUwoVc2luZ2xlX25lc3RlZF9tZXNzYWdlGMgB",
+ "IAEoCzIzLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RGaWVsZE9yZGVyaW5ncy5O",
+ "ZXN0ZWRNZXNzYWdlGicKDU5lc3RlZE1lc3NhZ2USCgoCb28YAiABKAMSCgoC",
+ "YmIYASABKAUiSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoLc3BhcnNlX2VudW0Y",
+ "ASABKA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3BhcnNlRW51bSIZCglP",
+ "bmVTdHJpbmcSDAoEZGF0YRgBIAEoCSIaCgpNb3JlU3RyaW5nEgwKBGRhdGEY",
+ "ASADKAkiGAoIT25lQnl0ZXMSDAoEZGF0YRgBIAEoDCIZCglNb3JlQnl0ZXMS",
+ "DAoEZGF0YRgBIAEoDCIcCgxJbnQzMk1lc3NhZ2USDAoEZGF0YRgBIAEoBSId",
+ "Cg1VaW50MzJNZXNzYWdlEgwKBGRhdGEYASABKA0iHAoMSW50NjRNZXNzYWdl",
+ "EgwKBGRhdGEYASABKAMiHQoNVWludDY0TWVzc2FnZRIMCgRkYXRhGAEgASgE",
+ "IhsKC0Jvb2xNZXNzYWdlEgwKBGRhdGEYASABKAgicwoJVGVzdE9uZW9mEhEK",
+ "B2Zvb19pbnQYASABKAVIABIUCgpmb29fc3RyaW5nGAIgASgJSAASNgoLZm9v",
+ "X21lc3NhZ2UYAyABKAsyHy5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlw",
+ "ZXNIAEIFCgNmb28iqgMKD1Rlc3RQYWNrZWRUeXBlcxIYCgxwYWNrZWRfaW50",
+ "MzIYWiADKAVCAhABEhgKDHBhY2tlZF9pbnQ2NBhbIAMoA0ICEAESGQoNcGFj",
+ "a2VkX3VpbnQzMhhcIAMoDUICEAESGQoNcGFja2VkX3VpbnQ2NBhdIAMoBEIC",
+ "EAESGQoNcGFja2VkX3NpbnQzMhheIAMoEUICEAESGQoNcGFja2VkX3NpbnQ2",
+ "NBhfIAMoEkICEAESGgoOcGFja2VkX2ZpeGVkMzIYYCADKAdCAhABEhoKDnBh",
+ "Y2tlZF9maXhlZDY0GGEgAygGQgIQARIbCg9wYWNrZWRfc2ZpeGVkMzIYYiAD",
+ "KA9CAhABEhsKD3BhY2tlZF9zZml4ZWQ2NBhjIAMoEEICEAESGAoMcGFja2Vk",
+ "X2Zsb2F0GGQgAygCQgIQARIZCg1wYWNrZWRfZG91YmxlGGUgAygBQgIQARIX",
+ "CgtwYWNrZWRfYm9vbBhmIAMoCEICEAESNwoLcGFja2VkX2VudW0YZyADKA4y",
+ "Hi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUICEAEiyAMKEVRlc3RV",
+ "bnBhY2tlZFR5cGVzEhoKDnVucGFja2VkX2ludDMyGFogAygFQgIQABIaCg51",
+ "bnBhY2tlZF9pbnQ2NBhbIAMoA0ICEAASGwoPdW5wYWNrZWRfdWludDMyGFwg",
+ "AygNQgIQABIbCg91bnBhY2tlZF91aW50NjQYXSADKARCAhAAEhsKD3VucGFj",
+ "a2VkX3NpbnQzMhheIAMoEUICEAASGwoPdW5wYWNrZWRfc2ludDY0GF8gAygS",
+ "QgIQABIcChB1bnBhY2tlZF9maXhlZDMyGGAgAygHQgIQABIcChB1bnBhY2tl",
+ "ZF9maXhlZDY0GGEgAygGQgIQABIdChF1bnBhY2tlZF9zZml4ZWQzMhhiIAMo",
+ "D0ICEAASHQoRdW5wYWNrZWRfc2ZpeGVkNjQYYyADKBBCAhAAEhoKDnVucGFj",
+ "a2VkX2Zsb2F0GGQgAygCQgIQABIbCg91bnBhY2tlZF9kb3VibGUYZSADKAFC",
+ "AhAAEhkKDXVucGFja2VkX2Jvb2wYZiADKAhCAhAAEjkKDXVucGFja2VkX2Vu",
+ "dW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUICEAAi",
+ "wAEKI1Rlc3RSZXBlYXRlZFNjYWxhckRpZmZlcmVudFRhZ1NpemVzEhgKEHJl",
+ "cGVhdGVkX2ZpeGVkMzIYDCADKAcSFgoOcmVwZWF0ZWRfaW50MzIYDSADKAUS",
+ "GQoQcmVwZWF0ZWRfZml4ZWQ2NBj+DyADKAYSFwoOcmVwZWF0ZWRfaW50NjQY",
+ "/w8gAygDEhgKDnJlcGVhdGVkX2Zsb2F0GP7/DyADKAISGQoPcmVwZWF0ZWRf",
+ "dWludDY0GP//DyADKAQiKAobVGVzdENvbW1lbnRJbmplY3Rpb25NZXNzYWdl",
+ "EgkKAWEYASABKAkiDAoKRm9vUmVxdWVzdCINCgtGb29SZXNwb25zZSISChBG",
+ "b29DbGllbnRNZXNzYWdlIhIKEEZvb1NlcnZlck1lc3NhZ2UiDAoKQmFyUmVx",
+ "dWVzdCINCgtCYXJSZXNwb25zZSpZCgtGb3JlaWduRW51bRIXChNGT1JFSUdO",
+ "X1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08QBBIPCgtGT1JFSUdOX0JB",
+ "UhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVudW1XaXRoRHVwVmFsdWUS",
+ "KAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VOU1BFQ0lGSUVEEAASCAoE",
+ "Rk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08yEAESCAoEQkFSMhAC",
+ "GgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVTVF9TUEFSU0VfRU5VTV9V",
+ "TlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoIU1BBUlNFX0IQpucDEg8K",
+ "CFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//////////ARIVCghTUEFS",
+ "U0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIymQEKC1Rlc3RTZXJ2aWNl",
+ "EkQKA0ZvbxIdLnByb3RvYnVmX3VuaXR0ZXN0LkZvb1JlcXVlc3QaHi5wcm90",
+ "b2J1Zl91bml0dGVzdC5Gb29SZXNwb25zZRJECgNCYXISHS5wcm90b2J1Zl91",
+ "bml0dGVzdC5CYXJSZXF1ZXN0Gh4ucHJvdG9idWZfdW5pdHRlc3QuQmFyUmVz",
+ "cG9uc2VCOkINVW5pdHRlc3RQcm90b0gBgAEBiAEBkAEB+AEBqgIaR29vZ2xl",
+ "LlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportProto3Reflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ForeignEnum), typeof(global::Google.Protobuf.TestProtos.TestEnumWithDupValue), typeof(global::Google.Protobuf.TestProtos.TestSparseEnum), }, new pbr::GeneratedClrTypeInfo[] {
@@ -189,8 +187,7 @@ namespace Google.Protobuf.TestProtos {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooClientMessage), global::Google.Protobuf.TestProtos.FooClientMessage.Parser, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooServerMessage), global::Google.Protobuf.TestProtos.FooServerMessage.Parser, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarRequest), global::Google.Protobuf.TestProtos.BarRequest.Parser, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarResponse), global::Google.Protobuf.TestProtos.BarResponse.Parser, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEmptyMessage), global::Google.Protobuf.TestProtos.TestEmptyMessage.Parser, null, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarResponse), global::Google.Protobuf.TestProtos.BarResponse.Parser, null, null, null, null)
}));
}
#endregion
@@ -242,7 +239,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes> {
private static readonly pb::MessageParser<TestAllTypes> _parser = new pb::MessageParser<TestAllTypes>(() => new TestAllTypes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestAllTypes> Parser { get { return _parser; } }
@@ -280,13 +276,13 @@ namespace Google.Protobuf.TestProtos {
singleBool_ = other.singleBool_;
singleString_ = other.singleString_;
singleBytes_ = other.singleBytes_;
- singleNestedMessage_ = other.singleNestedMessage_ != null ? other.singleNestedMessage_.Clone() : null;
- singleForeignMessage_ = other.singleForeignMessage_ != null ? other.singleForeignMessage_.Clone() : null;
- singleImportMessage_ = other.singleImportMessage_ != null ? other.singleImportMessage_.Clone() : null;
+ SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null;
+ SingleForeignMessage = other.singleForeignMessage_ != null ? other.SingleForeignMessage.Clone() : null;
+ SingleImportMessage = other.singleImportMessage_ != null ? other.SingleImportMessage.Clone() : null;
singleNestedEnum_ = other.singleNestedEnum_;
singleForeignEnum_ = other.singleForeignEnum_;
singleImportEnum_ = other.singleImportEnum_;
- singlePublicImportMessage_ = other.singlePublicImportMessage_ != null ? other.singlePublicImportMessage_.Clone() : null;
+ SinglePublicImportMessage = other.singlePublicImportMessage_ != null ? other.SinglePublicImportMessage.Clone() : null;
repeatedInt32_ = other.repeatedInt32_.Clone();
repeatedInt64_ = other.repeatedInt64_.Clone();
repeatedUint32_ = other.repeatedUint32_.Clone();
@@ -324,7 +320,6 @@ namespace Google.Protobuf.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -894,8 +889,8 @@ namespace Google.Protobuf.TestProtos {
if (SingleFixed64 != other.SingleFixed64) return false;
if (SingleSfixed32 != other.SingleSfixed32) return false;
if (SingleSfixed64 != other.SingleSfixed64) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(SingleFloat, other.SingleFloat)) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(SingleDouble, other.SingleDouble)) return false;
+ if (SingleFloat != other.SingleFloat) return false;
+ if (SingleDouble != other.SingleDouble) return false;
if (SingleBool != other.SingleBool) return false;
if (SingleString != other.SingleString) return false;
if (SingleBytes != other.SingleBytes) return false;
@@ -933,7 +928,7 @@ namespace Google.Protobuf.TestProtos {
if (OneofString != other.OneofString) return false;
if (OneofBytes != other.OneofBytes) return false;
if (OneofFieldCase != other.OneofFieldCase) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -949,8 +944,8 @@ namespace Google.Protobuf.TestProtos {
if (SingleFixed64 != 0UL) hash ^= SingleFixed64.GetHashCode();
if (SingleSfixed32 != 0) hash ^= SingleSfixed32.GetHashCode();
if (SingleSfixed64 != 0L) hash ^= SingleSfixed64.GetHashCode();
- if (SingleFloat != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(SingleFloat);
- if (SingleDouble != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SingleDouble);
+ if (SingleFloat != 0F) hash ^= SingleFloat.GetHashCode();
+ if (SingleDouble != 0D) hash ^= SingleDouble.GetHashCode();
if (SingleBool != false) hash ^= SingleBool.GetHashCode();
if (SingleString.Length != 0) hash ^= SingleString.GetHashCode();
if (SingleBytes.Length != 0) hash ^= SingleBytes.GetHashCode();
@@ -988,9 +983,6 @@ namespace Google.Protobuf.TestProtos {
if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) hash ^= OneofString.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) hash ^= OneofBytes.GetHashCode();
hash ^= (int) oneofFieldCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1127,9 +1119,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(146, 7);
output.WriteBytes(OneofBytes);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1235,9 +1224,6 @@ namespace Google.Protobuf.TestProtos {
if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) {
size += 2 + pb::CodedOutputStream.ComputeBytesSize(OneofBytes);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1351,10 +1337,7 @@ namespace Google.Protobuf.TestProtos {
OneofUint32 = other.OneofUint32;
break;
case OneofFieldOneofCase.OneofNestedMessage:
- if (OneofNestedMessage == null) {
- OneofNestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
- }
- OneofNestedMessage.MergeFrom(other.OneofNestedMessage);
+ OneofNestedMessage = other.OneofNestedMessage;
break;
case OneofFieldOneofCase.OneofString:
OneofString = other.OneofString;
@@ -1364,7 +1347,6 @@ namespace Google.Protobuf.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1373,7 +1355,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
SingleInt32 = input.ReadInt32();
@@ -1621,7 +1603,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class NestedMessage : pb::IMessage<NestedMessage> {
private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } }
@@ -1645,7 +1626,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public NestedMessage(NestedMessage other) : this() {
bb_ = other.bb_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1683,16 +1663,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Bb != other.Bb) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Bb != 0) hash ^= Bb.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1707,9 +1684,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(Bb);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1718,9 +1692,6 @@ namespace Google.Protobuf.TestProtos {
if (Bb != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Bb);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1732,7 +1703,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Bb != 0) {
Bb = other.Bb;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1741,7 +1711,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Bb = input.ReadInt32();
@@ -1763,7 +1733,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes> {
private static readonly pb::MessageParser<NestedTestAllTypes> _parser = new pb::MessageParser<NestedTestAllTypes>(() => new NestedTestAllTypes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NestedTestAllTypes> Parser { get { return _parser; } }
@@ -1786,10 +1755,9 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public NestedTestAllTypes(NestedTestAllTypes other) : this() {
- child_ = other.child_ != null ? other.child_.Clone() : null;
- payload_ = other.payload_ != null ? other.payload_.Clone() : null;
+ Child = other.child_ != null ? other.Child.Clone() : null;
+ Payload = other.payload_ != null ? other.Payload.Clone() : null;
repeatedChild_ = other.repeatedChild_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1845,7 +1813,7 @@ namespace Google.Protobuf.TestProtos {
if (!object.Equals(Child, other.Child)) return false;
if (!object.Equals(Payload, other.Payload)) return false;
if(!repeatedChild_.Equals(other.repeatedChild_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1854,9 +1822,6 @@ namespace Google.Protobuf.TestProtos {
if (child_ != null) hash ^= Child.GetHashCode();
if (payload_ != null) hash ^= Payload.GetHashCode();
hash ^= repeatedChild_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1876,9 +1841,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteMessage(Payload);
}
repeatedChild_.WriteTo(output, _repeated_repeatedChild_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1891,9 +1853,6 @@ namespace Google.Protobuf.TestProtos {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload);
}
size += repeatedChild_.CalculateSize(_repeated_repeatedChild_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1915,7 +1874,6 @@ namespace Google.Protobuf.TestProtos {
Payload.MergeFrom(other.Payload);
}
repeatedChild_.Add(other.repeatedChild_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1924,7 +1882,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
if (child_ == null) {
@@ -1952,7 +1910,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestDeprecatedFields : pb::IMessage<TestDeprecatedFields> {
private static readonly pb::MessageParser<TestDeprecatedFields> _parser = new pb::MessageParser<TestDeprecatedFields>(() => new TestDeprecatedFields());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestDeprecatedFields> Parser { get { return _parser; } }
@@ -1976,7 +1933,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestDeprecatedFields(TestDeprecatedFields other) : this() {
deprecatedInt32_ = other.deprecatedInt32_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2010,16 +1966,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (DeprecatedInt32 != other.DeprecatedInt32) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (DeprecatedInt32 != 0) hash ^= DeprecatedInt32.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2034,9 +1987,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(DeprecatedInt32);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2045,9 +1995,6 @@ namespace Google.Protobuf.TestProtos {
if (DeprecatedInt32 != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(DeprecatedInt32);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2059,7 +2006,6 @@ namespace Google.Protobuf.TestProtos {
if (other.DeprecatedInt32 != 0) {
DeprecatedInt32 = other.DeprecatedInt32;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2068,7 +2014,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
DeprecatedInt32 = input.ReadInt32();
@@ -2086,7 +2032,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage> {
private static readonly pb::MessageParser<ForeignMessage> _parser = new pb::MessageParser<ForeignMessage>(() => new ForeignMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ForeignMessage> Parser { get { return _parser; } }
@@ -2110,7 +2055,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ForeignMessage(ForeignMessage other) : this() {
c_ = other.c_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2143,16 +2087,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (C != other.C) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (C != 0) hash ^= C.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2167,9 +2108,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(C);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2178,9 +2116,6 @@ namespace Google.Protobuf.TestProtos {
if (C != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(C);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2192,7 +2127,6 @@ namespace Google.Protobuf.TestProtos {
if (other.C != 0) {
C = other.C;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2201,7 +2135,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
C = input.ReadInt32();
@@ -2215,7 +2149,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestReservedFields : pb::IMessage<TestReservedFields> {
private static readonly pb::MessageParser<TestReservedFields> _parser = new pb::MessageParser<TestReservedFields>(() => new TestReservedFields());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestReservedFields> Parser { get { return _parser; } }
@@ -2238,7 +2171,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestReservedFields(TestReservedFields other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2259,15 +2191,12 @@ namespace Google.Protobuf.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2278,17 +2207,11 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2297,7 +2220,6 @@ namespace Google.Protobuf.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2306,7 +2228,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -2319,7 +2241,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested> {
private static readonly pb::MessageParser<TestForeignNested> _parser = new pb::MessageParser<TestForeignNested>(() => new TestForeignNested());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestForeignNested> Parser { get { return _parser; } }
@@ -2342,8 +2263,7 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestForeignNested(TestForeignNested other) : this() {
- foreignNested_ = other.foreignNested_ != null ? other.foreignNested_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ ForeignNested = other.foreignNested_ != null ? other.ForeignNested.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2376,16 +2296,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (!object.Equals(ForeignNested, other.ForeignNested)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (foreignNested_ != null) hash ^= ForeignNested.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2400,9 +2317,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(10);
output.WriteMessage(ForeignNested);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2411,9 +2325,6 @@ namespace Google.Protobuf.TestProtos {
if (foreignNested_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ForeignNested);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2428,7 +2339,6 @@ namespace Google.Protobuf.TestProtos {
}
ForeignNested.MergeFrom(other.ForeignNested);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2437,7 +2347,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
if (foreignNested_ == null) {
@@ -2457,7 +2367,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber> {
private static readonly pb::MessageParser<TestReallyLargeTagNumber> _parser = new pb::MessageParser<TestReallyLargeTagNumber>(() => new TestReallyLargeTagNumber());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestReallyLargeTagNumber> Parser { get { return _parser; } }
@@ -2482,7 +2391,6 @@ namespace Google.Protobuf.TestProtos {
public TestReallyLargeTagNumber(TestReallyLargeTagNumber other) : this() {
a_ = other.a_;
bb_ = other.bb_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2531,7 +2439,7 @@ namespace Google.Protobuf.TestProtos {
}
if (A != other.A) return false;
if (Bb != other.Bb) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2539,9 +2447,6 @@ namespace Google.Protobuf.TestProtos {
int hash = 1;
if (A != 0) hash ^= A.GetHashCode();
if (Bb != 0) hash ^= Bb.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2560,9 +2465,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(248, 255, 255, 255, 7);
output.WriteInt32(Bb);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2574,9 +2476,6 @@ namespace Google.Protobuf.TestProtos {
if (Bb != 0) {
size += 5 + pb::CodedOutputStream.ComputeInt32Size(Bb);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2591,7 +2490,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Bb != 0) {
Bb = other.Bb;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2600,7 +2498,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
A = input.ReadInt32();
@@ -2618,7 +2516,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestRecursiveMessage : pb::IMessage<TestRecursiveMessage> {
private static readonly pb::MessageParser<TestRecursiveMessage> _parser = new pb::MessageParser<TestRecursiveMessage>(() => new TestRecursiveMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestRecursiveMessage> Parser { get { return _parser; } }
@@ -2641,9 +2538,8 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestRecursiveMessage(TestRecursiveMessage other) : this() {
- a_ = other.a_ != null ? other.a_.Clone() : null;
+ A = other.a_ != null ? other.A.Clone() : null;
i_ = other.i_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2688,7 +2584,7 @@ namespace Google.Protobuf.TestProtos {
}
if (!object.Equals(A, other.A)) return false;
if (I != other.I) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2696,9 +2592,6 @@ namespace Google.Protobuf.TestProtos {
int hash = 1;
if (a_ != null) hash ^= A.GetHashCode();
if (I != 0) hash ^= I.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2717,9 +2610,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(16);
output.WriteInt32(I);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2731,9 +2621,6 @@ namespace Google.Protobuf.TestProtos {
if (I != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(I);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2751,7 +2638,6 @@ namespace Google.Protobuf.TestProtos {
if (other.I != 0) {
I = other.I;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2760,7 +2646,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
if (a_ == null) {
@@ -2784,7 +2670,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA> {
private static readonly pb::MessageParser<TestMutualRecursionA> _parser = new pb::MessageParser<TestMutualRecursionA>(() => new TestMutualRecursionA());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestMutualRecursionA> Parser { get { return _parser; } }
@@ -2807,8 +2692,7 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestMutualRecursionA(TestMutualRecursionA other) : this() {
- bb_ = other.bb_ != null ? other.bb_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Bb = other.bb_ != null ? other.Bb.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2841,16 +2725,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (!object.Equals(Bb, other.Bb)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (bb_ != null) hash ^= Bb.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2865,9 +2746,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(10);
output.WriteMessage(Bb);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2876,9 +2754,6 @@ namespace Google.Protobuf.TestProtos {
if (bb_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bb);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2893,7 +2768,6 @@ namespace Google.Protobuf.TestProtos {
}
Bb.MergeFrom(other.Bb);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2902,7 +2776,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
if (bb_ == null) {
@@ -2919,7 +2793,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestMutualRecursionB : pb::IMessage<TestMutualRecursionB> {
private static readonly pb::MessageParser<TestMutualRecursionB> _parser = new pb::MessageParser<TestMutualRecursionB>(() => new TestMutualRecursionB());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestMutualRecursionB> Parser { get { return _parser; } }
@@ -2942,9 +2815,8 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestMutualRecursionB(TestMutualRecursionB other) : this() {
- a_ = other.a_ != null ? other.a_.Clone() : null;
+ A = other.a_ != null ? other.A.Clone() : null;
optionalInt32_ = other.optionalInt32_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2989,7 +2861,7 @@ namespace Google.Protobuf.TestProtos {
}
if (!object.Equals(A, other.A)) return false;
if (OptionalInt32 != other.OptionalInt32) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2997,9 +2869,6 @@ namespace Google.Protobuf.TestProtos {
int hash = 1;
if (a_ != null) hash ^= A.GetHashCode();
if (OptionalInt32 != 0) hash ^= OptionalInt32.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3018,9 +2887,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(16);
output.WriteInt32(OptionalInt32);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3032,9 +2898,6 @@ namespace Google.Protobuf.TestProtos {
if (OptionalInt32 != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(OptionalInt32);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3052,7 +2915,6 @@ namespace Google.Protobuf.TestProtos {
if (other.OptionalInt32 != 0) {
OptionalInt32 = other.OptionalInt32;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3061,7 +2923,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
if (a_ == null) {
@@ -3082,7 +2944,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestEnumAllowAlias : pb::IMessage<TestEnumAllowAlias> {
private static readonly pb::MessageParser<TestEnumAllowAlias> _parser = new pb::MessageParser<TestEnumAllowAlias>(() => new TestEnumAllowAlias());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestEnumAllowAlias> Parser { get { return _parser; } }
@@ -3106,7 +2967,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestEnumAllowAlias(TestEnumAllowAlias other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3139,16 +2999,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Value != 0) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3163,9 +3020,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteEnum((int) Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3174,9 +3028,6 @@ namespace Google.Protobuf.TestProtos {
if (Value != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3188,7 +3039,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Value != 0) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3197,7 +3047,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
value_ = (global::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum();
@@ -3215,7 +3065,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames> {
private static readonly pb::MessageParser<TestCamelCaseFieldNames> _parser = new pb::MessageParser<TestCamelCaseFieldNames>(() => new TestCamelCaseFieldNames());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestCamelCaseFieldNames> Parser { get { return _parser; } }
@@ -3241,12 +3090,11 @@ namespace Google.Protobuf.TestProtos {
primitiveField_ = other.primitiveField_;
stringField_ = other.stringField_;
enumField_ = other.enumField_;
- messageField_ = other.messageField_ != null ? other.messageField_.Clone() : null;
+ MessageField = other.messageField_ != null ? other.MessageField.Clone() : null;
repeatedPrimitiveField_ = other.repeatedPrimitiveField_.Clone();
repeatedStringField_ = other.repeatedStringField_.Clone();
repeatedEnumField_ = other.repeatedEnumField_.Clone();
repeatedMessageField_ = other.repeatedMessageField_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3359,7 +3207,7 @@ namespace Google.Protobuf.TestProtos {
if(!repeatedStringField_.Equals(other.repeatedStringField_)) return false;
if(!repeatedEnumField_.Equals(other.repeatedEnumField_)) return false;
if(!repeatedMessageField_.Equals(other.repeatedMessageField_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3373,9 +3221,6 @@ namespace Google.Protobuf.TestProtos {
hash ^= repeatedStringField_.GetHashCode();
hash ^= repeatedEnumField_.GetHashCode();
hash ^= repeatedMessageField_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3406,9 +3251,6 @@ namespace Google.Protobuf.TestProtos {
repeatedStringField_.WriteTo(output, _repeated_repeatedStringField_codec);
repeatedEnumField_.WriteTo(output, _repeated_repeatedEnumField_codec);
repeatedMessageField_.WriteTo(output, _repeated_repeatedMessageField_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3430,9 +3272,6 @@ namespace Google.Protobuf.TestProtos {
size += repeatedStringField_.CalculateSize(_repeated_repeatedStringField_codec);
size += repeatedEnumField_.CalculateSize(_repeated_repeatedEnumField_codec);
size += repeatedMessageField_.CalculateSize(_repeated_repeatedMessageField_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3460,7 +3299,6 @@ namespace Google.Protobuf.TestProtos {
repeatedStringField_.Add(other.repeatedStringField_);
repeatedEnumField_.Add(other.repeatedEnumField_);
repeatedMessageField_.Add(other.repeatedMessageField_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3469,7 +3307,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
PrimitiveField = input.ReadInt32();
@@ -3520,7 +3358,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestFieldOrderings : pb::IMessage<TestFieldOrderings> {
private static readonly pb::MessageParser<TestFieldOrderings> _parser = new pb::MessageParser<TestFieldOrderings>(() => new TestFieldOrderings());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestFieldOrderings> Parser { get { return _parser; } }
@@ -3546,8 +3383,7 @@ namespace Google.Protobuf.TestProtos {
myString_ = other.myString_;
myInt_ = other.myInt_;
myFloat_ = other.myFloat_;
- singleNestedMessage_ = other.singleNestedMessage_ != null ? other.singleNestedMessage_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3614,9 +3450,9 @@ namespace Google.Protobuf.TestProtos {
}
if (MyString != other.MyString) return false;
if (MyInt != other.MyInt) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(MyFloat, other.MyFloat)) return false;
+ if (MyFloat != other.MyFloat) return false;
if (!object.Equals(SingleNestedMessage, other.SingleNestedMessage)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3624,11 +3460,8 @@ namespace Google.Protobuf.TestProtos {
int hash = 1;
if (MyString.Length != 0) hash ^= MyString.GetHashCode();
if (MyInt != 0L) hash ^= MyInt.GetHashCode();
- if (MyFloat != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(MyFloat);
+ if (MyFloat != 0F) hash ^= MyFloat.GetHashCode();
if (singleNestedMessage_ != null) hash ^= SingleNestedMessage.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3655,9 +3488,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(194, 12);
output.WriteMessage(SingleNestedMessage);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3675,9 +3505,6 @@ namespace Google.Protobuf.TestProtos {
if (singleNestedMessage_ != null) {
size += 2 + pb::CodedOutputStream.ComputeMessageSize(SingleNestedMessage);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3701,7 +3528,6 @@ namespace Google.Protobuf.TestProtos {
}
SingleNestedMessage.MergeFrom(other.SingleNestedMessage);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3710,7 +3536,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
MyInt = input.ReadInt64();
@@ -3741,7 +3567,6 @@ namespace Google.Protobuf.TestProtos {
public static partial class Types {
public sealed partial class NestedMessage : pb::IMessage<NestedMessage> {
private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } }
@@ -3766,7 +3591,6 @@ namespace Google.Protobuf.TestProtos {
public NestedMessage(NestedMessage other) : this() {
oo_ = other.oo_;
bb_ = other.bb_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3816,7 +3640,7 @@ namespace Google.Protobuf.TestProtos {
}
if (Oo != other.Oo) return false;
if (Bb != other.Bb) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3824,9 +3648,6 @@ namespace Google.Protobuf.TestProtos {
int hash = 1;
if (Oo != 0L) hash ^= Oo.GetHashCode();
if (Bb != 0) hash ^= Bb.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3845,9 +3666,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(16);
output.WriteInt64(Oo);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3859,9 +3677,6 @@ namespace Google.Protobuf.TestProtos {
if (Bb != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Bb);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3876,7 +3691,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Bb != 0) {
Bb = other.Bb;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3885,7 +3699,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Bb = input.ReadInt32();
@@ -3908,7 +3722,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class SparseEnumMessage : pb::IMessage<SparseEnumMessage> {
private static readonly pb::MessageParser<SparseEnumMessage> _parser = new pb::MessageParser<SparseEnumMessage>(() => new SparseEnumMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<SparseEnumMessage> Parser { get { return _parser; } }
@@ -3932,7 +3745,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public SparseEnumMessage(SparseEnumMessage other) : this() {
sparseEnum_ = other.sparseEnum_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3965,16 +3777,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (SparseEnum != other.SparseEnum) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (SparseEnum != 0) hash ^= SparseEnum.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3989,9 +3798,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteEnum((int) SparseEnum);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4000,9 +3806,6 @@ namespace Google.Protobuf.TestProtos {
if (SparseEnum != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) SparseEnum);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4014,7 +3817,6 @@ namespace Google.Protobuf.TestProtos {
if (other.SparseEnum != 0) {
SparseEnum = other.SparseEnum;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4023,7 +3825,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
sparseEnum_ = (global::Google.Protobuf.TestProtos.TestSparseEnum) input.ReadEnum();
@@ -4040,7 +3842,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class OneString : pb::IMessage<OneString> {
private static readonly pb::MessageParser<OneString> _parser = new pb::MessageParser<OneString>(() => new OneString());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<OneString> Parser { get { return _parser; } }
@@ -4064,7 +3865,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public OneString(OneString other) : this() {
data_ = other.data_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4097,16 +3897,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Data != other.Data) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Data.Length != 0) hash ^= Data.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4121,9 +3918,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(10);
output.WriteString(Data);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4132,9 +3926,6 @@ namespace Google.Protobuf.TestProtos {
if (Data.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Data);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4146,7 +3937,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Data.Length != 0) {
Data = other.Data;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4155,7 +3945,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Data = input.ReadString();
@@ -4169,7 +3959,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class MoreString : pb::IMessage<MoreString> {
private static readonly pb::MessageParser<MoreString> _parser = new pb::MessageParser<MoreString>(() => new MoreString());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<MoreString> Parser { get { return _parser; } }
@@ -4193,7 +3982,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public MoreString(MoreString other) : this() {
data_ = other.data_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4225,16 +4013,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if(!data_.Equals(other.data_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= data_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4246,18 +4031,12 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
data_.WriteTo(output, _repeated_data_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += data_.CalculateSize(_repeated_data_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4267,7 +4046,6 @@ namespace Google.Protobuf.TestProtos {
return;
}
data_.Add(other.data_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4276,7 +4054,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
data_.AddEntriesFrom(input, _repeated_data_codec);
@@ -4290,7 +4068,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class OneBytes : pb::IMessage<OneBytes> {
private static readonly pb::MessageParser<OneBytes> _parser = new pb::MessageParser<OneBytes>(() => new OneBytes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<OneBytes> Parser { get { return _parser; } }
@@ -4314,7 +4091,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public OneBytes(OneBytes other) : this() {
data_ = other.data_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4347,16 +4123,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Data != other.Data) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Data.Length != 0) hash ^= Data.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4371,9 +4144,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(10);
output.WriteBytes(Data);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4382,9 +4152,6 @@ namespace Google.Protobuf.TestProtos {
if (Data.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4396,7 +4163,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Data.Length != 0) {
Data = other.Data;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4405,7 +4171,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Data = input.ReadBytes();
@@ -4419,7 +4185,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class MoreBytes : pb::IMessage<MoreBytes> {
private static readonly pb::MessageParser<MoreBytes> _parser = new pb::MessageParser<MoreBytes>(() => new MoreBytes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<MoreBytes> Parser { get { return _parser; } }
@@ -4443,7 +4208,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public MoreBytes(MoreBytes other) : this() {
data_ = other.data_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4476,16 +4240,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Data != other.Data) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Data.Length != 0) hash ^= Data.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4500,9 +4261,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(10);
output.WriteBytes(Data);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4511,9 +4269,6 @@ namespace Google.Protobuf.TestProtos {
if (Data.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4525,7 +4280,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Data.Length != 0) {
Data = other.Data;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4534,7 +4288,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Data = input.ReadBytes();
@@ -4551,7 +4305,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class Int32Message : pb::IMessage<Int32Message> {
private static readonly pb::MessageParser<Int32Message> _parser = new pb::MessageParser<Int32Message>(() => new Int32Message());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Int32Message> Parser { get { return _parser; } }
@@ -4575,7 +4328,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Int32Message(Int32Message other) : this() {
data_ = other.data_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4608,16 +4360,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Data != other.Data) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Data != 0) hash ^= Data.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4632,9 +4381,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteInt32(Data);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4643,9 +4389,6 @@ namespace Google.Protobuf.TestProtos {
if (Data != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Data);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4657,7 +4400,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Data != 0) {
Data = other.Data;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4666,7 +4408,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Data = input.ReadInt32();
@@ -4680,7 +4422,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class Uint32Message : pb::IMessage<Uint32Message> {
private static readonly pb::MessageParser<Uint32Message> _parser = new pb::MessageParser<Uint32Message>(() => new Uint32Message());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Uint32Message> Parser { get { return _parser; } }
@@ -4704,7 +4445,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Uint32Message(Uint32Message other) : this() {
data_ = other.data_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4737,16 +4477,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Data != other.Data) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Data != 0) hash ^= Data.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4761,9 +4498,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteUInt32(Data);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4772,9 +4506,6 @@ namespace Google.Protobuf.TestProtos {
if (Data != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Data);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4786,7 +4517,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Data != 0) {
Data = other.Data;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4795,7 +4525,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Data = input.ReadUInt32();
@@ -4809,7 +4539,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class Int64Message : pb::IMessage<Int64Message> {
private static readonly pb::MessageParser<Int64Message> _parser = new pb::MessageParser<Int64Message>(() => new Int64Message());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Int64Message> Parser { get { return _parser; } }
@@ -4833,7 +4562,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Int64Message(Int64Message other) : this() {
data_ = other.data_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4866,16 +4594,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Data != other.Data) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Data != 0L) hash ^= Data.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4890,9 +4615,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteInt64(Data);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4901,9 +4623,6 @@ namespace Google.Protobuf.TestProtos {
if (Data != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Data);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4915,7 +4634,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Data != 0L) {
Data = other.Data;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4924,7 +4642,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Data = input.ReadInt64();
@@ -4938,7 +4656,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class Uint64Message : pb::IMessage<Uint64Message> {
private static readonly pb::MessageParser<Uint64Message> _parser = new pb::MessageParser<Uint64Message>(() => new Uint64Message());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Uint64Message> Parser { get { return _parser; } }
@@ -4962,7 +4679,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Uint64Message(Uint64Message other) : this() {
data_ = other.data_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4995,16 +4711,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Data != other.Data) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Data != 0UL) hash ^= Data.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5019,9 +4732,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteUInt64(Data);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5030,9 +4740,6 @@ namespace Google.Protobuf.TestProtos {
if (Data != 0UL) {
size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Data);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5044,7 +4751,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Data != 0UL) {
Data = other.Data;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5053,7 +4759,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Data = input.ReadUInt64();
@@ -5067,7 +4773,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class BoolMessage : pb::IMessage<BoolMessage> {
private static readonly pb::MessageParser<BoolMessage> _parser = new pb::MessageParser<BoolMessage>(() => new BoolMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<BoolMessage> Parser { get { return _parser; } }
@@ -5091,7 +4796,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public BoolMessage(BoolMessage other) : this() {
data_ = other.data_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5124,16 +4828,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (Data != other.Data) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Data != false) hash ^= Data.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5148,9 +4849,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(8);
output.WriteBool(Data);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5159,9 +4857,6 @@ namespace Google.Protobuf.TestProtos {
if (Data != false) {
size += 1 + 1;
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5173,7 +4868,6 @@ namespace Google.Protobuf.TestProtos {
if (other.Data != false) {
Data = other.Data;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5182,7 +4876,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Data = input.ReadBool();
@@ -5199,7 +4893,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestOneof : pb::IMessage<TestOneof> {
private static readonly pb::MessageParser<TestOneof> _parser = new pb::MessageParser<TestOneof>(() => new TestOneof());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestOneof> Parser { get { return _parser; } }
@@ -5234,7 +4927,6 @@ namespace Google.Protobuf.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5312,7 +5004,7 @@ namespace Google.Protobuf.TestProtos {
if (FooString != other.FooString) return false;
if (!object.Equals(FooMessage, other.FooMessage)) return false;
if (FooCase != other.FooCase) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5322,9 +5014,6 @@ namespace Google.Protobuf.TestProtos {
if (fooCase_ == FooOneofCase.FooString) hash ^= FooString.GetHashCode();
if (fooCase_ == FooOneofCase.FooMessage) hash ^= FooMessage.GetHashCode();
hash ^= (int) fooCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5347,9 +5036,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(26);
output.WriteMessage(FooMessage);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5364,9 +5050,6 @@ namespace Google.Protobuf.TestProtos {
if (fooCase_ == FooOneofCase.FooMessage) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(FooMessage);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5383,14 +5066,10 @@ namespace Google.Protobuf.TestProtos {
FooString = other.FooString;
break;
case FooOneofCase.FooMessage:
- if (FooMessage == null) {
- FooMessage = new global::Google.Protobuf.TestProtos.TestAllTypes();
- }
- FooMessage.MergeFrom(other.FooMessage);
+ FooMessage = other.FooMessage;
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5399,7 +5078,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
FooInt = input.ReadInt32();
@@ -5426,7 +5105,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestPackedTypes : pb::IMessage<TestPackedTypes> {
private static readonly pb::MessageParser<TestPackedTypes> _parser = new pb::MessageParser<TestPackedTypes>(() => new TestPackedTypes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestPackedTypes> Parser { get { return _parser; } }
@@ -5463,7 +5141,6 @@ namespace Google.Protobuf.TestProtos {
packedDouble_ = other.packedDouble_.Clone();
packedBool_ = other.packedBool_.Clone();
packedEnum_ = other.packedEnum_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5638,7 +5315,7 @@ namespace Google.Protobuf.TestProtos {
if(!packedDouble_.Equals(other.packedDouble_)) return false;
if(!packedBool_.Equals(other.packedBool_)) return false;
if(!packedEnum_.Equals(other.packedEnum_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5658,9 +5335,6 @@ namespace Google.Protobuf.TestProtos {
hash ^= packedDouble_.GetHashCode();
hash ^= packedBool_.GetHashCode();
hash ^= packedEnum_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5685,9 +5359,6 @@ namespace Google.Protobuf.TestProtos {
packedDouble_.WriteTo(output, _repeated_packedDouble_codec);
packedBool_.WriteTo(output, _repeated_packedBool_codec);
packedEnum_.WriteTo(output, _repeated_packedEnum_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5707,9 +5378,6 @@ namespace Google.Protobuf.TestProtos {
size += packedDouble_.CalculateSize(_repeated_packedDouble_codec);
size += packedBool_.CalculateSize(_repeated_packedBool_codec);
size += packedEnum_.CalculateSize(_repeated_packedEnum_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5732,7 +5400,6 @@ namespace Google.Protobuf.TestProtos {
packedDouble_.Add(other.packedDouble_);
packedBool_.Add(other.packedBool_);
packedEnum_.Add(other.packedEnum_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5741,7 +5408,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 722:
case 720: {
@@ -5825,7 +5492,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes> {
private static readonly pb::MessageParser<TestUnpackedTypes> _parser = new pb::MessageParser<TestUnpackedTypes>(() => new TestUnpackedTypes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestUnpackedTypes> Parser { get { return _parser; } }
@@ -5862,7 +5528,6 @@ namespace Google.Protobuf.TestProtos {
unpackedDouble_ = other.unpackedDouble_.Clone();
unpackedBool_ = other.unpackedBool_.Clone();
unpackedEnum_ = other.unpackedEnum_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6037,7 +5702,7 @@ namespace Google.Protobuf.TestProtos {
if(!unpackedDouble_.Equals(other.unpackedDouble_)) return false;
if(!unpackedBool_.Equals(other.unpackedBool_)) return false;
if(!unpackedEnum_.Equals(other.unpackedEnum_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6057,9 +5722,6 @@ namespace Google.Protobuf.TestProtos {
hash ^= unpackedDouble_.GetHashCode();
hash ^= unpackedBool_.GetHashCode();
hash ^= unpackedEnum_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6084,9 +5746,6 @@ namespace Google.Protobuf.TestProtos {
unpackedDouble_.WriteTo(output, _repeated_unpackedDouble_codec);
unpackedBool_.WriteTo(output, _repeated_unpackedBool_codec);
unpackedEnum_.WriteTo(output, _repeated_unpackedEnum_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6106,9 +5765,6 @@ namespace Google.Protobuf.TestProtos {
size += unpackedDouble_.CalculateSize(_repeated_unpackedDouble_codec);
size += unpackedBool_.CalculateSize(_repeated_unpackedBool_codec);
size += unpackedEnum_.CalculateSize(_repeated_unpackedEnum_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6131,7 +5787,6 @@ namespace Google.Protobuf.TestProtos {
unpackedDouble_.Add(other.unpackedDouble_);
unpackedBool_.Add(other.unpackedBool_);
unpackedEnum_.Add(other.unpackedEnum_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6140,7 +5795,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 722:
case 720: {
@@ -6220,7 +5875,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage<TestRepeatedScalarDifferentTagSizes> {
private static readonly pb::MessageParser<TestRepeatedScalarDifferentTagSizes> _parser = new pb::MessageParser<TestRepeatedScalarDifferentTagSizes>(() => new TestRepeatedScalarDifferentTagSizes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestRepeatedScalarDifferentTagSizes> Parser { get { return _parser; } }
@@ -6249,7 +5903,6 @@ namespace Google.Protobuf.TestProtos {
repeatedInt64_ = other.repeatedInt64_.Clone();
repeatedFloat_ = other.repeatedFloat_.Clone();
repeatedUint64_ = other.repeatedUint64_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6350,7 +6003,7 @@ namespace Google.Protobuf.TestProtos {
if(!repeatedInt64_.Equals(other.repeatedInt64_)) return false;
if(!repeatedFloat_.Equals(other.repeatedFloat_)) return false;
if(!repeatedUint64_.Equals(other.repeatedUint64_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6362,9 +6015,6 @@ namespace Google.Protobuf.TestProtos {
hash ^= repeatedInt64_.GetHashCode();
hash ^= repeatedFloat_.GetHashCode();
hash ^= repeatedUint64_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6381,9 +6031,6 @@ namespace Google.Protobuf.TestProtos {
repeatedInt64_.WriteTo(output, _repeated_repeatedInt64_codec);
repeatedFloat_.WriteTo(output, _repeated_repeatedFloat_codec);
repeatedUint64_.WriteTo(output, _repeated_repeatedUint64_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6395,9 +6042,6 @@ namespace Google.Protobuf.TestProtos {
size += repeatedInt64_.CalculateSize(_repeated_repeatedInt64_codec);
size += repeatedFloat_.CalculateSize(_repeated_repeatedFloat_codec);
size += repeatedUint64_.CalculateSize(_repeated_repeatedUint64_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6412,7 +6056,6 @@ namespace Google.Protobuf.TestProtos {
repeatedInt64_.Add(other.repeatedInt64_);
repeatedFloat_.Add(other.repeatedFloat_);
repeatedUint64_.Add(other.repeatedUint64_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6421,7 +6064,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 98:
case 101: {
@@ -6461,7 +6104,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class TestCommentInjectionMessage : pb::IMessage<TestCommentInjectionMessage> {
private static readonly pb::MessageParser<TestCommentInjectionMessage> _parser = new pb::MessageParser<TestCommentInjectionMessage>(() => new TestCommentInjectionMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestCommentInjectionMessage> Parser { get { return _parser; } }
@@ -6485,7 +6127,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestCommentInjectionMessage(TestCommentInjectionMessage other) : this() {
a_ = other.a_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6521,16 +6162,13 @@ namespace Google.Protobuf.TestProtos {
return true;
}
if (A != other.A) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (A.Length != 0) hash ^= A.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6545,9 +6183,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(10);
output.WriteString(A);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6556,9 +6191,6 @@ namespace Google.Protobuf.TestProtos {
if (A.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(A);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6570,7 +6202,6 @@ namespace Google.Protobuf.TestProtos {
if (other.A.Length != 0) {
A = other.A;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6579,7 +6210,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
A = input.ReadString();
@@ -6596,7 +6227,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class FooRequest : pb::IMessage<FooRequest> {
private static readonly pb::MessageParser<FooRequest> _parser = new pb::MessageParser<FooRequest>(() => new FooRequest());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FooRequest> Parser { get { return _parser; } }
@@ -6619,7 +6249,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FooRequest(FooRequest other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6640,15 +6269,12 @@ namespace Google.Protobuf.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6659,17 +6285,11 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6678,7 +6298,6 @@ namespace Google.Protobuf.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6687,7 +6306,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -6697,7 +6316,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class FooResponse : pb::IMessage<FooResponse> {
private static readonly pb::MessageParser<FooResponse> _parser = new pb::MessageParser<FooResponse>(() => new FooResponse());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FooResponse> Parser { get { return _parser; } }
@@ -6720,7 +6338,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FooResponse(FooResponse other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6741,15 +6358,12 @@ namespace Google.Protobuf.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6760,17 +6374,11 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6779,7 +6387,6 @@ namespace Google.Protobuf.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6788,7 +6395,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -6798,7 +6405,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class FooClientMessage : pb::IMessage<FooClientMessage> {
private static readonly pb::MessageParser<FooClientMessage> _parser = new pb::MessageParser<FooClientMessage>(() => new FooClientMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FooClientMessage> Parser { get { return _parser; } }
@@ -6821,7 +6427,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FooClientMessage(FooClientMessage other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6842,15 +6447,12 @@ namespace Google.Protobuf.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6861,17 +6463,11 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6880,7 +6476,6 @@ namespace Google.Protobuf.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6889,7 +6484,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -6899,7 +6494,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class FooServerMessage : pb::IMessage<FooServerMessage> {
private static readonly pb::MessageParser<FooServerMessage> _parser = new pb::MessageParser<FooServerMessage>(() => new FooServerMessage());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FooServerMessage> Parser { get { return _parser; } }
@@ -6922,7 +6516,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FooServerMessage(FooServerMessage other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6943,15 +6536,12 @@ namespace Google.Protobuf.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6962,17 +6552,11 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6981,7 +6565,6 @@ namespace Google.Protobuf.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6990,7 +6573,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -7000,7 +6583,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class BarRequest : pb::IMessage<BarRequest> {
private static readonly pb::MessageParser<BarRequest> _parser = new pb::MessageParser<BarRequest>(() => new BarRequest());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<BarRequest> Parser { get { return _parser; } }
@@ -7023,7 +6605,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public BarRequest(BarRequest other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7044,15 +6625,12 @@ namespace Google.Protobuf.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -7063,17 +6641,11 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -7082,7 +6654,6 @@ namespace Google.Protobuf.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7091,7 +6662,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
@@ -7101,7 +6672,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class BarResponse : pb::IMessage<BarResponse> {
private static readonly pb::MessageParser<BarResponse> _parser = new pb::MessageParser<BarResponse>(() => new BarResponse());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<BarResponse> Parser { get { return _parser; } }
@@ -7124,7 +6694,6 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public BarResponse(BarResponse other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7145,15 +6714,12 @@ namespace Google.Protobuf.TestProtos {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -7164,17 +6730,11 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -7183,108 +6743,6 @@ namespace Google.Protobuf.TestProtos {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- }
- }
- }
-
- }
-
- public sealed partial class TestEmptyMessage : pb::IMessage<TestEmptyMessage> {
- private static readonly pb::MessageParser<TestEmptyMessage> _parser = new pb::MessageParser<TestEmptyMessage>(() => new TestEmptyMessage());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser<TestEmptyMessage> Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[34]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public TestEmptyMessage() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public TestEmptyMessage(TestEmptyMessage other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public TestEmptyMessage Clone() {
- return new TestEmptyMessage(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as TestEmptyMessage);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(TestEmptyMessage other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(TestEmptyMessage other) {
- if (other == null) {
- return;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7293,7 +6751,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
index fe913802f7..2c7f0e0e1e 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/unittest_well_known_types.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/unittest_well_known_types.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -181,7 +179,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class TestWellKnownTypes : pb::IMessage<TestWellKnownTypes> {
private static readonly pb::MessageParser<TestWellKnownTypes> _parser = new pb::MessageParser<TestWellKnownTypes>(() => new TestWellKnownTypes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<TestWellKnownTypes> Parser { get { return _parser; } }
@@ -204,15 +201,15 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestWellKnownTypes(TestWellKnownTypes other) : this() {
- anyField_ = other.anyField_ != null ? other.anyField_.Clone() : null;
- apiField_ = other.apiField_ != null ? other.apiField_.Clone() : null;
- durationField_ = other.durationField_ != null ? other.durationField_.Clone() : null;
- emptyField_ = other.emptyField_ != null ? other.emptyField_.Clone() : null;
- fieldMaskField_ = other.fieldMaskField_ != null ? other.fieldMaskField_.Clone() : null;
- sourceContextField_ = other.sourceContextField_ != null ? other.sourceContextField_.Clone() : null;
- structField_ = other.structField_ != null ? other.structField_.Clone() : null;
- timestampField_ = other.timestampField_ != null ? other.timestampField_.Clone() : null;
- typeField_ = other.typeField_ != null ? other.typeField_.Clone() : null;
+ AnyField = other.anyField_ != null ? other.AnyField.Clone() : null;
+ ApiField = other.apiField_ != null ? other.ApiField.Clone() : null;
+ DurationField = other.durationField_ != null ? other.DurationField.Clone() : null;
+ EmptyField = other.emptyField_ != null ? other.EmptyField.Clone() : null;
+ FieldMaskField = other.fieldMaskField_ != null ? other.FieldMaskField.Clone() : null;
+ SourceContextField = other.sourceContextField_ != null ? other.SourceContextField.Clone() : null;
+ StructField = other.structField_ != null ? other.StructField.Clone() : null;
+ TimestampField = other.timestampField_ != null ? other.TimestampField.Clone() : null;
+ TypeField = other.typeField_ != null ? other.TypeField.Clone() : null;
DoubleField = other.DoubleField;
FloatField = other.FloatField;
Int64Field = other.Int64Field;
@@ -222,8 +219,7 @@ namespace Google.Protobuf.TestProtos {
BoolField = other.BoolField;
StringField = other.StringField;
BytesField = other.BytesField;
- valueField_ = other.valueField_ != null ? other.valueField_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ ValueField = other.valueField_ != null ? other.ValueField.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -474,8 +470,8 @@ namespace Google.Protobuf.TestProtos {
if (!object.Equals(StructField, other.StructField)) return false;
if (!object.Equals(TimestampField, other.TimestampField)) return false;
if (!object.Equals(TypeField, other.TypeField)) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.Equals(DoubleField, other.DoubleField)) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals(FloatField, other.FloatField)) return false;
+ if (DoubleField != other.DoubleField) return false;
+ if (FloatField != other.FloatField) return false;
if (Int64Field != other.Int64Field) return false;
if (Uint64Field != other.Uint64Field) return false;
if (Int32Field != other.Int32Field) return false;
@@ -484,7 +480,7 @@ namespace Google.Protobuf.TestProtos {
if (StringField != other.StringField) return false;
if (BytesField != other.BytesField) return false;
if (!object.Equals(ValueField, other.ValueField)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -499,8 +495,8 @@ namespace Google.Protobuf.TestProtos {
if (structField_ != null) hash ^= StructField.GetHashCode();
if (timestampField_ != null) hash ^= TimestampField.GetHashCode();
if (typeField_ != null) hash ^= TypeField.GetHashCode();
- if (doubleField_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode(DoubleField);
- if (floatField_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode(FloatField);
+ if (doubleField_ != null) hash ^= DoubleField.GetHashCode();
+ if (floatField_ != null) hash ^= FloatField.GetHashCode();
if (int64Field_ != null) hash ^= Int64Field.GetHashCode();
if (uint64Field_ != null) hash ^= Uint64Field.GetHashCode();
if (int32Field_ != null) hash ^= Int32Field.GetHashCode();
@@ -509,9 +505,6 @@ namespace Google.Protobuf.TestProtos {
if (stringField_ != null) hash ^= StringField.GetHashCode();
if (bytesField_ != null) hash ^= BytesField.GetHashCode();
if (valueField_ != null) hash ^= ValueField.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -589,9 +582,6 @@ namespace Google.Protobuf.TestProtos {
output.WriteRawTag(154, 1);
output.WriteMessage(ValueField);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -654,9 +644,6 @@ namespace Google.Protobuf.TestProtos {
if (valueField_ != null) {
size += 2 + pb::CodedOutputStream.ComputeMessageSize(ValueField);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -770,7 +757,6 @@ namespace Google.Protobuf.TestProtos {
}
ValueField.MergeFrom(other.ValueField);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -779,7 +765,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
if (anyField_ == null) {
@@ -925,7 +911,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class RepeatedWellKnownTypes : pb::IMessage<RepeatedWellKnownTypes> {
private static readonly pb::MessageParser<RepeatedWellKnownTypes> _parser = new pb::MessageParser<RepeatedWellKnownTypes>(() => new RepeatedWellKnownTypes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<RepeatedWellKnownTypes> Parser { get { return _parser; } }
@@ -966,7 +951,6 @@ namespace Google.Protobuf.TestProtos {
boolField_ = other.boolField_.Clone();
stringField_ = other.stringField_.Clone();
bytesField_ = other.bytesField_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1188,7 +1172,7 @@ namespace Google.Protobuf.TestProtos {
if(!boolField_.Equals(other.boolField_)) return false;
if(!stringField_.Equals(other.stringField_)) return false;
if(!bytesField_.Equals(other.bytesField_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1212,9 +1196,6 @@ namespace Google.Protobuf.TestProtos {
hash ^= boolField_.GetHashCode();
hash ^= stringField_.GetHashCode();
hash ^= bytesField_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1243,9 +1224,6 @@ namespace Google.Protobuf.TestProtos {
boolField_.WriteTo(output, _repeated_boolField_codec);
stringField_.WriteTo(output, _repeated_stringField_codec);
bytesField_.WriteTo(output, _repeated_bytesField_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1269,9 +1247,6 @@ namespace Google.Protobuf.TestProtos {
size += boolField_.CalculateSize(_repeated_boolField_codec);
size += stringField_.CalculateSize(_repeated_stringField_codec);
size += bytesField_.CalculateSize(_repeated_bytesField_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1298,7 +1273,6 @@ namespace Google.Protobuf.TestProtos {
boolField_.Add(other.boolField_);
stringField_.Add(other.stringField_);
bytesField_.Add(other.bytesField_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1307,7 +1281,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
anyField_.AddEntriesFrom(input, _repeated_anyField_codec);
@@ -1389,7 +1363,6 @@ namespace Google.Protobuf.TestProtos {
public sealed partial class OneofWellKnownTypes : pb::IMessage<OneofWellKnownTypes> {
private static readonly pb::MessageParser<OneofWellKnownTypes> _parser = new pb::MessageParser<OneofWellKnownTypes>(() => new OneofWellKnownTypes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<OneofWellKnownTypes> Parser { get { return _parser; } }
@@ -1469,7 +1442,6 @@ namespace Google.Protobuf.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1741,8 +1713,8 @@ namespace Google.Protobuf.TestProtos {
if (!object.Equals(StructField, other.StructField)) return false;
if (!object.Equals(TimestampField, other.TimestampField)) return false;
if (!object.Equals(TypeField, other.TypeField)) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.Equals(DoubleField, other.DoubleField)) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals(FloatField, other.FloatField)) return false;
+ if (DoubleField != other.DoubleField) return false;
+ if (FloatField != other.FloatField) return false;
if (Int64Field != other.Int64Field) return false;
if (Uint64Field != other.Uint64Field) return false;
if (Int32Field != other.Int32Field) return false;
@@ -1751,7 +1723,7 @@ namespace Google.Protobuf.TestProtos {
if (StringField != other.StringField) return false;
if (BytesField != other.BytesField) return false;
if (OneofFieldCase != other.OneofFieldCase) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1766,8 +1738,8 @@ namespace Google.Protobuf.TestProtos {
if (oneofFieldCase_ == OneofFieldOneofCase.StructField) hash ^= StructField.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.TimestampField) hash ^= TimestampField.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.TypeField) hash ^= TypeField.GetHashCode();
- if (oneofFieldCase_ == OneofFieldOneofCase.DoubleField) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode(DoubleField);
- if (oneofFieldCase_ == OneofFieldOneofCase.FloatField) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode(FloatField);
+ if (oneofFieldCase_ == OneofFieldOneofCase.DoubleField) hash ^= DoubleField.GetHashCode();
+ if (oneofFieldCase_ == OneofFieldOneofCase.FloatField) hash ^= FloatField.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.Int64Field) hash ^= Int64Field.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.Uint64Field) hash ^= Uint64Field.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.Int32Field) hash ^= Int32Field.GetHashCode();
@@ -1776,9 +1748,6 @@ namespace Google.Protobuf.TestProtos {
if (oneofFieldCase_ == OneofFieldOneofCase.StringField) hash ^= StringField.GetHashCode();
if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) hash ^= BytesField.GetHashCode();
hash ^= (int) oneofFieldCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1852,9 +1821,6 @@ namespace Google.Protobuf.TestProtos {
if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) {
_oneof_bytesField_codec.WriteTagAndValue(output, (pb::ByteString) oneofField_);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1914,9 +1880,6 @@ namespace Google.Protobuf.TestProtos {
if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) {
size += _oneof_bytesField_codec.CalculateSizeWithTag(BytesField);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1927,58 +1890,31 @@ namespace Google.Protobuf.TestProtos {
}
switch (other.OneofFieldCase) {
case OneofFieldOneofCase.AnyField:
- if (AnyField == null) {
- AnyField = new global::Google.Protobuf.WellKnownTypes.Any();
- }
- AnyField.MergeFrom(other.AnyField);
+ AnyField = other.AnyField;
break;
case OneofFieldOneofCase.ApiField:
- if (ApiField == null) {
- ApiField = new global::Google.Protobuf.WellKnownTypes.Api();
- }
- ApiField.MergeFrom(other.ApiField);
+ ApiField = other.ApiField;
break;
case OneofFieldOneofCase.DurationField:
- if (DurationField == null) {
- DurationField = new global::Google.Protobuf.WellKnownTypes.Duration();
- }
- DurationField.MergeFrom(other.DurationField);
+ DurationField = other.DurationField;
break;
case OneofFieldOneofCase.EmptyField:
- if (EmptyField == null) {
- EmptyField = new global::Google.Protobuf.WellKnownTypes.Empty();
- }
- EmptyField.MergeFrom(other.EmptyField);
+ EmptyField = other.EmptyField;
break;
case OneofFieldOneofCase.FieldMaskField:
- if (FieldMaskField == null) {
- FieldMaskField = new global::Google.Protobuf.WellKnownTypes.FieldMask();
- }
- FieldMaskField.MergeFrom(other.FieldMaskField);
+ FieldMaskField = other.FieldMaskField;
break;
case OneofFieldOneofCase.SourceContextField:
- if (SourceContextField == null) {
- SourceContextField = new global::Google.Protobuf.WellKnownTypes.SourceContext();
- }
- SourceContextField.MergeFrom(other.SourceContextField);
+ SourceContextField = other.SourceContextField;
break;
case OneofFieldOneofCase.StructField:
- if (StructField == null) {
- StructField = new global::Google.Protobuf.WellKnownTypes.Struct();
- }
- StructField.MergeFrom(other.StructField);
+ StructField = other.StructField;
break;
case OneofFieldOneofCase.TimestampField:
- if (TimestampField == null) {
- TimestampField = new global::Google.Protobuf.WellKnownTypes.Timestamp();
- }
- TimestampField.MergeFrom(other.TimestampField);
+ TimestampField = other.TimestampField;
break;
case OneofFieldOneofCase.TypeField:
- if (TypeField == null) {
- TypeField = new global::Google.Protobuf.WellKnownTypes.Type();
- }
- TypeField.MergeFrom(other.TypeField);
+ TypeField = other.TypeField;
break;
case OneofFieldOneofCase.DoubleField:
DoubleField = other.DoubleField;
@@ -2009,7 +1945,6 @@ namespace Google.Protobuf.TestProtos {
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2018,7 +1953,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
global::Google.Protobuf.WellKnownTypes.Any subBuilder = new global::Google.Protobuf.WellKnownTypes.Any();
@@ -2150,7 +2085,6 @@ namespace Google.Protobuf.TestProtos {
/// </summary>
public sealed partial class MapWellKnownTypes : pb::IMessage<MapWellKnownTypes> {
private static readonly pb::MessageParser<MapWellKnownTypes> _parser = new pb::MessageParser<MapWellKnownTypes>(() => new MapWellKnownTypes());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<MapWellKnownTypes> Parser { get { return _parser; } }
@@ -2191,7 +2125,6 @@ namespace Google.Protobuf.TestProtos {
boolField_ = other.boolField_.Clone();
stringField_ = other.stringField_.Clone();
bytesField_ = other.bytesField_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2410,7 +2343,7 @@ namespace Google.Protobuf.TestProtos {
if (!BoolField.Equals(other.BoolField)) return false;
if (!StringField.Equals(other.StringField)) return false;
if (!BytesField.Equals(other.BytesField)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2434,9 +2367,6 @@ namespace Google.Protobuf.TestProtos {
hash ^= BoolField.GetHashCode();
hash ^= StringField.GetHashCode();
hash ^= BytesField.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2465,9 +2395,6 @@ namespace Google.Protobuf.TestProtos {
boolField_.WriteTo(output, _map_boolField_codec);
stringField_.WriteTo(output, _map_stringField_codec);
bytesField_.WriteTo(output, _map_bytesField_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2491,9 +2418,6 @@ namespace Google.Protobuf.TestProtos {
size += boolField_.CalculateSize(_map_boolField_codec);
size += stringField_.CalculateSize(_map_stringField_codec);
size += bytesField_.CalculateSize(_map_bytesField_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2520,7 +2444,6 @@ namespace Google.Protobuf.TestProtos {
boolField_.Add(other.boolField_);
stringField_.Add(other.stringField_);
bytesField_.Add(other.bytesField_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2529,7 +2452,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
anyField_.AddEntriesFrom(input, _map_anyField_codec);
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
index 6ca1e1f04b..a3edd5950c 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
@@ -42,7 +42,7 @@ namespace Google.Protobuf.WellKnownTypes
{
var message = SampleMessages.CreateFullTestAllTypes();
var any = Any.Pack(message);
- Assert.AreEqual("type.googleapis.com/protobuf_unittest3.TestAllTypes", any.TypeUrl);
+ Assert.AreEqual("type.googleapis.com/protobuf_unittest.TestAllTypes", any.TypeUrl);
Assert.AreEqual(message.CalculateSize(), any.Value.Length);
}
@@ -51,7 +51,7 @@ namespace Google.Protobuf.WellKnownTypes
{
var message = SampleMessages.CreateFullTestAllTypes();
var any = Any.Pack(message, "foo.bar/baz");
- Assert.AreEqual("foo.bar/baz/protobuf_unittest3.TestAllTypes", any.TypeUrl);
+ Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl);
Assert.AreEqual(message.CalculateSize(), any.Value.Length);
}
@@ -60,7 +60,7 @@ namespace Google.Protobuf.WellKnownTypes
{
var message = SampleMessages.CreateFullTestAllTypes();
var any = Any.Pack(message, "foo.bar/baz/");
- Assert.AreEqual("foo.bar/baz/protobuf_unittest3.TestAllTypes", any.TypeUrl);
+ Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl);
Assert.AreEqual(message.CalculateSize(), any.Value.Length);
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
index 141faf80e0..141faf80e0 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
index 1d9908b4d3..1d9908b4d3 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs
index 9ecd24c62a..9ecd24c62a 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
index 8ed557445a..5b7185dcd2 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
@@ -417,16 +417,5 @@ namespace Google.Protobuf.WellKnownTypes
TestWellKnownTypes.Descriptor.Fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.Clear(message);
Assert.IsNull(message.StringField);
}
-
- [Test]
- public void NaNComparisons()
- {
- var message1 = new TestWellKnownTypes { DoubleField = SampleNaNs.Regular };
- var message2 = new TestWellKnownTypes { DoubleField = SampleNaNs.PayloadFlipped };
- var message3 = new TestWellKnownTypes { DoubleField = SampleNaNs.Regular };
-
- EqualityTester.AssertInequality(message1, message2);
- EqualityTester.AssertEquality(message1, message3);
- }
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.sln b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.sln
index 0c077cbbb1..0c077cbbb1 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.sln
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf.sln
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ByteArray.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ByteArray.cs
index b19962794b..b19962794b 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ByteArray.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ByteArray.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ByteString.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ByteString.cs
index c7f961e5ec..c7f961e5ec 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ByteString.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ByteString.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedInputStream.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedInputStream.cs
index 084d8d19ab..0123a0f443 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedInputStream.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedInputStream.cs
@@ -94,7 +94,7 @@ namespace Google.Protobuf
private bool hasNextTag = false;
internal const int DefaultRecursionLimit = 64;
- internal const int DefaultSizeLimit = Int32.MaxValue;
+ internal const int DefaultSizeLimit = 64 << 20; // 64MB
internal const int BufferSize = 4096;
/// <summary>
@@ -248,7 +248,7 @@ namespace Google.Protobuf
/// <remarks>
/// This limit is applied when reading from the underlying stream, as a sanity check. It is
/// not applied when reading from a byte array data source without an underlying stream.
- /// The default value is Int32.MaxValue.
+ /// The default value is 64MB.
/// </remarks>
/// <value>
/// The size limit.
@@ -268,11 +268,6 @@ namespace Google.Protobuf
public int RecursionLimit { get { return recursionLimit; } }
/// <summary>
- /// Internal-only property; when set to true, unknown fields will be discarded while parsing.
- /// </summary>
- internal bool DiscardUnknownFields { get; set; }
-
- /// <summary>
/// Disposes of this instance, potentially closing any underlying stream.
/// </summary>
/// <remarks>
@@ -378,9 +373,9 @@ namespace Google.Protobuf
lastTag = ReadRawVarint32();
}
- if (WireFormat.GetTagFieldNumber(lastTag) == 0)
+ if (lastTag == 0)
{
- // If we actually read a tag with a field of 0, that's not a valid tag.
+ // If we actually read zero, that's not a valid tag.
throw InvalidProtocolBufferException.InvalidTag();
}
return lastTag;
@@ -429,10 +424,7 @@ namespace Google.Protobuf
}
}
- /// <summary>
- /// Skip a group.
- /// </summary>
- internal void SkipGroup(uint startGroupTag)
+ private void SkipGroup(uint startGroupTag)
{
// Note: Currently we expect this to be the way that groups are read. We could put the recursion
// depth changes into the ReadTag method instead, potentially...
@@ -1058,7 +1050,7 @@ namespace Google.Protobuf
RecomputeBufferSizeAfterLimit();
int totalBytesRead =
totalBytesRetired + bufferSize + bufferSizeAfterLimit;
- if (totalBytesRead < 0 || totalBytesRead > sizeLimit)
+ if (totalBytesRead > sizeLimit || totalBytesRead < 0)
{
throw InvalidProtocolBufferException.SizeLimitExceeded();
}
@@ -1278,6 +1270,7 @@ namespace Google.Protobuf
}
}
}
+
#endregion
}
} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs
index e22937c13d..e22937c13d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedOutputStream.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedOutputStream.cs
index 827f0398cf..827f0398cf 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/CodedOutputStream.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/CodedOutputStream.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/MapField.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/MapField.cs
index dbbcc14873..8dac8e301d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/MapField.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/MapField.cs
@@ -71,12 +71,9 @@ namespace Google.Protobuf.Collections
, IReadOnlyDictionary<TKey, TValue>
#endif
{
- private static readonly EqualityComparer<TValue> ValueEqualityComparer = ProtobufEqualityComparers.GetEqualityComparer<TValue>();
- private static readonly EqualityComparer<TKey> KeyEqualityComparer = ProtobufEqualityComparers.GetEqualityComparer<TKey>();
-
// TODO: Don't create the map/list until we have an entry. (Assume many maps will be empty.)
private readonly Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>> map =
- new Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>>(KeyEqualityComparer);
+ new Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>>();
private readonly LinkedList<KeyValuePair<TKey, TValue>> list = new LinkedList<KeyValuePair<TKey, TValue>>();
/// <summary>
@@ -134,8 +131,11 @@ namespace Google.Protobuf.Collections
return map.ContainsKey(key);
}
- private bool ContainsValue(TValue value) =>
- list.Any(pair => ValueEqualityComparer.Equals(pair.Value, value));
+ private bool ContainsValue(TValue value)
+ {
+ var comparer = EqualityComparer<TValue>.Default;
+ return list.Any(pair => comparer.Equals(pair.Value, value));
+ }
/// <summary>
/// Removes the entry identified by the given key from the map.
@@ -293,7 +293,8 @@ namespace Google.Protobuf.Collections
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
{
TValue value;
- return TryGetValue(item.Key, out value) && ValueEqualityComparer.Equals(item.Value, value);
+ return TryGetValue(item.Key, out value)
+ && EqualityComparer<TValue>.Default.Equals(item.Value, value);
}
/// <summary>
@@ -362,12 +363,11 @@ namespace Google.Protobuf.Collections
/// </returns>
public override int GetHashCode()
{
- var keyComparer = KeyEqualityComparer;
- var valueComparer = ValueEqualityComparer;
+ var valueComparer = EqualityComparer<TValue>.Default;
int hash = 0;
foreach (var pair in list)
{
- hash ^= keyComparer.GetHashCode(pair.Key) * 31 + valueComparer.GetHashCode(pair.Value);
+ hash ^= pair.Key.GetHashCode() * 31 + valueComparer.GetHashCode(pair.Value);
}
return hash;
}
@@ -394,7 +394,7 @@ namespace Google.Protobuf.Collections
{
return false;
}
- var valueComparer = ValueEqualityComparer;
+ var valueComparer = EqualityComparer<TValue>.Default;
foreach (var pair in this)
{
TValue value;
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs
index 28530a29a8..28530a29a8 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
index c18b63e23f..6063ff6158 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
@@ -51,7 +51,6 @@ namespace Google.Protobuf.Collections
, IReadOnlyList<T>
#endif
{
- private static readonly EqualityComparer<T> EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer<T>();
private static readonly T[] EmptyArray = new T[0];
private const int MinArraySize = 8;
@@ -435,7 +434,7 @@ namespace Google.Protobuf.Collections
{
return false;
}
- EqualityComparer<T> comparer = EqualityComparer;
+ EqualityComparer<T> comparer = EqualityComparer<T>.Default;
for (int i = 0; i < count; i++)
{
if (!comparer.Equals(array[i], other.array[i]))
@@ -455,7 +454,7 @@ namespace Google.Protobuf.Collections
public int IndexOf(T item)
{
ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item));
- EqualityComparer<T> comparer = EqualityComparer;
+ EqualityComparer<T> comparer = EqualityComparer<T>.Default;
for (int i = 0; i < count; i++)
{
if (comparer.Equals(array[i], item))
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs
index 95a02c727f..95a02c727f 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs
index bf4bf22018..bf4bf22018 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs
index 2f23713819..2f23713819 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/FieldCodec.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/FieldCodec.cs
index a11f2420e3..c28b47e1eb 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/FieldCodec.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/FieldCodec.cs
@@ -30,7 +30,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-using Google.Protobuf.Collections;
using Google.Protobuf.Compatibility;
using Google.Protobuf.WellKnownTypes;
using System;
@@ -347,7 +346,6 @@ namespace Google.Protobuf
/// </remarks>
public sealed class FieldCodec<T>
{
- private static readonly EqualityComparer<T> EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer<T>();
private static readonly T DefaultDefault;
// Only non-nullable value types support packing. This is the simplest way of detecting that.
private static readonly bool TypeSupportsPacking = default(T) != null;
@@ -471,6 +469,6 @@ namespace Google.Protobuf
/// </summary>
public int CalculateSizeWithTag(T value) => IsDefault(value) ? 0 : ValueSizeCalculator(value) + tagSize;
- private bool IsDefault(T value) => EqualityComparer.Equals(value, DefaultValue);
+ private bool IsDefault(T value) => EqualityComparer<T>.Default.Equals(value, DefaultValue);
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/FrameworkPortability.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/FrameworkPortability.cs
index c8060f6ca8..c8060f6ca8 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/FrameworkPortability.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/FrameworkPortability.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Google.Protobuf.csproj
index d19531aac7..1d21fdc5a4 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Google.Protobuf.csproj
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Google.Protobuf.csproj
@@ -4,9 +4,9 @@
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
<Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
- <VersionPrefix>3.6.0</VersionPrefix>
+ <VersionPrefix>3.4.0</VersionPrefix>
<Authors>Google Inc.</Authors>
- <TargetFrameworks>netstandard1.0;net45</TargetFrameworks>
+ <TargetFrameworks>netstandard1.0;net451</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs
index a0090569f1..a0090569f1 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/IDeepCloneable.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/IDeepCloneable.cs
index c9c71bbe2c..c9c71bbe2c 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/IDeepCloneable.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/IDeepCloneable.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/IMessage.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/IMessage.cs
index 3e644c1773..3e644c1773 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/IMessage.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/IMessage.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/InvalidJsonException.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/InvalidJsonException.cs
index b543420142..b543420142 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/InvalidJsonException.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/InvalidJsonException.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs
index b3aee222db..b3aee222db 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonFormatter.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonFormatter.cs
index 4ae10d8b73..4ae10d8b73 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonFormatter.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonFormatter.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonParser.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonParser.cs
index 284bce939b..6b6f2d9ae2 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonParser.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonParser.cs
@@ -203,14 +203,10 @@ namespace Google.Protobuf
}
else
{
- if (settings.IgnoreUnknownFields)
- {
- tokenizer.SkipValue();
- }
- else
- {
- throw new InvalidProtocolBufferException("Unknown field: " + name);
- }
+ // TODO: Is this what we want to do? If not, we'll need to skip the value,
+ // which may be an object or array. (We might want to put code in the tokenizer
+ // to do that.)
+ throw new InvalidProtocolBufferException("Unknown field: " + name);
}
}
}
@@ -264,12 +260,11 @@ namespace Google.Protobuf
return;
}
tokenizer.PushBack(token);
- object value = ParseSingleValue(field, tokenizer);
- if (value == null)
+ if (token.Type == JsonToken.TokenType.Null)
{
throw new InvalidProtocolBufferException("Repeated field elements cannot be null");
}
- list.Add(value);
+ list.Add(ParseSingleValue(field, tokenizer));
}
}
@@ -1002,19 +997,6 @@ namespace Google.Protobuf
public TypeRegistry TypeRegistry { get; }
/// <summary>
- /// Whether the parser should ignore unknown fields (<c>true</c>) or throw an exception when
- /// they are encountered (<c>false</c>).
- /// </summary>
- public bool IgnoreUnknownFields { get; }
-
- private Settings(int recursionLimit, TypeRegistry typeRegistry, bool ignoreUnknownFields)
- {
- RecursionLimit = recursionLimit;
- TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry));
- IgnoreUnknownFields = ignoreUnknownFields;
- }
-
- /// <summary>
/// Creates a new <see cref="Settings"/> object with the specified recursion limit.
/// </summary>
/// <param name="recursionLimit">The maximum depth of messages to parse</param>
@@ -1027,34 +1009,11 @@ namespace Google.Protobuf
/// </summary>
/// <param name="recursionLimit">The maximum depth of messages to parse</param>
/// <param name="typeRegistry">The type registry used to parse <see cref="Any"/> messages</param>
- public Settings(int recursionLimit, TypeRegistry typeRegistry) : this(recursionLimit, typeRegistry, false)
+ public Settings(int recursionLimit, TypeRegistry typeRegistry)
{
+ RecursionLimit = recursionLimit;
+ TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry));
}
-
- /// <summary>
- /// Creates a new <see cref="Settings"/> object set to either ignore unknown fields, or throw an exception
- /// when unknown fields are encountered.
- /// </summary>
- /// <param name="ignoreUnknownFields"><c>true</c> if unknown fields should be ignored when parsing; <c>false</c> to throw an exception.</param>
- public Settings WithIgnoreUnknownFields(bool ignoreUnknownFields) =>
- new Settings(RecursionLimit, TypeRegistry, ignoreUnknownFields);
-
- /// <summary>
- /// Creates a new <see cref="Settings"/> object based on this one, but with the specified recursion limit.
- /// </summary>
- /// <param name="recursionLimit">The new recursion limit.</param>
- public Settings WithRecursionLimit(int recursionLimit) =>
- new Settings(recursionLimit, TypeRegistry, IgnoreUnknownFields);
-
- /// <summary>
- /// Creates a new <see cref="Settings"/> object based on this one, but with the specified type registry.
- /// </summary>
- /// <param name="typeRegistry">The new type registry. Must not be null.</param>
- public Settings WithTypeRegistry(TypeRegistry typeRegistry) =>
- new Settings(
- RecursionLimit,
- ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)),
- IgnoreUnknownFields);
}
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonToken.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonToken.cs
index 6c0138ccb6..6c0138ccb6 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonToken.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonToken.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonTokenizer.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonTokenizer.cs
index 0e403f78aa..09a6d43b7b 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/JsonTokenizer.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/JsonTokenizer.cs
@@ -138,34 +138,6 @@ namespace Google.Protobuf
protected abstract JsonToken NextImpl();
/// <summary>
- /// Skips the value we're about to read. This must only be called immediately after reading a property name.
- /// If the value is an object or an array, the complete object/array is skipped.
- /// </summary>
- internal void SkipValue()
- {
- // We'll assume that Next() makes sure that the end objects and end arrays are all valid.
- // All we care about is the total nesting depth we need to close.
- int depth = 0;
-
- // do/while rather than while loop so that we read at least one token.
- do
- {
- var token = Next();
- switch (token.Type)
- {
- case JsonToken.TokenType.EndArray:
- case JsonToken.TokenType.EndObject:
- depth--;
- break;
- case JsonToken.TokenType.StartArray:
- case JsonToken.TokenType.StartObject:
- depth++;
- break;
- }
- } while (depth != 0);
- }
-
- /// <summary>
/// Tokenizer which first exhausts a list of tokens, then consults another tokenizer.
/// </summary>
private class JsonReplayTokenizer : JsonTokenizer
@@ -245,7 +217,7 @@ namespace Google.Protobuf
state = State.ObjectAfterColon;
break;
case ',':
- ValidateState(State.ObjectAfterProperty | State.ArrayAfterValue, "Invalid state to read a comma: ");
+ ValidateState(State.ObjectAfterProperty | State.ArrayAfterValue, "Invalid state to read a colon: ");
state = state == State.ObjectAfterProperty ? State.ObjectAfterComma : State.ArrayAfterComma;
break;
case '"':
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/LimitedInputStream.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/LimitedInputStream.cs
index f11d19d944..f11d19d944 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/LimitedInputStream.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/LimitedInputStream.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/MessageExtensions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/MessageExtensions.cs
index 62181eb9d9..047156c3ee 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/MessageExtensions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/MessageExtensions.cs
@@ -44,34 +44,42 @@ namespace Google.Protobuf
/// </summary>
/// <param name="message">The message to merge the data into.</param>
/// <param name="data">The data to merge, which must be protobuf-encoded binary data.</param>
- public static void MergeFrom(this IMessage message, byte[] data) =>
- MergeFrom(message, data, false);
-
- /// <summary>
- /// Merges data from the given byte array slice into an existing message.
- /// </summary>
- /// <param name="message">The message to merge the data into.</param>
- /// <param name="data">The data containing the slice to merge, which must be protobuf-encoded binary data.</param>
- /// <param name="offset">The offset of the slice to merge.</param>
- /// <param name="length">The length of the slice to merge.</param>
- public static void MergeFrom(this IMessage message, byte[] data, int offset, int length) =>
- MergeFrom(message, data, offset, length, false);
+ public static void MergeFrom(this IMessage message, byte[] data)
+ {
+ ProtoPreconditions.CheckNotNull(message, "message");
+ ProtoPreconditions.CheckNotNull(data, "data");
+ CodedInputStream input = new CodedInputStream(data);
+ message.MergeFrom(input);
+ input.CheckReadEndOfStreamTag();
+ }
/// <summary>
/// Merges data from the given byte string into an existing message.
/// </summary>
/// <param name="message">The message to merge the data into.</param>
/// <param name="data">The data to merge, which must be protobuf-encoded binary data.</param>
- public static void MergeFrom(this IMessage message, ByteString data) =>
- MergeFrom(message, data, false);
+ public static void MergeFrom(this IMessage message, ByteString data)
+ {
+ ProtoPreconditions.CheckNotNull(message, "message");
+ ProtoPreconditions.CheckNotNull(data, "data");
+ CodedInputStream input = data.CreateCodedInput();
+ message.MergeFrom(input);
+ input.CheckReadEndOfStreamTag();
+ }
/// <summary>
/// Merges data from the given stream into an existing message.
/// </summary>
/// <param name="message">The message to merge the data into.</param>
/// <param name="input">Stream containing the data to merge, which must be protobuf-encoded binary data.</param>
- public static void MergeFrom(this IMessage message, Stream input) =>
- MergeFrom(message, input, false);
+ public static void MergeFrom(this IMessage message, Stream input)
+ {
+ ProtoPreconditions.CheckNotNull(message, "message");
+ ProtoPreconditions.CheckNotNull(input, "input");
+ CodedInputStream codedInput = new CodedInputStream(input);
+ message.MergeFrom(codedInput);
+ codedInput.CheckReadEndOfStreamTag();
+ }
/// <summary>
/// Merges length-delimited data from the given stream into an existing message.
@@ -82,8 +90,14 @@ namespace Google.Protobuf
/// </remarks>
/// <param name="message">The message to merge the data into.</param>
/// <param name="input">Stream containing the data to merge, which must be protobuf-encoded binary data.</param>
- public static void MergeDelimitedFrom(this IMessage message, Stream input) =>
- MergeDelimitedFrom(message, input, false);
+ public static void MergeDelimitedFrom(this IMessage message, Stream input)
+ {
+ ProtoPreconditions.CheckNotNull(message, "message");
+ ProtoPreconditions.CheckNotNull(input, "input");
+ int size = (int) CodedInputStream.ReadRawVarint32(input);
+ Stream limitedStream = new LimitedInputStream(input, size);
+ message.MergeFrom(limitedStream);
+ }
/// <summary>
/// Converts the given message into a byte array in protobuf encoding.
@@ -138,56 +152,6 @@ namespace Google.Protobuf
{
ProtoPreconditions.CheckNotNull(message, "message");
return ByteString.AttachBytes(message.ToByteArray());
- }
-
- // Implementations allowing unknown fields to be discarded.
- internal static void MergeFrom(this IMessage message, byte[] data, bool discardUnknownFields)
- {
- ProtoPreconditions.CheckNotNull(message, "message");
- ProtoPreconditions.CheckNotNull(data, "data");
- CodedInputStream input = new CodedInputStream(data);
- input.DiscardUnknownFields = discardUnknownFields;
- message.MergeFrom(input);
- input.CheckReadEndOfStreamTag();
- }
-
- internal static void MergeFrom(this IMessage message, byte[] data, int offset, int length, bool discardUnknownFields)
- {
- ProtoPreconditions.CheckNotNull(message, "message");
- ProtoPreconditions.CheckNotNull(data, "data");
- CodedInputStream input = new CodedInputStream(data, offset, length);
- input.DiscardUnknownFields = discardUnknownFields;
- message.MergeFrom(input);
- input.CheckReadEndOfStreamTag();
- }
-
- internal static void MergeFrom(this IMessage message, ByteString data, bool discardUnknownFields)
- {
- ProtoPreconditions.CheckNotNull(message, "message");
- ProtoPreconditions.CheckNotNull(data, "data");
- CodedInputStream input = data.CreateCodedInput();
- input.DiscardUnknownFields = discardUnknownFields;
- message.MergeFrom(input);
- input.CheckReadEndOfStreamTag();
- }
-
- internal static void MergeFrom(this IMessage message, Stream input, bool discardUnknownFields)
- {
- ProtoPreconditions.CheckNotNull(message, "message");
- ProtoPreconditions.CheckNotNull(input, "input");
- CodedInputStream codedInput = new CodedInputStream(input);
- codedInput.DiscardUnknownFields = discardUnknownFields;
- message.MergeFrom(codedInput);
- codedInput.CheckReadEndOfStreamTag();
- }
-
- internal static void MergeDelimitedFrom(this IMessage message, Stream input, bool discardUnknownFields)
- {
- ProtoPreconditions.CheckNotNull(message, "message");
- ProtoPreconditions.CheckNotNull(input, "input");
- int size = (int) CodedInputStream.ReadRawVarint32(input);
- Stream limitedStream = new LimitedInputStream(input, size);
- MergeFrom(message, limitedStream, discardUnknownFields);
- }
+ }
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/MessageParser.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/MessageParser.cs
index 4d35554a25..8889638b20 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/MessageParser.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/MessageParser.cs
@@ -42,13 +42,10 @@ namespace Google.Protobuf
public class MessageParser
{
private Func<IMessage> factory;
- // TODO: When we use a C# 7.1 compiler, make this private protected.
- internal bool DiscardUnknownFields { get; }
- internal MessageParser(Func<IMessage> factory, bool discardUnknownFields)
+ internal MessageParser(Func<IMessage> factory)
{
this.factory = factory;
- DiscardUnknownFields = discardUnknownFields;
}
/// <summary>
@@ -67,22 +64,9 @@ namespace Google.Protobuf
/// <returns>The newly parsed message.</returns>
public IMessage ParseFrom(byte[] data)
{
+ ProtoPreconditions.CheckNotNull(data, "data");
IMessage message = factory();
- message.MergeFrom(data, DiscardUnknownFields);
- return message;
- }
-
- /// <summary>
- /// Parses a message from a byte array slice.
- /// </summary>
- /// <param name="data">The byte array containing the message. Must not be null.</param>
- /// <param name="offset">The offset of the slice to parse.</param>
- /// <param name="length">The length of the slice to parse.</param>
- /// <returns>The newly parsed message.</returns>
- public IMessage ParseFrom(byte[] data, int offset, int length)
- {
- IMessage message = factory();
- message.MergeFrom(data, offset, length, DiscardUnknownFields);
+ message.MergeFrom(data);
return message;
}
@@ -93,8 +77,9 @@ namespace Google.Protobuf
/// <returns>The parsed message.</returns>
public IMessage ParseFrom(ByteString data)
{
+ ProtoPreconditions.CheckNotNull(data, "data");
IMessage message = factory();
- message.MergeFrom(data, DiscardUnknownFields);
+ message.MergeFrom(data);
return message;
}
@@ -106,7 +91,7 @@ namespace Google.Protobuf
public IMessage ParseFrom(Stream input)
{
IMessage message = factory();
- message.MergeFrom(input, DiscardUnknownFields);
+ message.MergeFrom(input);
return message;
}
@@ -122,7 +107,7 @@ namespace Google.Protobuf
public IMessage ParseDelimitedFrom(Stream input)
{
IMessage message = factory();
- message.MergeDelimitedFrom(input, DiscardUnknownFields);
+ message.MergeDelimitedFrom(input);
return message;
}
@@ -134,7 +119,7 @@ namespace Google.Protobuf
public IMessage ParseFrom(CodedInputStream input)
{
IMessage message = factory();
- MergeFrom(message, input);
+ message.MergeFrom(input);
return message;
}
@@ -151,29 +136,6 @@ namespace Google.Protobuf
JsonParser.Default.Merge(message, json);
return message;
}
-
- // TODO: When we're using a C# 7.1 compiler, make this private protected.
- internal void MergeFrom(IMessage message, CodedInputStream codedInput)
- {
- bool originalDiscard = codedInput.DiscardUnknownFields;
- try
- {
- codedInput.DiscardUnknownFields = DiscardUnknownFields;
- message.MergeFrom(codedInput);
- }
- finally
- {
- codedInput.DiscardUnknownFields = originalDiscard;
- }
- }
-
- /// <summary>
- /// Creates a new message parser which optionally discards unknown fields when parsing.
- /// </summary>
- /// <param name="discardUnknownFields">Whether or not to discard unknown fields when parsing.</param>
- /// <returns>A newly configured message parser.</returns>
- public MessageParser WithDiscardUnknownFields(bool discardUnknownFields) =>
- new MessageParser(factory, discardUnknownFields);
}
/// <summary>
@@ -208,11 +170,7 @@ namespace Google.Protobuf
/// to require a parameterless constructor: delegates are significantly faster to execute.
/// </remarks>
/// <param name="factory">Function to invoke when a new, empty message is required.</param>
- public MessageParser(Func<T> factory) : this(factory, false)
- {
- }
-
- internal MessageParser(Func<T> factory, bool discardUnknownFields) : base(() => factory(), discardUnknownFields)
+ public MessageParser(Func<T> factory) : base(() => factory())
{
this.factory = factory;
}
@@ -233,22 +191,9 @@ namespace Google.Protobuf
/// <returns>The newly parsed message.</returns>
public new T ParseFrom(byte[] data)
{
+ ProtoPreconditions.CheckNotNull(data, "data");
T message = factory();
- message.MergeFrom(data, DiscardUnknownFields);
- return message;
- }
-
- /// <summary>
- /// Parses a message from a byte array slice.
- /// </summary>
- /// <param name="data">The byte array containing the message. Must not be null.</param>
- /// <param name="offset">The offset of the slice to parse.</param>
- /// <param name="length">The length of the slice to parse.</param>
- /// <returns>The newly parsed message.</returns>
- public new T ParseFrom(byte[] data, int offset, int length)
- {
- T message = factory();
- message.MergeFrom(data, offset, length, DiscardUnknownFields);
+ message.MergeFrom(data);
return message;
}
@@ -259,8 +204,9 @@ namespace Google.Protobuf
/// <returns>The parsed message.</returns>
public new T ParseFrom(ByteString data)
{
+ ProtoPreconditions.CheckNotNull(data, "data");
T message = factory();
- message.MergeFrom(data, DiscardUnknownFields);
+ message.MergeFrom(data);
return message;
}
@@ -272,7 +218,7 @@ namespace Google.Protobuf
public new T ParseFrom(Stream input)
{
T message = factory();
- message.MergeFrom(input, DiscardUnknownFields);
+ message.MergeFrom(input);
return message;
}
@@ -288,7 +234,7 @@ namespace Google.Protobuf
public new T ParseDelimitedFrom(Stream input)
{
T message = factory();
- message.MergeDelimitedFrom(input, DiscardUnknownFields);
+ message.MergeDelimitedFrom(input);
return message;
}
@@ -300,7 +246,7 @@ namespace Google.Protobuf
public new T ParseFrom(CodedInputStream input)
{
T message = factory();
- MergeFrom(message, input);
+ message.MergeFrom(input);
return message;
}
@@ -317,13 +263,5 @@ namespace Google.Protobuf
JsonParser.Default.Merge(message, json);
return message;
}
-
- /// <summary>
- /// Creates a new message parser which optionally discards unknown fields when parsing.
- /// </summary>
- /// <param name="discardUnknownFields">Whether or not to discard unknown fields when parsing.</param>
- /// <returns>A newly configured message parser.</returns>
- public new MessageParser<T> WithDiscardUnknownFields(bool discardUnknownFields) =>
- new MessageParser<T>(factory, discardUnknownFields);
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
index ae885f8c00..ae885f8c00 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ProtoPreconditions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ProtoPreconditions.cs
index abaeb9b481..abaeb9b481 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/ProtoPreconditions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/ProtoPreconditions.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs
index 88b3ec000d..88b3ec000d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/Descriptor.cs
index 4cbed33b65..8311a2c656 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/Descriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/Descriptor.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/descriptor.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/descriptor.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -72,92 +70,88 @@ namespace Google.Protobuf.Reflection {
"IkMKBUxhYmVsEhIKDkxBQkVMX09QVElPTkFMEAESEgoOTEFCRUxfUkVRVUlS",
"RUQQAhISCg5MQUJFTF9SRVBFQVRFRBADIlQKFE9uZW9mRGVzY3JpcHRvclBy",
"b3RvEgwKBG5hbWUYASABKAkSLgoHb3B0aW9ucxgCIAEoCzIdLmdvb2dsZS5w",
- "cm90b2J1Zi5PbmVvZk9wdGlvbnMipAIKE0VudW1EZXNjcmlwdG9yUHJvdG8S",
+ "cm90b2J1Zi5PbmVvZk9wdGlvbnMijAEKE0VudW1EZXNjcmlwdG9yUHJvdG8S",
"DAoEbmFtZRgBIAEoCRI4CgV2YWx1ZRgCIAMoCzIpLmdvb2dsZS5wcm90b2J1",
"Zi5FbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SLQoHb3B0aW9ucxgDIAEoCzIc",
- "Lmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9ucxJOCg5yZXNlcnZlZF9yYW5n",
- "ZRgEIAMoCzI2Lmdvb2dsZS5wcm90b2J1Zi5FbnVtRGVzY3JpcHRvclByb3Rv",
- "LkVudW1SZXNlcnZlZFJhbmdlEhUKDXJlc2VydmVkX25hbWUYBSADKAkaLwoR",
- "RW51bVJlc2VydmVkUmFuZ2USDQoFc3RhcnQYASABKAUSCwoDZW5kGAIgASgF",
- "ImwKGEVudW1WYWx1ZURlc2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg4K",
- "Bm51bWJlchgCIAEoBRIyCgdvcHRpb25zGAMgASgLMiEuZ29vZ2xlLnByb3Rv",
- "YnVmLkVudW1WYWx1ZU9wdGlvbnMikAEKFlNlcnZpY2VEZXNjcmlwdG9yUHJv",
- "dG8SDAoEbmFtZRgBIAEoCRI2CgZtZXRob2QYAiADKAsyJi5nb29nbGUucHJv",
- "dG9idWYuTWV0aG9kRGVzY3JpcHRvclByb3RvEjAKB29wdGlvbnMYAyABKAsy",
- "Hy5nb29nbGUucHJvdG9idWYuU2VydmljZU9wdGlvbnMiwQEKFU1ldGhvZERl",
- "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEhIKCmlucHV0X3R5cGUYAiAB",
- "KAkSEwoLb3V0cHV0X3R5cGUYAyABKAkSLwoHb3B0aW9ucxgEIAEoCzIeLmdv",
- "b2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zEh8KEGNsaWVudF9zdHJlYW1p",
- "bmcYBSABKAg6BWZhbHNlEh8KEHNlcnZlcl9zdHJlYW1pbmcYBiABKAg6BWZh",
- "bHNlIqYGCgtGaWxlT3B0aW9ucxIUCgxqYXZhX3BhY2thZ2UYASABKAkSHAoU",
- "amF2YV9vdXRlcl9jbGFzc25hbWUYCCABKAkSIgoTamF2YV9tdWx0aXBsZV9m",
- "aWxlcxgKIAEoCDoFZmFsc2USKQodamF2YV9nZW5lcmF0ZV9lcXVhbHNfYW5k",
- "X2hhc2gYFCABKAhCAhgBEiUKFmphdmFfc3RyaW5nX2NoZWNrX3V0ZjgYGyAB",
- "KAg6BWZhbHNlEkYKDG9wdGltaXplX2ZvchgJIAEoDjIpLmdvb2dsZS5wcm90",
- "b2J1Zi5GaWxlT3B0aW9ucy5PcHRpbWl6ZU1vZGU6BVNQRUVEEhIKCmdvX3Bh",
- "Y2thZ2UYCyABKAkSIgoTY2NfZ2VuZXJpY19zZXJ2aWNlcxgQIAEoCDoFZmFs",
- "c2USJAoVamF2YV9nZW5lcmljX3NlcnZpY2VzGBEgASgIOgVmYWxzZRIiChNw",
- "eV9nZW5lcmljX3NlcnZpY2VzGBIgASgIOgVmYWxzZRIjChRwaHBfZ2VuZXJp",
- "Y19zZXJ2aWNlcxgqIAEoCDoFZmFsc2USGQoKZGVwcmVjYXRlZBgXIAEoCDoF",
- "ZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoFZmFsc2USGQoRb2Jq",
- "Y19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25hbWVzcGFjZRglIAEo",
- "CRIUCgxzd2lmdF9wcmVmaXgYJyABKAkSGAoQcGhwX2NsYXNzX3ByZWZpeBgo",
- "IAEoCRIVCg1waHBfbmFtZXNwYWNlGCkgASgJEh4KFnBocF9tZXRhZGF0YV9u",
- "YW1lc3BhY2UYLCABKAkSFAoMcnVieV9wYWNrYWdlGC0gASgJEkMKFHVuaW50",
- "ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5Vbmlu",
- "dGVycHJldGVkT3B0aW9uIjoKDE9wdGltaXplTW9kZRIJCgVTUEVFRBABEg0K",
- "CUNPREVfU0laRRACEhAKDExJVEVfUlVOVElNRRADKgkI6AcQgICAgAJKBAgm",
- "ECci8gEKDk1lc3NhZ2VPcHRpb25zEiYKF21lc3NhZ2Vfc2V0X3dpcmVfZm9y",
- "bWF0GAEgASgIOgVmYWxzZRIuCh9ub19zdGFuZGFyZF9kZXNjcmlwdG9yX2Fj",
- "Y2Vzc29yGAIgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMgASgIOgVmYWxz",
- "ZRIRCgltYXBfZW50cnkYByABKAgSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y",
- "5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24q",
- "CQjoBxCAgICAAkoECAgQCUoECAkQCiKeAwoMRmllbGRPcHRpb25zEjoKBWN0",
- "eXBlGAEgASgOMiMuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5DVHlw",
- "ZToGU1RSSU5HEg4KBnBhY2tlZBgCIAEoCBI/CgZqc3R5cGUYBiABKA4yJC5n",
- "b29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zLkpTVHlwZToJSlNfTk9STUFM",
- "EhMKBGxhenkYBSABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZh",
- "bHNlEhMKBHdlYWsYCiABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0",
+ "Lmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9ucyJsChhFbnVtVmFsdWVEZXNj",
+ "cmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRIOCgZudW1iZXIYAiABKAUSMgoH",
+ "b3B0aW9ucxgDIAEoCzIhLmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVPcHRp",
+ "b25zIpABChZTZXJ2aWNlRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkS",
+ "NgoGbWV0aG9kGAIgAygLMiYuZ29vZ2xlLnByb3RvYnVmLk1ldGhvZERlc2Ny",
+ "aXB0b3JQcm90bxIwCgdvcHRpb25zGAMgASgLMh8uZ29vZ2xlLnByb3RvYnVm",
+ "LlNlcnZpY2VPcHRpb25zIsEBChVNZXRob2REZXNjcmlwdG9yUHJvdG8SDAoE",
+ "bmFtZRgBIAEoCRISCgppbnB1dF90eXBlGAIgASgJEhMKC291dHB1dF90eXBl",
+ "GAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5nb29nbGUucHJvdG9idWYuTWV0",
+ "aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFtaW5nGAUgASgIOgVmYWxzZRIf",
+ "ChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVmYWxzZSLwBQoLRmlsZU9wdGlv",
+ "bnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwKFGphdmFfb3V0ZXJfY2xhc3Nu",
+ "YW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVfZmlsZXMYCiABKAg6BWZhbHNl",
+ "EikKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2FuZF9oYXNoGBQgASgIQgIYARIl",
+ "ChZqYXZhX3N0cmluZ19jaGVja191dGY4GBsgASgIOgVmYWxzZRJGCgxvcHRp",
+ "bWl6ZV9mb3IYCSABKA4yKS5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMu",
+ "T3B0aW1pemVNb2RlOgVTUEVFRBISCgpnb19wYWNrYWdlGAsgASgJEiIKE2Nj",
+ "X2dlbmVyaWNfc2VydmljZXMYECABKAg6BWZhbHNlEiQKFWphdmFfZ2VuZXJp",
+ "Y19zZXJ2aWNlcxgRIAEoCDoFZmFsc2USIgoTcHlfZ2VuZXJpY19zZXJ2aWNl",
+ "cxgSIAEoCDoFZmFsc2USIwoUcGhwX2dlbmVyaWNfc2VydmljZXMYEyABKAg6",
+ "BWZhbHNlEhkKCmRlcHJlY2F0ZWQYFyABKAg6BWZhbHNlEh8KEGNjX2VuYWJs",
+ "ZV9hcmVuYXMYHyABKAg6BWZhbHNlEhkKEW9iamNfY2xhc3NfcHJlZml4GCQg",
+ "ASgJEhgKEGNzaGFycF9uYW1lc3BhY2UYJSABKAkSFAoMc3dpZnRfcHJlZml4",
+ "GCcgASgJEhgKEHBocF9jbGFzc19wcmVmaXgYKCABKAkSFQoNcGhwX25hbWVz",
+ "cGFjZRgpIAEoCRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5n",
+ "b29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiI6CgxPcHRpbWl6",
+ "ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJWkUQAhIQCgxMSVRFX1JVTlRJ",
+ "TUUQAyoJCOgHEICAgIACSgQIJhAnIvIBCg5NZXNzYWdlT3B0aW9ucxImChdt",
+ "ZXNzYWdlX3NldF93aXJlX2Zvcm1hdBgBIAEoCDoFZmFsc2USLgofbm9fc3Rh",
+ "bmRhcmRfZGVzY3JpcHRvcl9hY2Nlc3NvchgCIAEoCDoFZmFsc2USGQoKZGVw",
+ "cmVjYXRlZBgDIAEoCDoFZmFsc2USEQoJbWFwX2VudHJ5GAcgASgIEkMKFHVu",
+ "aW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5V",
+ "bmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAJKBAgIEAlKBAgJEAoingMK",
+ "DEZpZWxkT3B0aW9ucxI6CgVjdHlwZRgBIAEoDjIjLmdvb2dsZS5wcm90b2J1",
+ "Zi5GaWVsZE9wdGlvbnMuQ1R5cGU6BlNUUklORxIOCgZwYWNrZWQYAiABKAgS",
+ "PwoGanN0eXBlGAYgASgOMiQuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9u",
+ "cy5KU1R5cGU6CUpTX05PUk1BTBITCgRsYXp5GAUgASgIOgVmYWxzZRIZCgpk",
+ "ZXByZWNhdGVkGAMgASgIOgVmYWxzZRITCgR3ZWFrGAogASgIOgVmYWxzZRJD",
+ "ChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9i",
+ "dWYuVW5pbnRlcnByZXRlZE9wdGlvbiIvCgVDVHlwZRIKCgZTVFJJTkcQABII",
+ "CgRDT1JEEAESEAoMU1RSSU5HX1BJRUNFEAIiNQoGSlNUeXBlEg0KCUpTX05P",
+ "Uk1BTBAAEg0KCUpTX1NUUklORxABEg0KCUpTX05VTUJFUhACKgkI6AcQgICA",
+ "gAJKBAgEEAUiXgoMT25lb2ZPcHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRfb3B0",
"aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0",
- "aW9uIi8KBUNUeXBlEgoKBlNUUklORxAAEggKBENPUkQQARIQCgxTVFJJTkdf",
- "UElFQ0UQAiI1CgZKU1R5cGUSDQoJSlNfTk9STUFMEAASDQoJSlNfU1RSSU5H",
- "EAESDQoJSlNfTlVNQkVSEAIqCQjoBxCAgICAAkoECAQQBSJeCgxPbmVvZk9w",
- "dGlvbnMSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xl",
- "LnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKTAQoL",
- "RW51bU9wdGlvbnMSEwoLYWxsb3dfYWxpYXMYAiABKAgSGQoKZGVwcmVjYXRl",
- "ZBgDIAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygL",
- "MiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCA",
- "gICAAkoECAUQBiJ9ChBFbnVtVmFsdWVPcHRpb25zEhkKCmRlcHJlY2F0ZWQY",
- "ASABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIk",
- "Lmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICA",
- "gAIiewoOU2VydmljZU9wdGlvbnMSGQoKZGVwcmVjYXRlZBghIAEoCDoFZmFs",
- "c2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnBy",
- "b3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKtAgoNTWV0",
- "aG9kT3B0aW9ucxIZCgpkZXByZWNhdGVkGCEgASgIOgVmYWxzZRJfChFpZGVt",
- "cG90ZW5jeV9sZXZlbBgiIAEoDjIvLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RP",
- "cHRpb25zLklkZW1wb3RlbmN5TGV2ZWw6E0lERU1QT1RFTkNZX1VOS05PV04S",
- "QwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3Rv",
- "YnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24iUAoQSWRlbXBvdGVuY3lMZXZlbBIX",
- "ChNJREVNUE9URU5DWV9VTktOT1dOEAASEwoPTk9fU0lERV9FRkZFQ1RTEAES",
- "DgoKSURFTVBPVEVOVBACKgkI6AcQgICAgAIingIKE1VuaW50ZXJwcmV0ZWRP",
- "cHRpb24SOwoEbmFtZRgCIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5VbmludGVy",
- "cHJldGVkT3B0aW9uLk5hbWVQYXJ0EhgKEGlkZW50aWZpZXJfdmFsdWUYAyAB",
- "KAkSGgoScG9zaXRpdmVfaW50X3ZhbHVlGAQgASgEEhoKEm5lZ2F0aXZlX2lu",
- "dF92YWx1ZRgFIAEoAxIUCgxkb3VibGVfdmFsdWUYBiABKAESFAoMc3RyaW5n",
- "X3ZhbHVlGAcgASgMEhcKD2FnZ3JlZ2F0ZV92YWx1ZRgIIAEoCRozCghOYW1l",
- "UGFydBIRCgluYW1lX3BhcnQYASACKAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigI",
- "ItUBCg5Tb3VyY2VDb2RlSW5mbxI6Cghsb2NhdGlvbhgBIAMoCzIoLmdvb2ds",
- "ZS5wcm90b2J1Zi5Tb3VyY2VDb2RlSW5mby5Mb2NhdGlvbhqGAQoITG9jYXRp",
- "b24SEAoEcGF0aBgBIAMoBUICEAESEAoEc3BhbhgCIAMoBUICEAESGAoQbGVh",
- "ZGluZ19jb21tZW50cxgDIAEoCRIZChF0cmFpbGluZ19jb21tZW50cxgEIAEo",
- "CRIhChlsZWFkaW5nX2RldGFjaGVkX2NvbW1lbnRzGAYgAygJIqcBChFHZW5l",
- "cmF0ZWRDb2RlSW5mbxJBCgphbm5vdGF0aW9uGAEgAygLMi0uZ29vZ2xlLnBy",
- "b3RvYnVmLkdlbmVyYXRlZENvZGVJbmZvLkFubm90YXRpb24aTwoKQW5ub3Rh",
- "dGlvbhIQCgRwYXRoGAEgAygFQgIQARITCgtzb3VyY2VfZmlsZRgCIAEoCRIN",
- "CgViZWdpbhgDIAEoBRILCgNlbmQYBCABKAVCjwEKE2NvbS5nb29nbGUucHJv",
- "dG9idWZCEERlc2NyaXB0b3JQcm90b3NIAVo+Z2l0aHViLmNvbS9nb2xhbmcv",
- "cHJvdG9idWYvcHJvdG9jLWdlbi1nby9kZXNjcmlwdG9yO2Rlc2NyaXB0b3L4",
- "AQGiAgNHUEKqAhpHb29nbGUuUHJvdG9idWYuUmVmbGVjdGlvbg=="));
+ "aW9uKgkI6AcQgICAgAIikwEKC0VudW1PcHRpb25zEhMKC2FsbG93X2FsaWFz",
+ "GAIgASgIEhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZhbHNlEkMKFHVuaW50ZXJw",
+ "cmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVy",
+ "cHJldGVkT3B0aW9uKgkI6AcQgICAgAJKBAgFEAYifQoQRW51bVZhbHVlT3B0",
+ "aW9ucxIZCgpkZXByZWNhdGVkGAEgASgIOgVmYWxzZRJDChR1bmludGVycHJl",
+ "dGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnBy",
+ "ZXRlZE9wdGlvbioJCOgHEICAgIACInsKDlNlcnZpY2VPcHRpb25zEhkKCmRl",
+ "cHJlY2F0ZWQYISABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9u",
+ "GOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9u",
+ "KgkI6AcQgICAgAIirQIKDU1ldGhvZE9wdGlvbnMSGQoKZGVwcmVjYXRlZBgh",
+ "IAEoCDoFZmFsc2USXwoRaWRlbXBvdGVuY3lfbGV2ZWwYIiABKA4yLy5nb29n",
+ "bGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucy5JZGVtcG90ZW5jeUxldmVsOhNJ",
+ "REVNUE9URU5DWV9VTktOT1dOEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcH",
+ "IAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uIlAK",
+ "EElkZW1wb3RlbmN5TGV2ZWwSFwoTSURFTVBPVEVOQ1lfVU5LTk9XThAAEhMK",
+ "D05PX1NJREVfRUZGRUNUUxABEg4KCklERU1QT1RFTlQQAioJCOgHEICAgIAC",
+ "Ip4CChNVbmludGVycHJldGVkT3B0aW9uEjsKBG5hbWUYAiADKAsyLS5nb29n",
+ "bGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbi5OYW1lUGFydBIYChBp",
+ "ZGVudGlmaWVyX3ZhbHVlGAMgASgJEhoKEnBvc2l0aXZlX2ludF92YWx1ZRgE",
+ "IAEoBBIaChJuZWdhdGl2ZV9pbnRfdmFsdWUYBSABKAMSFAoMZG91YmxlX3Zh",
+ "bHVlGAYgASgBEhQKDHN0cmluZ192YWx1ZRgHIAEoDBIXCg9hZ2dyZWdhdGVf",
+ "dmFsdWUYCCABKAkaMwoITmFtZVBhcnQSEQoJbmFtZV9wYXJ0GAEgAigJEhQK",
+ "DGlzX2V4dGVuc2lvbhgCIAIoCCLVAQoOU291cmNlQ29kZUluZm8SOgoIbG9j",
+ "YXRpb24YASADKAsyKC5nb29nbGUucHJvdG9idWYuU291cmNlQ29kZUluZm8u",
+ "TG9jYXRpb24ahgEKCExvY2F0aW9uEhAKBHBhdGgYASADKAVCAhABEhAKBHNw",
+ "YW4YAiADKAVCAhABEhgKEGxlYWRpbmdfY29tbWVudHMYAyABKAkSGQoRdHJh",
+ "aWxpbmdfY29tbWVudHMYBCABKAkSIQoZbGVhZGluZ19kZXRhY2hlZF9jb21t",
+ "ZW50cxgGIAMoCSKnAQoRR2VuZXJhdGVkQ29kZUluZm8SQQoKYW5ub3RhdGlv",
+ "bhgBIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5HZW5lcmF0ZWRDb2RlSW5mby5B",
+ "bm5vdGF0aW9uGk8KCkFubm90YXRpb24SEAoEcGF0aBgBIAMoBUICEAESEwoL",
+ "c291cmNlX2ZpbGUYAiABKAkSDQoFYmVnaW4YAyABKAUSCwoDZW5kGAQgASgF",
+ "QowBChNjb20uZ29vZ2xlLnByb3RvYnVmQhBEZXNjcmlwdG9yUHJvdG9zSAFa",
+ "PmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3Byb3RvYy1nZW4tZ28vZGVz",
+ "Y3JpcHRvcjtkZXNjcmlwdG9yogIDR1BCqgIaR29vZ2xlLlByb3RvYnVmLlJl",
+ "ZmxlY3Rpb24="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
@@ -168,11 +162,11 @@ namespace Google.Protobuf.Reflection {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ExtensionRangeOptions), global::Google.Protobuf.Reflection.ExtensionRangeOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser, new[]{ "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "JsonName", "Options" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type), typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) }, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name", "Options" }, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options", "ReservedRange", "ReservedName" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange), global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange.Parser, new[]{ "Start", "End" }, null, null, null)}),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "PhpGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "PhpMetadataNamespace", "RubyPackage", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "PhpGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null),
@@ -195,7 +189,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class FileDescriptorSet : pb::IMessage<FileDescriptorSet> {
private static readonly pb::MessageParser<FileDescriptorSet> _parser = new pb::MessageParser<FileDescriptorSet>(() => new FileDescriptorSet());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FileDescriptorSet> Parser { get { return _parser; } }
@@ -219,7 +212,6 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FileDescriptorSet(FileDescriptorSet other) : this() {
file_ = other.file_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -251,16 +243,13 @@ namespace Google.Protobuf.Reflection {
return true;
}
if(!file_.Equals(other.file_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= file_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -272,18 +261,12 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
file_.WriteTo(output, _repeated_file_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += file_.CalculateSize(_repeated_file_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -293,7 +276,6 @@ namespace Google.Protobuf.Reflection {
return;
}
file_.Add(other.file_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -302,7 +284,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
file_.AddEntriesFrom(input, _repeated_file_codec);
@@ -319,7 +301,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class FileDescriptorProto : pb::IMessage<FileDescriptorProto> {
private static readonly pb::MessageParser<FileDescriptorProto> _parser = new pb::MessageParser<FileDescriptorProto>(() => new FileDescriptorProto());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FileDescriptorProto> Parser { get { return _parser; } }
@@ -351,10 +332,9 @@ namespace Google.Protobuf.Reflection {
enumType_ = other.enumType_.Clone();
service_ = other.service_.Clone();
extension_ = other.extension_.Clone();
- options_ = other.options_ != null ? other.options_.Clone() : null;
- sourceCodeInfo_ = other.sourceCodeInfo_ != null ? other.sourceCodeInfo_.Clone() : null;
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ SourceCodeInfo = other.sourceCodeInfo_ != null ? other.SourceCodeInfo.Clone() : null;
syntax_ = other.syntax_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -541,7 +521,7 @@ namespace Google.Protobuf.Reflection {
if (!object.Equals(Options, other.Options)) return false;
if (!object.Equals(SourceCodeInfo, other.SourceCodeInfo)) return false;
if (Syntax != other.Syntax) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -559,9 +539,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) hash ^= Options.GetHashCode();
if (sourceCodeInfo_ != null) hash ^= SourceCodeInfo.GetHashCode();
if (Syntax.Length != 0) hash ^= Syntax.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -599,9 +576,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(98);
output.WriteString(Syntax);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -629,9 +603,6 @@ namespace Google.Protobuf.Reflection {
if (Syntax.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Syntax);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -668,7 +639,6 @@ namespace Google.Protobuf.Reflection {
if (other.Syntax.Length != 0) {
Syntax = other.Syntax;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -677,7 +647,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -746,7 +716,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class DescriptorProto : pb::IMessage<DescriptorProto> {
private static readonly pb::MessageParser<DescriptorProto> _parser = new pb::MessageParser<DescriptorProto>(() => new DescriptorProto());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<DescriptorProto> Parser { get { return _parser; } }
@@ -776,10 +745,9 @@ namespace Google.Protobuf.Reflection {
enumType_ = other.enumType_.Clone();
extensionRange_ = other.extensionRange_.Clone();
oneofDecl_ = other.oneofDecl_.Clone();
- options_ = other.options_ != null ? other.options_.Clone() : null;
+ Options = other.options_ != null ? other.Options.Clone() : null;
reservedRange_ = other.reservedRange_.Clone();
reservedName_ = other.reservedName_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -916,7 +884,7 @@ namespace Google.Protobuf.Reflection {
if (!object.Equals(Options, other.Options)) return false;
if(!reservedRange_.Equals(other.reservedRange_)) return false;
if(!reservedName_.Equals(other.reservedName_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -932,9 +900,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) hash ^= Options.GetHashCode();
hash ^= reservedRange_.GetHashCode();
hash ^= reservedName_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -961,9 +926,6 @@ namespace Google.Protobuf.Reflection {
oneofDecl_.WriteTo(output, _repeated_oneofDecl_codec);
reservedRange_.WriteTo(output, _repeated_reservedRange_codec);
reservedName_.WriteTo(output, _repeated_reservedName_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -983,9 +945,6 @@ namespace Google.Protobuf.Reflection {
}
size += reservedRange_.CalculateSize(_repeated_reservedRange_codec);
size += reservedName_.CalculateSize(_repeated_reservedName_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1011,7 +970,6 @@ namespace Google.Protobuf.Reflection {
}
reservedRange_.Add(other.reservedRange_);
reservedName_.Add(other.reservedName_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1020,7 +978,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -1075,7 +1033,6 @@ namespace Google.Protobuf.Reflection {
public static partial class Types {
internal sealed partial class ExtensionRange : pb::IMessage<ExtensionRange> {
private static readonly pb::MessageParser<ExtensionRange> _parser = new pb::MessageParser<ExtensionRange>(() => new ExtensionRange());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ExtensionRange> Parser { get { return _parser; } }
@@ -1100,8 +1057,7 @@ namespace Google.Protobuf.Reflection {
public ExtensionRange(ExtensionRange other) : this() {
start_ = other.start_;
end_ = other.end_;
- options_ = other.options_ != null ? other.options_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Options = other.options_ != null ? other.Options.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1158,7 +1114,7 @@ namespace Google.Protobuf.Reflection {
if (Start != other.Start) return false;
if (End != other.End) return false;
if (!object.Equals(Options, other.Options)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1167,9 +1123,6 @@ namespace Google.Protobuf.Reflection {
if (Start != 0) hash ^= Start.GetHashCode();
if (End != 0) hash ^= End.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1192,9 +1145,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(26);
output.WriteMessage(Options);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1209,9 +1159,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1232,7 +1179,6 @@ namespace Google.Protobuf.Reflection {
}
Options.MergeFrom(other.Options);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1241,7 +1187,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Start = input.ReadInt32();
@@ -1271,7 +1217,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class ReservedRange : pb::IMessage<ReservedRange> {
private static readonly pb::MessageParser<ReservedRange> _parser = new pb::MessageParser<ReservedRange>(() => new ReservedRange());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ReservedRange> Parser { get { return _parser; } }
@@ -1296,7 +1241,6 @@ namespace Google.Protobuf.Reflection {
public ReservedRange(ReservedRange other) : this() {
start_ = other.start_;
end_ = other.end_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1347,7 +1291,7 @@ namespace Google.Protobuf.Reflection {
}
if (Start != other.Start) return false;
if (End != other.End) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1355,9 +1299,6 @@ namespace Google.Protobuf.Reflection {
int hash = 1;
if (Start != 0) hash ^= Start.GetHashCode();
if (End != 0) hash ^= End.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1376,9 +1317,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(16);
output.WriteInt32(End);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1390,9 +1328,6 @@ namespace Google.Protobuf.Reflection {
if (End != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1407,7 +1342,6 @@ namespace Google.Protobuf.Reflection {
if (other.End != 0) {
End = other.End;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1416,7 +1350,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Start = input.ReadInt32();
@@ -1439,7 +1373,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class ExtensionRangeOptions : pb::IMessage<ExtensionRangeOptions> {
private static readonly pb::MessageParser<ExtensionRangeOptions> _parser = new pb::MessageParser<ExtensionRangeOptions>(() => new ExtensionRangeOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ExtensionRangeOptions> Parser { get { return _parser; } }
@@ -1463,7 +1396,6 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ExtensionRangeOptions(ExtensionRangeOptions other) : this() {
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1498,16 +1430,13 @@ namespace Google.Protobuf.Reflection {
return true;
}
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1519,18 +1448,12 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1540,7 +1463,6 @@ namespace Google.Protobuf.Reflection {
return;
}
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1549,7 +1471,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 7994: {
uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
@@ -1566,7 +1488,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class FieldDescriptorProto : pb::IMessage<FieldDescriptorProto> {
private static readonly pb::MessageParser<FieldDescriptorProto> _parser = new pb::MessageParser<FieldDescriptorProto>(() => new FieldDescriptorProto());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FieldDescriptorProto> Parser { get { return _parser; } }
@@ -1598,8 +1519,7 @@ namespace Google.Protobuf.Reflection {
defaultValue_ = other.defaultValue_;
oneofIndex_ = other.oneofIndex_;
jsonName_ = other.jsonName_;
- options_ = other.options_ != null ? other.options_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Options = other.options_ != null ? other.Options.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1772,7 +1692,7 @@ namespace Google.Protobuf.Reflection {
if (OneofIndex != other.OneofIndex) return false;
if (JsonName != other.JsonName) return false;
if (!object.Equals(Options, other.Options)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1788,9 +1708,6 @@ namespace Google.Protobuf.Reflection {
if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode();
if (JsonName.Length != 0) hash ^= JsonName.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1841,9 +1758,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(82);
output.WriteString(JsonName);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1879,9 +1793,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1923,7 +1834,6 @@ namespace Google.Protobuf.Reflection {
}
Options.MergeFrom(other.Options);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1932,7 +1842,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -2055,7 +1965,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class OneofDescriptorProto : pb::IMessage<OneofDescriptorProto> {
private static readonly pb::MessageParser<OneofDescriptorProto> _parser = new pb::MessageParser<OneofDescriptorProto>(() => new OneofDescriptorProto());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<OneofDescriptorProto> Parser { get { return _parser; } }
@@ -2079,8 +1988,7 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public OneofDescriptorProto(OneofDescriptorProto other) : this() {
name_ = other.name_;
- options_ = other.options_ != null ? other.options_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Options = other.options_ != null ? other.Options.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2125,7 +2033,7 @@ namespace Google.Protobuf.Reflection {
}
if (Name != other.Name) return false;
if (!object.Equals(Options, other.Options)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2133,9 +2041,6 @@ namespace Google.Protobuf.Reflection {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2154,9 +2059,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(18);
output.WriteMessage(Options);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2168,9 +2070,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2188,7 +2087,6 @@ namespace Google.Protobuf.Reflection {
}
Options.MergeFrom(other.Options);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2197,7 +2095,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -2221,7 +2119,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class EnumDescriptorProto : pb::IMessage<EnumDescriptorProto> {
private static readonly pb::MessageParser<EnumDescriptorProto> _parser = new pb::MessageParser<EnumDescriptorProto>(() => new EnumDescriptorProto());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<EnumDescriptorProto> Parser { get { return _parser; } }
@@ -2246,10 +2143,7 @@ namespace Google.Protobuf.Reflection {
public EnumDescriptorProto(EnumDescriptorProto other) : this() {
name_ = other.name_;
value_ = other.value_.Clone();
- options_ = other.options_ != null ? other.options_.Clone() : null;
- reservedRange_ = other.reservedRange_.Clone();
- reservedName_ = other.reservedName_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Options = other.options_ != null ? other.Options.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2289,35 +2183,6 @@ namespace Google.Protobuf.Reflection {
}
}
- /// <summary>Field number for the "reserved_range" field.</summary>
- public const int ReservedRangeFieldNumber = 4;
- private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange> _repeated_reservedRange_codec
- = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange.Parser);
- private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange> reservedRange_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange>();
- /// <summary>
- /// Range of reserved numeric values. Reserved numeric values may not be used
- /// by enum values in the same enum declaration. Reserved ranges may not
- /// overlap.
- /// </summary>
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange> ReservedRange {
- get { return reservedRange_; }
- }
-
- /// <summary>Field number for the "reserved_name" field.</summary>
- public const int ReservedNameFieldNumber = 5;
- private static readonly pb::FieldCodec<string> _repeated_reservedName_codec
- = pb::FieldCodec.ForString(42);
- private readonly pbc::RepeatedField<string> reservedName_ = new pbc::RepeatedField<string>();
- /// <summary>
- /// Reserved enum value names, which may not be reused. A given name may only
- /// be reserved once.
- /// </summary>
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public pbc::RepeatedField<string> ReservedName {
- get { return reservedName_; }
- }
-
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as EnumDescriptorProto);
@@ -2334,9 +2199,7 @@ namespace Google.Protobuf.Reflection {
if (Name != other.Name) return false;
if(!value_.Equals(other.value_)) return false;
if (!object.Equals(Options, other.Options)) return false;
- if(!reservedRange_.Equals(other.reservedRange_)) return false;
- if(!reservedName_.Equals(other.reservedName_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2345,11 +2208,6 @@ namespace Google.Protobuf.Reflection {
if (Name.Length != 0) hash ^= Name.GetHashCode();
hash ^= value_.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
- hash ^= reservedRange_.GetHashCode();
- hash ^= reservedName_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2369,11 +2227,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(26);
output.WriteMessage(Options);
}
- reservedRange_.WriteTo(output, _repeated_reservedRange_codec);
- reservedName_.WriteTo(output, _repeated_reservedName_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2386,11 +2239,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
- size += reservedRange_.CalculateSize(_repeated_reservedRange_codec);
- size += reservedName_.CalculateSize(_repeated_reservedName_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2409,9 +2257,6 @@ namespace Google.Protobuf.Reflection {
}
Options.MergeFrom(other.Options);
}
- reservedRange_.Add(other.reservedRange_);
- reservedName_.Add(other.reservedName_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2420,7 +2265,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -2437,196 +2282,10 @@ namespace Google.Protobuf.Reflection {
input.ReadMessage(options_);
break;
}
- case 34: {
- reservedRange_.AddEntriesFrom(input, _repeated_reservedRange_codec);
- break;
- }
- case 42: {
- reservedName_.AddEntriesFrom(input, _repeated_reservedName_codec);
- break;
- }
}
}
}
- #region Nested types
- /// <summary>Container for nested types declared in the EnumDescriptorProto message type.</summary>
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static partial class Types {
- /// <summary>
- /// Range of reserved numeric values. Reserved values may not be used by
- /// entries in the same enum. Reserved ranges may not overlap.
- ///
- /// Note that this is distinct from DescriptorProto.ReservedRange in that it
- /// is inclusive such that it can appropriately represent the entire int32
- /// domain.
- /// </summary>
- internal sealed partial class EnumReservedRange : pb::IMessage<EnumReservedRange> {
- private static readonly pb::MessageParser<EnumReservedRange> _parser = new pb::MessageParser<EnumReservedRange>(() => new EnumReservedRange());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser<EnumReservedRange> Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::Google.Protobuf.Reflection.EnumDescriptorProto.Descriptor.NestedTypes[0]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public EnumReservedRange() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public EnumReservedRange(EnumReservedRange other) : this() {
- start_ = other.start_;
- end_ = other.end_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public EnumReservedRange Clone() {
- return new EnumReservedRange(this);
- }
-
- /// <summary>Field number for the "start" field.</summary>
- public const int StartFieldNumber = 1;
- private int start_;
- /// <summary>
- /// Inclusive.
- /// </summary>
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int Start {
- get { return start_; }
- set {
- start_ = value;
- }
- }
-
- /// <summary>Field number for the "end" field.</summary>
- public const int EndFieldNumber = 2;
- private int end_;
- /// <summary>
- /// Inclusive.
- /// </summary>
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int End {
- get { return end_; }
- set {
- end_ = value;
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as EnumReservedRange);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(EnumReservedRange other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (Start != other.Start) return false;
- if (End != other.End) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (Start != 0) hash ^= Start.GetHashCode();
- if (End != 0) hash ^= End.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- if (Start != 0) {
- output.WriteRawTag(8);
- output.WriteInt32(Start);
- }
- if (End != 0) {
- output.WriteRawTag(16);
- output.WriteInt32(End);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (Start != 0) {
- size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start);
- }
- if (End != 0) {
- size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(EnumReservedRange other) {
- if (other == null) {
- return;
- }
- if (other.Start != 0) {
- Start = other.Start;
- }
- if (other.End != 0) {
- End = other.End;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 8: {
- Start = input.ReadInt32();
- break;
- }
- case 16: {
- End = input.ReadInt32();
- break;
- }
- }
- }
- }
-
- }
-
- }
- #endregion
-
}
/// <summary>
@@ -2634,7 +2293,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class EnumValueDescriptorProto : pb::IMessage<EnumValueDescriptorProto> {
private static readonly pb::MessageParser<EnumValueDescriptorProto> _parser = new pb::MessageParser<EnumValueDescriptorProto>(() => new EnumValueDescriptorProto());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<EnumValueDescriptorProto> Parser { get { return _parser; } }
@@ -2659,8 +2317,7 @@ namespace Google.Protobuf.Reflection {
public EnumValueDescriptorProto(EnumValueDescriptorProto other) : this() {
name_ = other.name_;
number_ = other.number_;
- options_ = other.options_ != null ? other.options_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Options = other.options_ != null ? other.Options.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2717,7 +2374,7 @@ namespace Google.Protobuf.Reflection {
if (Name != other.Name) return false;
if (Number != other.Number) return false;
if (!object.Equals(Options, other.Options)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2726,9 +2383,6 @@ namespace Google.Protobuf.Reflection {
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Number != 0) hash ^= Number.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2751,9 +2405,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(26);
output.WriteMessage(Options);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2768,9 +2419,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2791,7 +2439,6 @@ namespace Google.Protobuf.Reflection {
}
Options.MergeFrom(other.Options);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2800,7 +2447,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -2828,7 +2475,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class ServiceDescriptorProto : pb::IMessage<ServiceDescriptorProto> {
private static readonly pb::MessageParser<ServiceDescriptorProto> _parser = new pb::MessageParser<ServiceDescriptorProto>(() => new ServiceDescriptorProto());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ServiceDescriptorProto> Parser { get { return _parser; } }
@@ -2853,8 +2499,7 @@ namespace Google.Protobuf.Reflection {
public ServiceDescriptorProto(ServiceDescriptorProto other) : this() {
name_ = other.name_;
method_ = other.method_.Clone();
- options_ = other.options_ != null ? other.options_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Options = other.options_ != null ? other.Options.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2910,7 +2555,7 @@ namespace Google.Protobuf.Reflection {
if (Name != other.Name) return false;
if(!method_.Equals(other.method_)) return false;
if (!object.Equals(Options, other.Options)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2919,9 +2564,6 @@ namespace Google.Protobuf.Reflection {
if (Name.Length != 0) hash ^= Name.GetHashCode();
hash ^= method_.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -2941,9 +2583,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(26);
output.WriteMessage(Options);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2956,9 +2595,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -2977,7 +2613,6 @@ namespace Google.Protobuf.Reflection {
}
Options.MergeFrom(other.Options);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2986,7 +2621,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -3014,7 +2649,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class MethodDescriptorProto : pb::IMessage<MethodDescriptorProto> {
private static readonly pb::MessageParser<MethodDescriptorProto> _parser = new pb::MessageParser<MethodDescriptorProto>(() => new MethodDescriptorProto());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<MethodDescriptorProto> Parser { get { return _parser; } }
@@ -3040,10 +2674,9 @@ namespace Google.Protobuf.Reflection {
name_ = other.name_;
inputType_ = other.inputType_;
outputType_ = other.outputType_;
- options_ = other.options_ != null ? other.options_.Clone() : null;
+ Options = other.options_ != null ? other.Options.Clone() : null;
clientStreaming_ = other.clientStreaming_;
serverStreaming_ = other.serverStreaming_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3146,7 +2779,7 @@ namespace Google.Protobuf.Reflection {
if (!object.Equals(Options, other.Options)) return false;
if (ClientStreaming != other.ClientStreaming) return false;
if (ServerStreaming != other.ServerStreaming) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3158,9 +2791,6 @@ namespace Google.Protobuf.Reflection {
if (options_ != null) hash ^= Options.GetHashCode();
if (ClientStreaming != false) hash ^= ClientStreaming.GetHashCode();
if (ServerStreaming != false) hash ^= ServerStreaming.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3195,9 +2825,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(48);
output.WriteBool(ServerStreaming);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3221,9 +2848,6 @@ namespace Google.Protobuf.Reflection {
if (ServerStreaming != false) {
size += 1 + 1;
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3253,7 +2877,6 @@ namespace Google.Protobuf.Reflection {
if (other.ServerStreaming != false) {
ServerStreaming = other.ServerStreaming;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3262,7 +2885,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -3299,7 +2922,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class FileOptions : pb::IMessage<FileOptions> {
private static readonly pb::MessageParser<FileOptions> _parser = new pb::MessageParser<FileOptions>(() => new FileOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FileOptions> Parser { get { return _parser; } }
@@ -3342,10 +2964,7 @@ namespace Google.Protobuf.Reflection {
swiftPrefix_ = other.swiftPrefix_;
phpClassPrefix_ = other.phpClassPrefix_;
phpNamespace_ = other.phpNamespace_;
- phpMetadataNamespace_ = other.phpMetadataNamespace_;
- rubyPackage_ = other.rubyPackage_;
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3516,7 +3135,7 @@ namespace Google.Protobuf.Reflection {
}
/// <summary>Field number for the "php_generic_services" field.</summary>
- public const int PhpGenericServicesFieldNumber = 42;
+ public const int PhpGenericServicesFieldNumber = 19;
private bool phpGenericServices_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool PhpGenericServices {
@@ -3635,46 +3254,13 @@ namespace Google.Protobuf.Reflection {
}
}
- /// <summary>Field number for the "php_metadata_namespace" field.</summary>
- public const int PhpMetadataNamespaceFieldNumber = 44;
- private string phpMetadataNamespace_ = "";
- /// <summary>
- /// Use this option to change the namespace of php generated metadata classes.
- /// Default is empty. When this option is empty, the proto file name will be used
- /// for determining the namespace.
- /// </summary>
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public string PhpMetadataNamespace {
- get { return phpMetadataNamespace_; }
- set {
- phpMetadataNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
- }
- }
-
- /// <summary>Field number for the "ruby_package" field.</summary>
- public const int RubyPackageFieldNumber = 45;
- private string rubyPackage_ = "";
- /// <summary>
- /// Use this option to change the package of ruby generated classes. Default
- /// is empty. When this option is not set, the package name will be used for
- /// determining the ruby package.
- /// </summary>
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public string RubyPackage {
- get { return rubyPackage_; }
- set {
- rubyPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
- }
- }
-
/// <summary>Field number for the "uninterpreted_option" field.</summary>
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
= pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
/// <summary>
- /// The parser stores options it doesn't recognize here.
- /// See the documentation for the "Options" section above.
+ /// The parser stores options it doesn't recognize here. See above.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
@@ -3712,10 +3298,8 @@ namespace Google.Protobuf.Reflection {
if (SwiftPrefix != other.SwiftPrefix) return false;
if (PhpClassPrefix != other.PhpClassPrefix) return false;
if (PhpNamespace != other.PhpNamespace) return false;
- if (PhpMetadataNamespace != other.PhpMetadataNamespace) return false;
- if (RubyPackage != other.RubyPackage) return false;
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3739,12 +3323,7 @@ namespace Google.Protobuf.Reflection {
if (SwiftPrefix.Length != 0) hash ^= SwiftPrefix.GetHashCode();
if (PhpClassPrefix.Length != 0) hash ^= PhpClassPrefix.GetHashCode();
if (PhpNamespace.Length != 0) hash ^= PhpNamespace.GetHashCode();
- if (PhpMetadataNamespace.Length != 0) hash ^= PhpMetadataNamespace.GetHashCode();
- if (RubyPackage.Length != 0) hash ^= RubyPackage.GetHashCode();
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -3787,6 +3366,10 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(144, 1);
output.WriteBool(PyGenericServices);
}
+ if (PhpGenericServices != false) {
+ output.WriteRawTag(152, 1);
+ output.WriteBool(PhpGenericServices);
+ }
if (JavaGenerateEqualsAndHash != false) {
output.WriteRawTag(160, 1);
output.WriteBool(JavaGenerateEqualsAndHash);
@@ -3823,22 +3406,7 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(202, 2);
output.WriteString(PhpNamespace);
}
- if (PhpGenericServices != false) {
- output.WriteRawTag(208, 2);
- output.WriteBool(PhpGenericServices);
- }
- if (PhpMetadataNamespace.Length != 0) {
- output.WriteRawTag(226, 2);
- output.WriteString(PhpMetadataNamespace);
- }
- if (RubyPackage.Length != 0) {
- output.WriteRawTag(234, 2);
- output.WriteString(RubyPackage);
- }
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3898,16 +3466,7 @@ namespace Google.Protobuf.Reflection {
if (PhpNamespace.Length != 0) {
size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpNamespace);
}
- if (PhpMetadataNamespace.Length != 0) {
- size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpMetadataNamespace);
- }
- if (RubyPackage.Length != 0) {
- size += 2 + pb::CodedOutputStream.ComputeStringSize(RubyPackage);
- }
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -3970,14 +3529,7 @@ namespace Google.Protobuf.Reflection {
if (other.PhpNamespace.Length != 0) {
PhpNamespace = other.PhpNamespace;
}
- if (other.PhpMetadataNamespace.Length != 0) {
- PhpMetadataNamespace = other.PhpMetadataNamespace;
- }
- if (other.RubyPackage.Length != 0) {
- RubyPackage = other.RubyPackage;
- }
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4020,6 +3572,10 @@ namespace Google.Protobuf.Reflection {
PyGenericServices = input.ReadBool();
break;
}
+ case 152: {
+ PhpGenericServices = input.ReadBool();
+ break;
+ }
case 160: {
JavaGenerateEqualsAndHash = input.ReadBool();
break;
@@ -4056,18 +3612,6 @@ namespace Google.Protobuf.Reflection {
PhpNamespace = input.ReadString();
break;
}
- case 336: {
- PhpGenericServices = input.ReadBool();
- break;
- }
- case 354: {
- PhpMetadataNamespace = input.ReadString();
- break;
- }
- case 362: {
- RubyPackage = input.ReadString();
- break;
- }
case 7994: {
uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
break;
@@ -4105,7 +3649,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class MessageOptions : pb::IMessage<MessageOptions> {
private static readonly pb::MessageParser<MessageOptions> _parser = new pb::MessageParser<MessageOptions>(() => new MessageOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<MessageOptions> Parser { get { return _parser; } }
@@ -4135,7 +3678,6 @@ namespace Google.Protobuf.Reflection {
deprecated_ = other.deprecated_;
mapEntry_ = other.mapEntry_;
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4272,7 +3814,7 @@ namespace Google.Protobuf.Reflection {
if (Deprecated != other.Deprecated) return false;
if (MapEntry != other.MapEntry) return false;
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4283,9 +3825,6 @@ namespace Google.Protobuf.Reflection {
if (Deprecated != false) hash ^= Deprecated.GetHashCode();
if (MapEntry != false) hash ^= MapEntry.GetHashCode();
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4313,9 +3852,6 @@ namespace Google.Protobuf.Reflection {
output.WriteBool(MapEntry);
}
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4334,9 +3870,6 @@ namespace Google.Protobuf.Reflection {
size += 1 + 1;
}
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4358,7 +3891,6 @@ namespace Google.Protobuf.Reflection {
MapEntry = other.MapEntry;
}
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4397,7 +3929,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class FieldOptions : pb::IMessage<FieldOptions> {
private static readonly pb::MessageParser<FieldOptions> _parser = new pb::MessageParser<FieldOptions>(() => new FieldOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FieldOptions> Parser { get { return _parser; } }
@@ -4429,7 +3960,6 @@ namespace Google.Protobuf.Reflection {
deprecated_ = other.deprecated_;
weak_ = other.weak_;
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4600,7 +4130,7 @@ namespace Google.Protobuf.Reflection {
if (Deprecated != other.Deprecated) return false;
if (Weak != other.Weak) return false;
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4613,9 +4143,6 @@ namespace Google.Protobuf.Reflection {
if (Deprecated != false) hash ^= Deprecated.GetHashCode();
if (Weak != false) hash ^= Weak.GetHashCode();
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4651,9 +4178,6 @@ namespace Google.Protobuf.Reflection {
output.WriteBool(Weak);
}
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4678,9 +4202,6 @@ namespace Google.Protobuf.Reflection {
size += 1 + 1;
}
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4708,7 +4229,6 @@ namespace Google.Protobuf.Reflection {
Weak = other.Weak;
}
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4786,7 +4306,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class OneofOptions : pb::IMessage<OneofOptions> {
private static readonly pb::MessageParser<OneofOptions> _parser = new pb::MessageParser<OneofOptions>(() => new OneofOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<OneofOptions> Parser { get { return _parser; } }
@@ -4812,7 +4331,6 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public OneofOptions(OneofOptions other) : this() {
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4847,16 +4365,13 @@ namespace Google.Protobuf.Reflection {
return true;
}
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -4868,18 +4383,12 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -4889,7 +4398,6 @@ namespace Google.Protobuf.Reflection {
return;
}
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4912,7 +4420,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class EnumOptions : pb::IMessage<EnumOptions> {
private static readonly pb::MessageParser<EnumOptions> _parser = new pb::MessageParser<EnumOptions>(() => new EnumOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<EnumOptions> Parser { get { return _parser; } }
@@ -4940,7 +4447,6 @@ namespace Google.Protobuf.Reflection {
allowAlias_ = other.allowAlias_;
deprecated_ = other.deprecated_;
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5009,7 +4515,7 @@ namespace Google.Protobuf.Reflection {
if (AllowAlias != other.AllowAlias) return false;
if (Deprecated != other.Deprecated) return false;
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5018,9 +4524,6 @@ namespace Google.Protobuf.Reflection {
if (AllowAlias != false) hash ^= AllowAlias.GetHashCode();
if (Deprecated != false) hash ^= Deprecated.GetHashCode();
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5040,9 +4543,6 @@ namespace Google.Protobuf.Reflection {
output.WriteBool(Deprecated);
}
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5055,9 +4555,6 @@ namespace Google.Protobuf.Reflection {
size += 1 + 1;
}
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5073,7 +4570,6 @@ namespace Google.Protobuf.Reflection {
Deprecated = other.Deprecated;
}
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5104,7 +4600,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class EnumValueOptions : pb::IMessage<EnumValueOptions> {
private static readonly pb::MessageParser<EnumValueOptions> _parser = new pb::MessageParser<EnumValueOptions>(() => new EnumValueOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<EnumValueOptions> Parser { get { return _parser; } }
@@ -5131,7 +4626,6 @@ namespace Google.Protobuf.Reflection {
public EnumValueOptions(EnumValueOptions other) : this() {
deprecated_ = other.deprecated_;
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5184,7 +4678,7 @@ namespace Google.Protobuf.Reflection {
}
if (Deprecated != other.Deprecated) return false;
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5192,9 +4686,6 @@ namespace Google.Protobuf.Reflection {
int hash = 1;
if (Deprecated != false) hash ^= Deprecated.GetHashCode();
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5210,9 +4701,6 @@ namespace Google.Protobuf.Reflection {
output.WriteBool(Deprecated);
}
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5222,9 +4710,6 @@ namespace Google.Protobuf.Reflection {
size += 1 + 1;
}
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5237,7 +4722,6 @@ namespace Google.Protobuf.Reflection {
Deprecated = other.Deprecated;
}
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5264,7 +4748,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class ServiceOptions : pb::IMessage<ServiceOptions> {
private static readonly pb::MessageParser<ServiceOptions> _parser = new pb::MessageParser<ServiceOptions>(() => new ServiceOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ServiceOptions> Parser { get { return _parser; } }
@@ -5291,7 +4774,6 @@ namespace Google.Protobuf.Reflection {
public ServiceOptions(ServiceOptions other) : this() {
deprecated_ = other.deprecated_;
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5344,7 +4826,7 @@ namespace Google.Protobuf.Reflection {
}
if (Deprecated != other.Deprecated) return false;
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5352,9 +4834,6 @@ namespace Google.Protobuf.Reflection {
int hash = 1;
if (Deprecated != false) hash ^= Deprecated.GetHashCode();
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5370,9 +4849,6 @@ namespace Google.Protobuf.Reflection {
output.WriteBool(Deprecated);
}
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5382,9 +4858,6 @@ namespace Google.Protobuf.Reflection {
size += 2 + 1;
}
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5397,7 +4870,6 @@ namespace Google.Protobuf.Reflection {
Deprecated = other.Deprecated;
}
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5424,7 +4896,6 @@ namespace Google.Protobuf.Reflection {
internal sealed partial class MethodOptions : pb::IMessage<MethodOptions> {
private static readonly pb::MessageParser<MethodOptions> _parser = new pb::MessageParser<MethodOptions>(() => new MethodOptions());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<MethodOptions> Parser { get { return _parser; } }
@@ -5452,7 +4923,6 @@ namespace Google.Protobuf.Reflection {
deprecated_ = other.deprecated_;
idempotencyLevel_ = other.idempotencyLevel_;
uninterpretedOption_ = other.uninterpretedOption_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5517,7 +4987,7 @@ namespace Google.Protobuf.Reflection {
if (Deprecated != other.Deprecated) return false;
if (IdempotencyLevel != other.IdempotencyLevel) return false;
if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5526,9 +4996,6 @@ namespace Google.Protobuf.Reflection {
if (Deprecated != false) hash ^= Deprecated.GetHashCode();
if (IdempotencyLevel != 0) hash ^= IdempotencyLevel.GetHashCode();
hash ^= uninterpretedOption_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5548,9 +5015,6 @@ namespace Google.Protobuf.Reflection {
output.WriteEnum((int) IdempotencyLevel);
}
uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5563,9 +5027,6 @@ namespace Google.Protobuf.Reflection {
size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) IdempotencyLevel);
}
size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5581,7 +5042,6 @@ namespace Google.Protobuf.Reflection {
IdempotencyLevel = other.IdempotencyLevel;
}
uninterpretedOption_.Add(other.uninterpretedOption_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5644,7 +5104,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class UninterpretedOption : pb::IMessage<UninterpretedOption> {
private static readonly pb::MessageParser<UninterpretedOption> _parser = new pb::MessageParser<UninterpretedOption>(() => new UninterpretedOption());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<UninterpretedOption> Parser { get { return _parser; } }
@@ -5674,7 +5133,6 @@ namespace Google.Protobuf.Reflection {
doubleValue_ = other.doubleValue_;
stringValue_ = other.stringValue_;
aggregateValue_ = other.aggregateValue_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5779,10 +5237,10 @@ namespace Google.Protobuf.Reflection {
if (IdentifierValue != other.IdentifierValue) return false;
if (PositiveIntValue != other.PositiveIntValue) return false;
if (NegativeIntValue != other.NegativeIntValue) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(DoubleValue, other.DoubleValue)) return false;
+ if (DoubleValue != other.DoubleValue) return false;
if (StringValue != other.StringValue) return false;
if (AggregateValue != other.AggregateValue) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5792,12 +5250,9 @@ namespace Google.Protobuf.Reflection {
if (IdentifierValue.Length != 0) hash ^= IdentifierValue.GetHashCode();
if (PositiveIntValue != 0UL) hash ^= PositiveIntValue.GetHashCode();
if (NegativeIntValue != 0L) hash ^= NegativeIntValue.GetHashCode();
- if (DoubleValue != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DoubleValue);
+ if (DoubleValue != 0D) hash ^= DoubleValue.GetHashCode();
if (StringValue.Length != 0) hash ^= StringValue.GetHashCode();
if (AggregateValue.Length != 0) hash ^= AggregateValue.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -5833,9 +5288,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(66);
output.WriteString(AggregateValue);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5860,9 +5312,6 @@ namespace Google.Protobuf.Reflection {
if (AggregateValue.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(AggregateValue);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -5890,7 +5339,6 @@ namespace Google.Protobuf.Reflection {
if (other.AggregateValue.Length != 0) {
AggregateValue = other.AggregateValue;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5899,7 +5347,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 18: {
name_.AddEntriesFrom(input, _repeated_name_codec);
@@ -5946,7 +5394,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class NamePart : pb::IMessage<NamePart> {
private static readonly pb::MessageParser<NamePart> _parser = new pb::MessageParser<NamePart>(() => new NamePart());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<NamePart> Parser { get { return _parser; } }
@@ -5971,7 +5418,6 @@ namespace Google.Protobuf.Reflection {
public NamePart(NamePart other) : this() {
namePart_ = other.namePart_;
isExtension_ = other.isExtension_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6016,7 +5462,7 @@ namespace Google.Protobuf.Reflection {
}
if (NamePart_ != other.NamePart_) return false;
if (IsExtension != other.IsExtension) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6024,9 +5470,6 @@ namespace Google.Protobuf.Reflection {
int hash = 1;
if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode();
if (IsExtension != false) hash ^= IsExtension.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6045,9 +5488,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(16);
output.WriteBool(IsExtension);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6059,9 +5499,6 @@ namespace Google.Protobuf.Reflection {
if (IsExtension != false) {
size += 1 + 1;
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6076,7 +5513,6 @@ namespace Google.Protobuf.Reflection {
if (other.IsExtension != false) {
IsExtension = other.IsExtension;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6085,7 +5521,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
NamePart_ = input.ReadString();
@@ -6112,7 +5548,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class SourceCodeInfo : pb::IMessage<SourceCodeInfo> {
private static readonly pb::MessageParser<SourceCodeInfo> _parser = new pb::MessageParser<SourceCodeInfo>(() => new SourceCodeInfo());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<SourceCodeInfo> Parser { get { return _parser; } }
@@ -6136,7 +5571,6 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public SourceCodeInfo(SourceCodeInfo other) : this() {
location_ = other.location_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6213,16 +5647,13 @@ namespace Google.Protobuf.Reflection {
return true;
}
if(!location_.Equals(other.location_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= location_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6234,18 +5665,12 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
location_.WriteTo(output, _repeated_location_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += location_.CalculateSize(_repeated_location_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6255,7 +5680,6 @@ namespace Google.Protobuf.Reflection {
return;
}
location_.Add(other.location_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6264,7 +5688,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
location_.AddEntriesFrom(input, _repeated_location_codec);
@@ -6280,7 +5704,6 @@ namespace Google.Protobuf.Reflection {
public static partial class Types {
internal sealed partial class Location : pb::IMessage<Location> {
private static readonly pb::MessageParser<Location> _parser = new pb::MessageParser<Location>(() => new Location());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Location> Parser { get { return _parser; } }
@@ -6308,7 +5731,6 @@ namespace Google.Protobuf.Reflection {
leadingComments_ = other.leadingComments_;
trailingComments_ = other.trailingComments_;
leadingDetachedComments_ = other.leadingDetachedComments_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6467,7 +5889,7 @@ namespace Google.Protobuf.Reflection {
if (LeadingComments != other.LeadingComments) return false;
if (TrailingComments != other.TrailingComments) return false;
if(!leadingDetachedComments_.Equals(other.leadingDetachedComments_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6478,9 +5900,6 @@ namespace Google.Protobuf.Reflection {
if (LeadingComments.Length != 0) hash ^= LeadingComments.GetHashCode();
if (TrailingComments.Length != 0) hash ^= TrailingComments.GetHashCode();
hash ^= leadingDetachedComments_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6502,9 +5921,6 @@ namespace Google.Protobuf.Reflection {
output.WriteString(TrailingComments);
}
leadingDetachedComments_.WriteTo(output, _repeated_leadingDetachedComments_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6519,9 +5935,6 @@ namespace Google.Protobuf.Reflection {
size += 1 + pb::CodedOutputStream.ComputeStringSize(TrailingComments);
}
size += leadingDetachedComments_.CalculateSize(_repeated_leadingDetachedComments_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6539,7 +5952,6 @@ namespace Google.Protobuf.Reflection {
TrailingComments = other.TrailingComments;
}
leadingDetachedComments_.Add(other.leadingDetachedComments_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6548,7 +5960,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10:
case 8: {
@@ -6590,7 +6002,6 @@ namespace Google.Protobuf.Reflection {
/// </summary>
internal sealed partial class GeneratedCodeInfo : pb::IMessage<GeneratedCodeInfo> {
private static readonly pb::MessageParser<GeneratedCodeInfo> _parser = new pb::MessageParser<GeneratedCodeInfo>(() => new GeneratedCodeInfo());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<GeneratedCodeInfo> Parser { get { return _parser; } }
@@ -6614,7 +6025,6 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GeneratedCodeInfo(GeneratedCodeInfo other) : this() {
annotation_ = other.annotation_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6650,16 +6060,13 @@ namespace Google.Protobuf.Reflection {
return true;
}
if(!annotation_.Equals(other.annotation_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= annotation_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6671,18 +6078,12 @@ namespace Google.Protobuf.Reflection {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
annotation_.WriteTo(output, _repeated_annotation_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += annotation_.CalculateSize(_repeated_annotation_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6692,7 +6093,6 @@ namespace Google.Protobuf.Reflection {
return;
}
annotation_.Add(other.annotation_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6701,7 +6101,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
annotation_.AddEntriesFrom(input, _repeated_annotation_codec);
@@ -6717,7 +6117,6 @@ namespace Google.Protobuf.Reflection {
public static partial class Types {
internal sealed partial class Annotation : pb::IMessage<Annotation> {
private static readonly pb::MessageParser<Annotation> _parser = new pb::MessageParser<Annotation>(() => new Annotation());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Annotation> Parser { get { return _parser; } }
@@ -6744,7 +6143,6 @@ namespace Google.Protobuf.Reflection {
sourceFile_ = other.sourceFile_;
begin_ = other.begin_;
end_ = other.end_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6828,7 +6226,7 @@ namespace Google.Protobuf.Reflection {
if (SourceFile != other.SourceFile) return false;
if (Begin != other.Begin) return false;
if (End != other.End) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6838,9 +6236,6 @@ namespace Google.Protobuf.Reflection {
if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode();
if (Begin != 0) hash ^= Begin.GetHashCode();
if (End != 0) hash ^= End.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -6864,9 +6259,6 @@ namespace Google.Protobuf.Reflection {
output.WriteRawTag(32);
output.WriteInt32(End);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6882,9 +6274,6 @@ namespace Google.Protobuf.Reflection {
if (End != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -6903,7 +6292,6 @@ namespace Google.Protobuf.Reflection {
if (other.End != 0) {
End = other.End;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6912,7 +6300,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10:
case 8: {
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs
index 194041a889..194041a889 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
index 99ca4bf34f..99ca4bf34f 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs
index f5570fc40a..f5570fc40a 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs
index 143671dbd4..143671dbd4 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
index 89c73a61b2..89c73a61b2 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
index 8b838c68f0..8b838c68f0 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs
index 82ce50518d..82ce50518d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
index 2a3d5c7a2d..2a3d5c7a2d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldType.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldType.cs
index 1658e34cd1..1658e34cd1 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FieldType.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FieldType.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
index be94cb100e..9124beee04 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
@@ -30,7 +30,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-using Google.Protobuf.WellKnownTypes;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -44,16 +43,6 @@ namespace Google.Protobuf.Reflection
/// </summary>
public sealed class FileDescriptor : IDescriptor
{
- // Prevent linker failures when using IL2CPP with the well-known types.
- static FileDescriptor()
- {
- ForceReflectionInitialization<Syntax>();
- ForceReflectionInitialization<NullValue>();
- ForceReflectionInitialization<Field.Types.Cardinality>();
- ForceReflectionInitialization<Field.Types.Kind>();
- ForceReflectionInitialization<Value.KindOneofCase>();
- }
-
private FileDescriptor(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool, bool allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo)
{
SerializedData = descriptorData;
@@ -345,18 +334,5 @@ namespace Google.Protobuf.Reflection
/// The (possibly empty) set of custom options for this file.
/// </summary>
public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty;
-
- /// <summary>
- /// Performs initialization for the given generic type argument.
- /// </summary>
- /// <remarks>
- /// This method is present for the sake of AOT compilers. It allows code (whether handwritten or generated)
- /// to make calls into the reflection machinery of this library to express an intention to use that type
- /// reflectively (e.g. for JSON parsing and formatting). The call itself does almost nothing, but AOT compilers
- /// attempting to determine which generic type arguments need to be handled will spot the code path and act
- /// accordingly.
- /// </remarks>
- /// <typeparam name="T">The type to force initialization for.</typeparam>
- public static void ForceReflectionInitialization<T>() => ReflectionUtil.ForceInitialize<T>();
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs
index fe5db65656..fe5db65656 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs
index 318d58c968..318d58c968 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs
index cfe56fde67..cfe56fde67 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs
index 9ed7f8c4df..9ed7f8c4df 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
index 86942acc02..86942acc02 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
index 19d7f8a092..19d7f8a092 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs
index 9759621879..8714ab18ef 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs
@@ -52,7 +52,7 @@ namespace Google.Protobuf.Reflection
throw new ArgumentException("Cannot read from property");
}
this.descriptor = descriptor;
- caseDelegate = ReflectionUtil.CreateFuncIMessageInt32(caseProperty.GetGetMethod());
+ caseDelegate = ReflectionUtil.CreateFuncIMessageT<int>(caseProperty.GetGetMethod());
this.descriptor = descriptor;
clearDelegate = ReflectionUtil.CreateActionIMessage(clearMethod);
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
index 5906c2e36d..5906c2e36d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs
index 07d0fd99af..07d0fd99af 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
index e547d83498..e547d83498 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs
index 6c285410d4..6c285410d4 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs
diff --git a/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs
new file mode 100644
index 0000000000..df820ca36b
--- /dev/null
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs
@@ -0,0 +1,107 @@
+#region Copyright notice and license
+// 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.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Reflection;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// The methods in this class are somewhat evil, and should not be tampered with lightly.
+ /// Basically they allow the creation of relatively weakly typed delegates from MethodInfos
+ /// which are more strongly typed. They do this by creating an appropriate strongly typed
+ /// delegate from the MethodInfo, and then calling that within an anonymous method.
+ /// Mind-bending stuff (at least to your humble narrator) but the resulting delegates are
+ /// very fast compared with calling Invoke later on.
+ /// </summary>
+ internal static class ReflectionUtil
+ {
+ /// <summary>
+ /// Empty Type[] used when calling GetProperty to force property instead of indexer fetching.
+ /// </summary>
+ internal static readonly Type[] EmptyTypes = new Type[0];
+
+ /// <summary>
+ /// Creates a delegate which will cast the argument to the appropriate method target type,
+ /// call the method on it, then convert the result to object.
+ /// </summary>
+ internal static Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method)
+ {
+ ParameterExpression parameter = Expression.Parameter(typeof(IMessage), "p");
+ Expression downcast = Expression.Convert(parameter, method.DeclaringType);
+ Expression call = Expression.Call(downcast, method);
+ Expression upcast = Expression.Convert(call, typeof(object));
+ return Expression.Lambda<Func<IMessage, object>>(upcast, parameter).Compile();
+ }
+
+ /// <summary>
+ /// Creates a delegate which will cast the argument to the appropriate method target type,
+ /// call the method on it, then convert the result to the specified type.
+ /// </summary>
+ internal static Func<IMessage, T> CreateFuncIMessageT<T>(MethodInfo method)
+ {
+ ParameterExpression parameter = Expression.Parameter(typeof(IMessage), "p");
+ Expression downcast = Expression.Convert(parameter, method.DeclaringType);
+ Expression call = Expression.Call(downcast, method);
+ Expression upcast = Expression.Convert(call, typeof(T));
+ return Expression.Lambda<Func<IMessage, T>>(upcast, parameter).Compile();
+ }
+
+ /// <summary>
+ /// Creates a delegate which will execute the given method after casting the first argument to
+ /// the target type of the method, and the second argument to the first parameter type of the method.
+ /// </summary>
+ internal static Action<IMessage, object> CreateActionIMessageObject(MethodInfo method)
+ {
+ ParameterExpression targetParameter = Expression.Parameter(typeof(IMessage), "target");
+ ParameterExpression argParameter = Expression.Parameter(typeof(object), "arg");
+ Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType);
+ Expression castArgument = Expression.Convert(argParameter, method.GetParameters()[0].ParameterType);
+ Expression call = Expression.Call(castTarget, method, castArgument);
+ return Expression.Lambda<Action<IMessage, object>>(call, targetParameter, argParameter).Compile();
+ }
+
+ /// <summary>
+ /// Creates a delegate which will execute the given method after casting the first argument to
+ /// the target type of the method.
+ /// </summary>
+ internal static Action<IMessage> CreateActionIMessage(MethodInfo method)
+ {
+ ParameterExpression targetParameter = Expression.Parameter(typeof(IMessage), "target");
+ Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType);
+ Expression call = Expression.Call(castTarget, method);
+ return Expression.Lambda<Action<IMessage>>(call, targetParameter).Compile();
+ }
+ }
+} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs
index bd40847092..bd40847092 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs
index fe5c072c8e..fe5c072c8e 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
index bbac2173d4..bbac2173d4 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs
index e94e3e6c60..e94e3e6c60 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
index 378b61d4ba..5b39b80906 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/any.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/any.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -121,7 +119,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Any : pb::IMessage<Any> {
private static readonly pb::MessageParser<Any> _parser = new pb::MessageParser<Any>(() => new Any());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Any> Parser { get { return _parser; } }
@@ -146,7 +143,6 @@ namespace Google.Protobuf.WellKnownTypes {
public Any(Any other) : this() {
typeUrl_ = other.typeUrl_;
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -158,18 +154,17 @@ namespace Google.Protobuf.WellKnownTypes {
public const int TypeUrlFieldNumber = 1;
private string typeUrl_ = "";
/// <summary>
- /// 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).
+ /// A URL/resource name whose content describes the type of the
+ /// serialized protocol buffer message.
///
- /// 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:
+ /// For URLs which use the scheme `http`, `https`, or no scheme, the
+ /// following restrictions and interpretations apply:
///
/// * 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
@@ -178,10 +173,6 @@ 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>
@@ -222,7 +213,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
if (TypeUrl != other.TypeUrl) return false;
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -230,9 +221,6 @@ namespace Google.Protobuf.WellKnownTypes {
int hash = 1;
if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode();
if (Value.Length != 0) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -251,9 +239,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(18);
output.WriteBytes(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -265,9 +250,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -282,7 +264,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value.Length != 0) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -291,7 +272,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
TypeUrl = input.ReadString();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs
index fca689dc08..fca689dc08 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
index e4a4a36544..6705e092e5 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/api.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/api.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -66,7 +64,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Api : pb::IMessage<Api> {
private static readonly pb::MessageParser<Api> _parser = new pb::MessageParser<Api>(() => new Api());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Api> Parser { get { return _parser; } }
@@ -93,10 +90,9 @@ namespace Google.Protobuf.WellKnownTypes {
methods_ = other.methods_.Clone();
options_ = other.options_.Clone();
version_ = other.version_;
- sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null;
+ SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null;
mixins_ = other.mixins_.Clone();
syntax_ = other.syntax_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -239,7 +235,7 @@ namespace Google.Protobuf.WellKnownTypes {
if (!object.Equals(SourceContext, other.SourceContext)) return false;
if(!mixins_.Equals(other.mixins_)) return false;
if (Syntax != other.Syntax) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -252,9 +248,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (sourceContext_ != null) hash ^= SourceContext.GetHashCode();
hash ^= mixins_.GetHashCode();
if (Syntax != 0) hash ^= Syntax.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -284,9 +277,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(56);
output.WriteEnum((int) Syntax);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -307,9 +297,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Syntax != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -336,7 +323,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Syntax != 0) {
Syntax = other.Syntax;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -345,7 +331,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -389,7 +375,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Method : pb::IMessage<Method> {
private static readonly pb::MessageParser<Method> _parser = new pb::MessageParser<Method>(() => new Method());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Method> Parser { get { return _parser; } }
@@ -419,7 +404,6 @@ namespace Google.Protobuf.WellKnownTypes {
responseStreaming_ = other.responseStreaming_;
options_ = other.options_.Clone();
syntax_ = other.syntax_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -544,7 +528,7 @@ namespace Google.Protobuf.WellKnownTypes {
if (ResponseStreaming != other.ResponseStreaming) return false;
if(!options_.Equals(other.options_)) return false;
if (Syntax != other.Syntax) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -557,9 +541,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (ResponseStreaming != false) hash ^= ResponseStreaming.GetHashCode();
hash ^= options_.GetHashCode();
if (Syntax != 0) hash ^= Syntax.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -595,9 +576,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(56);
output.WriteEnum((int) Syntax);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -622,9 +600,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Syntax != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -652,7 +627,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Syntax != 0) {
Syntax = other.Syntax;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -661,7 +635,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -779,7 +753,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Mixin : pb::IMessage<Mixin> {
private static readonly pb::MessageParser<Mixin> _parser = new pb::MessageParser<Mixin>(() => new Mixin());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Mixin> Parser { get { return _parser; } }
@@ -804,7 +777,6 @@ namespace Google.Protobuf.WellKnownTypes {
public Mixin(Mixin other) : this() {
name_ = other.name_;
root_ = other.root_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -856,7 +828,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
if (Name != other.Name) return false;
if (Root != other.Root) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -864,9 +836,6 @@ namespace Google.Protobuf.WellKnownTypes {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Root.Length != 0) hash ^= Root.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -885,9 +854,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(18);
output.WriteString(Root);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -899,9 +865,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Root.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Root);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -916,7 +879,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Root.Length != 0) {
Root = other.Root;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -925,7 +887,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
index 2858b532b6..94159cb84c 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/duration.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/duration.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -102,7 +100,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Duration : pb::IMessage<Duration> {
private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Duration> Parser { get { return _parser; } }
@@ -127,7 +124,6 @@ namespace Google.Protobuf.WellKnownTypes {
public Duration(Duration other) : this() {
seconds_ = other.seconds_;
nanos_ = other.nanos_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -185,7 +181,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
if (Seconds != other.Seconds) return false;
if (Nanos != other.Nanos) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -193,9 +189,6 @@ namespace Google.Protobuf.WellKnownTypes {
int hash = 1;
if (Seconds != 0L) hash ^= Seconds.GetHashCode();
if (Nanos != 0) hash ^= Nanos.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -214,9 +207,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(16);
output.WriteInt32(Nanos);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -228,9 +218,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Nanos != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -245,7 +232,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Nanos != 0) {
Nanos = other.Nanos;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -254,7 +240,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Seconds = input.ReadInt64();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs
index f164bfd19d..f164bfd19d 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
index 2113add9bc..aa89e08f59 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/empty.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/empty.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -52,7 +50,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Empty : pb::IMessage<Empty> {
private static readonly pb::MessageParser<Empty> _parser = new pb::MessageParser<Empty>(() => new Empty());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Empty> Parser { get { return _parser; } }
@@ -75,7 +72,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Empty(Empty other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -96,15 +92,12 @@ namespace Google.Protobuf.WellKnownTypes {
if (ReferenceEquals(other, this)) {
return true;
}
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -115,17 +108,11 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -134,7 +121,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other == null) {
return;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -143,7 +129,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
}
}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
index b73930b288..ef3bc10af7 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/field_mask.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/field_mask.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -241,16 +239,9 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// Note that oneof type names ("test_oneof" in this case) cannot be used in
/// paths.
- ///
- /// ## Field Mask Verification
- ///
- /// The implementation of any API method which has a FieldMask type field in the
- /// request should verify the included field paths, and return an
- /// `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
/// </summary>
public sealed partial class FieldMask : pb::IMessage<FieldMask> {
private static readonly pb::MessageParser<FieldMask> _parser = new pb::MessageParser<FieldMask>(() => new FieldMask());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FieldMask> Parser { get { return _parser; } }
@@ -274,7 +265,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FieldMask(FieldMask other) : this() {
paths_ = other.paths_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -309,16 +299,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if(!paths_.Equals(other.paths_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= paths_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -330,18 +317,12 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
paths_.WriteTo(output, _repeated_paths_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += paths_.CalculateSize(_repeated_paths_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -351,7 +332,6 @@ namespace Google.Protobuf.WellKnownTypes {
return;
}
paths_.Add(other.paths_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -360,7 +340,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
paths_.AddEntriesFrom(input, _repeated_paths_codec);
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
index 4b0670f6fd..4b0670f6fd 100644..100755
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
index 124ddaa712..6ddadf19ae 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/source_context.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/source_context.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -46,7 +44,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class SourceContext : pb::IMessage<SourceContext> {
private static readonly pb::MessageParser<SourceContext> _parser = new pb::MessageParser<SourceContext>(() => new SourceContext());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<SourceContext> Parser { get { return _parser; } }
@@ -70,7 +67,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public SourceContext(SourceContext other) : this() {
fileName_ = other.fileName_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -107,16 +103,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (FileName != other.FileName) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (FileName.Length != 0) hash ^= FileName.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -131,9 +124,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(10);
output.WriteString(FileName);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -142,9 +132,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (FileName.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(FileName);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -156,7 +143,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.FileName.Length != 0) {
FileName = other.FileName;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -165,7 +151,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
FileName = input.ReadString();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
index 194b81e965..1fa3552155 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/struct.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/struct.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -79,7 +77,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Struct : pb::IMessage<Struct> {
private static readonly pb::MessageParser<Struct> _parser = new pb::MessageParser<Struct>(() => new Struct());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Struct> Parser { get { return _parser; } }
@@ -103,7 +100,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Struct(Struct other) : this() {
fields_ = other.fields_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -138,16 +134,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (!Fields.Equals(other.Fields)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= Fields.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -159,18 +152,12 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
fields_.WriteTo(output, _map_fields_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += fields_.CalculateSize(_map_fields_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -180,7 +167,6 @@ namespace Google.Protobuf.WellKnownTypes {
return;
}
fields_.Add(other.fields_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -189,7 +175,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
fields_.AddEntriesFrom(input, _map_fields_codec);
@@ -211,7 +197,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Value : pb::IMessage<Value> {
private static readonly pb::MessageParser<Value> _parser = new pb::MessageParser<Value>(() => new Value());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Value> Parser { get { return _parser; } }
@@ -255,7 +240,6 @@ namespace Google.Protobuf.WellKnownTypes {
break;
}
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -384,28 +368,25 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (NullValue != other.NullValue) return false;
- if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(NumberValue, other.NumberValue)) return false;
+ if (NumberValue != other.NumberValue) return false;
if (StringValue != other.StringValue) return false;
if (BoolValue != other.BoolValue) return false;
if (!object.Equals(StructValue, other.StructValue)) return false;
if (!object.Equals(ListValue, other.ListValue)) return false;
if (KindCase != other.KindCase) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (kindCase_ == KindOneofCase.NullValue) hash ^= NullValue.GetHashCode();
- if (kindCase_ == KindOneofCase.NumberValue) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(NumberValue);
+ if (kindCase_ == KindOneofCase.NumberValue) hash ^= NumberValue.GetHashCode();
if (kindCase_ == KindOneofCase.StringValue) hash ^= StringValue.GetHashCode();
if (kindCase_ == KindOneofCase.BoolValue) hash ^= BoolValue.GetHashCode();
if (kindCase_ == KindOneofCase.StructValue) hash ^= StructValue.GetHashCode();
if (kindCase_ == KindOneofCase.ListValue) hash ^= ListValue.GetHashCode();
hash ^= (int) kindCase_;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -440,9 +421,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(50);
output.WriteMessage(ListValue);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -466,9 +444,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (kindCase_ == KindOneofCase.ListValue) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ListValue);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -491,20 +466,13 @@ namespace Google.Protobuf.WellKnownTypes {
BoolValue = other.BoolValue;
break;
case KindOneofCase.StructValue:
- if (StructValue == null) {
- StructValue = new global::Google.Protobuf.WellKnownTypes.Struct();
- }
- StructValue.MergeFrom(other.StructValue);
+ StructValue = other.StructValue;
break;
case KindOneofCase.ListValue:
- if (ListValue == null) {
- ListValue = new global::Google.Protobuf.WellKnownTypes.ListValue();
- }
- ListValue.MergeFrom(other.ListValue);
+ ListValue = other.ListValue;
break;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -513,7 +481,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
kind_ = input.ReadEnum();
@@ -563,7 +531,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class ListValue : pb::IMessage<ListValue> {
private static readonly pb::MessageParser<ListValue> _parser = new pb::MessageParser<ListValue>(() => new ListValue());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<ListValue> Parser { get { return _parser; } }
@@ -587,7 +554,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ListValue(ListValue other) : this() {
values_ = other.values_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -622,16 +588,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if(!values_.Equals(other.values_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= values_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -643,18 +606,12 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
values_.WriteTo(output, _repeated_values_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += values_.CalculateSize(_repeated_values_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -664,7 +621,6 @@ namespace Google.Protobuf.WellKnownTypes {
return;
}
values_.Add(other.values_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -673,7 +629,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
values_.AddEntriesFrom(input, _repeated_values_codec);
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs
index 8b63d63035..8b63d63035 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
index ef752be7cb..911f797e01 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/timestamp.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/timestamp.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -103,9 +101,7 @@ 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. 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).
+ /// is required, though only UTC (as indicated by "Z") is presently supported.
///
/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
/// 01:30 UTC on January 15, 2017.
@@ -116,12 +112,11 @@ 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://joda-time.sourceforge.net/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());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Timestamp> Parser { get { return _parser; } }
@@ -146,7 +141,6 @@ namespace Google.Protobuf.WellKnownTypes {
public Timestamp(Timestamp other) : this() {
seconds_ = other.seconds_;
nanos_ = other.nanos_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -202,7 +196,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
if (Seconds != other.Seconds) return false;
if (Nanos != other.Nanos) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -210,9 +204,6 @@ namespace Google.Protobuf.WellKnownTypes {
int hash = 1;
if (Seconds != 0L) hash ^= Seconds.GetHashCode();
if (Nanos != 0) hash ^= Nanos.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -231,9 +222,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(16);
output.WriteInt32(Nanos);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -245,9 +233,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Nanos != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -262,7 +247,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Nanos != 0) {
Nanos = other.Nanos;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -271,7 +255,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Seconds = input.ReadInt64();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs
index aa40347342..aa40347342 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
index 3e2fe541f8..7375b6cb18 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/type.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/type.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -96,7 +94,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Type : pb::IMessage<Type> {
private static readonly pb::MessageParser<Type> _parser = new pb::MessageParser<Type>(() => new Type());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Type> Parser { get { return _parser; } }
@@ -123,9 +120,8 @@ namespace Google.Protobuf.WellKnownTypes {
fields_ = other.fields_.Clone();
oneofs_ = other.oneofs_.Clone();
options_ = other.options_.Clone();
- sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null;
+ SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null;
syntax_ = other.syntax_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -233,7 +229,7 @@ namespace Google.Protobuf.WellKnownTypes {
if(!options_.Equals(other.options_)) return false;
if (!object.Equals(SourceContext, other.SourceContext)) return false;
if (Syntax != other.Syntax) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -245,9 +241,6 @@ namespace Google.Protobuf.WellKnownTypes {
hash ^= options_.GetHashCode();
if (sourceContext_ != null) hash ^= SourceContext.GetHashCode();
if (Syntax != 0) hash ^= Syntax.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -273,9 +266,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(48);
output.WriteEnum((int) Syntax);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -293,9 +283,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Syntax != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -319,7 +306,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Syntax != 0) {
Syntax = other.Syntax;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -328,7 +314,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -368,7 +354,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Field : pb::IMessage<Field> {
private static readonly pb::MessageParser<Field> _parser = new pb::MessageParser<Field>(() => new Field());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Field> Parser { get { return _parser; } }
@@ -401,7 +386,6 @@ namespace Google.Protobuf.WellKnownTypes {
options_ = other.options_.Clone();
jsonName_ = other.jsonName_;
defaultValue_ = other.defaultValue_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -573,7 +557,7 @@ namespace Google.Protobuf.WellKnownTypes {
if(!options_.Equals(other.options_)) return false;
if (JsonName != other.JsonName) return false;
if (DefaultValue != other.DefaultValue) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -589,9 +573,6 @@ namespace Google.Protobuf.WellKnownTypes {
hash ^= options_.GetHashCode();
if (JsonName.Length != 0) hash ^= JsonName.GetHashCode();
if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -639,9 +620,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(90);
output.WriteString(DefaultValue);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -675,9 +653,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (DefaultValue.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -714,7 +689,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.DefaultValue.Length != 0) {
DefaultValue = other.DefaultValue;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -723,7 +697,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
kind_ = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum();
@@ -887,7 +861,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Enum : pb::IMessage<Enum> {
private static readonly pb::MessageParser<Enum> _parser = new pb::MessageParser<Enum>(() => new Enum());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Enum> Parser { get { return _parser; } }
@@ -913,9 +886,8 @@ namespace Google.Protobuf.WellKnownTypes {
name_ = other.name_;
enumvalue_ = other.enumvalue_.Clone();
options_ = other.options_.Clone();
- sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null;
+ SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null;
syntax_ = other.syntax_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1009,7 +981,7 @@ namespace Google.Protobuf.WellKnownTypes {
if(!options_.Equals(other.options_)) return false;
if (!object.Equals(SourceContext, other.SourceContext)) return false;
if (Syntax != other.Syntax) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1020,9 +992,6 @@ namespace Google.Protobuf.WellKnownTypes {
hash ^= options_.GetHashCode();
if (sourceContext_ != null) hash ^= SourceContext.GetHashCode();
if (Syntax != 0) hash ^= Syntax.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1047,9 +1016,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(40);
output.WriteEnum((int) Syntax);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1066,9 +1032,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Syntax != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1091,7 +1054,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Syntax != 0) {
Syntax = other.Syntax;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1100,7 +1062,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -1136,7 +1098,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class EnumValue : pb::IMessage<EnumValue> {
private static readonly pb::MessageParser<EnumValue> _parser = new pb::MessageParser<EnumValue>(() => new EnumValue());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<EnumValue> Parser { get { return _parser; } }
@@ -1162,7 +1123,6 @@ namespace Google.Protobuf.WellKnownTypes {
name_ = other.name_;
number_ = other.number_;
options_ = other.options_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1227,7 +1187,7 @@ namespace Google.Protobuf.WellKnownTypes {
if (Name != other.Name) return false;
if (Number != other.Number) return false;
if(!options_.Equals(other.options_)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1236,9 +1196,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Number != 0) hash ^= Number.GetHashCode();
hash ^= options_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1258,9 +1215,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteInt32(Number);
}
options_.WriteTo(output, _repeated_options_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1273,9 +1227,6 @@ namespace Google.Protobuf.WellKnownTypes {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number);
}
size += options_.CalculateSize(_repeated_options_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1291,7 +1242,6 @@ namespace Google.Protobuf.WellKnownTypes {
Number = other.Number;
}
options_.Add(other.options_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1300,7 +1250,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
@@ -1326,7 +1276,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Option : pb::IMessage<Option> {
private static readonly pb::MessageParser<Option> _parser = new pb::MessageParser<Option>(() => new Option());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Option> Parser { get { return _parser; } }
@@ -1350,8 +1299,7 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Option(Option other) : this() {
name_ = other.name_;
- value_ = other.value_ != null ? other.value_.Clone() : null;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ Value = other.value_ != null ? other.Value.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1408,7 +1356,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
if (Name != other.Name) return false;
if (!object.Equals(Value, other.Value)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1416,9 +1364,6 @@ namespace Google.Protobuf.WellKnownTypes {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (value_ != null) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1437,9 +1382,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(18);
output.WriteMessage(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1451,9 +1393,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (value_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1471,7 +1410,6 @@ namespace Google.Protobuf.WellKnownTypes {
}
Value.MergeFrom(other.Value);
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1480,7 +1418,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs
index d34b560de0..d34b560de0 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
index 25a65aa72c..9a5fb81ee9 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
@@ -1,7 +1,5 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/wrappers.proto
-// </auto-generated>
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/wrappers.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -59,7 +57,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class DoubleValue : pb::IMessage<DoubleValue> {
private static readonly pb::MessageParser<DoubleValue> _parser = new pb::MessageParser<DoubleValue>(() => new DoubleValue());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<DoubleValue> Parser { get { return _parser; } }
@@ -83,7 +80,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public DoubleValue(DoubleValue other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -118,17 +114,14 @@ namespace Google.Protobuf.WellKnownTypes {
if (ReferenceEquals(other, this)) {
return true;
}
- if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Value, other.Value)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ if (Value != other.Value) return false;
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (Value != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Value);
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
+ if (Value != 0D) hash ^= Value.GetHashCode();
return hash;
}
@@ -143,9 +136,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(9);
output.WriteDouble(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -154,9 +144,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value != 0D) {
size += 1 + 8;
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -168,7 +155,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value != 0D) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -177,7 +163,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 9: {
Value = input.ReadDouble();
@@ -196,7 +182,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class FloatValue : pb::IMessage<FloatValue> {
private static readonly pb::MessageParser<FloatValue> _parser = new pb::MessageParser<FloatValue>(() => new FloatValue());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FloatValue> Parser { get { return _parser; } }
@@ -220,7 +205,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FloatValue(FloatValue other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -255,17 +239,14 @@ namespace Google.Protobuf.WellKnownTypes {
if (ReferenceEquals(other, this)) {
return true;
}
- if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Value, other.Value)) return false;
- return Equals(_unknownFields, other._unknownFields);
+ if (Value != other.Value) return false;
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (Value != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Value);
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
+ if (Value != 0F) hash ^= Value.GetHashCode();
return hash;
}
@@ -280,9 +261,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(13);
output.WriteFloat(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -291,9 +269,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value != 0F) {
size += 1 + 4;
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -305,7 +280,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value != 0F) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -314,7 +288,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 13: {
Value = input.ReadFloat();
@@ -333,7 +307,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Int64Value : pb::IMessage<Int64Value> {
private static readonly pb::MessageParser<Int64Value> _parser = new pb::MessageParser<Int64Value>(() => new Int64Value());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Int64Value> Parser { get { return _parser; } }
@@ -357,7 +330,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Int64Value(Int64Value other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -393,16 +365,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Value != 0L) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -417,9 +386,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(8);
output.WriteInt64(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -428,9 +394,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -442,7 +405,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value != 0L) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -451,7 +413,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Value = input.ReadInt64();
@@ -470,7 +432,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class UInt64Value : pb::IMessage<UInt64Value> {
private static readonly pb::MessageParser<UInt64Value> _parser = new pb::MessageParser<UInt64Value>(() => new UInt64Value());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<UInt64Value> Parser { get { return _parser; } }
@@ -494,7 +455,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public UInt64Value(UInt64Value other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -530,16 +490,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Value != 0UL) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -554,9 +511,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(8);
output.WriteUInt64(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -565,9 +519,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value != 0UL) {
size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -579,7 +530,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value != 0UL) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -588,7 +538,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Value = input.ReadUInt64();
@@ -607,7 +557,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class Int32Value : pb::IMessage<Int32Value> {
private static readonly pb::MessageParser<Int32Value> _parser = new pb::MessageParser<Int32Value>(() => new Int32Value());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Int32Value> Parser { get { return _parser; } }
@@ -631,7 +580,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Int32Value(Int32Value other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -667,16 +615,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Value != 0) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -691,9 +636,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(8);
output.WriteInt32(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -702,9 +644,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -716,7 +655,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value != 0) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -725,7 +663,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Value = input.ReadInt32();
@@ -744,7 +682,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class UInt32Value : pb::IMessage<UInt32Value> {
private static readonly pb::MessageParser<UInt32Value> _parser = new pb::MessageParser<UInt32Value>(() => new UInt32Value());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<UInt32Value> Parser { get { return _parser; } }
@@ -768,7 +705,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public UInt32Value(UInt32Value other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -804,16 +740,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Value != 0) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -828,9 +761,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(8);
output.WriteUInt32(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -839,9 +769,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -853,7 +780,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value != 0) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -862,7 +788,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Value = input.ReadUInt32();
@@ -881,7 +807,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class BoolValue : pb::IMessage<BoolValue> {
private static readonly pb::MessageParser<BoolValue> _parser = new pb::MessageParser<BoolValue>(() => new BoolValue());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<BoolValue> Parser { get { return _parser; } }
@@ -905,7 +830,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public BoolValue(BoolValue other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -941,16 +865,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Value != false) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -965,9 +886,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(8);
output.WriteBool(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -976,9 +894,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value != false) {
size += 1 + 1;
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -990,7 +905,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value != false) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -999,7 +913,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 8: {
Value = input.ReadBool();
@@ -1018,7 +932,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class StringValue : pb::IMessage<StringValue> {
private static readonly pb::MessageParser<StringValue> _parser = new pb::MessageParser<StringValue>(() => new StringValue());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<StringValue> Parser { get { return _parser; } }
@@ -1042,7 +955,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public StringValue(StringValue other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1078,16 +990,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Value.Length != 0) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1102,9 +1011,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(10);
output.WriteString(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1113,9 +1019,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1127,7 +1030,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value.Length != 0) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1136,7 +1038,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Value = input.ReadString();
@@ -1155,7 +1057,6 @@ namespace Google.Protobuf.WellKnownTypes {
/// </summary>
public sealed partial class BytesValue : pb::IMessage<BytesValue> {
private static readonly pb::MessageParser<BytesValue> _parser = new pb::MessageParser<BytesValue>(() => new BytesValue());
- private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<BytesValue> Parser { get { return _parser; } }
@@ -1179,7 +1080,6 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public BytesValue(BytesValue other) : this() {
value_ = other.value_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1215,16 +1115,13 @@ namespace Google.Protobuf.WellKnownTypes {
return true;
}
if (Value != other.Value) return false;
- return Equals(_unknownFields, other._unknownFields);
+ return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Value.Length != 0) hash ^= Value.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
return hash;
}
@@ -1239,9 +1136,6 @@ namespace Google.Protobuf.WellKnownTypes {
output.WriteRawTag(10);
output.WriteBytes(Value);
}
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1250,9 +1144,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (Value.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value);
}
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
return size;
}
@@ -1264,7 +1155,6 @@ namespace Google.Protobuf.WellKnownTypes {
if (other.Value.Length != 0) {
Value = other.Value;
}
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1273,7 +1163,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ input.SkipLastField();
break;
case 10: {
Value = input.ReadBytes();
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs
index 9f620eb401..9f620eb401 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WireFormat.cs b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WireFormat.cs
index e884da5205..e884da5205 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/WireFormat.cs
+++ b/third_party/protobuf/3.4.0/csharp/src/Google.Protobuf/WireFormat.cs
diff --git a/third_party/protobuf/3.6.0/docs/third_party.md b/third_party/protobuf/3.4.0/docs/third_party.md
index 3f267ddec0..385650dfd8 100644
--- a/third_party/protobuf/3.6.0/docs/third_party.md
+++ b/third_party/protobuf/3.4.0/docs/third_party.md
@@ -32,7 +32,6 @@ These are projects we know about implementing Protocol Buffers for other program
* Delphi: http://sourceforge.net/projects/protobuf-delphi/
* Delphi: http://fundementals.sourceforge.net/dl.html
* Elixir: https://github.com/jeremyong/exprotoc
-* Elixir: https://github.com/tony612/protobuf-elixir
* Elm: https://github.com/tiziano88/elm-protobuf
* Erlang: http://github.com/ngerakines/erlang_protobuffs/tree/master
* Erlang: http://piqi.org/
@@ -42,10 +41,7 @@ These are projects we know about implementing Protocol Buffers for other program
* Go: https://github.com/golang/protobuf (Google-official implementation)
* Go: https://github.com/akunspy/gopbuf
* Go: https://github.com/gogo/protobuf
-* GopherJS: https://github.com/johanbrandhorst/protobuf
* Haskell: http://hackage.haskell.org/package/hprotoc
-* Haskell: https://github.com/google/proto-lens (Google-unofficial implementation)
-* Haskell: https://github.com/awakesecurity/proto3-suite (code generator) https://github.com/awakesecurity/proto3-wire (binary serializer/deserializer)
* Haxe: https://github.com/Atry/protoc-gen-haxe
* Java: https://github.com/google/protobuf (Google-official implementation)
* Java/Android: https://github.com/square/wire
@@ -58,7 +54,6 @@ These are projects we know about implementing Protocol Buffers for other program
* Javascript: http://code.google.com/p/protobuf-for-node/
* Javascript: http://code.google.com/p/protostuff/
* Julia: https://github.com/tanmaykm/ProtoBuf.jl
-* Kotlin: https://github.com/Kotlin/kotlinx.serialization
* Lua: http://code.google.com/p/protoc-gen-lua/
* Lua: http://github.com/indygreg/lua-protobuf
* Lua: https://github.com/Neopallium/lua-pb
@@ -111,6 +106,7 @@ GRPC (http://www.grpc.io/) is Google's RPC implementation for Protocol Buffers.
* http://code.google.com/p/cxf-protobuf/ (Java)
* http://code.google.com/p/protobuf-remote/ (C++/C#)
* http://code.google.com/p/protobuf-rpc-pro/ (Java)
+* https://code.google.com/p/protorpc/ (Go/C++)
* https://code.google.com/p/eneter-protobuf-serializer/ (Java/.NET)
* http://www.deltavsoft.com/RCFProto.html (C++/Java/Python/C#)
* https://github.com/robbinfan/claire-protorpc (C++)
@@ -121,10 +117,6 @@ GRPC (http://www.grpc.io/) is Google's RPC implementation for Protocol Buffers.
* https://github.com/w359405949/libmaid (C++, Python)
* https://github.com/madwyn/libpbrpc (C++)
* https://github.com/SeriousMa/grpc-protobuf-validation (Java)
-* https://github.com/tony612/grpc-elixir (Elixir)
-* https://github.com/johanbrandhorst/protobuf (GopherJS)
-* https://github.com/awakesecurity/gRPC-haskell (Haskell)
-* https://github.com/Yeolar/raster (C++)
## Other Utilities
@@ -162,7 +154,6 @@ There are miscellaneous other things you may find useful as a Protocol Buffers d
* [ProtoBuf with Java EE7 Expression Language 3.0; pure Java ProtoBuf Parser and Builder.](https://github.com/protobufel/protobuf-el)
* [Notepad++ Syntax Highlighting for .proto files](https://github.com/chai2010/notepadplus-protobuf)
* [Linter for .proto files](https://github.com/ckaznocha/protoc-gen-lint)
-* [Protocol Buffers Dynamic Schema - create protobuf schemas programmatically (Java)](https://github.com/os72/protobuf-dynamic)
+* [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/third_party/protobuf/3.6.0/editors/README.txt b/third_party/protobuf/3.4.0/editors/README.txt
index 3e9fc79e9c..3e9fc79e9c 100644
--- a/third_party/protobuf/3.6.0/editors/README.txt
+++ b/third_party/protobuf/3.4.0/editors/README.txt
diff --git a/third_party/protobuf/3.6.0/editors/proto.vim b/third_party/protobuf/3.4.0/editors/proto.vim
index 7f1aeb730a..7f1aeb730a 100644
--- a/third_party/protobuf/3.6.0/editors/proto.vim
+++ b/third_party/protobuf/3.4.0/editors/proto.vim
diff --git a/third_party/protobuf/3.6.0/editors/protobuf-mode.el b/third_party/protobuf/3.4.0/editors/protobuf-mode.el
index d3bdcded70..d3bdcded70 100644
--- a/third_party/protobuf/3.6.0/editors/protobuf-mode.el
+++ b/third_party/protobuf/3.4.0/editors/protobuf-mode.el
diff --git a/third_party/protobuf/3.6.0/examples/AddPerson.java b/third_party/protobuf/3.4.0/examples/AddPerson.java
index c262ab7e60..c262ab7e60 100644
--- a/third_party/protobuf/3.6.0/examples/AddPerson.java
+++ b/third_party/protobuf/3.4.0/examples/AddPerson.java
diff --git a/third_party/protobuf/3.6.0/examples/CMakeLists.txt b/third_party/protobuf/3.4.0/examples/CMakeLists.txt
index 3e8e65414e..3e8e65414e 100644
--- a/third_party/protobuf/3.6.0/examples/CMakeLists.txt
+++ b/third_party/protobuf/3.4.0/examples/CMakeLists.txt
diff --git a/third_party/protobuf/3.6.0/examples/ListPeople.java b/third_party/protobuf/3.4.0/examples/ListPeople.java
index 580f7ac2af..7892430508 100644
--- a/third_party/protobuf/3.6.0/examples/ListPeople.java
+++ b/third_party/protobuf/3.4.0/examples/ListPeople.java
@@ -27,9 +27,6 @@ class ListPeople {
case WORK:
System.out.print(" Work phone #: ");
break;
- default:
- System.out.println(" Unknown phone #: ");
- break;
}
System.out.println(phoneNumber.getNumber());
}
diff --git a/third_party/protobuf/3.6.0/examples/Makefile b/third_party/protobuf/3.4.0/examples/Makefile
index 1ff7fa7fc5..d16bb56d5a 100644
--- a/third_party/protobuf/3.6.0/examples/Makefile
+++ b/third_party/protobuf/3.4.0/examples/Makefile
@@ -22,12 +22,12 @@ clean:
rmdir com 2>/dev/null || true
protoc_middleman: addressbook.proto
- protoc $$PROTO_PATH --cpp_out=. --java_out=. --python_out=. addressbook.proto
+ protoc --cpp_out=. --java_out=. --python_out=. addressbook.proto
@touch protoc_middleman
protoc_middleman_go: addressbook.proto
- mkdir -p tutorial # make directory for go package
- protoc $$PROTO_PATH --go_out=tutorial addressbook.proto
+ mkdir tutorial # make directory for go package
+ protoc --go_out=tutorial addressbook.proto
@touch protoc_middleman_go
add_person_cpp: add_person.cc protoc_middleman
@@ -51,7 +51,7 @@ list_people_gotest: list_people.go list_people_go
go test list_people.go list_people_test.go
javac_middleman: AddPerson.java ListPeople.java protoc_middleman
- javac -cp $$CLASSPATH AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java
+ javac -cp ../java/core/target/*.jar AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java
@touch javac_middleman
add_person_java: javac_middleman
diff --git a/third_party/protobuf/3.4.0/examples/README.txt b/third_party/protobuf/3.4.0/examples/README.txt
new file mode 100644
index 0000000000..2e4f6e4e8b
--- /dev/null
+++ b/third_party/protobuf/3.4.0/examples/README.txt
@@ -0,0 +1,61 @@
+This directory contains example code that uses Protocol Buffers to manage an
+address book. Two programs are provided, each with three different
+implementations, one written in each of C++, Java, and Python. The add_person
+example adds a new person to an address book, prompting the user to input
+the person's information. The list_people example lists people already in the
+address book. The examples use the exact same format in all three languages,
+so you can, for example, use add_person_java to create an address book and then
+use list_people_python to read it.
+
+You must install the protobuf package before you can build these.
+
+To build all the examples (on a unix-like system), simply run "make". This
+creates the following executable files in the current directory:
+ add_person_cpp list_people_cpp
+ add_person_java list_people_java
+ add_person_python list_people_python
+
+If you only want to compile examples in one language, use "make cpp"*,
+"make java", or "make python".
+
+All of these programs simply take an address book file as their parameter.
+The add_person programs will create the file if it doesn't already exist.
+
+These examples are part of the Protocol Buffers tutorial, located at:
+ https://developers.google.com/protocol-buffers/docs/tutorials
+
+* Note that on some platforms you may have to edit the Makefile and remove
+"-lpthread" from the linker commands (perhaps replacing it with something else).
+We didn't do this automatically because we wanted to keep the example simple.
+
+## Java ##
+
+protobuf-java-*.jar can be generated by:
+ cd ../java
+ mvn package
+and will be used by "make java"
+
+## Go ##
+
+The Go example requires a plugin to the protocol buffer compiler, so it is not
+build with all the other examples. See:
+ https://github.com/golang/protobuf
+for more information about Go protocol buffer support.
+
+First, install the Protocol Buffers compiler (protoc).
+Then, install the Go Protocol Buffers plugin
+($GOPATH/bin must be in your $PATH for protoc to find it):
+ go get github.com/golang/protobuf/protoc-gen-go
+
+Build the Go samples in this directory with "make go". This creates the
+following executable files in the current directory:
+ add_person_go list_people_go
+To run the example:
+ ./add_person_go addressbook.data
+to add a person to the protocol buffer encoded file addressbook.data. The file
+is created if it does not exist. To view the data, run:
+ ./list_people_go addressbook.data
+
+Observe that the C++, Python, and Java examples in this directory run in a
+similar way and can view/modify files created by the Go example and vice
+versa.
diff --git a/third_party/protobuf/3.6.0/examples/add_person.cc b/third_party/protobuf/3.4.0/examples/add_person.cc
index 856e90bb7b..9bec4b374d 100644
--- a/third_party/protobuf/3.6.0/examples/add_person.cc
+++ b/third_party/protobuf/3.4.0/examples/add_person.cc
@@ -1,17 +1,11 @@
// See README.txt for information and build instructions.
-#include <ctime>
-#include <fstream>
-#include <google/protobuf/util/time_util.h>
#include <iostream>
+#include <fstream>
#include <string>
-
#include "addressbook.pb.h"
-
using namespace std;
-using google::protobuf::util::TimeUtil;
-
// This function fills in a Person message based on user input.
void PromptForAddress(tutorial::Person* person) {
cout << "Enter person ID number: ";
@@ -54,7 +48,6 @@ void PromptForAddress(tutorial::Person* person) {
cout << "Unknown phone type. Using default." << endl;
}
}
- *person->mutable_last_updated() = TimeUtil::SecondsToTimestamp(time(NULL));
}
// Main function: Reads the entire address book from a file,
diff --git a/third_party/protobuf/3.6.0/examples/add_person.go b/third_party/protobuf/3.4.0/examples/add_person.go
index 4f2e7f7418..4f2e7f7418 100644
--- a/third_party/protobuf/3.6.0/examples/add_person.go
+++ b/third_party/protobuf/3.4.0/examples/add_person.go
diff --git a/third_party/protobuf/3.6.0/examples/add_person.py b/third_party/protobuf/3.4.0/examples/add_person.py
index aa0fbca737..0b6985792d 100644..100755
--- a/third_party/protobuf/3.6.0/examples/add_person.py
+++ b/third_party/protobuf/3.4.0/examples/add_person.py
@@ -5,12 +5,6 @@
import addressbook_pb2
import sys
-try:
- raw_input # Python 2
-except NameError:
- raw_input = input # Python 3
-
-
# This function fills in a Person message based on user input.
def PromptForAddress(person):
person.id = int(raw_input("Enter person ID number: "))
@@ -36,14 +30,13 @@ def PromptForAddress(person):
elif type == "work":
phone_number.type = addressbook_pb2.Person.WORK
else:
- print("Unknown phone type; leaving as default value.")
-
+ print "Unknown phone type; leaving as default value."
# Main procedure: Reads the entire address book from a file,
# adds one person based on user input, then writes it back out to the same
# file.
if len(sys.argv) != 2:
- print("Usage:", sys.argv[0], "ADDRESS_BOOK_FILE")
+ print "Usage:", sys.argv[0], "ADDRESS_BOOK_FILE"
sys.exit(-1)
address_book = addressbook_pb2.AddressBook()
@@ -53,7 +46,7 @@ try:
with open(sys.argv[1], "rb") as f:
address_book.ParseFromString(f.read())
except IOError:
- print(sys.argv[1] + ": File not found. Creating a new file.")
+ print sys.argv[1] + ": File not found. Creating a new file."
# Add an address.
PromptForAddress(address_book.people.add())
diff --git a/third_party/protobuf/3.6.0/examples/add_person_test.go b/third_party/protobuf/3.4.0/examples/add_person_test.go
index f8ba93387f..0507db6fc1 100644
--- a/third_party/protobuf/3.6.0/examples/add_person_test.go
+++ b/third_party/protobuf/3.4.0/examples/add_person_test.go
@@ -30,10 +30,10 @@ unknown
t.Errorf("promptForAddress(%q) got %d, want ID %d", in, got.Id, 12345)
}
if got.Name != "Example Name" {
- t.Errorf("promptForAddress(%q) => want name %q, got %q", in, "Example Name", got.Name)
+ t.Errorf("promptForAddress(%q) => want name %q, got %q", "Example Name", got.Name)
}
if got.Email != "name@example.com" {
- t.Errorf("promptForAddress(%q) => want email %q, got %q", in, "name@example.com", got.Email)
+ t.Errorf("promptForAddress(%q) => want email %q, got %q", "name@example.com", got.Email)
}
want := []*pb.Person_PhoneNumber{
diff --git a/third_party/protobuf/3.6.0/examples/addressbook.proto b/third_party/protobuf/3.4.0/examples/addressbook.proto
index b4b33b4c65..23cc2f97e7 100644
--- a/third_party/protobuf/3.6.0/examples/addressbook.proto
+++ b/third_party/protobuf/3.4.0/examples/addressbook.proto
@@ -9,8 +9,6 @@
// [START declaration]
syntax = "proto3";
package tutorial;
-
-import "google/protobuf/timestamp.proto";
// [END declaration]
// [START java_declaration]
@@ -40,8 +38,6 @@ message Person {
}
repeated PhoneNumber phones = 4;
-
- google.protobuf.Timestamp last_updated = 5;
}
// Our address book file is just one of these.
diff --git a/third_party/protobuf/3.6.0/examples/list_people.cc b/third_party/protobuf/3.4.0/examples/list_people.cc
index b309c59680..68e5666d84 100644
--- a/third_party/protobuf/3.6.0/examples/list_people.cc
+++ b/third_party/protobuf/3.4.0/examples/list_people.cc
@@ -1,16 +1,11 @@
// See README.txt for information and build instructions.
-#include <fstream>
-#include <google/protobuf/util/time_util.h>
#include <iostream>
+#include <fstream>
#include <string>
-
#include "addressbook.pb.h"
-
using namespace std;
-using google::protobuf::util::TimeUtil;
-
// Iterates though all people in the AddressBook and prints info about them.
void ListPeople(const tutorial::AddressBook& address_book) {
for (int i = 0; i < address_book.people_size(); i++) {
@@ -35,15 +30,9 @@ void ListPeople(const tutorial::AddressBook& address_book) {
case tutorial::Person::WORK:
cout << " Work phone #: ";
break;
- default:
- cout << " Unknown phone #: ";
- break;
}
cout << phone_number.number() << endl;
}
- if (person.has_last_updated()) {
- cout << " Updated: " << TimeUtil::ToString(person.last_updated()) << endl;
- }
}
}
diff --git a/third_party/protobuf/3.6.0/examples/list_people.go b/third_party/protobuf/3.4.0/examples/list_people.go
index 70bc589efc..70bc589efc 100644
--- a/third_party/protobuf/3.6.0/examples/list_people.go
+++ b/third_party/protobuf/3.4.0/examples/list_people.go
diff --git a/third_party/protobuf/3.6.0/examples/list_people.py b/third_party/protobuf/3.4.0/examples/list_people.py
index d2c294c6f5..f131872d84 100644..100755
--- a/third_party/protobuf/3.6.0/examples/list_people.py
+++ b/third_party/protobuf/3.4.0/examples/list_people.py
@@ -2,33 +2,30 @@
# See README.txt for information and build instructions.
-from __future__ import print_function
import addressbook_pb2
import sys
-
# Iterates though all people in the AddressBook and prints info about them.
def ListPeople(address_book):
for person in address_book.people:
- print("Person ID:", person.id)
- print(" Name:", person.name)
+ print "Person ID:", person.id
+ print " Name:", person.name
if person.email != "":
- print(" E-mail address:", person.email)
+ print " E-mail address:", person.email
for phone_number in person.phones:
if phone_number.type == addressbook_pb2.Person.MOBILE:
- print(" Mobile phone #:", end=" ")
+ print " Mobile phone #:",
elif phone_number.type == addressbook_pb2.Person.HOME:
- print(" Home phone #:", end=" ")
+ print " Home phone #:",
elif phone_number.type == addressbook_pb2.Person.WORK:
- print(" Work phone #:", end=" ")
- print(phone_number.number)
-
+ print " Work phone #:",
+ print phone_number.number
# Main procedure: Reads the entire address book from a file and prints all
# the information inside.
if len(sys.argv) != 2:
- print("Usage:", sys.argv[0], "ADDRESS_BOOK_FILE")
+ print "Usage:", sys.argv[0], "ADDRESS_BOOK_FILE"
sys.exit(-1)
address_book = addressbook_pb2.AddressBook()
diff --git a/third_party/protobuf/3.6.0/examples/list_people_test.go b/third_party/protobuf/3.4.0/examples/list_people_test.go
index 87d6ad6ec6..87d6ad6ec6 100644
--- a/third_party/protobuf/3.6.0/examples/list_people_test.go
+++ b/third_party/protobuf/3.4.0/examples/list_people_test.go
diff --git a/third_party/protobuf/3.6.0/generate_changelog.py b/third_party/protobuf/3.4.0/generate_changelog.py
index d90a9b7043..d90a9b7043 100644..100755
--- a/third_party/protobuf/3.6.0/generate_changelog.py
+++ b/third_party/protobuf/3.4.0/generate_changelog.py
diff --git a/third_party/protobuf/3.6.0/generate_descriptor_proto.sh b/third_party/protobuf/3.4.0/generate_descriptor_proto.sh
index 8a5ed48a2b..e15276faad 100644..100755
--- a/third_party/protobuf/3.6.0/generate_descriptor_proto.sh
+++ b/third_party/protobuf/3.4.0/generate_descriptor_proto.sh
@@ -81,7 +81,7 @@ do
$PROTOC --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:$TMP ${RUNTIME_PROTO_FILES[@]} && \
$PROTOC --cpp_out=dllexport_decl=LIBPROTOC_EXPORT:$TMP ${COMPILER_PROTO_FILES[@]}
- for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]} ${COMPILER_PROTO_FILES[@]}; do
+ for PROTO_FILE in "${RUNTIME_PROTO_FILES[@]}" "${COMPILER_PROTO_FILES[@]}"; do
BASE_NAME=${PROTO_FILE%.*}
diff ${BASE_NAME}.pb.h $TMP/${BASE_NAME}.pb.h > /dev/null
if test $? -ne 0; then
@@ -96,7 +96,7 @@ do
# Only override the output if the files are different to avoid re-compilation
# of the protoc.
if [ $CORE_PROTO_IS_CORRECT -ne 1 ]; then
- for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]} ${COMPILER_PROTO_FILES[@]}; do
+ for PROTO_FILE in "${RUNTIME_PROTO_FILES[@]}" "${COMPILER_PROTO_FILES[@]}"; do
BASE_NAME=${PROTO_FILE%.*}
mv $TMP/${BASE_NAME}.pb.h ${BASE_NAME}.pb.h
mv $TMP/${BASE_NAME}.pb.cc ${BASE_NAME}.pb.cc
diff --git a/third_party/protobuf/3.4.0/gmock.BUILD b/third_party/protobuf/3.4.0/gmock.BUILD
new file mode 100644
index 0000000000..b1ae15a919
--- /dev/null
+++ b/third_party/protobuf/3.4.0/gmock.BUILD
@@ -0,0 +1,28 @@
+cc_library(
+ name = "gtest",
+ srcs = [
+ "googletest/src/gtest-all.cc",
+ "googlemock/src/gmock-all.cc",
+ ],
+ hdrs = glob([
+ "**/*.h",
+ "googletest/src/*.cc",
+ "googlemock/src/*.cc",
+ ]),
+ includes = [
+ "googlemock",
+ "googletest",
+ "googletest/include",
+ "googlemock/include",
+ ],
+ linkopts = ["-pthread"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "gtest_main",
+ srcs = ["googlemock/src/gmock_main.cc"],
+ linkopts = ["-pthread"],
+ visibility = ["//visibility:public"],
+ deps = [":gtest"],
+)
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/any.proto b/third_party/protobuf/3.4.0/google/protobuf/any.proto
index 4932942558..c748667623 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/any.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/any.proto
@@ -120,18 +120,17 @@ option objc_class_prefix = "GPB";
// }
//
message Any {
- // 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).
+ // A URL/resource name whose content describes the type of the
+ // serialized protocol buffer message.
//
- // 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:
+ // For URLs which use the scheme `http`, `https`, or no scheme, the
+ // following restrictions and interpretations apply:
//
// * 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
@@ -140,10 +139,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/api.proto b/third_party/protobuf/3.4.0/google/protobuf/api.proto
index f37ee2fa46..f37ee2fa46 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/api.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/api.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.proto b/third_party/protobuf/3.4.0/google/protobuf/compiler/plugin.proto
index 5b5574529e..5b5574529e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/compiler/plugin.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.proto b/third_party/protobuf/3.4.0/google/protobuf/descriptor.proto
index ed08fcbc54..f1ec5735da 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/descriptor.proto
@@ -45,7 +45,6 @@ option java_package = "com.google.protobuf";
option java_outer_classname = "DescriptorProtos";
option csharp_namespace = "Google.Protobuf.Reflection";
option objc_class_prefix = "GPB";
-option cc_enable_arenas = true;
// descriptor.proto must be optimized for speed because reflection-based
// algorithms don't work during bootstrapping.
@@ -226,26 +225,6 @@ message EnumDescriptorProto {
repeated EnumValueDescriptorProto value = 2;
optional EnumOptions options = 3;
-
- // Range of reserved numeric values. Reserved values may not be used by
- // entries in the same enum. Reserved ranges may not overlap.
- //
- // Note that this is distinct from DescriptorProto.ReservedRange in that it
- // is inclusive such that it can appropriately represent the entire int32
- // domain.
- message EnumReservedRange {
- optional int32 start = 1; // Inclusive.
- optional int32 end = 2; // Inclusive.
- }
-
- // Range of reserved numeric values. Reserved numeric values may not be used
- // by enum values in the same enum declaration. Reserved ranges may not
- // overlap.
- repeated EnumReservedRange reserved_range = 4;
-
- // Reserved enum value names, which may not be reused. A given name may only
- // be reserved once.
- repeated string reserved_name = 5;
}
// Describes a value within an enum.
@@ -382,7 +361,7 @@ message FileOptions {
optional bool cc_generic_services = 16 [default=false];
optional bool java_generic_services = 17 [default=false];
optional bool py_generic_services = 18 [default=false];
- optional bool php_generic_services = 42 [default=false];
+ optional bool php_generic_services = 19 [default=false];
// Is this file deprecated?
// Depending on the target platform, this can emit Deprecated annotations
@@ -417,23 +396,10 @@ message FileOptions {
// determining the namespace.
optional string php_namespace = 41;
-
- // Use this option to change the namespace of php generated metadata classes.
- // Default is empty. When this option is empty, the proto file name will be used
- // for determining the namespace.
- optional string php_metadata_namespace = 44;
-
- // Use this option to change the package of ruby generated classes. Default
- // is empty. When this option is not set, the package name will be used for
- // determining the ruby package.
- optional string ruby_package = 45;
-
- // The parser stores options it doesn't recognize here.
- // See the documentation for the "Options" section above.
+ // The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
- // Clients can define custom options in extensions of this message.
- // See the documentation for the "Options" section above.
+ // Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
reserved 38;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/duration.proto b/third_party/protobuf/3.4.0/google/protobuf/duration.proto
index 975fce41aa..975fce41aa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/duration.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/duration.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/empty.proto b/third_party/protobuf/3.4.0/google/protobuf/empty.proto
index 03cacd2330..03cacd2330 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/empty.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/empty.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/field_mask.proto b/third_party/protobuf/3.4.0/google/protobuf/field_mask.proto
index 76e09f391d..c68d247c8a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/field_mask.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/field_mask.proto
@@ -240,12 +240,6 @@ option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";
//
// Note that oneof type names ("test_oneof" in this case) cannot be used in
// paths.
-//
-// ## Field Mask Verification
-//
-// The implementation of any API method which has a FieldMask type field in the
-// request should verify the included field paths, and return an
-// `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
message FieldMask {
// The set of field mask paths.
repeated string paths = 1;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/source_context.proto b/third_party/protobuf/3.4.0/google/protobuf/source_context.proto
index f3b2c96681..f3b2c96681 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/source_context.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/source_context.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/struct.proto b/third_party/protobuf/3.4.0/google/protobuf/struct.proto
index 7d7808e7fb..7d7808e7fb 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/struct.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/struct.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/timestamp.proto b/third_party/protobuf/3.4.0/google/protobuf/timestamp.proto
index eafb3fa03a..b7cbd17502 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/timestamp.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/timestamp.proto
@@ -103,9 +103,7 @@ 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. 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).
+// is required, though only UTC (as indicated by "Z") is presently supported.
//
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
// 01:30 UTC on January 15, 2017.
@@ -116,8 +114,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://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime())
+// to obtain a formatter capable of generating timestamps in this format.
//
//
message Timestamp {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/type.proto b/third_party/protobuf/3.4.0/google/protobuf/type.proto
index 624c15ee61..624c15ee61 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/type.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/type.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/wrappers.proto b/third_party/protobuf/3.4.0/google/protobuf/wrappers.proto
index 01947639ac..01947639ac 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wrappers.proto
+++ b/third_party/protobuf/3.4.0/google/protobuf/wrappers.proto
diff --git a/third_party/protobuf/3.6.0/java/README.md b/third_party/protobuf/3.4.0/java/README.md
index 5e4fb8b495..0e0fba647a 100644
--- a/third_party/protobuf/3.6.0/java/README.md
+++ b/third_party/protobuf/3.4.0/java/README.md
@@ -1,65 +1,17 @@
-# Protocol Buffers - Google's data interchange format
+Protocol Buffers - Google's data interchange format
+===================================================
-Copyright 2008 Google Inc.
-
-https://developers.google.com/protocol-buffers/
-
-## Use Java Protocol Buffers
-
-To use protobuf in Java, first obtain the protocol compiler (a.k.a., protoc,
-see instructions in the toplevel [README.md](../README.md)) and use it to
-generate Java code for your .proto files:
-
- $ protoc --java_out=${OUTPUT_DIR} path/to/your/proto/file
-
-Include the generated Java files in your project and add a dependency on the
-protobuf Java runtime. If you are using Maven, use the following:
-
-```xml
-<dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- <version>3.5.1</version>
-</dependency>
-```
+[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf)
-Make sure the version number of the runtime matches (or is newer than) the
-version number of the protoc.
-
-If you want to use features like protobuf JsonFormat, add a dependency on the
-protobuf-java-util package:
-
-```xml
-<dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java-util</artifactId>
- <version>3.5.1</version>
-</dependency>
-```
-
-### Use Java Protocol Buffers on Android
-
-For Android users, it's recommended to use protobuf Java Lite runtime because
-of its smaller code size. Java Lite runtime also works better with Proguard
-because it doesn't rely on Java reflection and is optimized to allow as much
-code stripping as possible. You can following these [instructions to use Java
-Lite runtime](lite.md).
-
-### Use Java Protocol Buffers with Bazel
-
-Bazel has native build rules to work with protobuf. For Java, you can use the
-`java_proto_library` rule for server and the `java_lite_proto_library` rule
-for Android. Check out [our build files examples](../examples/BUILD) to learn
-how to use them.
+Copyright 2008 Google Inc.
-## Build from Source
+This directory contains the Java Protocol Buffers runtime library.
-Most users should follow the instructions above to use protobuf Java runtime.
-If you are contributing code to protobuf or want to use a protobuf version
-that hasn't been officially released yet, you can folllow the instructions
-below to build protobuf from source code.
+Installation - With Maven
+=========================
-### Build from Source - With Maven
+The Protocol Buffers build is managed using Maven. If you would
+rather build without Maven, see below.
1) Install Apache Maven if you don't have it:
@@ -93,15 +45,20 @@ below to build protobuf from source code.
The .jar will be placed in the "target" directory.
-The above instructions will install 2 maven artifacts:
+The above instructions will install 3 maven artifacts:
* protobuf-java: The core Java Protocol Buffers library. Most users only
need this artifact.
+ * protobuf-lite: The lite version of core Java Protobuf Buffers library. It
+ is a subset of the core library and is used together with
+ the 'lite' code generator flag to reduce generated code size
+ for mobile.
* protobuf-java-util: Utilities to work with protos. It contains JSON support
as well as utilities to work with proto3 well-known
types.
-### Build from Source - Without Maven
+Installation - Without Maven
+============================
If you would rather not install Maven to build the library, you may
follow these instructions instead. Note that these instructions skip
@@ -126,7 +83,8 @@ library (without the util package).
4) Install the classes wherever you prefer.
-## Compatibility Notice
+Compatibility Notice
+====================
* Protobuf minor version releases are backwards-compatible. If your code
can build/run against the old version, it's expected to build/run against
@@ -160,7 +118,8 @@ library (without the util package).
* Protobuf LITE runtime APIs are not stable yet. They are subject to change even
in minor version releases.
-## Documentation
+Documentation
+=============
The complete documentation for Protocol Buffers is available via the
web at:
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/README.md b/third_party/protobuf/3.4.0/java/compatibility_tests/README.md
index 72c6034c99..72c6034c99 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/README.md
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/README.md
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/deps/pom.xml b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/deps/pom.xml
index 7ceb96049d..7ceb96049d 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/deps/pom.xml
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/deps/pom.xml
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/pom.xml b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/pom.xml
index ff0c4133f0..ff0c4133f0 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/pom.xml
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/pom.xml
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto
index 9a040145a6..9a040145a6 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto
index abffb9d2ba..abffb9d2ba 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto
index 9fe5d560c9..9fe5d560c9 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto
index 16ee46e57d..16ee46e57d 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto
index f61b419bc2..f61b419bc2 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
index 3c82659b5e..3c82659b5e 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
index 6e67d97a69..6e67d97a69 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto
index a785f79faf..a785f79faf 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto
index 6eb2d86f51..6eb2d86f51 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto
index e591d29447..e591d29447 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
index fa1762594e..fa1762594e 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto
index ab12d1fb9f..ab12d1fb9f 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
index bc0b7c16a0..bc0b7c16a0 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto
index c115b11171..c115b11171 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto
index 81b117fe84..81b117fe84 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto
index ea5d1b13fe..ea5d1b13fe 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto
index d077563cbd..d077563cbd 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto
index a1764aac8d..a1764aac8d 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
index d52cb8cc36..d52cb8cc36 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto
index 3497f09fa6..3497f09fa6 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto
index cffb4122c5..cffb4122c5 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto
index feecbef8d4..feecbef8d4 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/pom.xml b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/pom.xml
index 83a7563afd..83a7563afd 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/pom.xml
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/pom.xml
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/pom.xml b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/pom.xml
index a22e91ed1d..a22e91ed1d 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/pom.xml
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/pom.xml
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto
index 9a040145a6..9a040145a6 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto
index abffb9d2ba..abffb9d2ba 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto
index 9fe5d560c9..9fe5d560c9 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto
index 16ee46e57d..16ee46e57d 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto
index f61b419bc2..f61b419bc2 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
index 3c82659b5e..3c82659b5e 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
index 6e67d97a69..6e67d97a69 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
index a785f79faf..a785f79faf 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
index 6eb2d86f51..6eb2d86f51 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
index e591d29447..e591d29447 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
index fa1762594e..fa1762594e 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto
index ab12d1fb9f..ab12d1fb9f 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
index bc0b7c16a0..bc0b7c16a0 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
index c115b11171..c115b11171 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto
index 81b117fe84..81b117fe84 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
index ea5d1b13fe..ea5d1b13fe 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto
index d077563cbd..d077563cbd 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto
index a1764aac8d..a1764aac8d 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
index d52cb8cc36..d52cb8cc36 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
index 3497f09fa6..3497f09fa6 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
index cffb4122c5..cffb4122c5 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto
index feecbef8d4..feecbef8d4 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/test.sh b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/test.sh
index 5d5e9ed439..5d5e9ed439 100644..100755
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/test.sh
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/test.sh
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/pom.xml b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/pom.xml
index f1ce46e7ab..f1ce46e7ab 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/pom.xml
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/pom.xml
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java
index 6789550c49..6789550c49 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
index c838274369..c838274369 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java
index 8bb9f731d2..8bb9f731d2 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java
index 7e67898ea4..7e67898ea4 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java
index 354d89d664..354d89d664 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java
index ee4e767520..ee4e767520 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java
index aabd7b4d73..aabd7b4d73 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java
index 00230678fb..00230678fb 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java
index 6a39500ead..6a39500ead 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java
index 49f114643c..49f114643c 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java
index 9bc94eef1d..9bc94eef1d 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java
index e21e038993..e21e038993 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java
index b2dcc7e882..b2dcc7e882 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java
index c8c95a87c7..c8c95a87c7 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java
index 68d70beca1..68d70beca1 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java
index b35af689cd..b35af689cd 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java
index 3c1f5035b7..3c1f5035b7 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java
index 8caeadd9a1..8caeadd9a1 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java
index 4c7f751c0a..4c7f751c0a 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
index 5086732295..5086732295 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java
index a92348303e..a92348303e 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java
index edcc8908a4..edcc8908a4 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java
index b9bfb691b1..b9bfb691b1 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java
index cb75d74b0c..cb75d74b0c 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java
diff --git a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java
index 7452872620..7452872620 100644
--- a/third_party/protobuf/3.6.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java
+++ b/third_party/protobuf/3.4.0/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/generate-sources-build.xml b/third_party/protobuf/3.4.0/java/core/generate-sources-build.xml
index 0996e5fff4..0996e5fff4 100644
--- a/third_party/protobuf/3.6.0/java/core/generate-sources-build.xml
+++ b/third_party/protobuf/3.4.0/java/core/generate-sources-build.xml
diff --git a/third_party/protobuf/3.6.0/java/core/generate-test-sources-build.xml b/third_party/protobuf/3.4.0/java/core/generate-test-sources-build.xml
index 1d11f13144..68951747ca 100644
--- a/third_party/protobuf/3.6.0/java/core/generate-test-sources-build.xml
+++ b/third_party/protobuf/3.4.0/java/core/generate-test-sources-build.xml
@@ -19,7 +19,6 @@
<arg value="${protobuf.source.dir}/google/protobuf/unittest_enormous_descriptor.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_no_generic_services.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_well_known_types.proto"/>
- <arg value="${test.proto.dir}/com/google/protobuf/deprecated_file.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/lazy_fields_lite.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/lite_equals_and_hash.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/multiple_files_test.proto"/>
@@ -39,7 +38,6 @@
<arg value="${test.proto.dir}/com/google/protobuf/field_presence_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/map_for_proto2_lite_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/map_for_proto2_test.proto"/>
- <arg value="${test.proto.dir}/com/google/protobuf/map_lite_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/map_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/map_initialization_order_test.proto"/>
</exec>
diff --git a/third_party/protobuf/3.6.0/java/core/pom.xml b/third_party/protobuf/3.4.0/java/core/pom.xml
index b4edcbc7d2..4608fce657 100644
--- a/third_party/protobuf/3.6.0/java/core/pom.xml
+++ b/third_party/protobuf/3.4.0/java/core/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
- <version>3.6.0</version>
+ <version>3.4.0</version>
</parent>
<artifactId>protobuf-java</artifactId>
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractMessage.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractMessage.java
index fc3c2a5d9a..065fa1a921 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractMessage.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractMessage.java
@@ -125,16 +125,6 @@ public abstract class AbstractMessage
protected int memoizedSize = -1;
@Override
- int getMemoizedSerializedSize() {
- return memoizedSize;
- }
-
- @Override
- void setMemoizedSerializedSize(int size) {
- memoizedSize = size;
- }
-
- @Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) {
@@ -390,10 +380,6 @@ public abstract class AbstractMessage
@Override
public BuilderType mergeFrom(final Message other) {
- return mergeFrom(other, other.getAllFields());
- }
-
- BuilderType mergeFrom(final Message other, Map<FieldDescriptor, Object> allFields) {
if (other.getDescriptorForType() != getDescriptorForType()) {
throw new IllegalArgumentException(
"mergeFrom(Message) can only merge messages of the same type.");
@@ -408,7 +394,8 @@ public abstract class AbstractMessage
// TODO(kenton): Provide a function somewhere called makeDeepCopy()
// which allows people to make secure deep copies of messages.
- for (final Map.Entry<FieldDescriptor, Object> entry : allFields.entrySet()) {
+ for (final Map.Entry<FieldDescriptor, Object> entry :
+ other.getAllFields().entrySet()) {
final FieldDescriptor field = entry.getKey();
if (field.isRepeated()) {
for (final Object element : (List)entry.getValue()) {
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
index b22bbaab62..24830c0a32 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
@@ -99,16 +99,6 @@ public abstract class AbstractMessageLite<
codedOutput.flush();
}
- // We'd like these to be abstract but some folks are extending this class directly. They shouldn't
- // be doing that and they should feel bad.
- int getMemoizedSerializedSize() {
- throw new UnsupportedOperationException();
- }
-
- void setMemoizedSerializedSize(int size) {
- throw new UnsupportedOperationException();
- }
-
/**
* Package private helper method for AbstractParser to create
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractParser.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractParser.java
index ba570e3df1..ba570e3df1 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractParser.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractParser.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java
index b17db6e0b3..b17db6e0b3 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java
index d535efb9b6..d535efb9b6 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BlockingService.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BlockingService.java
index d01f0b8ff0..d01f0b8ff0 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BlockingService.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BlockingService.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java
index 4d7a9727f3..fd4c142b33 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java
@@ -82,18 +82,6 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean>
}
@Override
- protected void removeRange(int fromIndex, int toIndex) {
- ensureIsMutable();
- if (toIndex < fromIndex) {
- throw new IndexOutOfBoundsException("toIndex < fromIndex");
- }
-
- System.arraycopy(array, toIndex, array, fromIndex, size - toIndex);
- size -= (toIndex - fromIndex);
- modCount++;
- }
-
- @Override
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -258,9 +246,7 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean>
ensureIsMutable();
ensureIndexInRange(index);
boolean value = array[index];
- if (index < size - 1) {
- System.arraycopy(array, index + 1, array, index, size - index);
- }
+ System.arraycopy(array, index + 1, array, index, size - index);
size--;
modCount++;
return value;
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java
index 6157a52f50..6157a52f50 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteOutput.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteOutput.java
index ee5887538f..ee5887538f 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteOutput.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteOutput.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteString.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteString.java
index d67bb54a73..99a312096d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ByteString.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ByteString.java
@@ -124,8 +124,14 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
private static final ByteArrayCopier byteArrayCopier;
static {
- byteArrayCopier =
- Android.isOnAndroidDevice() ? new SystemByteArrayCopier() : new ArraysByteArrayCopier();
+ boolean isAndroid = true;
+ try {
+ Class.forName("android.content.Context");
+ } catch (ClassNotFoundException e) {
+ isAndroid = false;
+ }
+
+ byteArrayCopier = isAndroid ? new SystemByteArrayCopier() : new ArraysByteArrayCopier();
}
/**
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/CodedInputStream.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
index 1297462e2d..d6a941b1c0 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
@@ -44,7 +44,6 @@ import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
/**
@@ -64,12 +63,6 @@ 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}.
- * Currently disabled.
- */
- private static final boolean ENABLE_CUSTOM_UTF8_DECODE = false;
-
/** Visible for subclasses. See setRecursionLimit() */
int recursionDepth;
@@ -92,43 +85,6 @@ public abstract class CodedInputStream {
return new StreamDecoder(input, bufferSize);
}
- /** Create a new CodedInputStream wrapping the given {@code Iterable <ByteBuffer>}. */
- public static CodedInputStream newInstance(final Iterable<ByteBuffer> input) {
- if (!UnsafeDirectNioDecoder.isSupported()) {
- return newInstance(new IterableByteBufferInputStream(input));
- }
- return newInstance(input, false);
- }
-
- /** Create a new CodedInputStream wrapping the given {@code Iterable <ByteBuffer>}. */
- static CodedInputStream newInstance(
- final Iterable<ByteBuffer> bufs, final boolean bufferIsImmutable) {
- // flag is to check the type of input's ByteBuffers.
- // flag equals 1: all ByteBuffers have array.
- // flag equals 2: all ByteBuffers are direct ByteBuffers.
- // flag equals 3: some ByteBuffers are direct and some have array.
- // flag greater than 3: other cases.
- int flag = 0;
- // Total size of the input
- int totalSize = 0;
- for (ByteBuffer buf : bufs) {
- totalSize += buf.remaining();
- if (buf.hasArray()) {
- flag |= 1;
- } else if (buf.isDirect()) {
- flag |= 2;
- } else {
- flag |= 4;
- }
- }
- if (flag == 2) {
- return new IterableDirectByteBufferDecoder(bufs, totalSize, bufferIsImmutable);
- } else {
- // TODO(yilunchong): add another decoders to deal case 1 and 3.
- return newInstance(new IterableByteBufferInputStream(bufs));
- }
- }
-
/** Create a new CodedInputStream wrapping the given byte array. */
public static CodedInputStream newInstance(final byte[] buf) {
return newInstance(buf, 0, buf.length);
@@ -419,7 +375,8 @@ public abstract class CodedInputStream {
private boolean explicitDiscardUnknownFields = false;
- private static volatile boolean proto3DiscardUnknownFieldsDefault = false;
+ /** TODO(liujisi): flip the default.*/
+ private static volatile boolean proto3DiscardUnknownFieldsDefault = true;
static void setProto3DiscardUnknownsByDefaultForTest() {
proto3DiscardUnknownFieldsDefault = true;
@@ -831,19 +788,13 @@ public abstract class CodedInputStream {
public String readStringRequireUtf8() throws IOException {
final int size = readRawVarint32();
if (size > 0 && size <= (limit - pos)) {
- 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);
+ // 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);
}
if (size == 0) {
@@ -1536,8 +1487,6 @@ 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);
@@ -1558,26 +1507,19 @@ public abstract class CodedInputStream {
@Override
public String readStringRequireUtf8() throws IOException {
final int size = readRawVarint32();
- 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;
+ 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();
}
+
+ String result = new String(bytes, UTF_8);
+ pos += size;
+ return result;
}
if (size == 0) {
@@ -2345,15 +2287,11 @@ public abstract class CodedInputStream {
bytes = readRawBytesSlowPath(size);
tempPos = 0;
}
- 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);
+ // 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);
}
@Override
@@ -3084,859 +3022,4 @@ public abstract class CodedInputStream {
pos = size - tempPos;
}
}
-
- /**
- * Implementation of {@link CodedInputStream} that uses an {@link Iterable <ByteBuffer>} as the
- * data source. Requires the use of {@code sun.misc.Unsafe} to perform fast reads on the buffer.
- */
- private static final class IterableDirectByteBufferDecoder extends CodedInputStream {
- /** The object that need to decode. */
- private Iterable<ByteBuffer> input;
- /** The {@link Iterator} with type {@link ByteBuffer} of {@code input} */
- private Iterator<ByteBuffer> iterator;
- /** The current ByteBuffer; */
- private ByteBuffer currentByteBuffer;
- /**
- * If {@code true}, indicates that all the buffer are backing a {@link ByteString} and are
- * therefore considered to be an immutable input source.
- */
- private boolean immutable;
- /**
- * If {@code true}, indicates that calls to read {@link ByteString} or {@code byte[]}
- * <strong>may</strong> return slices of the underlying buffer, rather than copies.
- */
- private boolean enableAliasing;
- /** The global total message length limit */
- private int totalBufferSize;
- /** The amount of available data in the input beyond {@link #currentLimit}. */
- private int bufferSizeAfterCurrentLimit;
- /** The absolute position of the end of the current message. */
- private int currentLimit = Integer.MAX_VALUE;
- /** The last tag that was read from this stream. */
- private int lastTag;
- /** Total Bytes have been Read from the {@link Iterable} {@link ByteBuffer} */
- private int totalBytesRead;
- /** The start position offset of the whole message, used as to reset the totalBytesRead */
- private int startOffset;
- /** The current position for current ByteBuffer */
- private long currentByteBufferPos;
-
- private long currentByteBufferStartPos;
- /**
- * If the current ByteBuffer is unsafe-direct based, currentAddress is the start address of this
- * ByteBuffer; otherwise should be zero.
- */
- private long currentAddress;
- /** The limit position for current ByteBuffer */
- private long currentByteBufferLimit;
-
- /**
- * The constructor of {@code Iterable<ByteBuffer>} decoder.
- *
- * @param inputBufs The input data.
- * @param size The total size of the input data.
- * @param immutableFlag whether the input data is immutable.
- */
- private IterableDirectByteBufferDecoder(
- Iterable<ByteBuffer> inputBufs, int size, boolean immutableFlag) {
- totalBufferSize = size;
- input = inputBufs;
- iterator = input.iterator();
- immutable = immutableFlag;
- startOffset = totalBytesRead = 0;
- if (size == 0) {
- currentByteBuffer = EMPTY_BYTE_BUFFER;
- currentByteBufferPos = 0;
- currentByteBufferStartPos = 0;
- currentByteBufferLimit = 0;
- currentAddress = 0;
- } else {
- tryGetNextByteBuffer();
- }
- }
-
- /** To get the next ByteBuffer from {@code input}, and then update the parameters */
- private void getNextByteBuffer() throws InvalidProtocolBufferException {
- if (!iterator.hasNext()) {
- throw InvalidProtocolBufferException.truncatedMessage();
- }
- tryGetNextByteBuffer();
- }
-
- private void tryGetNextByteBuffer() {
- currentByteBuffer = iterator.next();
- totalBytesRead += (int) (currentByteBufferPos - currentByteBufferStartPos);
- currentByteBufferPos = currentByteBuffer.position();
- currentByteBufferStartPos = currentByteBufferPos;
- currentByteBufferLimit = currentByteBuffer.limit();
- currentAddress = UnsafeUtil.addressOffset(currentByteBuffer);
- currentByteBufferPos += currentAddress;
- currentByteBufferStartPos += currentAddress;
- currentByteBufferLimit += currentAddress;
- }
-
- @Override
- public int readTag() throws IOException {
- if (isAtEnd()) {
- lastTag = 0;
- return 0;
- }
-
- lastTag = readRawVarint32();
- if (WireFormat.getTagFieldNumber(lastTag) == 0) {
- // If we actually read zero (or any tag number corresponding to field
- // number zero), that's not a valid tag.
- throw InvalidProtocolBufferException.invalidTag();
- }
- return lastTag;
- }
-
- @Override
- public void checkLastTagWas(final int value) throws InvalidProtocolBufferException {
- if (lastTag != value) {
- throw InvalidProtocolBufferException.invalidEndTag();
- }
- }
-
- @Override
- public int getLastTag() {
- return lastTag;
- }
-
- @Override
- public boolean skipField(final int tag) throws IOException {
- switch (WireFormat.getTagWireType(tag)) {
- case WireFormat.WIRETYPE_VARINT:
- skipRawVarint();
- return true;
- case WireFormat.WIRETYPE_FIXED64:
- skipRawBytes(FIXED64_SIZE);
- return true;
- case WireFormat.WIRETYPE_LENGTH_DELIMITED:
- skipRawBytes(readRawVarint32());
- return true;
- case WireFormat.WIRETYPE_START_GROUP:
- skipMessage();
- checkLastTagWas(
- WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP));
- return true;
- case WireFormat.WIRETYPE_END_GROUP:
- return false;
- case WireFormat.WIRETYPE_FIXED32:
- skipRawBytes(FIXED32_SIZE);
- return true;
- default:
- throw InvalidProtocolBufferException.invalidWireType();
- }
- }
-
- @Override
- public boolean skipField(final int tag, final CodedOutputStream output) throws IOException {
- switch (WireFormat.getTagWireType(tag)) {
- case WireFormat.WIRETYPE_VARINT:
- {
- long value = readInt64();
- output.writeRawVarint32(tag);
- output.writeUInt64NoTag(value);
- return true;
- }
- case WireFormat.WIRETYPE_FIXED64:
- {
- long value = readRawLittleEndian64();
- output.writeRawVarint32(tag);
- output.writeFixed64NoTag(value);
- return true;
- }
- case WireFormat.WIRETYPE_LENGTH_DELIMITED:
- {
- ByteString value = readBytes();
- output.writeRawVarint32(tag);
- output.writeBytesNoTag(value);
- return true;
- }
- case WireFormat.WIRETYPE_START_GROUP:
- {
- output.writeRawVarint32(tag);
- skipMessage(output);
- int endtag =
- WireFormat.makeTag(
- WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP);
- checkLastTagWas(endtag);
- output.writeRawVarint32(endtag);
- return true;
- }
- case WireFormat.WIRETYPE_END_GROUP:
- {
- return false;
- }
- case WireFormat.WIRETYPE_FIXED32:
- {
- int value = readRawLittleEndian32();
- output.writeRawVarint32(tag);
- output.writeFixed32NoTag(value);
- return true;
- }
- default:
- throw InvalidProtocolBufferException.invalidWireType();
- }
- }
-
- @Override
- public void skipMessage() throws IOException {
- while (true) {
- final int tag = readTag();
- if (tag == 0 || !skipField(tag)) {
- return;
- }
- }
- }
-
- @Override
- public void skipMessage(CodedOutputStream output) throws IOException {
- while (true) {
- final int tag = readTag();
- if (tag == 0 || !skipField(tag, output)) {
- return;
- }
- }
- }
-
- // -----------------------------------------------------------------
-
- @Override
- public double readDouble() throws IOException {
- return Double.longBitsToDouble(readRawLittleEndian64());
- }
-
- @Override
- public float readFloat() throws IOException {
- return Float.intBitsToFloat(readRawLittleEndian32());
- }
-
- @Override
- public long readUInt64() throws IOException {
- return readRawVarint64();
- }
-
- @Override
- public long readInt64() throws IOException {
- return readRawVarint64();
- }
-
- @Override
- public int readInt32() throws IOException {
- return readRawVarint32();
- }
-
- @Override
- public long readFixed64() throws IOException {
- return readRawLittleEndian64();
- }
-
- @Override
- public int readFixed32() throws IOException {
- return readRawLittleEndian32();
- }
-
- @Override
- public boolean readBool() throws IOException {
- return readRawVarint64() != 0;
- }
-
- @Override
- public String readString() throws IOException {
- final int size = readRawVarint32();
- if (size > 0 && size <= currentByteBufferLimit - currentByteBufferPos) {
- byte[] bytes = new byte[size];
- UnsafeUtil.copyMemory(currentByteBufferPos, bytes, 0, size);
- String result = new String(bytes, UTF_8);
- currentByteBufferPos += size;
- return result;
- } else if (size > 0 && size <= remaining()) {
- // TODO(yilunchong): To use an underlying bytes[] instead of allocating a new bytes[]
- byte[] bytes = new byte[size];
- readRawBytesTo(bytes, 0, size);
- String result = new String(bytes, UTF_8);
- return result;
- }
-
- if (size == 0) {
- return "";
- }
- if (size < 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- @Override
- public String readStringRequireUtf8() throws IOException {
- final int size = readRawVarint32();
- if (size > 0 && size <= currentByteBufferLimit - currentByteBufferPos) {
- 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;
- }
- }
- if (size >= 0 && size <= remaining()) {
- byte[] bytes = new byte[size];
- readRawBytesTo(bytes, 0, size);
- 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;
- }
- }
-
- if (size == 0) {
- return "";
- }
- if (size <= 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- @Override
- public void readGroup(
- final int fieldNumber,
- final MessageLite.Builder builder,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- if (recursionDepth >= recursionLimit) {
- throw InvalidProtocolBufferException.recursionLimitExceeded();
- }
- ++recursionDepth;
- builder.mergeFrom(this, extensionRegistry);
- checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP));
- --recursionDepth;
- }
-
-
- @Override
- public <T extends MessageLite> T readGroup(
- final int fieldNumber,
- final Parser<T> parser,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- if (recursionDepth >= recursionLimit) {
- throw InvalidProtocolBufferException.recursionLimitExceeded();
- }
- ++recursionDepth;
- T result = parser.parsePartialFrom(this, extensionRegistry);
- checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP));
- --recursionDepth;
- return result;
- }
-
- @Deprecated
- @Override
- public void readUnknownGroup(final int fieldNumber, final MessageLite.Builder builder)
- throws IOException {
- readGroup(fieldNumber, builder, ExtensionRegistryLite.getEmptyRegistry());
- }
-
- @Override
- public void readMessage(
- final MessageLite.Builder builder, final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- final int length = readRawVarint32();
- if (recursionDepth >= recursionLimit) {
- throw InvalidProtocolBufferException.recursionLimitExceeded();
- }
- final int oldLimit = pushLimit(length);
- ++recursionDepth;
- builder.mergeFrom(this, extensionRegistry);
- checkLastTagWas(0);
- --recursionDepth;
- popLimit(oldLimit);
- }
-
-
- @Override
- public <T extends MessageLite> T readMessage(
- final Parser<T> parser, final ExtensionRegistryLite extensionRegistry) throws IOException {
- int length = readRawVarint32();
- if (recursionDepth >= recursionLimit) {
- throw InvalidProtocolBufferException.recursionLimitExceeded();
- }
- final int oldLimit = pushLimit(length);
- ++recursionDepth;
- T result = parser.parsePartialFrom(this, extensionRegistry);
- checkLastTagWas(0);
- --recursionDepth;
- popLimit(oldLimit);
- return result;
- }
-
- @Override
- public ByteString readBytes() throws IOException {
- final int size = readRawVarint32();
- if (size > 0 && size <= currentByteBufferLimit - currentByteBufferPos) {
- if (immutable && enableAliasing) {
- final int idx = (int) (currentByteBufferPos - currentAddress);
- final ByteString result = ByteString.wrap(slice(idx, idx + size));
- currentByteBufferPos += size;
- return result;
- } else {
- byte[] bytes;
- bytes = new byte[size];
- UnsafeUtil.copyMemory(currentByteBufferPos, bytes, 0, size);
- currentByteBufferPos += size;
- return ByteString.wrap(bytes);
- }
- } else if (size > 0 && size <= remaining()) {
- byte[] temp = new byte[size];
- readRawBytesTo(temp, 0, size);
- return ByteString.wrap(temp);
- }
-
- if (size == 0) {
- return ByteString.EMPTY;
- }
- if (size < 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- @Override
- public byte[] readByteArray() throws IOException {
- return readRawBytes(readRawVarint32());
- }
-
- @Override
- public ByteBuffer readByteBuffer() throws IOException {
- final int size = readRawVarint32();
- if (size > 0 && size <= currentRemaining()) {
- if (!immutable && enableAliasing) {
- currentByteBufferPos += size;
- return slice(
- (int) (currentByteBufferPos - currentAddress - size),
- (int) (currentByteBufferPos - currentAddress));
- } else {
- byte[] bytes = new byte[size];
- UnsafeUtil.copyMemory(currentByteBufferPos, bytes, 0, size);
- currentByteBufferPos += size;
- return ByteBuffer.wrap(bytes);
- }
- } else if (size > 0 && size <= remaining()) {
- byte[] temp = new byte[size];
- readRawBytesTo(temp, 0, size);
- return ByteBuffer.wrap(temp);
- }
-
- if (size == 0) {
- return EMPTY_BYTE_BUFFER;
- }
- if (size < 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- @Override
- public int readUInt32() throws IOException {
- return readRawVarint32();
- }
-
- @Override
- public int readEnum() throws IOException {
- return readRawVarint32();
- }
-
- @Override
- public int readSFixed32() throws IOException {
- return readRawLittleEndian32();
- }
-
- @Override
- public long readSFixed64() throws IOException {
- return readRawLittleEndian64();
- }
-
- @Override
- public int readSInt32() throws IOException {
- return decodeZigZag32(readRawVarint32());
- }
-
- @Override
- public long readSInt64() throws IOException {
- return decodeZigZag64(readRawVarint64());
- }
-
- @Override
- public int readRawVarint32() throws IOException {
- fastpath:
- {
- long tempPos = currentByteBufferPos;
-
- if (currentByteBufferLimit == currentByteBufferPos) {
- break fastpath;
- }
-
- int x;
- if ((x = UnsafeUtil.getByte(tempPos++)) >= 0) {
- currentByteBufferPos++;
- return x;
- } else if (currentByteBufferLimit - currentByteBufferPos < 10) {
- break fastpath;
- } else if ((x ^= (UnsafeUtil.getByte(tempPos++) << 7)) < 0) {
- x ^= (~0 << 7);
- } else if ((x ^= (UnsafeUtil.getByte(tempPos++) << 14)) >= 0) {
- x ^= (~0 << 7) ^ (~0 << 14);
- } else if ((x ^= (UnsafeUtil.getByte(tempPos++) << 21)) < 0) {
- x ^= (~0 << 7) ^ (~0 << 14) ^ (~0 << 21);
- } else {
- int y = UnsafeUtil.getByte(tempPos++);
- x ^= y << 28;
- x ^= (~0 << 7) ^ (~0 << 14) ^ (~0 << 21) ^ (~0 << 28);
- if (y < 0
- && UnsafeUtil.getByte(tempPos++) < 0
- && UnsafeUtil.getByte(tempPos++) < 0
- && UnsafeUtil.getByte(tempPos++) < 0
- && UnsafeUtil.getByte(tempPos++) < 0
- && UnsafeUtil.getByte(tempPos++) < 0) {
- break fastpath; // Will throw malformedVarint()
- }
- }
- currentByteBufferPos = tempPos;
- return x;
- }
- return (int) readRawVarint64SlowPath();
- }
-
- @Override
- public long readRawVarint64() throws IOException {
- fastpath:
- {
- long tempPos = currentByteBufferPos;
-
- if (currentByteBufferLimit == currentByteBufferPos) {
- break fastpath;
- }
-
- long x;
- int y;
- if ((y = UnsafeUtil.getByte(tempPos++)) >= 0) {
- currentByteBufferPos++;
- return y;
- } else if (currentByteBufferLimit - currentByteBufferPos < 10) {
- break fastpath;
- } else if ((y ^= (UnsafeUtil.getByte(tempPos++) << 7)) < 0) {
- x = y ^ (~0 << 7);
- } else if ((y ^= (UnsafeUtil.getByte(tempPos++) << 14)) >= 0) {
- x = y ^ ((~0 << 7) ^ (~0 << 14));
- } else if ((y ^= (UnsafeUtil.getByte(tempPos++) << 21)) < 0) {
- x = y ^ ((~0 << 7) ^ (~0 << 14) ^ (~0 << 21));
- } else if ((x = y ^ ((long) UnsafeUtil.getByte(tempPos++) << 28)) >= 0L) {
- x ^= (~0L << 7) ^ (~0L << 14) ^ (~0L << 21) ^ (~0L << 28);
- } else if ((x ^= ((long) UnsafeUtil.getByte(tempPos++) << 35)) < 0L) {
- x ^= (~0L << 7) ^ (~0L << 14) ^ (~0L << 21) ^ (~0L << 28) ^ (~0L << 35);
- } else if ((x ^= ((long) UnsafeUtil.getByte(tempPos++) << 42)) >= 0L) {
- x ^= (~0L << 7) ^ (~0L << 14) ^ (~0L << 21) ^ (~0L << 28) ^ (~0L << 35) ^ (~0L << 42);
- } else if ((x ^= ((long) UnsafeUtil.getByte(tempPos++) << 49)) < 0L) {
- x ^=
- (~0L << 7)
- ^ (~0L << 14)
- ^ (~0L << 21)
- ^ (~0L << 28)
- ^ (~0L << 35)
- ^ (~0L << 42)
- ^ (~0L << 49);
- } else {
- x ^= ((long) UnsafeUtil.getByte(tempPos++) << 56);
- x ^=
- (~0L << 7)
- ^ (~0L << 14)
- ^ (~0L << 21)
- ^ (~0L << 28)
- ^ (~0L << 35)
- ^ (~0L << 42)
- ^ (~0L << 49)
- ^ (~0L << 56);
- if (x < 0L) {
- if (UnsafeUtil.getByte(tempPos++) < 0L) {
- break fastpath; // Will throw malformedVarint()
- }
- }
- }
- currentByteBufferPos = tempPos;
- return x;
- }
- return readRawVarint64SlowPath();
- }
-
- @Override
- long readRawVarint64SlowPath() throws IOException {
- long result = 0;
- for (int shift = 0; shift < 64; shift += 7) {
- final byte b = readRawByte();
- result |= (long) (b & 0x7F) << shift;
- if ((b & 0x80) == 0) {
- return result;
- }
- }
- throw InvalidProtocolBufferException.malformedVarint();
- }
-
- @Override
- public int readRawLittleEndian32() throws IOException {
- if (currentRemaining() >= FIXED32_SIZE) {
- long tempPos = currentByteBufferPos;
- currentByteBufferPos += FIXED32_SIZE;
- return (((UnsafeUtil.getByte(tempPos) & 0xff))
- | ((UnsafeUtil.getByte(tempPos + 1) & 0xff) << 8)
- | ((UnsafeUtil.getByte(tempPos + 2) & 0xff) << 16)
- | ((UnsafeUtil.getByte(tempPos + 3) & 0xff) << 24));
- }
- return ((readRawByte() & 0xff)
- | ((readRawByte() & 0xff) << 8)
- | ((readRawByte() & 0xff) << 16)
- | ((readRawByte() & 0xff) << 24));
- }
-
- @Override
- public long readRawLittleEndian64() throws IOException {
- if (currentRemaining() >= FIXED64_SIZE) {
- long tempPos = currentByteBufferPos;
- currentByteBufferPos += FIXED64_SIZE;
- return (((UnsafeUtil.getByte(tempPos) & 0xffL))
- | ((UnsafeUtil.getByte(tempPos + 1) & 0xffL) << 8)
- | ((UnsafeUtil.getByte(tempPos + 2) & 0xffL) << 16)
- | ((UnsafeUtil.getByte(tempPos + 3) & 0xffL) << 24)
- | ((UnsafeUtil.getByte(tempPos + 4) & 0xffL) << 32)
- | ((UnsafeUtil.getByte(tempPos + 5) & 0xffL) << 40)
- | ((UnsafeUtil.getByte(tempPos + 6) & 0xffL) << 48)
- | ((UnsafeUtil.getByte(tempPos + 7) & 0xffL) << 56));
- }
- return ((readRawByte() & 0xffL)
- | ((readRawByte() & 0xffL) << 8)
- | ((readRawByte() & 0xffL) << 16)
- | ((readRawByte() & 0xffL) << 24)
- | ((readRawByte() & 0xffL) << 32)
- | ((readRawByte() & 0xffL) << 40)
- | ((readRawByte() & 0xffL) << 48)
- | ((readRawByte() & 0xffL) << 56));
- }
-
- @Override
- public void enableAliasing(boolean enabled) {
- this.enableAliasing = enabled;
- }
-
- @Override
- public void resetSizeCounter() {
- startOffset = (int) (totalBytesRead + currentByteBufferPos - currentByteBufferStartPos);
- }
-
- @Override
- public int pushLimit(int byteLimit) throws InvalidProtocolBufferException {
- if (byteLimit < 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
- byteLimit += getTotalBytesRead();
- final int oldLimit = currentLimit;
- if (byteLimit > oldLimit) {
- throw InvalidProtocolBufferException.truncatedMessage();
- }
- currentLimit = byteLimit;
-
- recomputeBufferSizeAfterLimit();
-
- return oldLimit;
- }
-
- private void recomputeBufferSizeAfterLimit() {
- totalBufferSize += bufferSizeAfterCurrentLimit;
- final int bufferEnd = totalBufferSize - startOffset;
- if (bufferEnd > currentLimit) {
- // Limit is in current buffer.
- bufferSizeAfterCurrentLimit = bufferEnd - currentLimit;
- totalBufferSize -= bufferSizeAfterCurrentLimit;
- } else {
- bufferSizeAfterCurrentLimit = 0;
- }
- }
-
- @Override
- public void popLimit(final int oldLimit) {
- currentLimit = oldLimit;
- recomputeBufferSizeAfterLimit();
- }
-
- @Override
- public int getBytesUntilLimit() {
- if (currentLimit == Integer.MAX_VALUE) {
- return -1;
- }
-
- return currentLimit - getTotalBytesRead();
- }
-
- @Override
- public boolean isAtEnd() throws IOException {
- return totalBytesRead + currentByteBufferPos - currentByteBufferStartPos == totalBufferSize;
- }
-
- @Override
- public int getTotalBytesRead() {
- return (int)
- (totalBytesRead - startOffset + currentByteBufferPos - currentByteBufferStartPos);
- }
-
- @Override
- public byte readRawByte() throws IOException {
- if (currentRemaining() == 0) {
- getNextByteBuffer();
- }
- return UnsafeUtil.getByte(currentByteBufferPos++);
- }
-
- @Override
- public byte[] readRawBytes(final int length) throws IOException {
- if (length >= 0 && length <= currentRemaining()) {
- byte[] bytes = new byte[length];
- UnsafeUtil.copyMemory(currentByteBufferPos, bytes, 0, length);
- currentByteBufferPos += length;
- return bytes;
- }
- if (length >= 0 && length <= remaining()) {
- byte[] bytes = new byte[length];
- readRawBytesTo(bytes, 0, length);
- return bytes;
- }
-
- if (length <= 0) {
- if (length == 0) {
- return EMPTY_BYTE_ARRAY;
- } else {
- throw InvalidProtocolBufferException.negativeSize();
- }
- }
-
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- /**
- * Try to get raw bytes from {@code input} with the size of {@code length} and copy to {@code
- * bytes} array. If the size is bigger than the number of remaining bytes in the input, then
- * throw {@code truncatedMessage} exception.
- *
- * @param bytes
- * @param offset
- * @param length
- * @throws IOException
- */
- private void readRawBytesTo(byte[] bytes, int offset, final int length) throws IOException {
- if (length >= 0 && length <= remaining()) {
- int l = length;
- while (l > 0) {
- if (currentRemaining() == 0) {
- getNextByteBuffer();
- }
- int bytesToCopy = Math.min(l, (int) currentRemaining());
- UnsafeUtil.copyMemory(currentByteBufferPos, bytes, length - l + offset, bytesToCopy);
- l -= bytesToCopy;
- currentByteBufferPos += bytesToCopy;
- }
- return;
- }
-
- if (length <= 0) {
- if (length == 0) {
- return;
- } else {
- throw InvalidProtocolBufferException.negativeSize();
- }
- }
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- @Override
- public void skipRawBytes(final int length) throws IOException {
- if (length >= 0
- && length
- <= (totalBufferSize
- - totalBytesRead
- - currentByteBufferPos
- + currentByteBufferStartPos)) {
- // We have all the bytes we need already.
- int l = length;
- while (l > 0) {
- if (currentRemaining() == 0) {
- getNextByteBuffer();
- }
- int rl = Math.min(l, (int) currentRemaining());
- l -= rl;
- currentByteBufferPos += rl;
- }
- return;
- }
-
- if (length < 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- // TODO: optimize to fastpath
- private void skipRawVarint() throws IOException {
- for (int i = 0; i < MAX_VARINT_SIZE; i++) {
- if (readRawByte() >= 0) {
- return;
- }
- }
- throw InvalidProtocolBufferException.malformedVarint();
- }
-
- /**
- * Try to get the number of remaining bytes in {@code input}.
- *
- * @return the number of remaining bytes in {@code input}.
- */
- private int remaining() {
- return (int)
- (totalBufferSize - totalBytesRead - currentByteBufferPos + currentByteBufferStartPos);
- }
-
- /**
- * Try to get the number of remaining bytes in {@code currentByteBuffer}.
- *
- * @return the number of remaining bytes in {@code currentByteBuffer}
- */
- private long currentRemaining() {
- return (currentByteBufferLimit - currentByteBufferPos);
- }
-
- private ByteBuffer slice(int begin, int end) throws IOException {
- int prevPos = currentByteBuffer.position();
- int prevLimit = currentByteBuffer.limit();
- try {
- currentByteBuffer.position(begin);
- currentByteBuffer.limit(end);
- return currentByteBuffer.slice();
- } catch (IllegalArgumentException e) {
- throw InvalidProtocolBufferException.truncatedMessage();
- } finally {
- currentByteBuffer.position(prevPos);
- currentByteBuffer.limit(prevLimit);
- }
- }
- }
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
index 7b1ac65120..093a5f616b 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
@@ -377,7 +377,6 @@ public abstract class CodedOutputStream extends ByteOutput {
public abstract void writeMessage(final int fieldNumber, final MessageLite value)
throws IOException;
-
/**
* Write a MessageSet extension field to the stream. For historical reasons,
* the wire format differs from normal fields.
@@ -482,7 +481,6 @@ public abstract class CodedOutputStream extends ByteOutput {
// Abstract to avoid overhead of additional virtual method calls.
public abstract void writeMessageNoTag(final MessageLite value) throws IOException;
-
//=================================================================
@ExperimentalApi
@@ -668,7 +666,6 @@ public abstract class CodedOutputStream extends ByteOutput {
return computeTagSize(fieldNumber) + computeMessageSizeNoTag(value);
}
-
/**
* Compute the number of bytes that would be needed to encode a
* MessageSet extension to the stream. For historical reasons,
@@ -916,7 +913,6 @@ public abstract class CodedOutputStream extends ByteOutput {
return computeLengthDelimitedFieldSize(value.getSerializedSize());
}
-
static int computeLengthDelimitedFieldSize(int fieldLength) {
return computeUInt32SizeNoTag(fieldLength) + fieldLength;
}
@@ -1053,7 +1049,6 @@ public abstract class CodedOutputStream extends ByteOutput {
writeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP);
}
-
/**
* Write a {@code group} field to the stream.
*
@@ -1064,7 +1059,6 @@ public abstract class CodedOutputStream extends ByteOutput {
value.writeTo(this);
}
-
/**
* Compute the number of bytes that would be needed to encode a
* {@code group} field, including tag.
@@ -1076,7 +1070,6 @@ public abstract class CodedOutputStream extends ByteOutput {
return computeTagSize(fieldNumber) * 2 + computeGroupSizeNoTag(value);
}
-
/**
* Compute the number of bytes that would be needed to encode a
* {@code group} field.
@@ -1086,7 +1079,6 @@ public abstract class CodedOutputStream extends ByteOutput {
return value.getSerializedSize();
}
-
/**
* Encode and write a varint. {@code value} is treated as
* unsigned, so it won't be sign-extended if negative.
@@ -1281,7 +1273,6 @@ public abstract class CodedOutputStream extends ByteOutput {
writeMessageNoTag(value);
}
-
@Override
public final void writeMessageSetExtension(final int fieldNumber, final MessageLite value)
throws IOException {
@@ -1306,7 +1297,6 @@ public abstract class CodedOutputStream extends ByteOutput {
value.writeTo(this);
}
-
@Override
public final void write(byte value) throws IOException {
try {
@@ -1618,7 +1608,6 @@ public abstract class CodedOutputStream extends ByteOutput {
writeMessageNoTag(value);
}
-
@Override
public void writeMessageSetExtension(final int fieldNumber, final MessageLite value)
throws IOException {
@@ -1643,7 +1632,6 @@ public abstract class CodedOutputStream extends ByteOutput {
value.writeTo(this);
}
-
@Override
public void write(byte value) throws IOException {
try {
@@ -1940,7 +1928,6 @@ public abstract class CodedOutputStream extends ByteOutput {
writeMessageNoTag(value);
}
-
@Override
public void writeMessageSetExtension(int fieldNumber, MessageLite value) throws IOException {
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP);
@@ -1963,7 +1950,6 @@ public abstract class CodedOutputStream extends ByteOutput {
value.writeTo(this);
}
-
@Override
public void write(byte value) throws IOException {
if (position >= limit) {
@@ -2470,7 +2456,6 @@ public abstract class CodedOutputStream extends ByteOutput {
writeMessageNoTag(value);
}
-
@Override
public void writeMessageSetExtension(final int fieldNumber, final MessageLite value)
throws IOException {
@@ -2495,7 +2480,6 @@ public abstract class CodedOutputStream extends ByteOutput {
value.writeTo(this);
}
-
@Override
public void write(byte value) throws IOException {
if (position == limit) {
@@ -2775,7 +2759,6 @@ public abstract class CodedOutputStream extends ByteOutput {
writeMessageNoTag(value);
}
-
@Override
public void writeMessageSetExtension(final int fieldNumber, final MessageLite value)
throws IOException {
@@ -2800,7 +2783,6 @@ public abstract class CodedOutputStream extends ByteOutput {
value.writeTo(this);
}
-
@Override
public void write(byte value) throws IOException {
if (position == limit) {
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Descriptors.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Descriptors.java
index 75b16fe30e..75b16fe30e 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Descriptors.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Descriptors.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java
index 7ae9434906..7ae9434906 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java
index 5b28b4a8c7..867b85ce86 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java
@@ -82,18 +82,6 @@ final class DoubleArrayList extends AbstractProtobufList<Double>
}
@Override
- protected void removeRange(int fromIndex, int toIndex) {
- ensureIsMutable();
- if (toIndex < fromIndex) {
- throw new IndexOutOfBoundsException("toIndex < fromIndex");
- }
-
- System.arraycopy(array, toIndex, array, fromIndex, size - toIndex);
- size -= (toIndex - fromIndex);
- modCount++;
- }
-
- @Override
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -259,9 +247,7 @@ final class DoubleArrayList extends AbstractProtobufList<Double>
ensureIsMutable();
ensureIndexInRange(index);
double value = array[index];
- if (index < size - 1) {
- System.arraycopy(array, index + 1, array, index, size - index);
- }
+ System.arraycopy(array, index + 1, array, index, size - index);
size--;
modCount++;
return value;
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DynamicMessage.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DynamicMessage.java
index a6a774b76e..ba5320217d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/DynamicMessage.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/DynamicMessage.java
@@ -339,20 +339,6 @@ public final class DynamicMessage extends AbstractMessage {
this.fields = FieldSet.newFieldSet();
this.unknownFields = UnknownFieldSet.getDefaultInstance();
this.oneofCases = new FieldDescriptor[type.toProto().getOneofDeclCount()];
- // A MapEntry has all of its fields present at all times.
- if (type.getOptions().getMapEntry()) {
- populateMapEntry();
- }
- }
-
- private void populateMapEntry() {
- for (FieldDescriptor field : type.getFields()) {
- if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
- fields.setField(field, getDefaultInstance(field.getMessageType()));
- } else {
- fields.setField(field, field.getDefaultValue());
- }
- }
}
// ---------------------------------------------------------------
@@ -365,10 +351,6 @@ public final class DynamicMessage extends AbstractMessage {
} else {
fields.clear();
}
- // A MapEntry has all of its fields present at all times.
- if (type.getOptions().getMapEntry()) {
- populateMapEntry();
- }
unknownFields = UnknownFieldSet.getDefaultInstance();
return this;
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java
index 3cd4c88492..3cd4c88492 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Extension.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Extension.java
index 5df12e6422..5df12e6422 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Extension.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Extension.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionLite.java
index f8f5bd2c4f..f8f5bd2c4f 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionLite.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java
index a22a74a03c..a22a74a03c 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java
index 89f7ab9b33..89f7ab9b33 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java
index f3d48d3af3..f3d48d3af3 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/FieldSet.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/FieldSet.java
index c09daa32c7..8a9239edef 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/FieldSet.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/FieldSet.java
@@ -102,11 +102,6 @@ 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/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/FloatArrayList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/FloatArrayList.java
index 7c080af3ee..76645583eb 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/FloatArrayList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/FloatArrayList.java
@@ -82,18 +82,6 @@ final class FloatArrayList extends AbstractProtobufList<Float>
}
@Override
- protected void removeRange(int fromIndex, int toIndex) {
- ensureIsMutable();
- if (toIndex < fromIndex) {
- throw new IndexOutOfBoundsException("toIndex < fromIndex");
- }
-
- System.arraycopy(array, toIndex, array, fromIndex, size - toIndex);
- size -= (toIndex - fromIndex);
- modCount++;
- }
-
- @Override
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -258,9 +246,7 @@ final class FloatArrayList extends AbstractProtobufList<Float>
ensureIsMutable();
ensureIndexInRange(index);
float value = array[index];
- if (index < size - 1) {
- System.arraycopy(array, index + 1, array, index, size - index);
- }
+ System.arraycopy(array, index + 1, array, index, size - index);
size--;
modCount++;
return value;
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java
index 60179e371d..60179e371d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
index df01547e56..7116ae1c28 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
@@ -31,6 +31,7 @@
package com.google.protobuf;
import com.google.protobuf.AbstractMessageLite.Builder.LimitedInputStream;
+import com.google.protobuf.GeneratedMessageLite.EqualsVisitor.NotEqualsException;
import com.google.protobuf.Internal.BooleanList;
import com.google.protobuf.Internal.DoubleList;
import com.google.protobuf.Internal.EnumLiteMap;
@@ -51,7 +52,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
/**
* Lite version of {@link GeneratedMessage}.
@@ -62,12 +62,6 @@ public abstract class GeneratedMessageLite<
MessageType extends GeneratedMessageLite<MessageType, BuilderType>,
BuilderType extends GeneratedMessageLite.Builder<MessageType, BuilderType>>
extends AbstractMessageLite<MessageType, BuilderType> {
- // BEGIN REGULAR
- static final boolean ENABLE_EXPERIMENTAL_RUNTIME_AT_BUILD_TIME = false;
- // END REGULAR
- // BEGIN EXPERIMENTAL
- // static final boolean ENABLE_EXPERIMENTAL_RUNTIME_AT_BUILD_TIME = true;
- // END EXPERIMENTAL
/** For use by generated code only. Lazily initialized to reduce allocations. */
protected UnknownFieldSetLite unknownFields = UnknownFieldSetLite.getDefaultInstance();
@@ -116,19 +110,12 @@ public abstract class GeneratedMessageLite<
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
- // BEGIN EXPERIMENTAL
- // memoizedHashCode = Protobuf.getInstance().schemaFor(this).hashCode(this);
- // return memoizedHashCode;
- // END EXPERIMENTAL
- // BEGIN REGULAR
HashCodeVisitor visitor = new HashCodeVisitor();
visit(visitor, (MessageType) this);
memoizedHashCode = visitor.hashCode;
return memoizedHashCode;
- // END REGULAR
}
- // BEGIN REGULAR
@SuppressWarnings("unchecked") // Guaranteed by runtime
int hashCode(HashCodeVisitor visitor) {
if (memoizedHashCode == 0) {
@@ -140,7 +127,6 @@ public abstract class GeneratedMessageLite<
}
return memoizedHashCode;
}
- // END REGULAR
@SuppressWarnings("unchecked") // Guaranteed by isInstance + runtime
@Override
@@ -153,22 +139,18 @@ public abstract class GeneratedMessageLite<
return false;
}
- // BEGIN EXPERIMENTAL
- // return Protobuf.getInstance().schemaFor(this).equals(this, (MessageType) other);
- // END EXPERIMENTAL
- // BEGIN REGULAR
try {
visit(EqualsVisitor.INSTANCE, (MessageType) other);
- } catch (EqualsVisitor.NotEqualsException e) {
+ } catch (NotEqualsException e) {
return false;
}
return true;
- // END REGULAR
}
- // BEGIN REGULAR
- /** Same as {@link #equals(Object)} but throws {@code NotEqualsException}. */
+ /**
+ * Same as {@link #equals(Object)} but throws {@code NotEqualsException}.
+ */
@SuppressWarnings("unchecked") // Guaranteed by isInstance + runtime
boolean equals(EqualsVisitor visitor, MessageLite other) {
if (this == other) {
@@ -182,13 +164,14 @@ public abstract class GeneratedMessageLite<
visit(visitor, (MessageType) other);
return true;
}
- // END REGULAR
// The general strategy for unknown fields is to use an UnknownFieldSetLite that is treated as
// mutable during the parsing constructor and immutable after. This allows us to avoid
// any unnecessary intermediary allocations while reducing the generated code size.
- /** Lazily initializes unknown fields. */
+ /**
+ * Lazily initializes unknown fields.
+ */
private final void ensureUnknownFieldsInitialized() {
if (unknownFields == UnknownFieldSetLite.getDefaultInstance()) {
unknownFields = UnknownFieldSetLite.newInstance();
@@ -230,32 +213,14 @@ public abstract class GeneratedMessageLite<
* Called by subclasses to complete parsing. For use by generated code only.
*/
protected void makeImmutable() {
- // BEGIN REGULAR
dynamicMethod(MethodToInvoke.MAKE_IMMUTABLE);
- unknownFields.makeImmutable();
- // END REGULAR
- // BEGIN EXPERIMENTAL
- // Protobuf.getInstance().schemaFor(this).makeImmutable(this);
- // END EXPERIMENTAL
- }
-
- protected final <
- MessageType extends GeneratedMessageLite<MessageType, BuilderType>,
- BuilderType extends GeneratedMessageLite.Builder<MessageType, BuilderType>>
- BuilderType createBuilder() {
- return (BuilderType) dynamicMethod(MethodToInvoke.NEW_BUILDER);
- }
- protected final <
- MessageType extends GeneratedMessageLite<MessageType, BuilderType>,
- BuilderType extends GeneratedMessageLite.Builder<MessageType, BuilderType>>
- BuilderType createBuilder(MessageType prototype) {
- return ((BuilderType) createBuilder()).mergeFrom(prototype);
+ unknownFields.makeImmutable();
}
@Override
public final boolean isInitialized() {
- return isInitialized((MessageType) this, Boolean.TRUE);
+ return dynamicMethod(MethodToInvoke.IS_INITIALIZED, Boolean.TRUE) != null;
}
@Override
@@ -273,15 +238,11 @@ public abstract class GeneratedMessageLite<
* For use by generated code only.
*/
public static enum MethodToInvoke {
- // BEGIN REGULAR
+ // Rely on/modify instance state
IS_INITIALIZED,
VISIT,
MERGE_FROM_STREAM,
MAKE_IMMUTABLE,
- // END REGULAR
- // Rely on/modify instance state
- GET_MEMOIZED_IS_INITIALIZED,
- SET_MEMOIZED_IS_INITIALIZED,
// Rely on static state
NEW_MUTABLE_INSTANCE,
@@ -295,30 +256,25 @@ public abstract class GeneratedMessageLite<
* Theses different kinds of operations are required to implement message-level operations for
* builders in the runtime. This method bundles those operations to reduce the generated methods
* count.
- *
* <ul>
- * <li>{@code MERGE_FROM_STREAM} is parameterized with an {@link CodedInputStream} and {@link
- * ExtensionRegistryLite}. It consumes the input stream, parsing the contents into the
- * returned protocol buffer. If parsing throws an {@link InvalidProtocolBufferException},
- * the implementation wraps it in a RuntimeException.
- * <li>{@code NEW_INSTANCE} returns a new instance of the protocol buffer that has not yet been
- * made immutable. See {@code MAKE_IMMUTABLE}.
- * <li>{@code IS_INITIALIZED} returns {@code null} for false and the default instance for true.
- * It doesn't use or modify any memoized value.
- * <li>{@code GET_MEMOIZED_IS_INITIALIZED} returns the memoized {@code isInitialized} byte
- * value.
- * <li>{@code SET_MEMOIZED_IS_INITIALIZED} sets the memoized {@code isInitilaized} byte value to
- * 1 if the first parameter is not null, or to 0 if the first parameter is null.
- * <li>{@code NEW_BUILDER} returns a {@code BuilderType} instance.
- * <li>{@code VISIT} is parameterized with a {@code Visitor} and a {@code MessageType} and
- * recursively iterates through the fields side by side between this and the instance.
- * <li>{@code MAKE_IMMUTABLE} sets all internal fields to an immutable state.
+ * <li>{@code MERGE_FROM_STREAM} is parameterized with an {@link CodedInputStream} and
+ * {@link ExtensionRegistryLite}. It consumes the input stream, parsing the contents into the
+ * returned protocol buffer. If parsing throws an {@link InvalidProtocolBufferException}, the
+ * implementation wraps it in a RuntimeException.
+ * <li>{@code NEW_INSTANCE} returns a new instance of the protocol buffer that has not yet been
+ * made immutable. See {@code MAKE_IMMUTABLE}.
+ * <li>{@code IS_INITIALIZED} is parameterized with a {@code Boolean} detailing whether to
+ * memoize. It returns {@code null} for false and the default instance for true. We optionally
+ * memoize to support the Builder case, where memoization is not desired.
+ * <li>{@code NEW_BUILDER} returns a {@code BuilderType} instance.
+ * <li>{@code VISIT} is parameterized with a {@code Visitor} and a {@code MessageType} and
+ * recursively iterates through the fields side by side between this and the instance.
+ * <li>{@code MAKE_IMMUTABLE} sets all internal fields to an immutable state.
* </ul>
- *
* This method, plus the implementation of the Builder, enables the Builder class to be proguarded
* away entirely on Android.
- *
- * <p>For use by generated code only.
+ * <p>
+ * For use by generated code only.
*/
protected abstract Object dynamicMethod(MethodToInvoke method, Object arg0, Object arg1);
@@ -336,27 +292,14 @@ public abstract class GeneratedMessageLite<
return dynamicMethod(method, null, null);
}
- // BEGIN REGULAR
void visit(Visitor visitor, MessageType other) {
dynamicMethod(MethodToInvoke.VISIT, visitor, other);
unknownFields = visitor.visitUnknownFields(unknownFields, other.unknownFields);
}
- // END REGULAR
-
- @Override
- int getMemoizedSerializedSize() {
- return memoizedSerializedSize;
- }
-
- @Override
- void setMemoizedSerializedSize(int size) {
- memoizedSerializedSize = size;
- }
-
-
/**
- * Merge some unknown fields into the {@link UnknownFieldSetLite} for this message.
+ * Merge some unknown fields into the {@link UnknownFieldSetLite} for this
+ * message.
*
* <p>For use by generated code only.
*/
@@ -449,12 +392,7 @@ public abstract class GeneratedMessageLite<
}
private void mergeFromInstance(MessageType dest, MessageType src) {
- // BEGIN EXPERIMENTAL
- // Protobuf.getInstance().schemaFor(dest).mergeFrom(dest, src);
- // END EXPERIMENTAL
- // BEGIN REGULAR
dest.visit(MergeFromVisitor.INSTANCE, src);
- // END REGULAR
}
@Override
@@ -463,41 +401,13 @@ public abstract class GeneratedMessageLite<
}
@Override
- public BuilderType mergeFrom(byte[] input, int offset, int length)
- throws InvalidProtocolBufferException {
- // BEGIN REGULAR
- return super.mergeFrom(input, offset, length);
- // END REGULAR
- // BEGIN EXPERIMENTAL
- // copyOnWrite();
- // try {
- // Protobuf.getInstance().schemaFor(instance).mergeFrom(
- // instance, input, offset, offset + length, new ArrayDecoders.Registers());
- // } catch (InvalidProtocolBufferException e) {
- // throw e;
- // } catch (IndexOutOfBoundsException e) {
- // throw InvalidProtocolBufferException.truncatedMessage();
- // } catch (IOException e) {
- // throw new RuntimeException("Reading from byte array should not throw IOException.", e);
- // }
- // return (BuilderType) this;
- // END EXPERIMENTAL
- }
-
- @Override
public BuilderType mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws IOException {
copyOnWrite();
try {
- // BEGIN REGULAR
instance.dynamicMethod(MethodToInvoke.MERGE_FROM_STREAM, input, extensionRegistry);
- // END REGULAR
- // BEGIN EXPERIMENTAL
- // Protobuf.getInstance().schemaFor(instance).mergeFrom(
- // instance, CodedInputStreamReader.forCodedInput(input), extensionRegistry);
- // END EXPERIMENTAL
} catch (RuntimeException e) {
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
@@ -546,8 +456,11 @@ 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.emptySet();
+ /**
+ * Represents the set of extensions on this message. For use by generated
+ * code only.
+ */
+ protected FieldSet<ExtensionDescriptor> extensions = FieldSet.newFieldSet();
@SuppressWarnings("unchecked")
protected final void mergeExtensionFields(final MessageType other) {
@@ -557,13 +470,11 @@ public abstract class GeneratedMessageLite<
extensions.mergeFrom(((ExtendableMessage) other).extensions);
}
- // BEGIN REGULAR
@Override
final void visit(Visitor visitor, MessageType other) {
super.visit(visitor, other);
extensions = visitor.visitExtensions(extensions, other.extensions);
}
- // END REGULAR
/**
* Parse an unknown field or an extension. For use by generated code only.
@@ -576,8 +487,7 @@ public abstract class GeneratedMessageLite<
MessageType defaultInstance,
CodedInputStream input,
ExtensionRegistryLite extensionRegistry,
- int tag)
- throws IOException {
+ int tag) throws IOException {
int fieldNumber = WireFormat.getTagFieldNumber(tag);
// TODO(dweis): How much bytecode would be saved by not requiring the generated code to
@@ -617,9 +527,7 @@ public abstract class GeneratedMessageLite<
if (unknown) { // Unknown field or wrong wire type. Skip.
return parseUnknownField(tag, input);
}
-
- ensureExtensionsAreMutable();
-
+
if (packed) {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
@@ -834,18 +742,10 @@ public abstract class GeneratedMessageLite<
if (subBuilder == null) {
subBuilder = extension.getMessageDefaultInstance().newBuilderForType();
}
- subBuilder.mergeFrom(rawBytes, extensionRegistry);
+ rawBytes.newCodedInput().readMessage(subBuilder, extensionRegistry);
MessageLite value = subBuilder.build();
- ensureExtensionsAreMutable().setField(
- extension.descriptor, extension.singularToFieldSetType(value));
- }
-
- private FieldSet<ExtensionDescriptor> ensureExtensionsAreMutable() {
- if (extensions.isImmutable()) {
- extensions = extensions.clone();
- }
- return extensions;
+ extensions.setField(extension.descriptor, extension.singularToFieldSetType(value));
}
private void verifyExtensionContainingType(
@@ -917,12 +817,10 @@ public abstract class GeneratedMessageLite<
@Override
protected final void makeImmutable() {
super.makeImmutable();
- // BEGIN REGULAR
+
extensions.makeImmutable();
- // END REGULAR
}
-
/**
* Used by subclasses to serialize extensions. Extension ranges may be
* interleaved with field numbers, but we must write them in canonical
@@ -993,6 +891,12 @@ 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.
@@ -1011,15 +915,6 @@ 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) {
@@ -1078,8 +973,7 @@ public abstract class GeneratedMessageLite<
verifyExtensionContainingType(extensionLite);
copyOnWrite();
- ensureExtensionsAreMutable()
- .setField(extensionLite.descriptor, extensionLite.toFieldSetType(value));
+ instance.extensions.setField(extensionLite.descriptor, extensionLite.toFieldSetType(value));
return (BuilderType) this;
}
@@ -1092,9 +986,8 @@ public abstract class GeneratedMessageLite<
verifyExtensionContainingType(extensionLite);
copyOnWrite();
- ensureExtensionsAreMutable()
- .setRepeatedField(
- extensionLite.descriptor, index, extensionLite.singularToFieldSetType(value));
+ instance.extensions.setRepeatedField(
+ extensionLite.descriptor, index, extensionLite.singularToFieldSetType(value));
return (BuilderType) this;
}
@@ -1107,8 +1000,8 @@ public abstract class GeneratedMessageLite<
verifyExtensionContainingType(extensionLite);
copyOnWrite();
- ensureExtensionsAreMutable()
- .addRepeatedField(extensionLite.descriptor, extensionLite.singularToFieldSetType(value));
+ instance.extensions.addRepeatedField(
+ extensionLite.descriptor, extensionLite.singularToFieldSetType(value));
return (BuilderType) this;
}
@@ -1119,7 +1012,7 @@ public abstract class GeneratedMessageLite<
verifyExtensionContainingType(extensionLite);
copyOnWrite();
- ensureExtensionsAreMutable().clearField(extensionLite.descriptor);
+ instance.extensions.clearField(extensionLite.descriptor);
return (BuilderType) this;
}
}
@@ -1510,26 +1403,11 @@ public abstract class GeneratedMessageLite<
*/
protected static final <T extends GeneratedMessageLite<T, ?>> boolean isInitialized(
T message, boolean shouldMemoize) {
- byte memoizedIsInitialized =
- (Byte) message.dynamicMethod(MethodToInvoke.GET_MEMOIZED_IS_INITIALIZED);
- if (memoizedIsInitialized == 1) {
- return true;
- }
- if (memoizedIsInitialized == 0) {
- return false;
- }
- // BEGIN EXPERIMENTAL
- // boolean isInitialized = Protobuf.getInstance().schemaFor(message).isInitialized(message);
- // END EXPERIMENTAL
- // BEGIN REGULAR
- boolean isInitialized =
- message.dynamicMethod(MethodToInvoke.IS_INITIALIZED, Boolean.FALSE) != null;
- // END REGULAR
- if (shouldMemoize) {
- message.dynamicMethod(
- MethodToInvoke.SET_MEMOIZED_IS_INITIALIZED, isInitialized ? message : null);
- }
- return isInitialized;
+ return message.dynamicMethod(MethodToInvoke.IS_INITIALIZED, shouldMemoize) != null;
+ }
+
+ protected static final <T extends GeneratedMessageLite<T, ?>> void makeImmutable(T message) {
+ message.dynamicMethod(MethodToInvoke.MAKE_IMMUTABLE);
}
protected static IntList emptyIntList() {
@@ -1611,11 +1489,6 @@ public abstract class GeneratedMessageLite<
throws InvalidProtocolBufferException {
return GeneratedMessageLite.parsePartialFrom(defaultInstance, input, extensionRegistry);
}
-
- @Override
- public T parsePartialFrom(byte[] input) throws InvalidProtocolBufferException {
- return GeneratedMessageLite.parsePartialFrom(defaultInstance, input);
- }
}
/**
@@ -1629,21 +1502,8 @@ public abstract class GeneratedMessageLite<
@SuppressWarnings("unchecked") // Guaranteed by protoc
T result = (T) instance.dynamicMethod(MethodToInvoke.NEW_MUTABLE_INSTANCE);
try {
- // BEGIN REGULAR
result.dynamicMethod(MethodToInvoke.MERGE_FROM_STREAM, input, extensionRegistry);
- // END REGULAR
- // BEGIN EXPERIMENTAL
- // Protobuf.getInstance().schemaFor(result).mergeFrom(
- // result, CodedInputStreamReader.forCodedInput(input), extensionRegistry);
- // END EXPERIMENTAL
result.makeImmutable();
- // BEGIN EXPERIMENTAL
- // } catch (IOException e) {
- // if (e.getCause() instanceof InvalidProtocolBufferException) {
- // throw (InvalidProtocolBufferException) e.getCause();
- // }
- // throw new InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(result);
- // END EXPERIMENTAL
} catch (RuntimeException e) {
if (e.getCause() instanceof InvalidProtocolBufferException) {
throw (InvalidProtocolBufferException) e.getCause();
@@ -1653,34 +1513,6 @@ public abstract class GeneratedMessageLite<
return result;
}
- /** A static helper method for parsing a partial from byte array. */
- static <T extends GeneratedMessageLite<T, ?>> T parsePartialFrom(T instance, byte[] input)
- throws InvalidProtocolBufferException {
- // BEGIN REGULAR
- return parsePartialFrom(instance, input, ExtensionRegistryLite.getEmptyRegistry());
- // END REGULAR
- // BEGIN EXPERIMENTAL
- // @SuppressWarnings("unchecked") // Guaranteed by protoc
- // T result = (T) instance.dynamicMethod(MethodToInvoke.NEW_MUTABLE_INSTANCE);
- // try {
- // Protobuf.getInstance().schemaFor(result).mergeFrom(
- // result, input, 0, input.length, new ArrayDecoders.Registers());
- // result.makeImmutable();
- // if (result.memoizedHashCode != 0) {
- // throw new RuntimeException();
- // }
- // } catch (IOException e) {
- // if (e.getCause() instanceof InvalidProtocolBufferException) {
- // throw (InvalidProtocolBufferException) e.getCause();
- // }
- // throw new InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(result);
- // } catch (IndexOutOfBoundsException e) {
- // throw InvalidProtocolBufferException.truncatedMessage().setUnfinishedMessage(result);
- // }
- // return result;
- // END EXPERIMENTAL
- }
-
protected static <T extends GeneratedMessageLite<T, ?>> T parsePartialFrom(
T defaultInstance,
CodedInputStream input)
@@ -1777,7 +1609,8 @@ public abstract class GeneratedMessageLite<
protected static <T extends GeneratedMessageLite<T, ?>> T parseFrom(
T defaultInstance, byte[] data)
throws InvalidProtocolBufferException {
- return checkMessageInitialized(parsePartialFrom(defaultInstance, data));
+ return checkMessageInitialized(
+ parsePartialFrom(defaultInstance, data, ExtensionRegistryLite.getEmptyRegistry()));
}
// Validates last tag.
@@ -1862,7 +1695,6 @@ public abstract class GeneratedMessageLite<
return message;
}
- // BEGIN REGULAR
/**
* An abstract visitor that the generated code calls into that we use to implement various
* features. Fields that are not members of oneofs are always visited. Members of a oneof are only
@@ -2548,5 +2380,4 @@ public abstract class GeneratedMessageLite<
return mine;
}
}
- // END REGULAR
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
index 4acd8f2fa5..592869a1d9 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
@@ -358,10 +358,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
throw e.unwrapIOException();
}
}
-
- protected static boolean canUseUnsafe() {
- return UnsafeUtil.hasUnsafeArrayOperations() && UnsafeUtil.hasUnsafeByteBufferOperations();
- }
@Override
public void writeTo(final CodedOutputStream output) throws IOException {
@@ -659,7 +655,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
.build());
}
-
@Override
public boolean isInitialized() {
for (final FieldDescriptor field : getDescriptorForType().getFields()) {
@@ -2858,4 +2853,3 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
}
}
}
-
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/IntArrayList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/IntArrayList.java
index aacd71e1ca..aff5c21b26 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/IntArrayList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/IntArrayList.java
@@ -82,18 +82,6 @@ final class IntArrayList extends AbstractProtobufList<Integer>
}
@Override
- protected void removeRange(int fromIndex, int toIndex) {
- ensureIsMutable();
- if (toIndex < fromIndex) {
- throw new IndexOutOfBoundsException("toIndex < fromIndex");
- }
-
- System.arraycopy(array, toIndex, array, fromIndex, size - toIndex);
- size -= (toIndex - fromIndex);
- modCount++;
- }
-
- @Override
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -258,9 +246,7 @@ final class IntArrayList extends AbstractProtobufList<Integer>
ensureIsMutable();
ensureIndexInRange(index);
int value = array[index];
- if (index < size - 1) {
- System.arraycopy(array, index + 1, array, index, size - index);
- }
+ System.arraycopy(array, index + 1, array, index, size - index);
size--;
modCount++;
return value;
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Internal.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Internal.java
index 848cad03fc..848cad03fc 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Internal.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Internal.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
index 510c6aac74..510c6aac74 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyField.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyField.java
index 98e13ca199..98e13ca199 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyField.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyField.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java
index 49ecfc0be6..49ecfc0be6 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java
index d474c51ef1..d474c51ef1 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyStringList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyStringList.java
index 3eeedca1d3..3eeedca1d3 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LazyStringList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LazyStringList.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LongArrayList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LongArrayList.java
index 95945cb723..fc146e232b 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/LongArrayList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/LongArrayList.java
@@ -82,18 +82,6 @@ final class LongArrayList extends AbstractProtobufList<Long>
}
@Override
- protected void removeRange(int fromIndex, int toIndex) {
- ensureIsMutable();
- if (toIndex < fromIndex) {
- throw new IndexOutOfBoundsException("toIndex < fromIndex");
- }
-
- System.arraycopy(array, toIndex, array, fromIndex, size - toIndex);
- size -= (toIndex - fromIndex);
- modCount++;
- }
-
- @Override
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -258,9 +246,7 @@ final class LongArrayList extends AbstractProtobufList<Long>
ensureIsMutable();
ensureIndexInRange(index);
long value = array[index];
- if (index < size - 1) {
- System.arraycopy(array, index + 1, array, index, size - index);
- }
+ System.arraycopy(array, index + 1, array, index, size - index);
size--;
modCount++;
return value;
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapEntry.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapEntry.java
index 0849b821cf..0849b821cf 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapEntry.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapEntry.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapEntryLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapEntryLite.java
index dcb5dfad3d..dcb5dfad3d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapEntryLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapEntryLite.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapField.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapField.java
index ad8ceb02a9..ad8ceb02a9 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapField.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapField.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapFieldLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
index a8b3dd8849..a8b3dd8849 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Message.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Message.java
index 0770d41787..94590fb91b 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Message.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Message.java
@@ -125,7 +125,7 @@ public interface Message extends MessageLite, MessageOrBuilder {
* it is merged into the corresponding sub-message of this message
* using the same merging rules.<br>
* * For repeated fields, the elements in {@code other} are concatenated
- * with the elements in this message.<br>
+ * with the elements in this message.
* * For oneof groups, if the other message has one of the fields set,
* the group of this message is cleared and replaced by the field
* of the other message, so that the oneof constraint is preserved.
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLite.java
index 88f531df3e..88f531df3e 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLite.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java
index 818386ce58..818386ce58 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java
index 8e2659359b..23373ef4cd 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java
@@ -31,7 +31,6 @@
package com.google.protobuf;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -39,18 +38,20 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
-/** Helps generate {@link String} representations of {@link MessageLite} protos. */
+/**
+ * Helps generate {@link String} representations of {@link MessageLite} protos.
+ */
+// TODO(dweis): Fix map fields.
final class MessageLiteToString {
private static final String LIST_SUFFIX = "List";
private static final String BUILDER_LIST_SUFFIX = "OrBuilderList";
- private static final String MAP_SUFFIX = "Map";
private static final String BYTES_SUFFIX = "Bytes";
-
+
/**
- * Returns a {@link String} representation of the {@link MessageLite} object. The first line of
+ * Returns a {@link String} representation of the {@link MessageLite} object. The first line of
* the {@code String} representation representation includes a comment string to uniquely identify
- * the object instance. This acts as an indicator that this should not be relied on for
+ * the objcet instance. This acts as an indicator that this should not be relied on for
* comparisons.
*
* <p>For use by generated code only.
@@ -70,9 +71,8 @@ final class MessageLiteToString {
*/
private static void reflectivePrintWithIndent(
MessageLite messageLite, StringBuilder buffer, int indent) {
- // Build a map of method name to method. We're looking for methods like getFoo(), hasFoo(),
- // getFooList() and getFooMap() which might be useful for building an object's string
- // representation.
+ // Build a map of method name to method. We're looking for methods like getFoo(), hasFoo(), and
+ // getFooList() which might be useful for building an object's string representation.
Map<String, Method> nameToNoArgMethod = new HashMap<String, Method>();
Map<String, Method> nameToMethod = new HashMap<String, Method>();
Set<String> getters = new TreeSet<String>();
@@ -89,16 +89,12 @@ final class MessageLiteToString {
for (String getter : getters) {
String suffix = getter.replaceFirst("get", "");
- if (suffix.endsWith(LIST_SUFFIX)
- && !suffix.endsWith(BUILDER_LIST_SUFFIX)
- // Sometimes people have fields named 'list' that aren't repeated.
- && !suffix.equals(LIST_SUFFIX)) {
- String camelCase =
- suffix.substring(0, 1).toLowerCase()
- + suffix.substring(1, suffix.length() - LIST_SUFFIX.length());
+ if (suffix.endsWith(LIST_SUFFIX) && !suffix.endsWith(BUILDER_LIST_SUFFIX)) {
+ String camelCase = suffix.substring(0, 1).toLowerCase()
+ + suffix.substring(1, suffix.length() - LIST_SUFFIX.length());
// Try to reflectively get the value and toString() the field as if it were repeated. This
- // only works if the method names have not been proguarded out or renamed.
- Method listMethod = nameToNoArgMethod.get(getter);
+ // only works if the method names have not be proguarded out or renamed.
+ Method listMethod = nameToNoArgMethod.get("get" + suffix);
if (listMethod != null && listMethod.getReturnType().equals(List.class)) {
printField(
buffer,
@@ -108,30 +104,6 @@ final class MessageLiteToString {
continue;
}
}
- if (suffix.endsWith(MAP_SUFFIX)
- // Sometimes people have fields named 'map' that aren't maps.
- && !suffix.equals(MAP_SUFFIX)) {
- String camelCase =
- suffix.substring(0, 1).toLowerCase()
- + suffix.substring(1, suffix.length() - MAP_SUFFIX.length());
- // Try to reflectively get the value and toString() the field as if it were a map. This only
- // works if the method names have not been proguarded out or renamed.
- Method mapMethod = nameToNoArgMethod.get(getter);
- if (mapMethod != null
- && mapMethod.getReturnType().equals(Map.class)
- // Skip the deprecated getter method with no prefix "Map" when the field name ends with
- // "map".
- && !mapMethod.isAnnotationPresent(Deprecated.class)
- // Skip the internal mutable getter method.
- && Modifier.isPublic(mapMethod.getModifiers())) {
- printField(
- buffer,
- indent,
- camelCaseToSnakeCase(camelCase),
- GeneratedMessageLite.invokeOrDie(mapMethod, messageLite));
- continue;
- }
- }
Method setter = nameToMethod.get("set" + suffix);
if (setter == null) {
@@ -147,19 +119,22 @@ final class MessageLiteToString {
String camelCase = suffix.substring(0, 1).toLowerCase() + suffix.substring(1);
// Try to reflectively get the value and toString() the field as if it were optional. This
- // only works if the method names have not been proguarded out or renamed.
+ // only works if the method names have not be proguarded out or renamed.
Method getMethod = nameToNoArgMethod.get("get" + suffix);
Method hasMethod = nameToNoArgMethod.get("has" + suffix);
// TODO(dweis): Fix proto3 semantics.
if (getMethod != null) {
Object value = GeneratedMessageLite.invokeOrDie(getMethod, messageLite);
- final boolean hasValue =
- hasMethod == null
- ? !isDefaultValue(value)
- : (Boolean) GeneratedMessageLite.invokeOrDie(hasMethod, messageLite);
- // TODO(dweis): This doesn't stop printing oneof case twice: value and enum style.
+ final boolean hasValue = hasMethod == null
+ ? !isDefaultValue(value)
+ : (Boolean) GeneratedMessageLite.invokeOrDie(hasMethod, messageLite);
+ // TODO(dweis): This doesn't stop printing oneof case twice: value and enum style.
if (hasValue) {
- printField(buffer, indent, camelCaseToSnakeCase(camelCase), value);
+ printField(
+ buffer,
+ indent,
+ camelCaseToSnakeCase(camelCase),
+ value);
}
continue;
}
@@ -178,7 +153,7 @@ final class MessageLiteToString {
((GeneratedMessageLite<?, ?>) messageLite).unknownFields.printWithIndent(buffer, indent);
}
}
-
+
private static boolean isDefaultValue(Object o) {
if (o instanceof Boolean) {
return !((Boolean) o);
@@ -204,7 +179,7 @@ final class MessageLiteToString {
if (o instanceof java.lang.Enum<?>) { // Catches oneof enums.
return ((java.lang.Enum<?>) o).ordinal() == 0;
}
-
+
return false;
}
@@ -226,13 +201,6 @@ final class MessageLiteToString {
}
return;
}
- if (object instanceof Map<?, ?>) {
- Map<?, ?> map = (Map<?, ?>) object;
- for (Map.Entry<?, ?> entry : map.entrySet()) {
- printField(buffer, indent, name, entry);
- }
- return;
- }
buffer.append('\n');
for (int i = 0; i < indent; i++) {
@@ -252,21 +220,11 @@ final class MessageLiteToString {
buffer.append(' ');
}
buffer.append("}");
- } else if (object instanceof Map.Entry<?, ?>) {
- buffer.append(" {");
- Map.Entry<?, ?> entry = (Map.Entry<?, ?>) object;
- printField(buffer, indent + 2, "key", entry.getKey());
- printField(buffer, indent + 2, "value", entry.getValue());
- buffer.append("\n");
- for (int i = 0; i < indent; i++) {
- buffer.append(' ');
- }
- buffer.append("}");
} else {
buffer.append(": ").append(object.toString());
}
}
-
+
private static final String camelCaseToSnakeCase(String camelCase) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < camelCase.length(); i++) {
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java
index 5e7d782132..5e7d782132 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageReflection.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageReflection.java
index 69ad7ddf94..69ad7ddf94 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MessageReflection.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MessageReflection.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MutabilityOracle.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MutabilityOracle.java
index 82b723c95d..82b723c95d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/MutabilityOracle.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/MutabilityOracle.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/NioByteString.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/NioByteString.java
index 76594809e8..76594809e8 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/NioByteString.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/NioByteString.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Parser.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Parser.java
index e07c68959a..e07c68959a 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Parser.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Parser.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java
index 79b5769d19..79b5769d19 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java
index 81255ec291..81255ec291 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java
index a596d30190..a596d30190 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtocolStringList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtocolStringList.java
index d553b41e52..d553b41e52 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ProtocolStringList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ProtocolStringList.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java
index 29f567dcde..29f567dcde 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java
index 30c991d40b..30c991d40b 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RopeByteString.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RopeByteString.java
index 6fa555df15..6fa555df15 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RopeByteString.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RopeByteString.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcCallback.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcCallback.java
index 10752968e2..10752968e2 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcCallback.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcCallback.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcChannel.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcChannel.java
index f272f4ad72..f272f4ad72 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcChannel.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcChannel.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcController.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcController.java
index a92dd7be6d..a92dd7be6d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcController.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcController.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcUtil.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcUtil.java
index f7d555ae15..f7d555ae15 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/RpcUtil.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/RpcUtil.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Service.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Service.java
index ba7b033ed4..ba7b033ed4 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Service.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Service.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ServiceException.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ServiceException.java
index 00d5707523..00d5707523 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/ServiceException.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/ServiceException.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java
index 941b5defc9..941b5defc9 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java
index 8ab0f26d90..8ab0f26d90 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java
index 279edc4de1..66033f58e5 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java
@@ -540,8 +540,8 @@ class SmallSortedMap<K extends Comparable<K>, V> extends AbstractMap<K, V> {
@Override
public boolean hasNext() {
- return (pos + 1) < entryList.size()
- || (!overflowEntries.isEmpty() && getOverflowIterator().hasNext());
+ return (pos + 1) < entryList.size() ||
+ getOverflowIterator().hasNext();
}
@Override
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormat.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormat.java
index 25c3474f91..64094d0918 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormat.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormat.java
@@ -279,21 +279,9 @@ public final class TextFormat {
generator.print(String.format((Locale) null, "0x%016x", (Long) value));
break;
case WireFormat.WIRETYPE_LENGTH_DELIMITED:
- try {
- // Try to parse and print the field as an embedded message
- UnknownFieldSet message = UnknownFieldSet.parseFrom((ByteString) value);
- generator.print("{");
- generator.eol();
- generator.indent();
- Printer.DEFAULT.printUnknownFields(message, generator);
- generator.outdent();
- generator.print("}");
- } catch (InvalidProtocolBufferException e) {
- // If not parseable as a message, print as a String
- generator.print("\"");
- generator.print(escapeBytes((ByteString) value));
- generator.print("\"");
- }
+ generator.print("\"");
+ generator.print(escapeBytes((ByteString) value));
+ generator.print("\"");
break;
case WireFormat.WIRETYPE_START_GROUP:
Printer.DEFAULT.printUnknownFields((UnknownFieldSet) value, generator);
@@ -987,7 +975,7 @@ public final class TextFormat {
nextToken();
return false;
} else {
- throw parseException("Expected \"true\" or \"false\". Found \"" + currentToken + "\".");
+ throw parseException("Expected \"true\" or \"false\".");
}
}
@@ -1224,22 +1212,6 @@ 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}.
@@ -1264,25 +1236,6 @@ 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.
@@ -1311,17 +1264,13 @@ public final class TextFormat {
}
private final boolean allowUnknownFields;
- private final boolean allowUnknownEnumValues;
private final SingularOverwritePolicy singularOverwritePolicy;
private TextFormatParseInfoTree.Builder parseInfoTreeBuilder;
private Parser(
- boolean allowUnknownFields,
- boolean allowUnknownEnumValues,
- SingularOverwritePolicy singularOverwritePolicy,
+ boolean allowUnknownFields, SingularOverwritePolicy singularOverwritePolicy,
TextFormatParseInfoTree.Builder parseInfoTreeBuilder) {
this.allowUnknownFields = allowUnknownFields;
- this.allowUnknownEnumValues = allowUnknownEnumValues;
this.singularOverwritePolicy = singularOverwritePolicy;
this.parseInfoTreeBuilder = parseInfoTreeBuilder;
}
@@ -1338,7 +1287,6 @@ public final class TextFormat {
*/
public static class Builder {
private boolean allowUnknownFields = false;
- private boolean allowUnknownEnumValues = false;
private SingularOverwritePolicy singularOverwritePolicy =
SingularOverwritePolicy.ALLOW_SINGULAR_OVERWRITES;
private TextFormatParseInfoTree.Builder parseInfoTreeBuilder = null;
@@ -1360,10 +1308,7 @@ public final class TextFormat {
public Parser build() {
return new Parser(
- allowUnknownFields,
- allowUnknownEnumValues,
- singularOverwritePolicy,
- parseInfoTreeBuilder);
+ allowUnknownFields, singularOverwritePolicy, parseInfoTreeBuilder);
}
}
@@ -1427,7 +1372,7 @@ public final class TextFormat {
return text;
}
- // Check both unknown fields and unknown extensions and log warning messages
+ // Check both unknown fields and unknown extensions and log warming messages
// or throw exceptions according to the flag.
private void checkUnknownFields(final List<String> unknownFields)
throws ParseException {
@@ -1745,40 +1690,17 @@ public final class TextFormat {
final int number = tokenizer.consumeInt32();
value = enumType.findValueByNumber(number);
if (value == null) {
- String unknownValueMsg =
- "Enum type \""
- + enumType.getFullName()
- + "\" has no value with number "
- + number
- + '.';
- if (allowUnknownEnumValues) {
- logger.warning(unknownValueMsg);
- return;
- } else {
- throw tokenizer.parseExceptionPreviousToken(
- "Enum type \""
- + enumType.getFullName()
- + "\" has no value with number "
- + number
- + '.');
- }
+ throw tokenizer.parseExceptionPreviousToken(
+ "Enum type \"" + enumType.getFullName()
+ + "\" has no value with number " + number + '.');
}
} else {
final String id = tokenizer.consumeIdentifier();
value = enumType.findValueByName(id);
if (value == null) {
- String unknownValueMsg =
- "Enum type \""
- + enumType.getFullName()
- + "\" has no value named \""
- + id
- + "\".";
- if (allowUnknownEnumValues) {
- logger.warning(unknownValueMsg);
- return;
- } else {
- throw tokenizer.parseExceptionPreviousToken(unknownValueMsg);
- }
+ throw tokenizer.parseExceptionPreviousToken(
+ "Enum type \"" + enumType.getFullName()
+ + "\" has no value named \"" + id + "\".");
}
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java
index da9ceadd16..da9ceadd16 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java
index 0127ce92a3..0127ce92a3 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java
index cce286e10f..cce286e10f 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java
index 5714c063a9..5714c063a9 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
index 37d6463342..37d6463342 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java
index f0b919adae..d6226fc70c 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java
@@ -81,7 +81,7 @@ public final class UnknownFieldSetLite {
System.arraycopy(second.objects, 0, objects, first.count, second.count);
return new UnknownFieldSetLite(count, tags, objects, true /* isMutable */);
}
-
+
/**
* The number of elements in the set.
*/
@@ -295,30 +295,14 @@ public final class UnknownFieldSetLite {
return true;
}
- private static int hashCode(int[] tags, int count) {
- int hashCode = 17;
- for (int i = 0; i < count; ++i) {
- hashCode = 31 * hashCode + tags[i];
- }
- return hashCode;
- }
-
- private static int hashCode(Object[] objects, int count) {
- int hashCode = 17;
- for (int i = 0; i < count; ++i) {
- hashCode = 31 * hashCode + objects[i].hashCode();
- }
- return hashCode;
- }
-
@Override
public int hashCode() {
int hashCode = 17;
-
+
hashCode = 31 * hashCode + count;
- hashCode = 31 * hashCode + hashCode(tags, count);
- hashCode = 31 * hashCode + hashCode(objects, count);
-
+ hashCode = 31 * hashCode + Arrays.hashCode(tags);
+ hashCode = 31 * hashCode + Arrays.deepHashCode(objects);
+
return hashCode;
}
@@ -339,7 +323,6 @@ public final class UnknownFieldSetLite {
// Package private for unsafe experimental runtime.
void storeField(int tag, Object value) {
- checkMutable();
ensureCapacity();
tags[count] = tag;
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java
index 30e8791178..30e8791178 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java
index 878c775816..878c775816 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
index c9e2904b4c..acc03a7c0f 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
@@ -72,8 +72,6 @@ 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() {
@@ -84,7 +82,6 @@ final class UnsafeUtil {
return HAS_UNSAFE_BYTEBUFFER_OPERATIONS;
}
-
static long objectFieldOffset(Field field) {
return MEMORY_ACCESSOR.objectFieldOffset(field);
}
@@ -255,6 +252,10 @@ final class UnsafeUtil {
MEMORY_ACCESSOR.putLong(address, value);
}
+ static void copyMemory(long srcAddress, long targetAddress, long length) {
+ MEMORY_ACCESSOR.copyMemory(srcAddress, targetAddress, length);
+ }
+
/**
* Gets the offset of the {@code address} field of the given direct {@link ByteBuffer}.
*/
@@ -262,26 +263,6 @@ 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);
}
@@ -289,7 +270,7 @@ final class UnsafeUtil {
/**
* Gets the {@code sun.misc.Unsafe} instance, or {@code null} if not available on this platform.
*/
- static sun.misc.Unsafe getUnsafe() {
+ private static sun.misc.Unsafe getUnsafe() {
sun.misc.Unsafe unsafe = null;
try {
unsafe =
@@ -369,10 +350,6 @@ final class UnsafeUtil {
clazz.getMethod("objectFieldOffset", Field.class);
clazz.getMethod("getLong", Object.class, long.class);
- if (bufferAddressField() == null) {
- return false;
- }
-
clazz.getMethod("getByte", long.class);
clazz.getMethod("putByte", long.class, byte.class);
clazz.getMethod("getInt", long.class);
@@ -391,16 +368,18 @@ final class UnsafeUtil {
}
- /** Finds the address field within a direct {@link Buffer}. */
- private static Field bufferAddressField() {
- Field field = field(Buffer.class, "address");
- return field != null && field.getType() == long.class ? field : null;
+ @SuppressWarnings("unchecked")
+ private static <T> Class<T> getClassForName(String name) {
+ try {
+ return (Class<T>) Class.forName(name);
+ } catch (Throwable e) {
+ return null;
+ }
}
- /** Finds the value field within a {@link String}. */
- private static Field stringValueField() {
- Field field = field(String.class, "value");
- return field != null && field.getType() == char[].class ? field : null;
+ /** Finds the address field within a direct {@link Buffer}. */
+ private static Field bufferAddressField() {
+ return field(Buffer.class, "address");
}
/**
@@ -499,6 +478,8 @@ final class UnsafeUtil {
public abstract void putLong(long address, long value);
+ public abstract void copyMemory(long srcAddress, long targetAddress, long length);
+
public abstract Object getStaticObject(Field field);
public abstract void copyMemory(long srcOffset, byte[] target, long targetIndex, long length);
@@ -581,6 +562,11 @@ final class UnsafeUtil {
public void putDouble(Object target, long offset, double value) {
unsafe.putDouble(target, offset, value);
}
+
+ @Override
+ public void copyMemory(long srcAddress, long targetAddress, long length) {
+ unsafe.copyMemory(srcAddress, targetAddress, length);
+ }
@Override
public void copyMemory(long srcOffset, byte[] target, long targetIndex, long length) {
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Utf8.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Utf8.java
index 6968abb3c1..4cf79d7b57 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Utf8.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/Utf8.java
@@ -34,15 +34,11 @@ 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
@@ -293,7 +289,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 < MIN_SUPPLEMENTARY_CODE_POINT) {
+ if (cp < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
throw new UnpairedSurrogateException(i, utf16Length);
}
i++;
@@ -335,26 +331,6 @@ 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)
@@ -634,116 +610,6 @@ 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
@@ -985,88 +851,6 @@ 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;
@@ -1212,7 +996,6 @@ 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));
@@ -1308,7 +1091,6 @@ 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));
@@ -1403,163 +1185,6 @@ 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;
@@ -1722,7 +1347,7 @@ final class Utf8 {
// Read bytes until 8-byte aligned so that we can read longs in the loop below.
// We do this by ANDing the address with 7 to determine the number of bytes that need to
// be read before we're 8-byte aligned.
- final int unaligned = 8 - ((int) address & 7);
+ final int unaligned = (int) address & 7;
for (int j = unaligned; j > 0; j--) {
if (UnsafeUtil.getByte(address++) < 0) {
return unaligned - j;
@@ -1929,112 +1554,5 @@ 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/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/WireFormat.java b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/WireFormat.java
index 8b837ee5e1..8b837ee5e1 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/WireFormat.java
+++ b/third_party/protobuf/3.4.0/java/core/src/main/java/com/google/protobuf/WireFormat.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java
index cb2d34eba2..622e36a413 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java
@@ -30,9 +30,6 @@
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;
@@ -349,6 +346,11 @@ 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 =
@@ -378,7 +380,7 @@ public class AbstractMessageTest extends TestCase {
builder.setOptionalMessage(TEST_REQUIRED_UNINITIALIZED);
assertFalse(abstractBuilder.isInitialized());
assertEquals(
- "optional_message.b, optional_message.c",
+ "optional_message.a, optional_message.b, optional_message.c",
abstractBuilder.getInitializationErrorString());
builder.setOptionalMessage(TEST_REQUIRED_INITIALIZED);
@@ -388,7 +390,7 @@ public class AbstractMessageTest extends TestCase {
builder.addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED);
assertFalse(abstractBuilder.isInitialized());
assertEquals(
- "repeated_message[0].b, repeated_message[0].c",
+ "repeated_message[0].a, repeated_message[0].b, repeated_message[0].c",
abstractBuilder.getInitializationErrorString());
builder.setRepeatedMessage(0, TEST_REQUIRED_INITIALIZED);
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/AnyTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/AnyTest.java
index cf91ed91c6..cf91ed91c6 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/AnyTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/AnyTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java
index 4906763c35..18132e9e03 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java
@@ -32,7 +32,6 @@ package com.google.protobuf;
import static java.util.Arrays.asList;
-import com.google.protobuf.Internal.BooleanList;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -298,20 +297,6 @@ public class BooleanArrayListTest extends TestCase {
}
}
- public void testRemoveEndOfCapacity() {
- BooleanList toRemove = BooleanArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addBoolean(true);
- toRemove.remove(0);
- assertEquals(0, toRemove.size());
- }
-
- public void testSublistRemoveEndOfCapacity() {
- BooleanList toRemove = BooleanArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addBoolean(true);
- toRemove.subList(0, 1).clear();
- assertEquals(0, toRemove.size());
- }
-
private void assertImmutable(BooleanArrayList list) {
try {
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java
index db10ee7483..db10ee7483 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ByteBufferWriterTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ByteBufferWriterTest.java
index 6b1cfe78c1..6b1cfe78c1 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ByteBufferWriterTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ByteBufferWriterTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ByteStringTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ByteStringTest.java
index be71f1f5a3..be71f1f5a3 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java
index 50b87ae31f..cc65d19ab7 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java
@@ -34,7 +34,7 @@ import proto2_test_check_utf8.TestCheckUtf8.BytesWrapper;
import proto2_test_check_utf8.TestCheckUtf8.StringWrapper;
import proto2_test_check_utf8_size.TestCheckUtf8Size.BytesWrapperSize;
import proto2_test_check_utf8_size.TestCheckUtf8Size.StringWrapperSize;
-import java.io.ByteArrayInputStream;
+
import junit.framework.TestCase;
/**
@@ -90,9 +90,14 @@ public class CheckUtf8Test extends TestCase {
}
public void testParseRequiredStringWithBadUtf8() throws Exception {
- byte[] serialized =
- BytesWrapper.newBuilder().setReq(NON_UTF8_BYTE_STRING).build().toByteArray();
- assertParseBadUtf8(StringWrapper.getDefaultInstance(), serialized);
+ ByteString serialized =
+ BytesWrapper.newBuilder().setReq(NON_UTF8_BYTE_STRING).build().toByteString();
+ try {
+ StringWrapper.parser().parseFrom(serialized);
+ fail("Expected InvalidProtocolBufferException for non UTF-8 byte string.");
+ } catch (InvalidProtocolBufferException exception) {
+ assertEquals("Protocol message had invalid UTF-8.", exception.getMessage());
+ }
}
public void testBuildRequiredStringWithBadUtf8Size() throws Exception {
@@ -123,36 +128,14 @@ public class CheckUtf8Test extends TestCase {
}
public void testParseRequiredStringWithBadUtf8Size() throws Exception {
- byte[] serialized =
- BytesWrapperSize.newBuilder().setReq(NON_UTF8_BYTE_STRING).build().toByteArray();
- assertParseBadUtf8(StringWrapperSize.getDefaultInstance(), serialized);
- }
-
- private void assertParseBadUtf8(MessageLite defaultInstance, byte[] data) throws Exception {
- // Check combinations of (parser vs. builder) x (byte[] vs. InputStream)
- try {
- defaultInstance.getParserForType().parseFrom(data);
- fail("Expected InvalidProtocolBufferException for non UTF-8 byte string.");
- } catch (InvalidProtocolBufferException exception) {
- assertEquals("Protocol message had invalid UTF-8.", exception.getMessage());
- }
- try {
- defaultInstance.newBuilderForType().mergeFrom(data);
- fail("Expected InvalidProtocolBufferException for non UTF-8 byte string.");
- } catch (InvalidProtocolBufferException exception) {
- assertEquals("Protocol message had invalid UTF-8.", exception.getMessage());
- }
- try {
- defaultInstance.getParserForType().parseFrom(new ByteArrayInputStream(data));
- fail("Expected InvalidProtocolBufferException for non UTF-8 byte string.");
- } catch (InvalidProtocolBufferException exception) {
- assertEquals("Protocol message had invalid UTF-8.", exception.getMessage());
- }
+ ByteString serialized =
+ BytesWrapperSize.newBuilder().setReq(NON_UTF8_BYTE_STRING).build().toByteString();
try {
- defaultInstance.newBuilderForType().mergeFrom(new ByteArrayInputStream(data));
+ StringWrapperSize.parser().parseFrom(serialized);
fail("Expected InvalidProtocolBufferException for non UTF-8 byte string.");
} catch (InvalidProtocolBufferException exception) {
assertEquals("Protocol message had invalid UTF-8.", exception.getMessage());
}
}
+
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java
index 5ea6b79c79..da2c067ebb 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java
@@ -41,7 +41,6 @@ import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
-import java.util.ArrayList;
import java.util.Arrays;
import junit.framework.TestCase;
@@ -51,9 +50,6 @@ import junit.framework.TestCase;
* @author kenton@google.com Kenton Varda
*/
public class CodedInputStreamTest extends TestCase {
-
- private static final int DEFAULT_BLOCK_SIZE = 4096;
-
private enum InputType {
ARRAY {
@Override
@@ -81,43 +77,7 @@ public class CodedInputStreamTest extends TestCase {
CodedInputStream newDecoder(byte[] data, int blockSize) {
return CodedInputStream.newInstance(new SmallBlockInputStream(data, blockSize));
}
- },
- ITER_DIRECT {
- @Override
- CodedInputStream newDecoder(byte[] data, int blockSize) {
- if (blockSize > DEFAULT_BLOCK_SIZE) {
- blockSize = DEFAULT_BLOCK_SIZE;
- }
- ArrayList <ByteBuffer> input = new ArrayList <ByteBuffer>();
- for (int i = 0; i < data.length; i += blockSize) {
- int rl = Math.min(blockSize, data.length - i);
- ByteBuffer rb = ByteBuffer.allocateDirect(rl);
- rb.put(data, i, rl);
- rb.flip();
- input.add(rb);
- }
- return CodedInputStream.newInstance(input);
- }
- },
- STREAM_ITER_DIRECT {
- @Override
- CodedInputStream newDecoder(byte[] data, int blockSize) {
- if (blockSize > DEFAULT_BLOCK_SIZE) {
- blockSize = DEFAULT_BLOCK_SIZE;
- }
- ArrayList <ByteBuffer> input = new ArrayList <ByteBuffer>();
- for (int i = 0; i < data.length; i += blockSize) {
- int rl = Math.min(blockSize, data.length - i);
- ByteBuffer rb = ByteBuffer.allocateDirect(rl);
- rb.put(data, i, rl);
- rb.flip();
- input.add(rb);
- }
- return CodedInputStream.newInstance(new IterableByteBufferInputStream(input));
- }
};
-
-
CodedInputStream newDecoder(byte[] data) {
return newDecoder(data, data.length);
@@ -1034,9 +994,7 @@ public class CodedInputStreamTest extends TestCase {
byte[] data = byteArrayStream.toByteArray();
for (InputType inputType : InputType.values()) {
- if (inputType == InputType.STREAM
- || inputType == InputType.STREAM_ITER_DIRECT
- || inputType == InputType.ITER_DIRECT) {
+ if (inputType == InputType.STREAM) {
// Aliasing doesn't apply to stream-backed CIS.
continue;
}
@@ -1061,7 +1019,7 @@ public class CodedInputStreamTest extends TestCase {
assertEquals(inputType.name(), (byte) 89, result.get());
// Enable aliasing
- inputStream = inputType.newDecoder(data, data.length);
+ inputStream = inputType.newDecoder(data);
inputStream.enableAliasing(true);
result = inputStream.readByteBuffer();
assertEquals(inputType.name(), 0, result.capacity());
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java
index 78f415c254..78f415c254 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java
index 9c0997c49b..2c272a7347 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java
+++ b/third_party/protobuf/3.4.0/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,15 +72,7 @@ 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/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java
index b60cd62088..b60cd62088 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java
index 0f09a51b2e..0f09a51b2e 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java
index 923d7f4302..d894279297 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java
@@ -32,7 +32,6 @@ package com.google.protobuf;
import static java.util.Arrays.asList;
-import com.google.protobuf.Internal.DoubleList;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -298,20 +297,6 @@ public class DoubleArrayListTest extends TestCase {
}
}
- public void testRemoveEndOfCapacity() {
- DoubleList toRemove = DoubleArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addDouble(3);
- toRemove.remove(0);
- assertEquals(0, toRemove.size());
- }
-
- public void testSublistRemoveEndOfCapacity() {
- DoubleList toRemove = DoubleArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addDouble(3);
- toRemove.subList(0, 1).clear();
- assertEquals(0, toRemove.size());
- }
-
private void assertImmutable(DoubleArrayList list) {
if (list.contains(1D)) {
throw new RuntimeException("Cannot test the immutability of lists that contain 1.");
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java
index 77d14f6b3a..77d14f6b3a 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/EnumTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/EnumTest.java
index 14c7406b3d..14c7406b3d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/EnumTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/EnumTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java
index 6157e58966..6157e58966 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java
index 42da5bb38b..ff686a0cdf 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java
@@ -404,4 +404,34 @@ public class FieldPresenceTest extends TestCase {
assertTrue(builder.buildPartial().isInitialized());
}
+
+ // Test that unknown fields are dropped.
+ public void testUnknownFields() throws Exception {
+ TestAllTypes.Builder builder = TestAllTypes.newBuilder();
+ builder.setOptionalInt32(1234);
+ builder.addRepeatedInt32(5678);
+ TestAllTypes message = builder.build();
+ ByteString data = message.toByteString();
+
+ TestOptionalFieldsOnly optionalOnlyMessage =
+ TestOptionalFieldsOnly.parseFrom(data);
+ // UnknownFieldSet should be empty.
+ assertEquals(
+ 0, optionalOnlyMessage.getUnknownFields().toByteString().size());
+ assertEquals(1234, optionalOnlyMessage.getOptionalInt32());
+ message = TestAllTypes.parseFrom(optionalOnlyMessage.toByteString());
+ assertEquals(1234, message.getOptionalInt32());
+ // The repeated field is discarded because it's unknown to the optional-only
+ // message.
+ assertEquals(0, message.getRepeatedInt32Count());
+
+ DynamicMessage dynamicOptionalOnlyMessage =
+ DynamicMessage.getDefaultInstance(
+ TestOptionalFieldsOnly.getDescriptor())
+ .getParserForType().parseFrom(data);
+ assertEquals(
+ 0, dynamicOptionalOnlyMessage.getUnknownFields().toByteString().size());
+ assertEquals(optionalOnlyMessage.toByteString(),
+ dynamicOptionalOnlyMessage.toByteString());
+ }
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java
index 903a79dbff..aa36be4977 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java
@@ -32,7 +32,6 @@ package com.google.protobuf;
import static java.util.Arrays.asList;
-import com.google.protobuf.Internal.FloatList;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -298,20 +297,6 @@ public class FloatArrayListTest extends TestCase {
}
}
- public void testRemoveEndOfCapacity() {
- FloatList toRemove = FloatArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addFloat(3);
- toRemove.remove(0);
- assertEquals(0, toRemove.size());
- }
-
- public void testSublistRemoveEndOfCapacity() {
- FloatList toRemove = FloatArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addFloat(3);
- toRemove.subList(0, 1).clear();
- assertEquals(0, toRemove.size());
- }
-
private void assertImmutable(FloatArrayList list) {
if (list.contains(1F)) {
throw new RuntimeException("Cannot test the immutability of lists that contain 1.");
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java
index b7eaebf5e2..b7eaebf5e2 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
index c9ebe7f5d9..a4311d17db 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
@@ -32,14 +32,19 @@ package com.google.protobuf;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
+import com.google.protobuf.UnittestLite.TestAllExtensionsLite;
import com.google.protobuf.test.UnittestImport;
import protobuf_unittest.EnumWithNoOuter;
import protobuf_unittest.MessageWithNoOuter;
import protobuf_unittest.MultipleFilesTestProto;
import protobuf_unittest.NestedExtension.MyNestedExtension;
+import protobuf_unittest.NestedExtensionLite.MyNestedExtensionLite;
import protobuf_unittest.NonNestedExtension;
import protobuf_unittest.NonNestedExtension.MessageToBeExtended;
import protobuf_unittest.NonNestedExtension.MyNonNestedExtension;
+import protobuf_unittest.NonNestedExtensionLite;
+import protobuf_unittest.NonNestedExtensionLite.MessageLiteToBeExtended;
+import protobuf_unittest.NonNestedExtensionLite.MyNonNestedExtensionLite;
import protobuf_unittest.OuterClassNameTest2OuterClass;
import protobuf_unittest.OuterClassNameTest3OuterClass;
import protobuf_unittest.OuterClassNameTestOuterClass;
@@ -707,6 +712,70 @@ public class GeneratedMessageTest extends TestCase {
}
// =================================================================
+ // Lite Extensions.
+
+ // We test lite extensions directly because they have a separate
+ // implementation from full extensions. In contrast, we do not test
+ // lite fields directly since they are implemented exactly the same as
+ // regular fields.
+
+ public void testLiteExtensionMessageOrBuilder() throws Exception {
+ TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.newBuilder();
+ TestUtilLite.setAllExtensions(builder);
+ TestUtil.assertAllExtensionsSet(builder);
+
+ TestAllExtensionsLite message = builder.build();
+ TestUtil.assertAllExtensionsSet(message);
+ }
+
+ public void testLiteExtensionRepeatedSetters() throws Exception {
+ TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.newBuilder();
+ TestUtilLite.setAllExtensions(builder);
+ TestUtilLite.modifyRepeatedExtensions(builder);
+ TestUtil.assertRepeatedExtensionsModified(builder);
+
+ TestAllExtensionsLite message = builder.build();
+ TestUtil.assertRepeatedExtensionsModified(message);
+ }
+
+ public void testLiteExtensionDefaults() throws Exception {
+ TestUtil.assertExtensionsClear(TestAllExtensionsLite.getDefaultInstance());
+ TestUtil.assertExtensionsClear(TestAllExtensionsLite.newBuilder().build());
+ }
+
+ public void testClearLiteExtension() throws Exception {
+ // clearExtension() is not actually used in TestUtil, so try it manually.
+ assertFalse(
+ TestAllExtensionsLite.newBuilder()
+ .setExtension(UnittestLite.optionalInt32ExtensionLite, 1)
+ .clearExtension(UnittestLite.optionalInt32ExtensionLite)
+ .hasExtension(UnittestLite.optionalInt32ExtensionLite));
+ assertEquals(0,
+ TestAllExtensionsLite.newBuilder()
+ .addExtension(UnittestLite.repeatedInt32ExtensionLite, 1)
+ .clearExtension(UnittestLite.repeatedInt32ExtensionLite)
+ .getExtensionCount(UnittestLite.repeatedInt32ExtensionLite));
+ }
+
+ public void testLiteExtensionCopy() throws Exception {
+ TestAllExtensionsLite original = TestUtilLite.getAllLiteExtensionsSet();
+ TestAllExtensionsLite copy =
+ TestAllExtensionsLite.newBuilder(original).build();
+ TestUtil.assertAllExtensionsSet(copy);
+ }
+
+ public void testLiteExtensionMergeFrom() throws Exception {
+ TestAllExtensionsLite original =
+ TestAllExtensionsLite.newBuilder()
+ .setExtension(UnittestLite.optionalInt32ExtensionLite, 1).build();
+ TestAllExtensionsLite merged =
+ TestAllExtensionsLite.newBuilder().mergeFrom(original).build();
+ assertTrue(merged.hasExtension(UnittestLite.optionalInt32ExtensionLite));
+ assertEquals(
+ 1, (int) merged.getExtension(UnittestLite.optionalInt32ExtensionLite));
+ }
+
+ // =================================================================
// multiple_files_test
// Test that custom options of an file level enum are properly initialized.
@@ -873,6 +942,16 @@ public class GeneratedMessageTest extends TestCase {
MyNestedExtension.recursiveExtension.getDescriptor().getName());
}
+ public void testNonNestedExtensionLiteInitialization() {
+ assertTrue(NonNestedExtensionLite.nonNestedExtensionLite
+ .getMessageDefaultInstance() instanceof MyNonNestedExtensionLite);
+ }
+
+ public void testNestedExtensionLiteInitialization() {
+ assertTrue(MyNestedExtensionLite.recursiveExtensionLite
+ .getMessageDefaultInstance() instanceof MessageLiteToBeExtended);
+ }
+
public void testInvalidations() throws Exception {
GeneratedMessage.enableAlwaysUseFieldBuildersForTesting();
TestAllTypes.NestedMessage nestedMessage1 =
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IntArrayListTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IntArrayListTest.java
index d8e97d4f29..60c85450c3 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IntArrayListTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IntArrayListTest.java
@@ -32,7 +32,6 @@ package com.google.protobuf;
import static java.util.Arrays.asList;
-import com.google.protobuf.Internal.IntList;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -298,20 +297,6 @@ public class IntArrayListTest extends TestCase {
}
}
- public void testRemoveEndOfCapacity() {
- IntList toRemove = IntArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addInt(3);
- toRemove.remove(0);
- assertEquals(0, toRemove.size());
- }
-
- public void testSublistRemoveEndOfCapacity() {
- IntList toRemove = IntArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addInt(3);
- toRemove.subList(0, 1).clear();
- assertEquals(0, toRemove.size());
- }
-
private void assertImmutable(IntArrayList list) {
if (list.contains(1)) {
throw new RuntimeException("Cannot test the immutability of lists that contain 1.");
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java
index 756049b41f..756049b41f 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
index 1bcf63e7d9..16a808bf31 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
@@ -273,15 +273,6 @@ 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/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java
index 813fe6bc69..813fe6bc69 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java
index f27e8e51b2..f27e8e51b2 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java
index 968ca2065c..968ca2065c 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java
index 2fc3124d4c..2fc3124d4c 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java
index 006e493366..006e493366 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
index 4764ca1bbc..4764ca1bbc 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteTest.java
index 5ab80ca2ce..ba8bcb1c24 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteTest.java
@@ -48,15 +48,11 @@ import com.google.protobuf.UnittestLite.TestAllTypesLite.RepeatedGroup;
import com.google.protobuf.UnittestLite.TestAllTypesLiteOrBuilder;
import com.google.protobuf.UnittestLite.TestHugeFieldNumbersLite;
import com.google.protobuf.UnittestLite.TestNestedExtensionLite;
-import map_lite_test.MapTestProto.TestMap;
-import map_lite_test.MapTestProto.TestMap.MessageValue;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.BarPrime;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestOneofEquals;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestRecursiveOneof;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -92,11 +88,12 @@ public class LiteTest extends TestCase {
// stuff to make sure the lite message is actually here and usable.
TestAllTypesLite message =
- TestAllTypesLite.newBuilder()
- .setOptionalInt32(123)
- .addRepeatedString("hello")
- .setOptionalNestedMessage(TestAllTypesLite.NestedMessage.newBuilder().setBb(7))
- .build();
+ TestAllTypesLite.newBuilder()
+ .setOptionalInt32(123)
+ .addRepeatedString("hello")
+ .setOptionalNestedMessage(
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(7))
+ .build();
ByteString data = message.toByteString();
@@ -108,66 +105,57 @@ public class LiteTest extends TestCase {
assertEquals(7, message2.getOptionalNestedMessage().getBb());
}
- public void testLite_unknownEnumAtListBoundary() throws Exception {
- ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
- CodedOutputStream output = CodedOutputStream.newInstance(byteStream);
- for (int i = 0; i < AbstractProtobufList.DEFAULT_CAPACITY; i++) {
- output.writeInt32(TestAllTypesLite.REPEATED_NESTED_ENUM_FIELD_NUMBER, 1);
- }
- // 0 is not a valid enum value for NestedEnum
- output.writeInt32(TestAllTypesLite.REPEATED_NESTED_ENUM_FIELD_NUMBER, 0);
- output.flush();
- // This tests a bug we had once with removal right at the boundary of the array. It would throw
- // at runtime so no need to assert.
- TestAllTypesLite.parseFrom(new ByteArrayInputStream(byteStream.toByteArray()));
- }
-
public void testLiteExtensions() throws Exception {
// TODO(kenton): Unlike other features of the lite library, extensions are
// implemented completely differently from the regular library. We
// should probably test them more thoroughly.
TestAllExtensionsLite message =
- TestAllExtensionsLite.newBuilder()
- .setExtension(UnittestLite.optionalInt32ExtensionLite, 123)
- .addExtension(UnittestLite.repeatedStringExtensionLite, "hello")
- .setExtension(
- UnittestLite.optionalNestedEnumExtensionLite, TestAllTypesLite.NestedEnum.BAZ)
- .setExtension(
- UnittestLite.optionalNestedMessageExtensionLite,
- TestAllTypesLite.NestedMessage.newBuilder().setBb(7).build())
- .build();
+ TestAllExtensionsLite.newBuilder()
+ .setExtension(UnittestLite.optionalInt32ExtensionLite, 123)
+ .addExtension(UnittestLite.repeatedStringExtensionLite, "hello")
+ .setExtension(UnittestLite.optionalNestedEnumExtensionLite,
+ TestAllTypesLite.NestedEnum.BAZ)
+ .setExtension(UnittestLite.optionalNestedMessageExtensionLite,
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(7).build())
+ .build();
// Test copying a message, since coping extensions actually does use a
// different code path between lite and regular libraries, and as of this
// writing, parsing hasn't been implemented yet.
TestAllExtensionsLite message2 = message.toBuilder().build();
- assertEquals(123, (int) message2.getExtension(UnittestLite.optionalInt32ExtensionLite));
- assertEquals(1, message2.getExtensionCount(UnittestLite.repeatedStringExtensionLite));
- assertEquals(1, message2.getExtension(UnittestLite.repeatedStringExtensionLite).size());
- assertEquals("hello", message2.getExtension(UnittestLite.repeatedStringExtensionLite, 0));
- assertEquals(
- TestAllTypesLite.NestedEnum.BAZ,
- message2.getExtension(UnittestLite.optionalNestedEnumExtensionLite));
- assertEquals(7, message2.getExtension(UnittestLite.optionalNestedMessageExtensionLite).getBb());
+ assertEquals(123, (int) message2.getExtension(
+ UnittestLite.optionalInt32ExtensionLite));
+ assertEquals(1, message2.getExtensionCount(
+ UnittestLite.repeatedStringExtensionLite));
+ assertEquals(1, message2.getExtension(
+ UnittestLite.repeatedStringExtensionLite).size());
+ assertEquals("hello", message2.getExtension(
+ UnittestLite.repeatedStringExtensionLite, 0));
+ assertEquals(TestAllTypesLite.NestedEnum.BAZ, message2.getExtension(
+ UnittestLite.optionalNestedEnumExtensionLite));
+ assertEquals(7, message2.getExtension(
+ UnittestLite.optionalNestedMessageExtensionLite).getBb());
}
-
+
public void testClone() {
- TestAllTypesLite.Builder expected = TestAllTypesLite.newBuilder().setOptionalInt32(123);
- assertEquals(expected.getOptionalInt32(), expected.clone().getOptionalInt32());
-
- TestAllExtensionsLite.Builder expected2 =
- TestAllExtensionsLite.newBuilder()
- .setExtension(UnittestLite.optionalInt32ExtensionLite, 123);
+ TestAllTypesLite.Builder expected = TestAllTypesLite.newBuilder()
+ .setOptionalInt32(123);
+ assertEquals(
+ expected.getOptionalInt32(), expected.clone().getOptionalInt32());
+
+ TestAllExtensionsLite.Builder expected2 = TestAllExtensionsLite.newBuilder()
+ .setExtension(UnittestLite.optionalInt32ExtensionLite, 123);
assertEquals(
expected2.getExtension(UnittestLite.optionalInt32ExtensionLite),
expected2.clone().getExtension(UnittestLite.optionalInt32ExtensionLite));
}
-
+
public void testAddAll() {
try {
- TestAllTypesLite.newBuilder().addAllRepeatedBytes(null);
+ TestAllTypesLite.newBuilder()
+ .addAllRepeatedBytes(null);
fail();
} catch (NullPointerException e) {
// expected.
@@ -198,7 +186,7 @@ public class LiteTest extends TestCase {
// We have to cast to Byte first. Casting to byte causes a type error
assertEquals(1, ((Byte) memo.get(message)).intValue());
}
-
+
public void testSanityCopyOnWrite() throws InvalidProtocolBufferException {
// Since builders are implemented as a thin wrapper around a message
// instance, we attempt to verify that we can't cause the builder to modify
@@ -222,11 +210,13 @@ public class LiteTest extends TestCase {
assertEquals(ByteString.EMPTY, message.getOptionalBytes());
assertEquals(ByteString.copyFromUtf8("hi"), builder.getOptionalBytes());
messageAfterBuild = builder.build();
- assertEquals(ByteString.copyFromUtf8("hi"), messageAfterBuild.getOptionalBytes());
+ assertEquals(
+ ByteString.copyFromUtf8("hi"), messageAfterBuild.getOptionalBytes());
assertEquals(ByteString.EMPTY, message.getOptionalBytes());
builder.clearOptionalBytes();
assertEquals(ByteString.EMPTY, builder.getOptionalBytes());
- assertEquals(ByteString.copyFromUtf8("hi"), messageAfterBuild.getOptionalBytes());
+ assertEquals(
+ ByteString.copyFromUtf8("hi"), messageAfterBuild.getOptionalBytes());
message = builder.build();
builder.setOptionalCord("hi");
@@ -244,23 +234,27 @@ public class LiteTest extends TestCase {
assertEquals(ByteString.EMPTY, message.getOptionalCordBytes());
assertEquals(ByteString.copyFromUtf8("no"), builder.getOptionalCordBytes());
messageAfterBuild = builder.build();
- assertEquals(ByteString.copyFromUtf8("no"), messageAfterBuild.getOptionalCordBytes());
+ assertEquals(
+ ByteString.copyFromUtf8("no"),
+ messageAfterBuild.getOptionalCordBytes());
assertEquals(ByteString.EMPTY, message.getOptionalCordBytes());
builder.clearOptionalCord();
assertEquals(ByteString.EMPTY, builder.getOptionalCordBytes());
- assertEquals(ByteString.copyFromUtf8("no"), messageAfterBuild.getOptionalCordBytes());
-
+ assertEquals(
+ ByteString.copyFromUtf8("no"),
+ messageAfterBuild.getOptionalCordBytes());
+
message = builder.build();
builder.setOptionalDouble(1);
- assertEquals(0D, message.getOptionalDouble(), 0.0);
- assertEquals(1D, builder.getOptionalDouble(), 0.0);
+ assertEquals(0D, message.getOptionalDouble());
+ assertEquals(1D, builder.getOptionalDouble());
messageAfterBuild = builder.build();
- assertEquals(1D, messageAfterBuild.getOptionalDouble(), 0.0);
- assertEquals(0D, message.getOptionalDouble(), 0.0);
+ assertEquals(1D, messageAfterBuild.getOptionalDouble());
+ assertEquals(0D, message.getOptionalDouble());
builder.clearOptionalDouble();
- assertEquals(0D, builder.getOptionalDouble(), 0.0);
- assertEquals(1D, messageAfterBuild.getOptionalDouble(), 0.0);
-
+ assertEquals(0D, builder.getOptionalDouble());
+ assertEquals(1D, messageAfterBuild.getOptionalDouble());
+
message = builder.build();
builder.setOptionalFixed32(1);
assertEquals(0, message.getOptionalFixed32());
@@ -271,7 +265,7 @@ public class LiteTest extends TestCase {
builder.clearOptionalFixed32();
assertEquals(0, builder.getOptionalFixed32());
assertEquals(1, messageAfterBuild.getOptionalFixed32());
-
+
message = builder.build();
builder.setOptionalFixed64(1);
assertEquals(0L, message.getOptionalFixed64());
@@ -285,72 +279,105 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.setOptionalFloat(1);
- assertEquals(0F, message.getOptionalFloat(), 0.0f);
- assertEquals(1F, builder.getOptionalFloat(), 0.0f);
+ assertEquals(0F, message.getOptionalFloat());
+ assertEquals(1F, builder.getOptionalFloat());
messageAfterBuild = builder.build();
- assertEquals(1F, messageAfterBuild.getOptionalFloat(), 0.0f);
- assertEquals(0F, message.getOptionalFloat(), 0.0f);
+ assertEquals(1F, messageAfterBuild.getOptionalFloat());
+ assertEquals(0F, message.getOptionalFloat());
builder.clearOptionalFloat();
- assertEquals(0F, builder.getOptionalFloat(), 0.0f);
- assertEquals(1F, messageAfterBuild.getOptionalFloat(), 0.0f);
+ assertEquals(0F, builder.getOptionalFloat());
+ assertEquals(1F, messageAfterBuild.getOptionalFloat());
message = builder.build();
builder.setOptionalForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR);
- assertEquals(ForeignEnumLite.FOREIGN_LITE_FOO, message.getOptionalForeignEnum());
- assertEquals(ForeignEnumLite.FOREIGN_LITE_BAR, builder.getOptionalForeignEnum());
+ assertEquals(
+ ForeignEnumLite.FOREIGN_LITE_FOO, message.getOptionalForeignEnum());
+ assertEquals(
+ ForeignEnumLite.FOREIGN_LITE_BAR, builder.getOptionalForeignEnum());
messageAfterBuild = builder.build();
- assertEquals(ForeignEnumLite.FOREIGN_LITE_BAR, messageAfterBuild.getOptionalForeignEnum());
- assertEquals(ForeignEnumLite.FOREIGN_LITE_FOO, message.getOptionalForeignEnum());
+ assertEquals(
+ ForeignEnumLite.FOREIGN_LITE_BAR,
+ messageAfterBuild.getOptionalForeignEnum());
+ assertEquals(
+ ForeignEnumLite.FOREIGN_LITE_FOO, message.getOptionalForeignEnum());
builder.clearOptionalForeignEnum();
- assertEquals(ForeignEnumLite.FOREIGN_LITE_FOO, builder.getOptionalForeignEnum());
- assertEquals(ForeignEnumLite.FOREIGN_LITE_BAR, messageAfterBuild.getOptionalForeignEnum());
+ assertEquals(
+ ForeignEnumLite.FOREIGN_LITE_FOO, builder.getOptionalForeignEnum());
+ assertEquals(
+ ForeignEnumLite.FOREIGN_LITE_BAR,
+ messageAfterBuild.getOptionalForeignEnum());
message = builder.build();
- ForeignMessageLite foreignMessage = ForeignMessageLite.newBuilder().setC(1).build();
+ ForeignMessageLite foreignMessage = ForeignMessageLite.newBuilder()
+ .setC(1)
+ .build();
builder.setOptionalForeignMessage(foreignMessage);
- assertEquals(ForeignMessageLite.getDefaultInstance(), message.getOptionalForeignMessage());
+ assertEquals(
+ ForeignMessageLite.getDefaultInstance(),
+ message.getOptionalForeignMessage());
assertEquals(foreignMessage, builder.getOptionalForeignMessage());
messageAfterBuild = builder.build();
assertEquals(foreignMessage, messageAfterBuild.getOptionalForeignMessage());
- assertEquals(ForeignMessageLite.getDefaultInstance(), message.getOptionalForeignMessage());
+ assertEquals(
+ ForeignMessageLite.getDefaultInstance(),
+ message.getOptionalForeignMessage());
builder.clearOptionalForeignMessage();
- assertEquals(ForeignMessageLite.getDefaultInstance(), builder.getOptionalForeignMessage());
+ assertEquals(
+ ForeignMessageLite.getDefaultInstance(),
+ builder.getOptionalForeignMessage());
assertEquals(foreignMessage, messageAfterBuild.getOptionalForeignMessage());
message = builder.build();
- ForeignMessageLite.Builder foreignMessageBuilder = ForeignMessageLite.newBuilder().setC(3);
+ ForeignMessageLite.Builder foreignMessageBuilder =
+ ForeignMessageLite.newBuilder()
+ .setC(3);
builder.setOptionalForeignMessage(foreignMessageBuilder);
- assertEquals(ForeignMessageLite.getDefaultInstance(), message.getOptionalForeignMessage());
+ assertEquals(
+ ForeignMessageLite.getDefaultInstance(),
+ message.getOptionalForeignMessage());
assertEquals(foreignMessageBuilder.build(), builder.getOptionalForeignMessage());
messageAfterBuild = builder.build();
assertEquals(foreignMessageBuilder.build(), messageAfterBuild.getOptionalForeignMessage());
- assertEquals(ForeignMessageLite.getDefaultInstance(), message.getOptionalForeignMessage());
+ assertEquals(
+ ForeignMessageLite.getDefaultInstance(),
+ message.getOptionalForeignMessage());
builder.clearOptionalForeignMessage();
- assertEquals(ForeignMessageLite.getDefaultInstance(), builder.getOptionalForeignMessage());
+ assertEquals(
+ ForeignMessageLite.getDefaultInstance(),
+ builder.getOptionalForeignMessage());
assertEquals(foreignMessageBuilder.build(), messageAfterBuild.getOptionalForeignMessage());
message = builder.build();
- OptionalGroup optionalGroup = OptionalGroup.newBuilder().setA(1).build();
+ OptionalGroup optionalGroup = OptionalGroup.newBuilder()
+ .setA(1)
+ .build();
builder.setOptionalGroup(optionalGroup);
- assertEquals(OptionalGroup.getDefaultInstance(), message.getOptionalGroup());
+ assertEquals(
+ OptionalGroup.getDefaultInstance(), message.getOptionalGroup());
assertEquals(optionalGroup, builder.getOptionalGroup());
messageAfterBuild = builder.build();
assertEquals(optionalGroup, messageAfterBuild.getOptionalGroup());
- assertEquals(OptionalGroup.getDefaultInstance(), message.getOptionalGroup());
+ assertEquals(
+ OptionalGroup.getDefaultInstance(), message.getOptionalGroup());
builder.clearOptionalGroup();
- assertEquals(OptionalGroup.getDefaultInstance(), builder.getOptionalGroup());
+ assertEquals(
+ OptionalGroup.getDefaultInstance(), builder.getOptionalGroup());
assertEquals(optionalGroup, messageAfterBuild.getOptionalGroup());
message = builder.build();
- OptionalGroup.Builder optionalGroupBuilder = OptionalGroup.newBuilder().setA(3);
+ OptionalGroup.Builder optionalGroupBuilder = OptionalGroup.newBuilder()
+ .setA(3);
builder.setOptionalGroup(optionalGroupBuilder);
- assertEquals(OptionalGroup.getDefaultInstance(), message.getOptionalGroup());
+ assertEquals(
+ OptionalGroup.getDefaultInstance(), message.getOptionalGroup());
assertEquals(optionalGroupBuilder.build(), builder.getOptionalGroup());
messageAfterBuild = builder.build();
assertEquals(optionalGroupBuilder.build(), messageAfterBuild.getOptionalGroup());
- assertEquals(OptionalGroup.getDefaultInstance(), message.getOptionalGroup());
+ assertEquals(
+ OptionalGroup.getDefaultInstance(), message.getOptionalGroup());
builder.clearOptionalGroup();
- assertEquals(OptionalGroup.getDefaultInstance(), builder.getOptionalGroup());
+ assertEquals(
+ OptionalGroup.getDefaultInstance(), builder.getOptionalGroup());
assertEquals(optionalGroupBuilder.build(), messageAfterBuild.getOptionalGroup());
message = builder.build();
@@ -374,29 +401,43 @@ public class LiteTest extends TestCase {
builder.clearOptionalInt64();
assertEquals(0L, builder.getOptionalInt64());
assertEquals(1L, messageAfterBuild.getOptionalInt64());
-
+
message = builder.build();
- NestedMessage nestedMessage = NestedMessage.newBuilder().setBb(1).build();
+ NestedMessage nestedMessage = NestedMessage.newBuilder()
+ .setBb(1)
+ .build();
builder.setOptionalLazyMessage(nestedMessage);
- assertEquals(NestedMessage.getDefaultInstance(), message.getOptionalLazyMessage());
+ assertEquals(
+ NestedMessage.getDefaultInstance(),
+ message.getOptionalLazyMessage());
assertEquals(nestedMessage, builder.getOptionalLazyMessage());
messageAfterBuild = builder.build();
assertEquals(nestedMessage, messageAfterBuild.getOptionalLazyMessage());
- assertEquals(NestedMessage.getDefaultInstance(), message.getOptionalLazyMessage());
+ assertEquals(
+ NestedMessage.getDefaultInstance(),
+ message.getOptionalLazyMessage());
builder.clearOptionalLazyMessage();
- assertEquals(NestedMessage.getDefaultInstance(), builder.getOptionalLazyMessage());
+ assertEquals(
+ NestedMessage.getDefaultInstance(), builder.getOptionalLazyMessage());
assertEquals(nestedMessage, messageAfterBuild.getOptionalLazyMessage());
message = builder.build();
- NestedMessage.Builder nestedMessageBuilder = NestedMessage.newBuilder().setBb(3);
+ NestedMessage.Builder nestedMessageBuilder =
+ NestedMessage.newBuilder()
+ .setBb(3);
builder.setOptionalLazyMessage(nestedMessageBuilder);
- assertEquals(NestedMessage.getDefaultInstance(), message.getOptionalLazyMessage());
+ assertEquals(
+ NestedMessage.getDefaultInstance(),
+ message.getOptionalLazyMessage());
assertEquals(nestedMessageBuilder.build(), builder.getOptionalLazyMessage());
messageAfterBuild = builder.build();
assertEquals(nestedMessageBuilder.build(), messageAfterBuild.getOptionalLazyMessage());
- assertEquals(NestedMessage.getDefaultInstance(), message.getOptionalLazyMessage());
+ assertEquals(
+ NestedMessage.getDefaultInstance(),
+ message.getOptionalLazyMessage());
builder.clearOptionalLazyMessage();
- assertEquals(NestedMessage.getDefaultInstance(), builder.getOptionalLazyMessage());
+ assertEquals(
+ NestedMessage.getDefaultInstance(), builder.getOptionalLazyMessage());
assertEquals(nestedMessageBuilder.build(), messageAfterBuild.getOptionalLazyMessage());
message = builder.build();
@@ -456,14 +497,19 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.setOptionalStringBytes(ByteString.copyFromUtf8("no"));
assertEquals(ByteString.EMPTY, message.getOptionalStringBytes());
- assertEquals(ByteString.copyFromUtf8("no"), builder.getOptionalStringBytes());
+ assertEquals(
+ ByteString.copyFromUtf8("no"), builder.getOptionalStringBytes());
messageAfterBuild = builder.build();
- assertEquals(ByteString.copyFromUtf8("no"), messageAfterBuild.getOptionalStringBytes());
+ assertEquals(
+ ByteString.copyFromUtf8("no"),
+ messageAfterBuild.getOptionalStringBytes());
assertEquals(ByteString.EMPTY, message.getOptionalStringBytes());
builder.clearOptionalString();
assertEquals(ByteString.EMPTY, builder.getOptionalStringBytes());
- assertEquals(ByteString.copyFromUtf8("no"), messageAfterBuild.getOptionalStringBytes());
-
+ assertEquals(
+ ByteString.copyFromUtf8("no"),
+ messageAfterBuild.getOptionalStringBytes());
+
message = builder.build();
builder.setOptionalStringPiece("hi");
assertEquals("", message.getOptionalStringPiece());
@@ -478,13 +524,18 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.setOptionalStringPieceBytes(ByteString.copyFromUtf8("no"));
assertEquals(ByteString.EMPTY, message.getOptionalStringPieceBytes());
- assertEquals(ByteString.copyFromUtf8("no"), builder.getOptionalStringPieceBytes());
+ assertEquals(
+ ByteString.copyFromUtf8("no"), builder.getOptionalStringPieceBytes());
messageAfterBuild = builder.build();
- assertEquals(ByteString.copyFromUtf8("no"), messageAfterBuild.getOptionalStringPieceBytes());
+ assertEquals(
+ ByteString.copyFromUtf8("no"),
+ messageAfterBuild.getOptionalStringPieceBytes());
assertEquals(ByteString.EMPTY, message.getOptionalStringPieceBytes());
builder.clearOptionalStringPiece();
assertEquals(ByteString.EMPTY, builder.getOptionalStringPieceBytes());
- assertEquals(ByteString.copyFromUtf8("no"), messageAfterBuild.getOptionalStringPieceBytes());
+ assertEquals(
+ ByteString.copyFromUtf8("no"),
+ messageAfterBuild.getOptionalStringPieceBytes());
message = builder.build();
builder.setOptionalUint32(1);
@@ -521,13 +572,16 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.addAllRepeatedBytes(singletonList(ByteString.copyFromUtf8("hi")));
assertEquals(emptyList(), message.getRepeatedBytesList());
- assertEquals(singletonList(ByteString.copyFromUtf8("hi")), builder.getRepeatedBytesList());
+ assertEquals(
+ singletonList(ByteString.copyFromUtf8("hi")),
+ builder.getRepeatedBytesList());
assertEquals(emptyList(), message.getRepeatedBytesList());
messageAfterBuild = builder.build();
builder.clearRepeatedBytes();
assertEquals(emptyList(), builder.getRepeatedBytesList());
assertEquals(
- singletonList(ByteString.copyFromUtf8("hi")), messageAfterBuild.getRepeatedBytesList());
+ singletonList(ByteString.copyFromUtf8("hi")),
+ messageAfterBuild.getRepeatedBytesList());
message = builder.build();
builder.addAllRepeatedCord(singletonList("hi"));
@@ -580,10 +634,12 @@ public class LiteTest extends TestCase {
assertEquals(singletonList(1F), messageAfterBuild.getRepeatedFloatList());
message = builder.build();
- builder.addAllRepeatedForeignEnum(singletonList(ForeignEnumLite.FOREIGN_LITE_BAR));
+ builder.addAllRepeatedForeignEnum(
+ singletonList(ForeignEnumLite.FOREIGN_LITE_BAR));
assertEquals(emptyList(), message.getRepeatedForeignEnumList());
assertEquals(
- singletonList(ForeignEnumLite.FOREIGN_LITE_BAR), builder.getRepeatedForeignEnumList());
+ singletonList(ForeignEnumLite.FOREIGN_LITE_BAR),
+ builder.getRepeatedForeignEnumList());
assertEquals(emptyList(), message.getRepeatedForeignEnumList());
messageAfterBuild = builder.build();
builder.clearRepeatedForeignEnum();
@@ -595,17 +651,23 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.addAllRepeatedForeignMessage(singletonList(foreignMessage));
assertEquals(emptyList(), message.getRepeatedForeignMessageList());
- assertEquals(singletonList(foreignMessage), builder.getRepeatedForeignMessageList());
+ assertEquals(
+ singletonList(foreignMessage), builder.getRepeatedForeignMessageList());
assertEquals(emptyList(), message.getRepeatedForeignMessageList());
messageAfterBuild = builder.build();
builder.clearRepeatedForeignMessage();
assertEquals(emptyList(), builder.getRepeatedForeignMessageList());
- assertEquals(singletonList(foreignMessage), messageAfterBuild.getRepeatedForeignMessageList());
+ assertEquals(
+ singletonList(foreignMessage),
+ messageAfterBuild.getRepeatedForeignMessageList());
message = builder.build();
- builder.addAllRepeatedGroup(singletonList(RepeatedGroup.getDefaultInstance()));
+ builder.addAllRepeatedGroup(
+ singletonList(RepeatedGroup.getDefaultInstance()));
assertEquals(emptyList(), message.getRepeatedGroupList());
- assertEquals(singletonList(RepeatedGroup.getDefaultInstance()), builder.getRepeatedGroupList());
+ assertEquals(
+ singletonList(RepeatedGroup.getDefaultInstance()),
+ builder.getRepeatedGroupList());
assertEquals(emptyList(), message.getRepeatedGroupList());
messageAfterBuild = builder.build();
builder.clearRepeatedGroup();
@@ -637,12 +699,15 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.addAllRepeatedLazyMessage(singletonList(nestedMessage));
assertEquals(emptyList(), message.getRepeatedLazyMessageList());
- assertEquals(singletonList(nestedMessage), builder.getRepeatedLazyMessageList());
+ assertEquals(
+ singletonList(nestedMessage), builder.getRepeatedLazyMessageList());
assertEquals(emptyList(), message.getRepeatedLazyMessageList());
messageAfterBuild = builder.build();
builder.clearRepeatedLazyMessage();
assertEquals(emptyList(), builder.getRepeatedLazyMessageList());
- assertEquals(singletonList(nestedMessage), messageAfterBuild.getRepeatedLazyMessageList());
+ assertEquals(
+ singletonList(nestedMessage),
+ messageAfterBuild.getRepeatedLazyMessageList());
message = builder.build();
builder.addAllRepeatedSfixed32(singletonList(1));
@@ -662,7 +727,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
builder.clearRepeatedSfixed64();
assertEquals(emptyList(), builder.getRepeatedSfixed64List());
- assertEquals(singletonList(1L), messageAfterBuild.getRepeatedSfixed64List());
+ assertEquals(
+ singletonList(1L), messageAfterBuild.getRepeatedSfixed64List());
message = builder.build();
builder.addAllRepeatedSint32(singletonList(1));
@@ -692,7 +758,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
builder.clearRepeatedString();
assertEquals(emptyList(), builder.getRepeatedStringList());
- assertEquals(singletonList("hi"), messageAfterBuild.getRepeatedStringList());
+ assertEquals(
+ singletonList("hi"), messageAfterBuild.getRepeatedStringList());
message = builder.build();
builder.addAllRepeatedStringPiece(singletonList("hi"));
@@ -702,7 +769,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
builder.clearRepeatedStringPiece();
assertEquals(emptyList(), builder.getRepeatedStringPieceList());
- assertEquals(singletonList("hi"), messageAfterBuild.getRepeatedStringPieceList());
+ assertEquals(
+ singletonList("hi"), messageAfterBuild.getRepeatedStringPieceList());
message = builder.build();
builder.addAllRepeatedUint32(singletonList(1));
@@ -737,13 +805,16 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.addRepeatedBytes(ByteString.copyFromUtf8("hi"));
assertEquals(emptyList(), message.getRepeatedBytesList());
- assertEquals(singletonList(ByteString.copyFromUtf8("hi")), builder.getRepeatedBytesList());
+ assertEquals(
+ singletonList(ByteString.copyFromUtf8("hi")),
+ builder.getRepeatedBytesList());
assertEquals(emptyList(), message.getRepeatedBytesList());
messageAfterBuild = builder.build();
builder.clearRepeatedBytes();
assertEquals(emptyList(), builder.getRepeatedBytesList());
assertEquals(
- singletonList(ByteString.copyFromUtf8("hi")), messageAfterBuild.getRepeatedBytesList());
+ singletonList(ByteString.copyFromUtf8("hi")),
+ messageAfterBuild.getRepeatedBytesList());
message = builder.build();
builder.addRepeatedCord("hi");
@@ -799,7 +870,8 @@ public class LiteTest extends TestCase {
builder.addRepeatedForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR);
assertEquals(emptyList(), message.getRepeatedForeignEnumList());
assertEquals(
- singletonList(ForeignEnumLite.FOREIGN_LITE_BAR), builder.getRepeatedForeignEnumList());
+ singletonList(ForeignEnumLite.FOREIGN_LITE_BAR),
+ builder.getRepeatedForeignEnumList());
assertEquals(emptyList(), message.getRepeatedForeignEnumList());
messageAfterBuild = builder.build();
builder.clearRepeatedForeignEnum();
@@ -811,17 +883,22 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.addRepeatedForeignMessage(foreignMessage);
assertEquals(emptyList(), message.getRepeatedForeignMessageList());
- assertEquals(singletonList(foreignMessage), builder.getRepeatedForeignMessageList());
+ assertEquals(
+ singletonList(foreignMessage), builder.getRepeatedForeignMessageList());
assertEquals(emptyList(), message.getRepeatedForeignMessageList());
messageAfterBuild = builder.build();
builder.removeRepeatedForeignMessage(0);
assertEquals(emptyList(), builder.getRepeatedForeignMessageList());
- assertEquals(singletonList(foreignMessage), messageAfterBuild.getRepeatedForeignMessageList());
+ assertEquals(
+ singletonList(foreignMessage),
+ messageAfterBuild.getRepeatedForeignMessageList());
message = builder.build();
builder.addRepeatedGroup(RepeatedGroup.getDefaultInstance());
assertEquals(emptyList(), message.getRepeatedGroupList());
- assertEquals(singletonList(RepeatedGroup.getDefaultInstance()), builder.getRepeatedGroupList());
+ assertEquals(
+ singletonList(RepeatedGroup.getDefaultInstance()),
+ builder.getRepeatedGroupList());
assertEquals(emptyList(), message.getRepeatedGroupList());
messageAfterBuild = builder.build();
builder.removeRepeatedGroup(0);
@@ -853,12 +930,15 @@ public class LiteTest extends TestCase {
message = builder.build();
builder.addRepeatedLazyMessage(nestedMessage);
assertEquals(emptyList(), message.getRepeatedLazyMessageList());
- assertEquals(singletonList(nestedMessage), builder.getRepeatedLazyMessageList());
+ assertEquals(
+ singletonList(nestedMessage), builder.getRepeatedLazyMessageList());
assertEquals(emptyList(), message.getRepeatedLazyMessageList());
messageAfterBuild = builder.build();
builder.removeRepeatedLazyMessage(0);
assertEquals(emptyList(), builder.getRepeatedLazyMessageList());
- assertEquals(singletonList(nestedMessage), messageAfterBuild.getRepeatedLazyMessageList());
+ assertEquals(
+ singletonList(nestedMessage),
+ messageAfterBuild.getRepeatedLazyMessageList());
message = builder.build();
builder.addRepeatedSfixed32(1);
@@ -878,7 +958,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
builder.clearRepeatedSfixed64();
assertEquals(emptyList(), builder.getRepeatedSfixed64List());
- assertEquals(singletonList(1L), messageAfterBuild.getRepeatedSfixed64List());
+ assertEquals(
+ singletonList(1L), messageAfterBuild.getRepeatedSfixed64List());
message = builder.build();
builder.addRepeatedSint32(1);
@@ -908,7 +989,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
builder.clearRepeatedString();
assertEquals(emptyList(), builder.getRepeatedStringList());
- assertEquals(singletonList("hi"), messageAfterBuild.getRepeatedStringList());
+ assertEquals(
+ singletonList("hi"), messageAfterBuild.getRepeatedStringList());
message = builder.build();
builder.addRepeatedStringPiece("hi");
@@ -918,7 +1000,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
builder.clearRepeatedStringPiece();
assertEquals(emptyList(), builder.getRepeatedStringPieceList());
- assertEquals(singletonList("hi"), messageAfterBuild.getRepeatedStringPieceList());
+ assertEquals(
+ singletonList("hi"), messageAfterBuild.getRepeatedStringPieceList());
message = builder.build();
builder.addRepeatedUint32(1);
@@ -939,7 +1022,7 @@ public class LiteTest extends TestCase {
builder.clearRepeatedUint64();
assertEquals(emptyList(), builder.getRepeatedUint64List());
assertEquals(singletonList(1L), messageAfterBuild.getRepeatedUint64List());
-
+
message = builder.build();
builder.addRepeatedBool(true);
messageAfterBuild = builder.build();
@@ -948,13 +1031,14 @@ public class LiteTest extends TestCase {
assertEquals(true, messageAfterBuild.getRepeatedBool(0));
assertEquals(false, builder.getRepeatedBool(0));
builder.clearRepeatedBool();
-
+
message = builder.build();
builder.addRepeatedBytes(ByteString.copyFromUtf8("hi"));
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedBytesCount());
builder.setRepeatedBytes(0, ByteString.EMPTY);
- assertEquals(ByteString.copyFromUtf8("hi"), messageAfterBuild.getRepeatedBytes(0));
+ assertEquals(
+ ByteString.copyFromUtf8("hi"), messageAfterBuild.getRepeatedBytes(0));
assertEquals(ByteString.EMPTY, builder.getRepeatedBytes(0));
builder.clearRepeatedBytes();
@@ -972,7 +1056,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedCordCount());
builder.setRepeatedCord(0, "");
- assertEquals(ByteString.copyFromUtf8("hi"), messageAfterBuild.getRepeatedCordBytes(0));
+ assertEquals(
+ ByteString.copyFromUtf8("hi"), messageAfterBuild.getRepeatedCordBytes(0));
assertEquals(ByteString.EMPTY, builder.getRepeatedCordBytes(0));
builder.clearRepeatedCord();
@@ -981,8 +1066,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedDoubleCount());
builder.setRepeatedDouble(0, 0D);
- assertEquals(1D, messageAfterBuild.getRepeatedDouble(0), 0.0);
- assertEquals(0D, builder.getRepeatedDouble(0), 0.0);
+ assertEquals(1D, messageAfterBuild.getRepeatedDouble(0));
+ assertEquals(0D, builder.getRepeatedDouble(0));
builder.clearRepeatedDouble();
message = builder.build();
@@ -1008,8 +1093,8 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedFloatCount());
builder.setRepeatedFloat(0, 0F);
- assertEquals(1F, messageAfterBuild.getRepeatedFloat(0), 0.0f);
- assertEquals(0F, builder.getRepeatedFloat(0), 0.0f);
+ assertEquals(1F, messageAfterBuild.getRepeatedFloat(0));
+ assertEquals(0F, builder.getRepeatedFloat(0));
builder.clearRepeatedFloat();
message = builder.build();
@@ -1017,26 +1102,36 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedForeignEnumCount());
builder.setRepeatedForeignEnum(0, ForeignEnumLite.FOREIGN_LITE_FOO);
- assertEquals(ForeignEnumLite.FOREIGN_LITE_BAR, messageAfterBuild.getRepeatedForeignEnum(0));
- assertEquals(ForeignEnumLite.FOREIGN_LITE_FOO, builder.getRepeatedForeignEnum(0));
+ assertEquals(
+ ForeignEnumLite.FOREIGN_LITE_BAR,
+ messageAfterBuild.getRepeatedForeignEnum(0));
+ assertEquals(
+ ForeignEnumLite.FOREIGN_LITE_FOO, builder.getRepeatedForeignEnum(0));
builder.clearRepeatedForeignEnum();
message = builder.build();
builder.addRepeatedForeignMessage(foreignMessage);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedForeignMessageCount());
- builder.setRepeatedForeignMessage(0, ForeignMessageLite.getDefaultInstance());
- assertEquals(foreignMessage, messageAfterBuild.getRepeatedForeignMessage(0));
- assertEquals(ForeignMessageLite.getDefaultInstance(), builder.getRepeatedForeignMessage(0));
+ builder.setRepeatedForeignMessage(
+ 0, ForeignMessageLite.getDefaultInstance());
+ assertEquals(
+ foreignMessage, messageAfterBuild.getRepeatedForeignMessage(0));
+ assertEquals(
+ ForeignMessageLite.getDefaultInstance(),
+ builder.getRepeatedForeignMessage(0));
builder.clearRepeatedForeignMessage();
-
+
message = builder.build();
builder.addRepeatedForeignMessage(foreignMessageBuilder);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedForeignMessageCount());
- builder.setRepeatedForeignMessage(0, ForeignMessageLite.getDefaultInstance());
+ builder.setRepeatedForeignMessage(
+ 0, ForeignMessageLite.getDefaultInstance());
assertEquals(foreignMessageBuilder.build(), messageAfterBuild.getRepeatedForeignMessage(0));
- assertEquals(ForeignMessageLite.getDefaultInstance(), builder.getRepeatedForeignMessage(0));
+ assertEquals(
+ ForeignMessageLite.getDefaultInstance(),
+ builder.getRepeatedForeignMessage(0));
builder.clearRepeatedForeignMessage();
message = builder.build();
@@ -1044,46 +1139,54 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedForeignMessageCount());
builder.setRepeatedForeignMessage(0, foreignMessageBuilder);
- assertEquals(foreignMessage, messageAfterBuild.getRepeatedForeignMessage(0));
+ assertEquals(
+ foreignMessage, messageAfterBuild.getRepeatedForeignMessage(0));
assertEquals(foreignMessageBuilder.build(), builder.getRepeatedForeignMessage(0));
builder.clearRepeatedForeignMessage();
message = builder.build();
- RepeatedGroup repeatedGroup = RepeatedGroup.newBuilder().setA(1).build();
+ RepeatedGroup repeatedGroup = RepeatedGroup.newBuilder()
+ .setA(1)
+ .build();
builder.addRepeatedGroup(repeatedGroup);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedGroupCount());
builder.setRepeatedGroup(0, RepeatedGroup.getDefaultInstance());
assertEquals(repeatedGroup, messageAfterBuild.getRepeatedGroup(0));
- assertEquals(RepeatedGroup.getDefaultInstance(), builder.getRepeatedGroup(0));
+ assertEquals(
+ RepeatedGroup.getDefaultInstance(), builder.getRepeatedGroup(0));
builder.clearRepeatedGroup();
-
+
message = builder.build();
builder.addRepeatedGroup(0, repeatedGroup);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedGroupCount());
builder.setRepeatedGroup(0, RepeatedGroup.getDefaultInstance());
assertEquals(repeatedGroup, messageAfterBuild.getRepeatedGroup(0));
- assertEquals(RepeatedGroup.getDefaultInstance(), builder.getRepeatedGroup(0));
+ assertEquals(
+ RepeatedGroup.getDefaultInstance(), builder.getRepeatedGroup(0));
builder.clearRepeatedGroup();
-
+
message = builder.build();
- RepeatedGroup.Builder repeatedGroupBuilder = RepeatedGroup.newBuilder().setA(3);
+ RepeatedGroup.Builder repeatedGroupBuilder = RepeatedGroup.newBuilder()
+ .setA(3);
builder.addRepeatedGroup(repeatedGroupBuilder);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedGroupCount());
builder.setRepeatedGroup(0, RepeatedGroup.getDefaultInstance());
assertEquals(repeatedGroupBuilder.build(), messageAfterBuild.getRepeatedGroup(0));
- assertEquals(RepeatedGroup.getDefaultInstance(), builder.getRepeatedGroup(0));
+ assertEquals(
+ RepeatedGroup.getDefaultInstance(), builder.getRepeatedGroup(0));
builder.clearRepeatedGroup();
-
+
message = builder.build();
builder.addRepeatedGroup(0, repeatedGroupBuilder);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedGroupCount());
builder.setRepeatedGroup(0, RepeatedGroup.getDefaultInstance());
assertEquals(repeatedGroupBuilder.build(), messageAfterBuild.getRepeatedGroup(0));
- assertEquals(RepeatedGroup.getDefaultInstance(), builder.getRepeatedGroup(0));
+ assertEquals(
+ RepeatedGroup.getDefaultInstance(), builder.getRepeatedGroup(0));
builder.clearRepeatedGroup();
message = builder.build();
@@ -1103,41 +1206,45 @@ public class LiteTest extends TestCase {
assertEquals(1L, messageAfterBuild.getRepeatedInt64(0));
assertEquals(0L, builder.getRepeatedInt64(0));
builder.clearRepeatedInt64();
-
+
message = builder.build();
builder.addRepeatedLazyMessage(nestedMessage);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedLazyMessageCount());
builder.setRepeatedLazyMessage(0, NestedMessage.getDefaultInstance());
assertEquals(nestedMessage, messageAfterBuild.getRepeatedLazyMessage(0));
- assertEquals(NestedMessage.getDefaultInstance(), builder.getRepeatedLazyMessage(0));
+ assertEquals(
+ NestedMessage.getDefaultInstance(), builder.getRepeatedLazyMessage(0));
builder.clearRepeatedLazyMessage();
-
+
message = builder.build();
builder.addRepeatedLazyMessage(0, nestedMessage);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedLazyMessageCount());
builder.setRepeatedLazyMessage(0, NestedMessage.getDefaultInstance());
assertEquals(nestedMessage, messageAfterBuild.getRepeatedLazyMessage(0));
- assertEquals(NestedMessage.getDefaultInstance(), builder.getRepeatedLazyMessage(0));
+ assertEquals(
+ NestedMessage.getDefaultInstance(), builder.getRepeatedLazyMessage(0));
builder.clearRepeatedLazyMessage();
-
+
message = builder.build();
builder.addRepeatedLazyMessage(nestedMessageBuilder);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedLazyMessageCount());
builder.setRepeatedLazyMessage(0, NestedMessage.getDefaultInstance());
assertEquals(nestedMessageBuilder.build(), messageAfterBuild.getRepeatedLazyMessage(0));
- assertEquals(NestedMessage.getDefaultInstance(), builder.getRepeatedLazyMessage(0));
+ assertEquals(
+ NestedMessage.getDefaultInstance(), builder.getRepeatedLazyMessage(0));
builder.clearRepeatedLazyMessage();
-
+
message = builder.build();
builder.addRepeatedLazyMessage(0, nestedMessageBuilder);
messageAfterBuild = builder.build();
assertEquals(0, message.getRepeatedLazyMessageCount());
builder.setRepeatedLazyMessage(0, NestedMessage.getDefaultInstance());
assertEquals(nestedMessageBuilder.build(), messageAfterBuild.getRepeatedLazyMessage(0));
- assertEquals(NestedMessage.getDefaultInstance(), builder.getRepeatedLazyMessage(0));
+ assertEquals(
+ NestedMessage.getDefaultInstance(), builder.getRepeatedLazyMessage(0));
builder.clearRepeatedLazyMessage();
message = builder.build();
@@ -1190,7 +1297,9 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
assertEquals(0L, message.getRepeatedStringCount());
builder.setRepeatedString(0, "");
- assertEquals(ByteString.copyFromUtf8("hi"), messageAfterBuild.getRepeatedStringBytes(0));
+ assertEquals(
+ ByteString.copyFromUtf8("hi"),
+ messageAfterBuild.getRepeatedStringBytes(0));
assertEquals(ByteString.EMPTY, builder.getRepeatedStringBytes(0));
builder.clearRepeatedString();
@@ -1208,7 +1317,9 @@ public class LiteTest extends TestCase {
messageAfterBuild = builder.build();
assertEquals(0L, message.getRepeatedStringPieceCount());
builder.setRepeatedStringPiece(0, "");
- assertEquals(ByteString.copyFromUtf8("hi"), messageAfterBuild.getRepeatedStringPieceBytes(0));
+ assertEquals(
+ ByteString.copyFromUtf8("hi"),
+ messageAfterBuild.getRepeatedStringPieceBytes(0));
assertEquals(ByteString.EMPTY, builder.getRepeatedStringPieceBytes(0));
builder.clearRepeatedStringPiece();
@@ -1232,14 +1343,18 @@ public class LiteTest extends TestCase {
message = builder.build();
assertEquals(0, message.getSerializedSize());
- builder.mergeFrom(TestAllTypesLite.newBuilder().setOptionalBool(true).build());
+ builder.mergeFrom(TestAllTypesLite.newBuilder()
+ .setOptionalBool(true)
+ .build());
assertEquals(0, message.getSerializedSize());
assertEquals(true, builder.build().getOptionalBool());
builder.clearOptionalBool();
message = builder.build();
assertEquals(0, message.getSerializedSize());
- builder.mergeFrom(TestAllTypesLite.newBuilder().setOptionalBool(true).build());
+ builder.mergeFrom(TestAllTypesLite.newBuilder()
+ .setOptionalBool(true)
+ .build());
assertEquals(0, message.getSerializedSize());
assertEquals(true, builder.build().getOptionalBool());
builder.clear();
@@ -1249,107 +1364,93 @@ public class LiteTest extends TestCase {
assertEquals(0, message.getSerializedSize());
builder.mergeOptionalForeignMessage(foreignMessage);
assertEquals(0, message.getSerializedSize());
- assertEquals(foreignMessage.getC(), builder.build().getOptionalForeignMessage().getC());
+ assertEquals(
+ foreignMessage.getC(),
+ builder.build().getOptionalForeignMessage().getC());
builder.clearOptionalForeignMessage();
message = builder.build();
assertEquals(0, message.getSerializedSize());
builder.mergeOptionalLazyMessage(nestedMessage);
assertEquals(0, message.getSerializedSize());
- assertEquals(nestedMessage.getBb(), builder.build().getOptionalLazyMessage().getBb());
+ assertEquals(
+ nestedMessage.getBb(),
+ builder.build().getOptionalLazyMessage().getBb());
builder.clearOptionalLazyMessage();
-
+
message = builder.build();
builder.setOneofString("hi");
- assertEquals(OneofFieldCase.ONEOFFIELD_NOT_SET, message.getOneofFieldCase());
+ assertEquals(
+ OneofFieldCase.ONEOFFIELD_NOT_SET, message.getOneofFieldCase());
assertEquals(OneofFieldCase.ONEOF_STRING, builder.getOneofFieldCase());
assertEquals("hi", builder.getOneofString());
messageAfterBuild = builder.build();
- assertEquals(OneofFieldCase.ONEOF_STRING, messageAfterBuild.getOneofFieldCase());
+ assertEquals(
+ OneofFieldCase.ONEOF_STRING, messageAfterBuild.getOneofFieldCase());
assertEquals("hi", messageAfterBuild.getOneofString());
builder.setOneofUint32(1);
- assertEquals(OneofFieldCase.ONEOF_STRING, messageAfterBuild.getOneofFieldCase());
+ assertEquals(
+ OneofFieldCase.ONEOF_STRING, messageAfterBuild.getOneofFieldCase());
assertEquals("hi", messageAfterBuild.getOneofString());
assertEquals(OneofFieldCase.ONEOF_UINT32, builder.getOneofFieldCase());
assertEquals(1, builder.getOneofUint32());
TestAllTypesLiteOrBuilder messageOrBuilder = builder;
assertEquals(OneofFieldCase.ONEOF_UINT32, messageOrBuilder.getOneofFieldCase());
-
- TestAllExtensionsLite.Builder extendableMessageBuilder = TestAllExtensionsLite.newBuilder();
+
+ TestAllExtensionsLite.Builder extendableMessageBuilder =
+ TestAllExtensionsLite.newBuilder();
TestAllExtensionsLite extendableMessage = extendableMessageBuilder.build();
- extendableMessageBuilder.setExtension(UnittestLite.optionalInt32ExtensionLite, 1);
- assertFalse(extendableMessage.hasExtension(UnittestLite.optionalInt32ExtensionLite));
+ extendableMessageBuilder.setExtension(
+ UnittestLite.optionalInt32ExtensionLite, 1);
+ assertFalse(extendableMessage.hasExtension(
+ UnittestLite.optionalInt32ExtensionLite));
extendableMessage = extendableMessageBuilder.build();
assertEquals(
- 1, (int) extendableMessageBuilder.getExtension(UnittestLite.optionalInt32ExtensionLite));
- assertEquals(1, (int) extendableMessage.getExtension(UnittestLite.optionalInt32ExtensionLite));
- extendableMessageBuilder.setExtension(UnittestLite.optionalInt32ExtensionLite, 3);
+ 1, (int) extendableMessageBuilder.getExtension(
+ UnittestLite.optionalInt32ExtensionLite));
+ assertEquals(
+ 1, (int) extendableMessage.getExtension(
+ UnittestLite.optionalInt32ExtensionLite));
+ extendableMessageBuilder.setExtension(
+ UnittestLite.optionalInt32ExtensionLite, 3);
assertEquals(
- 3, (int) extendableMessageBuilder.getExtension(UnittestLite.optionalInt32ExtensionLite));
- assertEquals(1, (int) extendableMessage.getExtension(UnittestLite.optionalInt32ExtensionLite));
+ 3, (int) extendableMessageBuilder.getExtension(
+ UnittestLite.optionalInt32ExtensionLite));
+ assertEquals(
+ 1, (int) extendableMessage.getExtension(
+ UnittestLite.optionalInt32ExtensionLite));
extendableMessage = extendableMessageBuilder.build();
assertEquals(
- 3, (int) extendableMessageBuilder.getExtension(UnittestLite.optionalInt32ExtensionLite));
- assertEquals(3, (int) extendableMessage.getExtension(UnittestLite.optionalInt32ExtensionLite));
-
+ 3, (int) extendableMessageBuilder.getExtension(
+ UnittestLite.optionalInt32ExtensionLite));
+ assertEquals(
+ 3, (int) extendableMessage.getExtension(
+ UnittestLite.optionalInt32ExtensionLite));
+
// No extension registry, so it should be in unknown fields.
- extendableMessage = TestAllExtensionsLite.parseFrom(extendableMessage.toByteArray());
- assertFalse(extendableMessage.hasExtension(UnittestLite.optionalInt32ExtensionLite));
-
+ extendableMessage =
+ TestAllExtensionsLite.parseFrom(extendableMessage.toByteArray());
+ assertFalse(extendableMessage.hasExtension(
+ UnittestLite.optionalInt32ExtensionLite));
+
extendableMessageBuilder = extendableMessage.toBuilder();
- extendableMessageBuilder.mergeFrom(
- TestAllExtensionsLite.newBuilder()
- .setExtension(UnittestLite.optionalFixed32ExtensionLite, 11)
- .build());
-
+ extendableMessageBuilder.mergeFrom(TestAllExtensionsLite.newBuilder()
+ .setExtension(UnittestLite.optionalFixed32ExtensionLite, 11)
+ .build());
+
extendableMessage = extendableMessageBuilder.build();
ExtensionRegistryLite registry = ExtensionRegistryLite.newInstance();
UnittestLite.registerAllExtensions(registry);
- extendableMessage = TestAllExtensionsLite.parseFrom(extendableMessage.toByteArray(), registry);
-
+ extendableMessage = TestAllExtensionsLite.parseFrom(
+ extendableMessage.toByteArray(), registry);
+
// The unknown field was preserved.
- assertEquals(3, (int) extendableMessage.getExtension(UnittestLite.optionalInt32ExtensionLite));
assertEquals(
- 11, (int) extendableMessage.getExtension(UnittestLite.optionalFixed32ExtensionLite));
- }
-
- public void testBuilderMergeFromNull() throws Exception {
- try {
- TestAllTypesLite.newBuilder().mergeFrom((TestAllTypesLite) null);
- fail("Expected exception");
- } catch (NullPointerException e) {
- // Pass.
- }
- }
-
- // Builder.mergeFrom() should keep existing extensions.
- public void testBuilderMergeFromWithExtensions() throws Exception {
- TestAllExtensionsLite message =
- TestAllExtensionsLite.newBuilder()
- .addExtension(UnittestLite.repeatedInt32ExtensionLite, 12)
- .build();
-
- ExtensionRegistryLite registry = ExtensionRegistryLite.newInstance();
- UnittestLite.registerAllExtensions(registry);
-
- TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.newBuilder();
- builder.mergeFrom(message.toByteArray(), registry);
- builder.mergeFrom(message.toByteArray(), registry);
- TestAllExtensionsLite result = builder.build();
- assertEquals(2, result.getExtensionCount(UnittestLite.repeatedInt32ExtensionLite));
- assertEquals(12, result.getExtension(UnittestLite.repeatedInt32ExtensionLite, 0).intValue());
- assertEquals(12, result.getExtension(UnittestLite.repeatedInt32ExtensionLite, 1).intValue());
- }
-
- // Builder.mergeFrom() should keep existing unknown fields.
- public void testBuilderMergeFromWithUnknownFields() throws Exception {
- TestAllTypesLite message = TestAllTypesLite.newBuilder().addRepeatedInt32(1).build();
-
- NestedMessage.Builder builder = NestedMessage.newBuilder();
- builder.mergeFrom(message.toByteArray());
- builder.mergeFrom(message.toByteArray());
- NestedMessage result = builder.build();
- assertEquals(message.getSerializedSize() * 2, result.getSerializedSize());
+ 3, (int) extendableMessage.getExtension(
+ UnittestLite.optionalInt32ExtensionLite));
+ assertEquals(
+ 11, (int) extendableMessage.getExtension(
+ UnittestLite.optionalFixed32ExtensionLite));
}
public void testToStringDefaultInstance() throws Exception {
@@ -1357,174 +1458,140 @@ public class LiteTest extends TestCase {
}
public void testToStringScalarFieldsSuffixedWithList() throws Exception {
- assertToStringEquals(
- "deceptively_named_list: 7",
- TestAllTypesLite.newBuilder().setDeceptivelyNamedList(7).build());
+ assertToStringEquals("deceptively_named_list: 7", TestAllTypesLite.newBuilder()
+ .setDeceptivelyNamedList(7)
+ .build());
}
public void testToStringPrimitives() throws Exception {
- TestAllTypesLite proto =
- TestAllTypesLite.newBuilder()
- .setOptionalInt32(1)
- .setOptionalInt64(9223372036854775807L)
- .build();
+ TestAllTypesLite proto = TestAllTypesLite.newBuilder()
+ .setOptionalInt32(1)
+ .setOptionalInt64(9223372036854775807L)
+ .build();
assertToStringEquals("optional_int32: 1\noptional_int64: 9223372036854775807", proto);
- proto =
- TestAllTypesLite.newBuilder()
- .setOptionalBool(true)
- .setOptionalNestedEnum(TestAllTypesLite.NestedEnum.BAZ)
- .build();
+ proto = TestAllTypesLite.newBuilder()
+ .setOptionalBool(true)
+ .setOptionalNestedEnum(TestAllTypesLite.NestedEnum.BAZ)
+ .build();
assertToStringEquals("optional_bool: true\noptional_nested_enum: BAZ", proto);
- proto = TestAllTypesLite.newBuilder().setOptionalFloat(2.72f).setOptionalDouble(3.14).build();
+ proto = TestAllTypesLite.newBuilder()
+ .setOptionalFloat(2.72f)
+ .setOptionalDouble(3.14)
+ .build();
assertToStringEquals("optional_double: 3.14\noptional_float: 2.72", proto);
}
public void testToStringStringFields() throws Exception {
- TestAllTypesLite proto =
- TestAllTypesLite.newBuilder().setOptionalString("foo\"bar\nbaz\\").build();
+ TestAllTypesLite proto = TestAllTypesLite.newBuilder()
+ .setOptionalString("foo\"bar\nbaz\\")
+ .build();
assertToStringEquals("optional_string: \"foo\\\"bar\\nbaz\\\\\"", proto);
- proto = TestAllTypesLite.newBuilder().setOptionalString("\u6587").build();
+ proto = TestAllTypesLite.newBuilder()
+ .setOptionalString("\u6587")
+ .build();
assertToStringEquals("optional_string: \"\\346\\226\\207\"", proto);
}
public void testToStringNestedMessage() throws Exception {
- TestAllTypesLite proto =
- TestAllTypesLite.newBuilder()
- .setOptionalNestedMessage(TestAllTypesLite.NestedMessage.getDefaultInstance())
- .build();
+ TestAllTypesLite proto = TestAllTypesLite.newBuilder()
+ .setOptionalNestedMessage(TestAllTypesLite.NestedMessage.getDefaultInstance())
+ .build();
assertToStringEquals("optional_nested_message {\n}", proto);
- proto =
- TestAllTypesLite.newBuilder()
- .setOptionalNestedMessage(TestAllTypesLite.NestedMessage.newBuilder().setBb(7))
- .build();
+ proto = TestAllTypesLite.newBuilder()
+ .setOptionalNestedMessage(
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(7))
+ .build();
assertToStringEquals("optional_nested_message {\n bb: 7\n}", proto);
}
public void testToStringRepeatedFields() throws Exception {
- TestAllTypesLite proto =
- TestAllTypesLite.newBuilder()
- .addRepeatedInt32(32)
- .addRepeatedInt32(32)
- .addRepeatedInt64(64)
- .build();
+ TestAllTypesLite proto = TestAllTypesLite.newBuilder()
+ .addRepeatedInt32(32)
+ .addRepeatedInt32(32)
+ .addRepeatedInt64(64)
+ .build();
assertToStringEquals("repeated_int32: 32\nrepeated_int32: 32\nrepeated_int64: 64", proto);
- proto =
- TestAllTypesLite.newBuilder()
- .addRepeatedLazyMessage(TestAllTypesLite.NestedMessage.newBuilder().setBb(7))
- .addRepeatedLazyMessage(TestAllTypesLite.NestedMessage.newBuilder().setBb(8))
- .build();
+ proto = TestAllTypesLite.newBuilder()
+ .addRepeatedLazyMessage(
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(7))
+ .addRepeatedLazyMessage(
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(8))
+ .build();
assertToStringEquals(
- "repeated_lazy_message {\n bb: 7\n}\nrepeated_lazy_message {\n bb: 8\n}", proto);
+ "repeated_lazy_message {\n bb: 7\n}\nrepeated_lazy_message {\n bb: 8\n}",
+ proto);
}
public void testToStringForeignFields() throws Exception {
- TestAllTypesLite proto =
- TestAllTypesLite.newBuilder()
- .setOptionalForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR)
- .setOptionalForeignMessage(ForeignMessageLite.newBuilder().setC(3))
- .build();
+ TestAllTypesLite proto = TestAllTypesLite.newBuilder()
+ .setOptionalForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR)
+ .setOptionalForeignMessage(
+ ForeignMessageLite.newBuilder()
+ .setC(3))
+ .build();
assertToStringEquals(
- "optional_foreign_enum: FOREIGN_LITE_BAR\noptional_foreign_message {\n c: 3\n}", proto);
+ "optional_foreign_enum: FOREIGN_LITE_BAR\noptional_foreign_message {\n c: 3\n}",
+ proto);
}
public void testToStringExtensions() throws Exception {
- TestAllExtensionsLite message =
- TestAllExtensionsLite.newBuilder()
- .setExtension(UnittestLite.optionalInt32ExtensionLite, 123)
- .addExtension(UnittestLite.repeatedStringExtensionLite, "spam")
- .addExtension(UnittestLite.repeatedStringExtensionLite, "eggs")
- .setExtension(
- UnittestLite.optionalNestedEnumExtensionLite, TestAllTypesLite.NestedEnum.BAZ)
- .setExtension(
- UnittestLite.optionalNestedMessageExtensionLite,
- TestAllTypesLite.NestedMessage.newBuilder().setBb(7).build())
- .build();
+ TestAllExtensionsLite message = TestAllExtensionsLite.newBuilder()
+ .setExtension(UnittestLite.optionalInt32ExtensionLite, 123)
+ .addExtension(UnittestLite.repeatedStringExtensionLite, "spam")
+ .addExtension(UnittestLite.repeatedStringExtensionLite, "eggs")
+ .setExtension(UnittestLite.optionalNestedEnumExtensionLite,
+ TestAllTypesLite.NestedEnum.BAZ)
+ .setExtension(UnittestLite.optionalNestedMessageExtensionLite,
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(7).build())
+ .build();
assertToStringEquals(
- "[1]: 123\n[18] {\n bb: 7\n}\n[21]: 3\n[44]: \"spam\"\n[44]: \"eggs\"", message);
+ "[1]: 123\n[18] {\n bb: 7\n}\n[21]: 3\n[44]: \"spam\"\n[44]: \"eggs\"",
+ message);
}
public void testToStringUnknownFields() throws Exception {
- TestAllExtensionsLite messageWithExtensions =
- TestAllExtensionsLite.newBuilder()
- .setExtension(UnittestLite.optionalInt32ExtensionLite, 123)
- .addExtension(UnittestLite.repeatedStringExtensionLite, "spam")
- .addExtension(UnittestLite.repeatedStringExtensionLite, "eggs")
- .setExtension(
- UnittestLite.optionalNestedEnumExtensionLite, TestAllTypesLite.NestedEnum.BAZ)
- .setExtension(
- UnittestLite.optionalNestedMessageExtensionLite,
- TestAllTypesLite.NestedMessage.newBuilder().setBb(7).build())
- .build();
- TestAllExtensionsLite messageWithUnknownFields =
- TestAllExtensionsLite.parseFrom(messageWithExtensions.toByteArray());
+ TestAllExtensionsLite messageWithExtensions = TestAllExtensionsLite.newBuilder()
+ .setExtension(UnittestLite.optionalInt32ExtensionLite, 123)
+ .addExtension(UnittestLite.repeatedStringExtensionLite, "spam")
+ .addExtension(UnittestLite.repeatedStringExtensionLite, "eggs")
+ .setExtension(UnittestLite.optionalNestedEnumExtensionLite,
+ TestAllTypesLite.NestedEnum.BAZ)
+ .setExtension(UnittestLite.optionalNestedMessageExtensionLite,
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(7).build())
+ .build();
+ TestAllExtensionsLite messageWithUnknownFields = TestAllExtensionsLite.parseFrom(
+ messageWithExtensions.toByteArray());
assertToStringEquals(
- "1: 123\n18: \"\\b\\a\"\n21: 3\n44: \"spam\"\n44: \"eggs\"", messageWithUnknownFields);
+ "1: 123\n18: \"\\b\\a\"\n21: 3\n44: \"spam\"\n44: \"eggs\"",
+ messageWithUnknownFields);
}
-
+
public void testToStringLazyMessage() throws Exception {
- TestAllTypesLite message =
- TestAllTypesLite.newBuilder()
- .setOptionalLazyMessage(NestedMessage.newBuilder().setBb(1).build())
- .build();
+ TestAllTypesLite message = TestAllTypesLite.newBuilder()
+ .setOptionalLazyMessage(NestedMessage.newBuilder().setBb(1).build())
+ .build();
assertToStringEquals("optional_lazy_message {\n bb: 1\n}", message);
}
-
+
public void testToStringGroup() throws Exception {
- TestAllTypesLite message =
- TestAllTypesLite.newBuilder()
- .setOptionalGroup(OptionalGroup.newBuilder().setA(1).build())
- .build();
+ TestAllTypesLite message = TestAllTypesLite.newBuilder()
+ .setOptionalGroup(OptionalGroup.newBuilder().setA(1).build())
+ .build();
assertToStringEquals("optional_group {\n a: 1\n}", message);
}
-
+
public void testToStringOneof() throws Exception {
- TestAllTypesLite message = TestAllTypesLite.newBuilder().setOneofString("hello").build();
+ TestAllTypesLite message = TestAllTypesLite.newBuilder()
+ .setOneofString("hello")
+ .build();
assertToStringEquals("oneof_string: \"hello\"", message);
}
- public void testToStringMapFields() throws Exception {
- TestMap message1 =
- TestMap.newBuilder()
- .putInt32ToStringField(1, "alpha")
- .putInt32ToStringField(2, "beta")
- .build();
- assertToStringEquals(
- "int32_to_string_field {\n"
- + " key: 1\n"
- + " value: \"alpha\"\n"
- + "}\n"
- + "int32_to_string_field {\n"
- + " key: 2\n"
- + " value: \"beta\"\n"
- + "}",
- message1);
-
- TestMap message2 =
- TestMap.newBuilder()
- .putInt32ToMessageField(1, MessageValue.newBuilder().setValue(10).build())
- .putInt32ToMessageField(2, MessageValue.newBuilder().setValue(20).build())
- .build();
- assertToStringEquals(
- "int32_to_message_field {\n"
- + " key: 1\n"
- + " value {\n"
- + " value: 10\n"
- + " }\n"
- + "}\n"
- + "int32_to_message_field {\n"
- + " key: 2\n"
- + " value {\n"
- + " value: 20\n"
- + " }\n"
- + "}",
- message2);
- }
-
// Asserts that the toString() representation of the message matches the expected. This verifies
// the first line starts with a comment; but, does not factor in said comment as part of the
// comparison as it contains unstable addresses.
@@ -1538,38 +1605,38 @@ public class LiteTest extends TestCase {
}
assertEquals(expected, toString);
}
-
+
public void testParseLazy() throws Exception {
- ByteString bb =
- TestAllTypesLite.newBuilder()
- .setOptionalLazyMessage(NestedMessage.newBuilder().setBb(11).build())
- .build()
- .toByteString();
- ByteString cc =
- TestAllTypesLite.newBuilder()
- .setOptionalLazyMessage(NestedMessage.newBuilder().setCc(22).build())
- .build()
- .toByteString();
-
+ ByteString bb = TestAllTypesLite.newBuilder()
+ .setOptionalLazyMessage(NestedMessage.newBuilder()
+ .setBb(11)
+ .build())
+ .build().toByteString();
+ ByteString cc = TestAllTypesLite.newBuilder()
+ .setOptionalLazyMessage(NestedMessage.newBuilder()
+ .setCc(22)
+ .build())
+ .build().toByteString();
+
ByteString concat = bb.concat(cc);
TestAllTypesLite message = TestAllTypesLite.parseFrom(concat);
assertEquals(11, message.getOptionalLazyMessage().getBb());
assertEquals(22L, message.getOptionalLazyMessage().getCc());
}
-
+
public void testParseLazy_oneOf() throws Exception {
- ByteString bb =
- TestAllTypesLite.newBuilder()
- .setOneofLazyNestedMessage(NestedMessage.newBuilder().setBb(11).build())
- .build()
- .toByteString();
- ByteString cc =
- TestAllTypesLite.newBuilder()
- .setOneofLazyNestedMessage(NestedMessage.newBuilder().setCc(22).build())
- .build()
- .toByteString();
-
+ ByteString bb = TestAllTypesLite.newBuilder()
+ .setOneofLazyNestedMessage(NestedMessage.newBuilder()
+ .setBb(11)
+ .build())
+ .build().toByteString();
+ ByteString cc = TestAllTypesLite.newBuilder()
+ .setOneofLazyNestedMessage(NestedMessage.newBuilder()
+ .setCc(22)
+ .build())
+ .build().toByteString();
+
ByteString concat = bb.concat(cc);
TestAllTypesLite message = TestAllTypesLite.parseFrom(concat);
@@ -1578,26 +1645,27 @@ public class LiteTest extends TestCase {
}
public void testMergeFromStream_repeatedField() throws Exception {
- TestAllTypesLite.Builder builder = TestAllTypesLite.newBuilder().addRepeatedString("hello");
+ TestAllTypesLite.Builder builder = TestAllTypesLite.newBuilder()
+ .addRepeatedString("hello");
builder.mergeFrom(CodedInputStream.newInstance(builder.build().toByteArray()));
assertEquals(2, builder.getRepeatedStringCount());
}
public void testMergeFromStream_invalidBytes() throws Exception {
- TestAllTypesLite.Builder builder = TestAllTypesLite.newBuilder().setDefaultBool(true);
+ TestAllTypesLite.Builder builder = TestAllTypesLite.newBuilder()
+ .setDefaultBool(true);
try {
builder.mergeFrom(CodedInputStream.newInstance("Invalid bytes".getBytes(Internal.UTF_8)));
fail();
- } catch (InvalidProtocolBufferException expected) {
- }
+ } catch (InvalidProtocolBufferException expected) {}
}
public void testMergeFrom_sanity() throws Exception {
TestAllTypesLite one = TestUtilLite.getAllLiteSetBuilder().build();
byte[] bytes = one.toByteArray();
TestAllTypesLite two = TestAllTypesLite.parseFrom(bytes);
-
+
one = one.toBuilder().mergeFrom(one).build();
two = two.toBuilder().mergeFrom(bytes).build();
assertEquals(one, two);
@@ -1606,14 +1674,14 @@ public class LiteTest extends TestCase {
}
public void testMergeFromNoLazyFieldSharing() throws Exception {
- TestAllTypesLite.Builder sourceBuilder =
- TestAllTypesLite.newBuilder()
- .setOptionalLazyMessage(TestAllTypesLite.NestedMessage.newBuilder().setBb(1));
+ TestAllTypesLite.Builder sourceBuilder = TestAllTypesLite.newBuilder().setOptionalLazyMessage(
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(1));
TestAllTypesLite.Builder targetBuilder =
TestAllTypesLite.newBuilder().mergeFrom(sourceBuilder.build());
assertEquals(1, sourceBuilder.getOptionalLazyMessage().getBb());
// now change the sourceBuilder, and target value shouldn't be affected.
- sourceBuilder.setOptionalLazyMessage(TestAllTypesLite.NestedMessage.newBuilder().setBb(2));
+ sourceBuilder.setOptionalLazyMessage(
+ TestAllTypesLite.NestedMessage.newBuilder().setBb(2));
assertEquals(1, targetBuilder.getOptionalLazyMessage().getBb());
}
@@ -1621,373 +1689,508 @@ public class LiteTest extends TestCase {
TestAllTypesLite one = TestUtilLite.getAllLiteSetBuilder().build();
byte[] bytes = one.toByteArray();
TestAllTypesLite two = one.toBuilder().mergeFrom(one).mergeFrom(bytes).build();
-
+
assertFalse(one.equals(two));
assertFalse(two.equals(one));
-
+
assertFalse(one.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(one));
-
- TestAllTypesLite oneFieldSet = TestAllTypesLite.newBuilder().setDefaultBool(true).build();
+
+ TestAllTypesLite oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultBool(true)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultCord("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultCord("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultCordBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultCordBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultDouble(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultDouble(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultFixed32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultFixed32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultFixed64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultFixed64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultFloat(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultFloat(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .setDefaultForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR)
- .build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder().setDefaultImportEnum(ImportEnumLite.IMPORT_LITE_BAR).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultImportEnum(ImportEnumLite.IMPORT_LITE_BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultInt32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultInt32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultInt64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultInt64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultNestedEnum(NestedEnum.BAR).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultNestedEnum(NestedEnum.BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultSfixed32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultSfixed32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultSfixed64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultSfixed64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultSint32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultSint32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultSint64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultSint64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultString("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultString("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultStringBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultStringBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultStringPiece("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultStringPiece("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder().setDefaultStringPieceBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultStringPieceBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultUint32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultUint32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setDefaultUint64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setDefaultUint64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedBool(true).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedBool(true)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedCord("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedCord("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedCordBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedCordBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedDouble(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedDouble(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedFixed32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedFixed32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedFixed64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedFixed64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedFloat(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedFloat(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .addRepeatedForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR)
- .build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder().addRepeatedImportEnum(ImportEnumLite.IMPORT_LITE_BAR).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedImportEnum(ImportEnumLite.IMPORT_LITE_BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedInt32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedInt32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedInt64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedInt64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedNestedEnum(NestedEnum.BAR).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedNestedEnum(NestedEnum.BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedSfixed32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedSfixed32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedSfixed64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedSfixed64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedSint32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedSint32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedSint64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedSint64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedString("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedString("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedStringBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedStringBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedStringPiece("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedStringPiece("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder().addRepeatedStringPieceBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedStringPieceBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedUint32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedUint32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().addRepeatedUint64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedUint64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalBool(true).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalBool(true)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalCord("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalCord("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalCordBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalCordBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalDouble(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalDouble(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalFixed32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalFixed32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalFixed64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalFixed64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalFloat(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalFloat(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .setOptionalForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR)
- .build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder().setOptionalImportEnum(ImportEnumLite.IMPORT_LITE_BAR).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalImportEnum(ImportEnumLite.IMPORT_LITE_BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalInt32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalInt32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalInt64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalInt64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalNestedEnum(NestedEnum.BAR).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalNestedEnum(NestedEnum.BAR)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalSfixed32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalSfixed32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalSfixed64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalSfixed64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalSint32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalSint32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalSint64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalSint64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalString("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalString("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalStringBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalStringBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalStringPiece("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalStringPiece("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder().setOptionalStringPieceBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalStringPieceBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalUint32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalUint32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOptionalUint64(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalUint64(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOneofBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOneofBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .setOneofLazyNestedMessage(NestedMessage.getDefaultInstance())
- .build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOneofLazyNestedMessage(NestedMessage.getDefaultInstance())
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .setOneofNestedMessage(NestedMessage.getDefaultInstance())
- .build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOneofNestedMessage(NestedMessage.getDefaultInstance())
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOneofString("").build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOneofString("")
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOneofStringBytes(ByteString.EMPTY).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOneofStringBytes(ByteString.EMPTY)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
-
- oneFieldSet = TestAllTypesLite.newBuilder().setOneofUint32(0).build();
+
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOneofUint32(0)
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .setOptionalForeignMessage(ForeignMessageLite.getDefaultInstance())
- .build();
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalForeignMessage(ForeignMessageLite.getDefaultInstance())
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
- oneFieldSet =
- TestAllTypesLite.newBuilder().setOptionalGroup(OptionalGroup.getDefaultInstance()).build();
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalGroup(OptionalGroup.getDefaultInstance())
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .setOptionalPublicImportMessage(PublicImportMessageLite.getDefaultInstance())
- .build();
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalPublicImportMessage(PublicImportMessageLite.getDefaultInstance())
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .setOptionalLazyMessage(NestedMessage.getDefaultInstance())
- .build();
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .setOptionalLazyMessage(NestedMessage.getDefaultInstance())
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
-
+
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
- oneFieldSet =
- TestAllTypesLite.newBuilder()
- .addRepeatedLazyMessage(NestedMessage.getDefaultInstance())
- .build();
+ oneFieldSet = TestAllTypesLite.newBuilder()
+ .addRepeatedLazyMessage(NestedMessage.getDefaultInstance())
+ .build();
assertFalse(oneFieldSet.equals(TestAllTypesLite.getDefaultInstance()));
assertFalse(TestAllTypesLite.getDefaultInstance().equals(oneFieldSet));
}
public void testEquals() throws Exception {
// Check that two identical objs are equal.
- Foo foo1a = Foo.newBuilder().setValue(1).addBar(Bar.newBuilder().setName("foo1")).build();
- Foo foo1b = Foo.newBuilder().setValue(1).addBar(Bar.newBuilder().setName("foo1")).build();
- Foo foo2 = Foo.newBuilder().setValue(1).addBar(Bar.newBuilder().setName("foo2")).build();
+ Foo foo1a = Foo.newBuilder()
+ .setValue(1)
+ .addBar(Bar.newBuilder().setName("foo1"))
+ .build();
+ Foo foo1b = Foo.newBuilder()
+ .setValue(1)
+ .addBar(Bar.newBuilder().setName("foo1"))
+ .build();
+ Foo foo2 = Foo.newBuilder()
+ .setValue(1)
+ .addBar(Bar.newBuilder().setName("foo2"))
+ .build();
// Check that equals is doing value rather than object equality.
assertEquals(foo1a, foo1b);
@@ -2004,10 +2207,17 @@ public class LiteTest extends TestCase {
}
public void testEqualsAndHashCodeForTrickySchemaTypes() {
- Foo foo1 = Foo.getDefaultInstance();
- Foo foo2 = Foo.newBuilder().setSint64(1).build();
- Foo foo3 = Foo.newBuilder().putMyMap("key", "value2").build();
- Foo foo4 = Foo.newBuilder().setMyGroup(Foo.MyGroup.newBuilder().setValue(4).build()).build();
+ Foo foo1 = Foo.newBuilder()
+ .build();
+ Foo foo2 = Foo.newBuilder()
+ .setSint64(1)
+ .build();
+ Foo foo3 = Foo.newBuilder()
+ .putMyMap("key", "value2")
+ .build();
+ Foo foo4 = Foo.newBuilder()
+ .setMyGroup(Foo.MyGroup.newBuilder().setValue(4).build())
+ .build();
assertEqualsAndHashCodeAreFalse(foo1, foo2);
assertEqualsAndHashCodeAreFalse(foo1, foo3);
@@ -2023,27 +2233,29 @@ public class LiteTest extends TestCase {
TestOneofEquals message2 = builder.build();
assertFalse(message1.equals(message2));
}
-
+
public void testEquals_sanity() throws Exception {
TestAllTypesLite one = TestUtilLite.getAllLiteSetBuilder().build();
TestAllTypesLite two = TestAllTypesLite.parseFrom(one.toByteArray());
assertEquals(one, two);
assertEquals(one.hashCode(), two.hashCode());
-
+
assertEquals(
one.toBuilder().mergeFrom(two).build(),
two.toBuilder().mergeFrom(two.toByteArray()).build());
}
public void testEqualsAndHashCodeWithUnknownFields() throws InvalidProtocolBufferException {
- Foo fooWithOnlyValue = Foo.newBuilder().setValue(1).build();
+ Foo fooWithOnlyValue = Foo.newBuilder()
+ .setValue(1)
+ .build();
- Foo fooWithValueAndExtension =
- fooWithOnlyValue
- .toBuilder()
- .setValue(1)
- .setExtension(Bar.fooExt, Bar.newBuilder().setName("name").build())
- .build();
+ Foo fooWithValueAndExtension = fooWithOnlyValue.toBuilder()
+ .setValue(1)
+ .setExtension(Bar.fooExt, Bar.newBuilder()
+ .setName("name")
+ .build())
+ .build();
Foo fooWithValueAndUnknownFields = Foo.parseFrom(fooWithValueAndExtension.toByteArray());
@@ -2052,27 +2264,30 @@ public class LiteTest extends TestCase {
}
public void testEqualsAndHashCodeWithExtensions() throws InvalidProtocolBufferException {
- Foo fooWithOnlyValue = Foo.newBuilder().setValue(1).build();
+ Foo fooWithOnlyValue = Foo.newBuilder()
+ .setValue(1)
+ .build();
- Foo fooWithValueAndExtension =
- fooWithOnlyValue
- .toBuilder()
- .setValue(1)
- .setExtension(Bar.fooExt, Bar.newBuilder().setName("name").build())
- .build();
+ Foo fooWithValueAndExtension = fooWithOnlyValue.toBuilder()
+ .setValue(1)
+ .setExtension(Bar.fooExt, Bar.newBuilder()
+ .setName("name")
+ .build())
+ .build();
assertEqualsAndHashCodeAreFalse(fooWithOnlyValue, fooWithValueAndExtension);
}
-
+
// Test to ensure we avoid a class cast exception with oneofs.
public void testEquals_oneOfMessages() {
- TestAllTypesLite mine = TestAllTypesLite.newBuilder().setOneofString("Hello").build();
-
- TestAllTypesLite other =
- TestAllTypesLite.newBuilder()
- .setOneofNestedMessage(NestedMessage.getDefaultInstance())
- .build();
-
+ TestAllTypesLite mine = TestAllTypesLite.newBuilder()
+ .setOneofString("Hello")
+ .build();
+
+ TestAllTypesLite other = TestAllTypesLite.newBuilder()
+ .setOneofNestedMessage(NestedMessage.getDefaultInstance())
+ .build();
+
assertFalse(mine.equals(other));
assertFalse(other.equals(mine));
}
@@ -2122,13 +2337,16 @@ public class LiteTest extends TestCase {
public void testParseFromByteBufferThrows() {
try {
- TestAllTypesLite.parseFrom(ByteBuffer.wrap(new byte[] {0x5}));
+ TestAllTypesLite.parseFrom(ByteBuffer.wrap(new byte[] { 0x5 }));
fail();
} catch (InvalidProtocolBufferException expected) {
}
TestAllTypesLite message =
- TestAllTypesLite.newBuilder().setOptionalInt32(123).addRepeatedString("hello").build();
+ TestAllTypesLite.newBuilder()
+ .setOptionalInt32(123)
+ .addRepeatedString("hello")
+ .build();
ByteBuffer buffer = ByteBuffer.wrap(message.toByteArray(), 0, message.getSerializedSize() - 1);
try {
@@ -2136,7 +2354,9 @@ public class LiteTest extends TestCase {
fail();
} catch (InvalidProtocolBufferException expected) {
assertEquals(
- TestAllTypesLite.newBuilder().setOptionalInt32(123).build(),
+ TestAllTypesLite.newBuilder()
+ .setOptionalInt32(123)
+ .build(),
expected.getUnfinishedMessage());
}
}
@@ -2166,7 +2386,7 @@ public class LiteTest extends TestCase {
ExtensionRegistryLite registry = ExtensionRegistryLite.newInstance();
UnittestLite.registerAllExtensions(registry);
try {
- TestAllExtensionsLite.parseFrom(ByteBuffer.wrap(new byte[] {0x5}), registry);
+ TestAllExtensionsLite.parseFrom(ByteBuffer.wrap(new byte[] { 0x5 }), registry);
fail();
} catch (InvalidProtocolBufferException expected) {
}
@@ -2207,24 +2427,26 @@ public class LiteTest extends TestCase {
}
public void testAddAllIteratesOnce() {
- TestAllTypesLite.newBuilder()
- .addAllRepeatedBool(new OneTimeIterableList(false))
- .addAllRepeatedInt32(new OneTimeIterableList(0))
- .addAllRepeatedInt64(new OneTimeIterableList(0L))
- .addAllRepeatedFloat(new OneTimeIterableList(0f))
- .addAllRepeatedDouble(new OneTimeIterableList(0d))
- .addAllRepeatedBytes(new OneTimeIterableList(ByteString.EMPTY))
- .addAllRepeatedString(new OneTimeIterableList(""))
- .addAllRepeatedNestedMessage(new OneTimeIterableList(NestedMessage.getDefaultInstance()))
- .addAllRepeatedBool(new OneTimeIterable(false))
- .addAllRepeatedInt32(new OneTimeIterable(0))
- .addAllRepeatedInt64(new OneTimeIterable(0L))
- .addAllRepeatedFloat(new OneTimeIterable(0f))
- .addAllRepeatedDouble(new OneTimeIterable(0d))
- .addAllRepeatedBytes(new OneTimeIterable(ByteString.EMPTY))
- .addAllRepeatedString(new OneTimeIterable(""))
- .addAllRepeatedNestedMessage(new OneTimeIterable(NestedMessage.getDefaultInstance()))
- .build();
+ TestAllTypesLite message =
+ TestAllTypesLite.newBuilder()
+ .addAllRepeatedBool(new OneTimeIterableList(false))
+ .addAllRepeatedInt32(new OneTimeIterableList(0))
+ .addAllRepeatedInt64(new OneTimeIterableList(0L))
+ .addAllRepeatedFloat(new OneTimeIterableList(0f))
+ .addAllRepeatedDouble(new OneTimeIterableList(0d))
+ .addAllRepeatedBytes(new OneTimeIterableList(ByteString.EMPTY))
+ .addAllRepeatedString(new OneTimeIterableList(""))
+ .addAllRepeatedNestedMessage(
+ new OneTimeIterableList(NestedMessage.getDefaultInstance()))
+ .addAllRepeatedBool(new OneTimeIterable(false))
+ .addAllRepeatedInt32(new OneTimeIterable(0))
+ .addAllRepeatedInt64(new OneTimeIterable(0L))
+ .addAllRepeatedFloat(new OneTimeIterable(0f))
+ .addAllRepeatedDouble(new OneTimeIterable(0d))
+ .addAllRepeatedBytes(new OneTimeIterable(ByteString.EMPTY))
+ .addAllRepeatedString(new OneTimeIterable(""))
+ .addAllRepeatedNestedMessage(new OneTimeIterable(NestedMessage.getDefaultInstance()))
+ .build();
}
public void testAddAllIteratesOnce_throwsOnNull() {
@@ -2370,12 +2592,4 @@ public class LiteTest extends TestCase {
return list.iterator();
}
}
-
- public void testNullExtensionRegistry() throws Exception {
- try {
- TestAllTypesLite.parseFrom(new byte[] {}, null);
- fail();
- } catch (NullPointerException expected) {
- }
- }
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java
index eac47448e0..eac47448e0 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java
index e50c7d1e95..6bbdfcaa32 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java
@@ -32,7 +32,6 @@ package com.google.protobuf;
import static java.util.Arrays.asList;
-import com.google.protobuf.Internal.LongList;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -298,20 +297,6 @@ public class LongArrayListTest extends TestCase {
}
}
- public void testRemoveEndOfCapacity() {
- LongList toRemove = LongArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addLong(3);
- toRemove.remove(0);
- assertEquals(0, toRemove.size());
- }
-
- public void testSublistRemoveEndOfCapacity() {
- LongList toRemove = LongArrayList.emptyList().mutableCopyWithCapacity(1);
- toRemove.addLong(3);
- toRemove.subList(0, 1).clear();
- assertEquals(0, toRemove.size());
- }
-
private void assertImmutable(LongArrayList list) {
if (list.contains(1L)) {
throw new RuntimeException("Cannot test the immutability of lists that contain 1.");
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java
index da9195f933..da9195f933 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java
index bcfd927c31..37827f768a 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java
@@ -788,24 +788,6 @@ public class MapForProto2Test extends TestCase {
assertEquals(message.hashCode(), dynamicMessage.hashCode());
}
- // Check that DynamicMessage handles map field serialization the same way as generated code
- // regarding unset key and value field in a map entry.
- public void testDynamicMessageUnsetKeyAndValue() throws Exception {
- FieldDescriptor field = f("int32_to_int32_field");
-
- Message dynamicDefaultInstance =
- DynamicMessage.getDefaultInstance(TestMap.getDescriptor());
- Message.Builder builder = dynamicDefaultInstance.newBuilderForType();
- // Add an entry without key and value.
- builder.addRepeatedField(field, builder.newBuilderForField(field).build());
- Message message = builder.build();
- ByteString bytes = message.toByteString();
- // Parse it back to the same generated type.
- Message generatedMessage = TestMap.parseFrom(bytes);
- // Assert the serialized bytes are equivalent.
- assertEquals(generatedMessage.toByteString(), bytes);
- }
-
public void testReflectionEqualsAndHashCode() throws Exception {
// Test that generated equals() and hashCode() will disregard the order
// of map entries when comparing/hashing map fields.
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapTest.java
index 58efce92c0..64ae4435d0 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MapTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MapTest.java
@@ -893,24 +893,6 @@ public class MapTest extends TestCase {
assertEquals(message.hashCode(), dynamicMessage.hashCode());
}
- // Check that DynamicMessage handles map field serialization the same way as generated code
- // regarding unset key and value field in a map entry.
- public void testDynamicMessageUnsetKeyAndValue() throws Exception {
- FieldDescriptor field = f("int32_to_int32_field");
-
- Message dynamicDefaultInstance =
- DynamicMessage.getDefaultInstance(TestMap.getDescriptor());
- Message.Builder builder = dynamicDefaultInstance.newBuilderForType();
- // Add an entry without key and value.
- builder.addRepeatedField(field, builder.newBuilderForField(field).build());
- Message message = builder.build();
- ByteString bytes = message.toByteString();
- // Parse it back to the same generated type.
- Message generatedMessage = TestMap.parseFrom(bytes);
- // Assert the serialized bytes are equivalent.
- assertEquals(generatedMessage.toByteString(), bytes);
- }
-
public void testReflectionEqualsAndHashCode() throws Exception {
// Test that generated equals() and hashCode() will disregard the order
// of map entries when comparing/hashing map fields.
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MessageTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MessageTest.java
index 4fc8f78e03..9d55d0ddce 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/MessageTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/MessageTest.java
@@ -74,14 +74,6 @@ public class MessageTest extends TestCase {
"repeated_string: \"qux\"\n" +
"repeated_string: \"bar\"\n";
- public void testParsingWithNullExtensionRegistry() throws Exception {
- try {
- TestAllTypes.parseFrom(new byte[] {}, null);
- fail();
- } catch (NullPointerException expected) {
- }
- }
-
public void testMergeFrom() throws Exception {
TestAllTypes result =
TestAllTypes.newBuilder(MERGE_DEST)
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java
index 03ed65a550..03ed65a550 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java
index c388bd0561..c388bd0561 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java
index e376b1cd72..e376b1cd72 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ParserTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ParserTest.java
index 1e89111283..4bd34112d6 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ParserTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ParserTest.java
@@ -30,6 +30,9 @@
package com.google.protobuf;
+import com.google.protobuf.UnittestLite.TestAllTypesLite;
+import com.google.protobuf.UnittestLite.TestPackedExtensionsLite;
+import com.google.protobuf.UnittestLite.TestParsingMergeLite;
import protobuf_unittest.UnittestOptimizeFor;
import protobuf_unittest.UnittestOptimizeFor.TestOptimizedForSize;
import protobuf_unittest.UnittestOptimizeFor.TestRequiredOptimizedForSize;
@@ -180,12 +183,22 @@ public class ParserTest extends TestCase {
TestUtil.getExtensionRegistry());
}
+ public void testParseExtensionsLite() throws Exception {
+ assertRoundTripEquals(
+ TestUtilLite.getAllLiteExtensionsSet(), TestUtilLite.getExtensionRegistryLite());
+ }
+
public void testParsePacked() throws Exception {
assertRoundTripEquals(TestUtil.getPackedSet());
assertRoundTripEquals(TestUtil.getPackedExtensionsSet(),
TestUtil.getExtensionRegistry());
}
+ public void testParsePackedLite() throws Exception {
+ assertRoundTripEquals(
+ TestUtilLite.getLitePackedExtensionsSet(), TestUtilLite.getExtensionRegistryLite());
+ }
+
public void testParseDelimitedTo() throws Exception {
// Write normal Message.
TestAllTypes normalMessage = TestUtil.getAllSet();
@@ -198,6 +211,26 @@ public class ParserTest extends TestCase {
assertMessageEquals(normalMessage, normalMessage.getParserForType().parseDelimitedFrom(input));
}
+ public void testParseDelimitedToLite() throws Exception {
+ // Write MessageLite with packed extension fields.
+ TestPackedExtensionsLite packedMessage = TestUtilLite.getLitePackedExtensionsSet();
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ packedMessage.writeDelimitedTo(output);
+ packedMessage.writeDelimitedTo(output);
+
+ InputStream input = new ByteArrayInputStream(output.toByteArray());
+ assertMessageEquals(
+ packedMessage,
+ packedMessage
+ .getParserForType()
+ .parseDelimitedFrom(input, TestUtilLite.getExtensionRegistryLite()));
+ assertMessageEquals(
+ packedMessage,
+ packedMessage
+ .getParserForType()
+ .parseDelimitedFrom(input, TestUtilLite.getExtensionRegistryLite()));
+ }
+
public void testParseUnknownFields() throws Exception {
// All fields will be treated as unknown fields in emptyMessage.
TestEmptyMessage emptyMessage =
@@ -230,6 +263,14 @@ public class ParserTest extends TestCase {
assertEquals("hello", allTypes.getOptionalString());
}
+ /** Helper method for {@link #testParsingMergeLite()}.*/
+ private void assertMessageMerged(TestAllTypesLite allTypes)
+ throws Exception {
+ assertEquals(3, allTypes.getOptionalInt32());
+ assertEquals(2, allTypes.getOptionalInt64());
+ assertEquals("hello", allTypes.getOptionalString());
+ }
+
public void testParsingMerge() throws Exception {
// Build messages.
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
@@ -291,6 +332,67 @@ public class ParserTest extends TestCase {
TestParsingMerge.repeatedExt));
}
+ public void testParsingMergeLite() throws Exception {
+ // Build messages.
+ TestAllTypesLite.Builder builder = TestAllTypesLite.newBuilder();
+ TestAllTypesLite msg1 = builder.setOptionalInt32(1).build();
+ builder.clear();
+ TestAllTypesLite msg2 = builder.setOptionalInt64(2).build();
+ builder.clear();
+ TestAllTypesLite msg3 = builder.setOptionalInt32(3)
+ .setOptionalString("hello").build();
+
+ // Build groups.
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group1 optionalG1 =
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group1.newBuilder()
+ .setField1(msg1).build();
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group1 optionalG2 =
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group1.newBuilder()
+ .setField1(msg2).build();
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group1 optionalG3 =
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group1.newBuilder()
+ .setField1(msg3).build();
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group2 repeatedG1 =
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group2.newBuilder()
+ .setField1(msg1).build();
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group2 repeatedG2 =
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group2.newBuilder()
+ .setField1(msg2).build();
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group2 repeatedG3 =
+ TestParsingMergeLite.RepeatedFieldsGenerator.Group2.newBuilder()
+ .setField1(msg3).build();
+
+ // Assign and serialize RepeatedFieldsGenerator.
+ ByteString data = TestParsingMergeLite.RepeatedFieldsGenerator.newBuilder()
+ .addField1(msg1).addField1(msg2).addField1(msg3)
+ .addField2(msg1).addField2(msg2).addField2(msg3)
+ .addField3(msg1).addField3(msg2).addField3(msg3)
+ .addGroup1(optionalG1).addGroup1(optionalG2).addGroup1(optionalG3)
+ .addGroup2(repeatedG1).addGroup2(repeatedG2).addGroup2(repeatedG3)
+ .addExt1(msg1).addExt1(msg2).addExt1(msg3)
+ .addExt2(msg1).addExt2(msg2).addExt2(msg3)
+ .build().toByteString();
+
+ // Parse TestParsingMergeLite.
+ ExtensionRegistry registry = ExtensionRegistry.newInstance();
+ UnittestLite.registerAllExtensions(registry);
+ TestParsingMergeLite parsingMerge = TestParsingMergeLite.parser().parseFrom(data, registry);
+
+ // Required and optional fields should be merged.
+ assertMessageMerged(parsingMerge.getRequiredAllTypes());
+ assertMessageMerged(parsingMerge.getOptionalAllTypes());
+ assertMessageMerged(
+ parsingMerge.getOptionalGroup().getOptionalGroupAllTypes());
+ assertMessageMerged(parsingMerge.getExtension(
+ TestParsingMergeLite.optionalExt));
+
+ // Repeated fields should not be merged.
+ assertEquals(3, parsingMerge.getRepeatedAllTypesCount());
+ assertEquals(3, parsingMerge.getRepeatedGroupCount());
+ assertEquals(3, parsingMerge.getExtensionCount(
+ TestParsingMergeLite.repeatedExt));
+ }
+
public void testParseDelimitedFrom_firstByteInterrupted_preservesCause() {
try {
TestUtil.getAllSet().parseDelimitedFrom(
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java
index af717bfd20..af717bfd20 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
index edbd0afd75..edbd0afd75 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java
index dc56f2e9ac..dc56f2e9ac 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java
index 4ec3a40988..4ec3a40988 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ServiceTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ServiceTest.java
index b895ad8d36..b895ad8d36 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/ServiceTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/ServiceTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java
index e3a8d4f408..e3a8d4f408 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java
index a7f8342d13..a7f8342d13 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java
index 4af5542912..4af5542912 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiersLite.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiersLite.java
index 37f94c03bc..37f94c03bc 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiersLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestBadIdentifiersLite.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestUtil.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestUtil.java
index b4bc3a3d51..e96adf0763 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestUtil.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestUtil.java
@@ -231,7 +231,6 @@ 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;
@@ -253,11 +252,6 @@ 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/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestUtilLite.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestUtilLite.java
index 8f33fa14ab..8f33fa14ab 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TestUtilLite.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TestUtilLite.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java
index e338af2112..e338af2112 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java
index c42bfa6e71..c42bfa6e71 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
index 720061d257..910f360f09 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
@@ -30,9 +30,6 @@
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;
@@ -45,7 +42,6 @@ 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;
@@ -61,11 +57,12 @@ import junit.framework.TestCase;
public class TextFormatTest extends TestCase {
// A basic string with different escapable characters for testing.
- private static final String ESCAPE_TEST_STRING =
- "\"A string with ' characters \n and \r newlines and \t tabs and \001 " + "slashes \\";
+ private final static String kEscapeTestString =
+ "\"A string with ' characters \n and \r newlines and \t tabs and \001 "
+ + "slashes \\";
// A representation of the above string with all the characters escaped.
- private static final String ESCAPE_TEST_STRING_ESCAPED =
+ private final static String kEscapeTestStringEscaped =
"\\\"A string with \\' characters \\n and \\r newlines "
+ "and \\t tabs and \\001 slashes \\\\";
@@ -171,7 +168,6 @@ public class TextFormatTest extends TestCase {
// Creates an example unknown field set.
private UnknownFieldSet makeUnknownFieldSet() {
-
return UnknownFieldSet.newBuilder()
.addField(5,
UnknownFieldSet.Field.newBuilder()
@@ -179,12 +175,6 @@ public class TextFormatTest extends TestCase {
.addFixed32(2)
.addFixed64(3)
.addLengthDelimited(ByteString.copyFromUtf8("4"))
- .addLengthDelimited(UnknownFieldSet.newBuilder()
- .addField(12,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(6)
- .build())
- .build().toByteString())
.addGroup(
UnknownFieldSet.newBuilder()
.addField(10,
@@ -217,23 +207,20 @@ public class TextFormatTest extends TestCase {
.build();
assertEquals(
- "5: 1\n"
- + "5: 0x00000002\n"
- + "5: 0x0000000000000003\n"
- + "5: \"4\"\n"
- + "5: {\n"
- + " 12: 6\n"
- + "}\n"
- + "5 {\n"
- + " 10: 5\n"
- + "}\n"
- + "8: 1\n"
- + "8: 2\n"
- + "8: 3\n"
- + "15: 12379813812177893520\n"
- + "15: 0xabcd1234\n"
- + "15: 0xabcdef1234567890\n",
- TextFormat.printToString(message));
+ "5: 1\n" +
+ "5: 0x00000002\n" +
+ "5: 0x0000000000000003\n" +
+ "5: \"4\"\n" +
+ "5 {\n" +
+ " 10: 5\n" +
+ "}\n" +
+ "8: 1\n" +
+ "8: 2\n" +
+ "8: 3\n" +
+ "15: 12379813812177893520\n" +
+ "15: 0xabcd1234\n" +
+ "15: 0xabcdef1234567890\n",
+ TextFormat.printToString(message));
}
public void testPrintField() throws Exception {
@@ -329,58 +316,19 @@ public class TextFormatTest extends TestCase {
// =================================================================
- public void testMerge() throws Exception {
+ public void testParse() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge(allFieldsSetText, builder);
TestUtil.assertAllFieldsSet(builder.build());
}
- 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 {
+ public void testParseReader() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge(new StringReader(allFieldsSetText), builder);
TestUtil.assertAllFieldsSet(builder.build());
}
- public void testMergeExtensions() throws Exception {
+ public void testParseExtensions() throws Exception {
TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
TextFormat.merge(allExtensionsSetText,
TestUtil.getExtensionRegistry(),
@@ -388,14 +336,7 @@ public class TextFormatTest extends TestCase {
TestUtil.assertAllExtensionsSet(builder.build());
}
- public void testParseExtensions() throws Exception {
- TestUtil.assertAllExtensionsSet(
- TextFormat.parse(allExtensionsSetText,
- TestUtil.getExtensionRegistry(),
- TestAllExtensions.class));
- }
-
- public void testMergeAndParseCompatibility() throws Exception {
+ public void testParseCompatibility() throws Exception {
String original = "repeated_float: inf\n" +
"repeated_float: -inf\n" +
"repeated_float: nan\n" +
@@ -420,29 +361,21 @@ 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 testMergeAndParseExotic() throws Exception {
+ public void testParseExotic() 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 testMergeMessageSet() throws Exception {
+ public void testParseMessageSet() throws Exception {
ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
extensionRegistry.add(TestMessageSetExtension1.messageSetExtension);
extensionRegistry.add(TestMessageSetExtension2.messageSetExtension);
@@ -468,7 +401,7 @@ public class TextFormatTest extends TestCase {
TestMessageSetExtension1.messageSetExtension).getI());
}
- public void testMergeMessageSetWithOverwriteForbidden() throws Exception {
+ public void testParseMessageSetWithOverwriteForbidden() throws Exception {
ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
extensionRegistry.add(TestMessageSetExtension1.messageSetExtension);
extensionRegistry.add(TestMessageSetExtension2.messageSetExtension);
@@ -495,20 +428,20 @@ public class TextFormatTest extends TestCase {
}
}
- public void testMergeNumericEnum() throws Exception {
+ public void testParseNumericEnum() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge("optional_nested_enum: 2", builder);
assertEquals(TestAllTypes.NestedEnum.BAR, builder.getOptionalNestedEnum());
}
- public void testMergeAngleBrackets() throws Exception {
+ public void testParseAngleBrackets() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge("OptionalGroup: < a: 1 >", builder);
assertTrue(builder.hasOptionalGroup());
assertEquals(1, builder.getOptionalGroup().getA());
}
- public void testMergeComment() throws Exception {
+ public void testParseComment() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge(
"# this is a comment\n" +
@@ -520,7 +453,6 @@ 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);
@@ -528,15 +460,6 @@ 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());
- }
}
@@ -575,10 +498,10 @@ public class TextFormatTest extends TestCase {
"integer: 82301481290849012385230157",
"optional_int32: 82301481290849012385230157");
assertParseError(
- "1:16: Expected \"true\" or \"false\". Found \"maybe\".",
+ "1:16: Expected \"true\" or \"false\".",
"optional_bool: maybe");
assertParseError(
- "1:16: Expected \"true\" or \"false\". Found \"2\".",
+ "1:16: Expected \"true\" or \"false\".",
"optional_bool: 2");
assertParseError(
"1:18: Expected string.",
@@ -642,8 +565,10 @@ public class TextFormatTest extends TestCase {
TextFormat.unescapeBytes("\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\""));
assertEquals("\0\001\007\b\f\n\r\t\013\\\'\"",
TextFormat.unescapeText("\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\""));
- assertEquals(ESCAPE_TEST_STRING_ESCAPED, TextFormat.escapeText(ESCAPE_TEST_STRING));
- assertEquals(ESCAPE_TEST_STRING, TextFormat.unescapeText(ESCAPE_TEST_STRING_ESCAPED));
+ assertEquals(kEscapeTestStringEscaped,
+ TextFormat.escapeText(kEscapeTestString));
+ assertEquals(kEscapeTestString,
+ TextFormat.unescapeText(kEscapeTestStringEscaped));
// Invariant
assertEquals("hello",
@@ -936,7 +861,7 @@ public class TextFormatTest extends TestCase {
}
public void testShortDebugString_unknown() {
- assertEquals("5: 1 5: 0x00000002 5: 0x0000000000000003 5: \"4\" 5: { 12: 6 } 5 { 10: 5 }"
+ assertEquals("5: 1 5: 0x00000002 5: 0x0000000000000003 5: \"4\" 5 { 10: 5 }"
+ " 8: 1 8: 2 8: 3 15: 12379813812177893520 15: 0xabcd1234 15:"
+ " 0xabcdef1234567890",
TextFormat.shortDebugString(makeUnknownFieldSet()));
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java
index 88cbbf862c..88cbbf862c 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java
index 8ce0ca7362..f8cb0aabbc 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java
@@ -30,24 +30,13 @@
package com.google.protobuf;
-import static junit.framework.TestCase.assertEquals;
-
import com.google.protobuf.UnittestLite.TestAllExtensionsLite;
import com.google.protobuf.UnittestLite.TestAllTypesLite;
-import protobuf_unittest.UnittestProto;
-import protobuf_unittest.UnittestProto.ForeignEnum;
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestEmptyMessage;
-import protobuf_unittest.UnittestProto.TestPackedExtensions;
-import protobuf_unittest.UnittestProto.TestPackedTypes;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.util.Arrays;
-import java.util.Map;
import junit.framework.TestCase;
/**
@@ -56,44 +45,7 @@ import junit.framework.TestCase;
* @author dweis@google.com (Daniel Weis)
*/
public class UnknownFieldSetLiteTest extends TestCase {
- @Override
- public void setUp() throws Exception {
- allFields = TestUtil.getAllSet();
- allFieldsData = allFields.toByteString();
- emptyMessage = TestEmptyMessage.parseFrom(allFieldsData);
- unknownFields = emptyMessage.getUnknownFields();
- }
-
- TestAllTypes allFields;
- ByteString allFieldsData;
-
- // Constructs a protocol buffer which contains fields with all the same
- // numbers as allFieldsData except that each field is some other wire
- // type.
- private ByteString getBizarroData() throws Exception {
- UnknownFieldSet.Builder bizarroFields = UnknownFieldSet.newBuilder();
-
- UnknownFieldSet.Field varintField = UnknownFieldSet.Field.newBuilder().addVarint(1).build();
- UnknownFieldSet.Field fixed32Field = UnknownFieldSet.Field.newBuilder().addFixed32(1).build();
-
- for (Map.Entry<Integer, UnknownFieldSet.Field> entry : unknownFields.asMap().entrySet()) {
- if (entry.getValue().getVarintList().isEmpty()) {
- // Original field is not a varint, so use a varint.
- bizarroFields.addField(entry.getKey(), varintField);
- } else {
- // Original field *is* a varint, so use something else.
- bizarroFields.addField(entry.getKey(), fixed32Field);
- }
- }
-
- return bizarroFields.build().toByteString();
- }
-
- // An empty message that has been parsed from allFieldsData. So, it has
- // unknown fields of every type.
- TestEmptyMessage emptyMessage;
- UnknownFieldSet unknownFields;
-
+
public void testDefaultInstance() {
UnknownFieldSetLite unknownFields = UnknownFieldSetLite.getDefaultInstance();
@@ -135,25 +87,6 @@ public class UnknownFieldSetLiteTest extends TestCase {
assertEquals(foo.toByteString().size(), instance.getSerializedSize());
}
- public void testHashCodeAfterDeserialization() throws IOException {
- Foo foo = Foo.newBuilder()
- .setValue(2)
- .build();
-
- Foo fooDeserialized = Foo.parseFrom(foo.toByteArray());
-
- assertEquals(fooDeserialized, foo);
- assertEquals(foo.hashCode(), fooDeserialized.hashCode());
- }
-
- public void testNewInstanceHashCode() {
- UnknownFieldSetLite emptyFieldSet = UnknownFieldSetLite.getDefaultInstance();
- UnknownFieldSetLite paddedFieldSet = UnknownFieldSetLite.newInstance();
-
- assertEquals(emptyFieldSet, paddedFieldSet);
- assertEquals(emptyFieldSet.hashCode(), paddedFieldSet.hashCode());
- }
-
public void testMergeVarintField() throws IOException {
UnknownFieldSetLite unknownFields = UnknownFieldSetLite.newInstance();
unknownFields.mergeVarintField(10, 2);
@@ -398,203 +331,4 @@ public class UnknownFieldSetLiteTest extends TestCase {
}
return ByteString.copyFrom(byteArrayOutputStream.toByteArray());
}
-
- public void testSerializeLite() throws Exception {
- UnittestLite.TestEmptyMessageLite emptyMessageLite =
- UnittestLite.TestEmptyMessageLite.parseFrom(allFieldsData);
- assertEquals(allFieldsData.size(), emptyMessageLite.getSerializedSize());
- ByteString data = emptyMessageLite.toByteString();
- TestAllTypes message = TestAllTypes.parseFrom(data);
- TestUtil.assertAllFieldsSet(message);
- assertEquals(allFieldsData, data);
- }
-
- public void testAllExtensionsLite() throws Exception {
- TestAllExtensions allExtensions = TestUtil.getAllExtensionsSet();
- ByteString allExtensionsData = allExtensions.toByteString();
- UnittestLite.TestEmptyMessageLite emptyMessageLite =
- UnittestLite.TestEmptyMessageLite.parser().parseFrom(allExtensionsData);
- ByteString data = emptyMessageLite.toByteString();
- TestAllExtensions message = TestAllExtensions.parseFrom(data, TestUtil.getExtensionRegistry());
- TestUtil.assertAllExtensionsSet(message);
- assertEquals(allExtensionsData, data);
- }
-
- public void testAllPackedFieldsLite() throws Exception {
- TestPackedTypes allPackedFields = TestUtil.getPackedSet();
- ByteString allPackedData = allPackedFields.toByteString();
- UnittestLite.TestEmptyMessageLite emptyMessageLite =
- UnittestLite.TestEmptyMessageLite.parseFrom(allPackedData);
- ByteString data = emptyMessageLite.toByteString();
- TestPackedTypes message = TestPackedTypes.parseFrom(data, TestUtil.getExtensionRegistry());
- TestUtil.assertPackedFieldsSet(message);
- assertEquals(allPackedData, data);
- }
-
- public void testAllPackedExtensionsLite() throws Exception {
- TestPackedExtensions allPackedExtensions = TestUtil.getPackedExtensionsSet();
- ByteString allPackedExtensionsData = allPackedExtensions.toByteString();
- UnittestLite.TestEmptyMessageLite emptyMessageLite =
- UnittestLite.TestEmptyMessageLite.parseFrom(allPackedExtensionsData);
- ByteString data = emptyMessageLite.toByteString();
- TestPackedExtensions message =
- TestPackedExtensions.parseFrom(data, TestUtil.getExtensionRegistry());
- TestUtil.assertPackedExtensionsSet(message);
- assertEquals(allPackedExtensionsData, data);
- }
-
- public void testCopyFromLite() throws Exception {
- UnittestLite.TestEmptyMessageLite emptyMessageLite =
- UnittestLite.TestEmptyMessageLite.parseFrom(allFieldsData);
- UnittestLite.TestEmptyMessageLite emptyMessageLite2 =
- UnittestLite.TestEmptyMessageLite.newBuilder().mergeFrom(emptyMessageLite).build();
- assertEquals(emptyMessageLite.toByteString(), emptyMessageLite2.toByteString());
- }
-
- public void testMergeFromLite() throws Exception {
- TestAllTypes message1 =
- TestAllTypes.newBuilder()
- .setOptionalInt32(1)
- .setOptionalString("foo")
- .addRepeatedString("bar")
- .setOptionalNestedEnum(TestAllTypes.NestedEnum.BAZ)
- .build();
-
- TestAllTypes message2 =
- TestAllTypes.newBuilder()
- .setOptionalInt64(2)
- .setOptionalString("baz")
- .addRepeatedString("qux")
- .setOptionalForeignEnum(ForeignEnum.FOREIGN_BAZ)
- .build();
-
- ByteString data1 = message1.toByteString();
- UnittestLite.TestEmptyMessageLite emptyMessageLite1 =
- UnittestLite.TestEmptyMessageLite.parseFrom(data1);
- ByteString data2 = message2.toByteString();
- UnittestLite.TestEmptyMessageLite emptyMessageLite2 =
- UnittestLite.TestEmptyMessageLite.parseFrom(data2);
-
- message1 = TestAllTypes.newBuilder(message1).mergeFrom(message2).build();
- emptyMessageLite1 =
- UnittestLite.TestEmptyMessageLite.newBuilder(emptyMessageLite1)
- .mergeFrom(emptyMessageLite2)
- .build();
-
- data1 = emptyMessageLite1.toByteString();
- message2 = TestAllTypes.parseFrom(data1);
-
- assertEquals(message1, message2);
- }
-
- public void testWrongTypeTreatedAsUnknownLite() throws Exception {
- // Test that fields of the wrong wire type are treated like unknown fields
- // when parsing.
-
- ByteString bizarroData = getBizarroData();
- TestAllTypes allTypesMessage = TestAllTypes.parseFrom(bizarroData);
- UnittestLite.TestEmptyMessageLite emptyMessageLite =
- UnittestLite.TestEmptyMessageLite.parseFrom(bizarroData);
- ByteString data = emptyMessageLite.toByteString();
- TestAllTypes allTypesMessage2 = TestAllTypes.parseFrom(data);
-
- assertEquals(allTypesMessage.toString(), allTypesMessage2.toString());
- }
-
- public void testUnknownExtensionsLite() throws Exception {
- // Make sure fields are properly parsed to the UnknownFieldSet even when
- // they are declared as extension numbers.
-
- UnittestLite.TestEmptyMessageWithExtensionsLite message =
- UnittestLite.TestEmptyMessageWithExtensionsLite.parseFrom(allFieldsData);
-
- assertEquals(allFieldsData, message.toByteString());
- }
-
- public void testWrongExtensionTypeTreatedAsUnknownLite() throws Exception {
- // Test that fields of the wrong wire type are treated like unknown fields
- // when parsing extensions.
-
- ByteString bizarroData = getBizarroData();
- TestAllExtensions allExtensionsMessage = TestAllExtensions.parseFrom(bizarroData);
- UnittestLite.TestEmptyMessageLite emptyMessageLite =
- UnittestLite.TestEmptyMessageLite.parseFrom(bizarroData);
-
- // All fields should have been interpreted as unknown, so the byte strings
- // should be the same.
- assertEquals(emptyMessageLite.toByteString(), allExtensionsMessage.toByteString());
- }
-
- public void testParseUnknownEnumValueLite() throws Exception {
- Descriptors.FieldDescriptor singularField =
- TestAllTypes.getDescriptor().findFieldByName("optional_nested_enum");
- Descriptors.FieldDescriptor repeatedField =
- TestAllTypes.getDescriptor().findFieldByName("repeated_nested_enum");
- assertNotNull(singularField);
- assertNotNull(repeatedField);
-
- ByteString data =
- UnknownFieldSet.newBuilder()
- .addField(
- singularField.getNumber(),
- UnknownFieldSet.Field.newBuilder()
- .addVarint(TestAllTypes.NestedEnum.BAR.getNumber())
- .addVarint(5) // not valid
- .build())
- .addField(
- repeatedField.getNumber(),
- UnknownFieldSet.Field.newBuilder()
- .addVarint(TestAllTypes.NestedEnum.FOO.getNumber())
- .addVarint(4) // not valid
- .addVarint(TestAllTypes.NestedEnum.BAZ.getNumber())
- .addVarint(6) // not valid
- .build())
- .build()
- .toByteString();
-
- UnittestLite.TestEmptyMessageLite emptyMessageLite =
- UnittestLite.TestEmptyMessageLite.parseFrom(data);
- data = emptyMessageLite.toByteString();
-
- {
- TestAllTypes message = TestAllTypes.parseFrom(data);
- assertEquals(TestAllTypes.NestedEnum.BAR, message.getOptionalNestedEnum());
- assertEquals(
- Arrays.asList(TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAZ),
- message.getRepeatedNestedEnumList());
- assertEquals(
- Arrays.asList(5L),
- message.getUnknownFields().getField(singularField.getNumber()).getVarintList());
- assertEquals(
- Arrays.asList(4L, 6L),
- message.getUnknownFields().getField(repeatedField.getNumber()).getVarintList());
- }
-
- {
- TestAllExtensions message =
- TestAllExtensions.parseFrom(data, TestUtil.getExtensionRegistry());
- assertEquals(
- TestAllTypes.NestedEnum.BAR,
- message.getExtension(UnittestProto.optionalNestedEnumExtension));
- assertEquals(
- Arrays.asList(TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAZ),
- message.getExtension(UnittestProto.repeatedNestedEnumExtension));
- assertEquals(
- Arrays.asList(5L),
- message.getUnknownFields().getField(singularField.getNumber()).getVarintList());
- assertEquals(
- Arrays.asList(4L, 6L),
- message.getUnknownFields().getField(repeatedField.getNumber()).getVarintList());
- }
- }
-
- public void testClearLite() throws Exception {
- UnittestLite.TestEmptyMessageLite emptyMessageLite1 =
- UnittestLite.TestEmptyMessageLite.parseFrom(allFieldsData);
- UnittestLite.TestEmptyMessageLite emptyMessageLite2 =
- UnittestLite.TestEmptyMessageLite.newBuilder().mergeFrom(emptyMessageLite1).clear().build();
- assertEquals(0, emptyMessageLite2.getSerializedSize());
- ByteString data = emptyMessageLite2.toByteString();
- assertEquals(0, data.size());
- }
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java
index 1a84806a46..f81e90b459 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java
@@ -445,4 +445,208 @@ public class UnknownFieldSetTest extends TestCase {
}
// =================================================================
+
+ public void testSerializeLite() throws Exception {
+ UnittestLite.TestEmptyMessageLite emptyMessageLite =
+ UnittestLite.TestEmptyMessageLite.parseFrom(allFieldsData);
+ assertEquals(allFieldsData.size(), emptyMessageLite.getSerializedSize());
+ ByteString data = emptyMessageLite.toByteString();
+ TestAllTypes message = TestAllTypes.parseFrom(data);
+ TestUtil.assertAllFieldsSet(message);
+ assertEquals(allFieldsData, data);
+ }
+
+ public void testAllExtensionsLite() throws Exception {
+ TestAllExtensions allExtensions = TestUtil.getAllExtensionsSet();
+ ByteString allExtensionsData = allExtensions.toByteString();
+ UnittestLite.TestEmptyMessageLite emptyMessageLite =
+ UnittestLite.TestEmptyMessageLite.parser().parseFrom(allExtensionsData);
+ ByteString data = emptyMessageLite.toByteString();
+ TestAllExtensions message =
+ TestAllExtensions.parseFrom(data, TestUtil.getExtensionRegistry());
+ TestUtil.assertAllExtensionsSet(message);
+ assertEquals(allExtensionsData, data);
+ }
+
+ public void testAllPackedFieldsLite() throws Exception {
+ TestPackedTypes allPackedFields = TestUtil.getPackedSet();
+ ByteString allPackedData = allPackedFields.toByteString();
+ UnittestLite.TestEmptyMessageLite emptyMessageLite =
+ UnittestLite.TestEmptyMessageLite.parseFrom(allPackedData);
+ ByteString data = emptyMessageLite.toByteString();
+ TestPackedTypes message =
+ TestPackedTypes.parseFrom(data, TestUtil.getExtensionRegistry());
+ TestUtil.assertPackedFieldsSet(message);
+ assertEquals(allPackedData, data);
+ }
+
+ public void testAllPackedExtensionsLite() throws Exception {
+ TestPackedExtensions allPackedExtensions = TestUtil.getPackedExtensionsSet();
+ ByteString allPackedExtensionsData = allPackedExtensions.toByteString();
+ UnittestLite.TestEmptyMessageLite emptyMessageLite =
+ UnittestLite.TestEmptyMessageLite.parseFrom(allPackedExtensionsData);
+ ByteString data = emptyMessageLite.toByteString();
+ TestPackedExtensions message =
+ TestPackedExtensions.parseFrom(data, TestUtil.getExtensionRegistry());
+ TestUtil.assertPackedExtensionsSet(message);
+ assertEquals(allPackedExtensionsData, data);
+ }
+
+ public void testCopyFromLite() throws Exception {
+ UnittestLite.TestEmptyMessageLite emptyMessageLite =
+ UnittestLite.TestEmptyMessageLite.parseFrom(allFieldsData);
+ UnittestLite.TestEmptyMessageLite emptyMessageLite2 =
+ UnittestLite.TestEmptyMessageLite.newBuilder()
+ .mergeFrom(emptyMessageLite).build();
+ assertEquals(emptyMessageLite.toByteString(), emptyMessageLite2.toByteString());
+ }
+
+ public void testMergeFromLite() throws Exception {
+ TestAllTypes message1 = TestAllTypes.newBuilder()
+ .setOptionalInt32(1)
+ .setOptionalString("foo")
+ .addRepeatedString("bar")
+ .setOptionalNestedEnum(TestAllTypes.NestedEnum.BAZ)
+ .build();
+
+ TestAllTypes message2 = TestAllTypes.newBuilder()
+ .setOptionalInt64(2)
+ .setOptionalString("baz")
+ .addRepeatedString("qux")
+ .setOptionalForeignEnum(ForeignEnum.FOREIGN_BAZ)
+ .build();
+
+ ByteString data1 = message1.toByteString();
+ UnittestLite.TestEmptyMessageLite emptyMessageLite1 =
+ UnittestLite.TestEmptyMessageLite.parseFrom(data1);
+ ByteString data2 = message2.toByteString();
+ UnittestLite.TestEmptyMessageLite emptyMessageLite2 =
+ UnittestLite.TestEmptyMessageLite.parseFrom(data2);
+
+ message1 = TestAllTypes.newBuilder(message1).mergeFrom(message2).build();
+ emptyMessageLite1 = UnittestLite.TestEmptyMessageLite.newBuilder(emptyMessageLite1)
+ .mergeFrom(emptyMessageLite2).build();
+
+ data1 = emptyMessageLite1.toByteString();
+ message2 = TestAllTypes.parseFrom(data1);
+
+ assertEquals(message1, message2);
+ }
+
+ public void testWrongTypeTreatedAsUnknownLite() throws Exception {
+ // Test that fields of the wrong wire type are treated like unknown fields
+ // when parsing.
+
+ ByteString bizarroData = getBizarroData();
+ TestAllTypes allTypesMessage = TestAllTypes.parseFrom(bizarroData);
+ UnittestLite.TestEmptyMessageLite emptyMessageLite =
+ UnittestLite.TestEmptyMessageLite.parseFrom(bizarroData);
+ ByteString data = emptyMessageLite.toByteString();
+ TestAllTypes allTypesMessage2 = TestAllTypes.parseFrom(data);
+
+ assertEquals(allTypesMessage.toString(), allTypesMessage2.toString());
+ }
+
+ public void testUnknownExtensionsLite() throws Exception {
+ // Make sure fields are properly parsed to the UnknownFieldSet even when
+ // they are declared as extension numbers.
+
+ UnittestLite.TestEmptyMessageWithExtensionsLite message =
+ UnittestLite.TestEmptyMessageWithExtensionsLite.parseFrom(allFieldsData);
+
+ assertEquals(allFieldsData, message.toByteString());
+ }
+
+ public void testWrongExtensionTypeTreatedAsUnknownLite() throws Exception {
+ // Test that fields of the wrong wire type are treated like unknown fields
+ // when parsing extensions.
+
+ ByteString bizarroData = getBizarroData();
+ TestAllExtensions allExtensionsMessage =
+ TestAllExtensions.parseFrom(bizarroData);
+ UnittestLite.TestEmptyMessageLite emptyMessageLite =
+ UnittestLite.TestEmptyMessageLite.parseFrom(bizarroData);
+
+ // All fields should have been interpreted as unknown, so the byte strings
+ // should be the same.
+ assertEquals(emptyMessageLite.toByteString(),
+ allExtensionsMessage.toByteString());
+ }
+
+ public void testParseUnknownEnumValueLite() throws Exception {
+ Descriptors.FieldDescriptor singularField =
+ TestAllTypes.getDescriptor().findFieldByName("optional_nested_enum");
+ Descriptors.FieldDescriptor repeatedField =
+ TestAllTypes.getDescriptor().findFieldByName("repeated_nested_enum");
+ assertNotNull(singularField);
+ assertNotNull(repeatedField);
+
+ ByteString data =
+ UnknownFieldSet.newBuilder()
+ .addField(singularField.getNumber(),
+ UnknownFieldSet.Field.newBuilder()
+ .addVarint(TestAllTypes.NestedEnum.BAR.getNumber())
+ .addVarint(5) // not valid
+ .build())
+ .addField(repeatedField.getNumber(),
+ UnknownFieldSet.Field.newBuilder()
+ .addVarint(TestAllTypes.NestedEnum.FOO.getNumber())
+ .addVarint(4) // not valid
+ .addVarint(TestAllTypes.NestedEnum.BAZ.getNumber())
+ .addVarint(6) // not valid
+ .build())
+ .build()
+ .toByteString();
+
+ UnittestLite.TestEmptyMessageLite emptyMessageLite =
+ UnittestLite.TestEmptyMessageLite.parseFrom(data);
+ data = emptyMessageLite.toByteString();
+
+ {
+ TestAllTypes message = TestAllTypes.parseFrom(data);
+ assertEquals(TestAllTypes.NestedEnum.BAR,
+ message.getOptionalNestedEnum());
+ assertEquals(
+ Arrays.asList(TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAZ),
+ message.getRepeatedNestedEnumList());
+ assertEquals(Arrays.asList(5L),
+ message.getUnknownFields()
+ .getField(singularField.getNumber())
+ .getVarintList());
+ assertEquals(Arrays.asList(4L, 6L),
+ message.getUnknownFields()
+ .getField(repeatedField.getNumber())
+ .getVarintList());
+ }
+
+ {
+ TestAllExtensions message =
+ TestAllExtensions.parseFrom(data, TestUtil.getExtensionRegistry());
+ assertEquals(TestAllTypes.NestedEnum.BAR,
+ message.getExtension(UnittestProto.optionalNestedEnumExtension));
+ assertEquals(
+ Arrays.asList(TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAZ),
+ message.getExtension(UnittestProto.repeatedNestedEnumExtension));
+ assertEquals(Arrays.asList(5L),
+ message.getUnknownFields()
+ .getField(singularField.getNumber())
+ .getVarintList());
+ assertEquals(Arrays.asList(4L, 6L),
+ message.getUnknownFields()
+ .getField(repeatedField.getNumber())
+ .getVarintList());
+ }
+ }
+
+ public void testClearLite() throws Exception {
+ UnittestLite.TestEmptyMessageLite emptyMessageLite1 =
+ UnittestLite.TestEmptyMessageLite.parseFrom(allFieldsData);
+ UnittestLite.TestEmptyMessageLite emptyMessageLite2 =
+ UnittestLite.TestEmptyMessageLite.newBuilder()
+ .mergeFrom(emptyMessageLite1).clear().build();
+ assertEquals(0, emptyMessageLite2.getSerializedSize());
+ ByteString data = emptyMessageLite2.toByteString();
+ assertEquals(0, data.size());
+ }
+
}
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java
index 00f201ca58..00f201ca58 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java
index 982e200f53..982e200f53 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/WireFormatTest.java b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/WireFormatTest.java
index 03c33ecfea..370860c2f8 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/WireFormatTest.java
+++ b/third_party/protobuf/3.4.0/java/core/src/test/java/com/google/protobuf/WireFormatTest.java
@@ -30,13 +30,14 @@
package com.google.protobuf;
+import com.google.protobuf.UnittestLite.TestAllExtensionsLite;
+import com.google.protobuf.UnittestLite.TestPackedExtensionsLite;
import protobuf_unittest.UnittestMset.RawMessageSet;
import protobuf_unittest.UnittestMset.TestMessageSetExtension1;
import protobuf_unittest.UnittestMset.TestMessageSetExtension2;
import protobuf_unittest.UnittestProto;
import protobuf_unittest.UnittestProto.TestAllExtensions;
import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestExtensionInsideTable;
import protobuf_unittest.UnittestProto.TestFieldOrderings;
import protobuf_unittest.UnittestProto.TestOneof2;
import protobuf_unittest.UnittestProto.TestOneofBackwardsCompatible;
@@ -124,6 +125,32 @@ public class WireFormatTest extends TestCase {
TestUtil.assertPackedFieldsSet(message2);
}
+ public void testSerializeExtensionsLite() throws Exception {
+ // TestAllTypes and TestAllExtensions should have compatible wire formats,
+ // so if we serialize a TestAllExtensions then parse it as TestAllTypes
+ // it should work.
+
+ TestAllExtensionsLite message = TestUtilLite.getAllLiteExtensionsSet();
+ ByteString rawBytes = message.toByteString();
+ assertEquals(rawBytes.size(), message.getSerializedSize());
+
+ TestAllTypes message2 = TestAllTypes.parseFrom(rawBytes);
+
+ TestUtil.assertAllFieldsSet(message2);
+ }
+
+ public void testSerializePackedExtensionsLite() throws Exception {
+ // TestPackedTypes and TestPackedExtensions should have compatible wire
+ // formats; check that they serialize to the same string.
+ TestPackedExtensionsLite message = TestUtilLite.getLitePackedExtensionsSet();
+ ByteString rawBytes = message.toByteString();
+
+ TestPackedTypes message2 = TestUtil.getPackedSet();
+ ByteString rawBytes2 = message2.toByteString();
+
+ assertEquals(rawBytes, rawBytes2);
+ }
+
public void testParseExtensions() throws Exception {
// TestAllTypes and TestAllExtensions should have compatible wire formats,
// so if we serialize a TestAllTypes then parse it as TestAllExtensions
@@ -153,6 +180,48 @@ public class WireFormatTest extends TestCase {
TestUtil.assertPackedExtensionsSet(message2);
}
+ public void testParseExtensionsLite() throws Exception {
+ // TestAllTypes and TestAllExtensions should have compatible wire formats,
+ // so if we serialize a TestAllTypes then parse it as TestAllExtensions
+ // it should work.
+
+ TestAllTypes message = TestUtil.getAllSet();
+ ByteString rawBytes = message.toByteString();
+
+ ExtensionRegistryLite registry_lite = TestUtilLite.getExtensionRegistryLite();
+
+ TestAllExtensionsLite message2 =
+ TestAllExtensionsLite.parseFrom(rawBytes, registry_lite);
+
+ TestUtil.assertAllExtensionsSet(message2);
+
+ // Try again using a full extension registry.
+ ExtensionRegistry registry = TestUtil.getExtensionRegistry();
+
+ TestAllExtensionsLite message3 =
+ TestAllExtensionsLite.parseFrom(rawBytes, registry);
+
+ TestUtil.assertAllExtensionsSet(message3);
+ }
+
+ public void testParsePackedExtensionsLite() throws Exception {
+ // Ensure that packed extensions can be properly parsed.
+ TestPackedExtensionsLite message = TestUtilLite.getLitePackedExtensionsSet();
+ ByteString rawBytes = message.toByteString();
+
+ ExtensionRegistryLite registry = TestUtilLite.getExtensionRegistryLite();
+
+ TestPackedExtensionsLite message2 =
+ TestPackedExtensionsLite.parseFrom(rawBytes, registry);
+
+ TestUtil.assertPackedExtensionsSet(message2);
+ }
+
+ public void testExtensionsSerializedSize() throws Exception {
+ assertNotSame(TestUtil.getAllSet().getSerializedSize(),
+ TestUtil.getAllExtensionsSet().getSerializedSize());
+ }
+
public void testSerializeDelimited() throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
TestUtil.getAllSet().writeDelimitedTo(output);
@@ -236,26 +305,6 @@ public class WireFormatTest extends TestCase {
getTestFieldOrderingsRegistry());
assertEquals(source, dest);
}
-
- private static ExtensionRegistry getTestExtensionInsideTableRegistry() {
- ExtensionRegistry result = ExtensionRegistry.newInstance();
- result.add(UnittestProto.testExtensionInsideTableExtension);
- return result;
- }
-
- public void testExtensionInsideTable() throws Exception {
- // Make sure the extension within the range of table is parsed correctly in experimental
- // runtime.
- TestExtensionInsideTable source =
- TestExtensionInsideTable.newBuilder()
- .setField1(1)
- .setExtension(UnittestProto.testExtensionInsideTableExtension, 23)
- .build();
- TestExtensionInsideTable dest =
- TestExtensionInsideTable.parseFrom(source.toByteString(),
- getTestExtensionInsideTableRegistry());
- assertEquals(source, dest);
- }
public void testParseMultipleExtensionRangesDynamic() throws Exception {
// Same as above except with DynamicMessage.
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/any_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/any_test.proto
index 80173d8a0e..80173d8a0e 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/any_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/any_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto
index 2367bd8bd0..2367bd8bd0 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto
index 5580f72d99..5580f72d99 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto
index b18b0d79f2..b18b0d79f2 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto
index 2ca0251ca2..2ca0251ca2 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto
index 974f8a2c74..974f8a2c74 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto
index b02ac599a5..b02ac599a5 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_test.proto
index bc2105e50f..bc2105e50f 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/map_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto
index 92790506f0..92790506f0 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto
index a5dd66d889..a5dd66d889 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_extension.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_extension.proto
index 704e649e02..704e649e02 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_extension.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_extension.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto
index a95c38b234..a95c38b234 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto
index 31fac55295..31fac55295 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto
index 37c369edaa..37c369edaa 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto
index 4208368146..4208368146 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto
index 3e5956b0d4..3e5956b0d4 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto
index 74a8ba3c3d..74a8ba3c3d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto
index ff5bf3ae21..ff5bf3ae21 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto
index 119c1dcbad..119c1dcbad 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto
index f06d76d629..f06d76d629 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto
index f8efd455a1..f8efd455a1 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto
index 645f57b4bb..645f57b4bb 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto
+++ b/third_party/protobuf/3.4.0/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto
diff --git a/third_party/protobuf/3.4.0/java/lite/generate-sources-build.xml b/third_party/protobuf/3.4.0/java/lite/generate-sources-build.xml
new file mode 100644
index 0000000000..89c21c1315
--- /dev/null
+++ b/third_party/protobuf/3.4.0/java/lite/generate-sources-build.xml
@@ -0,0 +1,20 @@
+<project name="generate-sources">
+ <echo message="Running protoc ..."/>
+ <mkdir dir="${generated.sources.lite.dir}"/>
+ <exec executable="${protoc}">
+ <arg value="--java_out=lite:${generated.sources.lite.dir}"/>
+ <arg value="--proto_path=${protobuf.source.dir}"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/source_context.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/struct.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/timestamp.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/type.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/wrappers.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/compiler/plugin.proto"/>
+ </exec>
+</project>
diff --git a/third_party/protobuf/3.4.0/java/lite/generate-test-sources-build.xml b/third_party/protobuf/3.4.0/java/lite/generate-test-sources-build.xml
new file mode 100644
index 0000000000..cdd1ee89a7
--- /dev/null
+++ b/third_party/protobuf/3.4.0/java/lite/generate-test-sources-build.xml
@@ -0,0 +1,43 @@
+<project name="generate-test-sources">
+ <mkdir dir="${generated.testsources.lite.dir}"/>
+ <exec executable="${protoc}">
+ <arg value="--java_out=lite:${generated.testsources.lite.dir}"/>
+ <arg value="--proto_path=${protobuf.source.dir}"/>
+ <arg value="--proto_path=${test.proto.dir}"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_mset.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_mset_wire_format.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_optimize_for.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_custom_options.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_lite_imports_nonlite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_enormous_descriptor.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_no_generic_services.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_well_known_types.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/lazy_fields_lite.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/lite_equals_and_hash.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/multiple_files_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/nested_builders_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/nested_extension.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/nested_extension_lite.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/non_nested_extension.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/non_nested_extension_lite.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/outer_class_name_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/outer_class_name_test2.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/outer_class_name_test3.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/test_bad_identifiers.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/test_check_utf8.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/test_check_utf8_size.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/test_custom_options.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/any_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/field_presence_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/map_for_proto2_lite_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/map_for_proto2_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/map_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/map_initialization_order_test.proto"/>
+ </exec>
+</project>
diff --git a/third_party/protobuf/3.4.0/java/lite/pom.xml b/third_party/protobuf/3.4.0/java/lite/pom.xml
new file mode 100644
index 0000000000..c902f8192a
--- /dev/null
+++ b/third_party/protobuf/3.4.0/java/lite/pom.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-parent</artifactId>
+ <version>3.0.0</version>
+ </parent>
+
+ <artifactId>protobuf-lite</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>Protocol Buffers [Lite]</name>
+ <description>A trimmed-down version of the Protocol Buffers library.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <core.root>../core</core.root>
+ <test.proto.dir>${core.root}/src/test/proto</test.proto.dir>
+ </properties>
+
+ <build>
+ <sourceDirectory>${core.root}/src/main/java</sourceDirectory>
+ <testSourceDirectory>${core.root}/src/test/java</testSourceDirectory>
+
+ <plugins>
+ <!-- Use Antrun plugin to generate sources with protoc -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <!-- Generate core protos -->
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <target>
+ <ant antfile="generate-sources-build.xml"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <!-- Generate the test protos -->
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <target>
+ <ant antfile="generate-test-sources-build.xml"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Only compile a subset of the files -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-generated-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${generated.sources.lite.dir}</source>
+ </sources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-generated-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${generated.testsources.lite.dir}</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/AbstractMessageLite.java</include>
+ <include>**/AbstractParser.java</include>
+ <include>**/AbstractProtobufList.java</include>
+ <include>**/BooleanArrayList.java</include>
+ <include>**/ByteString.java</include>
+ <include>**/CodedInputStream.java</include>
+ <include>**/CodedOutputStream.java</include>
+ <include>**/DoubleArrayList.java</include>
+ <include>**/ExtensionLite.java</include>
+ <include>**/ExtensionRegistryLite.java</include>
+ <include>**/FieldSet.java</include>
+ <include>**/FloatArrayList.java</include>
+ <include>**/GeneratedMessageLite.java</include>
+ <include>**/IntArrayList.java</include>
+ <include>**/Internal.java</include>
+ <include>**/InvalidProtocolBufferException.java</include>
+ <include>**/LazyFieldLite.java</include>
+ <include>**/LazyStringArrayList.java</include>
+ <include>**/LazyStringList.java</include>
+ <include>**/LongArrayList.java</include>
+ <include>**/MapEntryLite.java</include>
+ <include>**/MapFieldLite.java</include>
+ <include>**/MessageLite.java</include>
+ <include>**/MessageLiteOrBuilder.java</include>
+ <include>**/MessageLiteToString.java</include>
+ <include>**/MutabilityOracle.java</include>
+ <include>**/NioByteString.java</include>
+ <include>**/Parser.java</include>
+ <include>**/PrimitiveNonBoxingCollection.java</include>
+ <include>**/ProtobufArrayList.java</include>
+ <include>**/ProtocolStringList.java</include>
+ <include>**/RopeByteString.java</include>
+ <include>**/SmallSortedMap.java</include>
+ <include>**/TextFormatEscaper.java</include>
+ <include>**/UninitializedMessageException.java</include>
+ <include>**/UnknownFieldSetLite.java</include>
+ <include>**/UnmodifiableLazyStringList.java</include>
+ <include>**/UnsafeByteOperations.java</include>
+ <include>**/Utf8.java</include>
+ <include>**/WireFormat.java</include>
+ </includes>
+ <testIncludes>
+ <testInclude>**/*Lite.java</testInclude>
+ <testInclude>**/BooleanArrayListTest.java</testInclude>
+ <testInclude>**/DoubleArrayListTest.java</testInclude>
+ <testInclude>**/FloatArrayListTest.java</testInclude>
+ <testInclude>**/IntArrayListTest.java</testInclude>
+ <testInclude>**/LazyMessageLiteTest.java</testInclude>
+ <testInclude>**/LiteTest.java</testInclude>
+ <testInclude>**/LongArrayListTest.java</testInclude>
+ <testInclude>**/NioByteStringTest.java</testInclude>
+ <testInclude>**/ProtobufArrayListTest.java</testInclude>
+ <testInclude>**/UnknownFieldSetLiteTest.java</testInclude>
+ </testIncludes>
+ </configuration>
+ </plugin>
+
+ <!-- OSGI bundle configuration -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL>
+ <Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName>
+ <Export-Package>com.google.${project.artifactId};version=${project.version}</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/third_party/protobuf/3.6.0/java/pom.xml b/third_party/protobuf/3.4.0/java/pom.xml
index 35d653b44e..dd3ba3b88e 100644
--- a/third_party/protobuf/3.6.0/java/pom.xml
+++ b/third_party/protobuf/3.4.0/java/pom.xml
@@ -11,7 +11,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
- <version>3.6.0</version>
+ <version>3.4.0</version>
<packaging>pom</packaging>
<name>Protocol Buffers [Parent]</name>
@@ -33,6 +33,8 @@
<test.proto.dir>src/test/proto</test.proto.dir>
<generated.sources.dir>${project.build.directory}/generated-sources</generated.sources.dir>
<generated.testsources.dir>${project.build.directory}/generated-test-sources</generated.testsources.dir>
+ <generated.sources.lite.dir>${project.build.directory}/generated-sources-lite</generated.sources.lite.dir>
+ <generated.testsources.lite.dir>${project.build.directory}/generated-test-sources-lite</generated.testsources.lite.dir>
</properties>
<licenses>
@@ -94,8 +96,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
- <source>1.7</source>
- <target>1.7</target>
+ <source>1.6</source>
+ <target>1.6</target>
</configuration>
</plugin>
<plugin>
@@ -206,6 +208,7 @@
<modules>
<module>core</module>
+ <!-- <module>lite</module> -->
<module>util</module>
</modules>
diff --git a/third_party/protobuf/3.6.0/java/util/pom.xml b/third_party/protobuf/3.4.0/java/util/pom.xml
index 8ea4a40dd1..61abd14623 100644
--- a/third_party/protobuf/3.6.0/java/util/pom.xml
+++ b/third_party/protobuf/3.4.0/java/util/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
- <version>3.6.0</version>
+ <version>3.4.0</version>
</parent>
<artifactId>protobuf-java-util</artifactId>
diff --git a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/Durations.java b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/Durations.java
index fb7f434338..fb7f434338 100644
--- a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/Durations.java
+++ b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/Durations.java
diff --git a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java
index 4a13fb1d43..b192b53edf 100644
--- a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java
+++ b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java
@@ -34,6 +34,7 @@ import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Message;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
@@ -243,11 +244,6 @@ final class FieldMaskTree {
+ "singluar message field and cannot have sub-fields.");
continue;
}
- if (!source.hasField(field) && !destination.hasField(field)) {
- // If the message field is not present in both source and destination, skip recursing
- // so we don't create unnecessary empty messages.
- continue;
- }
String childPath = path.isEmpty() ? entry.getKey() : path + "." + entry.getKey();
merge(
entry.getValue(),
diff --git a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
index b2f849c491..b2f849c491 100644
--- a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
+++ b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
diff --git a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
index 7f69ee6889..a603d96aac 100644
--- a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
+++ b/third_party/protobuf/3.4.0/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,21 +125,18 @@ 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 printingEnumsAsInts) {
+ boolean omittingInsignificantWhitespace) {
this.registry = registry;
this.alwaysOutputDefaultValueFields = alwaysOutputDefaultValueFields;
this.includingDefaultValueFields = includingDefaultValueFields;
this.preservingProtoFieldNames = preservingProtoFieldNames;
this.omittingInsignificantWhitespace = omittingInsignificantWhitespace;
- this.printingEnumsAsInts = printingEnumsAsInts;
}
/**
@@ -157,8 +154,7 @@ public class JsonFormat {
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
preservingProtoFieldNames,
- omittingInsignificantWhitespace,
- printingEnumsAsInts);
+ omittingInsignificantWhitespace);
}
/**
@@ -174,31 +170,7 @@ public class JsonFormat {
true,
Collections.<FieldDescriptor>emptySet(),
preservingProtoFieldNames,
- 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.");
- }
+ omittingInsignificantWhitespace);
}
/**
@@ -219,8 +191,7 @@ public class JsonFormat {
false,
fieldsToAlwaysOutput,
preservingProtoFieldNames,
- omittingInsignificantWhitespace,
- printingEnumsAsInts);
+ omittingInsignificantWhitespace);
}
private void checkUnsetIncludingDefaultValueFields() {
@@ -242,8 +213,7 @@ public class JsonFormat {
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
true,
- omittingInsignificantWhitespace,
- printingEnumsAsInts);
+ omittingInsignificantWhitespace);
}
@@ -270,8 +240,7 @@ public class JsonFormat {
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
preservingProtoFieldNames,
- true,
- printingEnumsAsInts);
+ true);
}
/**
@@ -290,8 +259,7 @@ public class JsonFormat {
includingDefaultValueFields,
preservingProtoFieldNames,
output,
- omittingInsignificantWhitespace,
- printingEnumsAsInts)
+ omittingInsignificantWhitespace)
.print(message);
}
@@ -448,7 +416,7 @@ public class JsonFormat {
*/
public Builder add(Iterable<Descriptor> messageTypes) {
if (types == null) {
- throw new IllegalStateException("A TypeRegistry.Builder can only be used once.");
+ throw new IllegalStateException("A TypeRegistry.Builer can only be used once.");
}
for (Descriptor type : messageTypes) {
addFile(type.getFile());
@@ -602,7 +570,6 @@ 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;
@@ -619,13 +586,11 @@ public class JsonFormat {
Set<FieldDescriptor> includingDefaultValueFields,
boolean preservingProtoFieldNames,
Appendable jsonOutput,
- boolean omittingInsignificantWhitespace,
- boolean printingEnumsAsInts) {
+ boolean omittingInsignificantWhitespace) {
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) {
@@ -1104,7 +1069,7 @@ public class JsonFormat {
generator.print("\"");
}
} else {
- if (printingEnumsAsInts || ((EnumValueDescriptor) value).getIndex() == -1) {
+ if (((EnumValueDescriptor) value).getIndex() == -1) {
generator.print(String.valueOf(((EnumValueDescriptor) value).getNumber()));
} else {
generator.print("\"" + ((EnumValueDescriptor) value).getName() + "\"");
@@ -1557,8 +1522,7 @@ public class JsonFormat {
for (int i = 0; i < array.size(); ++i) {
Object value = parseFieldValue(field, array.get(i), builder);
if (value == null) {
- throw new InvalidProtocolBufferException(
- "Repeated field elements cannot be null in field: " + field.getFullName());
+ throw new InvalidProtocolBufferException("Repeated field elements cannot be null");
}
builder.addRepeatedField(field, value);
}
diff --git a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/TimeUtil.java b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/TimeUtil.java
index 0475847349..0475847349 100644
--- a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/TimeUtil.java
+++ b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/TimeUtil.java
diff --git a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/Timestamps.java b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
index 9e528d4a71..7a1f20149d 100644
--- a/third_party/protobuf/3.6.0/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
+++ b/third_party/protobuf/3.4.0/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
@@ -74,11 +74,6 @@ 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
@@ -363,12 +358,10 @@ 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 = (int) (nanos % NANOS_PER_SECOND);
+ nanos %= NANOS_PER_SECOND;
}
if (nanos < 0) {
- nanos =
- (int)
- (nanos + NANOS_PER_SECOND); // no overflow since nanos is negative (and we're adding)
+ 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/third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java b/third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java
index 853b6151dd..3ee0fc6e6a 100644
--- a/third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java
+++ b/third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java
@@ -33,6 +33,7 @@ package com.google.protobuf.util;
import protobuf_unittest.UnittestProto.NestedTestAllTypes;
import protobuf_unittest.UnittestProto.TestAllTypes;
import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage;
+
import junit.framework.TestCase;
public class FieldMaskTreeTest extends TestCase {
@@ -221,13 +222,6 @@ public class FieldMaskTreeTest extends TestCase {
new FieldMaskTree().addFieldPath("payload").merge(clearedSource, builder, options);
assertEquals(false, builder.hasPayload());
- // Skip a message field if they are unset in both source and target.
- builder = NestedTestAllTypes.newBuilder();
- new FieldMaskTree()
- .addFieldPath("payload.optional_int32")
- .merge(clearedSource, builder, options);
- assertEquals(false, builder.hasPayload());
-
// Change to replace message fields.
options.setReplaceMessageFields(true);
builder = NestedTestAllTypes.newBuilder();
diff --git a/third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java b/third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
index 1a99857053..1a99857053 100644
--- a/third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
+++ b/third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
diff --git a/third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java b/third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
index 6ef0850828..e4c5387af7 100644
--- a/third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
+++ b/third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
@@ -1174,14 +1174,6 @@ 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));
@@ -1449,13 +1441,6 @@ 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/third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java b/third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java
index 5af83d88e6..5af83d88e6 100644
--- a/third_party/protobuf/3.6.0/java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java
+++ b/third_party/protobuf/3.4.0/java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java
diff --git a/third_party/protobuf/3.6.0/java/util/src/test/proto/com/google/protobuf/util/json_test.proto b/third_party/protobuf/3.4.0/java/util/src/test/proto/com/google/protobuf/util/json_test.proto
index d1248cfb71..d1248cfb71 100644
--- a/third_party/protobuf/3.6.0/java/util/src/test/proto/com/google/protobuf/util/json_test.proto
+++ b/third_party/protobuf/3.4.0/java/util/src/test/proto/com/google/protobuf/util/json_test.proto
diff --git a/third_party/protobuf/3.4.0/javanano/README.md b/third_party/protobuf/3.4.0/javanano/README.md
new file mode 100644
index 0000000000..6b13ecea7c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/README.md
@@ -0,0 +1,401 @@
+Protocol Buffers - Google's data interchange format
+===================================================
+
+[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf)
+
+Copyright 2008 Google Inc.
+
+This directory contains the Java Protocol Buffers Nano runtime library.
+
+**Nano is no longer supported by protobuf team. We recommend Android users to
+use protobuf lite runtime instead.**
+
+Installation - With Maven
+-------------------------
+
+The Protocol Buffers build is managed using Maven. If you would
+rather build without Maven, see below.
+
+1) Install Apache Maven if you don't have it:
+
+ http://maven.apache.org/
+
+2) Build the C++ code, or obtain a binary distribution of protoc. If
+ you install a binary distribution, make sure that it is the same
+ version as this package. If in doubt, run:
+
+ $ protoc --version
+
+ You will need to place the protoc executable in ../src. (If you
+ built it yourself, it should already be there.)
+
+3) Run the tests:
+
+ $ mvn test
+
+ If some tests fail, this library may not work correctly on your
+ system. Continue at your own risk.
+
+4) Install the library into your Maven repository:
+
+ $ mvn install
+
+5) If you do not use Maven to manage your own build, you can build a
+ .jar file to use:
+
+ $ mvn package
+
+ The .jar will be placed in the "target" directory.
+
+Installation - Without Maven
+----------------------------
+
+If you would rather not install Maven to build the library, you may
+follow these instructions instead. Note that these instructions skip
+running unit tests.
+
+1) Build the C++ code, or obtain a binary distribution of protoc. If
+ you install a binary distribution, make sure that it is the same
+ version as this package. If in doubt, run:
+
+ $ protoc --version
+
+ If you built the C++ code without installing, the compiler binary
+ should be located in ../src.
+
+2) Invoke protoc to build DescriptorProtos.java:
+
+ $ protoc --java_out=src/main/java -I../src \
+ ../src/google/protobuf/descriptor.proto
+
+3) Compile the code in src/main/java using whatever means you prefer.
+
+4) Install the classes wherever you prefer.
+
+Nano version
+------------
+
+JavaNano is a special code generator and runtime library designed specially for
+resource-restricted systems, like Android. It is very resource-friendly in both
+the amount of code and the runtime overhead. Here is an overview of JavaNano
+features compared with the official Java protobuf:
+
+- No descriptors or message builders.
+- All messages are mutable; fields are public Java fields.
+- For optional fields only, encapsulation behind setter/getter/hazzer/
+ clearer functions is opt-in, which provide proper 'has' state support.
+- For proto2, if not opted in, has state (field presence) is not available.
+ Serialization outputs all fields not equal to their defaults
+ (see important implications below).
+ The behavior is consistent with proto3 semantics.
+- Required fields (proto2 only) are always serialized.
+- Enum constants are integers; protection against invalid values only
+ when parsing from the wire.
+- Enum constants can be generated into container interfaces bearing
+ the enum's name (so the referencing code is in Java style).
+- CodedInputByteBufferNano can only take byte[] (not InputStream).
+- Similarly CodedOutputByteBufferNano can only write to byte[].
+- Repeated fields are in arrays, not ArrayList or Vector. Null array
+ elements are allowed and silently ignored.
+- Full support for serializing/deserializing repeated packed fields.
+- Support extensions (in proto2).
+- Unset messages/groups are null, not an immutable empty default
+ instance.
+- toByteArray(...) and mergeFrom(...) are now static functions of
+ MessageNano.
+- The 'bytes' type translates to the Java type byte[].
+
+The generated messages are not thread-safe for writes, but may be
+used simultaneously from multiple threads in a read-only manner.
+In other words, an appropriate synchronization mechanism (such as
+a ReadWriteLock) must be used to ensure that a message, its
+ancestors, and descendants are not accessed by any other threads
+while the message is being modified. Field reads, getter methods
+(but not getExtension(...)), toByteArray(...), writeTo(...),
+getCachedSize(), and getSerializedSize() are all considered read-only
+operations.
+
+IMPORTANT: If you have fields with defaults and opt out of accessors
+
+How fields with defaults are serialized has changed. Because we don't
+keep "has" state, any field equal to its default is assumed to be not
+set and therefore is not serialized. Consider the situation where we
+change the default value of a field. Senders compiled against an older
+version of the proto continue to match against the old default, and
+don't send values to the receiver even though the receiver assumes the
+new default value. Therefore, think carefully about the implications
+of changing the default value. Alternatively, turn on accessors and
+enjoy the benefit of the explicit has() checks.
+
+IMPORTANT: If you have "bytes" fields with non-empty defaults
+
+Because the byte buffer is now of mutable type byte[], the default
+static final cannot be exposed through a public field. Each time a
+message's constructor or clear() function is called, the default value
+(kept in a private byte[]) is cloned. This causes a small memory
+penalty. This is not a problem if the field has no default or is an
+empty default.
+
+Nano Generator options
+----------------------
+
+```
+java_package -> <file-name>|<package-name>
+java_outer_classname -> <file-name>|<package-name>
+java_multiple_files -> true or false
+java_nano_generate_has -> true or false [DEPRECATED]
+optional_field_style -> default or accessors
+enum_style -> c or java
+ignore_services -> true or false
+parcelable_messages -> true or false
+generate_intdefs -> true or false
+```
+
+**java_package=\<file-name\>|\<package-name\>** (no default)
+
+ This allows overriding the 'java_package' option value
+ for the given file from the command line. Use multiple
+ java_package options to override the option for multiple
+ files. The final Java package for each file is the value
+ of this command line option if present, or the value of
+ the same option defined in the file if present, or the
+ proto package if present, or the default Java package.
+
+**java_outer_classname=\<file-name\>|\<outer-classname\>** (no default)
+
+ This allows overriding the 'java_outer_classname' option
+ for the given file from the command line. Use multiple
+ java_outer_classname options to override the option for
+ multiple files. The final Java outer class name for each
+ file is the value of this command line option if present,
+ or the value of the same option defined in the file if
+ present, or the file name converted to CamelCase. This
+ outer class will nest all classes and integer constants
+ generated from file-scope messages and enums.
+
+**java_multiple_files={true,false}** (no default)
+
+ This allows overriding the 'java_multiple_files' option
+ in all source files and their imported files from the
+ command line. The final value of this option for each
+ file is the value defined in this command line option, or
+ the value of the same option defined in the file if
+ present, or false. This specifies whether to generate
+ package-level classes for the file-scope messages in the
+ same Java package as the outer class (instead of nested
+ classes in the outer class). File-scope enum constants
+ are still generated as integer constants in the outer
+ class. This affects the fully qualified references in the
+ Java code. NOTE: because the command line option
+ overrides the value for all files and their imported
+ files, using this option inconsistently may result in
+ incorrect references to the imported messages and enum
+ constants.
+
+**java_nano_generate_has={true,false}** (default: false)
+
+ DEPRECATED. Use optional_field_style=accessors.
+
+ If true, generates a public boolean variable has\<fieldname\>
+ accompanying each optional or required field (not present for
+ repeated fields, groups or messages). It is set to false initially
+ and upon clear(). If parseFrom(...) reads the field from the wire,
+ it is set to true. This is a way for clients to inspect the "has"
+ value upon parse. If it is set to true, writeTo(...) will ALWAYS
+ output that field (even if field value is equal to its
+ default).
+
+ IMPORTANT: This option costs an extra 4 bytes per primitive field in
+ the message. Think carefully about whether you really need this. In
+ many cases reading the default works and determining whether the
+ field was received over the wire is irrelevant.
+
+**optional_field_style={default,accessors,reftypes}** (default: default)
+
+ Defines the style of the generated code for fields.
+
+ * default
+
+ In the default style, optional fields translate into public mutable
+ Java fields, and the serialization process is as discussed in the
+ "IMPORTANT" section above.
+
+ * accessors
+
+ When set to 'accessors', each optional field is encapsulated behind
+ 4 accessors, namely get\<fieldname\>(), set\<fieldname\>(), has\<fieldname\>()
+ and clear\<fieldname\>() methods, with the standard semantics. The hazzer's
+ return value determines whether a field is serialized, so this style is
+ useful when you need to serialize a field with the default value, or check
+ if a field has been explicitly set to its default value from the wire.
+
+ In the 'accessors' style, required and nested message fields are still
+ translated to one public mutable Java field each, repeated fields are still
+ translated to arrays. No accessors are generated for them.
+
+ IMPORTANT: When using the 'accessors' style, ProGuard should always
+ be enabled with optimization (don't use -dontoptimize) and allowing
+ access modification (use -allowaccessmodification). This removes the
+ unused accessors and maybe inline the rest at the call sites,
+ reducing the final code size.
+ TODO(maxtroy): find ProGuard config that would work the best.
+
+ * reftypes
+
+ When set to 'reftypes', each proto field is generated as a public Java
+ field. For primitive types, these fields use the Java reference types
+ such as java.lang.Integer instead of primitive types such as int.
+
+ In the 'reftypes' style, fields are initialized to null (or empty
+ arrays for repeated fields), and their default values are not available.
+ They are serialized over the wire based on equality to null.
+
+ The 'reftypes' mode has some additional cost due to autoboxing and usage
+ of reference types. In practice, many boxed types are cached, and so don't
+ result in object creation. However, references do take slightly more memory
+ than primitives.
+
+ The 'reftypes' mode is useful when you want to be able to serialize fields
+ with default values, or check if a field has been explicitly set to the
+ default over the wire without paying the extra method cost of the
+ 'accessors' mode.
+
+ Note that if you attempt to write null to a required field in the reftypes
+ mode, serialization of the proto will cause a NullPointerException. This is
+ an intentional indicator that you must set required fields.
+
+ NOTE
+ optional_field_style=accessors or reftypes cannot be used together with
+ java_nano_generate_has=true. If you need the 'has' flag for any
+ required field (you have no reason to), you can only use
+ java_nano_generate_has=true.
+
+**enum_style={c,java}** (default: c)
+
+ Defines where to put the int constants generated from enum members.
+
+ * c
+
+ Use C-style, so the enum constants are available at the scope where
+ the enum is defined. A file-scope enum's members are referenced like
+ 'FileOuterClass.ENUM_VALUE'; a message-scope enum's members are
+ referenced as 'Message.ENUM_VALUE'. The enum name is unavailable.
+ This complies with the Micro code generator's behavior.
+
+ * java
+
+ Use Java-style, so the enum constants are available under the enum
+ name and referenced like 'EnumName.ENUM_VALUE' (they are still int
+ constants). The enum name becomes the name of a public interface, at
+ the scope where the enum is defined. If the enum is file-scope and
+ the java_multiple_files option is on, the interface will be defined
+ in its own file. To reduce code size, this interface should not be
+ implemented and ProGuard shrinking should be used, so after the Java
+ compiler inlines all referenced enum constants into the call sites,
+ the interface remains unused and can be removed by ProGuard.
+
+**ignore_services={true,false}** (default: false)
+
+ Skips services definitions.
+
+ Nano doesn't support services. By default, if a service is defined
+ it will generate a compilation error. If this flag is set to true,
+ services will be silently ignored, instead.
+
+**parcelable_messages={true,false}** (default: false)
+
+ Android-specific option to generate Parcelable messages.
+
+**generate_intdefs={true,false}** (default: false)
+ Android-specific option to generate @IntDef annotations for enums.
+
+ If turned on, an '@IntDef' annotation (a public @interface) will be
+ generated for each enum, and every integer parameter and return
+ value in the generated code meant for this enum will be annotated
+ with it. This interface is generated with the same name and at the
+ same place as the enum members' container interfaces described
+ above under 'enum_style=java', regardless of the enum_style option
+ used. When this is combined with enum_style=java, the interface
+ will be both the '@IntDef' annotation and the container of the enum
+ members; otherwise the interface has an empty body.
+
+ Your app must declare a compile-time dependency on the
+ android-support-annotations library.
+
+ For more information on how these @IntDef annotations help with
+ compile-time type safety, see:
+ https://sites.google.com/a/android.com/tools/tech-docs/support-annotations
+ and
+ https://developer.android.com/reference/android/support/annotation/IntDef.html
+
+
+To use nano protobufs within the Android repo:
+----------------------------------------------
+
+- Set 'LOCAL_PROTOC_OPTIMIZE_TYPE := nano' in your local .mk file.
+ When building a Java library or an app (package) target, the build
+ system will add the Java nano runtime library to the
+ LOCAL_STATIC_JAVA_LIBRARIES variable, so you don't need to.
+- Set 'LOCAL_PROTO_JAVA_OUTPUT_PARAMS := ...' in your local .mk file
+ for any command-line options you need. Use commas to join multiple
+ options. In the nano flavor only, whitespace surrounding the option
+ names and values are ignored, so you can use backslash-newline or
+ '+=' to structure your make files nicely.
+- The options will be applied to *all* proto files in LOCAL_SRC_FILES
+ when you build a Java library or package. In case different options
+ are needed for different proto files, build separate Java libraries
+ and reference them in your main target. Note: you should make sure
+ that, for each separate target, all proto files imported from any
+ proto file in LOCAL_SRC_FILES are included in LOCAL_SRC_FILES. This
+ is because the generator has to assume that the imported files are
+ built using the same options, and will generate code that reference
+ the fields and enums from the imported files using the same code
+ style.
+- Hint: 'include $(CLEAR_VARS)' resets all LOCAL_ variables, including
+ the two above.
+
+To use nano protobufs outside of Android repo:
+----------------------------------------------
+
+- Link with the generated jar file
+ \<protobuf-root\>java/target/protobuf-java-2.3.0-nano.jar.
+- Invoke with --javanano_out, e.g.:
+```
+./protoc '--javanano_out=\
+ java_package=src/proto/simple-data.proto|my_package,\
+ java_outer_classname=src/proto/simple-data.proto|OuterName\
+ :.' src/proto/simple-data.proto
+```
+
+Contributing to nano:
+---------------------
+
+Please add/edit tests in NanoTest.java.
+
+Please run the following steps to test:
+
+- cd external/protobuf
+- ./configure
+- Run "make -j12 check" and verify all tests pass.
+- cd java
+- Run "mvn test" and verify all tests pass.
+- cd ../../..
+- . build/envsetup.sh
+- lunch 1
+- "make -j12 aprotoc libprotobuf-java-2.3.0-nano aprotoc-test-nano-params NanoAndroidTest" and
+ check for build errors.
+- Plug in an Android device or start an emulator.
+- adb install -r out/target/product/generic/data/app/NanoAndroidTest.apk
+- Run:
+ "adb shell am instrument -w com.google.protobuf.nano.test/android.test.InstrumentationTestRunner"
+ and verify all tests pass.
+- repo sync -c -j256
+- "make -j12" and check for build errors
+
+Usage
+-----
+
+The complete documentation for Protocol Buffers is available via the
+web at:
+
+ https://developers.google.com/protocol-buffers/
diff --git a/third_party/protobuf/3.4.0/javanano/pom.xml b/third_party/protobuf/3.4.0/javanano/pom.xml
new file mode 100644
index 0000000000..0395e8f2dc
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/pom.xml
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.google</groupId>
+ <artifactId>google</artifactId>
+ <version>1</version>
+ </parent>
+ <groupId>com.google.protobuf.nano</groupId>
+ <artifactId>protobuf-javanano</artifactId>
+ <version>3.2.0</version>
+ <packaging>bundle</packaging>
+ <name>Protocol Buffer JavaNano API</name>
+ <description>
+ Protocol Buffers are a way of encoding structured data in an efficient yet
+ extensible format.
+ </description>
+ <inceptionYear>2008</inceptionYear>
+ <url>https://developers.google.com/protocol-buffers/</url>
+ <licenses>
+ <license>
+ <name>3-Clause BSD License</name>
+ <url>https://opensource.org/licenses/BSD-3-Clause</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <scm>
+ <url>https://github.com/google/protobuf</url>
+ <connection>
+ scm:git:https://github.com/google/protobuf.git
+ </connection>
+ </scm>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="target/generated-test-sources" />
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=generate_equals=true:target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_simple_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_stringutf8_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_recursive_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_import_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_single_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_multiple_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_multiple_nameclash_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_enum_class_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_repeated_merge_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/map_test.proto" />
+ </exec>
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=store_unknown_fields=true,generate_equals=true,generate_clone=true:target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_extension_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_extension_singular_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_extension_repeated_nano.proto" />
+ </exec>
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=store_unknown_fields=true,generate_clone=true:target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_extension_packed_nano.proto" />
+ </exec>
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=java_nano_generate_has=true,generate_equals=true,generate_clone=true:target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_has_nano.proto" />
+ </exec>
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=optional_field_style=accessors,generate_equals=true:target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_accessors_nano.proto" />
+ </exec>
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=enum_style=java:target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_enum_class_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_enum_class_multiple_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_repeated_packables_nano.proto" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_enum_validity_nano.proto" />
+ </exec>
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=
+ optional_field_style=accessors,
+ java_outer_classname=google/protobuf/nano/unittest_enum_validity_nano.proto|EnumValidityAccessors
+ :target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_enum_validity_nano.proto" />
+ </exec>
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=optional_field_style=reftypes,generate_equals=true:target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_reference_types_nano.proto" />
+ </exec>
+ <exec executable="../src/protoc">
+ <arg value="--javanano_out=
+ optional_field_style=reftypes_compat_mode,
+ generate_equals=true,
+ java_outer_classname=google/protobuf/nano/unittest_reference_types_nano.proto|NanoReferenceTypesCompat
+ :target/generated-test-sources" />
+ <arg value="--proto_path=src/test/java/com" />
+ <arg value="src/test/java/com/google/protobuf/nano/unittest_reference_types_nano.proto" />
+ </exec>
+ </tasks>
+ <testSourceRoot>target/generated-test-sources</testSourceRoot>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL>
+ <Bundle-SymbolicName>com.google.protobuf.nano</Bundle-SymbolicName>
+ <Export-Package>com.google.protobuf.nano;version=3.0.0-alpha-7</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>release</id>
+ <distributionManagement>
+ <snapshotRepository>
+ <id>sonatype-nexus-staging</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ </snapshotRepository>
+ <repository>
+ <id>sonatype-nexus-staging</id>
+ <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
+ </repository>
+ </distributionManagement>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.3</version>
+ <extensions>true</extensions>
+ <configuration>
+ <serverId>sonatype-nexus-staging</serverId>
+ <nexusUrl>https://oss.sonatype.org/</nexusUrl>
+ <autoReleaseAfterClose>false</autoReleaseAfterClose>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java
new file mode 100644
index 0000000000..f399315511
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java
@@ -0,0 +1,683 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+
+/**
+ * Reads and decodes protocol message fields.
+ *
+ * This class contains two kinds of methods: methods that read specific
+ * protocol message constructs and field types (e.g. {@link #readTag()} and
+ * {@link #readInt32()}) and methods that read low-level values (e.g.
+ * {@link #readRawVarint32()} and {@link #readRawBytes}). If you are reading
+ * encoded protocol messages, you should use the former methods, but if you are
+ * reading some other format of your own design, use the latter.
+ *
+ * @author kenton@google.com Kenton Varda
+ */
+public final class CodedInputByteBufferNano {
+ /**
+ * Create a new CodedInputStream wrapping the given byte array.
+ */
+ public static CodedInputByteBufferNano newInstance(final byte[] buf) {
+ return newInstance(buf, 0, buf.length);
+ }
+
+ /**
+ * Create a new CodedInputStream wrapping the given byte array slice.
+ */
+ public static CodedInputByteBufferNano newInstance(final byte[] buf, final int off,
+ final int len) {
+ return new CodedInputByteBufferNano(buf, off, len);
+ }
+
+ // -----------------------------------------------------------------
+
+ /**
+ * Attempt to read a field tag, returning zero if we have reached EOF.
+ * Protocol message parsers use this to read tags, since a protocol message
+ * may legally end wherever a tag occurs, and zero is not a valid tag number.
+ */
+ public int readTag() throws IOException {
+ if (isAtEnd()) {
+ lastTag = 0;
+ return 0;
+ }
+
+ lastTag = readRawVarint32();
+ if (lastTag == 0) {
+ // If we actually read zero, that's not a valid tag.
+ throw InvalidProtocolBufferNanoException.invalidTag();
+ }
+ return lastTag;
+ }
+
+ /**
+ * Verifies that the last call to readTag() returned the given tag value.
+ * This is used to verify that a nested group ended with the correct
+ * end tag.
+ *
+ * @throws InvalidProtocolBufferNanoException {@code value} does not match the
+ * last tag.
+ */
+ public void checkLastTagWas(final int value)
+ throws InvalidProtocolBufferNanoException {
+ if (lastTag != value) {
+ throw InvalidProtocolBufferNanoException.invalidEndTag();
+ }
+ }
+
+ /**
+ * Reads and discards a single field, given its tag value.
+ *
+ * @return {@code false} if the tag is an endgroup tag, in which case
+ * nothing is skipped. Otherwise, returns {@code true}.
+ */
+ public boolean skipField(final int tag) throws IOException {
+ switch (WireFormatNano.getTagWireType(tag)) {
+ case WireFormatNano.WIRETYPE_VARINT:
+ readInt32();
+ return true;
+ case WireFormatNano.WIRETYPE_FIXED64:
+ readRawLittleEndian64();
+ return true;
+ case WireFormatNano.WIRETYPE_LENGTH_DELIMITED:
+ skipRawBytes(readRawVarint32());
+ return true;
+ case WireFormatNano.WIRETYPE_START_GROUP:
+ skipMessage();
+ checkLastTagWas(
+ WireFormatNano.makeTag(WireFormatNano.getTagFieldNumber(tag),
+ WireFormatNano.WIRETYPE_END_GROUP));
+ return true;
+ case WireFormatNano.WIRETYPE_END_GROUP:
+ return false;
+ case WireFormatNano.WIRETYPE_FIXED32:
+ readRawLittleEndian32();
+ return true;
+ default:
+ throw InvalidProtocolBufferNanoException.invalidWireType();
+ }
+ }
+
+ /**
+ * Reads and discards an entire message. This will read either until EOF
+ * or until an endgroup tag, whichever comes first.
+ */
+ public void skipMessage() throws IOException {
+ while (true) {
+ final int tag = readTag();
+ if (tag == 0 || !skipField(tag)) {
+ return;
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------
+
+ /** Read a {@code double} field value from the stream. */
+ public double readDouble() throws IOException {
+ return Double.longBitsToDouble(readRawLittleEndian64());
+ }
+
+ /** Read a {@code float} field value from the stream. */
+ public float readFloat() throws IOException {
+ return Float.intBitsToFloat(readRawLittleEndian32());
+ }
+
+ /** Read a {@code uint64} field value from the stream. */
+ public long readUInt64() throws IOException {
+ return readRawVarint64();
+ }
+
+ /** Read an {@code int64} field value from the stream. */
+ public long readInt64() throws IOException {
+ return readRawVarint64();
+ }
+
+ /** Read an {@code int32} field value from the stream. */
+ public int readInt32() throws IOException {
+ return readRawVarint32();
+ }
+
+ /** Read a {@code fixed64} field value from the stream. */
+ public long readFixed64() throws IOException {
+ return readRawLittleEndian64();
+ }
+
+ /** Read a {@code fixed32} field value from the stream. */
+ public int readFixed32() throws IOException {
+ return readRawLittleEndian32();
+ }
+
+ /** Read a {@code bool} field value from the stream. */
+ public boolean readBool() throws IOException {
+ return readRawVarint32() != 0;
+ }
+
+ /** Read a {@code string} field value from the stream. */
+ public String readString() throws IOException {
+ final int size = readRawVarint32();
+ if (size <= (bufferSize - bufferPos) && size > 0) {
+ // Fast path: We already have the bytes in a contiguous buffer, so
+ // just copy directly from it.
+ final String result = new String(buffer, bufferPos, size, InternalNano.UTF_8);
+ bufferPos += size;
+ return result;
+ } else {
+ // Slow path: Build a byte array first then copy it.
+ return new String(readRawBytes(size), InternalNano.UTF_8);
+ }
+ }
+
+ /** Read a {@code group} field value from the stream. */
+ public void readGroup(final MessageNano msg, final int fieldNumber)
+ throws IOException {
+ if (recursionDepth >= recursionLimit) {
+ throw InvalidProtocolBufferNanoException.recursionLimitExceeded();
+ }
+ ++recursionDepth;
+ msg.mergeFrom(this);
+ checkLastTagWas(
+ WireFormatNano.makeTag(fieldNumber, WireFormatNano.WIRETYPE_END_GROUP));
+ --recursionDepth;
+ }
+
+ public void readMessage(final MessageNano msg)
+ throws IOException {
+ final int length = readRawVarint32();
+ if (recursionDepth >= recursionLimit) {
+ throw InvalidProtocolBufferNanoException.recursionLimitExceeded();
+ }
+ final int oldLimit = pushLimit(length);
+ ++recursionDepth;
+ msg.mergeFrom(this);
+ checkLastTagWas(0);
+ --recursionDepth;
+ popLimit(oldLimit);
+ }
+
+ /** Read a {@code bytes} field value from the stream. */
+ public byte[] readBytes() throws IOException {
+ final int size = readRawVarint32();
+ if (size <= (bufferSize - bufferPos) && size > 0) {
+ // Fast path: We already have the bytes in a contiguous buffer, so
+ // just copy directly from it.
+ final byte[] result = new byte[size];
+ System.arraycopy(buffer, bufferPos, result, 0, size);
+ bufferPos += size;
+ return result;
+ } else if (size == 0) {
+ return WireFormatNano.EMPTY_BYTES;
+ } else {
+ // Slow path: Build a byte array first then copy it.
+ return readRawBytes(size);
+ }
+ }
+
+ /** Read a {@code uint32} field value from the stream. */
+ public int readUInt32() throws IOException {
+ return readRawVarint32();
+ }
+
+ /**
+ * Read an enum field value from the stream. Caller is responsible
+ * for converting the numeric value to an actual enum.
+ */
+ public int readEnum() throws IOException {
+ return readRawVarint32();
+ }
+
+ /** Read an {@code sfixed32} field value from the stream. */
+ public int readSFixed32() throws IOException {
+ return readRawLittleEndian32();
+ }
+
+ /** Read an {@code sfixed64} field value from the stream. */
+ public long readSFixed64() throws IOException {
+ return readRawLittleEndian64();
+ }
+
+ /** Read an {@code sint32} field value from the stream. */
+ public int readSInt32() throws IOException {
+ return decodeZigZag32(readRawVarint32());
+ }
+
+ /** Read an {@code sint64} field value from the stream. */
+ public long readSInt64() throws IOException {
+ return decodeZigZag64(readRawVarint64());
+ }
+
+ // =================================================================
+
+ /**
+ * Read a raw Varint from the stream. If larger than 32 bits, discard the
+ * upper bits.
+ */
+ public int readRawVarint32() throws IOException {
+ byte tmp = readRawByte();
+ if (tmp >= 0) {
+ return tmp;
+ }
+ int result = tmp & 0x7f;
+ if ((tmp = readRawByte()) >= 0) {
+ result |= tmp << 7;
+ } else {
+ result |= (tmp & 0x7f) << 7;
+ if ((tmp = readRawByte()) >= 0) {
+ result |= tmp << 14;
+ } else {
+ result |= (tmp & 0x7f) << 14;
+ if ((tmp = readRawByte()) >= 0) {
+ result |= tmp << 21;
+ } else {
+ result |= (tmp & 0x7f) << 21;
+ result |= (tmp = readRawByte()) << 28;
+ if (tmp < 0) {
+ // Discard upper 32 bits.
+ for (int i = 0; i < 5; i++) {
+ if (readRawByte() >= 0) {
+ return result;
+ }
+ }
+ throw InvalidProtocolBufferNanoException.malformedVarint();
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /** Read a raw Varint from the stream. */
+ public long readRawVarint64() throws IOException {
+ int shift = 0;
+ long result = 0;
+ while (shift < 64) {
+ final byte b = readRawByte();
+ result |= (long)(b & 0x7F) << shift;
+ if ((b & 0x80) == 0) {
+ return result;
+ }
+ shift += 7;
+ }
+ throw InvalidProtocolBufferNanoException.malformedVarint();
+ }
+
+ /** Read a 32-bit little-endian integer from the stream. */
+ public int readRawLittleEndian32() throws IOException {
+ final byte b1 = readRawByte();
+ final byte b2 = readRawByte();
+ final byte b3 = readRawByte();
+ final byte b4 = readRawByte();
+ return ((b1 & 0xff) ) |
+ ((b2 & 0xff) << 8) |
+ ((b3 & 0xff) << 16) |
+ ((b4 & 0xff) << 24);
+ }
+
+ /** Read a 64-bit little-endian integer from the stream. */
+ public long readRawLittleEndian64() throws IOException {
+ final byte b1 = readRawByte();
+ final byte b2 = readRawByte();
+ final byte b3 = readRawByte();
+ final byte b4 = readRawByte();
+ final byte b5 = readRawByte();
+ final byte b6 = readRawByte();
+ final byte b7 = readRawByte();
+ final byte b8 = readRawByte();
+ return (((long)b1 & 0xff) ) |
+ (((long)b2 & 0xff) << 8) |
+ (((long)b3 & 0xff) << 16) |
+ (((long)b4 & 0xff) << 24) |
+ (((long)b5 & 0xff) << 32) |
+ (((long)b6 & 0xff) << 40) |
+ (((long)b7 & 0xff) << 48) |
+ (((long)b8 & 0xff) << 56);
+ }
+
+ /**
+ * Decode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers
+ * into values that can be efficiently encoded with varint. (Otherwise,
+ * negative values must be sign-extended to 64 bits to be varint encoded,
+ * thus always taking 10 bytes on the wire.)
+ *
+ * @param n An unsigned 32-bit integer, stored in a signed int because
+ * Java has no explicit unsigned support.
+ * @return A signed 32-bit integer.
+ */
+ public static int decodeZigZag32(final int n) {
+ return (n >>> 1) ^ -(n & 1);
+ }
+
+ /**
+ * Decode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers
+ * into values that can be efficiently encoded with varint. (Otherwise,
+ * negative values must be sign-extended to 64 bits to be varint encoded,
+ * thus always taking 10 bytes on the wire.)
+ *
+ * @param n An unsigned 64-bit integer, stored in a signed int because
+ * Java has no explicit unsigned support.
+ * @return A signed 64-bit integer.
+ */
+ public static long decodeZigZag64(final long n) {
+ return (n >>> 1) ^ -(n & 1);
+ }
+
+ // -----------------------------------------------------------------
+
+ private final byte[] buffer;
+ private int bufferStart;
+ private int bufferSize;
+ private int bufferSizeAfterLimit;
+ private int bufferPos;
+ private int lastTag;
+
+ /** The absolute position of the end of the current message. */
+ private int currentLimit = Integer.MAX_VALUE;
+
+ /** See setRecursionLimit() */
+ private int recursionDepth;
+ private int recursionLimit = DEFAULT_RECURSION_LIMIT;
+
+ /** See setSizeLimit() */
+ private int sizeLimit = DEFAULT_SIZE_LIMIT;
+
+ private static final int DEFAULT_RECURSION_LIMIT = 64;
+ private static final int DEFAULT_SIZE_LIMIT = 64 << 20; // 64MB
+
+ private CodedInputByteBufferNano(final byte[] buffer, final int off, final int len) {
+ this.buffer = buffer;
+ bufferStart = off;
+ bufferSize = off + len;
+ bufferPos = off;
+ }
+
+ /**
+ * Set the maximum message recursion depth. In order to prevent malicious
+ * messages from causing stack overflows, {@code CodedInputStream} limits
+ * how deeply messages may be nested. The default limit is 64.
+ *
+ * @return the old limit.
+ */
+ public int setRecursionLimit(final int limit) {
+ if (limit < 0) {
+ throw new IllegalArgumentException(
+ "Recursion limit cannot be negative: " + limit);
+ }
+ final int oldLimit = recursionLimit;
+ recursionLimit = limit;
+ return oldLimit;
+ }
+
+ /**
+ * Set the maximum message size. In order to prevent malicious
+ * messages from exhausting memory or causing integer overflows,
+ * {@code CodedInputStream} limits how large a message may be.
+ * The default limit is 64MB. You should set this limit as small
+ * as you can without harming your app's functionality. Note that
+ * size limits only apply when reading from an {@code InputStream}, not
+ * when constructed around a raw byte array.
+ * <p>
+ * If you want to read several messages from a single CodedInputStream, you
+ * could call {@link #resetSizeCounter()} after each one to avoid hitting the
+ * size limit.
+ *
+ * @return the old limit.
+ */
+ public int setSizeLimit(final int limit) {
+ if (limit < 0) {
+ throw new IllegalArgumentException(
+ "Size limit cannot be negative: " + limit);
+ }
+ final int oldLimit = sizeLimit;
+ sizeLimit = limit;
+ return oldLimit;
+ }
+
+ /**
+ * Resets the current size counter to zero (see {@link #setSizeLimit(int)}).
+ */
+ public void resetSizeCounter() {
+ }
+
+ /**
+ * Sets {@code currentLimit} to (current position) + {@code byteLimit}. This
+ * is called when descending into a length-delimited embedded message.
+ *
+ * @return the old limit.
+ */
+ public int pushLimit(int byteLimit) throws InvalidProtocolBufferNanoException {
+ if (byteLimit < 0) {
+ throw InvalidProtocolBufferNanoException.negativeSize();
+ }
+ byteLimit += bufferPos;
+ final int oldLimit = currentLimit;
+ if (byteLimit > oldLimit) {
+ throw InvalidProtocolBufferNanoException.truncatedMessage();
+ }
+ currentLimit = byteLimit;
+
+ recomputeBufferSizeAfterLimit();
+
+ return oldLimit;
+ }
+
+ private void recomputeBufferSizeAfterLimit() {
+ bufferSize += bufferSizeAfterLimit;
+ final int bufferEnd = bufferSize;
+ if (bufferEnd > currentLimit) {
+ // Limit is in current buffer.
+ bufferSizeAfterLimit = bufferEnd - currentLimit;
+ bufferSize -= bufferSizeAfterLimit;
+ } else {
+ bufferSizeAfterLimit = 0;
+ }
+ }
+
+ /**
+ * Discards the current limit, returning to the previous limit.
+ *
+ * @param oldLimit The old limit, as returned by {@code pushLimit}.
+ */
+ public void popLimit(final int oldLimit) {
+ currentLimit = oldLimit;
+ recomputeBufferSizeAfterLimit();
+ }
+
+ /**
+ * Returns the number of bytes to be read before the current limit.
+ * If no limit is set, returns -1.
+ */
+ public int getBytesUntilLimit() {
+ if (currentLimit == Integer.MAX_VALUE) {
+ return -1;
+ }
+
+ final int currentAbsolutePosition = bufferPos;
+ return currentLimit - currentAbsolutePosition;
+ }
+
+ /**
+ * Returns true if the stream has reached the end of the input. This is the
+ * case if either the end of the underlying input source has been reached or
+ * if the stream has reached a limit created using {@link #pushLimit(int)}.
+ */
+ public boolean isAtEnd() {
+ return bufferPos == bufferSize;
+ }
+
+ /**
+ * Get current position in buffer relative to beginning offset.
+ */
+ public int getPosition() {
+ return bufferPos - bufferStart;
+ }
+
+ /**
+ * Retrieves a subset of data in the buffer. The returned array is not backed by the original
+ * buffer array.
+ *
+ * @param offset the position (relative to the buffer start position) to start at.
+ * @param length the number of bytes to retrieve.
+ */
+ public byte[] getData(int offset, int length) {
+ if (length == 0) {
+ return WireFormatNano.EMPTY_BYTES;
+ }
+ byte[] copy = new byte[length];
+ int start = bufferStart + offset;
+ System.arraycopy(buffer, start, copy, 0, length);
+ return copy;
+ }
+
+ /**
+ * Rewind to previous position. Cannot go forward.
+ */
+ public void rewindToPosition(int position) {
+ if (position > bufferPos - bufferStart) {
+ throw new IllegalArgumentException(
+ "Position " + position + " is beyond current " + (bufferPos - bufferStart));
+ }
+ if (position < 0) {
+ throw new IllegalArgumentException("Bad position " + position);
+ }
+ bufferPos = bufferStart + position;
+ }
+
+ /**
+ * Read one byte from the input.
+ *
+ * @throws InvalidProtocolBufferNanoException The end of the stream or the current
+ * limit was reached.
+ */
+ public byte readRawByte() throws IOException {
+ if (bufferPos == bufferSize) {
+ throw InvalidProtocolBufferNanoException.truncatedMessage();
+ }
+ return buffer[bufferPos++];
+ }
+
+ /**
+ * Read a fixed size of bytes from the input.
+ *
+ * @throws InvalidProtocolBufferNanoException The end of the stream or the current
+ * limit was reached.
+ */
+ public byte[] readRawBytes(final int size) throws IOException {
+ if (size < 0) {
+ throw InvalidProtocolBufferNanoException.negativeSize();
+ }
+
+ if (bufferPos + size > currentLimit) {
+ // Read to the end of the stream anyway.
+ skipRawBytes(currentLimit - bufferPos);
+ // Then fail.
+ throw InvalidProtocolBufferNanoException.truncatedMessage();
+ }
+
+ if (size <= bufferSize - bufferPos) {
+ // We have all the bytes we need already.
+ final byte[] bytes = new byte[size];
+ System.arraycopy(buffer, bufferPos, bytes, 0, size);
+ bufferPos += size;
+ return bytes;
+ } else {
+ throw InvalidProtocolBufferNanoException.truncatedMessage();
+ }
+ }
+
+ /**
+ * Reads and discards {@code size} bytes.
+ *
+ * @throws InvalidProtocolBufferNanoException The end of the stream or the current
+ * limit was reached.
+ */
+ public void skipRawBytes(final int size) throws IOException {
+ if (size < 0) {
+ throw InvalidProtocolBufferNanoException.negativeSize();
+ }
+
+ if (bufferPos + size > currentLimit) {
+ // Read to the end of the stream anyway.
+ skipRawBytes(currentLimit - bufferPos);
+ // Then fail.
+ throw InvalidProtocolBufferNanoException.truncatedMessage();
+ }
+
+ if (size <= bufferSize - bufferPos) {
+ // We have all the bytes we need already.
+ bufferPos += size;
+ } else {
+ throw InvalidProtocolBufferNanoException.truncatedMessage();
+ }
+ }
+
+ // Read a primitive type.
+ Object readPrimitiveField(int type) throws IOException {
+ switch (type) {
+ case InternalNano.TYPE_DOUBLE:
+ return readDouble();
+ case InternalNano.TYPE_FLOAT:
+ return readFloat();
+ case InternalNano.TYPE_INT64:
+ return readInt64();
+ case InternalNano.TYPE_UINT64:
+ return readUInt64();
+ case InternalNano.TYPE_INT32:
+ return readInt32();
+ case InternalNano.TYPE_FIXED64:
+ return readFixed64();
+ case InternalNano.TYPE_FIXED32:
+ return readFixed32();
+ case InternalNano.TYPE_BOOL:
+ return readBool();
+ case InternalNano.TYPE_STRING:
+ return readString();
+ case InternalNano.TYPE_BYTES:
+ return readBytes();
+ case InternalNano.TYPE_UINT32:
+ return readUInt32();
+ case InternalNano.TYPE_ENUM:
+ return readEnum();
+ case InternalNano.TYPE_SFIXED32:
+ return readSFixed32();
+ case InternalNano.TYPE_SFIXED64:
+ return readSFixed64();
+ case InternalNano.TYPE_SINT32:
+ return readSInt32();
+ case InternalNano.TYPE_SINT64:
+ return readSInt64();
+ default:
+ throw new IllegalArgumentException("Unknown type " + type);
+ }
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java
new file mode 100644
index 0000000000..322ada8e1f
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java
@@ -0,0 +1,1214 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.ReadOnlyBufferException;
+
+/**
+ * Encodes and writes protocol message fields.
+ *
+ * <p>This class contains two kinds of methods: methods that write specific
+ * protocol message constructs and field types (e.g. {@link #writeTag} and
+ * {@link #writeInt32}) and methods that write low-level values (e.g.
+ * {@link #writeRawVarint32} and {@link #writeRawBytes}). If you are
+ * writing encoded protocol messages, you should use the former methods, but if
+ * you are writing some other format of your own design, use the latter.
+ *
+ * <p>This class is totally unsynchronized.
+ *
+ * @author kneton@google.com Kenton Varda
+ */
+public final class CodedOutputByteBufferNano {
+ /* max bytes per java UTF-16 char in UTF-8 */
+ private static final int MAX_UTF8_EXPANSION = 3;
+ private final ByteBuffer buffer;
+
+ private CodedOutputByteBufferNano(final byte[] buffer, final int offset,
+ final int length) {
+ this(ByteBuffer.wrap(buffer, offset, length));
+ }
+
+ private CodedOutputByteBufferNano(final ByteBuffer buffer) {
+ this.buffer = buffer;
+ this.buffer.order(ByteOrder.LITTLE_ENDIAN);
+ }
+
+ /**
+ * Create a new {@code CodedOutputStream} that writes directly to the given
+ * byte array. If more bytes are written than fit in the array,
+ * {@link OutOfSpaceException} will be thrown. Writing directly to a flat
+ * array is faster than writing to an {@code OutputStream}.
+ */
+ public static CodedOutputByteBufferNano newInstance(final byte[] flatArray) {
+ return newInstance(flatArray, 0, flatArray.length);
+ }
+
+ /**
+ * Create a new {@code CodedOutputStream} that writes directly to the given
+ * byte array slice. If more bytes are written than fit in the slice,
+ * {@link OutOfSpaceException} will be thrown. Writing directly to a flat
+ * array is faster than writing to an {@code OutputStream}.
+ */
+ public static CodedOutputByteBufferNano newInstance(final byte[] flatArray,
+ final int offset,
+ final int length) {
+ return new CodedOutputByteBufferNano(flatArray, offset, length);
+ }
+
+ // -----------------------------------------------------------------
+
+ /** Write a {@code double} field, including tag, to the stream. */
+ public void writeDouble(final int fieldNumber, final double value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_FIXED64);
+ writeDoubleNoTag(value);
+ }
+
+ /** Write a {@code float} field, including tag, to the stream. */
+ public void writeFloat(final int fieldNumber, final float value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_FIXED32);
+ writeFloatNoTag(value);
+ }
+
+ /** Write a {@code uint64} field, including tag, to the stream. */
+ public void writeUInt64(final int fieldNumber, final long value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_VARINT);
+ writeUInt64NoTag(value);
+ }
+
+ /** Write an {@code int64} field, including tag, to the stream. */
+ public void writeInt64(final int fieldNumber, final long value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_VARINT);
+ writeInt64NoTag(value);
+ }
+
+ /** Write an {@code int32} field, including tag, to the stream. */
+ public void writeInt32(final int fieldNumber, final int value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_VARINT);
+ writeInt32NoTag(value);
+ }
+
+ /** Write a {@code fixed64} field, including tag, to the stream. */
+ public void writeFixed64(final int fieldNumber, final long value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_FIXED64);
+ writeFixed64NoTag(value);
+ }
+
+ /** Write a {@code fixed32} field, including tag, to the stream. */
+ public void writeFixed32(final int fieldNumber, final int value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_FIXED32);
+ writeFixed32NoTag(value);
+ }
+
+ /** Write a {@code bool} field, including tag, to the stream. */
+ public void writeBool(final int fieldNumber, final boolean value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_VARINT);
+ writeBoolNoTag(value);
+ }
+
+ /** Write a {@code string} field, including tag, to the stream. */
+ public void writeString(final int fieldNumber, final String value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_LENGTH_DELIMITED);
+ writeStringNoTag(value);
+ }
+
+ /** Write a {@code group} field, including tag, to the stream. */
+ public void writeGroup(final int fieldNumber, final MessageNano value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_START_GROUP);
+ writeGroupNoTag(value);
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_END_GROUP);
+ }
+
+ /** Write an embedded message field, including tag, to the stream. */
+ public void writeMessage(final int fieldNumber, final MessageNano value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_LENGTH_DELIMITED);
+ writeMessageNoTag(value);
+ }
+
+ /** Write a {@code bytes} field, including tag, to the stream. */
+ public void writeBytes(final int fieldNumber, final byte[] value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_LENGTH_DELIMITED);
+ writeBytesNoTag(value);
+ }
+
+ /** Write a {@code uint32} field, including tag, to the stream. */
+ public void writeUInt32(final int fieldNumber, final int value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_VARINT);
+ writeUInt32NoTag(value);
+ }
+
+ /**
+ * Write an enum field, including tag, to the stream. Caller is responsible
+ * for converting the enum value to its numeric value.
+ */
+ public void writeEnum(final int fieldNumber, final int value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_VARINT);
+ writeEnumNoTag(value);
+ }
+
+ /** Write an {@code sfixed32} field, including tag, to the stream. */
+ public void writeSFixed32(final int fieldNumber, final int value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_FIXED32);
+ writeSFixed32NoTag(value);
+ }
+
+ /** Write an {@code sfixed64} field, including tag, to the stream. */
+ public void writeSFixed64(final int fieldNumber, final long value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_FIXED64);
+ writeSFixed64NoTag(value);
+ }
+
+ /** Write an {@code sint32} field, including tag, to the stream. */
+ public void writeSInt32(final int fieldNumber, final int value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_VARINT);
+ writeSInt32NoTag(value);
+ }
+
+ /** Write an {@code sint64} field, including tag, to the stream. */
+ public void writeSInt64(final int fieldNumber, final long value)
+ throws IOException {
+ writeTag(fieldNumber, WireFormatNano.WIRETYPE_VARINT);
+ writeSInt64NoTag(value);
+ }
+
+ /**
+ * Write a MessageSet extension field to the stream. For historical reasons,
+ * the wire format differs from normal fields.
+ */
+// public void writeMessageSetExtension(final int fieldNumber,
+// final MessageMicro value)
+// throws IOException {
+// writeTag(WireFormatMicro.MESSAGE_SET_ITEM, WireFormatMicro.WIRETYPE_START_GROUP);
+// writeUInt32(WireFormatMicro.MESSAGE_SET_TYPE_ID, fieldNumber);
+// writeMessage(WireFormatMicro.MESSAGE_SET_MESSAGE, value);
+// writeTag(WireFormatMicro.MESSAGE_SET_ITEM, WireFormatMicro.WIRETYPE_END_GROUP);
+// }
+
+ /**
+ * Write an unparsed MessageSet extension field to the stream. For
+ * historical reasons, the wire format differs from normal fields.
+ */
+// public void writeRawMessageSetExtension(final int fieldNumber,
+// final ByteStringMicro value)
+// throws IOException {
+// writeTag(WireFormatMicro.MESSAGE_SET_ITEM, WireFormatMicro.WIRETYPE_START_GROUP);
+// writeUInt32(WireFormatMicro.MESSAGE_SET_TYPE_ID, fieldNumber);
+// writeBytes(WireFormatMicro.MESSAGE_SET_MESSAGE, value);
+// writeTag(WireFormatMicro.MESSAGE_SET_ITEM, WireFormatMicro.WIRETYPE_END_GROUP);
+// }
+
+ // -----------------------------------------------------------------
+
+ /** Write a {@code double} field to the stream. */
+ public void writeDoubleNoTag(final double value) throws IOException {
+ writeRawLittleEndian64(Double.doubleToLongBits(value));
+ }
+
+ /** Write a {@code float} field to the stream. */
+ public void writeFloatNoTag(final float value) throws IOException {
+ writeRawLittleEndian32(Float.floatToIntBits(value));
+ }
+
+ /** Write a {@code uint64} field to the stream. */
+ public void writeUInt64NoTag(final long value) throws IOException {
+ writeRawVarint64(value);
+ }
+
+ /** Write an {@code int64} field to the stream. */
+ public void writeInt64NoTag(final long value) throws IOException {
+ writeRawVarint64(value);
+ }
+
+ /** Write an {@code int32} field to the stream. */
+ public void writeInt32NoTag(final int value) throws IOException {
+ if (value >= 0) {
+ writeRawVarint32(value);
+ } else {
+ // Must sign-extend.
+ writeRawVarint64(value);
+ }
+ }
+
+ /** Write a {@code fixed64} field to the stream. */
+ public void writeFixed64NoTag(final long value) throws IOException {
+ writeRawLittleEndian64(value);
+ }
+
+ /** Write a {@code fixed32} field to the stream. */
+ public void writeFixed32NoTag(final int value) throws IOException {
+ writeRawLittleEndian32(value);
+ }
+
+ /** Write a {@code bool} field to the stream. */
+ public void writeBoolNoTag(final boolean value) throws IOException {
+ writeRawByte(value ? 1 : 0);
+ }
+
+ /** Write a {@code string} field to the stream. */
+ public void writeStringNoTag(final String value) throws IOException {
+ // UTF-8 byte length of the string is at least its UTF-16 code unit length (value.length()),
+ // and at most 3 times of it. Optimize for the case where we know this length results in a
+ // constant varint length - saves measuring length of the string.
+ try {
+ final int minLengthVarIntSize = computeRawVarint32Size(value.length());
+ final int maxLengthVarIntSize = computeRawVarint32Size(value.length() * MAX_UTF8_EXPANSION);
+ if (minLengthVarIntSize == maxLengthVarIntSize) {
+ int oldPosition = buffer.position();
+ // Buffer.position, when passed a position that is past its limit, throws
+ // IllegalArgumentException, and this class is documented to throw
+ // OutOfSpaceException instead.
+ if (buffer.remaining() < minLengthVarIntSize) {
+ throw new OutOfSpaceException(oldPosition + minLengthVarIntSize, buffer.limit());
+ }
+ buffer.position(oldPosition + minLengthVarIntSize);
+ encode(value, buffer);
+ int newPosition = buffer.position();
+ buffer.position(oldPosition);
+ writeRawVarint32(newPosition - oldPosition - minLengthVarIntSize);
+ buffer.position(newPosition);
+ } else {
+ writeRawVarint32(encodedLength(value));
+ encode(value, buffer);
+ }
+ } catch (BufferOverflowException e) {
+ final OutOfSpaceException outOfSpaceException = new OutOfSpaceException(buffer.position(),
+ buffer.limit());
+ outOfSpaceException.initCause(e);
+ throw outOfSpaceException;
+ }
+ }
+
+ // These UTF-8 handling methods are copied from Guava's Utf8 class.
+ /**
+ * Returns the number of bytes in the UTF-8-encoded form of {@code sequence}. For a string,
+ * this method is equivalent to {@code string.getBytes(UTF_8).length}, but is more efficient in
+ * both time and space.
+ *
+ * @throws IllegalArgumentException if {@code sequence} contains ill-formed UTF-16 (unpaired
+ * surrogates)
+ */
+ private static int encodedLength(CharSequence sequence) {
+ // Warning to maintainers: this implementation is highly optimized.
+ int utf16Length = sequence.length();
+ int utf8Length = utf16Length;
+ int i = 0;
+
+ // This loop optimizes for pure ASCII.
+ while (i < utf16Length && sequence.charAt(i) < 0x80) {
+ i++;
+ }
+
+ // This loop optimizes for chars less than 0x800.
+ for (; i < utf16Length; i++) {
+ char c = sequence.charAt(i);
+ if (c < 0x800) {
+ utf8Length += ((0x7f - c) >>> 31); // branch free!
+ } else {
+ utf8Length += encodedLengthGeneral(sequence, i);
+ break;
+ }
+ }
+
+ if (utf8Length < utf16Length) {
+ // Necessary and sufficient condition for overflow because of maximum 3x expansion
+ throw new IllegalArgumentException("UTF-8 length does not fit in int: "
+ + (utf8Length + (1L << 32)));
+ }
+ return utf8Length;
+ }
+
+ private static int encodedLengthGeneral(CharSequence sequence, int start) {
+ int utf16Length = sequence.length();
+ int utf8Length = 0;
+ for (int i = start; i < utf16Length; i++) {
+ char c = sequence.charAt(i);
+ if (c < 0x800) {
+ utf8Length += (0x7f - c) >>> 31; // branch free!
+ } else {
+ utf8Length += 2;
+ // jdk7+: if (Character.isSurrogate(c)) {
+ 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) {
+ throw new IllegalArgumentException("Unpaired surrogate at index " + i);
+ }
+ i++;
+ }
+ }
+ }
+ return utf8Length;
+ }
+
+ /**
+ * Encodes {@code sequence} into UTF-8, in {@code byteBuffer}. For a string, this method is
+ * equivalent to {@code buffer.put(string.getBytes(UTF_8))}, but is more efficient in both time
+ * and space. Bytes are written starting at the current position. This method requires paired
+ * surrogates, and therefore does not support chunking.
+ *
+ * <p>To ensure sufficient space in the output buffer, either call {@link #encodedLength} to
+ * compute the exact amount needed, or leave room for {@code 3 * sequence.length()}, which is the
+ * largest possible number of bytes that any input can be encoded to.
+ *
+ * @throws IllegalArgumentException if {@code sequence} contains ill-formed UTF-16 (unpaired
+ * surrogates)
+ * @throws BufferOverflowException if {@code sequence} encoded in UTF-8 does not fit in
+ * {@code byteBuffer}'s remaining space.
+ * @throws ReadOnlyBufferException if {@code byteBuffer} is a read-only buffer.
+ */
+ private static void encode(CharSequence sequence, ByteBuffer byteBuffer) {
+ if (byteBuffer.isReadOnly()) {
+ throw new ReadOnlyBufferException();
+ } else if (byteBuffer.hasArray()) {
+ try {
+ int encoded = encode(sequence,
+ byteBuffer.array(),
+ byteBuffer.arrayOffset() + byteBuffer.position(),
+ byteBuffer.remaining());
+ byteBuffer.position(encoded - byteBuffer.arrayOffset());
+ } catch (ArrayIndexOutOfBoundsException e) {
+ BufferOverflowException boe = new BufferOverflowException();
+ boe.initCause(e);
+ throw boe;
+ }
+ } else {
+ encodeDirect(sequence, byteBuffer);
+ }
+ }
+
+ private static void encodeDirect(CharSequence sequence, ByteBuffer byteBuffer) {
+ int utf16Length = sequence.length();
+ for (int i = 0; i < utf16Length; i++) {
+ final char c = sequence.charAt(i);
+ if (c < 0x80) { // ASCII
+ byteBuffer.put((byte) c);
+ } else if (c < 0x800) { // 11 bits, two UTF-8 bytes
+ byteBuffer.put((byte) ((0xF << 6) | (c >>> 6)));
+ byteBuffer.put((byte) (0x80 | (0x3F & c)));
+ } else if (c < Character.MIN_SURROGATE || Character.MAX_SURROGATE < c) {
+ // Maximium single-char code point is 0xFFFF, 16 bits, three UTF-8 bytes
+ byteBuffer.put((byte) ((0xF << 5) | (c >>> 12)));
+ byteBuffer.put((byte) (0x80 | (0x3F & (c >>> 6))));
+ byteBuffer.put((byte) (0x80 | (0x3F & c)));
+ } else {
+ final char low;
+ if (i + 1 == sequence.length()
+ || !Character.isSurrogatePair(c, (low = sequence.charAt(++i)))) {
+ throw new IllegalArgumentException("Unpaired surrogate at index " + (i - 1));
+ }
+ int codePoint = Character.toCodePoint(c, low);
+ byteBuffer.put((byte) ((0xF << 4) | (codePoint >>> 18)));
+ byteBuffer.put((byte) (0x80 | (0x3F & (codePoint >>> 12))));
+ byteBuffer.put((byte) (0x80 | (0x3F & (codePoint >>> 6))));
+ byteBuffer.put((byte) (0x80 | (0x3F & codePoint)));
+ }
+ }
+ }
+
+ private static int encode(CharSequence sequence, byte[] bytes, int offset, int length) {
+ int utf16Length = sequence.length();
+ int j = offset;
+ int i = 0;
+ int limit = offset + length;
+ // Designed to take advantage of
+ // https://wikis.oracle.com/display/HotSpotInternals/RangeCheckElimination
+ for (char c; i < utf16Length && i + j < limit && (c = sequence.charAt(i)) < 0x80; i++) {
+ bytes[j + i] = (byte) c;
+ }
+ if (i == utf16Length) {
+ return j + utf16Length;
+ }
+ j += i;
+ for (char c; i < utf16Length; i++) {
+ c = sequence.charAt(i);
+ if (c < 0x80 && j < limit) {
+ bytes[j++] = (byte) c;
+ } else if (c < 0x800 && j <= limit - 2) { // 11 bits, two UTF-8 bytes
+ bytes[j++] = (byte) ((0xF << 6) | (c >>> 6));
+ bytes[j++] = (byte) (0x80 | (0x3F & c));
+ } else if ((c < Character.MIN_SURROGATE || Character.MAX_SURROGATE < c) && j <= limit - 3) {
+ // Maximum single-char code point is 0xFFFF, 16 bits, three UTF-8 bytes
+ bytes[j++] = (byte) ((0xF << 5) | (c >>> 12));
+ bytes[j++] = (byte) (0x80 | (0x3F & (c >>> 6)));
+ bytes[j++] = (byte) (0x80 | (0x3F & c));
+ } else if (j <= limit - 4) {
+ // Minimum code point represented by a surrogate pair is 0x10000, 17 bits, four UTF-8 bytes
+ final char low;
+ if (i + 1 == sequence.length()
+ || !Character.isSurrogatePair(c, (low = sequence.charAt(++i)))) {
+ throw new IllegalArgumentException("Unpaired surrogate at index " + (i - 1));
+ }
+ int codePoint = Character.toCodePoint(c, low);
+ bytes[j++] = (byte) ((0xF << 4) | (codePoint >>> 18));
+ bytes[j++] = (byte) (0x80 | (0x3F & (codePoint >>> 12)));
+ bytes[j++] = (byte) (0x80 | (0x3F & (codePoint >>> 6)));
+ bytes[j++] = (byte) (0x80 | (0x3F & codePoint));
+ } else {
+ throw new ArrayIndexOutOfBoundsException("Failed writing " + c + " at index " + j);
+ }
+ }
+ return j;
+ }
+
+ // End guava UTF-8 methods
+
+
+ /** Write a {@code group} field to the stream. */
+ public void writeGroupNoTag(final MessageNano value) throws IOException {
+ value.writeTo(this);
+ }
+
+ /** Write an embedded message field to the stream. */
+ public void writeMessageNoTag(final MessageNano value) throws IOException {
+ writeRawVarint32(value.getCachedSize());
+ value.writeTo(this);
+ }
+
+ /** Write a {@code bytes} field to the stream. */
+ public void writeBytesNoTag(final byte[] value) throws IOException {
+ writeRawVarint32(value.length);
+ writeRawBytes(value);
+ }
+
+ /** Write a {@code uint32} field to the stream. */
+ public void writeUInt32NoTag(final int value) throws IOException {
+ writeRawVarint32(value);
+ }
+
+ /**
+ * Write an enum field to the stream. Caller is responsible
+ * for converting the enum value to its numeric value.
+ */
+ public void writeEnumNoTag(final int value) throws IOException {
+ writeRawVarint32(value);
+ }
+
+ /** Write an {@code sfixed32} field to the stream. */
+ public void writeSFixed32NoTag(final int value) throws IOException {
+ writeRawLittleEndian32(value);
+ }
+
+ /** Write an {@code sfixed64} field to the stream. */
+ public void writeSFixed64NoTag(final long value) throws IOException {
+ writeRawLittleEndian64(value);
+ }
+
+ /** Write an {@code sint32} field to the stream. */
+ public void writeSInt32NoTag(final int value) throws IOException {
+ writeRawVarint32(encodeZigZag32(value));
+ }
+
+ /** Write an {@code sint64} field to the stream. */
+ public void writeSInt64NoTag(final long value) throws IOException {
+ writeRawVarint64(encodeZigZag64(value));
+ }
+
+ // =================================================================
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code double} field, including tag.
+ */
+ public static int computeDoubleSize(final int fieldNumber,
+ final double value) {
+ return computeTagSize(fieldNumber) + computeDoubleSizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code float} field, including tag.
+ */
+ public static int computeFloatSize(final int fieldNumber, final float value) {
+ return computeTagSize(fieldNumber) + computeFloatSizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code uint64} field, including tag.
+ */
+ public static int computeUInt64Size(final int fieldNumber, final long value) {
+ return computeTagSize(fieldNumber) + computeUInt64SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code int64} field, including tag.
+ */
+ public static int computeInt64Size(final int fieldNumber, final long value) {
+ return computeTagSize(fieldNumber) + computeInt64SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code int32} field, including tag.
+ */
+ public static int computeInt32Size(final int fieldNumber, final int value) {
+ return computeTagSize(fieldNumber) + computeInt32SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code fixed64} field, including tag.
+ */
+ public static int computeFixed64Size(final int fieldNumber,
+ final long value) {
+ return computeTagSize(fieldNumber) + computeFixed64SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code fixed32} field, including tag.
+ */
+ public static int computeFixed32Size(final int fieldNumber,
+ final int value) {
+ return computeTagSize(fieldNumber) + computeFixed32SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code bool} field, including tag.
+ */
+ public static int computeBoolSize(final int fieldNumber,
+ final boolean value) {
+ return computeTagSize(fieldNumber) + computeBoolSizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code string} field, including tag.
+ */
+ public static int computeStringSize(final int fieldNumber,
+ final String value) {
+ return computeTagSize(fieldNumber) + computeStringSizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code group} field, including tag.
+ */
+ public static int computeGroupSize(final int fieldNumber,
+ final MessageNano value) {
+ return computeTagSize(fieldNumber) * 2 + computeGroupSizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * embedded message field, including tag.
+ */
+ public static int computeMessageSize(final int fieldNumber,
+ final MessageNano value) {
+ return computeTagSize(fieldNumber) + computeMessageSizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code bytes} field, including tag.
+ */
+ public static int computeBytesSize(final int fieldNumber,
+ final byte[] value) {
+ return computeTagSize(fieldNumber) + computeBytesSizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code uint32} field, including tag.
+ */
+ public static int computeUInt32Size(final int fieldNumber, final int value) {
+ return computeTagSize(fieldNumber) + computeUInt32SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * enum field, including tag. Caller is responsible for converting the
+ * enum value to its numeric value.
+ */
+ public static int computeEnumSize(final int fieldNumber, final int value) {
+ return computeTagSize(fieldNumber) + computeEnumSizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code sfixed32} field, including tag.
+ */
+ public static int computeSFixed32Size(final int fieldNumber,
+ final int value) {
+ return computeTagSize(fieldNumber) + computeSFixed32SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code sfixed64} field, including tag.
+ */
+ public static int computeSFixed64Size(final int fieldNumber,
+ final long value) {
+ return computeTagSize(fieldNumber) + computeSFixed64SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code sint32} field, including tag.
+ */
+ public static int computeSInt32Size(final int fieldNumber, final int value) {
+ return computeTagSize(fieldNumber) + computeSInt32SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code sint64} field, including tag.
+ */
+ public static int computeSInt64Size(final int fieldNumber, final long value) {
+ return computeTagSize(fieldNumber) + computeSInt64SizeNoTag(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * MessageSet extension to the stream. For historical reasons,
+ * the wire format differs from normal fields.
+ */
+// public static int computeMessageSetExtensionSize(
+// final int fieldNumber, final MessageMicro value) {
+// return computeTagSize(WireFormatMicro.MESSAGE_SET_ITEM) * 2 +
+// computeUInt32Size(WireFormatMicro.MESSAGE_SET_TYPE_ID, fieldNumber) +
+// computeMessageSize(WireFormatMicro.MESSAGE_SET_MESSAGE, value);
+// }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * unparsed MessageSet extension field to the stream. For
+ * historical reasons, the wire format differs from normal fields.
+ */
+// public static int computeRawMessageSetExtensionSize(
+// final int fieldNumber, final ByteStringMicro value) {
+// return computeTagSize(WireFormatMicro.MESSAGE_SET_ITEM) * 2 +
+// computeUInt32Size(WireFormatMicro.MESSAGE_SET_TYPE_ID, fieldNumber) +
+// computeBytesSize(WireFormatMicro.MESSAGE_SET_MESSAGE, value);
+// }
+
+ // -----------------------------------------------------------------
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code double} field, including tag.
+ */
+ public static int computeDoubleSizeNoTag(final double value) {
+ return LITTLE_ENDIAN_64_SIZE;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code float} field, including tag.
+ */
+ public static int computeFloatSizeNoTag(final float value) {
+ return LITTLE_ENDIAN_32_SIZE;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code uint64} field, including tag.
+ */
+ public static int computeUInt64SizeNoTag(final long value) {
+ return computeRawVarint64Size(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code int64} field, including tag.
+ */
+ public static int computeInt64SizeNoTag(final long value) {
+ return computeRawVarint64Size(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code int32} field, including tag.
+ */
+ public static int computeInt32SizeNoTag(final int value) {
+ if (value >= 0) {
+ return computeRawVarint32Size(value);
+ } else {
+ // Must sign-extend.
+ return 10;
+ }
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code fixed64} field.
+ */
+ public static int computeFixed64SizeNoTag(final long value) {
+ return LITTLE_ENDIAN_64_SIZE;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code fixed32} field.
+ */
+ public static int computeFixed32SizeNoTag(final int value) {
+ return LITTLE_ENDIAN_32_SIZE;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code bool} field.
+ */
+ public static int computeBoolSizeNoTag(final boolean value) {
+ return 1;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code string} field.
+ */
+ public static int computeStringSizeNoTag(final String value) {
+ final int length = encodedLength(value);
+ return computeRawVarint32Size(length) + length;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code group} field.
+ */
+ public static int computeGroupSizeNoTag(final MessageNano value) {
+ return value.getSerializedSize();
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an embedded
+ * message field.
+ */
+ public static int computeMessageSizeNoTag(final MessageNano value) {
+ final int size = value.getSerializedSize();
+ return computeRawVarint32Size(size) + size;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code bytes} field.
+ */
+ public static int computeBytesSizeNoTag(final byte[] value) {
+ return computeRawVarint32Size(value.length) + value.length;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a
+ * {@code uint32} field.
+ */
+ public static int computeUInt32SizeNoTag(final int value) {
+ return computeRawVarint32Size(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an enum field.
+ * Caller is responsible for converting the enum value to its numeric value.
+ */
+ public static int computeEnumSizeNoTag(final int value) {
+ return computeRawVarint32Size(value);
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code sfixed32} field.
+ */
+ public static int computeSFixed32SizeNoTag(final int value) {
+ return LITTLE_ENDIAN_32_SIZE;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code sfixed64} field.
+ */
+ public static int computeSFixed64SizeNoTag(final long value) {
+ return LITTLE_ENDIAN_64_SIZE;
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code sint32} field.
+ */
+ public static int computeSInt32SizeNoTag(final int value) {
+ return computeRawVarint32Size(encodeZigZag32(value));
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode an
+ * {@code sint64} field.
+ */
+ public static int computeSInt64SizeNoTag(final long value) {
+ return computeRawVarint64Size(encodeZigZag64(value));
+ }
+
+ // =================================================================
+
+ /**
+ * If writing to a flat array, return the space left in the array.
+ * Otherwise, throws {@code UnsupportedOperationException}.
+ */
+ public int spaceLeft() {
+ return buffer.remaining();
+ }
+
+ /**
+ * Verifies that {@link #spaceLeft()} returns zero. It's common to create
+ * a byte array that is exactly big enough to hold a message, then write to
+ * it with a {@code CodedOutputStream}. Calling {@code checkNoSpaceLeft()}
+ * after writing verifies that the message was actually as big as expected,
+ * which can help catch bugs.
+ */
+ public void checkNoSpaceLeft() {
+ if (spaceLeft() != 0) {
+ throw new IllegalStateException(
+ "Did not write as much data as expected.");
+ }
+ }
+
+ /**
+ * Returns the position within the internal buffer.
+ */
+ public int position() {
+ return buffer.position();
+ }
+
+ /**
+ * Resets the position within the internal buffer to zero.
+ *
+ * @see #position
+ * @see #spaceLeft
+ */
+ public void reset() {
+ buffer.clear();
+ }
+
+ /**
+ * If you create a CodedOutputStream around a simple flat array, you must
+ * not attempt to write more bytes than the array has space. Otherwise,
+ * this exception will be thrown.
+ */
+ public static class OutOfSpaceException extends IOException {
+ private static final long serialVersionUID = -6947486886997889499L;
+
+ OutOfSpaceException(int position, int limit) {
+ super("CodedOutputStream was writing to a flat byte array and ran " +
+ "out of space (pos " + position + " limit " + limit + ").");
+ }
+ }
+
+ /** Write a single byte. */
+ public void writeRawByte(final byte value) throws IOException {
+ if (!buffer.hasRemaining()) {
+ // We're writing to a single buffer.
+ throw new OutOfSpaceException(buffer.position(), buffer.limit());
+ }
+
+ buffer.put(value);
+ }
+
+ /** Write a single byte, represented by an integer value. */
+ public void writeRawByte(final int value) throws IOException {
+ writeRawByte((byte) value);
+ }
+
+ /** Write an array of bytes. */
+ public void writeRawBytes(final byte[] value) throws IOException {
+ writeRawBytes(value, 0, value.length);
+ }
+
+ /** Write part of an array of bytes. */
+ public void writeRawBytes(final byte[] value, int offset, int length)
+ throws IOException {
+ if (buffer.remaining() >= length) {
+ buffer.put(value, offset, length);
+ } else {
+ // We're writing to a single buffer.
+ throw new OutOfSpaceException(buffer.position(), buffer.limit());
+ }
+ }
+
+ /** Encode and write a tag. */
+ public void writeTag(final int fieldNumber, final int wireType)
+ throws IOException {
+ writeRawVarint32(WireFormatNano.makeTag(fieldNumber, wireType));
+ }
+
+ /** Compute the number of bytes that would be needed to encode a tag. */
+ public static int computeTagSize(final int fieldNumber) {
+ return computeRawVarint32Size(WireFormatNano.makeTag(fieldNumber, 0));
+ }
+
+ /**
+ * Encode and write a varint. {@code value} is treated as
+ * unsigned, so it won't be sign-extended if negative.
+ */
+ public void writeRawVarint32(int value) throws IOException {
+ while (true) {
+ if ((value & ~0x7F) == 0) {
+ writeRawByte(value);
+ return;
+ } else {
+ writeRawByte((value & 0x7F) | 0x80);
+ value >>>= 7;
+ }
+ }
+ }
+
+ /**
+ * Compute the number of bytes that would be needed to encode a varint.
+ * {@code value} is treated as unsigned, so it won't be sign-extended if
+ * negative.
+ */
+ public static int computeRawVarint32Size(final int value) {
+ if ((value & (0xffffffff << 7)) == 0) return 1;
+ if ((value & (0xffffffff << 14)) == 0) return 2;
+ if ((value & (0xffffffff << 21)) == 0) return 3;
+ if ((value & (0xffffffff << 28)) == 0) return 4;
+ return 5;
+ }
+
+ /** Encode and write a varint. */
+ public void writeRawVarint64(long value) throws IOException {
+ while (true) {
+ if ((value & ~0x7FL) == 0) {
+ writeRawByte((int)value);
+ return;
+ } else {
+ writeRawByte(((int)value & 0x7F) | 0x80);
+ value >>>= 7;
+ }
+ }
+ }
+
+ /** Compute the number of bytes that would be needed to encode a varint. */
+ public static int computeRawVarint64Size(final long value) {
+ if ((value & (0xffffffffffffffffL << 7)) == 0) return 1;
+ if ((value & (0xffffffffffffffffL << 14)) == 0) return 2;
+ if ((value & (0xffffffffffffffffL << 21)) == 0) return 3;
+ if ((value & (0xffffffffffffffffL << 28)) == 0) return 4;
+ if ((value & (0xffffffffffffffffL << 35)) == 0) return 5;
+ if ((value & (0xffffffffffffffffL << 42)) == 0) return 6;
+ if ((value & (0xffffffffffffffffL << 49)) == 0) return 7;
+ if ((value & (0xffffffffffffffffL << 56)) == 0) return 8;
+ if ((value & (0xffffffffffffffffL << 63)) == 0) return 9;
+ return 10;
+ }
+
+ /** Write a little-endian 32-bit integer. */
+ public void writeRawLittleEndian32(final int value) throws IOException {
+ if (buffer.remaining() < 4) {
+ throw new OutOfSpaceException(buffer.position(), buffer.limit());
+ }
+ buffer.putInt(value);
+ }
+
+ public static final int LITTLE_ENDIAN_32_SIZE = 4;
+
+ /** Write a little-endian 64-bit integer. */
+ public void writeRawLittleEndian64(final long value) throws IOException {
+ if (buffer.remaining() < 8) {
+ throw new OutOfSpaceException(buffer.position(), buffer.limit());
+ }
+ buffer.putLong(value);
+ }
+
+ public static final int LITTLE_ENDIAN_64_SIZE = 8;
+
+ /**
+ * Encode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers
+ * into values that can be efficiently encoded with varint. (Otherwise,
+ * negative values must be sign-extended to 64 bits to be varint encoded,
+ * thus always taking 10 bytes on the wire.)
+ *
+ * @param n A signed 32-bit integer.
+ * @return An unsigned 32-bit integer, stored in a signed int because
+ * Java has no explicit unsigned support.
+ */
+ public static int encodeZigZag32(final int n) {
+ // Note: the right-shift must be arithmetic
+ return (n << 1) ^ (n >> 31);
+ }
+
+ /**
+ * Encode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers
+ * into values that can be efficiently encoded with varint. (Otherwise,
+ * negative values must be sign-extended to 64 bits to be varint encoded,
+ * thus always taking 10 bytes on the wire.)
+ *
+ * @param n A signed 64-bit integer.
+ * @return An unsigned 64-bit integer, stored in a signed int because
+ * Java has no explicit unsigned support.
+ */
+ public static long encodeZigZag64(final long n) {
+ // Note: the right-shift must be arithmetic
+ return (n << 1) ^ (n >> 63);
+ }
+
+ static int computeFieldSize(int number, int type, Object object) {
+ switch (type) {
+ case InternalNano.TYPE_BOOL:
+ return computeBoolSize(number, (Boolean) object);
+ case InternalNano.TYPE_BYTES:
+ return computeBytesSize(number, (byte[]) object);
+ case InternalNano.TYPE_STRING:
+ return computeStringSize(number, (String) object);
+ case InternalNano.TYPE_FLOAT:
+ return computeFloatSize(number, (Float) object);
+ case InternalNano.TYPE_DOUBLE:
+ return computeDoubleSize(number, (Double) object);
+ case InternalNano.TYPE_ENUM:
+ return computeEnumSize(number, (Integer) object);
+ case InternalNano.TYPE_FIXED32:
+ return computeFixed32Size(number, (Integer) object);
+ case InternalNano.TYPE_INT32:
+ return computeInt32Size(number, (Integer) object);
+ case InternalNano.TYPE_UINT32:
+ return computeUInt32Size(number, (Integer) object);
+ case InternalNano.TYPE_SINT32:
+ return computeSInt32Size(number, (Integer) object);
+ case InternalNano.TYPE_SFIXED32:
+ return computeSFixed32Size(number, (Integer) object);
+ case InternalNano.TYPE_INT64:
+ return computeInt64Size(number, (Long) object);
+ case InternalNano.TYPE_UINT64:
+ return computeUInt64Size(number, (Long) object);
+ case InternalNano.TYPE_SINT64:
+ return computeSInt64Size(number, (Long) object);
+ case InternalNano.TYPE_FIXED64:
+ return computeFixed64Size(number, (Long) object);
+ case InternalNano.TYPE_SFIXED64:
+ return computeSFixed64Size(number, (Long) object);
+ case InternalNano.TYPE_MESSAGE:
+ return computeMessageSize(number, (MessageNano) object);
+ case InternalNano.TYPE_GROUP:
+ return computeGroupSize(number, (MessageNano) object);
+ default:
+ throw new IllegalArgumentException("Unknown type: " + type);
+ }
+ }
+
+ void writeField(int number, int type, Object value)
+ throws IOException {
+ switch (type) {
+ case InternalNano.TYPE_DOUBLE:
+ Double doubleValue = (Double) value;
+ writeDouble(number, doubleValue);
+ break;
+ case InternalNano.TYPE_FLOAT:
+ Float floatValue = (Float) value;
+ writeFloat(number, floatValue);
+ break;
+ case InternalNano.TYPE_INT64:
+ Long int64Value = (Long) value;
+ writeInt64(number, int64Value);
+ break;
+ case InternalNano.TYPE_UINT64:
+ Long uint64Value = (Long) value;
+ writeUInt64(number, uint64Value);
+ break;
+ case InternalNano.TYPE_INT32:
+ Integer int32Value = (Integer) value;
+ writeInt32(number, int32Value);
+ break;
+ case InternalNano.TYPE_FIXED64:
+ Long fixed64Value = (Long) value;
+ writeFixed64(number, fixed64Value);
+ break;
+ case InternalNano.TYPE_FIXED32:
+ Integer fixed32Value = (Integer) value;
+ writeFixed32(number, fixed32Value);
+ break;
+ case InternalNano.TYPE_BOOL:
+ Boolean boolValue = (Boolean) value;
+ writeBool(number, boolValue);
+ break;
+ case InternalNano.TYPE_STRING:
+ String stringValue = (String) value;
+ writeString(number, stringValue);
+ break;
+ case InternalNano.TYPE_BYTES:
+ byte[] bytesValue = (byte[]) value;
+ writeBytes(number, bytesValue);
+ break;
+ case InternalNano.TYPE_UINT32:
+ Integer uint32Value = (Integer) value;
+ writeUInt32(number, uint32Value);
+ break;
+ case InternalNano.TYPE_ENUM:
+ Integer enumValue = (Integer) value;
+ writeEnum(number, enumValue);
+ break;
+ case InternalNano.TYPE_SFIXED32:
+ Integer sfixed32Value = (Integer) value;
+ writeSFixed32(number, sfixed32Value);
+ break;
+ case InternalNano.TYPE_SFIXED64:
+ Long sfixed64Value = (Long) value;
+ writeSFixed64(number, sfixed64Value);
+ break;
+ case InternalNano.TYPE_SINT32:
+ Integer sint32Value = (Integer) value;
+ writeSInt32(number, sint32Value);
+ break;
+ case InternalNano.TYPE_SINT64:
+ Long sint64Value = (Long) value;
+ writeSInt64(number, sint64Value);
+ break;
+ case InternalNano.TYPE_MESSAGE:
+ MessageNano messageValue = (MessageNano) value;
+ writeMessage(number, messageValue);
+ break;
+ case InternalNano.TYPE_GROUP:
+ MessageNano groupValue = (MessageNano) value;
+ writeGroup(number, groupValue);
+ break;
+ default:
+ throw new IOException("Unknown type: " + type);
+ }
+ }
+
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/ExtendableMessageNano.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/ExtendableMessageNano.java
new file mode 100644
index 0000000000..87973d76f0
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/ExtendableMessageNano.java
@@ -0,0 +1,169 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+
+/**
+ * Base class of those Protocol Buffer messages that need to store unknown fields,
+ * such as extensions.
+ */
+public abstract class ExtendableMessageNano<M extends ExtendableMessageNano<M>>
+ extends MessageNano {
+ /**
+ * A container for fields unknown to the message, including extensions. Extension fields can
+ * can be accessed through the {@link #getExtension} and {@link #setExtension} methods.
+ */
+ protected FieldArray unknownFieldData;
+
+ @Override
+ protected int computeSerializedSize() {
+ int size = 0;
+ if (unknownFieldData != null) {
+ for (int i = 0; i < unknownFieldData.size(); i++) {
+ FieldData field = unknownFieldData.dataAt(i);
+ size += field.computeSerializedSize();
+ }
+ }
+ return size;
+ }
+
+ @Override
+ public void writeTo(CodedOutputByteBufferNano output) throws IOException {
+ if (unknownFieldData == null) {
+ return;
+ }
+ for (int i = 0; i < unknownFieldData.size(); i++) {
+ FieldData field = unknownFieldData.dataAt(i);
+ field.writeTo(output);
+ }
+ }
+
+ /**
+ * Checks if there is a value stored for the specified extension in this
+ * message.
+ */
+ public final boolean hasExtension(Extension<M, ?> extension) {
+ if (unknownFieldData == null) {
+ return false;
+ }
+ FieldData field = unknownFieldData.get(WireFormatNano.getTagFieldNumber(extension.tag));
+ return field != null;
+ }
+
+ /**
+ * Gets the value stored in the specified extension of this message.
+ */
+ public final <T> T getExtension(Extension<M, T> extension) {
+ if (unknownFieldData == null) {
+ return null;
+ }
+ FieldData field = unknownFieldData.get(WireFormatNano.getTagFieldNumber(extension.tag));
+ return field == null ? null : field.getValue(extension);
+ }
+
+ /**
+ * Sets the value of the specified extension of this message.
+ */
+ public final <T> M setExtension(Extension<M, T> extension, T value) {
+ int fieldNumber = WireFormatNano.getTagFieldNumber(extension.tag);
+ if (value == null) {
+ if (unknownFieldData != null) {
+ unknownFieldData.remove(fieldNumber);
+ if (unknownFieldData.isEmpty()) {
+ unknownFieldData = null;
+ }
+ }
+ } else {
+ FieldData field = null;
+ if (unknownFieldData == null) {
+ unknownFieldData = new FieldArray();
+ } else {
+ field = unknownFieldData.get(fieldNumber);
+ }
+ if (field == null) {
+ unknownFieldData.put(fieldNumber, new FieldData(extension, value));
+ } else {
+ field.setValue(extension, value);
+ }
+ }
+
+ @SuppressWarnings("unchecked") // Generated code should guarantee type safety
+ M typedThis = (M) this;
+ return typedThis;
+ }
+
+ /**
+ * Stores the binary data of an unknown field.
+ *
+ * <p>Generated messages will call this for unknown fields if the store_unknown_fields
+ * option is on.
+ *
+ * <p>Note that the tag might be a end-group tag (rather than the start of an unknown field) in
+ * which case we do not want to add an unknown field entry.
+ *
+ * @param input the input buffer.
+ * @param tag the tag of the field.
+
+ * @return {@literal true} unless the tag is an end-group tag.
+ */
+ protected final boolean storeUnknownField(CodedInputByteBufferNano input, int tag)
+ throws IOException {
+ int startPos = input.getPosition();
+ if (!input.skipField(tag)) {
+ return false; // This wasn't an unknown field, it's an end-group tag.
+ }
+ int fieldNumber = WireFormatNano.getTagFieldNumber(tag);
+ int endPos = input.getPosition();
+ byte[] bytes = input.getData(startPos, endPos - startPos);
+ UnknownFieldData unknownField = new UnknownFieldData(tag, bytes);
+
+ FieldData field = null;
+ if (unknownFieldData == null) {
+ unknownFieldData = new FieldArray();
+ } else {
+ field = unknownFieldData.get(fieldNumber);
+ }
+ if (field == null) {
+ field = new FieldData();
+ unknownFieldData.put(fieldNumber, field);
+ }
+ field.addUnknownField(unknownField);
+ return true;
+ }
+
+ @Override
+ public M clone() throws CloneNotSupportedException {
+ M cloned = (M) super.clone();
+ InternalNano.cloneUnknownFieldData(this, cloned);
+ return cloned;
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/Extension.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/Extension.java
new file mode 100644
index 0000000000..c458f9b1fc
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/Extension.java
@@ -0,0 +1,706 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents an extension.
+ *
+ * @author bduff@google.com (Brian Duff)
+ * @author maxtroy@google.com (Max Cai)
+ * @param <M> the type of the extendable message this extension is for.
+ * @param <T> the Java type of the extension; see {@link #clazz}.
+ */
+public class Extension<M extends ExtendableMessageNano<M>, T> {
+
+ /*
+ * Because we typically only define message-typed extensions, the Extension class hierarchy is
+ * designed as follows, to allow a big amount of code in this file to be removed by ProGuard:
+ *
+ * Extension // ready to use for message/group typed extensions
+ * Δ
+ * |
+ * PrimitiveExtension // for primitive/enum typed extensions
+ */
+
+ public static final int TYPE_DOUBLE = InternalNano.TYPE_DOUBLE;
+ public static final int TYPE_FLOAT = InternalNano.TYPE_FLOAT;
+ public static final int TYPE_INT64 = InternalNano.TYPE_INT64;
+ public static final int TYPE_UINT64 = InternalNano.TYPE_UINT64;
+ public static final int TYPE_INT32 = InternalNano.TYPE_INT32;
+ public static final int TYPE_FIXED64 = InternalNano.TYPE_FIXED64;
+ public static final int TYPE_FIXED32 = InternalNano.TYPE_FIXED32;
+ public static final int TYPE_BOOL = InternalNano.TYPE_BOOL;
+ public static final int TYPE_STRING = InternalNano.TYPE_STRING;
+ public static final int TYPE_GROUP = InternalNano.TYPE_GROUP;
+ public static final int TYPE_MESSAGE = InternalNano.TYPE_MESSAGE;
+ public static final int TYPE_BYTES = InternalNano.TYPE_BYTES;
+ public static final int TYPE_UINT32 = InternalNano.TYPE_UINT32;
+ public static final int TYPE_ENUM = InternalNano.TYPE_ENUM;
+ public static final int TYPE_SFIXED32 = InternalNano.TYPE_SFIXED32;
+ public static final int TYPE_SFIXED64 = InternalNano.TYPE_SFIXED64;
+ public static final int TYPE_SINT32 = InternalNano.TYPE_SINT32;
+ public static final int TYPE_SINT64 = InternalNano.TYPE_SINT64;
+
+ /**
+ * Creates an {@code Extension} of the given message type and tag number.
+ * Should be used by the generated code only.
+ *
+ * @param type {@link #TYPE_MESSAGE} or {@link #TYPE_GROUP}
+ * @deprecated use {@link #createMessageTyped(int, Class, long)} instead.
+ */
+ @Deprecated
+ public static <M extends ExtendableMessageNano<M>, T extends MessageNano>
+ Extension<M, T> createMessageTyped(int type, Class<T> clazz, int tag) {
+ return new Extension<M, T>(type, clazz, tag, false);
+ }
+
+ // Note: these create...() methods take a long for the tag parameter,
+ // because tags are represented as unsigned ints, and these values exist
+ // in generated code as long values. However, they can fit in 32-bits, so
+ // it's safe to cast them to int without loss of precision.
+
+ /**
+ * Creates an {@code Extension} of the given message type and tag number.
+ * Should be used by the generated code only.
+ *
+ * @param type {@link #TYPE_MESSAGE} or {@link #TYPE_GROUP}
+ */
+ public static <M extends ExtendableMessageNano<M>, T extends MessageNano>
+ Extension<M, T> createMessageTyped(int type, Class<T> clazz, long tag) {
+ return new Extension<M, T>(type, clazz, (int) tag, false);
+ }
+
+ /**
+ * Creates a repeated {@code Extension} of the given message type and tag number.
+ * Should be used by the generated code only.
+ *
+ * @param type {@link #TYPE_MESSAGE} or {@link #TYPE_GROUP}
+ */
+ public static <M extends ExtendableMessageNano<M>, T extends MessageNano>
+ Extension<M, T[]> createRepeatedMessageTyped(int type, Class<T[]> clazz, long tag) {
+ return new Extension<M, T[]>(type, clazz, (int) tag, true);
+ }
+
+ /**
+ * Creates an {@code Extension} of the given primitive type and tag number.
+ * Should be used by the generated code only.
+ *
+ * @param type one of {@code TYPE_*}, except {@link #TYPE_MESSAGE} and {@link #TYPE_GROUP}
+ * @param clazz the boxed Java type of this extension
+ */
+ public static <M extends ExtendableMessageNano<M>, T>
+ Extension<M, T> createPrimitiveTyped(int type, Class<T> clazz, long tag) {
+ return new PrimitiveExtension<M, T>(type, clazz, (int) tag, false, 0, 0);
+ }
+
+ /**
+ * Creates a repeated {@code Extension} of the given primitive type and tag number.
+ * Should be used by the generated code only.
+ *
+ * @param type one of {@code TYPE_*}, except {@link #TYPE_MESSAGE} and {@link #TYPE_GROUP}
+ * @param clazz the Java array type of this extension, with an unboxed component type
+ */
+ public static <M extends ExtendableMessageNano<M>, T>
+ Extension<M, T> createRepeatedPrimitiveTyped(
+ int type, Class<T> clazz, long tag, long nonPackedTag, long packedTag) {
+ return new PrimitiveExtension<M, T>(type, clazz, (int) tag, true,
+ (int) nonPackedTag, (int) packedTag);
+ }
+
+ /**
+ * Protocol Buffer type of this extension; one of the {@code TYPE_} constants.
+ */
+ protected final int type;
+
+ /**
+ * Java type of this extension. For a singular extension, this is the boxed Java type for the
+ * Protocol Buffer {@link #type}; for a repeated extension, this is an array type whose
+ * component type is the unboxed Java type for {@link #type}. For example, for a singular
+ * {@code int32}/{@link #TYPE_INT32} extension, this equals {@code Integer.class}; for a
+ * repeated {@code int32} extension, this equals {@code int[].class}.
+ */
+ protected final Class<T> clazz;
+
+ /**
+ * Tag number of this extension. The data should be viewed as an unsigned 32-bit value.
+ */
+ public final int tag;
+
+ /**
+ * Whether this extension is repeated.
+ */
+ protected final boolean repeated;
+
+ private Extension(int type, Class<T> clazz, int tag, boolean repeated) {
+ this.type = type;
+ this.clazz = clazz;
+ this.tag = tag;
+ this.repeated = repeated;
+ }
+
+ /**
+ * Returns the value of this extension stored in the given list of unknown fields, or
+ * {@code null} if no unknown fields matches this extension.
+ *
+ * @param unknownFields a list of {@link UnknownFieldData}. All of the elements must have a tag
+ * that matches this Extension's tag.
+ *
+ */
+ final T getValueFrom(List<UnknownFieldData> unknownFields) {
+ if (unknownFields == null) {
+ return null;
+ }
+ return repeated ? getRepeatedValueFrom(unknownFields) : getSingularValueFrom(unknownFields);
+ }
+
+ private T getRepeatedValueFrom(List<UnknownFieldData> unknownFields) {
+ // For repeated extensions, read all matching unknown fields in their original order.
+ List<Object> resultList = new ArrayList<Object>();
+ for (int i = 0; i < unknownFields.size(); i++) {
+ UnknownFieldData data = unknownFields.get(i);
+ if (data.bytes.length != 0) {
+ readDataInto(data, resultList);
+ }
+ }
+
+ int resultSize = resultList.size();
+ if (resultSize == 0) {
+ return null;
+ } else {
+ T result = clazz.cast(Array.newInstance(clazz.getComponentType(), resultSize));
+ for (int i = 0; i < resultSize; i++) {
+ Array.set(result, i, resultList.get(i));
+ }
+ return result;
+ }
+ }
+
+ private T getSingularValueFrom(List<UnknownFieldData> unknownFields) {
+ // For singular extensions, get the last piece of data stored under this extension.
+ if (unknownFields.isEmpty()) {
+ return null;
+ }
+ UnknownFieldData lastData = unknownFields.get(unknownFields.size() - 1);
+ return clazz.cast(readData(CodedInputByteBufferNano.newInstance(lastData.bytes)));
+ }
+
+ protected Object readData(CodedInputByteBufferNano input) {
+ // This implementation is for message/group extensions.
+ Class<?> messageType = repeated ? clazz.getComponentType() : clazz;
+ try {
+ switch (type) {
+ case TYPE_GROUP:
+ MessageNano group = (MessageNano) messageType.newInstance();
+ input.readGroup(group, WireFormatNano.getTagFieldNumber(tag));
+ return group;
+ case TYPE_MESSAGE:
+ MessageNano message = (MessageNano) messageType.newInstance();
+ input.readMessage(message);
+ return message;
+ default:
+ throw new IllegalArgumentException("Unknown type " + type);
+ }
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(
+ "Error creating instance of class " + messageType, e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(
+ "Error creating instance of class " + messageType, e);
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Error reading extension field", e);
+ }
+ }
+
+ protected void readDataInto(UnknownFieldData data, List<Object> resultList) {
+ // This implementation is for message/group extensions.
+ resultList.add(readData(CodedInputByteBufferNano.newInstance(data.bytes)));
+ }
+
+ void writeTo(Object value, CodedOutputByteBufferNano output) throws IOException {
+ if (repeated) {
+ writeRepeatedData(value, output);
+ } else {
+ writeSingularData(value, output);
+ }
+ }
+
+ protected void writeSingularData(Object value, CodedOutputByteBufferNano out) {
+ // This implementation is for message/group extensions.
+ try {
+ out.writeRawVarint32(tag);
+ switch (type) {
+ case TYPE_GROUP:
+ MessageNano groupValue = (MessageNano) value;
+ int fieldNumber = WireFormatNano.getTagFieldNumber(tag);
+ out.writeGroupNoTag(groupValue);
+ // The endgroup tag must be included in the data payload.
+ out.writeTag(fieldNumber, WireFormatNano.WIRETYPE_END_GROUP);
+ break;
+ case TYPE_MESSAGE:
+ MessageNano messageValue = (MessageNano) value;
+ out.writeMessageNoTag(messageValue);
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown type " + type);
+ }
+ } catch (IOException e) {
+ // Should not happen
+ throw new IllegalStateException(e);
+ }
+ }
+
+ protected void writeRepeatedData(Object array, CodedOutputByteBufferNano output) {
+ // This implementation is for non-packed extensions.
+ int arrayLength = Array.getLength(array);
+ for (int i = 0; i < arrayLength; i++) {
+ Object element = Array.get(array, i);
+ if (element != null) {
+ writeSingularData(element, output);
+ }
+ }
+ }
+
+ int computeSerializedSize(Object value) {
+ if (repeated) {
+ return computeRepeatedSerializedSize(value);
+ } else {
+ return computeSingularSerializedSize(value);
+ }
+ }
+
+ protected int computeRepeatedSerializedSize(Object array) {
+ // This implementation is for non-packed extensions.
+ int size = 0;
+ int arrayLength = Array.getLength(array);
+ for (int i = 0; i < arrayLength; i++) {
+ Object element = Array.get(array, i);
+ if (element != null) {
+ size += computeSingularSerializedSize(Array.get(array, i));
+ }
+ }
+ return size;
+ }
+
+ protected int computeSingularSerializedSize(Object value) {
+ // This implementation is for message/group extensions.
+ int fieldNumber = WireFormatNano.getTagFieldNumber(tag);
+ switch (type) {
+ case TYPE_GROUP:
+ MessageNano groupValue = (MessageNano) value;
+ return CodedOutputByteBufferNano.computeGroupSize(fieldNumber, groupValue);
+ case TYPE_MESSAGE:
+ MessageNano messageValue = (MessageNano) value;
+ return CodedOutputByteBufferNano.computeMessageSize(fieldNumber, messageValue);
+ default:
+ throw new IllegalArgumentException("Unknown type " + type);
+ }
+ }
+
+ /**
+ * Represents an extension of a primitive (including enum) type. If there is no primitive
+ * extensions, this subclass will be removable by ProGuard.
+ */
+ private static class PrimitiveExtension<M extends ExtendableMessageNano<M>, T>
+ extends Extension<M, T> {
+
+ /**
+ * Tag of a piece of non-packed data from the wire compatible with this extension.
+ */
+ private final int nonPackedTag;
+
+ /**
+ * Tag of a piece of packed data from the wire compatible with this extension.
+ * 0 if the type of this extension is not packable.
+ */
+ private final int packedTag;
+
+ public PrimitiveExtension(int type, Class<T> clazz, int tag, boolean repeated,
+ int nonPackedTag, int packedTag) {
+ super(type, clazz, tag, repeated);
+ this.nonPackedTag = nonPackedTag;
+ this.packedTag = packedTag;
+ }
+
+ @Override
+ protected Object readData(CodedInputByteBufferNano input) {
+ try {
+ return input.readPrimitiveField(type);
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Error reading extension field", e);
+ }
+ }
+
+ @Override
+ protected void readDataInto(UnknownFieldData data, List<Object> resultList) {
+ // This implementation is for primitive typed extensions,
+ // which can read both packed and non-packed data.
+ if (data.tag == nonPackedTag) {
+ resultList.add(readData(CodedInputByteBufferNano.newInstance(data.bytes)));
+ } else {
+ CodedInputByteBufferNano buffer =
+ CodedInputByteBufferNano.newInstance(data.bytes);
+ try {
+ buffer.pushLimit(buffer.readRawVarint32()); // length limit
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Error reading extension field", e);
+ }
+ while (!buffer.isAtEnd()) {
+ resultList.add(readData(buffer));
+ }
+ }
+ }
+
+ @Override
+ protected final void writeSingularData(Object value, CodedOutputByteBufferNano output) {
+ try {
+ output.writeRawVarint32(tag);
+ switch (type) {
+ case TYPE_DOUBLE:
+ Double doubleValue = (Double) value;
+ output.writeDoubleNoTag(doubleValue);
+ break;
+ case TYPE_FLOAT:
+ Float floatValue = (Float) value;
+ output.writeFloatNoTag(floatValue);
+ break;
+ case TYPE_INT64:
+ Long int64Value = (Long) value;
+ output.writeInt64NoTag(int64Value);
+ break;
+ case TYPE_UINT64:
+ Long uint64Value = (Long) value;
+ output.writeUInt64NoTag(uint64Value);
+ break;
+ case TYPE_INT32:
+ Integer int32Value = (Integer) value;
+ output.writeInt32NoTag(int32Value);
+ break;
+ case TYPE_FIXED64:
+ Long fixed64Value = (Long) value;
+ output.writeFixed64NoTag(fixed64Value);
+ break;
+ case TYPE_FIXED32:
+ Integer fixed32Value = (Integer) value;
+ output.writeFixed32NoTag(fixed32Value);
+ break;
+ case TYPE_BOOL:
+ Boolean boolValue = (Boolean) value;
+ output.writeBoolNoTag(boolValue);
+ break;
+ case TYPE_STRING:
+ String stringValue = (String) value;
+ output.writeStringNoTag(stringValue);
+ break;
+ case TYPE_BYTES:
+ byte[] bytesValue = (byte[]) value;
+ output.writeBytesNoTag(bytesValue);
+ break;
+ case TYPE_UINT32:
+ Integer uint32Value = (Integer) value;
+ output.writeUInt32NoTag(uint32Value);
+ break;
+ case TYPE_ENUM:
+ Integer enumValue = (Integer) value;
+ output.writeEnumNoTag(enumValue);
+ break;
+ case TYPE_SFIXED32:
+ Integer sfixed32Value = (Integer) value;
+ output.writeSFixed32NoTag(sfixed32Value);
+ break;
+ case TYPE_SFIXED64:
+ Long sfixed64Value = (Long) value;
+ output.writeSFixed64NoTag(sfixed64Value);
+ break;
+ case TYPE_SINT32:
+ Integer sint32Value = (Integer) value;
+ output.writeSInt32NoTag(sint32Value);
+ break;
+ case TYPE_SINT64:
+ Long sint64Value = (Long) value;
+ output.writeSInt64NoTag(sint64Value);
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown type " + type);
+ }
+ } catch (IOException e) {
+ // Should not happen
+ throw new IllegalStateException(e);
+ }
+ }
+
+ @Override
+ protected void writeRepeatedData(Object array, CodedOutputByteBufferNano output) {
+ if (tag == nonPackedTag) {
+ // Use base implementation for non-packed data
+ super.writeRepeatedData(array, output);
+ } else if (tag == packedTag) {
+ // Packed. Note that the array element type is guaranteed to be primitive, so there
+ // won't be any null elements, so no null check in this block.
+ int arrayLength = Array.getLength(array);
+ int dataSize = computePackedDataSize(array);
+
+ try {
+ output.writeRawVarint32(tag);
+ output.writeRawVarint32(dataSize);
+ switch (type) {
+ case TYPE_BOOL:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeBoolNoTag(Array.getBoolean(array, i));
+ }
+ break;
+ case TYPE_FIXED32:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeFixed32NoTag(Array.getInt(array, i));
+ }
+ break;
+ case TYPE_SFIXED32:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeSFixed32NoTag(Array.getInt(array, i));
+ }
+ break;
+ case TYPE_FLOAT:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeFloatNoTag(Array.getFloat(array, i));
+ }
+ break;
+ case TYPE_FIXED64:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeFixed64NoTag(Array.getLong(array, i));
+ }
+ break;
+ case TYPE_SFIXED64:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeSFixed64NoTag(Array.getLong(array, i));
+ }
+ break;
+ case TYPE_DOUBLE:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeDoubleNoTag(Array.getDouble(array, i));
+ }
+ break;
+ case TYPE_INT32:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeInt32NoTag(Array.getInt(array, i));
+ }
+ break;
+ case TYPE_SINT32:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeSInt32NoTag(Array.getInt(array, i));
+ }
+ break;
+ case TYPE_UINT32:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeUInt32NoTag(Array.getInt(array, i));
+ }
+ break;
+ case TYPE_INT64:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeInt64NoTag(Array.getLong(array, i));
+ }
+ break;
+ case TYPE_SINT64:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeSInt64NoTag(Array.getLong(array, i));
+ }
+ break;
+ case TYPE_UINT64:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeUInt64NoTag(Array.getLong(array, i));
+ }
+ break;
+ case TYPE_ENUM:
+ for (int i = 0; i < arrayLength; i++) {
+ output.writeEnumNoTag(Array.getInt(array, i));
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("Unpackable type " + type);
+ }
+ } catch (IOException e) {
+ // Should not happen.
+ throw new IllegalStateException(e);
+ }
+ } else {
+ throw new IllegalArgumentException("Unexpected repeated extension tag " + tag
+ + ", unequal to both non-packed variant " + nonPackedTag
+ + " and packed variant " + packedTag);
+ }
+ }
+
+ private int computePackedDataSize(Object array) {
+ int dataSize = 0;
+ int arrayLength = Array.getLength(array);
+ switch (type) {
+ case TYPE_BOOL:
+ // Bools are stored as int32 but just as 0 or 1, so 1 byte each.
+ dataSize = arrayLength;
+ break;
+ case TYPE_FIXED32:
+ case TYPE_SFIXED32:
+ case TYPE_FLOAT:
+ dataSize = arrayLength * CodedOutputByteBufferNano.LITTLE_ENDIAN_32_SIZE;
+ break;
+ case TYPE_FIXED64:
+ case TYPE_SFIXED64:
+ case TYPE_DOUBLE:
+ dataSize = arrayLength * CodedOutputByteBufferNano.LITTLE_ENDIAN_64_SIZE;
+ break;
+ case TYPE_INT32:
+ for (int i = 0; i < arrayLength; i++) {
+ dataSize += CodedOutputByteBufferNano.computeInt32SizeNoTag(
+ Array.getInt(array, i));
+ }
+ break;
+ case TYPE_SINT32:
+ for (int i = 0; i < arrayLength; i++) {
+ dataSize += CodedOutputByteBufferNano.computeSInt32SizeNoTag(
+ Array.getInt(array, i));
+ }
+ break;
+ case TYPE_UINT32:
+ for (int i = 0; i < arrayLength; i++) {
+ dataSize += CodedOutputByteBufferNano.computeUInt32SizeNoTag(
+ Array.getInt(array, i));
+ }
+ break;
+ case TYPE_INT64:
+ for (int i = 0; i < arrayLength; i++) {
+ dataSize += CodedOutputByteBufferNano.computeInt64SizeNoTag(
+ Array.getLong(array, i));
+ }
+ break;
+ case TYPE_SINT64:
+ for (int i = 0; i < arrayLength; i++) {
+ dataSize += CodedOutputByteBufferNano.computeSInt64SizeNoTag(
+ Array.getLong(array, i));
+ }
+ break;
+ case TYPE_UINT64:
+ for (int i = 0; i < arrayLength; i++) {
+ dataSize += CodedOutputByteBufferNano.computeUInt64SizeNoTag(
+ Array.getLong(array, i));
+ }
+ break;
+ case TYPE_ENUM:
+ for (int i = 0; i < arrayLength; i++) {
+ dataSize += CodedOutputByteBufferNano.computeEnumSizeNoTag(
+ Array.getInt(array, i));
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("Unexpected non-packable type " + type);
+ }
+ return dataSize;
+ }
+
+ @Override
+ protected int computeRepeatedSerializedSize(Object array) {
+ if (tag == nonPackedTag) {
+ // Use base implementation for non-packed data
+ return super.computeRepeatedSerializedSize(array);
+ } else if (tag == packedTag) {
+ // Packed.
+ int dataSize = computePackedDataSize(array);
+ int payloadSize =
+ dataSize + CodedOutputByteBufferNano.computeRawVarint32Size(dataSize);
+ return payloadSize + CodedOutputByteBufferNano.computeRawVarint32Size(tag);
+ } else {
+ throw new IllegalArgumentException("Unexpected repeated extension tag " + tag
+ + ", unequal to both non-packed variant " + nonPackedTag
+ + " and packed variant " + packedTag);
+ }
+ }
+
+ @Override
+ protected final int computeSingularSerializedSize(Object value) {
+ int fieldNumber = WireFormatNano.getTagFieldNumber(tag);
+ switch (type) {
+ case TYPE_DOUBLE:
+ Double doubleValue = (Double) value;
+ return CodedOutputByteBufferNano.computeDoubleSize(fieldNumber, doubleValue);
+ case TYPE_FLOAT:
+ Float floatValue = (Float) value;
+ return CodedOutputByteBufferNano.computeFloatSize(fieldNumber, floatValue);
+ case TYPE_INT64:
+ Long int64Value = (Long) value;
+ return CodedOutputByteBufferNano.computeInt64Size(fieldNumber, int64Value);
+ case TYPE_UINT64:
+ Long uint64Value = (Long) value;
+ return CodedOutputByteBufferNano.computeUInt64Size(fieldNumber, uint64Value);
+ case TYPE_INT32:
+ Integer int32Value = (Integer) value;
+ return CodedOutputByteBufferNano.computeInt32Size(fieldNumber, int32Value);
+ case TYPE_FIXED64:
+ Long fixed64Value = (Long) value;
+ return CodedOutputByteBufferNano.computeFixed64Size(fieldNumber, fixed64Value);
+ case TYPE_FIXED32:
+ Integer fixed32Value = (Integer) value;
+ return CodedOutputByteBufferNano.computeFixed32Size(fieldNumber, fixed32Value);
+ case TYPE_BOOL:
+ Boolean boolValue = (Boolean) value;
+ return CodedOutputByteBufferNano.computeBoolSize(fieldNumber, boolValue);
+ case TYPE_STRING:
+ String stringValue = (String) value;
+ return CodedOutputByteBufferNano.computeStringSize(fieldNumber, stringValue);
+ case TYPE_BYTES:
+ byte[] bytesValue = (byte[]) value;
+ return CodedOutputByteBufferNano.computeBytesSize(fieldNumber, bytesValue);
+ case TYPE_UINT32:
+ Integer uint32Value = (Integer) value;
+ return CodedOutputByteBufferNano.computeUInt32Size(fieldNumber, uint32Value);
+ case TYPE_ENUM:
+ Integer enumValue = (Integer) value;
+ return CodedOutputByteBufferNano.computeEnumSize(fieldNumber, enumValue);
+ case TYPE_SFIXED32:
+ Integer sfixed32Value = (Integer) value;
+ return CodedOutputByteBufferNano.computeSFixed32Size(fieldNumber,
+ sfixed32Value);
+ case TYPE_SFIXED64:
+ Long sfixed64Value = (Long) value;
+ return CodedOutputByteBufferNano.computeSFixed64Size(fieldNumber,
+ sfixed64Value);
+ case TYPE_SINT32:
+ Integer sint32Value = (Integer) value;
+ return CodedOutputByteBufferNano.computeSInt32Size(fieldNumber, sint32Value);
+ case TYPE_SINT64:
+ Long sint64Value = (Long) value;
+ return CodedOutputByteBufferNano.computeSInt64Size(fieldNumber, sint64Value);
+ default:
+ throw new IllegalArgumentException("Unknown type " + type);
+ }
+ }
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/FieldArray.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/FieldArray.java
new file mode 100644
index 0000000000..b49a97fa5a
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/FieldArray.java
@@ -0,0 +1,291 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2014 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+
+/**
+ * A custom version of {@code android.util.SparseArray} with the minimal API
+ * for storing {@link FieldData} objects.
+ *
+ * <p>This class is an internal implementation detail of nano and should not
+ * be called directly by clients.
+ *
+ * Based on {@code android.support.v4.util.SpareArrayCompat}.
+ */
+public final class FieldArray implements Cloneable {
+ private static final FieldData DELETED = new FieldData();
+ private boolean mGarbage = false;
+
+ private int[] mFieldNumbers;
+ private FieldData[] mData;
+ private int mSize;
+
+ /**
+ * Creates a new FieldArray containing no fields.
+ */
+ FieldArray() {
+ this(10);
+ }
+
+ /**
+ * Creates a new FieldArray containing no mappings that will not
+ * require any additional memory allocation to store the specified
+ * number of mappings.
+ */
+ FieldArray(int initialCapacity) {
+ initialCapacity = idealIntArraySize(initialCapacity);
+ mFieldNumbers = new int[initialCapacity];
+ mData = new FieldData[initialCapacity];
+ mSize = 0;
+ }
+
+ /**
+ * Gets the FieldData mapped from the specified fieldNumber, or <code>null</code>
+ * if no such mapping has been made.
+ */
+ FieldData get(int fieldNumber) {
+ int i = binarySearch(fieldNumber);
+
+ if (i < 0 || mData[i] == DELETED) {
+ return null;
+ } else {
+ return mData[i];
+ }
+ }
+
+ /**
+ * Removes the data from the specified fieldNumber, if there was any.
+ */
+ void remove(int fieldNumber) {
+ int i = binarySearch(fieldNumber);
+
+ if (i >= 0 && mData[i] != DELETED) {
+ mData[i] = DELETED;
+ mGarbage = true;
+ }
+ }
+
+ private void gc() {
+ int n = mSize;
+ int o = 0;
+ int[] keys = mFieldNumbers;
+ FieldData[] values = mData;
+
+ for (int i = 0; i < n; i++) {
+ FieldData val = values[i];
+
+ if (val != DELETED) {
+ if (i != o) {
+ keys[o] = keys[i];
+ values[o] = val;
+ values[i] = null;
+ }
+
+ o++;
+ }
+ }
+
+ mGarbage = false;
+ mSize = o;
+ }
+
+ /**
+ * Adds a mapping from the specified fieldNumber to the specified data,
+ * replacing the previous mapping if there was one.
+ */
+ void put(int fieldNumber, FieldData data) {
+ int i = binarySearch(fieldNumber);
+
+ if (i >= 0) {
+ mData[i] = data;
+ } else {
+ i = ~i;
+
+ if (i < mSize && mData[i] == DELETED) {
+ mFieldNumbers[i] = fieldNumber;
+ mData[i] = data;
+ return;
+ }
+
+ if (mGarbage && mSize >= mFieldNumbers.length) {
+ gc();
+
+ // Search again because indices may have changed.
+ i = ~ binarySearch(fieldNumber);
+ }
+
+ if (mSize >= mFieldNumbers.length) {
+ int n = idealIntArraySize(mSize + 1);
+
+ int[] nkeys = new int[n];
+ FieldData[] nvalues = new FieldData[n];
+
+ System.arraycopy(mFieldNumbers, 0, nkeys, 0, mFieldNumbers.length);
+ System.arraycopy(mData, 0, nvalues, 0, mData.length);
+
+ mFieldNumbers = nkeys;
+ mData = nvalues;
+ }
+
+ if (mSize - i != 0) {
+ System.arraycopy(mFieldNumbers, i, mFieldNumbers, i + 1, mSize - i);
+ System.arraycopy(mData, i, mData, i + 1, mSize - i);
+ }
+
+ mFieldNumbers[i] = fieldNumber;
+ mData[i] = data;
+ mSize++;
+ }
+ }
+
+ /**
+ * Returns the number of key-value mappings that this FieldArray
+ * currently stores.
+ */
+ int size() {
+ if (mGarbage) {
+ gc();
+ }
+
+ return mSize;
+ }
+
+ public boolean isEmpty() {
+ return size() == 0;
+ }
+
+ /**
+ * Given an index in the range <code>0...size()-1</code>, returns
+ * the value from the <code>index</code>th key-value mapping that this
+ * FieldArray stores.
+ */
+ FieldData dataAt(int index) {
+ if (mGarbage) {
+ gc();
+ }
+
+ return mData[index];
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof FieldArray)) {
+ return false;
+ }
+
+ FieldArray other = (FieldArray) o;
+ if (size() != other.size()) { // size() will call gc() if necessary.
+ return false;
+ }
+ return arrayEquals(mFieldNumbers, other.mFieldNumbers, mSize) &&
+ arrayEquals(mData, other.mData, mSize);
+ }
+
+ @Override
+ public int hashCode() {
+ if (mGarbage) {
+ gc();
+ }
+ int result = 17;
+ for (int i = 0; i < mSize; i++) {
+ result = 31 * result + mFieldNumbers[i];
+ result = 31 * result + mData[i].hashCode();
+ }
+ return result;
+ }
+
+ private int idealIntArraySize(int need) {
+ return idealByteArraySize(need * 4) / 4;
+ }
+
+ private int idealByteArraySize(int need) {
+ for (int i = 4; i < 32; i++)
+ if (need <= (1 << i) - 12)
+ return (1 << i) - 12;
+
+ return need;
+ }
+
+ private int binarySearch(int value) {
+ int lo = 0;
+ int hi = mSize - 1;
+
+ while (lo <= hi) {
+ int mid = (lo + hi) >>> 1;
+ int midVal = mFieldNumbers[mid];
+
+ if (midVal < value) {
+ lo = mid + 1;
+ } else if (midVal > value) {
+ hi = mid - 1;
+ } else {
+ return mid; // value found
+ }
+ }
+ return ~lo; // value not present
+ }
+
+ private boolean arrayEquals(int[] a, int[] b, int size) {
+ for (int i = 0; i < size; i++) {
+ if (a[i] != b[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean arrayEquals(FieldData[] a, FieldData[] b, int size) {
+ for (int i = 0; i < size; i++) {
+ if (!a[i].equals(b[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public final FieldArray clone() {
+ // Trigger GC so we compact and don't copy DELETED elements.
+ int size = size();
+ FieldArray clone = new FieldArray(size);
+ System.arraycopy(mFieldNumbers, 0, clone.mFieldNumbers, 0, size);
+ for (int i = 0; i < size; i++) {
+ if (mData[i] != null) {
+ clone.mData[i] = mData[i].clone();
+ }
+ }
+ clone.mSize = size;
+ return clone;
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/FieldData.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/FieldData.java
new file mode 100644
index 0000000000..ebebabc8e5
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/FieldData.java
@@ -0,0 +1,240 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2014 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Stores unknown fields. These might be extensions or fields that the generated API doesn't
+ * know about yet.
+ */
+class FieldData implements Cloneable {
+ private Extension<?, ?> cachedExtension;
+ private Object value;
+ /** The serialised values for this object. Will be cleared if getValue is called */
+ private List<UnknownFieldData> unknownFieldData;
+
+ <T> FieldData(Extension<?, T> extension, T newValue) {
+ cachedExtension = extension;
+ value = newValue;
+ }
+
+ FieldData() {
+ unknownFieldData = new ArrayList<UnknownFieldData>();
+ }
+
+ void addUnknownField(UnknownFieldData unknownField) {
+ unknownFieldData.add(unknownField);
+ }
+
+ UnknownFieldData getUnknownField(int index) {
+ if (unknownFieldData == null) {
+ return null;
+ }
+ if (index < unknownFieldData.size()) {
+ return unknownFieldData.get(index);
+ }
+ return null;
+ }
+
+ int getUnknownFieldSize() {
+ if (unknownFieldData == null) {
+ return 0;
+ }
+ return unknownFieldData.size();
+ }
+
+ <T> T getValue(Extension<?, T> extension) {
+ if (value != null){
+ if (cachedExtension != extension) { // Extension objects are singletons.
+ throw new IllegalStateException(
+ "Tried to getExtension with a differernt Extension.");
+ }
+ } else {
+ cachedExtension = extension;
+ value = extension.getValueFrom(unknownFieldData);
+ unknownFieldData = null;
+ }
+ return (T) value;
+ }
+
+ <T> void setValue(Extension<?, T> extension, T newValue) {
+ cachedExtension = extension;
+ value = newValue;
+ unknownFieldData = null;
+ }
+
+ int computeSerializedSize() {
+ int size = 0;
+ if (value != null) {
+ size = cachedExtension.computeSerializedSize(value);
+ } else {
+ for (UnknownFieldData unknownField : unknownFieldData) {
+ size += unknownField.computeSerializedSize();
+ }
+ }
+ return size;
+ }
+
+ void writeTo(CodedOutputByteBufferNano output) throws IOException {
+ if (value != null) {
+ cachedExtension.writeTo(value, output);
+ } else {
+ for (UnknownFieldData unknownField : unknownFieldData) {
+ unknownField.writeTo(output);
+ }
+ }
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof FieldData)) {
+ return false;
+ }
+
+ FieldData other = (FieldData) o;
+ if (value != null && other.value != null) {
+ // If both objects have deserialized values, compare those.
+ // Since unknown fields are only compared if messages have generated equals methods
+ // we know this will be a meaningful comparison (not identity) for all values.
+ if (cachedExtension != other.cachedExtension) { // Extension objects are singletons.
+ return false;
+ }
+ if (!cachedExtension.clazz.isArray()) {
+ // Can't test (!cachedExtension.repeated) due to 'bytes' -> 'byte[]'
+ return value.equals(other.value);
+ }
+ if (value instanceof byte[]) {
+ return Arrays.equals((byte[]) value, (byte[]) other.value);
+ } else if (value instanceof int[]) {
+ return Arrays.equals((int[]) value, (int[]) other.value);
+ } else if (value instanceof long[]) {
+ return Arrays.equals((long[]) value, (long[]) other.value);
+ } else if (value instanceof float[]) {
+ return Arrays.equals((float[]) value, (float[]) other.value);
+ } else if (value instanceof double[]) {
+ return Arrays.equals((double[]) value, (double[]) other.value);
+ } else if (value instanceof boolean[]) {
+ return Arrays.equals((boolean[]) value, (boolean[]) other.value);
+ } else {
+ return Arrays.deepEquals((Object[]) value, (Object[]) other.value);
+ }
+ }
+ if (unknownFieldData != null && other.unknownFieldData != null) {
+ // If both objects have byte arrays compare those directly.
+ return unknownFieldData.equals(other.unknownFieldData);
+ }
+ try {
+ // As a last resort, serialize and compare the resulting byte arrays.
+ return Arrays.equals(toByteArray(), other.toByteArray());
+ } catch (IOException e) {
+ // Should not happen.
+ throw new IllegalStateException(e);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ try {
+ // The only way to generate a consistent hash is to use the serialized form.
+ result = 31 * result + Arrays.hashCode(toByteArray());
+ } catch (IOException e) {
+ // Should not happen.
+ throw new IllegalStateException(e);
+ }
+ return result;
+ }
+
+ private byte[] toByteArray() throws IOException {
+ byte[] result = new byte[computeSerializedSize()];
+ CodedOutputByteBufferNano output = CodedOutputByteBufferNano.newInstance(result);
+ writeTo(output);
+ return result;
+ }
+
+ @Override
+ public final FieldData clone() {
+ FieldData clone = new FieldData();
+ try {
+ clone.cachedExtension = cachedExtension;
+ if (unknownFieldData == null) {
+ clone.unknownFieldData = null;
+ } else {
+ clone.unknownFieldData.addAll(unknownFieldData);
+ }
+
+ // Whether we need to deep clone value depends on its type. Primitive reference types
+ // (e.g. Integer, Long etc.) are ok, since they're immutable. We need to clone arrays
+ // and messages.
+ if (value == null) {
+ // No cloning required.
+ } else if (value instanceof MessageNano) {
+ clone.value = ((MessageNano) value).clone();
+ } else if (value instanceof byte[]) {
+ clone.value = ((byte[]) value).clone();
+ } else if (value instanceof byte[][]) {
+ byte[][] valueArray = (byte[][]) value;
+ byte[][] cloneArray = new byte[valueArray.length][];
+ clone.value = cloneArray;
+ for (int i = 0; i < valueArray.length; i++) {
+ cloneArray[i] = valueArray[i].clone();
+ }
+ } else if (value instanceof boolean[]) {
+ clone.value = ((boolean[]) value).clone();
+ } else if (value instanceof int[]) {
+ clone.value = ((int[]) value).clone();
+ } else if (value instanceof long[]) {
+ clone.value = ((long[]) value).clone();
+ } else if (value instanceof float[]) {
+ clone.value = ((float[]) value).clone();
+ } else if (value instanceof double[]) {
+ clone.value = ((double[]) value).clone();
+ } else if (value instanceof MessageNano[]) {
+ MessageNano[] valueArray = (MessageNano[]) value;
+ MessageNano[] cloneArray = new MessageNano[valueArray.length];
+ clone.value = cloneArray;
+ for (int i = 0; i < valueArray.length; i++) {
+ cloneArray[i] = valueArray[i].clone();
+ }
+ }
+ return clone;
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError(e);
+ }
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/InternalNano.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/InternalNano.java
new file mode 100644
index 0000000000..278368a08b
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/InternalNano.java
@@ -0,0 +1,547 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import com.google.protobuf.nano.MapFactories.MapFactory;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * The classes contained within are used internally by the Protocol Buffer
+ * library and generated message implementations. They are public only because
+ * those generated messages do not reside in the {@code protobuf} package.
+ * Others should not use this class directly.
+ *
+ * @author kenton@google.com (Kenton Varda)
+ */
+public final class InternalNano {
+
+ public static final int TYPE_DOUBLE = 1;
+ public static final int TYPE_FLOAT = 2;
+ public static final int TYPE_INT64 = 3;
+ public static final int TYPE_UINT64 = 4;
+ public static final int TYPE_INT32 = 5;
+ public static final int TYPE_FIXED64 = 6;
+ public static final int TYPE_FIXED32 = 7;
+ public static final int TYPE_BOOL = 8;
+ public static final int TYPE_STRING = 9;
+ public static final int TYPE_GROUP = 10;
+ public static final int TYPE_MESSAGE = 11;
+ public static final int TYPE_BYTES = 12;
+ public static final int TYPE_UINT32 = 13;
+ public static final int TYPE_ENUM = 14;
+ public static final int TYPE_SFIXED32 = 15;
+ public static final int TYPE_SFIXED64 = 16;
+ public static final int TYPE_SINT32 = 17;
+ public static final int TYPE_SINT64 = 18;
+
+ static final Charset UTF_8 = Charset.forName("UTF-8");
+ static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
+
+ private InternalNano() {}
+
+ /**
+ * An object to provide synchronization when lazily initializing static fields
+ * of {@link MessageNano} subclasses.
+ * <p>
+ * To enable earlier versions of ProGuard to inline short methods from a
+ * generated MessageNano subclass to the call sites, that class must not have
+ * a class initializer, which will be created if there is any static variable
+ * initializers. To lazily initialize the static variables in a thread-safe
+ * manner, the initialization code will synchronize on this object.
+ */
+ public static final Object LAZY_INIT_LOCK = new Object();
+
+ /**
+ * Helper called by generated code to construct default values for string
+ * fields.
+ * <p>
+ * The protocol compiler does not actually contain a UTF-8 decoder -- it
+ * just pushes UTF-8-encoded text around without touching it. The one place
+ * where this presents a problem is when generating Java string literals.
+ * Unicode characters in the string literal would normally need to be encoded
+ * using a Unicode escape sequence, which would require decoding them.
+ * To get around this, protoc instead embeds the UTF-8 bytes into the
+ * generated code and leaves it to the runtime library to decode them.
+ * <p>
+ * It gets worse, though. If protoc just generated a byte array, like:
+ * new byte[] {0x12, 0x34, 0x56, 0x78}
+ * Java actually generates *code* which allocates an array and then fills
+ * in each value. This is much less efficient than just embedding the bytes
+ * directly into the bytecode. To get around this, we need another
+ * work-around. String literals are embedded directly, so protoc actually
+ * generates a string literal corresponding to the bytes. The easiest way
+ * to do this is to use the ISO-8859-1 character set, which corresponds to
+ * the first 256 characters of the Unicode range. Protoc can then use
+ * good old CEscape to generate the string.
+ * <p>
+ * So we have a string literal which represents a set of bytes which
+ * represents another string. This function -- stringDefaultValue --
+ * converts from the generated string to the string we actually want. The
+ * generated code calls this automatically.
+ */
+ public static String stringDefaultValue(String bytes) {
+ return new String(bytes.getBytes(ISO_8859_1), InternalNano.UTF_8);
+ }
+
+ /**
+ * Helper called by generated code to construct default values for bytes
+ * fields.
+ * <p>
+ * This is a lot like {@link #stringDefaultValue}, but for bytes fields.
+ * In this case we only need the second of the two hacks -- allowing us to
+ * embed raw bytes as a string literal with ISO-8859-1 encoding.
+ */
+ public static byte[] bytesDefaultValue(String bytes) {
+ return bytes.getBytes(ISO_8859_1);
+ }
+
+ /**
+ * Helper function to convert a string into UTF-8 while turning the
+ * UnsupportedEncodingException to a RuntimeException.
+ */
+ public static byte[] copyFromUtf8(final String text) {
+ return text.getBytes(InternalNano.UTF_8);
+ }
+
+ /**
+ * Checks repeated int field equality; null-value and 0-length fields are
+ * considered equal.
+ */
+ public static boolean equals(int[] field1, int[] field2) {
+ if (field1 == null || field1.length == 0) {
+ return field2 == null || field2.length == 0;
+ } else {
+ return Arrays.equals(field1, field2);
+ }
+ }
+
+ /**
+ * Checks repeated long field equality; null-value and 0-length fields are
+ * considered equal.
+ */
+ public static boolean equals(long[] field1, long[] field2) {
+ if (field1 == null || field1.length == 0) {
+ return field2 == null || field2.length == 0;
+ } else {
+ return Arrays.equals(field1, field2);
+ }
+ }
+
+ /**
+ * Checks repeated float field equality; null-value and 0-length fields are
+ * considered equal.
+ */
+ public static boolean equals(float[] field1, float[] field2) {
+ if (field1 == null || field1.length == 0) {
+ return field2 == null || field2.length == 0;
+ } else {
+ return Arrays.equals(field1, field2);
+ }
+ }
+
+ /**
+ * Checks repeated double field equality; null-value and 0-length fields are
+ * considered equal.
+ */
+ public static boolean equals(double[] field1, double[] field2) {
+ if (field1 == null || field1.length == 0) {
+ return field2 == null || field2.length == 0;
+ } else {
+ return Arrays.equals(field1, field2);
+ }
+ }
+
+ /**
+ * Checks repeated boolean field equality; null-value and 0-length fields are
+ * considered equal.
+ */
+ public static boolean equals(boolean[] field1, boolean[] field2) {
+ if (field1 == null || field1.length == 0) {
+ return field2 == null || field2.length == 0;
+ } else {
+ return Arrays.equals(field1, field2);
+ }
+ }
+
+ /**
+ * Checks repeated bytes field equality. Only non-null elements are tested.
+ * Returns true if the two fields have the same sequence of non-null
+ * elements. Null-value fields and fields of any length with only null
+ * elements are considered equal.
+ */
+ public static boolean equals(byte[][] field1, byte[][] field2) {
+ int index1 = 0;
+ int length1 = field1 == null ? 0 : field1.length;
+ int index2 = 0;
+ int length2 = field2 == null ? 0 : field2.length;
+ while (true) {
+ while (index1 < length1 && field1[index1] == null) {
+ index1++;
+ }
+ while (index2 < length2 && field2[index2] == null) {
+ index2++;
+ }
+ boolean atEndOf1 = index1 >= length1;
+ boolean atEndOf2 = index2 >= length2;
+ if (atEndOf1 && atEndOf2) {
+ // no more non-null elements to test in both arrays
+ return true;
+ } else if (atEndOf1 != atEndOf2) {
+ // one of the arrays have extra non-null elements
+ return false;
+ } else if (!Arrays.equals(field1[index1], field2[index2])) {
+ // element mismatch
+ return false;
+ }
+ index1++;
+ index2++;
+ }
+ }
+
+ /**
+ * Checks repeated string/message field equality. Only non-null elements are
+ * tested. Returns true if the two fields have the same sequence of non-null
+ * elements. Null-value fields and fields of any length with only null
+ * elements are considered equal.
+ */
+ public static boolean equals(Object[] field1, Object[] field2) {
+ int index1 = 0;
+ int length1 = field1 == null ? 0 : field1.length;
+ int index2 = 0;
+ int length2 = field2 == null ? 0 : field2.length;
+ while (true) {
+ while (index1 < length1 && field1[index1] == null) {
+ index1++;
+ }
+ while (index2 < length2 && field2[index2] == null) {
+ index2++;
+ }
+ boolean atEndOf1 = index1 >= length1;
+ boolean atEndOf2 = index2 >= length2;
+ if (atEndOf1 && atEndOf2) {
+ // no more non-null elements to test in both arrays
+ return true;
+ } else if (atEndOf1 != atEndOf2) {
+ // one of the arrays have extra non-null elements
+ return false;
+ } else if (!field1[index1].equals(field2[index2])) {
+ // element mismatch
+ return false;
+ }
+ index1++;
+ index2++;
+ }
+ }
+
+ /**
+ * Computes the hash code of a repeated int field. Null-value and 0-length
+ * fields have the same hash code.
+ */
+ public static int hashCode(int[] field) {
+ return field == null || field.length == 0 ? 0 : Arrays.hashCode(field);
+ }
+
+ /**
+ * Computes the hash code of a repeated long field. Null-value and 0-length
+ * fields have the same hash code.
+ */
+ public static int hashCode(long[] field) {
+ return field == null || field.length == 0 ? 0 : Arrays.hashCode(field);
+ }
+
+ /**
+ * Computes the hash code of a repeated float field. Null-value and 0-length
+ * fields have the same hash code.
+ */
+ public static int hashCode(float[] field) {
+ return field == null || field.length == 0 ? 0 : Arrays.hashCode(field);
+ }
+
+ /**
+ * Computes the hash code of a repeated double field. Null-value and 0-length
+ * fields have the same hash code.
+ */
+ public static int hashCode(double[] field) {
+ return field == null || field.length == 0 ? 0 : Arrays.hashCode(field);
+ }
+
+ /**
+ * Computes the hash code of a repeated boolean field. Null-value and 0-length
+ * fields have the same hash code.
+ */
+ public static int hashCode(boolean[] field) {
+ return field == null || field.length == 0 ? 0 : Arrays.hashCode(field);
+ }
+
+ /**
+ * Computes the hash code of a repeated bytes field. Only the sequence of all
+ * non-null elements are used in the computation. Null-value fields and fields
+ * of any length with only null elements have the same hash code.
+ */
+ public static int hashCode(byte[][] field) {
+ int result = 0;
+ for (int i = 0, size = field == null ? 0 : field.length; i < size; i++) {
+ byte[] element = field[i];
+ if (element != null) {
+ result = 31 * result + Arrays.hashCode(element);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Computes the hash code of a repeated string/message field. Only the
+ * sequence of all non-null elements are used in the computation. Null-value
+ * fields and fields of any length with only null elements have the same hash
+ * code.
+ */
+ public static int hashCode(Object[] field) {
+ int result = 0;
+ for (int i = 0, size = field == null ? 0 : field.length; i < size; i++) {
+ Object element = field[i];
+ if (element != null) {
+ result = 31 * result + element.hashCode();
+ }
+ }
+ return result;
+ }
+ private static Object primitiveDefaultValue(int type) {
+ switch (type) {
+ case TYPE_BOOL:
+ return Boolean.FALSE;
+ case TYPE_BYTES:
+ return WireFormatNano.EMPTY_BYTES;
+ case TYPE_STRING:
+ return "";
+ case TYPE_FLOAT:
+ return Float.valueOf(0);
+ case TYPE_DOUBLE:
+ return Double.valueOf(0);
+ case TYPE_ENUM:
+ case TYPE_FIXED32:
+ case TYPE_INT32:
+ case TYPE_UINT32:
+ case TYPE_SINT32:
+ case TYPE_SFIXED32:
+ return Integer.valueOf(0);
+ case TYPE_INT64:
+ case TYPE_UINT64:
+ case TYPE_SINT64:
+ case TYPE_FIXED64:
+ case TYPE_SFIXED64:
+ return Long.valueOf(0L);
+ case TYPE_MESSAGE:
+ case TYPE_GROUP:
+ default:
+ throw new IllegalArgumentException(
+ "Type: " + type + " is not a primitive type.");
+ }
+ }
+
+ /**
+ * Merges the map entry into the map field. Note this is only supposed to
+ * be called by generated messages.
+ *
+ * @param map the map field; may be null, in which case a map will be
+ * instantiated using the {@link MapFactories.MapFactory}
+ * @param input the input byte buffer
+ * @param keyType key type, as defined in InternalNano.TYPE_*
+ * @param valueType value type, as defined in InternalNano.TYPE_*
+ * @param value an new instance of the value, if the value is a TYPE_MESSAGE;
+ * otherwise this parameter can be null and will be ignored.
+ * @param keyTag wire tag for the key
+ * @param valueTag wire tag for the value
+ * @return the map field
+ * @throws IOException
+ */
+ @SuppressWarnings("unchecked")
+ public static final <K, V> Map<K, V> mergeMapEntry(
+ CodedInputByteBufferNano input,
+ Map<K, V> map,
+ MapFactory mapFactory,
+ int keyType,
+ int valueType,
+ V value,
+ int keyTag,
+ int valueTag) throws IOException {
+ map = mapFactory.forMap(map);
+ final int length = input.readRawVarint32();
+ final int oldLimit = input.pushLimit(length);
+ K key = null;
+ while (true) {
+ int tag = input.readTag();
+ if (tag == 0) {
+ break;
+ }
+ if (tag == keyTag) {
+ key = (K) input.readPrimitiveField(keyType);
+ } else if (tag == valueTag) {
+ if (valueType == TYPE_MESSAGE) {
+ input.readMessage((MessageNano) value);
+ } else {
+ value = (V) input.readPrimitiveField(valueType);
+ }
+ } else {
+ if (!input.skipField(tag)) {
+ break;
+ }
+ }
+ }
+ input.checkLastTagWas(0);
+ input.popLimit(oldLimit);
+
+ if (key == null) {
+ // key can only be primitive types.
+ key = (K) primitiveDefaultValue(keyType);
+ }
+
+ if (value == null) {
+ // message type value will be initialized by code-gen.
+ value = (V) primitiveDefaultValue(valueType);
+ }
+
+ map.put(key, value);
+ return map;
+ }
+
+ public static <K, V> void serializeMapField(
+ CodedOutputByteBufferNano output,
+ Map<K, V> map, int number, int keyType, int valueType)
+ throws IOException {
+ for (Entry<K, V> entry: map.entrySet()) {
+ K key = entry.getKey();
+ V value = entry.getValue();
+ if (key == null || value == null) {
+ throw new IllegalStateException(
+ "keys and values in maps cannot be null");
+ }
+ int entrySize =
+ CodedOutputByteBufferNano.computeFieldSize(1, keyType, key) +
+ CodedOutputByteBufferNano.computeFieldSize(2, valueType, value);
+ output.writeTag(number, WireFormatNano.WIRETYPE_LENGTH_DELIMITED);
+ output.writeRawVarint32(entrySize);
+ output.writeField(1, keyType, key);
+ output.writeField(2, valueType, value);
+ }
+ }
+
+ public static <K, V> int computeMapFieldSize(
+ Map<K, V> map, int number, int keyType, int valueType) {
+ int size = 0;
+ int tagSize = CodedOutputByteBufferNano.computeTagSize(number);
+ for (Entry<K, V> entry: map.entrySet()) {
+ K key = entry.getKey();
+ V value = entry.getValue();
+ if (key == null || value == null) {
+ throw new IllegalStateException(
+ "keys and values in maps cannot be null");
+ }
+ int entrySize =
+ CodedOutputByteBufferNano.computeFieldSize(1, keyType, key) +
+ CodedOutputByteBufferNano.computeFieldSize(2, valueType, value);
+ size += tagSize + entrySize
+ + CodedOutputByteBufferNano.computeRawVarint32Size(entrySize);
+ }
+ return size;
+ }
+
+ /**
+ * Checks whether two {@link Map} are equal. We don't use the default equals
+ * method of {@link Map} because it compares by identity not by content for
+ * byte arrays.
+ */
+ public static <K, V> boolean equals(Map<K, V> a, Map<K, V> b) {
+ if (a == b) {
+ return true;
+ }
+ if (a == null) {
+ return b.size() == 0;
+ }
+ if (b == null) {
+ return a.size() == 0;
+ }
+ if (a.size() != b.size()) {
+ return false;
+ }
+ for (Entry<K, V> entry : a.entrySet()) {
+ if (!b.containsKey(entry.getKey())) {
+ return false;
+ }
+ if (!equalsMapValue(entry.getValue(), b.get(entry.getKey()))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean equalsMapValue(Object a, Object b) {
+ if (a == null || b == null) {
+ throw new IllegalStateException(
+ "keys and values in maps cannot be null");
+ }
+ if (a instanceof byte[] && b instanceof byte[]) {
+ return Arrays.equals((byte[]) a, (byte[]) b);
+ }
+ return a.equals(b);
+ }
+
+ public static <K, V> int hashCode(Map<K, V> map) {
+ if (map == null) {
+ return 0;
+ }
+ int result = 0;
+ for (Entry<K, V> entry : map.entrySet()) {
+ result += hashCodeForMap(entry.getKey())
+ ^ hashCodeForMap(entry.getValue());
+ }
+ return result;
+ }
+
+ private static int hashCodeForMap(Object o) {
+ if (o instanceof byte[]) {
+ return Arrays.hashCode((byte[]) o);
+ }
+ return o.hashCode();
+ }
+
+ // This avoids having to make FieldArray public.
+ public static void cloneUnknownFieldData(ExtendableMessageNano original,
+ ExtendableMessageNano cloned) {
+ if (original.unknownFieldData != null) {
+ cloned.unknownFieldData = (FieldArray) original.unknownFieldData.clone();
+ }
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/InvalidProtocolBufferNanoException.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/InvalidProtocolBufferNanoException.java
new file mode 100644
index 0000000000..9a83d6d37c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/InvalidProtocolBufferNanoException.java
@@ -0,0 +1,93 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+
+/**
+ * Thrown when a protocol message being parsed is invalid in some way,
+ * e.g. it contains a malformed varint or a negative byte length.
+ *
+ * @author kenton@google.com Kenton Varda
+ */
+public class InvalidProtocolBufferNanoException extends IOException {
+ private static final long serialVersionUID = -1616151763072450476L;
+
+ public InvalidProtocolBufferNanoException(final String description) {
+ super(description);
+ }
+
+ static InvalidProtocolBufferNanoException truncatedMessage() {
+ return new InvalidProtocolBufferNanoException(
+ "While parsing a protocol message, the input ended unexpectedly " +
+ "in the middle of a field. This could mean either that the " +
+ "input has been truncated or that an embedded message " +
+ "misreported its own length.");
+ }
+
+ static InvalidProtocolBufferNanoException negativeSize() {
+ return new InvalidProtocolBufferNanoException(
+ "CodedInputStream encountered an embedded string or message " +
+ "which claimed to have negative size.");
+ }
+
+ static InvalidProtocolBufferNanoException malformedVarint() {
+ return new InvalidProtocolBufferNanoException(
+ "CodedInputStream encountered a malformed varint.");
+ }
+
+ static InvalidProtocolBufferNanoException invalidTag() {
+ return new InvalidProtocolBufferNanoException(
+ "Protocol message contained an invalid tag (zero).");
+ }
+
+ static InvalidProtocolBufferNanoException invalidEndTag() {
+ return new InvalidProtocolBufferNanoException(
+ "Protocol message end-group tag did not match expected tag.");
+ }
+
+ static InvalidProtocolBufferNanoException invalidWireType() {
+ return new InvalidProtocolBufferNanoException(
+ "Protocol message tag had invalid wire type.");
+ }
+
+ static InvalidProtocolBufferNanoException recursionLimitExceeded() {
+ return new InvalidProtocolBufferNanoException(
+ "Protocol message had too many levels of nesting. May be malicious. " +
+ "Use CodedInputStream.setRecursionLimit() to increase the depth limit.");
+ }
+
+ static InvalidProtocolBufferNanoException sizeLimitExceeded() {
+ return new InvalidProtocolBufferNanoException(
+ "Protocol message was too large. May be malicious. " +
+ "Use CodedInputStream.setSizeLimit() to increase the size limit.");
+ }
+}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleNaNs.cs b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MapFactories.java
index 08b50191d1..98fa4877bc 100644
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/SampleNaNs.cs
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MapFactories.java
@@ -1,6 +1,5 @@
-#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
-// Copyright 2017 Google Inc. All rights reserved.
+// Copyright 2013 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
@@ -28,26 +27,41 @@
// 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.
-#endregion
-using System;
+package com.google.protobuf.nano;
-namespace Google.Protobuf
-{
- /// <summary>
- /// Samples of different not-a-number values, for testing equality comparisons.
- /// </summary>
- public static class SampleNaNs
- {
- public static double Regular { get; } = double.NaN;
+import java.util.HashMap;
+import java.util.Map;
- // Signalling bit is inverted compared with double.NaN. Doesn't really matter
- // whether that makes it quiet or signalling - it's different.
- public static double SignallingFlipped { get; } =
- BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(double.NaN) ^ -0x8000_0000_0000_0000L);
+/**
+ * Utility class for maps support.
+ */
+public final class MapFactories {
+ public static interface MapFactory {
+ <K, V> Map<K, V> forMap(Map<K, V> oldMap);
+ }
- // A bit in the middle of the mantissa is flipped; this difference is preserved when casting to float.
- public static double PayloadFlipped { get; } =
- BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(double.NaN) ^ 0x1_0000_0000L);
+ // NOTE(liujisi): The factory setter is temporarily marked as package private.
+ // The way to provide customized implementations of maps for different
+ // platforms are still under discussion. Mark it as private to avoid exposing
+ // the API in proto3 alpha release.
+ /* public */ static void setMapFactory(MapFactory newMapFactory) {
+ mapFactory = newMapFactory;
+ }
+
+ public static MapFactory getMapFactory() {
+ return mapFactory;
+ }
+
+ private static class DefaultMapFactory implements MapFactory {
+ public <K, V> Map<K, V> forMap(Map<K, V> oldMap) {
+ if (oldMap == null) {
+ return new HashMap<K, V>();
+ }
+ return oldMap;
}
+ }
+ private static volatile MapFactory mapFactory = new DefaultMapFactory();
+
+ private MapFactories() {}
}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MessageNano.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MessageNano.java
new file mode 100644
index 0000000000..2347502702
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MessageNano.java
@@ -0,0 +1,198 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * Abstract interface implemented by Protocol Message objects.
+ *
+ * @author wink@google.com Wink Saville
+ */
+public abstract class MessageNano {
+ protected volatile int cachedSize = -1;
+
+ /**
+ * Get the number of bytes required to encode this message.
+ * Returns the cached size or calls getSerializedSize which
+ * sets the cached size. This is used internally when serializing
+ * so the size is only computed once. If a member is modified
+ * then this could be stale call getSerializedSize if in doubt.
+ */
+ public int getCachedSize() {
+ if (cachedSize < 0) {
+ // getSerializedSize sets cachedSize
+ getSerializedSize();
+ }
+ return cachedSize;
+ }
+
+ /**
+ * Computes the number of bytes required to encode this message.
+ * The size is cached and the cached result can be retrieved
+ * using getCachedSize().
+ */
+ public int getSerializedSize() {
+ int size = computeSerializedSize();
+ cachedSize = size;
+ return size;
+ }
+
+ /**
+ * Computes the number of bytes required to encode this message. This does not update the
+ * cached size.
+ */
+ protected int computeSerializedSize() {
+ // This is overridden if the generated message has serialized fields.
+ return 0;
+ }
+
+ /**
+ * Serializes the message and writes it to {@code output}.
+ *
+ * @param output the output to receive the serialized form.
+ * @throws IOException if an error occurred writing to {@code output}.
+ */
+ public void writeTo(CodedOutputByteBufferNano output) throws IOException {
+ // Does nothing by default. Overridden by subclasses which have data to write.
+ }
+
+ /**
+ * Parse {@code input} as a message of this type and merge it with the
+ * message being built.
+ */
+ public abstract MessageNano mergeFrom(CodedInputByteBufferNano input) throws IOException;
+
+ /**
+ * Serialize to a byte array.
+ * @return byte array with the serialized data.
+ */
+ public static final byte[] toByteArray(MessageNano msg) {
+ final byte[] result = new byte[msg.getSerializedSize()];
+ toByteArray(msg, result, 0, result.length);
+ return result;
+ }
+
+ /**
+ * Serialize to a byte array starting at offset through length. The
+ * method getSerializedSize must have been called prior to calling
+ * this method so the proper length is know. If an attempt to
+ * write more than length bytes OutOfSpaceException will be thrown
+ * and if length bytes are not written then IllegalStateException
+ * is thrown.
+ */
+ public static final void toByteArray(MessageNano msg, byte[] data, int offset, int length) {
+ try {
+ final CodedOutputByteBufferNano output =
+ CodedOutputByteBufferNano.newInstance(data, offset, length);
+ msg.writeTo(output);
+ output.checkNoSpaceLeft();
+ } catch (IOException e) {
+ throw new RuntimeException("Serializing to a byte array threw an IOException "
+ + "(should never happen).", e);
+ }
+ }
+
+ /**
+ * Parse {@code data} as a message of this type and merge it with the
+ * message being built.
+ */
+ public static final <T extends MessageNano> T mergeFrom(T msg, final byte[] data)
+ throws InvalidProtocolBufferNanoException {
+ return mergeFrom(msg, data, 0, data.length);
+ }
+
+ /**
+ * Parse {@code data} as a message of this type and merge it with the
+ * message being built.
+ */
+ public static final <T extends MessageNano> T mergeFrom(T msg, final byte[] data,
+ final int off, final int len) throws InvalidProtocolBufferNanoException {
+ try {
+ final CodedInputByteBufferNano input =
+ CodedInputByteBufferNano.newInstance(data, off, len);
+ msg.mergeFrom(input);
+ input.checkLastTagWas(0);
+ return msg;
+ } catch (InvalidProtocolBufferNanoException e) {
+ throw e;
+ } catch (IOException e) {
+ throw new RuntimeException("Reading from a byte array threw an IOException (should "
+ + "never happen).");
+ }
+ }
+
+ /**
+ * Compares two {@code MessageNano}s and returns true if the message's are the same class and
+ * have serialized form equality (i.e. all of the field values are the same).
+ */
+ public static final boolean messageNanoEquals(MessageNano a, MessageNano b) {
+ if (a == b) {
+ return true;
+ }
+ if (a == null || b == null) {
+ return false;
+ }
+ if (a.getClass() != b.getClass()) {
+ return false;
+ }
+ final int serializedSize = a.getSerializedSize();
+ if (b.getSerializedSize() != serializedSize) {
+ return false;
+ }
+ final byte[] aByteArray = new byte[serializedSize];
+ final byte[] bByteArray = new byte[serializedSize];
+ toByteArray(a, aByteArray, 0, serializedSize);
+ toByteArray(b, bByteArray, 0, serializedSize);
+ return Arrays.equals(aByteArray, bByteArray);
+ }
+
+ /**
+ * Returns a string that is (mostly) compatible with ProtoBuffer's TextFormat. Note that groups
+ * (which are deprecated) are not serialized with the correct field name.
+ *
+ * <p>This is implemented using reflection, so it is not especially fast nor is it guaranteed
+ * to find all fields if you have method removal turned on for proguard.
+ */
+ @Override
+ public String toString() {
+ return MessageNanoPrinter.print(this);
+ }
+
+ /**
+ * Provides support for cloning. This only works if you specify the generate_clone method.
+ */
+ @Override
+ public MessageNano clone() throws CloneNotSupportedException {
+ return (MessageNano) super.clone();
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java
new file mode 100644
index 0000000000..5f329f02fb
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java
@@ -0,0 +1,275 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Map;
+
+/**
+ * Static helper methods for printing nano protos.
+ *
+ * @author flynn@google.com Andrew Flynn
+ */
+public final class MessageNanoPrinter {
+ // Do not allow instantiation
+ private MessageNanoPrinter() {}
+
+ private static final String INDENT = " ";
+ private static final int MAX_STRING_LEN = 200;
+
+ /**
+ * Returns an text representation of a MessageNano suitable for debugging. The returned string
+ * is mostly compatible with Protocol Buffer's TextFormat (as provided by non-nano protocol
+ * buffers) -- groups (which are deprecated) are output with an underscore name (e.g. foo_bar
+ * instead of FooBar) and will thus not parse.
+ *
+ * <p>Employs Java reflection on the given object and recursively prints primitive fields,
+ * groups, and messages.</p>
+ */
+ public static <T extends MessageNano> String print(T message) {
+ if (message == null) {
+ return "";
+ }
+
+ StringBuffer buf = new StringBuffer();
+ try {
+ print(null, message, new StringBuffer(), buf);
+ } catch (IllegalAccessException e) {
+ return "Error printing proto: " + e.getMessage();
+ } catch (InvocationTargetException e) {
+ return "Error printing proto: " + e.getMessage();
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Function that will print the given message/field into the StringBuffer.
+ * Meant to be called recursively.
+ *
+ * @param identifier the identifier to use, or {@code null} if this is the root message to
+ * print.
+ * @param object the value to print. May in fact be a primitive value or byte array and not a
+ * message.
+ * @param indentBuf the indentation each line should begin with.
+ * @param buf the output buffer.
+ */
+ private static void print(String identifier, Object object,
+ StringBuffer indentBuf, StringBuffer buf) throws IllegalAccessException,
+ InvocationTargetException {
+ if (object == null) {
+ // This can happen if...
+ // - we're about to print a message, String, or byte[], but it not present;
+ // - we're about to print a primitive, but "reftype" optional style is enabled, and
+ // the field is unset.
+ // In both cases the appropriate behavior is to output nothing.
+ } else if (object instanceof MessageNano) { // Nano proto message
+ int origIndentBufLength = indentBuf.length();
+ if (identifier != null) {
+ buf.append(indentBuf).append(deCamelCaseify(identifier)).append(" <\n");
+ indentBuf.append(INDENT);
+ }
+ Class<?> clazz = object.getClass();
+
+ // Proto fields follow one of two formats:
+ //
+ // 1) Public, non-static variables that do not begin or end with '_'
+ // Find and print these using declared public fields
+ for (Field field : clazz.getFields()) {
+ int modifiers = field.getModifiers();
+ String fieldName = field.getName();
+ if ("cachedSize".equals(fieldName)) {
+ // TODO(bduff): perhaps cachedSize should have a more obscure name.
+ continue;
+ }
+
+ if ((modifiers & Modifier.PUBLIC) == Modifier.PUBLIC
+ && (modifiers & Modifier.STATIC) != Modifier.STATIC
+ && !fieldName.startsWith("_")
+ && !fieldName.endsWith("_")) {
+ Class<?> fieldType = field.getType();
+ Object value = field.get(object);
+
+ if (fieldType.isArray()) {
+ Class<?> arrayType = fieldType.getComponentType();
+
+ // bytes is special since it's not repeated, but is represented by an array
+ if (arrayType == byte.class) {
+ print(fieldName, value, indentBuf, buf);
+ } else {
+ int len = value == null ? 0 : Array.getLength(value);
+ for (int i = 0; i < len; i++) {
+ Object elem = Array.get(value, i);
+ print(fieldName, elem, indentBuf, buf);
+ }
+ }
+ } else {
+ print(fieldName, value, indentBuf, buf);
+ }
+ }
+ }
+
+ // 2) Fields that are accessed via getter methods (when accessors
+ // mode is turned on)
+ // Find and print these using getter methods.
+ for (Method method : clazz.getMethods()) {
+ String name = method.getName();
+ // Check for the setter accessor method since getters and hazzers both have
+ // non-proto-field name collisions (hashCode() and getSerializedSize())
+ if (name.startsWith("set")) {
+ String subfieldName = name.substring(3);
+
+ Method hazzer = null;
+ try {
+ hazzer = clazz.getMethod("has" + subfieldName);
+ } catch (NoSuchMethodException e) {
+ continue;
+ }
+ // If hazzer doesn't exist or returns false, no need to continue
+ if (!(Boolean) hazzer.invoke(object)) {
+ continue;
+ }
+
+ Method getter = null;
+ try {
+ getter = clazz.getMethod("get" + subfieldName);
+ } catch (NoSuchMethodException e) {
+ continue;
+ }
+
+ print(subfieldName, getter.invoke(object), indentBuf, buf);
+ }
+ }
+ if (identifier != null) {
+ indentBuf.setLength(origIndentBufLength);
+ buf.append(indentBuf).append(">\n");
+ }
+ } else if (object instanceof Map) {
+ Map<?,?> map = (Map<?,?>) object;
+ identifier = deCamelCaseify(identifier);
+
+ for (Map.Entry<?,?> entry : map.entrySet()) {
+ buf.append(indentBuf).append(identifier).append(" <\n");
+ int origIndentBufLength = indentBuf.length();
+ indentBuf.append(INDENT);
+ print("key", entry.getKey(), indentBuf, buf);
+ print("value", entry.getValue(), indentBuf, buf);
+ indentBuf.setLength(origIndentBufLength);
+ buf.append(indentBuf).append(">\n");
+ }
+ } else {
+ // Non-null primitive value
+ identifier = deCamelCaseify(identifier);
+ buf.append(indentBuf).append(identifier).append(": ");
+ if (object instanceof String) {
+ String stringMessage = sanitizeString((String) object);
+ buf.append("\"").append(stringMessage).append("\"");
+ } else if (object instanceof byte[]) {
+ appendQuotedBytes((byte[]) object, buf);
+ } else {
+ buf.append(object);
+ }
+ buf.append("\n");
+ }
+ }
+
+ /**
+ * Converts an identifier of the format "FieldName" into "field_name".
+ */
+ private static String deCamelCaseify(String identifier) {
+ StringBuffer out = new StringBuffer();
+ for (int i = 0; i < identifier.length(); i++) {
+ char currentChar = identifier.charAt(i);
+ if (i == 0) {
+ out.append(Character.toLowerCase(currentChar));
+ } else if (Character.isUpperCase(currentChar)) {
+ out.append('_').append(Character.toLowerCase(currentChar));
+ } else {
+ out.append(currentChar);
+ }
+ }
+ return out.toString();
+ }
+
+ /**
+ * Shortens and escapes the given string.
+ */
+ private static String sanitizeString(String str) {
+ if (!str.startsWith("http") && str.length() > MAX_STRING_LEN) {
+ // Trim non-URL strings.
+ str = str.substring(0, MAX_STRING_LEN) + "[...]";
+ }
+ return escapeString(str);
+ }
+
+ /**
+ * Escape everything except for low ASCII code points.
+ */
+ private static String escapeString(String str) {
+ int strLen = str.length();
+ StringBuilder b = new StringBuilder(strLen);
+ for (int i = 0; i < strLen; i++) {
+ char original = str.charAt(i);
+ if (original >= ' ' && original <= '~' && original != '"' && original != '\'') {
+ b.append(original);
+ } else {
+ b.append(String.format("\\u%04x", (int) original));
+ }
+ }
+ return b.toString();
+ }
+
+ /**
+ * Appends a quoted byte array to the provided {@code StringBuffer}.
+ */
+ private static void appendQuotedBytes(byte[] bytes, StringBuffer builder) {
+ if (bytes == null) {
+ builder.append("\"\"");
+ return;
+ }
+
+ builder.append('"');
+ for (int i = 0; i < bytes.length; ++i) {
+ int ch = bytes[i] & 0xff;
+ if (ch == '\\' || ch == '"') {
+ builder.append('\\').append((char) ch);
+ } else if (ch >= 32 && ch < 127) {
+ builder.append((char) ch);
+ } else {
+ builder.append(String.format("\\%03o", ch));
+ }
+ }
+ builder.append('"');
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/UnknownFieldData.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/UnknownFieldData.java
new file mode 100644
index 0000000000..b1678d1b93
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/UnknownFieldData.java
@@ -0,0 +1,88 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * Stores unknown fields. These might be extensions or fields that the generated
+ * API doesn't know about yet.
+ *
+ * @author bduff@google.com (Brian Duff)
+ */
+final class UnknownFieldData {
+
+ final int tag;
+ /**
+ * Important: this should be treated as immutable, even though it's possible
+ * to change the array values.
+ */
+ final byte[] bytes;
+
+ UnknownFieldData(int tag, byte[] bytes) {
+ this.tag = tag;
+ this.bytes = bytes;
+ }
+
+ int computeSerializedSize() {
+ int size = 0;
+ size += CodedOutputByteBufferNano.computeRawVarint32Size(tag);
+ size += bytes.length;
+ return size;
+ }
+
+ void writeTo(CodedOutputByteBufferNano output) throws IOException {
+ output.writeRawVarint32(tag);
+ output.writeRawBytes(bytes);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof UnknownFieldData)) {
+ return false;
+ }
+
+ UnknownFieldData other = (UnknownFieldData) o;
+ return tag == other.tag && Arrays.equals(bytes, other.bytes);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + tag;
+ result = 31 * result + Arrays.hashCode(bytes);
+ return result;
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/WireFormatNano.java b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/WireFormatNano.java
new file mode 100644
index 0000000000..bbb6370a3e
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/main/java/com/google/protobuf/nano/WireFormatNano.java
@@ -0,0 +1,124 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import java.io.IOException;
+
+/**
+ * This class is used internally by the Protocol Buffer library and generated
+ * message implementations. It is public only because those generated messages
+ * do not reside in the {@code protobuf} package. Others should not use this
+ * class directly.
+ *
+ * This class contains constants and helper functions useful for dealing with
+ * the Protocol Buffer wire format.
+ *
+ * @author kenton@google.com Kenton Varda
+ */
+public final class WireFormatNano {
+ // Do not allow instantiation.
+ private WireFormatNano() {}
+
+ static final int WIRETYPE_VARINT = 0;
+ static final int WIRETYPE_FIXED64 = 1;
+ static final int WIRETYPE_LENGTH_DELIMITED = 2;
+ static final int WIRETYPE_START_GROUP = 3;
+ static final int WIRETYPE_END_GROUP = 4;
+ static final int WIRETYPE_FIXED32 = 5;
+
+ static final int TAG_TYPE_BITS = 3;
+ static final int TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1;
+
+ /** Given a tag value, determines the wire type (the lower 3 bits). */
+ static int getTagWireType(final int tag) {
+ return tag & TAG_TYPE_MASK;
+ }
+
+ /** Given a tag value, determines the field number (the upper 29 bits). */
+ public static int getTagFieldNumber(final int tag) {
+ return tag >>> TAG_TYPE_BITS;
+ }
+
+ /** Makes a tag value given a field number and wire type. */
+ static int makeTag(final int fieldNumber, final int wireType) {
+ return (fieldNumber << TAG_TYPE_BITS) | wireType;
+ }
+
+ public static final int EMPTY_INT_ARRAY[] = {};
+ public static final long EMPTY_LONG_ARRAY[] = {};
+ public static final float EMPTY_FLOAT_ARRAY[] = {};
+ public static final double EMPTY_DOUBLE_ARRAY[] = {};
+ public static final boolean EMPTY_BOOLEAN_ARRAY[] = {};
+ public static final String EMPTY_STRING_ARRAY[] = {};
+ public static final byte[] EMPTY_BYTES_ARRAY[] = {};
+ public static final byte[] EMPTY_BYTES = {};
+
+ /**
+ * Parses an unknown field. This implementation skips the field.
+ *
+ * <p>Generated messages will call this for unknown fields if the store_unknown_fields
+ * option is off.
+ *
+ * @return {@literal true} unless the tag is an end-group tag.
+ */
+ public static boolean parseUnknownField(
+ final CodedInputByteBufferNano input,
+ final int tag) throws IOException {
+ return input.skipField(tag);
+ }
+
+ /**
+ * Computes the array length of a repeated field. We assume that in the common case repeated
+ * fields are contiguously serialized but we still correctly handle interspersed values of a
+ * repeated field (but with extra allocations).
+ *
+ * Rewinds to current input position before returning.
+ *
+ * @param input stream input, pointing to the byte after the first tag
+ * @param tag repeated field tag just read
+ * @return length of array
+ * @throws IOException
+ */
+ public static final int getRepeatedFieldArrayLength(
+ final CodedInputByteBufferNano input,
+ final int tag) throws IOException {
+ int arrayLength = 1;
+ int startPos = input.getPosition();
+ input.skipField(tag);
+ while (input.readTag() == tag) {
+ input.skipField(tag);
+ arrayLength++;
+ }
+ input.rewindToPosition(startPos);
+ return arrayLength;
+ }
+
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/NanoTest.java b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/NanoTest.java
new file mode 100644
index 0000000000..4d6e7f0903
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/NanoTest.java
@@ -0,0 +1,4471 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.nano;
+
+import com.google.protobuf.nano.CodedOutputByteBufferNano;
+import com.google.protobuf.nano.EnumClassNanos.EnumClassNano;
+import com.google.protobuf.nano.EnumClassNanos.EnumClassNano.MessageScopeEnum;
+import com.google.protobuf.nano.EnumClassNanos.FileScopeEnum;
+import com.google.protobuf.nano.MapTestProto.TestMap;
+import com.google.protobuf.nano.MapTestProto.TestMap.MessageValue;
+import com.google.protobuf.nano.NanoAccessorsOuterClass.TestNanoAccessors;
+import com.google.protobuf.nano.NanoHasOuterClass.TestAllTypesNanoHas;
+import com.google.protobuf.nano.NanoOuterClass.TestAllTypesNano;
+import com.google.protobuf.nano.UnittestRecursiveNano.RecursiveMessageNano;
+import com.google.protobuf.nano.NanoReferenceTypesCompat;
+import com.google.protobuf.nano.UnittestSimpleNano.SimpleMessageNano;
+import com.google.protobuf.nano.UnittestSingleNano.SingleMessageNano;
+import com.google.protobuf.nano.testext.nano.Extensions;
+import com.google.protobuf.nano.testext.nano.Extensions.AnotherMessage;
+import com.google.protobuf.nano.testext.nano.Extensions.MessageWithGroup;
+import com.google.protobuf.nano.testimport.nano.UnittestImportNano;
+
+import junit.framework.TestCase;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Test nano runtime.
+ *
+ * @author ulas@google.com Ulas Kirazci
+ */
+public class NanoTest extends TestCase {
+ @Override
+ public void setUp() throws Exception {
+ }
+
+ public void testSimpleMessageNano() throws Exception {
+ SimpleMessageNano msg = new SimpleMessageNano();
+ assertEquals(123, msg.d);
+ assertEquals(null, msg.nestedMsg);
+ assertEquals(SimpleMessageNano.BAZ, msg.defaultNestedEnum);
+
+ msg.d = 456;
+ assertEquals(456, msg.d);
+
+ SimpleMessageNano.NestedMessage nestedMsg = new SimpleMessageNano.NestedMessage();
+ nestedMsg.bb = 2;
+ assertEquals(2, nestedMsg.bb);
+ msg.nestedMsg = nestedMsg;
+ assertEquals(2, msg.nestedMsg.bb);
+
+ msg.defaultNestedEnum = SimpleMessageNano.BAR;
+ assertEquals(SimpleMessageNano.BAR, msg.defaultNestedEnum);
+
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+
+ SimpleMessageNano newMsg = SimpleMessageNano.parseFrom(result);
+ assertEquals(456, newMsg.d);
+ assertEquals(2, msg.nestedMsg.bb);
+ assertEquals(SimpleMessageNano.BAR, msg.defaultNestedEnum);
+
+ msg.nestedMsg = null;
+ assertTrue(msgSerializedSize != msg.getSerializedSize());
+
+ msg.clear();
+ assertEquals(0, msg.getSerializedSize());
+ }
+
+ public void testRecursiveMessageNano() throws Exception {
+ RecursiveMessageNano msg = new RecursiveMessageNano();
+ assertTrue(msg.repeatedRecursiveMessageNano.length == 0);
+
+ RecursiveMessageNano msg1 = new RecursiveMessageNano();
+ msg1.id = 1;
+ assertEquals(1, msg1.id);
+ RecursiveMessageNano msg2 = new RecursiveMessageNano();
+ msg2.id = 2;
+ RecursiveMessageNano msg3 = new RecursiveMessageNano();
+ msg3.id = 3;
+
+ RecursiveMessageNano.NestedMessage nestedMsg = new RecursiveMessageNano.NestedMessage();
+ nestedMsg.a = msg1;
+ assertEquals(1, nestedMsg.a.id);
+
+ msg.id = 0;
+ msg.nestedMessage = nestedMsg;
+ msg.optionalRecursiveMessageNano = msg2;
+ msg.repeatedRecursiveMessageNano = new RecursiveMessageNano[] { msg3 };
+
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 16);
+ assertEquals(result.length, msgSerializedSize);
+
+ RecursiveMessageNano newMsg = RecursiveMessageNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedRecursiveMessageNano.length);
+
+ assertEquals(0, newMsg.id);
+ assertEquals(1, newMsg.nestedMessage.a.id);
+ assertEquals(2, newMsg.optionalRecursiveMessageNano.id);
+ assertEquals(3, newMsg.repeatedRecursiveMessageNano[0].id);
+ }
+
+ public void testMessageNoFields() {
+ SingleMessageNano msg = new SingleMessageNano();
+ assertEquals(0, msg.getSerializedSize());
+ assertEquals(0, MessageNano.toByteArray(msg).length);
+ }
+
+ public void testNanoRequiredInt32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.id = 123;
+ assertEquals(123, msg.id);
+ msg.clear().id = 456;
+ assertEquals(456, msg.id);
+ msg.clear();
+
+ msg.id = 123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 3);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(123, newMsg.id);
+ }
+
+ public void testNanoOptionalInt32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalInt32 = 123;
+ assertEquals(123, msg.optionalInt32);
+ msg.clear()
+ .optionalInt32 = 456;
+ assertEquals(456, msg.optionalInt32);
+ msg.clear();
+
+ msg.optionalInt32 = 123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 5);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(123, newMsg.optionalInt32);
+ }
+
+ public void testNanoOptionalInt64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalInt64 = 123;
+ assertEquals(123, msg.optionalInt64);
+ msg.clear()
+ .optionalInt64 = 456;
+ assertEquals(456, msg.optionalInt64);
+ msg.clear();
+ assertEquals(0, msg.optionalInt64);
+
+ msg.optionalInt64 = 123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 5);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(123, newMsg.optionalInt64);
+ }
+
+ public void testNanoOptionalUint32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalUint32 = 123;
+ assertEquals(123, msg.optionalUint32);
+ msg.clear()
+ .optionalUint32 = 456;
+ assertEquals(456, msg.optionalUint32);
+ msg.clear();
+ assertEquals(0, msg.optionalUint32);
+
+ msg.optionalUint32 = 123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 5);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(123, newMsg.optionalUint32);
+ }
+
+ public void testNanoOptionalUint64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalUint64 = 123;
+ assertEquals(123, msg.optionalUint64);
+ msg.clear()
+ .optionalUint64 = 456;
+ assertEquals(456, msg.optionalUint64);
+ msg.clear();
+ assertEquals(0, msg.optionalUint64);
+
+ msg.optionalUint64 = 123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 5);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(123, newMsg.optionalUint64);
+ }
+
+ public void testNanoOptionalSint32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalSint32 = 123;
+ assertEquals(123, msg.optionalSint32);
+ msg.clear()
+ .optionalSint32 = 456;
+ assertEquals(456, msg.optionalSint32);
+ msg.clear();
+ assertEquals(0, msg.optionalSint32);
+
+ msg.optionalSint32 = -123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(-123, newMsg.optionalSint32);
+ }
+
+ public void testNanoOptionalSint64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalSint64 = 123;
+ assertEquals(123, msg.optionalSint64);
+ msg.clear()
+ .optionalSint64 = 456;
+ assertEquals(456, msg.optionalSint64);
+ msg.clear();
+ assertEquals(0, msg.optionalSint64);
+
+ msg.optionalSint64 = -123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(-123, newMsg.optionalSint64);
+ }
+
+ public void testNanoOptionalFixed32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalFixed32 = 123;
+ assertEquals(123, msg.optionalFixed32);
+ msg.clear()
+ .optionalFixed32 = 456;
+ assertEquals(456, msg.optionalFixed32);
+ msg.clear();
+ assertEquals(0, msg.optionalFixed32);
+
+ msg.optionalFixed32 = 123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(123, newMsg.optionalFixed32);
+ }
+
+ public void testNanoOptionalFixed64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalFixed64 = 123;
+ assertEquals(123, msg.optionalFixed64);
+ msg.clear()
+ .optionalFixed64 = 456;
+ assertEquals(456, msg.optionalFixed64);
+ msg.clear();
+ assertEquals(0, msg.optionalFixed64);
+
+ msg.optionalFixed64 = 123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 12);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(123, newMsg.optionalFixed64);
+ }
+
+ public void testNanoOptionalSfixed32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalSfixed32 = 123;
+ assertEquals(123, msg.optionalSfixed32);
+ msg.clear()
+ .optionalSfixed32 = 456;
+ assertEquals(456, msg.optionalSfixed32);
+ msg.clear();
+ assertEquals(0, msg.optionalSfixed32);
+
+ msg.optionalSfixed32 = 123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(123, newMsg.optionalSfixed32);
+ }
+
+ public void testNanoOptionalSfixed64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalSfixed64 = 123;
+ assertEquals(123, msg.optionalSfixed64);
+ msg.clear()
+ .optionalSfixed64 = 456;
+ assertEquals(456, msg.optionalSfixed64);
+ msg.clear();
+ assertEquals(0, msg.optionalSfixed64);
+
+ msg.optionalSfixed64 = -123;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 12);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(-123, newMsg.optionalSfixed64);
+ }
+
+ public void testNanoOptionalFloat() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalFloat = 123f;
+ assertTrue(123.0f == msg.optionalFloat);
+ msg.clear()
+ .optionalFloat = 456.0f;
+ assertTrue(456.0f == msg.optionalFloat);
+ msg.clear();
+ assertTrue(0.0f == msg.optionalFloat);
+
+ msg.optionalFloat = -123.456f;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(-123.456f == newMsg.optionalFloat);
+ }
+
+ public void testNanoOptionalDouble() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalDouble = 123;
+ assertTrue(123.0 == msg.optionalDouble);
+ msg.clear()
+ .optionalDouble = 456.0;
+ assertTrue(456.0 == msg.optionalDouble);
+ msg.clear();
+ assertTrue(0.0 == msg.optionalDouble);
+
+ msg.optionalDouble = -123.456;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 12);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(-123.456 == newMsg.optionalDouble);
+ }
+
+ public void testNanoOptionalBool() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalBool = true;
+ assertTrue(msg.optionalBool);
+ msg.clear()
+ .optionalBool = true;
+ assertTrue(msg.optionalBool);
+ msg.clear();
+ assertFalse(msg.optionalBool);
+
+ msg.optionalBool = true;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 5);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalBool);
+ }
+
+ public void testNanoOptionalString() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalString = "hello";
+ assertEquals("hello", msg.optionalString);
+ msg.clear();
+ assertTrue(msg.optionalString.isEmpty());
+ msg.clear()
+ .optionalString = "hello2";
+ assertEquals("hello2", msg.optionalString);
+ msg.clear();
+ assertTrue(msg.optionalString.isEmpty());
+
+ msg.optionalString = "bye";
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalString != null);
+ assertEquals("bye", newMsg.optionalString);
+ }
+
+ public void testNanoOptionalBytes() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertFalse(msg.optionalBytes.length > 0);
+ msg.optionalBytes = InternalNano.copyFromUtf8("hello");
+ assertTrue(msg.optionalBytes.length > 0);
+ assertEquals("hello", new String(msg.optionalBytes, InternalNano.UTF_8));
+ msg.clear();
+ assertFalse(msg.optionalBytes.length > 0);
+ msg.clear()
+ .optionalBytes = InternalNano.copyFromUtf8("hello");
+ assertTrue(msg.optionalBytes.length > 0);
+ msg.clear();
+ assertFalse(msg.optionalBytes.length > 0);
+
+ msg.optionalBytes = InternalNano.copyFromUtf8("bye");
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalBytes.length > 0);
+ assertEquals("bye", new String(newMsg.optionalBytes, InternalNano.UTF_8));
+ }
+
+ public void testNanoOptionalGroup() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ TestAllTypesNano.OptionalGroup grp = new TestAllTypesNano.OptionalGroup();
+ grp.a = 1;
+ assertFalse(msg.optionalGroup != null);
+ msg.optionalGroup = grp;
+ assertTrue(msg.optionalGroup != null);
+ assertEquals(1, msg.optionalGroup.a);
+ msg.clear();
+ assertFalse(msg.optionalGroup != null);
+ msg.clear()
+ .optionalGroup = new TestAllTypesNano.OptionalGroup();
+ msg.optionalGroup.a = 2;
+ assertTrue(msg.optionalGroup != null);
+ msg.clear();
+ assertFalse(msg.optionalGroup != null);
+
+ msg.optionalGroup = grp;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 10);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalGroup != null);
+ assertEquals(1, newMsg.optionalGroup.a);
+ }
+
+ public void testNanoOptionalGroupWithUnknownFieldsEnabled() throws Exception {
+ MessageWithGroup msg = new MessageWithGroup();
+ MessageWithGroup.Group grp = new MessageWithGroup.Group();
+ grp.a = 1;
+ msg.group = grp;
+ byte [] serialized = MessageNano.toByteArray(msg);
+
+ MessageWithGroup parsed = MessageWithGroup.parseFrom(serialized);
+ assertEquals(1, parsed.group.a);
+
+ byte [] serialized2 = MessageNano.toByteArray(parsed);
+ assertEquals(serialized.length, serialized2.length);
+ MessageWithGroup parsed2 = MessageWithGroup.parseFrom(serialized2);
+ assertEquals(1, parsed2.group.a);
+ }
+
+ public void testNanoOptionalNestedMessage() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ TestAllTypesNano.NestedMessage nestedMsg = new TestAllTypesNano.NestedMessage();
+ nestedMsg.bb = 1;
+ assertFalse(msg.optionalNestedMessage != null);
+ msg.optionalNestedMessage = nestedMsg;
+ assertTrue(msg.optionalNestedMessage != null);
+ assertEquals(1, msg.optionalNestedMessage.bb);
+ msg.clear();
+ assertFalse(msg.optionalNestedMessage != null);
+ msg.clear()
+ .optionalNestedMessage = new TestAllTypesNano.NestedMessage();
+ msg.optionalNestedMessage.bb = 2;
+ assertTrue(msg.optionalNestedMessage != null);
+ msg.clear();
+ assertFalse(msg.optionalNestedMessage != null);
+
+ msg.optionalNestedMessage = nestedMsg;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalNestedMessage != null);
+ assertEquals(1, newMsg.optionalNestedMessage.bb);
+ }
+
+ public void testNanoOptionalForeignMessage() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ NanoOuterClass.ForeignMessageNano nestedMsg = new NanoOuterClass.ForeignMessageNano();
+ nestedMsg.c = 1;
+ assertFalse(msg.optionalForeignMessage != null);
+ msg.optionalForeignMessage = nestedMsg;
+ assertTrue(msg.optionalForeignMessage != null);
+ assertEquals(1, msg.optionalForeignMessage.c);
+ msg.clear();
+ assertFalse(msg.optionalForeignMessage != null);
+ msg.clear()
+ .optionalForeignMessage = new NanoOuterClass.ForeignMessageNano();
+ msg.optionalForeignMessage.c = 2;
+ assertTrue(msg.optionalForeignMessage != null);
+ msg.clear();
+ assertFalse(msg.optionalForeignMessage != null);
+
+ msg.optionalForeignMessage = nestedMsg;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalForeignMessage != null);
+ assertEquals(1, newMsg.optionalForeignMessage.c);
+ }
+
+ public void testNanoOptionalImportMessage() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ UnittestImportNano.ImportMessageNano nestedMsg = new UnittestImportNano.ImportMessageNano();
+ nestedMsg.d = 1;
+ assertFalse(msg.optionalImportMessage != null);
+ msg.optionalImportMessage = nestedMsg;
+ assertTrue(msg.optionalImportMessage != null);
+ assertEquals(1, msg.optionalImportMessage.d);
+ msg.clear();
+ assertFalse(msg.optionalImportMessage != null);
+ msg.clear()
+ .optionalImportMessage = new UnittestImportNano.ImportMessageNano();
+ msg.optionalImportMessage.d = 2;
+ assertTrue(msg.optionalImportMessage != null);
+ msg.clear();
+ assertFalse(msg.optionalImportMessage != null);
+
+ msg.optionalImportMessage = nestedMsg;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalImportMessage != null);
+ assertEquals(1, newMsg.optionalImportMessage.d);
+ }
+
+ public void testNanoOptionalNestedEnum() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalNestedEnum = TestAllTypesNano.BAR;
+ assertEquals(TestAllTypesNano.BAR, msg.optionalNestedEnum);
+ msg.clear()
+ .optionalNestedEnum = TestAllTypesNano.BAZ;
+ assertEquals(TestAllTypesNano.BAZ, msg.optionalNestedEnum);
+ msg.clear();
+ assertEquals(TestAllTypesNano.FOO, msg.optionalNestedEnum);
+
+ msg.optionalNestedEnum = TestAllTypesNano.BAR;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(TestAllTypesNano.BAR, newMsg.optionalNestedEnum);
+ }
+
+ public void testNanoOptionalForeignEnum() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalForeignEnum = NanoOuterClass.FOREIGN_NANO_BAR;
+ assertEquals(NanoOuterClass.FOREIGN_NANO_BAR, msg.optionalForeignEnum);
+ msg.clear()
+ .optionalForeignEnum = NanoOuterClass.FOREIGN_NANO_BAZ;
+ assertEquals(NanoOuterClass.FOREIGN_NANO_BAZ, msg.optionalForeignEnum);
+ msg.clear();
+ assertEquals(NanoOuterClass.FOREIGN_NANO_FOO, msg.optionalForeignEnum);
+
+ msg.optionalForeignEnum = NanoOuterClass.FOREIGN_NANO_BAR;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_BAR, newMsg.optionalForeignEnum);
+ }
+
+ public void testNanoOptionalImportEnum() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalImportEnum = UnittestImportNano.IMPORT_NANO_BAR;
+ assertEquals(UnittestImportNano.IMPORT_NANO_BAR, msg.optionalImportEnum);
+ msg.clear()
+ .optionalImportEnum = UnittestImportNano.IMPORT_NANO_BAZ;
+ assertEquals(UnittestImportNano.IMPORT_NANO_BAZ, msg.optionalImportEnum);
+ msg.clear();
+ assertEquals(UnittestImportNano.IMPORT_NANO_FOO, msg.optionalImportEnum);
+
+ msg.optionalImportEnum = UnittestImportNano.IMPORT_NANO_BAR;
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(UnittestImportNano.IMPORT_NANO_BAR, newMsg.optionalImportEnum);
+ }
+
+ public void testNanoOptionalStringPiece() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalStringPiece = "hello";
+ assertEquals("hello", msg.optionalStringPiece);
+ msg.clear();
+ assertTrue(msg.optionalStringPiece.isEmpty());
+ msg.clear()
+ .optionalStringPiece = "hello2";
+ assertEquals("hello2", msg.optionalStringPiece);
+ msg.clear();
+ assertTrue(msg.optionalStringPiece.isEmpty());
+
+ msg.optionalStringPiece = "bye";
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalStringPiece != null);
+ assertEquals("bye", newMsg.optionalStringPiece);
+ }
+
+ public void testNanoOptionalCord() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalCord = "hello";
+ assertEquals("hello", msg.optionalCord);
+ msg.clear();
+ assertTrue(msg.optionalCord.isEmpty());
+ msg.clear()
+ .optionalCord = "hello2";
+ assertEquals("hello2", msg.optionalCord);
+ msg.clear();
+ assertTrue(msg.optionalCord.isEmpty());
+
+ msg.optionalCord = "bye";
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertTrue(newMsg.optionalCord != null);
+ assertEquals("bye", newMsg.optionalCord);
+ }
+
+ public void testNanoRepeatedInt32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedInt32.length);
+ msg.repeatedInt32 = new int[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedInt32[1]);
+ assertEquals(456, msg.repeatedInt32[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedInt32.length);
+ msg.clear()
+ .repeatedInt32 = new int[] { 456 };
+ assertEquals(1, msg.repeatedInt32.length);
+ assertEquals(456, msg.repeatedInt32[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedInt32.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedInt32 = new int[] { 123 };
+ assertEquals(1, msg.repeatedInt32.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedInt32.length);
+ assertEquals(123, newMsg.repeatedInt32[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedInt32 = new int[] { 123, 456 };
+ assertEquals(2, msg.repeatedInt32.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 10);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedInt32.length);
+ assertEquals(123, newMsg.repeatedInt32[0]);
+ assertEquals(456, newMsg.repeatedInt32[1]);
+ }
+
+ public void testNanoRepeatedInt64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedInt64.length);
+ msg.repeatedInt64 = new long[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedInt64[1]);
+ assertEquals(456, msg.repeatedInt64[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedInt64.length);
+ msg.clear()
+ .repeatedInt64 = new long[] { 456 };
+ assertEquals(1, msg.repeatedInt64.length);
+ assertEquals(456, msg.repeatedInt64[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedInt64.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedInt64 = new long[] { 123 };
+ assertEquals(1, msg.repeatedInt64.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedInt64.length);
+ assertEquals(123, newMsg.repeatedInt64[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedInt64 = new long[] { 123, 456 };
+ assertEquals(2, msg.repeatedInt64.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 10);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedInt64.length);
+ assertEquals(123, newMsg.repeatedInt64[0]);
+ assertEquals(456, newMsg.repeatedInt64[1]);
+ }
+
+ public void testNanoRepeatedUint32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedUint32.length);
+ msg.repeatedUint32 = new int[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedUint32[1]);
+ assertEquals(456, msg.repeatedUint32[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedUint32.length);
+ msg.clear()
+ .repeatedUint32 = new int[] { 456 };
+ assertEquals(1, msg.repeatedUint32.length);
+ assertEquals(456, msg.repeatedUint32[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedUint32.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedUint32 = new int[] { 123 };
+ assertEquals(1, msg.repeatedUint32.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedUint32.length);
+ assertEquals(123, newMsg.repeatedUint32[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedUint32 = new int[] { 123, 456 };
+ assertEquals(2, msg.repeatedUint32.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 10);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedUint32.length);
+ assertEquals(123, newMsg.repeatedUint32[0]);
+ assertEquals(456, newMsg.repeatedUint32[1]);
+ }
+
+ public void testNanoRepeatedUint64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedUint64.length);
+ msg.repeatedUint64 = new long[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedUint64[1]);
+ assertEquals(456, msg.repeatedUint64[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedUint64.length);
+ msg.clear()
+ .repeatedUint64 = new long[] { 456 };
+ assertEquals(1, msg.repeatedUint64.length);
+ assertEquals(456, msg.repeatedUint64[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedUint64.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedUint64 = new long[] { 123 };
+ assertEquals(1, msg.repeatedUint64.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedUint64.length);
+ assertEquals(123, newMsg.repeatedUint64[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedUint64 = new long[] { 123, 456 };
+ assertEquals(2, msg.repeatedUint64.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 10);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedUint64.length);
+ assertEquals(123, newMsg.repeatedUint64[0]);
+ assertEquals(456, newMsg.repeatedUint64[1]);
+ }
+
+ public void testNanoRepeatedSint32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedSint32.length);
+ msg.repeatedSint32 = new int[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedSint32[1]);
+ assertEquals(456, msg.repeatedSint32[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedSint32.length);
+ msg.clear()
+ .repeatedSint32 = new int[] { 456 };
+ assertEquals(1, msg.repeatedSint32.length);
+ assertEquals(456, msg.repeatedSint32[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedSint32.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedSint32 = new int[] { 123 };
+ assertEquals(1, msg.repeatedSint32.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 7);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedSint32.length);
+ assertEquals(123, newMsg.repeatedSint32[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedSint32 = new int[] { 123, 456 };
+ assertEquals(2, msg.repeatedSint32.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 11);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedSint32.length);
+ assertEquals(123, newMsg.repeatedSint32[0]);
+ assertEquals(456, newMsg.repeatedSint32[1]);
+ }
+
+ public void testNanoRepeatedSint64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedSint64.length);
+ msg.repeatedSint64 = new long[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedSint64[1]);
+ assertEquals(456, msg.repeatedSint64[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedSint64.length);
+ msg.clear()
+ .repeatedSint64 = new long[] { 456 };
+ assertEquals(1, msg.repeatedSint64.length);
+ assertEquals(456, msg.repeatedSint64[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedSint64.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedSint64 = new long[] { 123 };
+ assertEquals(1, msg.repeatedSint64.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 7);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedSint64.length);
+ assertEquals(123, newMsg.repeatedSint64[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedSint64 = new long[] { 123, 456 };
+ assertEquals(2, msg.repeatedSint64.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 11);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedSint64.length);
+ assertEquals(123, newMsg.repeatedSint64[0]);
+ assertEquals(456, newMsg.repeatedSint64[1]);
+ }
+
+ public void testNanoRepeatedFixed32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedFixed32.length);
+ msg.repeatedFixed32 = new int[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedFixed32[1]);
+ assertEquals(456, msg.repeatedFixed32[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedFixed32.length);
+ msg.clear()
+ .repeatedFixed32 = new int[] { 456 };
+ assertEquals(1, msg.repeatedFixed32.length);
+ assertEquals(456, msg.repeatedFixed32[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedFixed32.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedFixed32 = new int[] { 123 };
+ assertEquals(1, msg.repeatedFixed32.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedFixed32.length);
+ assertEquals(123, newMsg.repeatedFixed32[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedFixed32 = new int[] { 123, 456 };
+ assertEquals(2, msg.repeatedFixed32.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 15);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedFixed32.length);
+ assertEquals(123, newMsg.repeatedFixed32[0]);
+ assertEquals(456, newMsg.repeatedFixed32[1]);
+ }
+
+ public void testNanoRepeatedFixed64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedFixed64.length);
+ msg.repeatedFixed64 = new long[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedFixed64[1]);
+ assertEquals(456, msg.repeatedFixed64[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedFixed64.length);
+ msg.clear()
+ .repeatedFixed64 = new long[] { 456 };
+ assertEquals(1, msg.repeatedFixed64.length);
+ assertEquals(456, msg.repeatedFixed64[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedFixed64.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedFixed64 = new long[] { 123 };
+ assertEquals(1, msg.repeatedFixed64.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 13);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedFixed64.length);
+ assertEquals(123, newMsg.repeatedFixed64[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedFixed64 = new long[] { 123, 456 };
+ assertEquals(2, msg.repeatedFixed64.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 23);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedFixed64.length);
+ assertEquals(123, newMsg.repeatedFixed64[0]);
+ assertEquals(456, newMsg.repeatedFixed64[1]);
+ }
+
+ public void testNanoRepeatedSfixed32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedSfixed32.length);
+ msg.repeatedSfixed32 = new int[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedSfixed32[1]);
+ assertEquals(456, msg.repeatedSfixed32[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedSfixed32.length);
+ msg.clear()
+ .repeatedSfixed32 = new int[] { 456 };
+ assertEquals(1, msg.repeatedSfixed32.length);
+ assertEquals(456, msg.repeatedSfixed32[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedSfixed32.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedSfixed32 = new int[] { 123 };
+ assertEquals(1, msg.repeatedSfixed32.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedSfixed32.length);
+ assertEquals(123, newMsg.repeatedSfixed32[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedSfixed32 = new int[] { 123, 456 };
+ assertEquals(2, msg.repeatedSfixed32.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 15);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedSfixed32.length);
+ assertEquals(123, newMsg.repeatedSfixed32[0]);
+ assertEquals(456, newMsg.repeatedSfixed32[1]);
+ }
+
+ public void testNanoRepeatedSfixed64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedSfixed64.length);
+ msg.repeatedSfixed64 = new long[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedSfixed64[1]);
+ assertEquals(456, msg.repeatedSfixed64[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedSfixed64.length);
+ msg.clear()
+ .repeatedSfixed64 = new long[] { 456 };
+ assertEquals(1, msg.repeatedSfixed64.length);
+ assertEquals(456, msg.repeatedSfixed64[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedSfixed64.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedSfixed64 = new long[] { 123 };
+ assertEquals(1, msg.repeatedSfixed64.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 13);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedSfixed64.length);
+ assertEquals(123, newMsg.repeatedSfixed64[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedSfixed64 = new long[] { 123, 456 };
+ assertEquals(2, msg.repeatedSfixed64.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 23);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedSfixed64.length);
+ assertEquals(123, newMsg.repeatedSfixed64[0]);
+ assertEquals(456, newMsg.repeatedSfixed64[1]);
+ }
+
+ public void testNanoRepeatedFloat() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedFloat.length);
+ msg.repeatedFloat = new float[] { 123f, 789f, 456f };
+ assertEquals(789f, msg.repeatedFloat[1]);
+ assertEquals(456f, msg.repeatedFloat[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedFloat.length);
+ msg.clear()
+ .repeatedFloat = new float[] { 456f };
+ assertEquals(1, msg.repeatedFloat.length);
+ assertEquals(456f, msg.repeatedFloat[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedFloat.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedFloat = new float[] { 123f };
+ assertEquals(1, msg.repeatedFloat.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedFloat.length);
+ assertEquals(123f, newMsg.repeatedFloat[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedFloat = new float[] { 123f, 456f };
+ assertEquals(2, msg.repeatedFloat.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 15);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedFloat.length);
+ assertEquals(123f, newMsg.repeatedFloat[0]);
+ assertEquals(456f, newMsg.repeatedFloat[1]);
+ }
+
+ public void testNanoRepeatedDouble() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedDouble.length);
+ msg.repeatedDouble = new double[] { 123.0, 789.0, 456.0 };
+ assertEquals(789.0, msg.repeatedDouble[1]);
+ assertEquals(456.0, msg.repeatedDouble[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedDouble.length);
+ msg.clear()
+ .repeatedDouble = new double[] { 456.0 };
+ assertEquals(1, msg.repeatedDouble.length);
+ assertEquals(456.0, msg.repeatedDouble[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedDouble.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedDouble = new double[] { 123.0 };
+ assertEquals(1, msg.repeatedDouble.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 13);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedDouble.length);
+ assertEquals(123.0, newMsg.repeatedDouble[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedDouble = new double[] { 123.0, 456.0 };
+ assertEquals(2, msg.repeatedDouble.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 23);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedDouble.length);
+ assertEquals(123.0, newMsg.repeatedDouble[0]);
+ assertEquals(456.0, newMsg.repeatedDouble[1]);
+ }
+
+ public void testNanoRepeatedBool() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedBool.length);
+ msg.repeatedBool = new boolean[] { false, true, false };
+ assertTrue(msg.repeatedBool[1]);
+ assertFalse(msg.repeatedBool[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedBool.length);
+ msg.clear()
+ .repeatedBool = new boolean[] { true };
+ assertEquals(1, msg.repeatedBool.length);
+ assertTrue(msg.repeatedBool[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedBool.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedBool = new boolean[] { false };
+ assertEquals(1, msg.repeatedBool.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedBool.length);
+ assertFalse(newMsg.repeatedBool[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedBool = new boolean[] { true, false };
+ assertEquals(2, msg.repeatedBool.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedBool.length);
+ assertTrue(newMsg.repeatedBool[0]);
+ assertFalse(newMsg.repeatedBool[1]);
+ }
+
+ public void testNanoRepeatedString() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedString.length);
+ msg.repeatedString = new String[] { "hello", "bye", "boo" };
+ assertEquals("bye", msg.repeatedString[1]);
+ assertEquals("boo", msg.repeatedString[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedString.length);
+ msg.clear()
+ .repeatedString = new String[] { "boo" };
+ assertEquals(1, msg.repeatedString.length);
+ assertEquals("boo", msg.repeatedString[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedString.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedString = new String[] { "" };
+ assertEquals(1, msg.repeatedString.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedString.length);
+ assertTrue(newMsg.repeatedString[0].isEmpty());
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedString = new String[] { "hello", "world" };
+ assertEquals(2, msg.repeatedString.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 19);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedString.length);
+ assertEquals("hello", newMsg.repeatedString[0]);
+ assertEquals("world", newMsg.repeatedString[1]);
+ }
+
+ public void testNanoRepeatedBytes() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedBytes.length);
+ msg.repeatedBytes = new byte[][] {
+ InternalNano.copyFromUtf8("hello"),
+ InternalNano.copyFromUtf8("bye"),
+ InternalNano.copyFromUtf8("boo")
+ };
+ assertEquals("bye", new String(msg.repeatedBytes[1], InternalNano.UTF_8));
+ assertEquals("boo", new String(msg.repeatedBytes[2], InternalNano.UTF_8));
+ msg.clear();
+ assertEquals(0, msg.repeatedBytes.length);
+ msg.clear()
+ .repeatedBytes = new byte[][] { InternalNano.copyFromUtf8("boo") };
+ assertEquals(1, msg.repeatedBytes.length);
+ assertEquals("boo", new String(msg.repeatedBytes[0], InternalNano.UTF_8));
+ msg.clear();
+ assertEquals(0, msg.repeatedBytes.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedBytes = new byte[][] { InternalNano.copyFromUtf8("") };
+ assertEquals(1, msg.repeatedBytes.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedBytes.length);
+ assertTrue(newMsg.repeatedBytes[0].length == 0);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedBytes = new byte[][] {
+ InternalNano.copyFromUtf8("hello"),
+ InternalNano.copyFromUtf8("world")
+ };
+ assertEquals(2, msg.repeatedBytes.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 19);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedBytes.length);
+ assertEquals("hello", new String(newMsg.repeatedBytes[0], InternalNano.UTF_8));
+ assertEquals("world", new String(newMsg.repeatedBytes[1], InternalNano.UTF_8));
+ }
+
+ public void testNanoRepeatedGroup() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ TestAllTypesNano.RepeatedGroup group0 =
+ new TestAllTypesNano.RepeatedGroup();
+ group0.a = 0;
+ TestAllTypesNano.RepeatedGroup group1 =
+ new TestAllTypesNano.RepeatedGroup();
+ group1.a = 1;
+ TestAllTypesNano.RepeatedGroup group2 =
+ new TestAllTypesNano.RepeatedGroup();
+ group2.a = 2;
+
+ msg.repeatedGroup = new TestAllTypesNano.RepeatedGroup[] { group0, group1, group2 };
+ assertEquals(3, msg.repeatedGroup.length);
+ assertEquals(0, msg.repeatedGroup[0].a);
+ assertEquals(1, msg.repeatedGroup[1].a);
+ assertEquals(2, msg.repeatedGroup[2].a);
+ msg.clear();
+ assertEquals(0, msg.repeatedGroup.length);
+ msg.clear()
+ .repeatedGroup = new TestAllTypesNano.RepeatedGroup[] { group1 };
+ assertEquals(1, msg.repeatedGroup.length);
+ assertEquals(1, msg.repeatedGroup[0].a);
+ msg.clear();
+ assertEquals(0, msg.repeatedGroup.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedGroup = new TestAllTypesNano.RepeatedGroup[] { group0 };
+ assertEquals(1, msg.repeatedGroup.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 7);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedGroup.length);
+ assertEquals(0, newMsg.repeatedGroup[0].a);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedGroup = new TestAllTypesNano.RepeatedGroup[] { group0, group1 };
+ assertEquals(2, msg.repeatedGroup.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 14);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedGroup.length);
+ assertEquals(0, newMsg.repeatedGroup[0].a);
+ assertEquals(1, newMsg.repeatedGroup[1].a);
+ }
+
+ public void testNanoRepeatedNestedMessage() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ TestAllTypesNano.NestedMessage nestedMsg0 =
+ new TestAllTypesNano.NestedMessage();
+ nestedMsg0.bb = 0;
+ TestAllTypesNano.NestedMessage nestedMsg1 =
+ new TestAllTypesNano.NestedMessage();
+ nestedMsg1.bb = 1;
+ TestAllTypesNano.NestedMessage nestedMsg2 =
+ new TestAllTypesNano.NestedMessage();
+ nestedMsg2.bb = 2;
+
+ msg.repeatedNestedMessage =
+ new TestAllTypesNano.NestedMessage[] { nestedMsg0, nestedMsg1, nestedMsg2 };
+ assertEquals(3, msg.repeatedNestedMessage.length);
+ assertEquals(0, msg.repeatedNestedMessage[0].bb);
+ assertEquals(1, msg.repeatedNestedMessage[1].bb);
+ assertEquals(2, msg.repeatedNestedMessage[2].bb);
+ msg.clear();
+ assertEquals(0, msg.repeatedNestedMessage.length);
+ msg.clear()
+ .repeatedNestedMessage = new TestAllTypesNano.NestedMessage[] { nestedMsg1 };
+ assertEquals(1, msg.repeatedNestedMessage.length);
+ assertEquals(1, msg.repeatedNestedMessage[0].bb);
+ msg.clear();
+ assertEquals(0, msg.repeatedNestedMessage.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedNestedMessage = new TestAllTypesNano.NestedMessage[] { nestedMsg0 };
+ assertEquals(1, msg.repeatedNestedMessage.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedNestedMessage.length);
+ assertEquals(0, newMsg.repeatedNestedMessage[0].bb);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedNestedMessage = new TestAllTypesNano.NestedMessage[] { nestedMsg0, nestedMsg1 };
+ assertEquals(2, msg.repeatedNestedMessage.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 11);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedNestedMessage.length);
+ assertEquals(0, newMsg.repeatedNestedMessage[0].bb);
+ assertEquals(1, newMsg.repeatedNestedMessage[1].bb);
+ }
+
+ public void testNanoRepeatedForeignMessage() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ NanoOuterClass.ForeignMessageNano foreignMsg0 =
+ new NanoOuterClass.ForeignMessageNano();
+ foreignMsg0.c = 0;
+ NanoOuterClass.ForeignMessageNano foreignMsg1 =
+ new NanoOuterClass.ForeignMessageNano();
+ foreignMsg1.c = 1;
+ NanoOuterClass.ForeignMessageNano foreignMsg2 =
+ new NanoOuterClass.ForeignMessageNano();
+ foreignMsg2.c = 2;
+
+ msg.repeatedForeignMessage =
+ new NanoOuterClass.ForeignMessageNano[] { foreignMsg0, foreignMsg1, foreignMsg2 };
+ assertEquals(3, msg.repeatedForeignMessage.length);
+ assertEquals(0, msg.repeatedForeignMessage[0].c);
+ assertEquals(1, msg.repeatedForeignMessage[1].c);
+ assertEquals(2, msg.repeatedForeignMessage[2].c);
+ msg.clear();
+ assertEquals(0, msg.repeatedForeignMessage.length);
+ msg.clear()
+ .repeatedForeignMessage = new NanoOuterClass.ForeignMessageNano[] { foreignMsg1 };
+ assertEquals(1, msg.repeatedForeignMessage.length);
+ assertEquals(1, msg.repeatedForeignMessage[0].c);
+ msg.clear();
+ assertEquals(0, msg.repeatedForeignMessage.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedForeignMessage = new NanoOuterClass.ForeignMessageNano[] { foreignMsg0 };
+ assertEquals(1, msg.repeatedForeignMessage.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedForeignMessage.length);
+ assertEquals(0, newMsg.repeatedForeignMessage[0].c);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedForeignMessage = new NanoOuterClass.ForeignMessageNano[] { foreignMsg0, foreignMsg1 };
+ assertEquals(2, msg.repeatedForeignMessage.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 11);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedForeignMessage.length);
+ assertEquals(0, newMsg.repeatedForeignMessage[0].c);
+ assertEquals(1, newMsg.repeatedForeignMessage[1].c);
+ }
+
+ public void testNanoRepeatedImportMessage() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ UnittestImportNano.ImportMessageNano foreignMsg0 =
+ new UnittestImportNano.ImportMessageNano();
+ foreignMsg0.d = 0;
+ UnittestImportNano.ImportMessageNano foreignMsg1 =
+ new UnittestImportNano.ImportMessageNano();
+ foreignMsg1.d = 1;
+ UnittestImportNano.ImportMessageNano foreignMsg2 =
+ new UnittestImportNano.ImportMessageNano();
+ foreignMsg2.d = 2;
+
+ msg.repeatedImportMessage =
+ new UnittestImportNano.ImportMessageNano[] { foreignMsg0, foreignMsg1, foreignMsg2 };
+ assertEquals(3, msg.repeatedImportMessage.length);
+ assertEquals(0, msg.repeatedImportMessage[0].d);
+ assertEquals(1, msg.repeatedImportMessage[1].d);
+ assertEquals(2, msg.repeatedImportMessage[2].d);
+ msg.clear();
+ assertEquals(0, msg.repeatedImportMessage.length);
+ msg.clear()
+ .repeatedImportMessage = new UnittestImportNano.ImportMessageNano[] { foreignMsg1 };
+ assertEquals(1, msg.repeatedImportMessage.length);
+ assertEquals(1, msg.repeatedImportMessage[0].d);
+ msg.clear();
+ assertEquals(0, msg.repeatedImportMessage.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedImportMessage = new UnittestImportNano.ImportMessageNano[] { foreignMsg0 };
+ assertEquals(1, msg.repeatedImportMessage.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedImportMessage.length);
+ assertEquals(0, newMsg.repeatedImportMessage[0].d);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedImportMessage = new UnittestImportNano.ImportMessageNano[] { foreignMsg0, foreignMsg1 };
+ assertEquals(2, msg.repeatedImportMessage.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 11);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedImportMessage.length);
+ assertEquals(0, newMsg.repeatedImportMessage[0].d);
+ assertEquals(1, newMsg.repeatedImportMessage[1].d);
+ }
+
+ public void testNanoRepeatedNestedEnum() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.repeatedNestedEnum = new int[] {
+ TestAllTypesNano.FOO,
+ TestAllTypesNano.BAR,
+ TestAllTypesNano.BAZ
+ };
+ assertEquals(3, msg.repeatedNestedEnum.length);
+ assertEquals(TestAllTypesNano.FOO, msg.repeatedNestedEnum[0]);
+ assertEquals(TestAllTypesNano.BAR, msg.repeatedNestedEnum[1]);
+ assertEquals(TestAllTypesNano.BAZ, msg.repeatedNestedEnum[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedNestedEnum.length);
+ msg.clear()
+ .repeatedNestedEnum = new int[] { TestAllTypesNano.BAR };
+ assertEquals(1, msg.repeatedNestedEnum.length);
+ assertEquals(TestAllTypesNano.BAR, msg.repeatedNestedEnum[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedNestedEnum.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedNestedEnum = new int[] { TestAllTypesNano.FOO };
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedNestedEnum.length);
+ assertEquals(TestAllTypesNano.FOO, msg.repeatedNestedEnum[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedNestedEnum = new int[] { TestAllTypesNano.FOO, TestAllTypesNano.BAR };
+ assertEquals(2, msg.repeatedNestedEnum.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedNestedEnum.length);
+ assertEquals(TestAllTypesNano.FOO, msg.repeatedNestedEnum[0]);
+ assertEquals(TestAllTypesNano.BAR, msg.repeatedNestedEnum[1]);
+ }
+
+ public void testNanoRepeatedForeignEnum() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.repeatedForeignEnum = new int[] {
+ NanoOuterClass.FOREIGN_NANO_FOO,
+ NanoOuterClass.FOREIGN_NANO_BAR,
+ NanoOuterClass.FOREIGN_NANO_BAZ
+ };
+ assertEquals(3, msg.repeatedForeignEnum.length);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_FOO, msg.repeatedForeignEnum[0]);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_BAR, msg.repeatedForeignEnum[1]);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_BAZ, msg.repeatedForeignEnum[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedForeignEnum.length);
+ msg.clear()
+ .repeatedForeignEnum = new int[] { NanoOuterClass.FOREIGN_NANO_BAR };
+ assertEquals(1, msg.repeatedForeignEnum.length);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_BAR, msg.repeatedForeignEnum[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedForeignEnum.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedForeignEnum = new int[] { NanoOuterClass.FOREIGN_NANO_FOO };
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedForeignEnum.length);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_FOO, msg.repeatedForeignEnum[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedForeignEnum = new int[] {
+ NanoOuterClass.FOREIGN_NANO_FOO,
+ NanoOuterClass.FOREIGN_NANO_BAR
+ };
+ assertEquals(2, msg.repeatedForeignEnum.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedForeignEnum.length);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_FOO, msg.repeatedForeignEnum[0]);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_BAR, msg.repeatedForeignEnum[1]);
+ }
+
+ public void testNanoRepeatedImportEnum() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.repeatedImportEnum = new int[] {
+ UnittestImportNano.IMPORT_NANO_FOO,
+ UnittestImportNano.IMPORT_NANO_BAR,
+ UnittestImportNano.IMPORT_NANO_BAZ
+ };
+ assertEquals(3, msg.repeatedImportEnum.length);
+ assertEquals(UnittestImportNano.IMPORT_NANO_FOO, msg.repeatedImportEnum[0]);
+ assertEquals(UnittestImportNano.IMPORT_NANO_BAR, msg.repeatedImportEnum[1]);
+ assertEquals(UnittestImportNano.IMPORT_NANO_BAZ, msg.repeatedImportEnum[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedImportEnum.length);
+ msg.clear()
+ .repeatedImportEnum = new int[] { UnittestImportNano.IMPORT_NANO_BAR };
+ assertEquals(1, msg.repeatedImportEnum.length);
+ assertEquals(UnittestImportNano.IMPORT_NANO_BAR, msg.repeatedImportEnum[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedImportEnum.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedImportEnum = new int[] { UnittestImportNano.IMPORT_NANO_FOO };
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedImportEnum.length);
+ assertEquals(UnittestImportNano.IMPORT_NANO_FOO, msg.repeatedImportEnum[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedImportEnum = new int[] {
+ UnittestImportNano.IMPORT_NANO_FOO,
+ UnittestImportNano.IMPORT_NANO_BAR
+ };
+ assertEquals(2, msg.repeatedImportEnum.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedImportEnum.length);
+ assertEquals(UnittestImportNano.IMPORT_NANO_FOO, msg.repeatedImportEnum[0]);
+ assertEquals(UnittestImportNano.IMPORT_NANO_BAR, msg.repeatedImportEnum[1]);
+ }
+
+ public void testNanoRepeatedStringPiece() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedStringPiece.length);
+ msg.repeatedStringPiece = new String[] { "hello", "bye", "boo" };
+ assertEquals("bye", msg.repeatedStringPiece[1]);
+ assertEquals("boo", msg.repeatedStringPiece[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedStringPiece.length);
+ msg.clear()
+ .repeatedStringPiece = new String[] { "boo" };
+ assertEquals(1, msg.repeatedStringPiece.length);
+ assertEquals("boo", msg.repeatedStringPiece[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedStringPiece.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedStringPiece = new String[] { "" };
+ assertEquals(1, msg.repeatedStringPiece.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedStringPiece.length);
+ assertTrue(newMsg.repeatedStringPiece[0].isEmpty());
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedStringPiece = new String[] { "hello", "world" };
+ assertEquals(2, msg.repeatedStringPiece.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 19);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedStringPiece.length);
+ assertEquals("hello", newMsg.repeatedStringPiece[0]);
+ assertEquals("world", newMsg.repeatedStringPiece[1]);
+ }
+
+ public void testNanoRepeatedCord() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedCord.length);
+ msg.repeatedCord = new String[] { "hello", "bye", "boo" };
+ assertEquals("bye", msg.repeatedCord[1]);
+ assertEquals("boo", msg.repeatedCord[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedCord.length);
+ msg.clear()
+ .repeatedCord = new String[] { "boo" };
+ assertEquals(1, msg.repeatedCord.length);
+ assertEquals("boo", msg.repeatedCord[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedCord.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedCord = new String[] { "" };
+ assertEquals(1, msg.repeatedCord.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 6);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedCord.length);
+ assertTrue(newMsg.repeatedCord[0].isEmpty());
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedCord = new String[] { "hello", "world" };
+ assertEquals(2, msg.repeatedCord.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 19);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedCord.length);
+ assertEquals("hello", newMsg.repeatedCord[0]);
+ assertEquals("world", newMsg.repeatedCord[1]);
+ }
+
+ public void testNanoRepeatedPackedInt32() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedPackedInt32.length);
+ msg.repeatedPackedInt32 = new int[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedPackedInt32[1]);
+ assertEquals(456, msg.repeatedPackedInt32[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedPackedInt32.length);
+ msg.clear()
+ .repeatedPackedInt32 = new int[] { 456 };
+ assertEquals(1, msg.repeatedPackedInt32.length);
+ assertEquals(456, msg.repeatedPackedInt32[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedPackedInt32.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedPackedInt32 = new int[] { 123 };
+ assertEquals(1, msg.repeatedPackedInt32.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 7);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedPackedInt32.length);
+ assertEquals(123, newMsg.repeatedPackedInt32[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedPackedInt32 = new int[] { 123, 456 };
+ assertEquals(2, msg.repeatedPackedInt32.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 9);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedPackedInt32.length);
+ assertEquals(123, newMsg.repeatedPackedInt32[0]);
+ assertEquals(456, newMsg.repeatedPackedInt32[1]);
+ }
+
+ public void testNanoRepeatedPackedSfixed64() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ assertEquals(0, msg.repeatedPackedSfixed64.length);
+ msg.repeatedPackedSfixed64 = new long[] { 123, 789, 456 };
+ assertEquals(789, msg.repeatedPackedSfixed64[1]);
+ assertEquals(456, msg.repeatedPackedSfixed64[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedPackedSfixed64.length);
+ msg.clear()
+ .repeatedPackedSfixed64 = new long[] { 456 };
+ assertEquals(1, msg.repeatedPackedSfixed64.length);
+ assertEquals(456, msg.repeatedPackedSfixed64[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedPackedSfixed64.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedPackedSfixed64 = new long[] { 123 };
+ assertEquals(1, msg.repeatedPackedSfixed64.length);
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 14);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedPackedSfixed64.length);
+ assertEquals(123, newMsg.repeatedPackedSfixed64[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedPackedSfixed64 = new long[] { 123, 456 };
+ assertEquals(2, msg.repeatedPackedSfixed64.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 22);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedPackedSfixed64.length);
+ assertEquals(123, newMsg.repeatedPackedSfixed64[0]);
+ assertEquals(456, newMsg.repeatedPackedSfixed64[1]);
+ }
+
+ public void testNanoRepeatedPackedNestedEnum() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.repeatedPackedNestedEnum = new int[] {
+ TestAllTypesNano.FOO,
+ TestAllTypesNano.BAR,
+ TestAllTypesNano.BAZ
+ };
+ assertEquals(3, msg.repeatedPackedNestedEnum.length);
+ assertEquals(TestAllTypesNano.FOO, msg.repeatedPackedNestedEnum[0]);
+ assertEquals(TestAllTypesNano.BAR, msg.repeatedPackedNestedEnum[1]);
+ assertEquals(TestAllTypesNano.BAZ, msg.repeatedPackedNestedEnum[2]);
+ msg.clear();
+ assertEquals(0, msg.repeatedPackedNestedEnum.length);
+ msg.clear()
+ .repeatedPackedNestedEnum = new int[] { TestAllTypesNano.BAR };
+ assertEquals(1, msg.repeatedPackedNestedEnum.length);
+ assertEquals(TestAllTypesNano.BAR, msg.repeatedPackedNestedEnum[0]);
+ msg.clear();
+ assertEquals(0, msg.repeatedPackedNestedEnum.length);
+
+ // Test 1 entry
+ msg.clear()
+ .repeatedPackedNestedEnum = new int[] { TestAllTypesNano.FOO };
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 7);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(1, newMsg.repeatedPackedNestedEnum.length);
+ assertEquals(TestAllTypesNano.FOO, msg.repeatedPackedNestedEnum[0]);
+
+ // Test 2 entries
+ msg.clear()
+ .repeatedPackedNestedEnum = new int[] { TestAllTypesNano.FOO, TestAllTypesNano.BAR };
+ assertEquals(2, msg.repeatedPackedNestedEnum.length);
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 8);
+ assertEquals(result.length, msgSerializedSize);
+
+ newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(2, newMsg.repeatedPackedNestedEnum.length);
+ assertEquals(TestAllTypesNano.FOO, msg.repeatedPackedNestedEnum[0]);
+ assertEquals(TestAllTypesNano.BAR, msg.repeatedPackedNestedEnum[1]);
+ }
+
+ public void testNanoRepeatedPackedSerializedSize() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.repeatedPackedInt32 = new int[] { 123, 789, 456 };
+ int msgSerializedSize = msg.getSerializedSize();
+ byte [] result = MessageNano.toByteArray(msg);
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 11);
+ assertEquals(result.length, msgSerializedSize);
+ TestAllTypesNano msg2 = new TestAllTypesNano();
+ msg2.repeatedPackedInt32 = new int[] { 123, 789, 456 };
+ byte [] result2 = new byte[msgSerializedSize];
+ MessageNano.toByteArray(msg2, result2, 0, msgSerializedSize);
+
+ // Check equal size and content.
+ assertEquals(msgSerializedSize, msg2.getSerializedSize());
+ assertTrue(Arrays.equals(result, result2));
+ }
+
+ public void testNanoRepeatedInt32ReMerge() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.repeatedInt32 = new int[] { 234 };
+ byte [] result1 = MessageNano.toByteArray(msg);
+
+ msg.clear().optionalInt32 = 789;
+ byte [] result2 = MessageNano.toByteArray(msg);
+
+ msg.clear().repeatedInt32 = new int[] { 123, 456 };
+ byte [] result3 = MessageNano.toByteArray(msg);
+
+ // Concatenate the three serializations and read as one message.
+ byte [] result = new byte[result1.length + result2.length + result3.length];
+ System.arraycopy(result1, 0, result, 0, result1.length);
+ System.arraycopy(result2, 0, result, result1.length, result2.length);
+ System.arraycopy(result3, 0, result, result1.length + result2.length, result3.length);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(789, newMsg.optionalInt32);
+ assertEquals(3, newMsg.repeatedInt32.length);
+ assertEquals(234, newMsg.repeatedInt32[0]);
+ assertEquals(123, newMsg.repeatedInt32[1]);
+ assertEquals(456, newMsg.repeatedInt32[2]);
+ }
+
+ public void testNanoRepeatedNestedEnumReMerge() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.repeatedNestedEnum = new int[] { TestAllTypesNano.FOO };
+ byte [] result1 = MessageNano.toByteArray(msg);
+
+ msg.clear().optionalInt32 = 789;
+ byte [] result2 = MessageNano.toByteArray(msg);
+
+ msg.clear().repeatedNestedEnum = new int[] { TestAllTypesNano.BAR, TestAllTypesNano.FOO };
+ byte [] result3 = MessageNano.toByteArray(msg);
+
+ // Concatenate the three serializations and read as one message.
+ byte [] result = new byte[result1.length + result2.length + result3.length];
+ System.arraycopy(result1, 0, result, 0, result1.length);
+ System.arraycopy(result2, 0, result, result1.length, result2.length);
+ System.arraycopy(result3, 0, result, result1.length + result2.length, result3.length);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(789, newMsg.optionalInt32);
+ assertEquals(3, newMsg.repeatedNestedEnum.length);
+ assertEquals(TestAllTypesNano.FOO, newMsg.repeatedNestedEnum[0]);
+ assertEquals(TestAllTypesNano.BAR, newMsg.repeatedNestedEnum[1]);
+ assertEquals(TestAllTypesNano.FOO, newMsg.repeatedNestedEnum[2]);
+ }
+
+ public void testNanoRepeatedNestedMessageReMerge() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ TestAllTypesNano.NestedMessage nestedMsg0 =
+ new TestAllTypesNano.NestedMessage();
+ nestedMsg0.bb = 0;
+ TestAllTypesNano.NestedMessage nestedMsg1 =
+ new TestAllTypesNano.NestedMessage();
+ nestedMsg1.bb = 1;
+ TestAllTypesNano.NestedMessage nestedMsg2 =
+ new TestAllTypesNano.NestedMessage();
+ nestedMsg2.bb = 2;
+
+ msg.repeatedNestedMessage = new TestAllTypesNano.NestedMessage[] { nestedMsg0 };
+ byte [] result1 = MessageNano.toByteArray(msg);
+
+ msg.clear().optionalInt32 = 789;
+ byte [] result2 = MessageNano.toByteArray(msg);
+
+ msg.clear().repeatedNestedMessage =
+ new TestAllTypesNano.NestedMessage[] { nestedMsg1, nestedMsg2 };
+ byte [] result3 = MessageNano.toByteArray(msg);
+
+ // Concatenate the three serializations and read as one message.
+ byte [] result = new byte[result1.length + result2.length + result3.length];
+ System.arraycopy(result1, 0, result, 0, result1.length);
+ System.arraycopy(result2, 0, result, result1.length, result2.length);
+ System.arraycopy(result3, 0, result, result1.length + result2.length, result3.length);
+
+ TestAllTypesNano newMsg = TestAllTypesNano.parseFrom(result);
+ assertEquals(789, newMsg.optionalInt32);
+ assertEquals(3, newMsg.repeatedNestedMessage.length);
+ assertEquals(nestedMsg0.bb, newMsg.repeatedNestedMessage[0].bb);
+ assertEquals(nestedMsg1.bb, newMsg.repeatedNestedMessage[1].bb);
+ assertEquals(nestedMsg2.bb, newMsg.repeatedNestedMessage[2].bb);
+ }
+
+ /**
+ * Tests that invalid enum values from the wire are not accepted.
+ */
+ public void testNanoEnumValidity() throws Exception {
+ final int invalid = 120;
+ final int alsoInvalid = 121;
+
+ EnumValidity.M m = new EnumValidity.M();
+ // Sanity check & baseline of the assertions for the first case below.
+ assertEquals(EnumValidity.E.default_, m.optionalE);
+ assertEquals(EnumValidity.E.BAZ, m.defaultE);
+
+ m.optionalE = invalid;
+ m.defaultE = invalid;
+ // E contains all valid values
+ m.repeatedE = new int[] {EnumValidity.E.FOO, EnumValidity.E.BAR};
+ m.packedE = new int[] {EnumValidity.E.FOO, EnumValidity.E.BAZ};
+ // E2 contains some invalid values
+ m.repeatedE2 = new int[] {invalid, EnumValidity.E.BAR, alsoInvalid};
+ m.packedE2 = new int[] {EnumValidity.E.FOO, invalid, alsoInvalid};
+ // E3 contains all invalid values
+ m.repeatedE3 = new int[] {invalid, invalid};
+ m.packedE3 = new int[] {alsoInvalid, alsoInvalid};
+ byte[] serialized = MessageNano.toByteArray(m);
+ // Sanity check that we do have all data in the byte array.
+ assertEquals(31, serialized.length);
+
+ // Test 1: tests that invalid values aren't included in the deserialized message.
+ EnumValidity.M deserialized = MessageNano.mergeFrom(new EnumValidity.M(), serialized);
+ assertEquals(EnumValidity.E.default_, deserialized.optionalE);
+ assertEquals(EnumValidity.E.BAZ, deserialized.defaultE);
+ assertTrue(Arrays.equals(
+ new int[] {EnumValidity.E.FOO, EnumValidity.E.BAR}, deserialized.repeatedE));
+ assertTrue(Arrays.equals(
+ new int[] {EnumValidity.E.FOO, EnumValidity.E.BAZ}, deserialized.packedE));
+ assertTrue(Arrays.equals(
+ new int[] {EnumValidity.E.BAR}, deserialized.repeatedE2));
+ assertTrue(Arrays.equals(
+ new int[] {EnumValidity.E.FOO}, deserialized.packedE2));
+ assertEquals(0, deserialized.repeatedE3.length);
+ assertEquals(0, deserialized.packedE3.length);
+
+ // Test 2: tests that invalid values do not override previous values in the field, including
+ // arrays, including pre-existing invalid values.
+ deserialized.optionalE = EnumValidity.E.BAR;
+ deserialized.defaultE = alsoInvalid;
+ deserialized.repeatedE = new int[] {EnumValidity.E.BAZ};
+ deserialized.packedE = new int[] {EnumValidity.E.BAZ, alsoInvalid};
+ deserialized.repeatedE2 = new int[] {invalid, alsoInvalid};
+ deserialized.packedE2 = null;
+ deserialized.repeatedE3 = null;
+ deserialized.packedE3 = new int[0];
+ MessageNano.mergeFrom(deserialized, serialized);
+ assertEquals(EnumValidity.E.BAR, deserialized.optionalE);
+ assertEquals(alsoInvalid, deserialized.defaultE);
+ assertTrue(Arrays.equals(
+ new int[] {EnumValidity.E.BAZ, /* + */ EnumValidity.E.FOO, EnumValidity.E.BAR},
+ deserialized.repeatedE));
+ assertTrue(Arrays.equals(
+ new int[] {EnumValidity.E.BAZ, alsoInvalid, /* + */ EnumValidity.E.FOO, EnumValidity.E.BAZ},
+ deserialized.packedE));
+ assertTrue(Arrays.equals(
+ new int[] {invalid, alsoInvalid, /* + */ EnumValidity.E.BAR},
+ deserialized.repeatedE2));
+ assertTrue(Arrays.equals(
+ new int[] {/* <null> + */ EnumValidity.E.FOO},
+ deserialized.packedE2));
+ assertNull(deserialized.repeatedE3); // null + all invalid == null
+ assertEquals(0, deserialized.packedE3.length); // empty + all invalid == empty
+
+ // Test 3: reading by alternative forms
+ EnumValidity.Alt alt = MessageNano.mergeFrom(new EnumValidity.Alt(), serialized);
+ assertEquals(EnumValidity.E.BAR, // last valid value in m.repeatedE2
+ alt.repeatedE2AsOptional);
+ assertTrue(Arrays.equals(new int[] {EnumValidity.E.FOO}, alt.packedE2AsNonPacked));
+ assertEquals(0, alt.nonPackedE3AsPacked.length);
+ }
+
+ /**
+ * Tests the same as {@link #testNanoEnumValidity()} with accessor style. Repeated fields are
+ * not re-tested here because they are not affected by the accessor style.
+ */
+ public void testNanoEnumValidityAccessors() throws Exception {
+ final int invalid = 120;
+ final int alsoInvalid = 121;
+
+ EnumValidityAccessors.M m = new EnumValidityAccessors.M();
+ // Sanity check & baseline of the assertions for the first case below.
+ assertEquals(EnumValidityAccessors.default_, m.getOptionalE());
+ assertEquals(EnumValidityAccessors.BAZ, m.getDefaultE());
+
+ m.setOptionalE(invalid);
+ m.setDefaultE(invalid);
+ // Set repeatedE2 for Alt.repeatedE2AsOptional
+ m.repeatedE2 = new int[] {invalid, EnumValidityAccessors.BAR, alsoInvalid};
+ byte[] serialized = MessageNano.toByteArray(m);
+ // Sanity check that we do have all data in the byte array.
+ assertEquals(10, serialized.length);
+
+ // Test 1: tests that invalid values aren't included in the deserialized message.
+ EnumValidityAccessors.M deserialized =
+ MessageNano.mergeFrom(new EnumValidityAccessors.M(), serialized);
+ assertEquals(EnumValidityAccessors.default_, deserialized.getOptionalE());
+ assertEquals(EnumValidityAccessors.BAZ, deserialized.getDefaultE());
+
+ // Test 2: tests that invalid values do not override previous values in the field, including
+ // pre-existing invalid values.
+ deserialized.setOptionalE(EnumValidityAccessors.BAR);
+ deserialized.setDefaultE(alsoInvalid);
+ MessageNano.mergeFrom(deserialized, serialized);
+ assertEquals(EnumValidityAccessors.BAR, deserialized.getOptionalE());
+ assertEquals(alsoInvalid, deserialized.getDefaultE());
+
+ // Test 3: reading by alternative forms
+ EnumValidityAccessors.Alt alt =
+ MessageNano.mergeFrom(new EnumValidityAccessors.Alt(), serialized);
+ assertEquals(EnumValidityAccessors.BAR, // last valid value in m.repeatedE2
+ alt.getRepeatedE2AsOptional());
+ }
+
+ /**
+ * Tests that code generation correctly wraps a single message into its outer
+ * class. The class {@code SingleMessageNano} is imported from the outer
+ * class {@code UnittestSingleNano}, whose name is implicit. Any error would
+ * cause this method to fail compilation.
+ */
+ public void testNanoSingle() throws Exception {
+ SingleMessageNano msg = new SingleMessageNano();
+ assertNotNull(msg);
+ }
+
+ /**
+ * Tests that code generation correctly skips generating the outer class if
+ * unnecessary, letting a file-scope entity have the same name. The class
+ * {@code MultipleNameClashNano} shares the same name with the file's outer
+ * class defined explicitly, but the file contains no other entities and has
+ * java_multiple_files set. Any error would cause this method to fail
+ * compilation.
+ */
+ public void testNanoMultipleNameClash() throws Exception {
+ MultipleNameClashNano msg = new MultipleNameClashNano();
+ msg.field = 0;
+ }
+
+ /**
+ * Tests that code generation correctly handles enums in different scopes in
+ * a source file with the option java_multiple_files set to true. Any error
+ * would cause this method to fail compilation.
+ */
+ public void testNanoMultipleEnumScoping() throws Exception {
+ FileScopeEnumRefNano msg1 = new FileScopeEnumRefNano();
+ msg1.enumField = UnittestMultipleNano.ONE;
+ MessageScopeEnumRefNano msg2 = new MessageScopeEnumRefNano();
+ msg2.enumField = MessageScopeEnumRefNano.TWO;
+ }
+
+ /**
+ * Tests that code generation with mixed values of the java_multiple_files
+ * options between the main source file and the imported source files would
+ * generate correct references. Any error would cause this method to fail
+ * compilation.
+ */
+ public void testNanoMultipleImportingNonMultiple() throws Exception {
+ UnittestImportNano.ImportMessageNano importMsg = new UnittestImportNano.ImportMessageNano();
+ MultipleImportingNonMultipleNano1 nano1 = new MultipleImportingNonMultipleNano1();
+ nano1.field = importMsg;
+ MultipleImportingNonMultipleNano2 nano2 = new MultipleImportingNonMultipleNano2();
+ nano2.nano1 = nano1;
+ }
+
+ public void testNanoDefaults() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ for (int i = 0; i < 2; i++) {
+ assertEquals(41, msg.defaultInt32);
+ assertEquals(42, msg.defaultInt64);
+ assertEquals(43, msg.defaultUint32);
+ assertEquals(44, msg.defaultUint64);
+ assertEquals(-45, msg.defaultSint32);
+ assertEquals(46, msg.defaultSint64);
+ assertEquals(47, msg.defaultFixed32);
+ assertEquals(48, msg.defaultFixed64);
+ assertEquals(49, msg.defaultSfixed32);
+ assertEquals(-50, msg.defaultSfixed64);
+ assertTrue(51.5f == msg.defaultFloat);
+ assertTrue(52.0e3 == msg.defaultDouble);
+ assertEquals(true, msg.defaultBool);
+ assertEquals("hello", msg.defaultString);
+ assertEquals("world", new String(msg.defaultBytes, InternalNano.UTF_8));
+ assertEquals("dünya", msg.defaultStringNonascii);
+ assertEquals("dünyab", new String(msg.defaultBytesNonascii, InternalNano.UTF_8));
+ assertEquals(TestAllTypesNano.BAR, msg.defaultNestedEnum);
+ assertEquals(NanoOuterClass.FOREIGN_NANO_BAR, msg.defaultForeignEnum);
+ assertEquals(UnittestImportNano.IMPORT_NANO_BAR, msg.defaultImportEnum);
+ assertEquals(Float.POSITIVE_INFINITY, msg.defaultFloatInf);
+ assertEquals(Float.NEGATIVE_INFINITY, msg.defaultFloatNegInf);
+ assertEquals(Float.NaN, msg.defaultFloatNan);
+ assertEquals(Double.POSITIVE_INFINITY, msg.defaultDoubleInf);
+ assertEquals(Double.NEGATIVE_INFINITY, msg.defaultDoubleNegInf);
+ assertEquals(Double.NaN, msg.defaultDoubleNan);
+
+ // Default values are not output, except for required fields.
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 3);
+ assertEquals(result.length, msgSerializedSize);
+ msg.clear();
+ }
+ }
+
+ public void testDifferentStringLengthsNano() throws Exception {
+ // Test string serialization roundtrip using strings of the following lengths,
+ // with ASCII and Unicode characters requiring different UTF-8 byte counts per
+ // char, hence causing the length delimiter varint to sometimes require more
+ // bytes for the Unicode strings than the ASCII string of the same length.
+ int[] lengths = new int[] {
+ 0,
+ 1,
+ (1 << 4) - 1, // 1 byte for ASCII and Unicode
+ (1 << 7) - 1, // 1 byte for ASCII, 2 bytes for Unicode
+ (1 << 11) - 1, // 2 bytes for ASCII and Unicode
+ (1 << 14) - 1, // 2 bytes for ASCII, 3 bytes for Unicode
+ (1 << 17) - 1, // 3 bytes for ASCII and Unicode
+ };
+ for (int i : lengths) {
+ testEncodingOfString('q', i); // 1 byte per char
+ testEncodingOfString('\u07FF', i); // 2 bytes per char
+ testEncodingOfString('\u0981', i); // 3 bytes per char
+ }
+ }
+
+ /** Regression test for https://github.com/google/protobuf/issues/292 */
+ public void testCorrectExceptionThrowWhenEncodingStringsWithoutEnoughSpace() throws Exception {
+ String testCase = "Foooooooo";
+ assertEquals(CodedOutputByteBufferNano.computeRawVarint32Size(testCase.length()),
+ CodedOutputByteBufferNano.computeRawVarint32Size(testCase.length() * 3));
+ assertEquals(11, CodedOutputByteBufferNano.computeStringSize(1, testCase));
+ // Tag is one byte, varint describing string length is 1 byte, string length is 9 bytes.
+ // An array of size 1 will cause a failure when trying to write the varint.
+ for (int i = 0; i < 11; i++) {
+ CodedOutputByteBufferNano bufferNano = CodedOutputByteBufferNano.newInstance(new byte[i]);
+ try {
+ bufferNano.writeString(1, testCase);
+ fail("Should have thrown an out of space exception");
+ } catch (CodedOutputByteBufferNano.OutOfSpaceException expected) {}
+ }
+ }
+
+ private void testEncodingOfString(char c, int length) throws InvalidProtocolBufferNanoException {
+ TestAllTypesNano testAllTypesNano = new TestAllTypesNano();
+ final String fullString = fullString(c, length);
+ testAllTypesNano.optionalString = fullString;
+ final TestAllTypesNano resultNano = new TestAllTypesNano();
+ MessageNano.mergeFrom(resultNano, MessageNano.toByteArray(testAllTypesNano));
+ assertEquals(fullString, resultNano.optionalString);
+ }
+
+ private String fullString(char c, int length) {
+ char[] result = new char[length];
+ Arrays.fill(result, c);
+ return new String(result);
+ }
+
+ public void testNanoWithHasParseFrom() throws Exception {
+ TestAllTypesNanoHas msg = null;
+ // Test false on creation, after clear and upon empty parse.
+ for (int i = 0; i < 3; i++) {
+ if (i == 0) {
+ msg = new TestAllTypesNanoHas();
+ } else if (i == 1) {
+ msg.clear();
+ } else if (i == 2) {
+ msg = TestAllTypesNanoHas.parseFrom(new byte[0]);
+ }
+ assertFalse(msg.hasOptionalInt32);
+ assertFalse(msg.hasOptionalString);
+ assertFalse(msg.hasOptionalBytes);
+ assertFalse(msg.hasOptionalNestedEnum);
+ assertFalse(msg.hasDefaultInt32);
+ assertFalse(msg.hasDefaultString);
+ assertFalse(msg.hasDefaultBytes);
+ assertFalse(msg.hasDefaultFloatNan);
+ assertFalse(msg.hasDefaultNestedEnum);
+ assertFalse(msg.hasId);
+ assertFalse(msg.hasRequiredEnum);
+ msg.optionalInt32 = 123;
+ msg.optionalNestedMessage = new TestAllTypesNanoHas.NestedMessage();
+ msg.optionalNestedMessage.bb = 2;
+ msg.optionalNestedEnum = TestAllTypesNano.BAZ;
+ }
+
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 10);
+ assertEquals(result.length, msgSerializedSize);
+
+ // Has fields true upon parse.
+ TestAllTypesNanoHas newMsg = TestAllTypesNanoHas.parseFrom(result);
+ assertEquals(123, newMsg.optionalInt32);
+ assertTrue(newMsg.hasOptionalInt32);
+ assertEquals(2, newMsg.optionalNestedMessage.bb);
+ assertTrue(newMsg.optionalNestedMessage.hasBb);
+ assertEquals(TestAllTypesNanoHas.BAZ, newMsg.optionalNestedEnum);
+ assertTrue(newMsg.hasOptionalNestedEnum);
+ }
+
+ public void testNanoWithHasSerialize() throws Exception {
+ TestAllTypesNanoHas msg = new TestAllTypesNanoHas();
+ msg.hasOptionalInt32 = true;
+ msg.hasOptionalString = true;
+ msg.hasOptionalBytes = true;
+ msg.optionalNestedMessage = new TestAllTypesNanoHas.NestedMessage();
+ msg.optionalNestedMessage.hasBb = true;
+ msg.hasOptionalNestedEnum = true;
+ msg.hasDefaultInt32 = true;
+ msg.hasDefaultString = true;
+ msg.hasDefaultBytes = true;
+ msg.hasDefaultFloatNan = true;
+ msg.hasDefaultNestedEnum = true;
+ msg.hasId = true;
+ msg.hasRequiredEnum = true;
+
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ assertEquals(result.length, msgSerializedSize);
+
+ // Now deserialize and find that all fields are set and equal to their defaults.
+ TestAllTypesNanoHas newMsg = TestAllTypesNanoHas.parseFrom(result);
+ assertTrue(newMsg.hasOptionalInt32);
+ assertTrue(newMsg.hasOptionalString);
+ assertTrue(newMsg.hasOptionalBytes);
+ assertTrue(newMsg.optionalNestedMessage.hasBb);
+ assertTrue(newMsg.hasOptionalNestedEnum);
+ assertTrue(newMsg.hasDefaultInt32);
+ assertTrue(newMsg.hasDefaultString);
+ assertTrue(newMsg.hasDefaultBytes);
+ assertTrue(newMsg.hasDefaultFloatNan);
+ assertTrue(newMsg.hasDefaultNestedEnum);
+ assertTrue(newMsg.hasId);
+ assertTrue(newMsg.hasRequiredEnum);
+ assertEquals(0, newMsg.optionalInt32);
+ assertEquals(0, newMsg.optionalString.length());
+ assertEquals(0, newMsg.optionalBytes.length);
+ assertEquals(0, newMsg.optionalNestedMessage.bb);
+ assertEquals(TestAllTypesNanoHas.FOO, newMsg.optionalNestedEnum);
+ assertEquals(41, newMsg.defaultInt32);
+ assertEquals("hello", newMsg.defaultString);
+ assertEquals("world", new String(newMsg.defaultBytes, InternalNano.UTF_8));
+ assertEquals(TestAllTypesNanoHas.BAR, newMsg.defaultNestedEnum);
+ assertEquals(Float.NaN, newMsg.defaultFloatNan);
+ assertEquals(0, newMsg.id);
+ assertEquals(TestAllTypesNanoHas.FOO, newMsg.requiredEnum);
+ }
+
+ public void testNanoWithAccessorsBasic() throws Exception {
+ TestNanoAccessors msg = new TestNanoAccessors();
+
+ // Makes sure required, repeated, and message fields are still public
+ msg.id = 3;
+ msg.repeatedBytes = new byte[2][3];
+ msg.optionalNestedMessage = null;
+
+ // Test accessors
+ assertEquals(0, msg.getOptionalInt32());
+ assertFalse(msg.hasOptionalInt32());
+ msg.setOptionalInt32(135);
+ assertEquals(135, msg.getOptionalInt32());
+ assertTrue(msg.hasOptionalInt32());
+ msg.clearOptionalInt32();
+ assertFalse(msg.hasOptionalInt32());
+ msg.setOptionalInt32(0); // default value
+ assertTrue(msg.hasOptionalInt32());
+
+ // Test NPE
+ try {
+ msg.setOptionalBytes(null);
+ fail();
+ } catch (NullPointerException expected) {}
+ try {
+ msg.setOptionalString(null);
+ fail();
+ } catch (NullPointerException expected) {}
+
+ // Test has bit on bytes field with defaults and clear() re-clones the default array
+ assertFalse(msg.hasDefaultBytes());
+ byte[] defaultBytes = msg.getDefaultBytes();
+ msg.setDefaultBytes(defaultBytes);
+ assertTrue(msg.hasDefaultBytes());
+ msg.clearDefaultBytes();
+ assertFalse(msg.hasDefaultBytes());
+ defaultBytes[0]++; // modify original array
+ assertFalse(Arrays.equals(defaultBytes, msg.getDefaultBytes()));
+
+ // Test has bits that require additional bit fields
+ assertFalse(msg.hasBitFieldCheck());
+ msg.setBitFieldCheck(0);
+ assertTrue(msg.hasBitFieldCheck());
+ assertFalse(msg.hasBeforeBitFieldCheck()); // checks bit field does not leak
+ assertFalse(msg.hasAfterBitFieldCheck());
+
+ // Test clear() clears has bits
+ msg.setOptionalString("hi");
+ msg.setDefaultString("there");
+ msg.clear();
+ assertFalse(msg.hasOptionalString());
+ assertFalse(msg.hasDefaultString());
+ assertFalse(msg.hasBitFieldCheck());
+
+ // Test set() and clear() returns itself (compiles = success)
+ msg.clear()
+ .setOptionalInt32(3)
+ .clearDefaultBytes()
+ .setOptionalString("4");
+ }
+
+ public void testNanoWithAccessorsParseFrom() throws Exception {
+ TestNanoAccessors msg = null;
+ // Test false on creation, after clear and upon empty parse.
+ for (int i = 0; i < 3; i++) {
+ if (i == 0) {
+ msg = new TestNanoAccessors();
+ } else if (i == 1) {
+ msg.clear();
+ } else if (i == 2) {
+ msg = TestNanoAccessors.parseFrom(new byte[0]);
+ }
+ assertFalse(msg.hasOptionalInt32());
+ assertFalse(msg.hasOptionalString());
+ assertFalse(msg.hasOptionalBytes());
+ assertFalse(msg.hasOptionalNestedEnum());
+ assertFalse(msg.hasDefaultInt32());
+ assertFalse(msg.hasDefaultString());
+ assertFalse(msg.hasDefaultBytes());
+ assertFalse(msg.hasDefaultFloatNan());
+ assertFalse(msg.hasDefaultNestedEnum());
+ msg.optionalNestedMessage = new TestNanoAccessors.NestedMessage();
+ msg.optionalNestedMessage.setBb(2);
+ msg.setOptionalNestedEnum(TestNanoAccessors.BAZ);
+ msg.setDefaultInt32(msg.getDefaultInt32());
+ }
+
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
+ assertTrue(msgSerializedSize == 14);
+ assertEquals(result.length, msgSerializedSize);
+
+ // Has fields true upon parse.
+ TestNanoAccessors newMsg = TestNanoAccessors.parseFrom(result);
+ assertEquals(2, newMsg.optionalNestedMessage.getBb());
+ assertTrue(newMsg.optionalNestedMessage.hasBb());
+ assertEquals(TestNanoAccessors.BAZ, newMsg.getOptionalNestedEnum());
+ assertTrue(newMsg.hasOptionalNestedEnum());
+
+ // Has field true on fields with explicit default values from wire.
+ assertTrue(newMsg.hasDefaultInt32());
+ assertEquals(41, newMsg.getDefaultInt32());
+ }
+
+ public void testNanoWithAccessorsPublicFieldTypes() throws Exception {
+ TestNanoAccessors msg = new TestNanoAccessors();
+ assertNull(msg.optionalNestedMessage);
+ assertEquals(0, msg.id);
+ assertEquals(0, msg.repeatedNestedEnum.length);
+
+ TestNanoAccessors newMsg = TestNanoAccessors.parseFrom(MessageNano.toByteArray(msg));
+ assertNull(newMsg.optionalNestedMessage);
+ assertEquals(0, newMsg.id);
+ assertEquals(0, newMsg.repeatedNestedEnum.length);
+
+ TestNanoAccessors.NestedMessage nestedMessage = new TestNanoAccessors.NestedMessage();
+ nestedMessage.setBb(5);
+ newMsg.optionalNestedMessage = nestedMessage;
+ newMsg.id = -1;
+ newMsg.repeatedNestedEnum = new int[] { TestAllTypesNano.FOO };
+
+ TestNanoAccessors newMsg2 = TestNanoAccessors.parseFrom(MessageNano.toByteArray(newMsg));
+ assertEquals(nestedMessage.getBb(), newMsg2.optionalNestedMessage.getBb());
+ assertEquals(-1, newMsg2.id);
+ assertEquals(TestAllTypesNano.FOO, newMsg2.repeatedNestedEnum[0]);
+
+ newMsg2.optionalNestedMessage = null;
+ newMsg2.id = 0;
+ newMsg2.repeatedNestedEnum = null;
+
+ TestNanoAccessors newMsg3 = TestNanoAccessors.parseFrom(MessageNano.toByteArray(newMsg2));
+ assertNull(newMsg3.optionalNestedMessage);
+ assertEquals(0, newMsg3.id);
+ assertEquals(0, newMsg3.repeatedNestedEnum.length);
+ }
+
+ public void testNanoWithAccessorsSerialize() throws Exception {
+ TestNanoAccessors msg = new TestNanoAccessors();
+ msg.setOptionalInt32(msg.getOptionalInt32());
+ msg.setOptionalString(msg.getOptionalString());
+ msg.setOptionalBytes(msg.getOptionalBytes());
+ TestNanoAccessors.NestedMessage nestedMessage = new TestNanoAccessors.NestedMessage();
+ nestedMessage.setBb(nestedMessage.getBb());
+ msg.optionalNestedMessage = nestedMessage;
+ msg.setOptionalNestedEnum(msg.getOptionalNestedEnum());
+ msg.setDefaultInt32(msg.getDefaultInt32());
+ msg.setDefaultString(msg.getDefaultString());
+ msg.setDefaultBytes(msg.getDefaultBytes());
+ msg.setDefaultFloatNan(msg.getDefaultFloatNan());
+ msg.setDefaultNestedEnum(msg.getDefaultNestedEnum());
+
+ byte [] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ assertEquals(result.length, msgSerializedSize);
+
+ // Now deserialize and find that all fields are set and equal to their defaults.
+ TestNanoAccessors newMsg = TestNanoAccessors.parseFrom(result);
+ assertTrue(newMsg.hasOptionalInt32());
+ assertTrue(newMsg.hasOptionalString());
+ assertTrue(newMsg.hasOptionalBytes());
+ assertTrue(newMsg.optionalNestedMessage.hasBb());
+ assertTrue(newMsg.hasOptionalNestedEnum());
+ assertTrue(newMsg.hasDefaultInt32());
+ assertTrue(newMsg.hasDefaultString());
+ assertTrue(newMsg.hasDefaultBytes());
+ assertTrue(newMsg.hasDefaultFloatNan());
+ assertTrue(newMsg.hasDefaultNestedEnum());
+ assertEquals(0, newMsg.getOptionalInt32());
+ assertEquals(0, newMsg.getOptionalString().length());
+ assertEquals(0, newMsg.getOptionalBytes().length);
+ assertEquals(0, newMsg.optionalNestedMessage.getBb());
+ assertEquals(TestNanoAccessors.FOO, newMsg.getOptionalNestedEnum());
+ assertEquals(41, newMsg.getDefaultInt32());
+ assertEquals("hello", newMsg.getDefaultString());
+ assertEquals("world", new String(newMsg.getDefaultBytes(), InternalNano.UTF_8));
+ assertEquals(TestNanoAccessors.BAR, newMsg.getDefaultNestedEnum());
+ assertEquals(Float.NaN, newMsg.getDefaultFloatNan());
+ assertEquals(0, newMsg.id);
+ }
+
+ public void testNanoJavaEnumStyle() throws Exception {
+ EnumClassNanos.EnumClassNano msg = new EnumClassNanos.EnumClassNano();
+ assertEquals(EnumClassNanos.FileScopeEnum.ONE, msg.one);
+ assertEquals(EnumClassNanos.EnumClassNano.MessageScopeEnum.TWO, msg.two);
+
+ EnumClassNanoMultiple msg2 = new EnumClassNanoMultiple();
+ assertEquals(FileScopeEnumMultiple.THREE, msg2.three);
+ assertEquals(EnumClassNanoMultiple.MessageScopeEnumMultiple.FOUR, msg2.four);
+ }
+
+ /**
+ * Tests that fields with a default value of NaN are not serialized when
+ * set to NaN. This is a special case as NaN != NaN, so normal equality
+ * checks don't work.
+ */
+ public void testNanoNotANumberDefaults() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.defaultDoubleNan = 0;
+ msg.defaultFloatNan = 0;
+ byte[] result = MessageNano.toByteArray(msg);
+ int msgSerializedSize = msg.getSerializedSize();
+ assertTrue(result.length == msgSerializedSize);
+ assertTrue(msgSerializedSize > 3);
+
+ msg.defaultDoubleNan = Double.NaN;
+ msg.defaultFloatNan = Float.NaN;
+ result = MessageNano.toByteArray(msg);
+ msgSerializedSize = msg.getSerializedSize();
+ assertEquals(3, result.length);
+ assertEquals(3, msgSerializedSize);
+ }
+
+ /**
+ * Test that a bug in skipRawBytes() has been fixed: if the skip skips
+ * exactly up to a limit, this should not break things.
+ */
+ public void testSkipRawBytesBug() throws Exception {
+ byte[] rawBytes = new byte[] { 1, 2 };
+ CodedInputByteBufferNano input = CodedInputByteBufferNano.newInstance(rawBytes);
+
+ int limit = input.pushLimit(1);
+ input.skipRawBytes(1);
+ input.popLimit(limit);
+ assertEquals(2, input.readRawByte());
+ }
+
+ /**
+ * Test that a bug in skipRawBytes() has been fixed: if the skip skips
+ * past the end of a buffer with a limit that has been set past the end of
+ * that buffer, this should not break things.
+ */
+ public void testSkipRawBytesPastEndOfBufferWithLimit() throws Exception {
+ byte[] rawBytes = new byte[] { 1, 2, 3, 4, 5 };
+ CodedInputByteBufferNano input = CodedInputByteBufferNano.newInstance(rawBytes);
+
+ int limit = input.pushLimit(4);
+ // In order to expose the bug we need to read at least one byte to prime the
+ // buffer inside the CodedInputStream.
+ assertEquals(1, input.readRawByte());
+ // Skip to the end of the limit.
+ input.skipRawBytes(3);
+ assertTrue(input.isAtEnd());
+ input.popLimit(limit);
+ assertEquals(5, input.readRawByte());
+ }
+
+ // Test a smattering of various proto types for printing
+ public void testMessageNanoPrinter() {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.optionalInt32 = 14;
+ msg.optionalFloat = 42.3f;
+ msg.optionalString = "String \"with' both quotes";
+ msg.optionalBytes = new byte[] {'"', '\0', 1, 8};
+ msg.optionalGroup = new TestAllTypesNano.OptionalGroup();
+ msg.optionalGroup.a = 15;
+ msg.repeatedInt64 = new long[2];
+ msg.repeatedInt64[0] = 1L;
+ msg.repeatedInt64[1] = -1L;
+ msg.repeatedBytes = new byte[2][];
+ msg.repeatedBytes[1] = new byte[] {'h', 'e', 'l', 'l', 'o'};
+ msg.repeatedGroup = new TestAllTypesNano.RepeatedGroup[2];
+ msg.repeatedGroup[0] = new TestAllTypesNano.RepeatedGroup();
+ msg.repeatedGroup[0].a = -27;
+ msg.repeatedGroup[1] = new TestAllTypesNano.RepeatedGroup();
+ msg.repeatedGroup[1].a = -72;
+ msg.optionalNestedMessage = new TestAllTypesNano.NestedMessage();
+ msg.optionalNestedMessage.bb = 7;
+ msg.repeatedNestedMessage = new TestAllTypesNano.NestedMessage[2];
+ msg.repeatedNestedMessage[0] = new TestAllTypesNano.NestedMessage();
+ msg.repeatedNestedMessage[0].bb = 77;
+ msg.repeatedNestedMessage[1] = new TestAllTypesNano.NestedMessage();
+ msg.repeatedNestedMessage[1].bb = 88;
+ msg.optionalNestedEnum = TestAllTypesNano.BAZ;
+ msg.repeatedNestedEnum = new int[2];
+ msg.repeatedNestedEnum[0] = TestAllTypesNano.BAR;
+ msg.repeatedNestedEnum[1] = TestAllTypesNano.FOO;
+ msg.repeatedStringPiece = new String[] {null, "world"};
+ msg.setOneofString("hello");
+
+ String protoPrint = msg.toString();
+ assertTrue(protoPrint.contains("optional_int32: 14"));
+ assertTrue(protoPrint.contains("optional_float: 42.3"));
+ assertTrue(protoPrint.contains("optional_double: 0.0"));
+ assertTrue(protoPrint.contains("optional_string: \"String \\u0022with\\u0027 both quotes\""));
+ assertTrue(protoPrint.contains("optional_bytes: \"\\\"\\000\\001\\010\""));
+ assertTrue(protoPrint.contains("optional_group <\n a: 15\n>"));
+
+ assertTrue(protoPrint.contains("repeated_int64: 1\nrepeated_int64: -1"));
+ assertFalse(protoPrint.contains("repeated_bytes: \"\"")); // null should be dropped
+ assertTrue(protoPrint.contains("repeated_bytes: \"hello\""));
+ assertTrue(protoPrint.contains("repeated_group <\n a: -27\n>\n"
+ + "repeated_group <\n a: -72\n>"));
+ assertTrue(protoPrint.contains("optional_nested_message <\n bb: 7\n>"));
+ assertTrue(protoPrint.contains("repeated_nested_message <\n bb: 77\n>\n"
+ + "repeated_nested_message <\n bb: 88\n>"));
+ assertTrue(protoPrint.contains("optional_nested_enum: 3"));
+ assertTrue(protoPrint.contains("repeated_nested_enum: 2\nrepeated_nested_enum: 1"));
+ assertTrue(protoPrint.contains("default_int32: 41"));
+ assertTrue(protoPrint.contains("default_string: \"hello\""));
+ assertFalse(protoPrint.contains("repeated_string_piece: \"\"")); // null should be dropped
+ assertTrue(protoPrint.contains("repeated_string_piece: \"world\""));
+ assertTrue(protoPrint.contains("oneof_string: \"hello\""));
+ }
+
+ public void testMessageNanoPrinterAccessors() throws Exception {
+ TestNanoAccessors msg = new TestNanoAccessors();
+ msg.setOptionalInt32(13);
+ msg.setOptionalString("foo");
+ msg.setOptionalBytes(new byte[] {'"', '\0', 1, 8});
+ msg.optionalNestedMessage = new TestNanoAccessors.NestedMessage();
+ msg.optionalNestedMessage.setBb(7);
+ msg.setOptionalNestedEnum(TestNanoAccessors.BAZ);
+ msg.repeatedInt32 = new int[] { 1, -1 };
+ msg.repeatedString = new String[] { "Hello", "world" };
+ msg.repeatedBytes = new byte[2][];
+ msg.repeatedBytes[1] = new byte[] {'h', 'e', 'l', 'l', 'o'};
+ msg.repeatedNestedMessage = new TestNanoAccessors.NestedMessage[2];
+ msg.repeatedNestedMessage[0] = new TestNanoAccessors.NestedMessage();
+ msg.repeatedNestedMessage[0].setBb(5);
+ msg.repeatedNestedMessage[1] = new TestNanoAccessors.NestedMessage();
+ msg.repeatedNestedMessage[1].setBb(6);
+ msg.repeatedNestedEnum = new int[] { TestNanoAccessors.FOO, TestNanoAccessors.BAR };
+ msg.id = 33;
+
+ String protoPrint = msg.toString();
+ assertTrue(protoPrint.contains("optional_int32: 13"));
+ assertTrue(protoPrint.contains("optional_string: \"foo\""));
+ assertTrue(protoPrint.contains("optional_bytes: \"\\\"\\000\\001\\010\""));
+ assertTrue(protoPrint.contains("optional_nested_message <\n bb: 7\n>"));
+ assertTrue(protoPrint.contains("optional_nested_enum: 3"));
+ assertTrue(protoPrint.contains("repeated_int32: 1\nrepeated_int32: -1"));
+ assertTrue(protoPrint.contains("repeated_string: \"Hello\"\nrepeated_string: \"world\""));
+ assertFalse(protoPrint.contains("repeated_bytes: \"\"")); // null should be dropped
+ assertTrue(protoPrint.contains("repeated_bytes: \"hello\""));
+ assertTrue(protoPrint.contains("repeated_nested_message <\n bb: 5\n>\n"
+ + "repeated_nested_message <\n bb: 6\n>"));
+ assertTrue(protoPrint.contains("repeated_nested_enum: 1\nrepeated_nested_enum: 2"));
+ assertTrue(protoPrint.contains("id: 33"));
+ }
+
+ public void testMessageNanoPrinterForMaps() throws Exception {
+ TestMap msg = new TestMap();
+ MessageValue msgValues[] = new MessageValue[] {
+ new MessageValue(), new MessageValue()
+ };
+ msgValues[0].value = 1;
+ msgValues[1].value = 2;
+ msg.int32ToBytesField = new HashMap<Integer, byte[]>();
+ msg.int32ToBytesField.put(1, new byte[] {'"', '\0'});
+ msg.int32ToBytesField.put(2, new byte[] {1, 8});
+ msg.stringToInt32Field = new HashMap<String, Integer>();
+ msg.stringToInt32Field.put("hello", 1);
+ msg.stringToInt32Field.put("world", 2);
+ msg.int32ToMessageField = new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ msg.int32ToMessageField.put(0, msgValues[0]);
+ msg.int32ToMessageField.put(1, msgValues[1]);
+ msg.int32ToEnumField = new HashMap<Integer, Integer>();
+ msg.int32ToEnumField.put(1, 2);
+ msg.int32ToEnumField.put(2, 3);
+ String protoPrint = msg.toString();
+
+ assertTrue(protoPrint.contains(
+ "int32_to_bytes_field <\n key: 1\n value: \"\\\"\\000\"\n>"));
+ assertTrue(protoPrint.contains(
+ "int32_to_bytes_field <\n key: 2\n value: \"\\001\\010\"\n>"));
+ assertTrue(protoPrint.contains(
+ "string_to_int32_field <\n key: \"hello\"\n value: 1\n>"));
+ assertTrue(protoPrint.contains(
+ "string_to_int32_field <\n key: \"world\"\n value: 2\n>"));
+ assertTrue(protoPrint.contains(
+ "int32_to_message_field <\n key: 0\n value <\n value: 1\n"));
+ assertTrue(protoPrint.contains(
+ "int32_to_message_field <\n key: 1\n value <\n value: 2\n"));
+ assertTrue(protoPrint.contains(
+ "int32_to_enum_field <\n key: 1\n value: 2\n>"));
+ assertTrue(protoPrint.contains(
+ "int32_to_enum_field <\n key: 2\n value: 3\n>"));
+ }
+
+ public void testExtensions() throws Exception {
+ Extensions.ExtendableMessage message = new Extensions.ExtendableMessage();
+ message.field = 5;
+ int[] int32s = {1, 2};
+ int[] uint32s = {3, 4};
+ int[] sint32s = {-5, -6};
+ long[] int64s = {7, 8};
+ long[] uint64s = {9, 10};
+ long[] sint64s = {-11, -12};
+ int[] fixed32s = {13, 14};
+ int[] sfixed32s = {-15, -16};
+ long[] fixed64s = {17, 18};
+ long[] sfixed64s = {-19, -20};
+ boolean[] bools = {true, false};
+ float[] floats = {2.1f, 2.2f};
+ double[] doubles = {2.3, 2.4};
+ int[] enums = {Extensions.SECOND_VALUE, Extensions.FIRST_VALUE};
+ String[] strings = {"vijfentwintig", "twenty-six"};
+ byte[][] bytess = {{2, 7}, {2, 8}};
+ AnotherMessage another1 = new AnotherMessage();
+ another1.string = "er shi jiu";
+ another1.value = false;
+ AnotherMessage another2 = new AnotherMessage();
+ another2.string = "trente";
+ another2.value = true;
+ AnotherMessage[] messages = {another1, another2};
+ RepeatedExtensions.RepeatedGroup group1 = new RepeatedExtensions.RepeatedGroup();
+ group1.a = 31;
+ RepeatedExtensions.RepeatedGroup group2 = new RepeatedExtensions.RepeatedGroup();
+ group2.a = 32;
+ RepeatedExtensions.RepeatedGroup[] groups = {group1, group2};
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedInt32));
+ message.setExtension(RepeatedExtensions.repeatedInt32, int32s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedInt32));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedUint32));
+ message.setExtension(RepeatedExtensions.repeatedUint32, uint32s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedUint32));
+ message.setExtension(RepeatedExtensions.repeatedSint32, sint32s);
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedInt64));
+ message.setExtension(RepeatedExtensions.repeatedInt64, int64s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedInt64));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedUint64));
+ message.setExtension(RepeatedExtensions.repeatedUint64, uint64s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedUint64));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedSint64));
+ message.setExtension(RepeatedExtensions.repeatedSint64, sint64s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedSint64));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedFixed32));
+ message.setExtension(RepeatedExtensions.repeatedFixed32, fixed32s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedFixed32));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedSfixed32));
+ message.setExtension(RepeatedExtensions.repeatedSfixed32, sfixed32s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedSfixed32));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedFixed64));
+ message.setExtension(RepeatedExtensions.repeatedFixed64, fixed64s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedFixed64));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedSfixed64));
+ message.setExtension(RepeatedExtensions.repeatedSfixed64, sfixed64s);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedSfixed64));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedBool));
+ message.setExtension(RepeatedExtensions.repeatedBool, bools);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedBool));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedFloat));
+ message.setExtension(RepeatedExtensions.repeatedFloat, floats);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedFloat));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedDouble));
+ message.setExtension(RepeatedExtensions.repeatedDouble, doubles);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedDouble));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedEnum));
+ message.setExtension(RepeatedExtensions.repeatedEnum, enums);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedEnum));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedString));
+ message.setExtension(RepeatedExtensions.repeatedString, strings);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedString));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedBytes));
+ message.setExtension(RepeatedExtensions.repeatedBytes, bytess);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedBytes));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedMessage));
+ message.setExtension(RepeatedExtensions.repeatedMessage, messages);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedMessage));
+ assertFalse(message.hasExtension(RepeatedExtensions.repeatedGroup));
+ message.setExtension(RepeatedExtensions.repeatedGroup, groups);
+ assertTrue(message.hasExtension(RepeatedExtensions.repeatedGroup));
+
+ byte[] data = MessageNano.toByteArray(message);
+ message = Extensions.ExtendableMessage.parseFrom(data);
+ assertEquals(5, message.field);
+
+ // Test reading back using SingularExtensions: the retrieved value should equal the last
+ // in each array.
+ assertEquals(int32s[1], (int) message.getExtension(SingularExtensions.someInt32));
+ assertEquals(uint32s[1], (int) message.getExtension(SingularExtensions.someUint32));
+ assertEquals(sint32s[1], (int) message.getExtension(SingularExtensions.someSint32));
+ assertEquals(int64s[1], (long) message.getExtension(SingularExtensions.someInt64));
+ assertEquals(uint64s[1], (long) message.getExtension(SingularExtensions.someUint64));
+ assertEquals(sint64s[1], (long) message.getExtension(SingularExtensions.someSint64));
+ assertEquals(fixed32s[1], (int) message.getExtension(SingularExtensions.someFixed32));
+ assertEquals(sfixed32s[1], (int) message.getExtension(SingularExtensions.someSfixed32));
+ assertEquals(fixed64s[1], (long) message.getExtension(SingularExtensions.someFixed64));
+ assertEquals(sfixed64s[1], (long) message.getExtension(SingularExtensions.someSfixed64));
+ assertEquals(bools[1], (boolean) message.getExtension(SingularExtensions.someBool));
+ assertEquals(floats[1], (float) message.getExtension(SingularExtensions.someFloat));
+ assertEquals(doubles[1], (double) message.getExtension(SingularExtensions.someDouble));
+ assertEquals(enums[1], (int) message.getExtension(SingularExtensions.someEnum));
+ assertEquals(strings[1], message.getExtension(SingularExtensions.someString));
+ assertTrue(Arrays.equals(bytess[1], message.getExtension(SingularExtensions.someBytes)));
+ AnotherMessage deserializedMessage = message.getExtension(SingularExtensions.someMessage);
+ assertEquals(another2.string, deserializedMessage.string);
+ assertEquals(another2.value, deserializedMessage.value);
+ assertEquals(group2.a, message.getExtension(SingularExtensions.someGroup).a);
+
+ // Test reading back using RepeatedExtensions: the arrays should be equal.
+ message = Extensions.ExtendableMessage.parseFrom(data);
+ assertEquals(5, message.field);
+ assertTrue(Arrays.equals(int32s, message.getExtension(RepeatedExtensions.repeatedInt32)));
+ assertTrue(Arrays.equals(uint32s, message.getExtension(RepeatedExtensions.repeatedUint32)));
+ assertTrue(Arrays.equals(sint32s, message.getExtension(RepeatedExtensions.repeatedSint32)));
+ assertTrue(Arrays.equals(int64s, message.getExtension(RepeatedExtensions.repeatedInt64)));
+ assertTrue(Arrays.equals(uint64s, message.getExtension(RepeatedExtensions.repeatedUint64)));
+ assertTrue(Arrays.equals(sint64s, message.getExtension(RepeatedExtensions.repeatedSint64)));
+ assertTrue(Arrays.equals(fixed32s, message.getExtension(RepeatedExtensions.repeatedFixed32)));
+ assertTrue(Arrays.equals(sfixed32s, message.getExtension(RepeatedExtensions.repeatedSfixed32)));
+ assertTrue(Arrays.equals(fixed64s, message.getExtension(RepeatedExtensions.repeatedFixed64)));
+ assertTrue(Arrays.equals(sfixed64s, message.getExtension(RepeatedExtensions.repeatedSfixed64)));
+ assertTrue(Arrays.equals(bools, message.getExtension(RepeatedExtensions.repeatedBool)));
+ assertTrue(Arrays.equals(floats, message.getExtension(RepeatedExtensions.repeatedFloat)));
+ assertTrue(Arrays.equals(doubles, message.getExtension(RepeatedExtensions.repeatedDouble)));
+ assertTrue(Arrays.equals(enums, message.getExtension(RepeatedExtensions.repeatedEnum)));
+ assertTrue(Arrays.equals(strings, message.getExtension(RepeatedExtensions.repeatedString)));
+ byte[][] deserializedRepeatedBytes = message.getExtension(RepeatedExtensions.repeatedBytes);
+ assertEquals(2, deserializedRepeatedBytes.length);
+ assertTrue(Arrays.equals(bytess[0], deserializedRepeatedBytes[0]));
+ assertTrue(Arrays.equals(bytess[1], deserializedRepeatedBytes[1]));
+ AnotherMessage[] deserializedRepeatedMessage =
+ message.getExtension(RepeatedExtensions.repeatedMessage);
+ assertEquals(2, deserializedRepeatedMessage.length);
+ assertEquals(another1.string, deserializedRepeatedMessage[0].string);
+ assertEquals(another1.value, deserializedRepeatedMessage[0].value);
+ assertEquals(another2.string, deserializedRepeatedMessage[1].string);
+ assertEquals(another2.value, deserializedRepeatedMessage[1].value);
+ RepeatedExtensions.RepeatedGroup[] deserializedRepeatedGroup =
+ message.getExtension(RepeatedExtensions.repeatedGroup);
+ assertEquals(2, deserializedRepeatedGroup.length);
+ assertEquals(group1.a, deserializedRepeatedGroup[0].a);
+ assertEquals(group2.a, deserializedRepeatedGroup[1].a);
+
+ message = Extensions.ExtendableMessage.parseFrom(data);
+ assertEquals(5, message.field);
+ // Test hasExtension using PackedExtensions.
+ assertTrue(message.hasExtension(PackedExtensions.packedInt32));
+ assertTrue(message.hasExtension(PackedExtensions.packedUint32));
+ assertTrue(message.hasExtension(PackedExtensions.packedSint32));
+ assertTrue(message.hasExtension(PackedExtensions.packedInt64));
+ assertTrue(message.hasExtension(PackedExtensions.packedUint64));
+ assertTrue(message.hasExtension(PackedExtensions.packedSint64));
+ assertTrue(message.hasExtension(PackedExtensions.packedFixed32));
+ assertTrue(message.hasExtension(PackedExtensions.packedSfixed32));
+ assertTrue(message.hasExtension(PackedExtensions.packedFixed64));
+ assertTrue(message.hasExtension(PackedExtensions.packedSfixed64));
+ assertTrue(message.hasExtension(PackedExtensions.packedBool));
+ assertTrue(message.hasExtension(PackedExtensions.packedFloat));
+ assertTrue(message.hasExtension(PackedExtensions.packedDouble));
+ assertTrue(message.hasExtension(PackedExtensions.packedEnum));
+
+ // Test reading back using PackedExtensions: the arrays should be equal, even the fields
+ // are non-packed.
+ assertTrue(Arrays.equals(int32s, message.getExtension(PackedExtensions.packedInt32)));
+ assertTrue(Arrays.equals(uint32s, message.getExtension(PackedExtensions.packedUint32)));
+ assertTrue(Arrays.equals(sint32s, message.getExtension(PackedExtensions.packedSint32)));
+ assertTrue(Arrays.equals(int64s, message.getExtension(PackedExtensions.packedInt64)));
+ assertTrue(Arrays.equals(uint64s, message.getExtension(PackedExtensions.packedUint64)));
+ assertTrue(Arrays.equals(sint64s, message.getExtension(PackedExtensions.packedSint64)));
+ assertTrue(Arrays.equals(fixed32s, message.getExtension(PackedExtensions.packedFixed32)));
+ assertTrue(Arrays.equals(sfixed32s, message.getExtension(PackedExtensions.packedSfixed32)));
+ assertTrue(Arrays.equals(fixed64s, message.getExtension(PackedExtensions.packedFixed64)));
+ assertTrue(Arrays.equals(sfixed64s, message.getExtension(PackedExtensions.packedSfixed64)));
+ assertTrue(Arrays.equals(bools, message.getExtension(PackedExtensions.packedBool)));
+ assertTrue(Arrays.equals(floats, message.getExtension(PackedExtensions.packedFloat)));
+ assertTrue(Arrays.equals(doubles, message.getExtension(PackedExtensions.packedDouble)));
+ assertTrue(Arrays.equals(enums, message.getExtension(PackedExtensions.packedEnum)));
+
+ // Now set the packable extension values using PackedExtensions so they're serialized packed.
+ message.setExtension(PackedExtensions.packedInt32, int32s);
+ message.setExtension(PackedExtensions.packedUint32, uint32s);
+ message.setExtension(PackedExtensions.packedSint32, sint32s);
+ message.setExtension(PackedExtensions.packedInt64, int64s);
+ message.setExtension(PackedExtensions.packedUint64, uint64s);
+ message.setExtension(PackedExtensions.packedSint64, sint64s);
+ message.setExtension(PackedExtensions.packedFixed32, fixed32s);
+ message.setExtension(PackedExtensions.packedSfixed32, sfixed32s);
+ message.setExtension(PackedExtensions.packedFixed64, fixed64s);
+ message.setExtension(PackedExtensions.packedSfixed64, sfixed64s);
+ message.setExtension(PackedExtensions.packedBool, bools);
+ message.setExtension(PackedExtensions.packedFloat, floats);
+ message.setExtension(PackedExtensions.packedDouble, doubles);
+ message.setExtension(PackedExtensions.packedEnum, enums);
+
+ // And read back using non-packed RepeatedExtensions.
+ byte[] data2 = MessageNano.toByteArray(message);
+ message = MessageNano.mergeFrom(new Extensions.ExtendableMessage(), data2);
+ assertTrue(Arrays.equals(int32s, message.getExtension(RepeatedExtensions.repeatedInt32)));
+ assertTrue(Arrays.equals(uint32s, message.getExtension(RepeatedExtensions.repeatedUint32)));
+ assertTrue(Arrays.equals(sint32s, message.getExtension(RepeatedExtensions.repeatedSint32)));
+ assertTrue(Arrays.equals(int64s, message.getExtension(RepeatedExtensions.repeatedInt64)));
+ assertTrue(Arrays.equals(uint64s, message.getExtension(RepeatedExtensions.repeatedUint64)));
+ assertTrue(Arrays.equals(sint64s, message.getExtension(RepeatedExtensions.repeatedSint64)));
+ assertTrue(Arrays.equals(fixed32s, message.getExtension(RepeatedExtensions.repeatedFixed32)));
+ assertTrue(Arrays.equals(sfixed32s, message.getExtension(RepeatedExtensions.repeatedSfixed32)));
+ assertTrue(Arrays.equals(fixed64s, message.getExtension(RepeatedExtensions.repeatedFixed64)));
+ assertTrue(Arrays.equals(sfixed64s, message.getExtension(RepeatedExtensions.repeatedSfixed64)));
+ assertTrue(Arrays.equals(bools, message.getExtension(RepeatedExtensions.repeatedBool)));
+ assertTrue(Arrays.equals(floats, message.getExtension(RepeatedExtensions.repeatedFloat)));
+ assertTrue(Arrays.equals(doubles, message.getExtension(RepeatedExtensions.repeatedDouble)));
+ assertTrue(Arrays.equals(enums, message.getExtension(RepeatedExtensions.repeatedEnum)));
+
+ // Clone the message and ensure it's still equal.
+ Extensions.ExtendableMessage clone = message.clone();
+ assertEquals(clone, message);
+ }
+
+ public void testNullExtensions() throws Exception {
+ // Check that clearing the extension on an empty message is a no-op.
+ Extensions.ExtendableMessage message = new Extensions.ExtendableMessage();
+ assertFalse(message.hasExtension(SingularExtensions.someMessage));
+ message.setExtension(SingularExtensions.someMessage, null);
+ assertFalse(message.hasExtension(SingularExtensions.someMessage));
+ assertEquals(0, MessageNano.toByteArray(message).length);
+
+ // Check that the message is empty after setting and clearing an extension.
+ AnotherMessage another = new AnotherMessage();
+ assertFalse(message.hasExtension(SingularExtensions.someMessage));
+ message.setExtension(SingularExtensions.someMessage, another);
+ assertTrue(message.hasExtension(SingularExtensions.someMessage));
+ assertTrue(MessageNano.toByteArray(message).length > 0);
+ message.setExtension(SingularExtensions.someMessage, null);
+ assertFalse(message.hasExtension(SingularExtensions.someMessage));
+ assertEquals(0, MessageNano.toByteArray(message).length);
+ }
+
+ public void testExtensionsMutation() {
+ Extensions.ExtendableMessage extendableMessage = new Extensions.ExtendableMessage();
+ extendableMessage.setExtension(SingularExtensions.someMessage,
+ new Extensions.AnotherMessage());
+
+ extendableMessage.getExtension(SingularExtensions.someMessage).string = "not empty";
+
+ assertEquals("not empty",
+ extendableMessage.getExtension(SingularExtensions.someMessage).string);
+ }
+
+ public void testExtensionsMutation_Equals() throws InvalidProtocolBufferNanoException {
+ Extensions.ExtendableMessage extendableMessage = new Extensions.ExtendableMessage();
+ extendableMessage.field = 5;
+ int int32 = 42;
+ int[] uint32s = {3, 4};
+ int[] sint32s = {-5, -6};
+ long[] int64s = {7, 8};
+ long[] uint64s = {9, 10};
+ long[] sint64s = {-11, -12};
+ int[] fixed32s = {13, 14};
+ int[] sfixed32s = {-15, -16};
+ long[] fixed64s = {17, 18};
+ long[] sfixed64s = {-19, -20};
+ boolean[] bools = {true, false};
+ float[] floats = {2.1f, 2.2f};
+ double[] doubles = {2.3, 2.4};
+ int[] enums = {Extensions.SECOND_VALUE, Extensions.FIRST_VALUE};
+ String[] strings = {"vijfentwintig", "twenty-six"};
+ byte[][] bytess = {{2, 7}, {2, 8}};
+ AnotherMessage another1 = new AnotherMessage();
+ another1.string = "er shi jiu";
+ another1.value = false;
+ AnotherMessage another2 = new AnotherMessage();
+ another2.string = "trente";
+ another2.value = true;
+ AnotherMessage[] messages = {another1, another2};
+ RepeatedExtensions.RepeatedGroup group1 = new RepeatedExtensions.RepeatedGroup();
+ group1.a = 31;
+ RepeatedExtensions.RepeatedGroup group2 = new RepeatedExtensions.RepeatedGroup();
+ group2.a = 32;
+ RepeatedExtensions.RepeatedGroup[] groups = {group1, group2};
+ extendableMessage.setExtension(SingularExtensions.someInt32, int32);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedUint32, uint32s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedSint32, sint32s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedInt64, int64s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedUint64, uint64s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedSint64, sint64s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedFixed32, fixed32s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedSfixed32, sfixed32s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedFixed64, fixed64s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedSfixed64, sfixed64s);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedBool, bools);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedFloat, floats);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedDouble, doubles);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedEnum, enums);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedString, strings);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedBytes, bytess);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedMessage, messages);
+ extendableMessage.setExtension(RepeatedExtensions.repeatedGroup, groups);
+
+ byte[] data = MessageNano.toByteArray(extendableMessage);
+
+ extendableMessage = Extensions.ExtendableMessage.parseFrom(data);
+ Extensions.ExtendableMessage messageCopy = Extensions.ExtendableMessage.parseFrom(data);
+
+ // Without deserialising.
+ assertEquals(extendableMessage, messageCopy);
+ assertEquals(extendableMessage.hashCode(), messageCopy.hashCode());
+
+ // Only one deserialized.
+ extendableMessage.getExtension(SingularExtensions.someInt32);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedUint32);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedSint32);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedInt64);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedUint64);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedSint64);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedFixed32);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedSfixed32);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedFixed64);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedSfixed64);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedBool);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedFloat);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedDouble);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedEnum);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedString);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedBytes);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedMessage);
+ extendableMessage.getExtension(RepeatedExtensions.repeatedGroup);
+ assertEquals(extendableMessage, messageCopy);
+ assertEquals(extendableMessage.hashCode(), messageCopy.hashCode());
+
+ // Both deserialized.
+ messageCopy.getExtension(SingularExtensions.someInt32);
+ messageCopy.getExtension(RepeatedExtensions.repeatedUint32);
+ messageCopy.getExtension(RepeatedExtensions.repeatedSint32);
+ messageCopy.getExtension(RepeatedExtensions.repeatedInt64);
+ messageCopy.getExtension(RepeatedExtensions.repeatedUint64);
+ messageCopy.getExtension(RepeatedExtensions.repeatedSint64);
+ messageCopy.getExtension(RepeatedExtensions.repeatedFixed32);
+ messageCopy.getExtension(RepeatedExtensions.repeatedSfixed32);
+ messageCopy.getExtension(RepeatedExtensions.repeatedFixed64);
+ messageCopy.getExtension(RepeatedExtensions.repeatedSfixed64);
+ messageCopy.getExtension(RepeatedExtensions.repeatedBool);
+ messageCopy.getExtension(RepeatedExtensions.repeatedFloat);
+ messageCopy.getExtension(RepeatedExtensions.repeatedDouble);
+ messageCopy.getExtension(RepeatedExtensions.repeatedEnum);
+ messageCopy.getExtension(RepeatedExtensions.repeatedString);
+ messageCopy.getExtension(RepeatedExtensions.repeatedBytes);
+ messageCopy.getExtension(RepeatedExtensions.repeatedMessage);
+ messageCopy.getExtension(RepeatedExtensions.repeatedGroup);
+ assertEquals(extendableMessage, messageCopy);
+ assertEquals(extendableMessage.hashCode(), messageCopy.hashCode());
+
+ // Change one, make sure they are still different.
+ messageCopy.getExtension(RepeatedExtensions.repeatedMessage)[0].string = "not empty";
+ assertFalse(extendableMessage.equals(messageCopy));
+
+ // Even if the extension hasn't been deserialized.
+ extendableMessage = Extensions.ExtendableMessage.parseFrom(data);
+ assertFalse(extendableMessage.equals(messageCopy));
+ }
+
+ public void testExtensionsCaching() {
+ Extensions.ExtendableMessage extendableMessage = new Extensions.ExtendableMessage();
+ extendableMessage.setExtension(SingularExtensions.someMessage,
+ new Extensions.AnotherMessage());
+ assertSame("Consecutive calls to getExtensions should return the same object",
+ extendableMessage.getExtension(SingularExtensions.someMessage),
+ extendableMessage.getExtension(SingularExtensions.someMessage));
+ }
+
+ public void testUnknownFields() throws Exception {
+ // Check that we roundtrip (serialize and deserialize) unrecognized fields.
+ AnotherMessage message = new AnotherMessage();
+ message.string = "Hello World";
+ message.value = false;
+
+ byte[] bytes = MessageNano.toByteArray(message);
+ int extraFieldSize = CodedOutputByteBufferNano.computeStringSize(
+ 1001, "This is an unknown field");
+ byte[] newBytes = new byte[bytes.length + extraFieldSize];
+ System.arraycopy(bytes, 0, newBytes, 0, bytes.length);
+ CodedOutputByteBufferNano.newInstance(newBytes, bytes.length, extraFieldSize)
+ .writeString(1001, "This is an unknown field");
+
+ // Deserialize with an unknown field.
+ AnotherMessage deserialized = AnotherMessage.parseFrom(newBytes);
+ byte[] serialized = MessageNano.toByteArray(deserialized);
+
+ assertEquals(newBytes.length, serialized.length);
+
+ // Clear, and make sure it clears everything.
+ deserialized.clear();
+ assertEquals(0, MessageNano.toByteArray(deserialized).length);
+ }
+
+ public void testMergeFrom() throws Exception {
+ SimpleMessageNano message = new SimpleMessageNano();
+ message.d = 123;
+ byte[] bytes = MessageNano.toByteArray(message);
+
+ SimpleMessageNano newMessage = MessageNano.mergeFrom(new SimpleMessageNano(), bytes);
+ assertEquals(message.d, newMessage.d);
+ }
+
+ public void testJavaKeyword() throws Exception {
+ TestAllTypesNano msg = new TestAllTypesNano();
+ msg.synchronized_ = 123;
+ assertEquals(123, msg.synchronized_);
+ }
+
+ public void testReferenceTypesForPrimitives() throws Exception {
+ NanoReferenceTypes.TestAllTypesNano message = new NanoReferenceTypes.TestAllTypesNano();
+
+ // Base check - when nothing is set, we serialize nothing.
+ assertHasWireData(message, false);
+
+ message.defaultBool = true;
+ assertHasWireData(message, true);
+
+ message.defaultBool = false;
+ assertHasWireData(message, true);
+
+ message.defaultBool = null;
+ assertHasWireData(message, false);
+
+ message.defaultInt32 = 5;
+ assertHasWireData(message, true);
+
+ message.defaultInt32 = null;
+ assertHasWireData(message, false);
+
+ message.defaultInt64 = 123456L;
+ assertHasWireData(message, true);
+
+ message.defaultInt64 = null;
+ assertHasWireData(message, false);
+
+ message.defaultFloat = 1f;
+ assertHasWireData(message, true);
+
+ message.defaultFloat = null;
+ assertHasWireData(message, false);
+
+ message.defaultDouble = 2.1;
+ assertHasWireData(message, true);
+
+ message.defaultDouble = null;
+ assertHasWireData(message, false);
+
+ message.defaultString = "hello";
+ assertHasWireData(message, true);
+
+ message.defaultString = null;
+ assertHasWireData(message, false);
+
+ message.defaultBytes = new byte[] { 1, 2, 3 };
+ assertHasWireData(message, true);
+
+ message.defaultBytes = null;
+ assertHasWireData(message, false);
+ }
+
+ public void testHashCodeEquals() throws Exception {
+ // Complete equality:
+ TestAllTypesNano a = createMessageForHashCodeEqualsTest();
+ TestAllTypesNano aEquivalent = createMessageForHashCodeEqualsTest();
+
+ assertTrue(MessageNano.messageNanoEquals(a, aEquivalent));
+ assertFalse(MessageNano.messageNanoEquals(a, new TestAllTypesNano()));
+
+ // Null and empty array for repeated fields equality:
+ TestAllTypesNano b = createMessageForHashCodeEqualsTest();
+ b.repeatedBool = null;
+ b.repeatedFloat = new float[0];
+ TestAllTypesNano bEquivalent = createMessageForHashCodeEqualsTest();
+ bEquivalent.repeatedBool = new boolean[0];
+ bEquivalent.repeatedFloat = null;
+
+ // Ref-element-type repeated fields use non-null subsequence equality:
+ TestAllTypesNano c = createMessageForHashCodeEqualsTest();
+ c.repeatedString = null;
+ c.repeatedStringPiece = new String[] {null, "one", null, "two"};
+ c.repeatedBytes = new byte[][] {{3, 4}, null};
+ TestAllTypesNano cEquivalent = createMessageForHashCodeEqualsTest();
+ cEquivalent.repeatedString = new String[3];
+ cEquivalent.repeatedStringPiece = new String[] {"one", "two", null};
+ cEquivalent.repeatedBytes = new byte[][] {{3, 4}};
+
+ // Complete equality for messages with has fields:
+ TestAllTypesNanoHas d = createMessageWithHasForHashCodeEqualsTest();
+ TestAllTypesNanoHas dEquivalent = createMessageWithHasForHashCodeEqualsTest();
+
+ // If has-fields exist, fields with the same default values but
+ // different has-field values are different.
+ TestAllTypesNanoHas e = createMessageWithHasForHashCodeEqualsTest();
+ e.optionalInt32++; // make different from d
+ e.hasDefaultString = false;
+ TestAllTypesNanoHas eDifferent = createMessageWithHasForHashCodeEqualsTest();
+ eDifferent.optionalInt32 = e.optionalInt32;
+ eDifferent.hasDefaultString = true;
+
+ // Complete equality for messages with accessors:
+ TestNanoAccessors f = createMessageWithAccessorsForHashCodeEqualsTest();
+ TestNanoAccessors fEquivalent = createMessageWithAccessorsForHashCodeEqualsTest();
+
+ // If using accessors, explicitly setting a field to its default value
+ // should make the message different.
+ TestNanoAccessors g = createMessageWithAccessorsForHashCodeEqualsTest();
+ g.setOptionalInt32(g.getOptionalInt32() + 1); // make different from f
+ g.clearDefaultString();
+ TestNanoAccessors gDifferent = createMessageWithAccessorsForHashCodeEqualsTest();
+ gDifferent.setOptionalInt32(g.getOptionalInt32());
+ gDifferent.setDefaultString(g.getDefaultString());
+
+ // Complete equality for reference typed messages:
+ NanoReferenceTypes.TestAllTypesNano h = createRefTypedMessageForHashCodeEqualsTest();
+ NanoReferenceTypes.TestAllTypesNano hEquivalent = createRefTypedMessageForHashCodeEqualsTest();
+
+ // Inequality of null and default value for reference typed messages:
+ NanoReferenceTypes.TestAllTypesNano i = createRefTypedMessageForHashCodeEqualsTest();
+ i.optionalInt32 = 1; // make different from h
+ i.optionalFloat = null;
+ NanoReferenceTypes.TestAllTypesNano iDifferent = createRefTypedMessageForHashCodeEqualsTest();
+ iDifferent.optionalInt32 = i.optionalInt32;
+ iDifferent.optionalFloat = 0.0f;
+
+ HashMap<MessageNano, String> hashMap = new HashMap<MessageNano, String>();
+ hashMap.put(a, "a");
+ hashMap.put(b, "b");
+ hashMap.put(c, "c");
+ hashMap.put(d, "d");
+ hashMap.put(e, "e");
+ hashMap.put(f, "f");
+ hashMap.put(g, "g");
+ hashMap.put(h, "h");
+ hashMap.put(i, "i");
+
+ assertEquals(9, hashMap.size()); // a-i should be different from each other.
+
+ assertEquals("a", hashMap.get(a));
+ assertEquals("a", hashMap.get(aEquivalent));
+
+ assertEquals("b", hashMap.get(b));
+ assertEquals("b", hashMap.get(bEquivalent));
+
+ assertEquals("c", hashMap.get(c));
+ assertEquals("c", hashMap.get(cEquivalent));
+
+ assertEquals("d", hashMap.get(d));
+ assertEquals("d", hashMap.get(dEquivalent));
+
+ assertEquals("e", hashMap.get(e));
+ assertNull(hashMap.get(eDifferent));
+
+ assertEquals("f", hashMap.get(f));
+ assertEquals("f", hashMap.get(fEquivalent));
+
+ assertEquals("g", hashMap.get(g));
+ assertNull(hashMap.get(gDifferent));
+
+ assertEquals("h", hashMap.get(h));
+ assertEquals("h", hashMap.get(hEquivalent));
+
+ assertEquals("i", hashMap.get(i));
+ assertNull(hashMap.get(iDifferent));
+ }
+
+ private TestAllTypesNano createMessageForHashCodeEqualsTest() {
+ TestAllTypesNano message = new TestAllTypesNano();
+ message.optionalInt32 = 5;
+ message.optionalInt64 = 777;
+ message.optionalFloat = 1.0f;
+ message.optionalDouble = 2.0;
+ message.optionalBool = true;
+ message.optionalString = "Hello";
+ message.optionalBytes = new byte[] { 1, 2, 3 };
+ message.optionalNestedMessage = new TestAllTypesNano.NestedMessage();
+ message.optionalNestedMessage.bb = 27;
+ message.optionalNestedEnum = TestAllTypesNano.BAR;
+ message.repeatedInt32 = new int[] { 5, 6, 7, 8 };
+ message.repeatedInt64 = new long[] { 27L, 28L, 29L };
+ message.repeatedFloat = new float[] { 5.0f, 6.0f };
+ message.repeatedDouble = new double[] { 99.1, 22.5 };
+ message.repeatedBool = new boolean[] { true, false, true };
+ message.repeatedString = new String[] { "One", "Two" };
+ message.repeatedBytes = new byte[][] { { 2, 7 }, { 2, 7 } };
+ message.repeatedNestedMessage = new TestAllTypesNano.NestedMessage[] {
+ message.optionalNestedMessage,
+ message.optionalNestedMessage
+ };
+ message.repeatedNestedEnum = new int[] {
+ TestAllTypesNano.BAR,
+ TestAllTypesNano.BAZ
+ };
+ message.setOneofUint32(3);
+ return message;
+ }
+
+ private TestAllTypesNanoHas createMessageWithHasForHashCodeEqualsTest() {
+ TestAllTypesNanoHas message = new TestAllTypesNanoHas();
+ message.optionalInt32 = 5;
+ message.optionalString = "Hello";
+ message.optionalBytes = new byte[] { 1, 2, 3 };
+ message.optionalNestedMessage = new TestAllTypesNanoHas.NestedMessage();
+ message.optionalNestedMessage.bb = 27;
+ message.optionalNestedEnum = TestAllTypesNano.BAR;
+ message.repeatedInt32 = new int[] { 5, 6, 7, 8 };
+ message.repeatedString = new String[] { "One", "Two" };
+ message.repeatedBytes = new byte[][] { { 2, 7 }, { 2, 7 } };
+ message.repeatedNestedMessage = new TestAllTypesNanoHas.NestedMessage[] {
+ message.optionalNestedMessage,
+ message.optionalNestedMessage
+ };
+ message.repeatedNestedEnum = new int[] {
+ TestAllTypesNano.BAR,
+ TestAllTypesNano.BAZ
+ };
+ return message;
+ }
+
+ private TestNanoAccessors createMessageWithAccessorsForHashCodeEqualsTest() {
+ TestNanoAccessors message = new TestNanoAccessors()
+ .setOptionalInt32(5)
+ .setOptionalString("Hello")
+ .setOptionalBytes(new byte[] {1, 2, 3})
+ .setOptionalNestedEnum(TestNanoAccessors.BAR);
+ message.optionalNestedMessage = new TestNanoAccessors.NestedMessage().setBb(27);
+ message.repeatedInt32 = new int[] { 5, 6, 7, 8 };
+ message.repeatedString = new String[] { "One", "Two" };
+ message.repeatedBytes = new byte[][] { { 2, 7 }, { 2, 7 } };
+ message.repeatedNestedMessage = new TestNanoAccessors.NestedMessage[] {
+ message.optionalNestedMessage,
+ message.optionalNestedMessage
+ };
+ message.repeatedNestedEnum = new int[] {
+ TestAllTypesNano.BAR,
+ TestAllTypesNano.BAZ
+ };
+ return message;
+ }
+
+ private NanoReferenceTypes.TestAllTypesNano createRefTypedMessageForHashCodeEqualsTest() {
+ NanoReferenceTypes.TestAllTypesNano message = new NanoReferenceTypes.TestAllTypesNano();
+ message.optionalInt32 = 5;
+ message.optionalInt64 = 777L;
+ message.optionalFloat = 1.0f;
+ message.optionalDouble = 2.0;
+ message.optionalBool = true;
+ message.optionalString = "Hello";
+ message.optionalBytes = new byte[] { 1, 2, 3 };
+ message.optionalNestedMessage =
+ new NanoReferenceTypes.TestAllTypesNano.NestedMessage();
+ message.optionalNestedMessage.foo = 27;
+ message.optionalNestedEnum = NanoReferenceTypes.TestAllTypesNano.BAR;
+ message.repeatedInt32 = new int[] { 5, 6, 7, 8 };
+ message.repeatedInt64 = new long[] { 27L, 28L, 29L };
+ message.repeatedFloat = new float[] { 5.0f, 6.0f };
+ message.repeatedDouble = new double[] { 99.1, 22.5 };
+ message.repeatedBool = new boolean[] { true, false, true };
+ message.repeatedString = new String[] { "One", "Two" };
+ message.repeatedBytes = new byte[][] { { 2, 7 }, { 2, 7 } };
+ message.repeatedNestedMessage =
+ new NanoReferenceTypes.TestAllTypesNano.NestedMessage[] {
+ message.optionalNestedMessage,
+ message.optionalNestedMessage
+ };
+ message.repeatedNestedEnum = new int[] {
+ NanoReferenceTypes.TestAllTypesNano.BAR,
+ NanoReferenceTypes.TestAllTypesNano.BAZ
+ };
+ return message;
+ }
+
+ public void testEqualsWithSpecialFloatingPointValues() throws Exception {
+ // Checks that the nano implementation complies with Object.equals() when treating
+ // floating point numbers, i.e. NaN == NaN and +0.0 != -0.0.
+ // This test assumes that the generated equals() implementations are symmetric, so
+ // there will only be one direction for each equality check.
+
+ TestAllTypesNano m1 = new TestAllTypesNano();
+ m1.optionalFloat = Float.NaN;
+ m1.optionalDouble = Double.NaN;
+ TestAllTypesNano m2 = new TestAllTypesNano();
+ m2.optionalFloat = Float.NaN;
+ m2.optionalDouble = Double.NaN;
+ assertTrue(m1.equals(m2));
+ assertTrue(m1.equals(
+ MessageNano.mergeFrom(new TestAllTypesNano(), MessageNano.toByteArray(m1))));
+
+ m1.optionalFloat = +0f;
+ m2.optionalFloat = -0f;
+ assertFalse(m1.equals(m2));
+
+ m1.optionalFloat = -0f;
+ m1.optionalDouble = +0d;
+ m2.optionalDouble = -0d;
+ assertFalse(m1.equals(m2));
+
+ m1.optionalDouble = -0d;
+ assertTrue(m1.equals(m2));
+ assertFalse(m1.equals(new TestAllTypesNano())); // -0 does not equals() the default +0
+ assertTrue(m1.equals(
+ MessageNano.mergeFrom(new TestAllTypesNano(), MessageNano.toByteArray(m1))));
+
+ // -------
+
+ TestAllTypesNanoHas m3 = new TestAllTypesNanoHas();
+ m3.optionalFloat = Float.NaN;
+ m3.hasOptionalFloat = true;
+ m3.optionalDouble = Double.NaN;
+ m3.hasOptionalDouble = true;
+ TestAllTypesNanoHas m4 = new TestAllTypesNanoHas();
+ m4.optionalFloat = Float.NaN;
+ m4.hasOptionalFloat = true;
+ m4.optionalDouble = Double.NaN;
+ m4.hasOptionalDouble = true;
+ assertTrue(m3.equals(m4));
+ assertTrue(m3.equals(
+ MessageNano.mergeFrom(new TestAllTypesNanoHas(), MessageNano.toByteArray(m3))));
+
+ m3.optionalFloat = +0f;
+ m4.optionalFloat = -0f;
+ assertFalse(m3.equals(m4));
+
+ m3.optionalFloat = -0f;
+ m3.optionalDouble = +0d;
+ m4.optionalDouble = -0d;
+ assertFalse(m3.equals(m4));
+
+ m3.optionalDouble = -0d;
+ m3.hasOptionalFloat = false; // -0 does not equals() the default +0,
+ m3.hasOptionalDouble = false; // so these incorrect 'has' flags should be disregarded.
+ assertTrue(m3.equals(m4)); // note: m4 has the 'has' flags set.
+ assertFalse(m3.equals(new TestAllTypesNanoHas())); // note: the new message has +0 defaults
+ assertTrue(m3.equals(
+ MessageNano.mergeFrom(new TestAllTypesNanoHas(), MessageNano.toByteArray(m3))));
+ // note: the deserialized message has the 'has' flags set.
+
+ // -------
+
+ TestNanoAccessors m5 = new TestNanoAccessors();
+ m5.setOptionalFloat(Float.NaN);
+ m5.setOptionalDouble(Double.NaN);
+ TestNanoAccessors m6 = new TestNanoAccessors();
+ m6.setOptionalFloat(Float.NaN);
+ m6.setOptionalDouble(Double.NaN);
+ assertTrue(m5.equals(m6));
+ assertTrue(m5.equals(
+ MessageNano.mergeFrom(new TestNanoAccessors(), MessageNano.toByteArray(m6))));
+
+ m5.setOptionalFloat(+0f);
+ m6.setOptionalFloat(-0f);
+ assertFalse(m5.equals(m6));
+
+ m5.setOptionalFloat(-0f);
+ m5.setOptionalDouble(+0d);
+ m6.setOptionalDouble(-0d);
+ assertFalse(m5.equals(m6));
+
+ m5.setOptionalDouble(-0d);
+ assertTrue(m5.equals(m6));
+ assertFalse(m5.equals(new TestNanoAccessors()));
+ assertTrue(m5.equals(
+ MessageNano.mergeFrom(new TestNanoAccessors(), MessageNano.toByteArray(m6))));
+
+ // -------
+
+ NanoReferenceTypes.TestAllTypesNano m7 = new NanoReferenceTypes.TestAllTypesNano();
+ m7.optionalFloat = Float.NaN;
+ m7.optionalDouble = Double.NaN;
+ NanoReferenceTypes.TestAllTypesNano m8 = new NanoReferenceTypes.TestAllTypesNano();
+ m8.optionalFloat = Float.NaN;
+ m8.optionalDouble = Double.NaN;
+ assertTrue(m7.equals(m8));
+ assertTrue(m7.equals(MessageNano.mergeFrom(
+ new NanoReferenceTypes.TestAllTypesNano(), MessageNano.toByteArray(m7))));
+
+ m7.optionalFloat = +0f;
+ m8.optionalFloat = -0f;
+ assertFalse(m7.equals(m8));
+
+ m7.optionalFloat = -0f;
+ m7.optionalDouble = +0d;
+ m8.optionalDouble = -0d;
+ assertFalse(m7.equals(m8));
+
+ m7.optionalDouble = -0d;
+ assertTrue(m7.equals(m8));
+ assertFalse(m7.equals(new NanoReferenceTypes.TestAllTypesNano()));
+ assertTrue(m7.equals(MessageNano.mergeFrom(
+ new NanoReferenceTypes.TestAllTypesNano(), MessageNano.toByteArray(m7))));
+ }
+
+ private static TestAllTypesNano generateMessageForOneof(int caseNumber) {
+ TestAllTypesNano result = new TestAllTypesNano();
+ TestAllTypesNano.NestedMessage nested =
+ new TestAllTypesNano.NestedMessage();
+ nested.bb = 2;
+ switch (caseNumber) {
+ case TestAllTypesNano.ONEOF_UINT32_FIELD_NUMBER:
+ result.setOneofUint32(1);
+ break;
+ case TestAllTypesNano.ONEOF_ENUM_FIELD_NUMBER:
+ result.setOneofEnum(TestAllTypesNano.BAR);
+ break;
+ case TestAllTypesNano.ONEOF_NESTED_MESSAGE_FIELD_NUMBER:
+ result.setOneofNestedMessage(nested);
+ break;
+ case TestAllTypesNano.ONEOF_BYTES_FIELD_NUMBER:
+ result.setOneofBytes(new byte[] {1, 2});
+ break;
+ case TestAllTypesNano.ONEOF_STRING_FIELD_NUMBER:
+ result.setOneofString("hello");
+ break;
+ case TestAllTypesNano.ONEOF_FIXED64_FIELD_NUMBER:
+ result.setOneofFixed64(-1L);
+ break;
+ default:
+ throw new RuntimeException("unexpected case number: " + caseNumber);
+ }
+ return result;
+ }
+
+ public void testOneofHashCodeEquals() throws Exception {
+ TestAllTypesNano m1 = generateMessageForOneof(
+ TestAllTypesNano.ONEOF_UINT32_FIELD_NUMBER);
+ assertEquals(m1, generateMessageForOneof(
+ TestAllTypesNano.ONEOF_UINT32_FIELD_NUMBER));
+ assertFalse(m1.equals(new TestAllTypesNano()));
+
+ TestAllTypesNano m2 = generateMessageForOneof(
+ TestAllTypesNano.ONEOF_ENUM_FIELD_NUMBER);
+ assertEquals(m2, generateMessageForOneof(
+ TestAllTypesNano.ONEOF_ENUM_FIELD_NUMBER));
+ assertFalse(m2.equals(new TestAllTypesNano()));
+
+ TestAllTypesNano m3 = generateMessageForOneof(
+ TestAllTypesNano.ONEOF_NESTED_MESSAGE_FIELD_NUMBER);
+ assertEquals(m3, generateMessageForOneof(
+ TestAllTypesNano.ONEOF_NESTED_MESSAGE_FIELD_NUMBER));
+ assertFalse(m3.equals(new TestAllTypesNano()));
+
+ TestAllTypesNano m4 = generateMessageForOneof(
+ TestAllTypesNano.ONEOF_BYTES_FIELD_NUMBER);
+ assertEquals(m4, generateMessageForOneof(
+ TestAllTypesNano.ONEOF_BYTES_FIELD_NUMBER));
+ assertFalse(m4.equals(new TestAllTypesNano()));
+
+ TestAllTypesNano m5 = generateMessageForOneof(
+ TestAllTypesNano.ONEOF_STRING_FIELD_NUMBER);
+ assertEquals(m5, generateMessageForOneof(
+ TestAllTypesNano.ONEOF_STRING_FIELD_NUMBER));
+ assertFalse(m5.equals(new TestAllTypesNano()));
+
+ TestAllTypesNano m6 = generateMessageForOneof(
+ TestAllTypesNano.ONEOF_FIXED64_FIELD_NUMBER);
+ assertEquals(m6, generateMessageForOneof(
+ TestAllTypesNano.ONEOF_FIXED64_FIELD_NUMBER));
+ assertFalse(m6.equals(new TestAllTypesNano()));
+
+ Map<TestAllTypesNano, Integer> map =
+ new HashMap<TestAllTypesNano, Integer>();
+ map.put(m1, 1);
+ map.put(m2, 2);
+ map.put(m3, 3);
+ map.put(m4, 4);
+ map.put(m5, 5);
+ map.put(m6, 6);
+
+ assertEquals(6, map.size());
+ }
+
+ private void checkOneofCase(TestAllTypesNano nano, int field)
+ throws Exception {
+ assertEquals(field, nano.getOneofFieldCase());
+ assertEquals(
+ field == TestAllTypesNano.ONEOF_BYTES_FIELD_NUMBER,
+ nano.hasOneofBytes());
+ assertEquals(
+ field == TestAllTypesNano.ONEOF_ENUM_FIELD_NUMBER,
+ nano.hasOneofEnum());
+ assertEquals(
+ field == TestAllTypesNano.ONEOF_FIXED64_FIELD_NUMBER,
+ nano.hasOneofFixed64());
+ assertEquals(
+ field == TestAllTypesNano.ONEOF_NESTED_MESSAGE_FIELD_NUMBER,
+ nano.hasOneofNestedMessage());
+ assertEquals(
+ field == TestAllTypesNano.ONEOF_STRING_FIELD_NUMBER,
+ nano.hasOneofString());
+ assertEquals(
+ field == TestAllTypesNano.ONEOF_UINT32_FIELD_NUMBER,
+ nano.hasOneofUint32());
+
+ }
+
+ public void testOneofDefault() throws Exception {
+ TestAllTypesNano m1 = new TestAllTypesNano();
+ checkOneofCase(m1, 0);
+ assertEquals(WireFormatNano.EMPTY_BYTES, m1.getOneofBytes());
+ assertEquals(TestAllTypesNano.FOO, m1.getOneofEnum());
+ assertEquals(0L, m1.getOneofFixed64());
+ assertEquals(null, m1.getOneofNestedMessage());
+ assertEquals("", m1.getOneofString());
+ assertEquals(0, m1.getOneofUint32());
+ }
+
+ public void testOneofExclusiveness() throws Exception {
+ TestAllTypesNano m = new TestAllTypesNano();
+ checkOneofCase(m, 0);
+
+ m.setOneofBytes(new byte[]{0, 1});
+ checkOneofCase(m, TestAllTypesNano.ONEOF_BYTES_FIELD_NUMBER);
+ assertTrue(Arrays.equals(new byte[]{0, 1}, m.getOneofBytes()));
+
+ m.setOneofEnum(TestAllTypesNano.BAZ);
+ checkOneofCase(m, TestAllTypesNano.ONEOF_ENUM_FIELD_NUMBER);
+ assertEquals(TestAllTypesNano.BAZ, m.getOneofEnum());
+ assertEquals(WireFormatNano.EMPTY_BYTES, m.getOneofBytes());
+
+ m.setOneofFixed64(-1L);
+ checkOneofCase(m, TestAllTypesNano.ONEOF_FIXED64_FIELD_NUMBER);
+ assertEquals(-1L, m.getOneofFixed64());
+ assertEquals(TestAllTypesNano.FOO, m.getOneofEnum());
+
+ m.setOneofNestedMessage(new TestAllTypesNano.NestedMessage());
+ checkOneofCase(m, TestAllTypesNano.ONEOF_NESTED_MESSAGE_FIELD_NUMBER);
+ assertEquals(
+ new TestAllTypesNano.NestedMessage(), m.getOneofNestedMessage());
+ assertEquals(0L, m.getOneofFixed64());
+
+ m.setOneofString("hello");
+ checkOneofCase(m, TestAllTypesNano.ONEOF_STRING_FIELD_NUMBER);
+ assertEquals("hello", m.getOneofString());
+ assertNull(m.getOneofNestedMessage());
+
+ m.setOneofUint32(10);
+ checkOneofCase(m, TestAllTypesNano.ONEOF_UINT32_FIELD_NUMBER);
+ assertEquals(10, m.getOneofUint32());
+ assertEquals("", m.getOneofString());
+
+ m.setOneofBytes(new byte[]{0, 1});
+ checkOneofCase(m, TestAllTypesNano.ONEOF_BYTES_FIELD_NUMBER);
+ assertTrue(Arrays.equals(new byte[]{0, 1}, m.getOneofBytes()));
+ assertEquals(0, m.getOneofUint32());
+ }
+
+ public void testOneofClear() throws Exception {
+ TestAllTypesNano m = new TestAllTypesNano();
+ m.setOneofBytes(new byte[]{0, 1});
+ m.clearOneofField();
+ checkOneofCase(m, 0);
+
+ m.setOneofEnum(TestAllTypesNano.BAZ);
+ m.clearOneofField();
+ checkOneofCase(m, 0);
+
+ m.setOneofFixed64(-1L);
+ m.clearOneofField();
+ checkOneofCase(m, 0);
+
+ m.setOneofNestedMessage(new TestAllTypesNano.NestedMessage());
+ m.clearOneofField();
+ checkOneofCase(m, 0);
+
+ m.setOneofString("hello");
+ m.clearOneofField();
+ checkOneofCase(m, 0);
+
+ m.setOneofUint32(10);
+ m.clearOneofField();
+ checkOneofCase(m, 0);
+ }
+
+ public void testOneofMarshaling() throws Exception {
+ TestAllTypesNano m = new TestAllTypesNano();
+ TestAllTypesNano parsed = new TestAllTypesNano();
+ {
+ m.setOneofBytes(new byte[]{0, 1});
+ byte[] serialized = MessageNano.toByteArray(m);
+ MessageNano.mergeFrom(parsed, serialized);
+ checkOneofCase(parsed, TestAllTypesNano.ONEOF_BYTES_FIELD_NUMBER);
+ assertTrue(Arrays.equals(new byte[]{0, 1}, parsed.getOneofBytes()));
+ }
+ {
+ m.setOneofEnum(TestAllTypesNano.BAZ);
+ byte[] serialized = MessageNano.toByteArray(m);
+ MessageNano.mergeFrom(parsed, serialized);
+ checkOneofCase(m, TestAllTypesNano.ONEOF_ENUM_FIELD_NUMBER);
+ assertEquals(TestAllTypesNano.BAZ, m.getOneofEnum());
+ }
+ {
+ m.setOneofEnum(TestAllTypesNano.BAZ);
+ byte[] serialized = MessageNano.toByteArray(m);
+ MessageNano.mergeFrom(parsed, serialized);
+ checkOneofCase(m, TestAllTypesNano.ONEOF_ENUM_FIELD_NUMBER);
+ assertEquals(TestAllTypesNano.BAZ, m.getOneofEnum());
+ }
+ {
+ m.setOneofFixed64(-1L);
+ byte[] serialized = MessageNano.toByteArray(m);
+ MessageNano.mergeFrom(parsed, serialized);
+ checkOneofCase(m, TestAllTypesNano.ONEOF_FIXED64_FIELD_NUMBER);
+ assertEquals(-1L, m.getOneofFixed64());
+ }
+ {
+ m.setOneofNestedMessage(new TestAllTypesNano.NestedMessage());
+ byte[] serialized = MessageNano.toByteArray(m);
+ MessageNano.mergeFrom(parsed, serialized);
+ checkOneofCase(m, TestAllTypesNano.ONEOF_NESTED_MESSAGE_FIELD_NUMBER);
+ assertEquals(
+ new TestAllTypesNano.NestedMessage(), m.getOneofNestedMessage());
+ }
+ {
+ m.setOneofString("hello");
+ byte[] serialized = MessageNano.toByteArray(m);
+ MessageNano.mergeFrom(parsed, serialized);
+ assertEquals("hello", m.getOneofString());
+ assertNull(m.getOneofNestedMessage());
+ }
+ {
+ m.setOneofUint32(10);
+ byte[] serialized = MessageNano.toByteArray(m);
+ MessageNano.mergeFrom(parsed, serialized);
+ checkOneofCase(m, TestAllTypesNano.ONEOF_UINT32_FIELD_NUMBER);
+ assertEquals(10, m.getOneofUint32());
+ }
+ }
+
+ public void testOneofSerializedConcat() throws Exception {
+ TestAllTypesNano m1 = new TestAllTypesNano();
+ m1.setOneofBytes(new byte[] {0, 1});
+ byte[] b1 = MessageNano.toByteArray(m1);
+ TestAllTypesNano m2 = new TestAllTypesNano();
+ m2.setOneofEnum(TestAllTypesNano.BAZ);
+ byte[] b2 = MessageNano.toByteArray(m2);
+ byte[] b3 = new byte[b1.length + b2.length];
+ System.arraycopy(b1, 0, b3, 0, b1.length);
+ System.arraycopy(b2, 0, b3, b1.length, b2.length);
+ TestAllTypesNano parsed = new TestAllTypesNano();
+ MessageNano.mergeFrom(parsed, b3);
+ // the last on the wire wins.
+ checkOneofCase(parsed, TestAllTypesNano.ONEOF_ENUM_FIELD_NUMBER);
+ assertEquals(TestAllTypesNano.BAZ, parsed.getOneofEnum());
+ }
+
+ public void testNullRepeatedFields() throws Exception {
+ // Check that serialization after explicitly setting a repeated field
+ // to null doesn't NPE.
+ TestAllTypesNano message = new TestAllTypesNano();
+ message.repeatedInt32 = null;
+ MessageNano.toByteArray(message); // should not NPE
+ message.toString(); // should not NPE
+
+ message.repeatedNestedEnum = null;
+ MessageNano.toByteArray(message); // should not NPE
+ message.toString(); // should not NPE
+
+ message.repeatedBytes = null;
+ MessageNano.toByteArray(message); // should not NPE
+ message.toString(); // should not NPE
+
+ message.repeatedNestedMessage = null;
+ MessageNano.toByteArray(message); // should not NPE
+ message.toString(); // should not NPE
+
+ message.repeatedPackedInt32 = null;
+ MessageNano.toByteArray(message); // should not NPE
+ message.toString(); // should not NPE
+
+ message.repeatedPackedNestedEnum = null;
+ MessageNano.toByteArray(message); // should not NPE
+ message.toString(); // should not NPE
+
+ // Create a second message to merge into message.
+ TestAllTypesNano secondMessage = new TestAllTypesNano();
+ secondMessage.repeatedInt32 = new int[] {1, 2, 3};
+ secondMessage.repeatedNestedEnum = new int[] {
+ TestAllTypesNano.FOO, TestAllTypesNano.BAR
+ };
+ secondMessage.repeatedBytes = new byte[][] {{1, 2}, {3, 4}};
+ TestAllTypesNano.NestedMessage nested =
+ new TestAllTypesNano.NestedMessage();
+ nested.bb = 55;
+ secondMessage.repeatedNestedMessage =
+ new TestAllTypesNano.NestedMessage[] {nested};
+ secondMessage.repeatedPackedInt32 = new int[] {1, 2, 3};
+ secondMessage.repeatedPackedNestedEnum = new int[] {
+ TestAllTypesNano.FOO, TestAllTypesNano.BAR
+ };
+
+ // Should not NPE
+ message.mergeFrom(CodedInputByteBufferNano.newInstance(
+ MessageNano.toByteArray(secondMessage)));
+ assertEquals(3, message.repeatedInt32.length);
+ assertEquals(3, message.repeatedInt32[2]);
+ assertEquals(2, message.repeatedNestedEnum.length);
+ assertEquals(TestAllTypesNano.FOO, message.repeatedNestedEnum[0]);
+ assertEquals(2, message.repeatedBytes.length);
+ assertEquals(4, message.repeatedBytes[1][1]);
+ assertEquals(1, message.repeatedNestedMessage.length);
+ assertEquals(55, message.repeatedNestedMessage[0].bb);
+ assertEquals(3, message.repeatedPackedInt32.length);
+ assertEquals(2, message.repeatedPackedInt32[1]);
+ assertEquals(2, message.repeatedPackedNestedEnum.length);
+ assertEquals(TestAllTypesNano.BAR, message.repeatedPackedNestedEnum[1]);
+ }
+
+ public void testNullRepeatedFieldElements() throws Exception {
+ // Check that serialization with null array elements doesn't NPE.
+ String string1 = "1";
+ String string2 = "2";
+ byte[] bytes1 = {3, 4};
+ byte[] bytes2 = {5, 6};
+ TestAllTypesNano.NestedMessage msg1 = new TestAllTypesNano.NestedMessage();
+ msg1.bb = 7;
+ TestAllTypesNano.NestedMessage msg2 = new TestAllTypesNano.NestedMessage();
+ msg2.bb = 8;
+
+ TestAllTypesNano message = new TestAllTypesNano();
+ message.repeatedString = new String[] {null, string1, string2};
+ message.repeatedBytes = new byte[][] {bytes1, null, bytes2};
+ message.repeatedNestedMessage = new TestAllTypesNano.NestedMessage[] {msg1, msg2, null};
+ message.repeatedGroup = new TestAllTypesNano.RepeatedGroup[] {null, null, null};
+
+ byte[] serialized = MessageNano.toByteArray(message); // should not NPE
+ TestAllTypesNano deserialized = MessageNano.mergeFrom(new TestAllTypesNano(), serialized);
+ assertEquals(2, deserialized.repeatedString.length);
+ assertEquals(string1, deserialized.repeatedString[0]);
+ assertEquals(string2, deserialized.repeatedString[1]);
+ assertEquals(2, deserialized.repeatedBytes.length);
+ assertTrue(Arrays.equals(bytes1, deserialized.repeatedBytes[0]));
+ assertTrue(Arrays.equals(bytes2, deserialized.repeatedBytes[1]));
+ assertEquals(2, deserialized.repeatedNestedMessage.length);
+ assertEquals(msg1.bb, deserialized.repeatedNestedMessage[0].bb);
+ assertEquals(msg2.bb, deserialized.repeatedNestedMessage[1].bb);
+ assertEquals(0, deserialized.repeatedGroup.length);
+ }
+
+ public void testRepeatedMerge() throws Exception {
+ // Check that merging repeated fields cause the arrays to expand with
+ // new data.
+ TestAllTypesNano first = new TestAllTypesNano();
+ first.repeatedInt32 = new int[] {1, 2, 3};
+ TestAllTypesNano second = new TestAllTypesNano();
+ second.repeatedInt32 = new int[] {4, 5};
+ MessageNano.mergeFrom(first, MessageNano.toByteArray(second));
+ assertEquals(5, first.repeatedInt32.length);
+ assertEquals(1, first.repeatedInt32[0]);
+ assertEquals(4, first.repeatedInt32[3]);
+
+ first = new TestAllTypesNano();
+ first.repeatedNestedEnum = new int[] {TestAllTypesNano.BAR};
+ second = new TestAllTypesNano();
+ second.repeatedNestedEnum = new int[] {TestAllTypesNano.FOO};
+ MessageNano.mergeFrom(first, MessageNano.toByteArray(second));
+ assertEquals(2, first.repeatedNestedEnum.length);
+ assertEquals(TestAllTypesNano.BAR, first.repeatedNestedEnum[0]);
+ assertEquals(TestAllTypesNano.FOO, first.repeatedNestedEnum[1]);
+
+ first = new TestAllTypesNano();
+ first.repeatedNestedMessage = new TestAllTypesNano.NestedMessage[] {
+ new TestAllTypesNano.NestedMessage()
+ };
+ first.repeatedNestedMessage[0].bb = 3;
+ second = new TestAllTypesNano();
+ second.repeatedNestedMessage = new TestAllTypesNano.NestedMessage[] {
+ new TestAllTypesNano.NestedMessage()
+ };
+ second.repeatedNestedMessage[0].bb = 5;
+ MessageNano.mergeFrom(first, MessageNano.toByteArray(second));
+ assertEquals(2, first.repeatedNestedMessage.length);
+ assertEquals(3, first.repeatedNestedMessage[0].bb);
+ assertEquals(5, first.repeatedNestedMessage[1].bb);
+
+ first = new TestAllTypesNano();
+ first.repeatedPackedSfixed64 = new long[] {-1, -2, -3};
+ second = new TestAllTypesNano();
+ second.repeatedPackedSfixed64 = new long[] {-4, -5};
+ MessageNano.mergeFrom(first, MessageNano.toByteArray(second));
+ assertEquals(5, first.repeatedPackedSfixed64.length);
+ assertEquals(-1, first.repeatedPackedSfixed64[0]);
+ assertEquals(-4, first.repeatedPackedSfixed64[3]);
+
+ first = new TestAllTypesNano();
+ first.repeatedPackedNestedEnum = new int[] {TestAllTypesNano.BAR};
+ second = new TestAllTypesNano();
+ second.repeatedPackedNestedEnum = new int[] {TestAllTypesNano.FOO};
+ MessageNano.mergeFrom(first, MessageNano.toByteArray(second));
+ assertEquals(2, first.repeatedPackedNestedEnum.length);
+ assertEquals(TestAllTypesNano.BAR, first.repeatedPackedNestedEnum[0]);
+ assertEquals(TestAllTypesNano.FOO, first.repeatedPackedNestedEnum[1]);
+
+ // Now test repeated merging in a nested scope
+ TestRepeatedMergeNano firstContainer = new TestRepeatedMergeNano();
+ firstContainer.contained = new TestAllTypesNano();
+ firstContainer.contained.repeatedInt32 = new int[] {10, 20};
+ TestRepeatedMergeNano secondContainer = new TestRepeatedMergeNano();
+ secondContainer.contained = new TestAllTypesNano();
+ secondContainer.contained.repeatedInt32 = new int[] {30};
+ MessageNano.mergeFrom(firstContainer, MessageNano.toByteArray(secondContainer));
+ assertEquals(3, firstContainer.contained.repeatedInt32.length);
+ assertEquals(20, firstContainer.contained.repeatedInt32[1]);
+ assertEquals(30, firstContainer.contained.repeatedInt32[2]);
+ }
+
+ public void testRepeatedPackables() throws Exception {
+ // Check that repeated fields with packable types can accept both packed and unpacked
+ // serialized forms.
+ NanoRepeatedPackables.NonPacked nonPacked = new NanoRepeatedPackables.NonPacked();
+ // Exaggerates the first values of varint-typed arrays. This is to test that the parsing code
+ // of packed fields handles non-packed data correctly. If the code incorrectly thinks it is
+ // reading from a packed tag, it will read the first value as the byte length of the field,
+ // and the large number will cause the input to go out of bounds, thus capturing the error.
+ nonPacked.int32S = new int[] {1000, 2, 3};
+ nonPacked.int64S = new long[] {4000, 5, 6};
+ nonPacked.uint32S = new int[] {7000, 8, 9};
+ nonPacked.uint64S = new long[] {10000, 11, 12};
+ nonPacked.sint32S = new int[] {13000, 14, 15};
+ nonPacked.sint64S = new long[] {16000, 17, 18};
+ nonPacked.fixed32S = new int[] {19, 20, 21};
+ nonPacked.fixed64S = new long[] {22, 23, 24};
+ nonPacked.sfixed32S = new int[] {25, 26, 27};
+ nonPacked.sfixed64S = new long[] {28, 29, 30};
+ nonPacked.floats = new float[] {31, 32, 33};
+ nonPacked.doubles = new double[] {34, 35, 36};
+ nonPacked.bools = new boolean[] {false, true};
+ nonPacked.enums = new int[] {
+ NanoRepeatedPackables.Enum.OPTION_ONE,
+ NanoRepeatedPackables.Enum.OPTION_TWO,
+ };
+ nonPacked.noise = 13579;
+
+ byte[] nonPackedSerialized = MessageNano.toByteArray(nonPacked);
+
+ NanoRepeatedPackables.Packed packed =
+ MessageNano.mergeFrom(new NanoRepeatedPackables.Packed(), nonPackedSerialized);
+ assertRepeatedPackablesEqual(nonPacked, packed);
+
+ byte[] packedSerialized = MessageNano.toByteArray(packed);
+ // Just a cautious check that the two serialized forms are different,
+ // to make sure the remaining of this test is useful:
+ assertFalse(Arrays.equals(nonPackedSerialized, packedSerialized));
+
+ nonPacked = MessageNano.mergeFrom(new NanoRepeatedPackables.NonPacked(), packedSerialized);
+ assertRepeatedPackablesEqual(nonPacked, packed);
+
+ // Test mixed serialized form.
+ byte[] mixedSerialized = new byte[nonPackedSerialized.length + packedSerialized.length];
+ System.arraycopy(nonPackedSerialized, 0, mixedSerialized, 0, nonPackedSerialized.length);
+ System.arraycopy(packedSerialized, 0,
+ mixedSerialized, nonPackedSerialized.length, packedSerialized.length);
+
+ nonPacked = MessageNano.mergeFrom(new NanoRepeatedPackables.NonPacked(), mixedSerialized);
+ packed = MessageNano.mergeFrom(new NanoRepeatedPackables.Packed(), mixedSerialized);
+ assertRepeatedPackablesEqual(nonPacked, packed);
+ assertTrue(Arrays.equals(new int[] {1000, 2, 3, 1000, 2, 3}, nonPacked.int32S));
+ assertTrue(Arrays.equals(new int[] {13000, 14, 15, 13000, 14, 15}, nonPacked.sint32S));
+ assertTrue(Arrays.equals(new int[] {25, 26, 27, 25, 26, 27}, nonPacked.sfixed32S));
+ assertTrue(Arrays.equals(new boolean[] {false, true, false, true}, nonPacked.bools));
+ }
+
+ public void testMapsSerializeAndParse() throws Exception {
+ TestMap origin = new TestMap();
+ setMapMessage(origin);
+ assertMapMessageSet(origin);
+
+ byte[] output = MessageNano.toByteArray(origin);
+ TestMap parsed = new TestMap();
+ MessageNano.mergeFrom(parsed, output);
+ }
+
+ public void testMapSerializeRejectNull() throws Exception {
+ TestMap primitiveMap = new TestMap();
+ primitiveMap.int32ToInt32Field = new HashMap<Integer, Integer>();
+ primitiveMap.int32ToInt32Field.put(null, 1);
+ try {
+ MessageNano.toByteArray(primitiveMap);
+ fail("should reject null keys");
+ } catch (IllegalStateException e) {
+ // pass.
+ }
+
+ TestMap messageMap = new TestMap();
+ messageMap.int32ToMessageField =
+ new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ messageMap.int32ToMessageField.put(0, null);
+ try {
+ MessageNano.toByteArray(messageMap);
+ fail("should reject null values");
+ } catch (IllegalStateException e) {
+ // pass.
+ }
+ }
+
+ /**
+ * Tests that merging bytes containing conflicting keys with override the
+ * message value instead of merging the message value into the existing entry.
+ */
+ public void testMapMergeOverrideMessageValues() throws Exception {
+ TestMap.MessageValue origValue = new TestMap.MessageValue();
+ origValue.value = 1;
+ origValue.value2 = 2;
+ TestMap.MessageValue newValue = new TestMap.MessageValue();
+ newValue.value = 3;
+
+ TestMap origMessage = new TestMap();
+ origMessage.int32ToMessageField =
+ new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ origMessage.int32ToMessageField.put(1, origValue);
+
+ TestMap newMessage = new TestMap();
+ newMessage.int32ToMessageField =
+ new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ newMessage.int32ToMessageField.put(1, newValue);
+ MessageNano.mergeFrom(origMessage,
+ MessageNano.toByteArray(newMessage));
+ TestMap.MessageValue mergedValue = origMessage.int32ToMessageField.get(1);
+ assertEquals(3, mergedValue.value);
+ assertEquals(0, mergedValue.value2);
+ }
+
+ /**
+ * Tests that when merging with empty entries,
+ * we will use default for the key and value, instead of null.
+ */
+ public void testMapMergeEmptyEntry() throws Exception {
+ TestMap testMap = new TestMap();
+ byte[] buffer = new byte[1024];
+ CodedOutputByteBufferNano output =
+ CodedOutputByteBufferNano.newInstance(buffer);
+ // An empty entry for int32_to_int32 map.
+ output.writeTag(1, WireFormatNano.WIRETYPE_LENGTH_DELIMITED);
+ output.writeRawVarint32(0);
+ // An empty entry for int32_to_message map.
+ output.writeTag(5, WireFormatNano.WIRETYPE_LENGTH_DELIMITED);
+ output.writeRawVarint32(0);
+
+ CodedInputByteBufferNano input = CodedInputByteBufferNano.newInstance(
+ buffer, 0, buffer.length - output.spaceLeft());
+ testMap.mergeFrom(input);
+ assertNotNull(testMap.int32ToInt32Field);;
+ assertEquals(1, testMap.int32ToInt32Field.size());
+ assertEquals(Integer.valueOf(0), testMap.int32ToInt32Field.get(0));
+ assertNotNull(testMap.int32ToMessageField);
+ assertEquals(1, testMap.int32ToMessageField.size());
+ TestMap.MessageValue messageValue = testMap.int32ToMessageField.get(0);
+ assertNotNull(messageValue);
+ assertEquals(0, messageValue.value);
+ assertEquals(0, messageValue.value2);
+ }
+
+ public void testMapEquals() throws Exception {
+ TestMap a = new TestMap();
+ TestMap b = new TestMap();
+
+ // empty and null map fields are equal.
+ assertTestMapEqual(a, b);
+ a.int32ToBytesField = new HashMap<Integer, byte[]>();
+ assertTestMapEqual(a, b);
+
+ a.int32ToInt32Field = new HashMap<Integer, Integer>();
+ b.int32ToInt32Field = new HashMap<Integer, Integer>();
+ setMap(a.int32ToInt32Field, deepCopy(int32Values), deepCopy(int32Values));
+ setMap(b.int32ToInt32Field, deepCopy(int32Values), deepCopy(int32Values));
+ assertTestMapEqual(a, b);
+
+ a.int32ToMessageField =
+ new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ b.int32ToMessageField =
+ new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ setMap(a.int32ToMessageField,
+ deepCopy(int32Values), deepCopy(messageValues));
+ setMap(b.int32ToMessageField,
+ deepCopy(int32Values), deepCopy(messageValues));
+ assertTestMapEqual(a, b);
+
+ a.stringToInt32Field = new HashMap<String, Integer>();
+ b.stringToInt32Field = new HashMap<String, Integer>();
+ setMap(a.stringToInt32Field, deepCopy(stringValues), deepCopy(int32Values));
+ setMap(b.stringToInt32Field, deepCopy(stringValues), deepCopy(int32Values));
+ assertTestMapEqual(a, b);
+
+ a.int32ToBytesField = new HashMap<Integer, byte[]>();
+ b.int32ToBytesField = new HashMap<Integer, byte[]>();
+ setMap(a.int32ToBytesField, deepCopy(int32Values), deepCopy(bytesValues));
+ setMap(b.int32ToBytesField, deepCopy(int32Values), deepCopy(bytesValues));
+ assertTestMapEqual(a, b);
+
+ // Make sure the map implementation does not matter.
+ a.int32ToStringField = new TreeMap<Integer, String>();
+ b.int32ToStringField = new HashMap<Integer, String>();
+ setMap(a.int32ToStringField, deepCopy(int32Values), deepCopy(stringValues));
+ setMap(b.int32ToStringField, deepCopy(int32Values), deepCopy(stringValues));
+ assertTestMapEqual(a, b);
+
+ a.clear();
+ b.clear();
+
+ // unequal cases: different value
+ a.int32ToInt32Field = new HashMap<Integer, Integer>();
+ b.int32ToInt32Field = new HashMap<Integer, Integer>();
+ a.int32ToInt32Field.put(1, 1);
+ b.int32ToInt32Field.put(1, 2);
+ assertTestMapUnequal(a, b);
+ // unequal case: additional entry
+ b.int32ToInt32Field.put(1, 1);
+ b.int32ToInt32Field.put(2, 1);
+ assertTestMapUnequal(a, b);
+ a.int32ToInt32Field.put(2, 1);
+ assertTestMapEqual(a, b);
+
+ // unequal case: different message value.
+ a.int32ToMessageField =
+ new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ b.int32ToMessageField =
+ new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ MessageValue va = new MessageValue();
+ va.value = 1;
+ MessageValue vb = new MessageValue();
+ vb.value = 1;
+ a.int32ToMessageField.put(1, va);
+ b.int32ToMessageField.put(1, vb);
+ assertTestMapEqual(a, b);
+ vb.value = 2;
+ assertTestMapUnequal(a, b);
+ }
+
+ private static void assertTestMapEqual(TestMap a, TestMap b)
+ throws Exception {
+ assertEquals(a.hashCode(), b.hashCode());
+ assertTrue(a.equals(b));
+ assertTrue(b.equals(a));
+ }
+
+ private static void assertTestMapUnequal(TestMap a, TestMap b)
+ throws Exception {
+ assertFalse(a.equals(b));
+ assertFalse(b.equals(a));
+ }
+
+ private static final Integer[] int32Values = new Integer[] {
+ 0, 1, -1, Integer.MAX_VALUE, Integer.MIN_VALUE,
+ };
+
+ private static final Long[] int64Values = new Long[] {
+ 0L, 1L, -1L, Long.MAX_VALUE, Long.MIN_VALUE,
+ };
+
+ private static final String[] stringValues = new String[] {
+ "", "hello", "world", "foo", "bar",
+ };
+
+ private static final byte[][] bytesValues = new byte[][] {
+ new byte[] {},
+ new byte[] {0},
+ new byte[] {1, -1},
+ new byte[] {127, -128},
+ new byte[] {'a', 'b', '0', '1'},
+ };
+
+ private static final Boolean[] boolValues = new Boolean[] {
+ false, true,
+ };
+
+ private static final Integer[] enumValues = new Integer[] {
+ TestMap.FOO, TestMap.BAR, TestMap.BAZ, TestMap.QUX,
+ Integer.MAX_VALUE /* unknown */,
+ };
+
+ private static final TestMap.MessageValue[] messageValues =
+ new TestMap.MessageValue[] {
+ newMapValueMessage(0),
+ newMapValueMessage(1),
+ newMapValueMessage(-1),
+ newMapValueMessage(Integer.MAX_VALUE),
+ newMapValueMessage(Integer.MIN_VALUE),
+ };
+
+ private static TestMap.MessageValue newMapValueMessage(int value) {
+ TestMap.MessageValue result = new TestMap.MessageValue();
+ result.value = value;
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> T[] deepCopy(T[] orig) throws Exception {
+ if (orig instanceof MessageValue[]) {
+ MessageValue[] result = new MessageValue[orig.length];
+ for (int i = 0; i < orig.length; i++) {
+ result[i] = new MessageValue();
+ MessageNano.mergeFrom(
+ result[i], MessageNano.toByteArray((MessageValue) orig[i]));
+ }
+ return (T[]) result;
+ }
+ if (orig instanceof byte[][]) {
+ byte[][] result = new byte[orig.length][];
+ for (int i = 0; i < orig.length; i++) {
+ byte[] origBytes = (byte[]) orig[i];
+ result[i] = Arrays.copyOf(origBytes, origBytes.length);
+ }
+ }
+ return Arrays.copyOf(orig, orig.length);
+ }
+
+ private <K, V> void setMap(Map<K, V> map, K[] keys, V[] values) {
+ assert(keys.length == values.length);
+ for (int i = 0; i < keys.length; i++) {
+ map.put(keys[i], values[i]);
+ }
+ }
+
+ private <K, V> void assertMapSet(
+ Map<K, V> map, K[] keys, V[] values) throws Exception {
+ assert(keys.length == values.length);
+ for (int i = 0; i < values.length; i++) {
+ assertEquals(values[i], map.get(keys[i]));
+ }
+ assertEquals(keys.length, map.size());
+ }
+
+ private void setMapMessage(TestMap testMap) {
+ testMap.int32ToInt32Field = new HashMap<Integer, Integer>();
+ testMap.int32ToBytesField = new HashMap<Integer, byte[]>();
+ testMap.int32ToEnumField = new HashMap<Integer, Integer>();
+ testMap.int32ToMessageField =
+ new HashMap<Integer, MapTestProto.TestMap.MessageValue>();
+ testMap.int32ToStringField = new HashMap<Integer, String>();
+ testMap.stringToInt32Field = new HashMap<String, Integer>();
+ testMap.boolToBoolField = new HashMap<Boolean, Boolean>();
+ testMap.uint32ToUint32Field = new HashMap<Integer, Integer>();
+ testMap.sint32ToSint32Field = new HashMap<Integer, Integer>();
+ testMap.fixed32ToFixed32Field = new HashMap<Integer, Integer>();
+ testMap.sfixed32ToSfixed32Field = new HashMap<Integer, Integer>();
+ testMap.int64ToInt64Field = new HashMap<Long, Long>();
+ testMap.uint64ToUint64Field = new HashMap<Long, Long>();
+ testMap.sint64ToSint64Field = new HashMap<Long, Long>();
+ testMap.fixed64ToFixed64Field = new HashMap<Long, Long>();
+ testMap.sfixed64ToSfixed64Field = new HashMap<Long, Long>();
+ setMap(testMap.int32ToInt32Field, int32Values, int32Values);
+ setMap(testMap.int32ToBytesField, int32Values, bytesValues);
+ setMap(testMap.int32ToEnumField, int32Values, enumValues);
+ setMap(testMap.int32ToMessageField, int32Values, messageValues);
+ setMap(testMap.int32ToStringField, int32Values, stringValues);
+ setMap(testMap.stringToInt32Field, stringValues, int32Values);
+ setMap(testMap.boolToBoolField, boolValues, boolValues);
+ setMap(testMap.uint32ToUint32Field, int32Values, int32Values);
+ setMap(testMap.sint32ToSint32Field, int32Values, int32Values);
+ setMap(testMap.fixed32ToFixed32Field, int32Values, int32Values);
+ setMap(testMap.sfixed32ToSfixed32Field, int32Values, int32Values);
+ setMap(testMap.int64ToInt64Field, int64Values, int64Values);
+ setMap(testMap.uint64ToUint64Field, int64Values, int64Values);
+ setMap(testMap.sint64ToSint64Field, int64Values, int64Values);
+ setMap(testMap.fixed64ToFixed64Field, int64Values, int64Values);
+ setMap(testMap.sfixed64ToSfixed64Field, int64Values, int64Values);
+ }
+ private void assertMapMessageSet(TestMap testMap) throws Exception {
+ assertMapSet(testMap.int32ToInt32Field, int32Values, int32Values);
+ assertMapSet(testMap.int32ToBytesField, int32Values, bytesValues);
+ assertMapSet(testMap.int32ToEnumField, int32Values, enumValues);
+ assertMapSet(testMap.int32ToMessageField, int32Values, messageValues);
+ assertMapSet(testMap.int32ToStringField, int32Values, stringValues);
+ assertMapSet(testMap.stringToInt32Field, stringValues, int32Values);
+ assertMapSet(testMap.boolToBoolField, boolValues, boolValues);
+ assertMapSet(testMap.uint32ToUint32Field, int32Values, int32Values);
+ assertMapSet(testMap.sint32ToSint32Field, int32Values, int32Values);
+ assertMapSet(testMap.fixed32ToFixed32Field, int32Values, int32Values);
+ assertMapSet(testMap.sfixed32ToSfixed32Field, int32Values, int32Values);
+ assertMapSet(testMap.int64ToInt64Field, int64Values, int64Values);
+ assertMapSet(testMap.uint64ToUint64Field, int64Values, int64Values);
+ assertMapSet(testMap.sint64ToSint64Field, int64Values, int64Values);
+ assertMapSet(testMap.fixed64ToFixed64Field, int64Values, int64Values);
+ assertMapSet(testMap.sfixed64ToSfixed64Field, int64Values, int64Values);
+ }
+
+ public void testRepeatedFieldInitializedInReftypesCompatMode() {
+ NanoReferenceTypesCompat.TestAllTypesNano proto = new NanoReferenceTypesCompat.TestAllTypesNano();
+ assertNotNull(proto.repeatedString);
+ }
+
+ private void assertRepeatedPackablesEqual(
+ NanoRepeatedPackables.NonPacked nonPacked, NanoRepeatedPackables.Packed packed) {
+ // Not using MessageNano.equals() -- that belongs to a separate test.
+ assertTrue(Arrays.equals(nonPacked.int32S, packed.int32S));
+ assertTrue(Arrays.equals(nonPacked.int64S, packed.int64S));
+ assertTrue(Arrays.equals(nonPacked.uint32S, packed.uint32S));
+ assertTrue(Arrays.equals(nonPacked.uint64S, packed.uint64S));
+ assertTrue(Arrays.equals(nonPacked.sint32S, packed.sint32S));
+ assertTrue(Arrays.equals(nonPacked.sint64S, packed.sint64S));
+ assertTrue(Arrays.equals(nonPacked.fixed32S, packed.fixed32S));
+ assertTrue(Arrays.equals(nonPacked.fixed64S, packed.fixed64S));
+ assertTrue(Arrays.equals(nonPacked.sfixed32S, packed.sfixed32S));
+ assertTrue(Arrays.equals(nonPacked.sfixed64S, packed.sfixed64S));
+ assertTrue(Arrays.equals(nonPacked.floats, packed.floats));
+ assertTrue(Arrays.equals(nonPacked.doubles, packed.doubles));
+ assertTrue(Arrays.equals(nonPacked.bools, packed.bools));
+ assertTrue(Arrays.equals(nonPacked.enums, packed.enums));
+ }
+
+ public void testClone() throws Exception {
+ // A simple message.
+ AnotherMessage anotherMessage = new AnotherMessage();
+ anotherMessage.string = "Hello";
+ anotherMessage.value = true;
+ anotherMessage.integers = new int[] { 1, 2, 3 };
+
+ AnotherMessage clone = anotherMessage.clone();
+ assertEquals(clone, anotherMessage);
+
+ // Verify it was a deep clone - changes to the clone shouldn't affect the
+ // original.
+ clone.integers[1] = 100;
+ assertFalse(clone.equals(anotherMessage));
+ }
+
+ private void assertHasWireData(MessageNano message, boolean expected) {
+ byte[] bytes = MessageNano.toByteArray(message);
+ int wireLength = bytes.length;
+ if (expected) {
+ assertFalse(wireLength == 0);
+ } else {
+ if (wireLength != 0) {
+ fail("Expected no wire data for message \n" + message
+ + "\nBut got:\n"
+ + hexDump(bytes));
+ }
+ }
+ }
+
+ private static String hexDump(byte[] bytes) {
+ StringBuilder sb = new StringBuilder();
+ for (byte b : bytes) {
+ sb.append(String.format("%02x ", b));
+ }
+ return sb.toString();
+ }
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/structurally_valid_unittest.cc b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/map_test.proto
index eec07a87ab..51498a4925 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/structurally_valid_unittest.cc
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/map_test.proto
@@ -28,43 +28,43 @@
// (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)
+syntax = "proto3";
-#include <google/protobuf/stubs/common.h>
-#include <gtest/gtest.h>
+package map_test;
-namespace google {
-namespace protobuf {
-namespace internal {
-namespace {
+option java_package = "com.google.protobuf";
+option java_outer_classname = "MapTestProto";
-TEST(StructurallyValidTest, ValidUTF8String) {
- // On GCC, this string can be written as:
- // "abcd 1234 - \u2014\u2013\u2212"
- // MSVC seems to interpret \u differently.
- string valid_str("abcd 1234 - \342\200\224\342\200\223\342\210\222 - xyz789");
- EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data(),
- valid_str.size()));
- // Additional check for pointer alignment
- for (int i = 1; i < 8; ++i) {
- EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data() + i,
- valid_str.size() - i));
+message TestMap {
+ message MessageValue {
+ int32 value = 1;
+ int32 value2 = 2;
}
-}
-
-TEST(StructurallyValidTest, InvalidUTF8String) {
- const string invalid_str("abcd\xA0\xB0\xA0\xB0\xA0\xB0 - xyz789");
- EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data(),
- invalid_str.size()));
- // Additional check for pointer alignment
- for (int i = 1; i < 8; ++i) {
- EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data() + i,
- invalid_str.size() - i));
+ enum EnumValue {
+ FOO = 0;
+ BAR = 1;
+ BAZ = 2;
+ QUX = 3;
}
-}
-} // namespace
-} // namespace internal
-} // namespace protobuf
-} // namespace google
+ map<int32, int32> int32_to_int32_field = 1;
+ map<int32, string> int32_to_string_field = 2;
+ map<int32, bytes> int32_to_bytes_field = 3;
+ map<int32, EnumValue> int32_to_enum_field = 4;
+ map<int32, MessageValue> int32_to_message_field = 5;
+ map<string, int32> string_to_int32_field = 6;
+ map<bool, bool> bool_to_bool_field = 7;
+
+ // Test all the other primitive types. As the key and value are not coupled in
+ // the implementation, we do not test all the combinations of key/value pairs,
+ // so that we can keep the number of test cases manageable
+ map<uint32, uint32> uint32_to_uint32_field = 11;
+ map<sint32, sint32> sint32_to_sint32_field = 12;
+ map<fixed32, fixed32> fixed32_to_fixed32_field = 13;
+ map<sfixed32, sfixed32> sfixed32_to_sfixed32_field = 14;
+ map<int64, int64> int64_to_int64_field = 15;
+ map<uint64, uint64> uint64_to_uint64_field = 16;
+ map<sint64, sint64> sint64_to_sint64_field = 17;
+ map<fixed64, fixed64> fixed64_to_fixed64_field = 18;
+ map<sfixed64, sfixed64> sfixed64_to_sfixed64_field = 19;
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_accessors_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_accessors_nano.proto
new file mode 100644
index 0000000000..6511e4703b
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_accessors_nano.proto
@@ -0,0 +1,118 @@
+// 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: maxtroy@google.com (Max Cai)
+
+package protobuf_unittest;
+
+option java_package = "com.google.protobuf";
+option java_outer_classname = "NanoAccessorsOuterClass";
+
+message TestNanoAccessors {
+
+ message NestedMessage {
+ optional int32 bb = 1;
+ }
+
+ enum NestedEnum {
+ FOO = 1;
+ BAR = 2;
+ BAZ = 3;
+ }
+
+ // Singular
+ optional int32 optional_int32 = 1;
+ optional float optional_float = 11;
+ optional double optional_double = 12;
+ optional string optional_string = 14;
+ optional bytes optional_bytes = 15;
+
+ optional NestedMessage optional_nested_message = 18;
+
+ optional NestedEnum optional_nested_enum = 21;
+
+ // Repeated
+ repeated int32 repeated_int32 = 31;
+ repeated string repeated_string = 44;
+ repeated bytes repeated_bytes = 45;
+
+ repeated NestedMessage repeated_nested_message = 48;
+
+ repeated NestedEnum repeated_nested_enum = 51;
+
+ // Singular with defaults
+ optional int32 default_int32 = 61 [default = 41 ];
+ optional string default_string = 74 [default = "hello"];
+ optional bytes default_bytes = 75 [default = "world"];
+
+ optional float default_float_nan = 99 [default = nan];
+
+ optional NestedEnum default_nested_enum = 81 [default = BAR];
+
+ // Required
+ required int32 id = 86;
+
+ // Add enough optional fields to make 2 bit fields in total
+ optional int32 filler100 = 100;
+ optional int32 filler101 = 101;
+ optional int32 filler102 = 102;
+ optional int32 filler103 = 103;
+ optional int32 filler104 = 104;
+ optional int32 filler105 = 105;
+ optional int32 filler106 = 106;
+ optional int32 filler107 = 107;
+ optional int32 filler108 = 108;
+ optional int32 filler109 = 109;
+ optional int32 filler110 = 110;
+ optional int32 filler111 = 111;
+ optional int32 filler112 = 112;
+ optional int32 filler113 = 113;
+ optional int32 filler114 = 114;
+ optional int32 filler115 = 115;
+ optional int32 filler116 = 116;
+ optional int32 filler117 = 117;
+ optional int32 filler118 = 118;
+ optional int32 filler119 = 119;
+ optional int32 filler120 = 120;
+ optional int32 filler121 = 121;
+ optional int32 filler122 = 122;
+ optional int32 filler123 = 123;
+ optional int32 filler124 = 124;
+ optional int32 filler125 = 125;
+ optional int32 filler126 = 126;
+ optional int32 filler127 = 127;
+ optional int32 filler128 = 128;
+ optional int32 filler129 = 129;
+ optional int32 filler130 = 130;
+
+ optional int32 before_bit_field_check = 139;
+ optional int32 bit_field_check = 140;
+ optional int32 after_bit_field_check = 141;
+}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest10.m b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_multiple_nano.proto
index d8318678db..958e1f17ca 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest10.m
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_multiple_nano.proto
@@ -28,13 +28,21 @@
// (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: maxtroy@google.com (Max Cai)
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
+package protobuf_unittest;
-#import "GPBUnknownFieldSet.h"
+option java_package = "com.google.protobuf";
+option java_multiple_files = true;
+enum FileScopeEnumMultiple {
+ THREE = 3;
+}
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_10 = 0;
+message EnumClassNanoMultiple {
+ enum MessageScopeEnumMultiple {
+ FOUR = 4;
+ }
+ optional FileScopeEnumMultiple three = 3 [ default = THREE ];
+ optional MessageScopeEnumMultiple four = 4 [ default = FOUR ];
+}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest03.m b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_nano.proto
index 41994f94dd..3a1e07f6d9 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest03.m
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_nano.proto
@@ -28,13 +28,21 @@
// (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: maxtroy@google.com (Max Cai)
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
+package protobuf_unittest;
-#import "GPBCodedOutputStream.h"
+option java_package = "com.google.protobuf";
+option java_outer_classname = "EnumClassNanos";
+enum FileScopeEnum {
+ ONE = 1;
+}
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_3 = 0;
+message EnumClassNano {
+ enum MessageScopeEnum {
+ TWO = 2;
+ }
+ optional FileScopeEnum one = 1 [ default = ONE ];
+ optional MessageScopeEnum two = 2 [ default = TWO ];
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_validity_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_validity_nano.proto
new file mode 100644
index 0000000000..c0da8b422e
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_enum_validity_nano.proto
@@ -0,0 +1,28 @@
+package protobuf_unittest;
+
+option java_package = "com.google.protobuf";
+option java_outer_classname = "EnumValidity";
+
+enum E {
+ default = 1; // test java keyword renaming
+ FOO = 2;
+ BAR = 3;
+ BAZ = 4;
+}
+
+message M {
+ optional E optional_e = 1;
+ optional E default_e = 2 [ default = BAZ ];
+ repeated E repeated_e = 3;
+ repeated E packed_e = 4 [ packed = true ];
+ repeated E repeated_e2 = 5;
+ repeated E packed_e2 = 6 [ packed = true ];
+ repeated E repeated_e3 = 7;
+ repeated E packed_e3 = 8 [ packed = true ];
+}
+
+message Alt {
+ optional E repeated_e2_as_optional = 5;
+ repeated E packed_e2_as_non_packed = 6;
+ repeated E non_packed_e3_as_packed = 7 [ packed = true ];
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_nano.proto
new file mode 100644
index 0000000000..ca56b3dd45
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_nano.proto
@@ -0,0 +1,37 @@
+syntax = "proto2";
+
+option java_outer_classname = "Extensions";
+option java_package = "com.google.protobuf.nano.testext";
+
+message ExtendableMessage {
+ optional int32 field = 1;
+ extensions 10 to max;
+}
+
+enum AnEnum {
+ FIRST_VALUE = 1;
+ SECOND_VALUE = 2;
+}
+
+message AnotherMessage {
+ optional string string = 1;
+ optional bool value = 2;
+ repeated int32 integers = 3;
+}
+
+message ContainerMessage {
+ extend ExtendableMessage {
+ optional bool another_thing = 100;
+ // The largest permitted field number, per
+ // https://developers.google.com/protocol-buffers/docs/proto#simple
+ optional bool large_field_number = 536870911;
+ }
+}
+
+// For testNanoOptionalGroupWithUnknownFieldsEnabled;
+// not part of the extensions tests.
+message MessageWithGroup {
+ optional group Group = 1 {
+ optional int32 a = 2;
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_packed_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_packed_nano.proto
new file mode 100644
index 0000000000..3b7a004c9e
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_packed_nano.proto
@@ -0,0 +1,29 @@
+syntax = "proto2";
+
+option java_multiple_files = true;
+option java_package = "com.google.protobuf";
+
+import "google/protobuf/nano/unittest_extension_nano.proto";
+
+// Must be compiled separately due to extension number reuse.
+// The reuse is deliberate, for testing wire compatibility.
+
+message PackedExtensions {
+ extend ExtendableMessage {
+ repeated int32 packed_int32 = 10 [ packed = true ];
+ repeated uint32 packed_uint32 = 11 [ packed = true ];
+ repeated sint32 packed_sint32 = 12 [ packed = true ];
+ repeated int64 packed_int64 = 13 [ packed = true ];
+ repeated uint64 packed_uint64 = 14 [ packed = true ];
+ repeated sint64 packed_sint64 = 15 [ packed = true ];
+ repeated fixed32 packed_fixed32 = 16 [ packed = true ];
+ repeated sfixed32 packed_sfixed32 = 17 [ packed = true ];
+ repeated fixed64 packed_fixed64 = 18 [ packed = true ];
+ repeated sfixed64 packed_sfixed64 = 19 [ packed = true ];
+ repeated bool packed_bool = 20 [ packed = true ];
+ repeated float packed_float = 21 [ packed = true ];
+ repeated double packed_double = 22 [ packed = true ];
+ repeated AnEnum packed_enum = 23 [ packed = true ];
+ // Non-packable types omitted.
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_repeated_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_repeated_nano.proto
new file mode 100644
index 0000000000..e533c65b43
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_repeated_nano.proto
@@ -0,0 +1,34 @@
+syntax = "proto2";
+
+option java_multiple_files = true;
+option java_package = "com.google.protobuf";
+
+import "google/protobuf/nano/unittest_extension_nano.proto";
+
+// Must be compiled separately due to extension number reuse.
+// The reuse is deliberate, for testing wire compatibility.
+
+message RepeatedExtensions {
+ extend ExtendableMessage {
+ repeated int32 repeated_int32 = 10;
+ repeated uint32 repeated_uint32 = 11;
+ repeated sint32 repeated_sint32 = 12;
+ repeated int64 repeated_int64 = 13;
+ repeated uint64 repeated_uint64 = 14;
+ repeated sint64 repeated_sint64 = 15;
+ repeated fixed32 repeated_fixed32 = 16;
+ repeated sfixed32 repeated_sfixed32 = 17;
+ repeated fixed64 repeated_fixed64 = 18;
+ repeated sfixed64 repeated_sfixed64 = 19;
+ repeated bool repeated_bool = 20;
+ repeated float repeated_float = 21;
+ repeated double repeated_double = 22;
+ repeated AnEnum repeated_enum = 23;
+ repeated string repeated_string = 24;
+ repeated bytes repeated_bytes = 25;
+ repeated AnotherMessage repeated_message = 26;
+ repeated group RepeatedGroup = 27 {
+ optional int32 a = 1;
+ }
+ }
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_singular_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_singular_nano.proto
new file mode 100644
index 0000000000..8b2d965888
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_extension_singular_nano.proto
@@ -0,0 +1,34 @@
+syntax = "proto2";
+
+option java_multiple_files = true;
+option java_package = "com.google.protobuf";
+
+import "google/protobuf/nano/unittest_extension_nano.proto";
+
+// Must be compiled separately due to extension number reuse.
+// The reuse is deliberate, for testing wire compatibility.
+
+message SingularExtensions {
+ extend ExtendableMessage {
+ optional int32 some_int32 = 10;
+ optional uint32 some_uint32 = 11;
+ optional sint32 some_sint32 = 12;
+ optional int64 some_int64 = 13;
+ optional uint64 some_uint64 = 14;
+ optional sint64 some_sint64 = 15;
+ optional fixed32 some_fixed32 = 16;
+ optional sfixed32 some_sfixed32 = 17;
+ optional fixed64 some_fixed64 = 18;
+ optional sfixed64 some_sfixed64 = 19;
+ optional bool some_bool = 20;
+ optional float some_float = 21;
+ optional double some_double = 22;
+ optional AnEnum some_enum = 23;
+ optional string some_string = 24;
+ optional bytes some_bytes = 25;
+ optional AnotherMessage some_message = 26;
+ optional group SomeGroup = 27 {
+ optional int32 a = 1;
+ }
+ }
+}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest25.m b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_has_nano.proto
index 7a482b51b1..fe7d1794a7 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest25.m
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_has_nano.proto
@@ -28,15 +28,55 @@
// (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: ulas@google.com (Ulas Kirazci)
-// This is a test including a single header to ensure things build. This
-// is NOT a public header of the library, but uses a file that defines
-// extensions to proto2 syntax messages, so it can need more things
-// that the proto3 syntax WKTs bundled with the library.
+package protobuf_unittest;
-#import "google/protobuf/UnittestCustomOptions.pbobjc.h"
+option java_package = "com.google.protobuf";
+option java_outer_classname = "NanoHasOuterClass";
+message TestAllTypesNanoHas {
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_25 = 0;
+ message NestedMessage {
+ optional int32 bb = 1;
+ }
+
+ enum NestedEnum {
+ FOO = 1;
+ BAR = 2;
+ BAZ = 3;
+ }
+
+ // Singular
+ optional int32 optional_int32 = 1;
+ optional float optional_float = 11;
+ optional double optional_double = 12;
+ optional string optional_string = 14;
+ optional bytes optional_bytes = 15;
+
+ optional NestedMessage optional_nested_message = 18;
+
+ optional NestedEnum optional_nested_enum = 21;
+
+ // Repeated
+ repeated int32 repeated_int32 = 31;
+ repeated string repeated_string = 44;
+ repeated bytes repeated_bytes = 45;
+
+ repeated NestedMessage repeated_nested_message = 48;
+
+ repeated NestedEnum repeated_nested_enum = 51;
+
+ // Singular with defaults
+ optional int32 default_int32 = 61 [default = 41 ];
+ optional string default_string = 74 [default = "hello"];
+ optional bytes default_bytes = 75 [default = "world"];
+
+ optional float default_float_nan = 99 [default = nan];
+
+ optional NestedEnum default_nested_enum = 81 [default = BAR];
+
+ required int32 id = 86;
+ required NestedEnum required_enum = 87;
+
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/test_util.cc b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_import_nano.proto
index 795cb6ae17..1a3ddc57ea 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/test_util.cc
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_import_nano.proto
@@ -29,19 +29,20 @@
// 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.
+//
+// This is like unittest_import.proto but with optimize_for = NANO_RUNTIME.
-#ifdef _WIN32
-// Verify that #including windows.h does not break anything (e.g. because
-// windows.h #defines GetMessage() as a macro).
-#include <windows.h>
-#endif
+package protobuf_unittest_import;
-#include <google/protobuf/test_util.h>
+option java_package = "com.google.protobuf.nano.testimport";
+option java_outer_classname = "UnittestImportNano";
-namespace google {
-namespace protobuf {
+message ImportMessageNano {
+ optional int32 d = 1;
+}
-} // namespace protobuf
-} // namespace google
+enum ImportEnumNano {
+ IMPORT_NANO_FOO = 7;
+ IMPORT_NANO_BAR = 8;
+ IMPORT_NANO_BAZ = 9;
+}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest01.m b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nameclash_nano.proto
index c8bc433a04..b31c43994c 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest01.m
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nameclash_nano.proto
@@ -28,13 +28,14 @@
// (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: maxtroy@google.com (Max Cai)
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
+package protobuf_unittest_import;
-#import "GPBArray.h"
+option java_package = "com.google.protobuf";
+option java_outer_classname = "MultipleNameClashNano";
+option java_multiple_files = true;
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_1 = 0;
+message MultipleNameClashNano {
+ optional int32 field = 1;
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nano.proto
new file mode 100644
index 0000000000..406ab7741c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nano.proto
@@ -0,0 +1,63 @@
+// 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: maxtroy@google.com (Max Cai)
+
+package protobuf_unittest_import;
+
+import "google/protobuf/nano/unittest_import_nano.proto";
+
+option java_package = "com.google.protobuf";
+option java_multiple_files = true;
+
+enum FileScopeEnum {
+ ONE = 1;
+ TWO = 2;
+}
+
+message FileScopeEnumRefNano {
+ optional FileScopeEnum enum_field = 1;
+}
+
+message MessageScopeEnumRefNano {
+ enum MessageScopeEnum {
+ ONE = 1;
+ TWO = 2;
+ }
+ optional MessageScopeEnum enum_field = 1;
+}
+
+message MultipleImportingNonMultipleNano1 {
+ optional ImportMessageNano field = 1;
+}
+
+message MultipleImportingNonMultipleNano2 {
+ optional MultipleImportingNonMultipleNano1 nano1 = 1;
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_nano.proto
new file mode 100644
index 0000000000..3fff24c0c4
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_nano.proto
@@ -0,0 +1,195 @@
+// 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: wink@google.com (Wink Saville)
+
+package protobuf_unittest;
+
+import "google/protobuf/nano/unittest_import_nano.proto";
+
+option java_package = "com.google.protobuf";
+option java_outer_classname = "NanoOuterClass";
+
+// Same as TestAllTypes but with the nano runtime.
+message TestAllTypesNano {
+
+ message NestedMessage {
+ optional int32 bb = 1;
+ }
+
+ enum NestedEnum {
+ FOO = 1;
+ BAR = 2;
+ BAZ = 3;
+ }
+
+ // Singular
+ optional int32 optional_int32 = 1;
+ optional int64 optional_int64 = 2;
+ optional uint32 optional_uint32 = 3;
+ optional uint64 optional_uint64 = 4;
+ optional sint32 optional_sint32 = 5;
+ optional sint64 optional_sint64 = 6;
+ optional fixed32 optional_fixed32 = 7;
+ optional fixed64 optional_fixed64 = 8;
+ optional sfixed32 optional_sfixed32 = 9;
+ optional sfixed64 optional_sfixed64 = 10;
+ optional float optional_float = 11;
+ optional double optional_double = 12;
+ optional bool optional_bool = 13;
+ optional string optional_string = 14;
+ optional bytes optional_bytes = 15;
+
+ optional group OptionalGroup = 16 {
+ optional int32 a = 17;
+ }
+
+ optional NestedMessage optional_nested_message = 18;
+ optional ForeignMessageNano optional_foreign_message = 19;
+ optional protobuf_unittest_import.ImportMessageNano
+ optional_import_message = 20;
+
+ optional NestedEnum optional_nested_enum = 21;
+ optional ForeignEnumNano optional_foreign_enum = 22;
+ optional protobuf_unittest_import.ImportEnumNano optional_import_enum = 23;
+
+ optional string optional_string_piece = 24 [ctype=STRING_PIECE];
+ optional string optional_cord = 25 [ctype=CORD];
+
+ // Repeated
+ repeated int32 repeated_int32 = 31;
+ repeated int64 repeated_int64 = 32;
+ repeated uint32 repeated_uint32 = 33;
+ repeated uint64 repeated_uint64 = 34;
+ repeated sint32 repeated_sint32 = 35;
+ repeated sint64 repeated_sint64 = 36;
+ repeated fixed32 repeated_fixed32 = 37;
+ repeated fixed64 repeated_fixed64 = 38;
+ repeated sfixed32 repeated_sfixed32 = 39;
+ repeated sfixed64 repeated_sfixed64 = 40;
+ repeated float repeated_float = 41;
+ repeated double repeated_double = 42;
+ repeated bool repeated_bool = 43;
+ repeated string repeated_string = 44;
+ repeated bytes repeated_bytes = 45;
+
+ repeated group RepeatedGroup = 46 {
+ optional int32 a = 47;
+ }
+
+ repeated NestedMessage repeated_nested_message = 48;
+ repeated ForeignMessageNano repeated_foreign_message = 49;
+ repeated protobuf_unittest_import.ImportMessageNano
+ repeated_import_message = 50;
+
+ repeated NestedEnum repeated_nested_enum = 51;
+ repeated ForeignEnumNano repeated_foreign_enum = 52;
+ repeated protobuf_unittest_import.ImportEnumNano repeated_import_enum = 53;
+
+ repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+ repeated string repeated_cord = 55 [ctype=CORD];
+
+ // Repeated packed
+ repeated int32 repeated_packed_int32 = 87 [packed=true];
+ repeated sfixed64 repeated_packed_sfixed64 = 88 [packed=true];
+
+ repeated NestedEnum repeated_packed_nested_enum = 89 [packed=true];
+
+ // Singular with defaults
+ optional int32 default_int32 = 61 [default = 41 ];
+ optional int64 default_int64 = 62 [default = 42 ];
+ optional uint32 default_uint32 = 63 [default = 43 ];
+ optional uint64 default_uint64 = 64 [default = 44 ];
+ optional sint32 default_sint32 = 65 [default = -45 ];
+ optional sint64 default_sint64 = 66 [default = 46 ];
+ optional fixed32 default_fixed32 = 67 [default = 47 ];
+ optional fixed64 default_fixed64 = 68 [default = 48 ];
+ optional sfixed32 default_sfixed32 = 69 [default = 49 ];
+ optional sfixed64 default_sfixed64 = 70 [default = -50 ];
+ optional float default_float = 71 [default = 51.5 ];
+ optional double default_double = 72 [default = 52e3 ];
+ optional bool default_bool = 73 [default = true ];
+ optional string default_string = 74 [default = "hello"];
+ optional bytes default_bytes = 75 [default = "world"];
+
+ optional string default_string_nonascii = 76 [default = "dünya"];
+ optional bytes default_bytes_nonascii = 77 [default = "dünyab"];
+
+ optional float default_float_inf = 97 [default = inf];
+ optional float default_float_neg_inf = 98 [default = -inf];
+ optional float default_float_nan = 99 [default = nan];
+ optional double default_double_inf = 100 [default = inf];
+ optional double default_double_neg_inf = 101 [default = -inf];
+ optional double default_double_nan = 102 [default = nan];
+
+ optional NestedEnum default_nested_enum = 81 [default = BAR];
+ optional ForeignEnumNano default_foreign_enum = 82
+ [default = FOREIGN_NANO_BAR];
+ optional protobuf_unittest_import.ImportEnumNano
+ default_import_enum = 83 [default = IMPORT_NANO_BAR];
+
+ optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
+ optional string default_cord = 85 [ctype=CORD,default="123"];
+
+ required int32 id = 86;
+
+ // Try to cause conflicts.
+ optional int32 tag = 93;
+ optional int32 get_serialized_size = 94;
+ optional int32 write_to = 95;
+
+ // Try to fail with java reserved keywords
+ optional int32 synchronized = 96;
+
+ oneof oneof_field {
+ uint32 oneof_uint32 = 111;
+ NestedMessage oneof_nested_message = 112;
+ string oneof_string = 123;
+ bytes oneof_bytes = 124;
+ fixed64 oneof_fixed64 = 115;
+ NestedEnum oneof_enum = 116;
+ }
+}
+
+message ForeignMessageNano {
+ optional int32 c = 1;
+}
+
+enum ForeignEnumNano {
+ FOREIGN_NANO_FOO = 4;
+ FOREIGN_NANO_BAR = 5;
+ FOREIGN_NANO_BAZ = 6;
+}
+
+// Test that deprecated fields work. We only verify that they compile (at one
+// point this failed).
+message TestDeprecatedNano {
+ optional int32 deprecated_field = 1 [deprecated = true];
+}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest02.m b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_recursive_nano.proto
index c44e201a4d..29b944f01f 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest02.m
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_recursive_nano.proto
@@ -28,13 +28,22 @@
// (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: wink@google.com (Wink Saville)
+//
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
+package protobuf_unittest_import;
-#import "GPBCodedInputStream.h"
+option java_package = "com.google.protobuf";
+// Explicit outer classname to suppress legacy info.
+option java_outer_classname = "UnittestRecursiveNano";
+message RecursiveMessageNano {
+ message NestedMessage {
+ optional RecursiveMessageNano a = 1;
+ }
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_2 = 0;
+ required int32 id = 1;
+ optional NestedMessage nested_message = 2;
+ optional RecursiveMessageNano optional_recursive_message_nano = 3;
+ repeated RecursiveMessageNano repeated_recursive_message_nano = 4;
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_reference_types_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_reference_types_nano.proto
new file mode 100644
index 0000000000..82eb8d1175
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_reference_types_nano.proto
@@ -0,0 +1,116 @@
+package protobuf_unittest;
+
+option java_package = "com.google.protobuf";
+option java_outer_classname = "NanoReferenceTypes";
+
+message TestAllTypesNano {
+
+ enum NestedEnum {
+ FOO = 1;
+ BAR = 2;
+ BAZ = 3;
+ }
+
+ message NestedMessage {
+ optional int32 foo = 1;
+ }
+
+ // Singular
+ optional int32 optional_int32 = 1;
+ optional int64 optional_int64 = 2;
+ optional uint32 optional_uint32 = 3;
+ optional uint64 optional_uint64 = 4;
+ optional sint32 optional_sint32 = 5;
+ optional sint64 optional_sint64 = 6;
+ optional fixed32 optional_fixed32 = 7;
+ optional fixed64 optional_fixed64 = 8;
+ optional sfixed32 optional_sfixed32 = 9;
+ optional sfixed64 optional_sfixed64 = 10;
+ optional float optional_float = 11;
+ optional double optional_double = 12;
+ optional bool optional_bool = 13;
+ optional string optional_string = 14;
+ optional bytes optional_bytes = 15;
+
+ optional group OptionalGroup = 16 {
+ optional int32 a = 17;
+ }
+
+ optional NestedMessage optional_nested_message = 18;
+
+ optional NestedEnum optional_nested_enum = 21;
+
+ optional string optional_string_piece = 24 [ctype=STRING_PIECE];
+ optional string optional_cord = 25 [ctype=CORD];
+
+ // Repeated
+ repeated int32 repeated_int32 = 31;
+ repeated int64 repeated_int64 = 32;
+ repeated uint32 repeated_uint32 = 33;
+ repeated uint64 repeated_uint64 = 34;
+ repeated sint32 repeated_sint32 = 35;
+ repeated sint64 repeated_sint64 = 36;
+ repeated fixed32 repeated_fixed32 = 37;
+ repeated fixed64 repeated_fixed64 = 38;
+ repeated sfixed32 repeated_sfixed32 = 39;
+ repeated sfixed64 repeated_sfixed64 = 40;
+ repeated float repeated_float = 41;
+ repeated double repeated_double = 42;
+ repeated bool repeated_bool = 43;
+ repeated string repeated_string = 44;
+ repeated bytes repeated_bytes = 45;
+
+ repeated group RepeatedGroup = 46 {
+ optional int32 a = 47;
+ }
+
+ repeated NestedMessage repeated_nested_message = 48;
+
+ repeated NestedEnum repeated_nested_enum = 51;
+
+ repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+ repeated string repeated_cord = 55 [ctype=CORD];
+
+ // Repeated packed
+ repeated int32 repeated_packed_int32 = 87 [packed=true];
+ repeated sfixed64 repeated_packed_sfixed64 = 88 [packed=true];
+
+ repeated NestedEnum repeated_packed_nested_enum = 89 [packed=true];
+
+ // Singular with defaults
+ optional int32 default_int32 = 61 [default = 41 ];
+ optional int64 default_int64 = 62 [default = 42 ];
+ optional uint32 default_uint32 = 63 [default = 43 ];
+ optional uint64 default_uint64 = 64 [default = 44 ];
+ optional sint32 default_sint32 = 65 [default = -45 ];
+ optional sint64 default_sint64 = 66 [default = 46 ];
+ optional fixed32 default_fixed32 = 67 [default = 47 ];
+ optional fixed64 default_fixed64 = 68 [default = 48 ];
+ optional sfixed32 default_sfixed32 = 69 [default = 49 ];
+ optional sfixed64 default_sfixed64 = 70 [default = -50 ];
+ optional float default_float = 71 [default = 51.5 ];
+ optional double default_double = 72 [default = 52e3 ];
+ optional bool default_bool = 73 [default = true ];
+ optional string default_string = 74 [default = "hello"];
+ optional bytes default_bytes = 75 [default = "world"];
+
+
+ optional float default_float_inf = 97 [default = inf];
+ optional float default_float_neg_inf = 98 [default = -inf];
+ optional float default_float_nan = 99 [default = nan];
+ optional double default_double_inf = 100 [default = inf];
+ optional double default_double_neg_inf = 101 [default = -inf];
+ optional double default_double_nan = 102 [default = nan];
+
+}
+
+message ForeignMessageNano {
+ optional int32 c = 1;
+}
+
+enum ForeignEnumNano {
+ FOREIGN_NANO_FOO = 4;
+ FOREIGN_NANO_BAR = 5;
+ FOREIGN_NANO_BAZ = 6;
+}
+
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest11.m b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_merge_nano.proto
index 9f2c6b11a0..ef4e2d2f65 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest11.m
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_merge_nano.proto
@@ -28,13 +28,20 @@
// (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: maxtroy@google.com (Max Cai)
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
+package protobuf_unittest;
-#import "GPBUtilities.h"
+import "google/protobuf/nano/unittest_nano.proto";
+option java_package = "com.google.protobuf";
+option java_multiple_files = true;
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_11 = 0;
+// A container message for testing the merging of repeated fields at a
+// nested level. Other tests will be done using the repeated fields in
+// TestAllTypesNano.
+message TestRepeatedMergeNano {
+
+ optional TestAllTypesNano contained = 1;
+
+}
diff --git a/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_packables_nano.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_packables_nano.proto
new file mode 100644
index 0000000000..96af8856cf
--- /dev/null
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_repeated_packables_nano.proto
@@ -0,0 +1,95 @@
+// 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: maxtroy@google.com (Max Cai)
+
+package protobuf_unittest;
+
+option java_package = "com.google.protobuf";
+option java_outer_classname = "NanoRepeatedPackables";
+
+enum Enum {
+ OPTION_ONE = 1;
+ OPTION_TWO = 2;
+}
+
+// Two almost identical messages with all packable repeated field types.
+// One with none marked as packed and the other all packed. For
+// compatibility, they should be able to parse each other's serialized
+// forms.
+
+message NonPacked {
+
+ // All packable types, none marked as packed.
+
+ repeated int32 int32s = 1;
+ repeated int64 int64s = 2;
+ repeated uint32 uint32s = 3;
+ repeated uint64 uint64s = 4;
+ repeated sint32 sint32s = 5;
+ repeated sint64 sint64s = 6;
+ repeated fixed32 fixed32s = 7;
+ repeated fixed64 fixed64s = 8;
+ repeated sfixed32 sfixed32s = 9;
+ repeated sfixed64 sfixed64s = 10;
+ repeated float floats = 11;
+ repeated double doubles = 12;
+ repeated bool bools = 13;
+ repeated Enum enums = 14;
+
+ // Noise for testing merged deserialization.
+ optional int32 noise = 15;
+
+}
+
+message Packed {
+
+ // All packable types, all matching the field numbers in NonPacked,
+ // all marked as packed.
+
+ repeated int32 int32s = 1 [ packed = true ];
+ repeated int64 int64s = 2 [ packed = true ];
+ repeated uint32 uint32s = 3 [ packed = true ];
+ repeated uint64 uint64s = 4 [ packed = true ];
+ repeated sint32 sint32s = 5 [ packed = true ];
+ repeated sint64 sint64s = 6 [ packed = true ];
+ repeated fixed32 fixed32s = 7 [ packed = true ];
+ repeated fixed64 fixed64s = 8 [ packed = true ];
+ repeated sfixed32 sfixed32s = 9 [ packed = true ];
+ repeated sfixed64 sfixed64s = 10 [ packed = true ];
+ repeated float floats = 11 [ packed = true ];
+ repeated double doubles = 12 [ packed = true ];
+ repeated bool bools = 13 [ packed = true ];
+ repeated Enum enums = 14 [ packed = true ];
+
+ // Noise for testing merged deserialization.
+ optional int32 noise = 15;
+
+}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest12.m b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_simple_nano.proto
index 3aa29b3171..25786cc227 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest12.m
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_simple_nano.proto
@@ -28,13 +28,27 @@
// (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: wink@google.com (Wink Saville)
+//
+
+package protobuf_unittest_import;
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
+option java_package = "com.google.protobuf";
+// Explicit outer classname to suppress legacy info.
+option java_outer_classname = "UnittestSimpleNano";
-#import "GPBWellKnownTypes.h"
+message SimpleMessageNano {
+ message NestedMessage {
+ optional int32 bb = 1;
+ }
+ enum NestedEnum {
+ FOO = 1;
+ BAR = 2;
+ BAZ = 3;
+ }
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_12 = 0;
+ optional int32 d = 1 [default = 123];
+ optional NestedMessage nested_msg = 2;
+ optional NestedEnum default_nested_enum = 3 [default = BAZ];
+}
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/deprecated_file.proto b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_single_nano.proto
index ca90e927cd..7de30c877d 100644
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/deprecated_file.proto
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_single_nano.proto
@@ -28,11 +28,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-syntax = "proto3";
+// Author: maxtroy@google.com (Max Cai)
-package deprecated_file;
+package protobuf_unittest_import;
-option deprecated = true;
+option java_package = "com.google.protobuf";
-// TODO (liujisi): Add deprecation options on messages, enums fields as well and
-// add tests to verify those annotations are actually generated.
+message SingleMessageNano {
+}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest07.m b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_stringutf8_nano.proto
index 939bb7097d..bbd677cfd6 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest07.m
+++ b/third_party/protobuf/3.4.0/javanano/src/test/java/com/google/protobuf/nano/unittest_stringutf8_nano.proto
@@ -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.
+// Author: wink@google.com (Wink Saville)
+//
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "GPBMessage.h"
+package protobuf_unittest_import;
+option java_package = "com.google.protobuf";
+// Explicit outer classname to suppress legacy info.
+option java_outer_classname = "UnittestStringutf8Nano";
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_7 = 0;
+message StringUtf8 {
+ optional string id = 1;
+ repeated string rs = 2;
+}
diff --git a/third_party/protobuf/3.4.0/jenkins/README.md b/third_party/protobuf/3.4.0/jenkins/README.md
new file mode 100644
index 0000000000..29f664f299
--- /dev/null
+++ b/third_party/protobuf/3.4.0/jenkins/README.md
@@ -0,0 +1,6 @@
+
+Jenkins Infrastructure
+----------------------
+
+The scripts in this directory serve as plumbing for running the protobuf
+tests under Jenkins.
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/build_and_run_docker.sh b/third_party/protobuf/3.4.0/jenkins/build_and_run_docker.sh
index 6a1f327a76..50e1e8c684 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/linux/build_and_run_docker.sh
+++ b/third_party/protobuf/3.4.0/jenkins/build_and_run_docker.sh
@@ -11,16 +11,15 @@
set -ex
-cd $(dirname $0)/../..
+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\ )
+# Use image name based on Dockerfile location checksum
+DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR)_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ )
-# Pull dockerimage from Dockerhub
-docker pull $DOCKER_IMAGE_NAME
+# Make sure docker image has been built. Should be instantaneous if so.
+docker build -t $DOCKER_IMAGE_NAME $DOCKERFILE_DIR
# Ensure existence of ccache directory
CCACHE_DIR=/tmp/protobuf-ccache
@@ -29,26 +28,24 @@ 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 EXTERNAL_GIT_ROOT="/var/local/jenkins/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 "$git_root:/var/local/jenkins/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"
+ bash -l "/var/local/jenkins/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"
+ docker cp "$CONTAINER_NAME:/var/local/git/protobuf/$OUTPUT_DIR" "$git_root" || FAILED="true"
fi
# remove the container, possibly killing it first
diff --git a/third_party/protobuf/3.4.0/jenkins/buildcmds/README.md b/third_party/protobuf/3.4.0/jenkins/buildcmds/README.md
new file mode 100644
index 0000000000..7a48f2d5c9
--- /dev/null
+++ b/third_party/protobuf/3.4.0/jenkins/buildcmds/README.md
@@ -0,0 +1,6 @@
+
+Jenkins Build Commands
+----------------------
+
+The scripts in this directory are designed to be top-level entry points for
+Jenkins projects.
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/64-bit/build.sh b/third_party/protobuf/3.4.0/jenkins/buildcmds/pull_request.sh
index 48ddbce532..51e4bfa48c 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/linux/64-bit/build.sh
+++ b/third_party/protobuf/3.4.0/jenkins/buildcmds/pull_request.sh
@@ -1,17 +1,16 @@
#!/bin/bash
#
-# This is the top-level script we give to Kokoro as the entry point for
+# This is the top-level script we give to Jenkins as the entry point for
# running the "pull request" project:
#
+# https://grpc-testing.appspot.com/view/Protocol%20Buffers/job/protobuf_pull_request/
+#
# 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 DOCKERFILE_DIR=jenkins/docker
+export DOCKER_RUN_SCRIPT=jenkins/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
+./jenkins/build_and_run_docker.sh
diff --git a/third_party/protobuf/3.4.0/jenkins/buildcmds/pull_request_32.sh b/third_party/protobuf/3.4.0/jenkins/buildcmds/pull_request_32.sh
new file mode 100755
index 0000000000..bf0fb7ffe3
--- /dev/null
+++ b/third_party/protobuf/3.4.0/jenkins/buildcmds/pull_request_32.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Jenkins as the entry point for
+# running the "pull request 32" project:
+#
+# https://grpc-testing.appspot.com/view/Protocol%20Buffers/job/Protocol%20Buffers%20Pull%20Request%2032/
+#
+# 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.
+
+export DOCKERFILE_DIR=jenkins/docker32
+export DOCKER_RUN_SCRIPT=jenkins/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="php_all_32"
+./jenkins/build_and_run_docker.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/64-bit/Dockerfile b/third_party/protobuf/3.4.0/jenkins/docker/Dockerfile
index 3a279e6602..8faba4c667 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/64-bit/Dockerfile
+++ b/third_party/protobuf/3.4.0/jenkins/docker/Dockerfile
@@ -217,13 +217,6 @@ 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
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/32-bit/Dockerfile b/third_party/protobuf/3.4.0/jenkins/docker32/Dockerfile
index 1278889f91..1278889f91 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/32-bit/Dockerfile
+++ b/third_party/protobuf/3.4.0/jenkins/docker32/Dockerfile
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/make_test_output.py b/third_party/protobuf/3.4.0/jenkins/make_test_output.py
index 985368534c..b1f2e2c0bb 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/make_test_output.py
+++ b/third_party/protobuf/3.4.0/jenkins/make_test_output.py
@@ -17,12 +17,11 @@ detailed test results. It runs as the last step before the Jenkins build
finishes.
"""
-import os
-import sys
+import os;
+import sys;
from yattag import Doc
from collections import defaultdict
-
def readtests(basedir):
tests = defaultdict(dict)
@@ -69,7 +68,6 @@ def readtests(basedir):
return ret
-
def genxml(tests):
doc, tag, text = Doc().tagtext()
@@ -88,7 +86,6 @@ def genxml(tests):
return doc.getvalue()
-
sys.stderr.write("make_test_output.py: writing XML from directory: " +
- sys.argv[1] + "\n")
-print(genxml(readtests(sys.argv[1])))
+ sys.argv[1] + "\n");
+print genxml(readtests(sys.argv[1]))
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/pull_request_in_docker.sh b/third_party/protobuf/3.4.0/jenkins/pull_request_in_docker.sh
index df3636cce7..10daf0a593 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/linux/pull_request_in_docker.sh
+++ b/third_party/protobuf/3.4.0/jenkins/pull_request_in_docker.sh
@@ -5,7 +5,7 @@
WORKSPACE_BASE=`pwd`
MY_DIR="$(dirname "$0")"
-TEST_SCRIPT=$MY_DIR/../../tests.sh
+TEST_SCRIPT=$MY_DIR/../tests.sh
BUILD_DIR=/tmp/protobuf
set -e # exit immediately on error
@@ -16,12 +16,9 @@ set -x # display all commands
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR
cd $BUILD_DIR
-git clone /var/local/kokoro/protobuf
+git clone /var/local/jenkins/protobuf
cd protobuf
-# Initialize any submodules:
-git submodule update --init --recursive
-
# Set up the directory where our test output is going to go.
OUTPUT_DIR=`mktemp -d`
LOG_OUTPUT_DIR=$OUTPUT_DIR/logs
@@ -57,10 +54,10 @@ parallel --results $LOG_OUTPUT_DIR --joblog $OUTPUT_DIR/joblog $TEST_SCRIPT :::
cat $OUTPUT_DIR/joblog
-# The directory that is copied from Docker back into the Kokoro workspace.
+# The directory that is copied from Docker back into the Jenkins workspace.
COPY_FROM_DOCKER=/var/local/git/protobuf/testoutput
mkdir -p $COPY_FROM_DOCKER
-TESTOUTPUT_XML_FILE=$COPY_FROM_DOCKER/sponge_log.xml
+TESTOUTPUT_XML_FILE=$COPY_FROM_DOCKER/testresults.xml
# Process all the output files from "parallel" and package them into a single
# .xml file with detailed, broken-down test output.
diff --git a/third_party/protobuf/3.6.0/js/README.md b/third_party/protobuf/3.4.0/js/README.md
index ef0d4b198a..24386dc7d5 100644
--- a/third_party/protobuf/3.6.0/js/README.md
+++ b/third_party/protobuf/3.4.0/js/README.md
@@ -158,7 +158,7 @@ idea of how the library generally works:
message.setPhoneNumbers(["800-555-1212", "800-555-0000"]);
// Serializes to a UInt8Array.
- var bytes = message.serializeBinary();
+ bytes = message.serializeBinary();
var message2 = MyMessage.deserializeBinary(bytes);
diff --git a/third_party/protobuf/3.6.0/js/binary/arith.js b/third_party/protobuf/3.4.0/js/binary/arith.js
index 62528a263a..70257de716 100644
--- a/third_party/protobuf/3.6.0/js/binary/arith.js
+++ b/third_party/protobuf/3.4.0/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/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/arith_test.js b/third_party/protobuf/3.4.0/js/binary/arith_test.js
index 89796bf795..89796bf795 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/arith_test.js
+++ b/third_party/protobuf/3.4.0/js/binary/arith_test.js
diff --git a/third_party/protobuf/3.6.0/js/binary/constants.js b/third_party/protobuf/3.4.0/js/binary/constants.js
index 21c5889c93..ef5fecddc5 100644
--- a/third_party/protobuf/3.6.0/js/binary/constants.js
+++ b/third_party/protobuf/3.4.0/js/binary/constants.js
@@ -51,34 +51,20 @@ goog.provide('jspb.ScalarFieldType');
goog.provide('jspb.WriterFunction');
-goog.forwardDeclare('jspb.BinaryMessage');
-goog.forwardDeclare('jspb.BinaryReader');
-goog.forwardDeclare('jspb.BinaryWriter');
goog.forwardDeclare('jspb.Message');
goog.forwardDeclare('jsproto.BinaryExtension');
/**
- * Base interface class for all const messages.
+ * Base interface class for all const messages. Does __not__ define any
+ * methods, as doing so on a widely-used interface defeats dead-code
+ * elimination.
* @interface
*/
jspb.ConstBinaryMessage = function() {};
-/**
- * Generate a debug string for this proto that is in proto2 text format.
- * @return {string} The debug string.
- */
-jspb.ConstBinaryMessage.prototype.toDebugString;
-/**
- * Helper to generate a debug string for this proto at some indent level. The
- * first line is not indented.
- * @param {number} indentLevel The number of spaces by which to indent lines.
- * @return {string} The debug string.
- * @protected
- */
-jspb.ConstBinaryMessage.prototype.toDebugStringInternal;
/**
* Base interface class for all messages. Does __not__ define any methods, as
@@ -108,7 +94,6 @@ jspb.ScalarFieldType;
* A repeated field in jspb is an array of scalars, blobs, or messages.
* @typedef {!Array<jspb.ScalarFieldType>|
!Array<!Uint8Array>|
- !Array<!jspb.ConstBinaryMessage>|
!Array<!jspb.BinaryMessage>}
*/
jspb.RepeatedFieldType;
@@ -120,7 +105,6 @@ jspb.RepeatedFieldType;
* @typedef {jspb.ScalarFieldType|
jspb.RepeatedFieldType|
!Uint8Array|
- !jspb.ConstBinaryMessage|
!jspb.BinaryMessage|
!jsproto.BinaryExtension}
*/
diff --git a/third_party/protobuf/3.6.0/js/binary/decoder.js b/third_party/protobuf/3.4.0/js/binary/decoder.js
index e33bf1be9c..6db28e7c33 100644
--- a/third_party/protobuf/3.6.0/js/binary/decoder.js
+++ b/third_party/protobuf/3.4.0/js/binary/decoder.js
@@ -47,7 +47,6 @@ goog.provide('jspb.BinaryDecoder');
goog.provide('jspb.BinaryIterator');
goog.require('goog.asserts');
-goog.require('goog.crypt');
goog.require('jspb.utils');
@@ -58,7 +57,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 +91,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 +111,7 @@ jspb.BinaryIterator.prototype.init_ =
/**
* Global pool of BinaryIterator instances.
- * @private {!Array<!jspb.BinaryIterator>}
+ * @private {!Array.<!jspb.BinaryIterator>}
*/
jspb.BinaryIterator.instanceCache_ = [];
@@ -123,7 +122,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 +273,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_ = [];
@@ -583,24 +582,27 @@ jspb.BinaryDecoder.prototype.readUnsignedVarint32 = function() {
x |= (temp & 0x0F) << 28;
if (temp < 128) {
// We're reading the high bits of an unsigned varint. The byte we just read
- // also contains bits 33 through 35, which we're going to discard.
+ // also contains bits 33 through 35, which we're going to discard. Those
+ // bits _must_ be zero, or the encoding is invalid.
+ goog.asserts.assert((temp & 0xF0) == 0);
this.cursor_ += 5;
goog.asserts.assert(this.cursor_ <= this.end_);
return x >>> 0;
}
- // If we get here, we need to truncate coming bytes. However we need to make
- // sure cursor place is correct.
- this.cursor_ += 5;
- if (bytes[this.cursor_++] >= 128 &&
- bytes[this.cursor_++] >= 128 &&
- bytes[this.cursor_++] >= 128 &&
- bytes[this.cursor_++] >= 128 &&
- bytes[this.cursor_++] >= 128) {
- // If we get here, the varint is too long.
- goog.asserts.assert(false);
- }
+ // If we get here, we're reading the sign extension of a negative 32-bit int.
+ // We can skip these bytes, as we know in advance that they have to be all
+ // 1's if the varint is correctly encoded. Since we also know the value is
+ // negative, we don't have to coerce it to unsigned before we return it.
+
+ goog.asserts.assert((temp & 0xF0) == 0xF0);
+ goog.asserts.assert(bytes[this.cursor_ + 5] == 0xFF);
+ goog.asserts.assert(bytes[this.cursor_ + 6] == 0xFF);
+ goog.asserts.assert(bytes[this.cursor_ + 7] == 0xFF);
+ goog.asserts.assert(bytes[this.cursor_ + 8] == 0xFF);
+ goog.asserts.assert(bytes[this.cursor_ + 9] == 0x01);
+ this.cursor_ += 10;
goog.asserts.assert(this.cursor_ <= this.end_);
return x;
};
@@ -986,7 +988,7 @@ jspb.BinaryDecoder.prototype.readString = function(length) {
codeUnits.push(high, low);
}
- // Avoid exceeding the maximum stack size when calling `apply`.
+ // Avoid exceeding the maximum stack size when calling {@code apply}.
if (codeUnits.length >= 8192) {
result += String.fromCharCode.apply(null, codeUnits);
codeUnits.length = 0;
diff --git a/third_party/protobuf/3.6.0/js/binary/decoder_test.js b/third_party/protobuf/3.4.0/js/binary/decoder_test.js
index b19e1d1b27..d0139e293a 100644
--- a/third_party/protobuf/3.6.0/js/binary/decoder_test.js
+++ b/third_party/protobuf/3.4.0/js/binary/decoder_test.js
@@ -270,7 +270,24 @@ describe('binaryDecoderTest', function() {
assertThrows(function() {decoder.readSignedVarint64()});
decoder.reset();
assertThrows(function() {decoder.readZigzagVarint64()});
- decoder.reset();
+
+ // Positive 32-bit varints encoded with 1 bits in positions 33 through 35
+ // should trigger assertions.
+ decoder.setBlock([255, 255, 255, 255, 0x1F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 0x2F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 0x4F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ // Negative 32-bit varints encoded with non-1 bits in the high dword should
+ // trigger assertions.
+ decoder.setBlock([255, 255, 255, 255, 255, 255, 0, 255, 255, 1]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 255, 255, 255, 255, 255, 0]);
assertThrows(function() {decoder.readUnsignedVarint32()});
});
diff --git a/third_party/protobuf/3.6.0/js/binary/encoder.js b/third_party/protobuf/3.4.0/js/binary/encoder.js
index b2013f6340..8e9f5bbc34 100644
--- a/third_party/protobuf/3.6.0/js/binary/encoder.js
+++ b/third_party/protobuf/3.4.0/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/third_party/protobuf/3.6.0/js/binary/message_test.js b/third_party/protobuf/3.4.0/js/binary/message_test.js
index 4edc666b88..4edc666b88 100644
--- a/third_party/protobuf/3.6.0/js/binary/message_test.js
+++ b/third_party/protobuf/3.4.0/js/binary/message_test.js
diff --git a/third_party/protobuf/3.6.0/js/binary/proto_test.js b/third_party/protobuf/3.4.0/js/binary/proto_test.js
index f5e1b6bbf0..f5e1b6bbf0 100644
--- a/third_party/protobuf/3.6.0/js/binary/proto_test.js
+++ b/third_party/protobuf/3.4.0/js/binary/proto_test.js
diff --git a/third_party/protobuf/3.6.0/js/binary/reader.js b/third_party/protobuf/3.4.0/js/binary/reader.js
index 2dc3eb7026..d5d698f79d 100644
--- a/third_party/protobuf/3.6.0/js/binary/reader.js
+++ b/third_party/protobuf/3.4.0/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/third_party/protobuf/3.6.0/js/binary/reader_test.js b/third_party/protobuf/3.4.0/js/binary/reader_test.js
index 957113859e..957113859e 100644
--- a/third_party/protobuf/3.6.0/js/binary/reader_test.js
+++ b/third_party/protobuf/3.4.0/js/binary/reader_test.js
diff --git a/third_party/protobuf/3.6.0/js/binary/utils.js b/third_party/protobuf/3.4.0/js/binary/utils.js
index 55a9ccd4ce..58f11b54a5 100644
--- a/third_party/protobuf/3.6.0/js/binary/utils.js
+++ b/third_party/protobuf/3.4.0/js/binary/utils.js
@@ -38,7 +38,6 @@
goog.provide('jspb.utils');
goog.require('goog.asserts');
-goog.require('goog.crypt');
goog.require('goog.crypt.base64');
goog.require('goog.string');
goog.require('jspb.BinaryConstants');
@@ -431,7 +430,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 +553,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);
@@ -971,12 +970,8 @@ jspb.utils.byteSourceToUint8Array = function(data) {
return /** @type {!Uint8Array} */(new Uint8Array(data));
}
- if (data.constructor === Buffer) {
- return /** @type {!Uint8Array} */(new Uint8Array(data));
- }
-
if (data.constructor === Array) {
- data = /** @type {!Array<number>} */(data);
+ data = /** @type {!Array.<number>} */(data);
return /** @type {!Uint8Array} */(new Uint8Array(data));
}
diff --git a/third_party/protobuf/3.6.0/js/binary/utils_test.js b/third_party/protobuf/3.4.0/js/binary/utils_test.js
index 1345064470..0a2f4f0a2d 100644
--- a/third_party/protobuf/3.6.0/js/binary/utils_test.js
+++ b/third_party/protobuf/3.4.0/js/binary/utils_test.js
@@ -36,7 +36,6 @@
* @author aappleby@google.com (Austin Appleby)
*/
-goog.require('goog.crypt');
goog.require('goog.crypt.base64');
goog.require('goog.testing.asserts');
goog.require('jspb.BinaryConstants');
@@ -657,7 +656,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/third_party/protobuf/3.6.0/js/binary/writer.js b/third_party/protobuf/3.4.0/js/binary/writer.js
index 287d29c3f3..037e92b240 100644
--- a/third_party/protobuf/3.6.0/js/binary/writer.js
+++ b/third_party/protobuf/3.4.0/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) {
@@ -236,12 +236,10 @@ jspb.BinaryWriter.prototype.getResultBuffer = function() {
/**
* Converts the encoded data into a base64-encoded string.
- * @param {boolean=} opt_webSafe True indicates we should use a websafe
- * alphabet, which does not require escaping for use in URLs.
* @return {string}
*/
-jspb.BinaryWriter.prototype.getResultBase64String = function(opt_webSafe) {
- return goog.crypt.base64.encodeByteArray(this.getResultBuffer(), opt_webSafe);
+jspb.BinaryWriter.prototype.getResultBase64String = function() {
+ return goog.crypt.base64.encodeByteArray(this.getResultBuffer());
};
@@ -857,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;
@@ -871,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;
@@ -884,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;
@@ -898,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;
@@ -912,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;
@@ -926,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;
@@ -940,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;
@@ -954,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;
@@ -967,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;
@@ -980,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;
@@ -993,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;
@@ -1007,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;
@@ -1021,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;
@@ -1035,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) {
@@ -1049,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;
@@ -1062,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;
@@ -1076,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;
@@ -1089,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;
@@ -1102,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;
@@ -1115,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;
@@ -1128,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;
@@ -1141,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;
@@ -1154,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) {
@@ -1169,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.
@@ -1189,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.
@@ -1209,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) {
@@ -1224,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) {
@@ -1238,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;
@@ -1254,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;
@@ -1269,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;
@@ -1285,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;
@@ -1301,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;
@@ -1317,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) {
@@ -1333,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;
@@ -1349,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) {
@@ -1366,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;
@@ -1381,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;
@@ -1397,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;
@@ -1413,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;
@@ -1428,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;
@@ -1444,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;
@@ -1460,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;
@@ -1475,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;
@@ -1490,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;
@@ -1505,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;
@@ -1520,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;
@@ -1535,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;
@@ -1550,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;
@@ -1566,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;
@@ -1582,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/third_party/protobuf/3.6.0/js/binary/writer_test.js b/third_party/protobuf/3.4.0/js/binary/writer_test.js
index 8a9a1bb009..118eecfc6c 100644
--- a/third_party/protobuf/3.6.0/js/binary/writer_test.js
+++ b/third_party/protobuf/3.4.0/js/binary/writer_test.js
@@ -118,16 +118,4 @@ describe('binaryWriterTest', function() {
var buffer = writer.getResultBuffer();
assertEquals(expected, goog.crypt.byteArrayToHex(buffer));
});
-
-
- /**
- * Tests websafe encodings for base64 strings.
- */
- it('testWebSafeOption', function() {
- var writer = new jspb.BinaryWriter();
- writer.writeBytes(1, new Uint8Array([127]));
- assertEquals('CgF/', writer.getResultBase64String());
- assertEquals('CgF/', writer.getResultBase64String(false));
- assertEquals('CgF_', writer.getResultBase64String(true));
- });
});
diff --git a/third_party/protobuf/3.6.0/js/commonjs/export.js b/third_party/protobuf/3.4.0/js/commonjs/export.js
index a93ee928ff..a93ee928ff 100644
--- a/third_party/protobuf/3.6.0/js/commonjs/export.js
+++ b/third_party/protobuf/3.4.0/js/commonjs/export.js
diff --git a/third_party/protobuf/3.6.0/js/commonjs/export_asserts.js b/third_party/protobuf/3.4.0/js/commonjs/export_asserts.js
index ad9446c74a..ad9446c74a 100644
--- a/third_party/protobuf/3.6.0/js/commonjs/export_asserts.js
+++ b/third_party/protobuf/3.4.0/js/commonjs/export_asserts.js
diff --git a/third_party/protobuf/3.6.0/js/commonjs/export_testdeps.js b/third_party/protobuf/3.4.0/js/commonjs/export_testdeps.js
index 96d3f3470b..6f5cd0839b 100644
--- a/third_party/protobuf/3.6.0/js/commonjs/export_testdeps.js
+++ b/third_party/protobuf/3.4.0/js/commonjs/export_testdeps.js
@@ -12,7 +12,6 @@
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/third_party/protobuf/3.6.0/js/commonjs/import_test.js b/third_party/protobuf/3.4.0/js/commonjs/import_test.js
index ffa34fea61..ffa34fea61 100644
--- a/third_party/protobuf/3.6.0/js/commonjs/import_test.js
+++ b/third_party/protobuf/3.4.0/js/commonjs/import_test.js
diff --git a/third_party/protobuf/3.6.0/js/commonjs/jasmine.json b/third_party/protobuf/3.4.0/js/commonjs/jasmine.json
index 666b8edbf8..666b8edbf8 100644
--- a/third_party/protobuf/3.6.0/js/commonjs/jasmine.json
+++ b/third_party/protobuf/3.4.0/js/commonjs/jasmine.json
diff --git a/third_party/protobuf/3.6.0/js/commonjs/rewrite_tests_for_commonjs.js b/third_party/protobuf/3.4.0/js/commonjs/rewrite_tests_for_commonjs.js
index b6d90d287d..b6d90d287d 100644
--- a/third_party/protobuf/3.6.0/js/commonjs/rewrite_tests_for_commonjs.js
+++ b/third_party/protobuf/3.4.0/js/commonjs/rewrite_tests_for_commonjs.js
diff --git a/third_party/protobuf/3.6.0/js/commonjs/test6/test6.proto b/third_party/protobuf/3.4.0/js/commonjs/test6/test6.proto
index a060925f2d..a060925f2d 100644
--- a/third_party/protobuf/3.6.0/js/commonjs/test6/test6.proto
+++ b/third_party/protobuf/3.4.0/js/commonjs/test6/test6.proto
diff --git a/third_party/protobuf/3.6.0/js/commonjs/test7/test7.proto b/third_party/protobuf/3.4.0/js/commonjs/test7/test7.proto
index f5574a3dd3..f5574a3dd3 100644
--- a/third_party/protobuf/3.6.0/js/commonjs/test7/test7.proto
+++ b/third_party/protobuf/3.4.0/js/commonjs/test7/test7.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/arith_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/arith_test.js
index 89796bf795..89796bf795 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/arith_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/arith_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/decoder_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/decoder_test.js
index fce2fe181c..ac31264847 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/decoder_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/decoder_test.js
@@ -228,7 +228,24 @@ describe('binaryDecoderTest', function() {
assertThrows(function() {decoder.readSignedVarint64()});
decoder.reset();
assertThrows(function() {decoder.readZigzagVarint64()});
- decoder.reset();
+
+ // Positive 32-bit varints encoded with 1 bits in positions 33 through 35
+ // should trigger assertions.
+ decoder.setBlock([255, 255, 255, 255, 0x1F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 0x2F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 0x4F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ // Negative 32-bit varints encoded with non-1 bits in the high dword should
+ // trigger assertions.
+ decoder.setBlock([255, 255, 255, 255, 255, 255, 0, 255, 255, 1]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 255, 255, 255, 255, 255, 0]);
assertThrows(function() {decoder.readUnsignedVarint32()});
});
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/proto_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/proto_test.js
index 14d0f42e95..14d0f42e95 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/proto_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/proto_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/reader_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/reader_test.js
index 957113859e..957113859e 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/reader_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/reader_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/utils_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/utils_test.js
index d27e5ea2c6..d27e5ea2c6 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/utils_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/utils_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/writer_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/writer_test.js
index d5dadb4135..d5dadb4135 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/binary/writer_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/binary/writer_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/export_asserts.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/export_asserts.js
index 5219d120c1..5219d120c1 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/export_asserts.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/export_asserts.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js
index 59c77ca2cd..59c77ca2cd 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/import_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/import_test.js
index ffa34fea61..ffa34fea61 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/import_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/import_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/jasmine.json b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/jasmine.json
index 666b8edbf8..666b8edbf8 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/jasmine.json
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/jasmine.json
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js
index b6d90d287d..b6d90d287d 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto
index a060925f2d..a060925f2d 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto
index f5574a3dd3..f5574a3dd3 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/data.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/data.proto
index 74a8a994c7..74a8a994c7 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/data.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/data.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/debug_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/debug_test.js
index 01cbf891ab..01cbf891ab 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/debug_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/debug_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine1.json b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine1.json
index 6653c01cc7..6653c01cc7 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine1.json
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine1.json
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine2.json b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine2.json
index 3208078f7e..3208078f7e 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine2.json
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine2.json
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine3.json b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine3.json
index 3fb9a1b01d..3fb9a1b01d 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/jasmine3.json
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/jasmine3.json
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/message_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/message_test.js
index b779143115..b779143115 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/message_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/message_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/proto3_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/proto3_test.js
index fab0fd44ff..fab0fd44ff 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/proto3_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/proto3_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/proto3_test.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/proto3_test.proto
index acb6716492..acb6716492 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/proto3_test.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/proto3_test.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test.proto
index 937ffb89ce..937ffb89ce 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test.sh b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test.sh
index 9d58f30ac3..9d58f30ac3 100644..100755
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test.sh
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test.sh
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test2.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test2.proto
index 44e55effcb..44e55effcb 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test2.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test2.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test3.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test3.proto
index 940a552ed5..940a552ed5 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test3.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test3.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test4.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test4.proto
index cf2451e9cb..cf2451e9cb 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test4.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test4.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test5.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test5.proto
index 34979517e5..34979517e5 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/test5.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/test5.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/testbinary.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/testbinary.proto
index 116f17fb50..116f17fb50 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/testbinary.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/testbinary.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/testempty.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/testempty.proto
index 960bce4e5c..960bce4e5c 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.0.0/testempty.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.0.0/testempty.proto
diff --git a/third_party/protobuf/3.6.0/js/binary/arith_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/arith_test.js
index dd5791a7bb..89796bf795 100644
--- a/third_party/protobuf/3.6.0/js/binary/arith_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/arith_test.js
@@ -36,6 +36,7 @@
* @author cfallin@google.com (Chris Fallin)
*/
+goog.require('goog.testing.asserts');
goog.require('jspb.arith.Int64');
goog.require('jspb.arith.UInt64');
@@ -47,30 +48,30 @@ describe('binaryArithTest', function() {
it('testCompare', function() {
var a = new jspb.arith.UInt64(1234, 5678);
var b = new jspb.arith.UInt64(1234, 5678);
- expect(a.cmp(b)).toEqual(0);
- expect(b.cmp(a)).toEqual(0);
+ assertEquals(a.cmp(b), 0);
+ assertEquals(b.cmp(a), 0);
b.lo -= 1;
- expect(a.cmp(b)).toEqual(1);
- expect(b.cmp(a)).toEqual(-1);
+ assertEquals(a.cmp(b), 1);
+ assertEquals(b.cmp(a), -1);
b.lo += 2;
- expect(a.cmp(b)).toEqual(-1);
- expect(b.cmp(a)).toEqual(1);
+ assertEquals(a.cmp(b), -1);
+ assertEquals(b.cmp(a), 1);
b.lo = a.lo;
b.hi = a.hi - 1;
- expect(a.cmp(b)).toEqual(1);
- expect(b.cmp(a)).toEqual(-1);
+ assertEquals(a.cmp(b), 1);
+ assertEquals(b.cmp(a), -1);
- expect(a.zero()).toEqual(false);
- expect(a.msb()).toEqual(false);
- expect(a.lsb()).toEqual(false);
+ assertEquals(a.zero(), false);
+ assertEquals(a.msb(), false);
+ assertEquals(a.lsb(), false);
a.hi = 0;
a.lo = 0;
- expect(a.zero()).toEqual(true);
+ assertEquals(a.zero(), true);
a.hi = 0x80000000;
- expect(a.zero()).toEqual(false);
- expect(a.msb()).toEqual(true);
+ assertEquals(a.zero(), false);
+ assertEquals(a.msb(), true);
a.lo = 0x00000001;
- expect(a.lsb()).toEqual(true);
+ assertEquals(a.lsb(), true);
});
@@ -79,35 +80,35 @@ describe('binaryArithTest', function() {
*/
it('testShifts', function() {
var a = new jspb.arith.UInt64(1, 0);
- expect(a.lo).toEqual(1);
- expect(a.hi).toEqual(0);
+ assertEquals(a.lo, 1);
+ assertEquals(a.hi, 0);
var orig = a;
a = a.leftShift();
- expect(orig.lo).toEqual(1); // original unmodified.
- expect(orig.hi).toEqual(0);
- expect(a.lo).toEqual(2);
- expect(a.hi).toEqual(0);
+ assertEquals(orig.lo, 1); // original unmodified.
+ assertEquals(orig.hi, 0);
+ assertEquals(a.lo, 2);
+ assertEquals(a.hi, 0);
a = a.leftShift();
- expect(a.lo).toEqual(4);
- expect(a.hi).toEqual(0);
+ assertEquals(a.lo, 4);
+ assertEquals(a.hi, 0);
for (var i = 0; i < 29; i++) {
a = a.leftShift();
}
- expect(a.lo).toEqual(0x80000000);
- expect(a.hi).toEqual(0);
+ assertEquals(a.lo, 0x80000000);
+ assertEquals(a.hi, 0);
a = a.leftShift();
- expect(a.lo).toEqual(0);
- expect(a.hi).toEqual(1);
+ assertEquals(a.lo, 0);
+ assertEquals(a.hi, 1);
a = a.leftShift();
- expect(a.lo).toEqual(0);
- expect(a.hi).toEqual(2);
+ assertEquals(a.lo, 0);
+ assertEquals(a.hi, 2);
a = a.rightShift();
a = a.rightShift();
- expect(a.lo).toEqual(0x80000000);
- expect(a.hi).toEqual(0);
+ assertEquals(a.lo, 0x80000000);
+ assertEquals(a.hi, 0);
a = a.rightShift();
- expect(a.lo).toEqual(0x40000000);
- expect(a.hi).toEqual(0);
+ assertEquals(a.lo, 0x40000000);
+ assertEquals(a.hi, 0);
});
@@ -121,12 +122,12 @@ describe('binaryArithTest', function() {
/* hi = */ 0x92fa2123);
// Addition with carry.
var c = a.add(b);
- expect(a.lo).toEqual(0x89abcdef); // originals unmodified.
- expect(a.hi).toEqual(0x01234567);
- expect(b.lo).toEqual(0xff52ab91);
- expect(b.hi).toEqual(0x92fa2123);
- expect(c.lo).toEqual(0x88fe7980);
- expect(c.hi).toEqual(0x941d668b);
+ assertEquals(a.lo, 0x89abcdef); // originals unmodified.
+ assertEquals(a.hi, 0x01234567);
+ assertEquals(b.lo, 0xff52ab91);
+ assertEquals(b.hi, 0x92fa2123);
+ assertEquals(c.lo, 0x88fe7980);
+ assertEquals(c.hi, 0x941d668b);
// Simple addition without carry.
a.lo = 2;
@@ -134,8 +135,8 @@ describe('binaryArithTest', function() {
b.lo = 3;
b.hi = 0;
c = a.add(b);
- expect(c.lo).toEqual(5);
- expect(c.hi).toEqual(0);
+ assertEquals(c.lo, 5);
+ assertEquals(c.hi, 0);
});
@@ -169,8 +170,8 @@ describe('binaryArithTest', function() {
var a = new jspb.arith.UInt64(loValues[i], hiValues[j]);
var b = new jspb.arith.UInt64(loValues[j], hiValues[i]);
var c = a.add(b).sub(b);
- expect(c.hi).toEqual(a.hi);
- expect(c.lo).toEqual(a.lo);
+ assertEquals(c.hi, a.hi);
+ assertEquals(c.lo, a.lo);
}
}
});
@@ -200,8 +201,8 @@ describe('binaryArithTest', function() {
var cLow = testData[i][2] >>> 0;
var cHigh = testData[i][3] >>> 0;
var c = jspb.arith.UInt64.mul32x32(a, b);
- expect(c.lo).toEqual(cLow);
- expect(c.hi).toEqual(cHigh);
+ assertEquals(c.lo, cLow);
+ assertEquals(c.hi, cHigh);
}
});
@@ -230,8 +231,8 @@ describe('binaryArithTest', function() {
for (var i = 0; i < testData.length; i++) {
var a = new jspb.arith.UInt64(testData[i][0], testData[i][1]);
var prod = a.mul(testData[i][2]);
- expect(prod.lo).toEqual(testData[i][3]);
- expect(prod.hi).toEqual(testData[i][4]);
+ assertEquals(prod.lo, testData[i][3]);
+ assertEquals(prod.hi, testData[i][4]);
}
});
@@ -273,9 +274,9 @@ describe('binaryArithTest', function() {
var result = a.div(testData[i][2]);
var quotient = result[0];
var remainder = result[1];
- expect(quotient.lo).toEqual(testData[i][3]);
- expect(quotient.hi).toEqual(testData[i][4]);
- expect(remainder.lo).toEqual(testData[i][5]);
+ assertEquals(quotient.lo, testData[i][3]);
+ assertEquals(quotient.hi, testData[i][4]);
+ assertEquals(remainder.lo, testData[i][5]);
}
});
@@ -310,9 +311,9 @@ describe('binaryArithTest', function() {
for (var i = 0; i < testData.length; i++) {
var a = new jspb.arith.UInt64(testData[i][0], testData[i][1]);
var roundtrip = jspb.arith.UInt64.fromString(a.toString());
- expect(roundtrip.lo).toEqual(a.lo);
- expect(roundtrip.hi).toEqual(a.hi);
- expect(a.toString()).toEqual(testData[i][2]);
+ assertEquals(roundtrip.lo, a.lo);
+ assertEquals(roundtrip.hi, a.hi);
+ assertEquals(a.toString(), testData[i][2]);
}
});
@@ -348,7 +349,7 @@ describe('binaryArithTest', function() {
for (var i = 0; i < testStrings.length; i++) {
var roundtrip =
jspb.arith.Int64.fromString(testStrings[i]).toString();
- expect(roundtrip).toEqual(testStrings[i]);
+ assertEquals(roundtrip, testStrings[i]);
}
});
});
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/decoder_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/decoder_test.js
index fce2fe181c..ac31264847 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/decoder_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/decoder_test.js
@@ -228,7 +228,24 @@ describe('binaryDecoderTest', function() {
assertThrows(function() {decoder.readSignedVarint64()});
decoder.reset();
assertThrows(function() {decoder.readZigzagVarint64()});
- decoder.reset();
+
+ // Positive 32-bit varints encoded with 1 bits in positions 33 through 35
+ // should trigger assertions.
+ decoder.setBlock([255, 255, 255, 255, 0x1F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 0x2F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 0x4F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ // Negative 32-bit varints encoded with non-1 bits in the high dword should
+ // trigger assertions.
+ decoder.setBlock([255, 255, 255, 255, 255, 255, 0, 255, 255, 1]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 255, 255, 255, 255, 255, 0]);
assertThrows(function() {decoder.readUnsignedVarint32()});
});
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/proto_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/proto_test.js
index 26e1d30f1c..26e1d30f1c 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/proto_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/proto_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/reader_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/reader_test.js
index 957113859e..957113859e 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/reader_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/reader_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/utils_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/utils_test.js
index d27e5ea2c6..d27e5ea2c6 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/utils_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/utils_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/writer_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/writer_test.js
index d5dadb4135..d5dadb4135 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/binary/writer_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/binary/writer_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto
index a060925f2d..a060925f2d 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto
index f5574a3dd3..f5574a3dd3 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/data.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/data.proto
index 74a8a994c7..74a8a994c7 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/data.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/data.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/debug_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/debug_test.js
index 702cc76e90..702cc76e90 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/debug_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/debug_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/maps_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/maps_test.js
index 0d442f4fd1..0d442f4fd1 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/maps_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/maps_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/message_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/message_test.js
index c1023784fa..b46e50d376 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/message_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/message_test.js
@@ -643,7 +643,12 @@ describe('Message test suite', function() {
it('testInitialization_emptyArray', function() {
var msg = new proto.jspb.test.HasExtensions([]);
- assertArrayEquals([], msg.toArray());
+ if (jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS) {
+ assertArrayEquals([], msg.toArray());
+ } else {
+ // Extension object is created past all regular fields.
+ assertArrayEquals([,,, {}], msg.toArray());
+ }
});
it('testInitialization_justExtensionObject', function() {
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/proto3_test.js b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/proto3_test.js
index 3c929effd5..3c929effd5 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/proto3_test.js
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/proto3_test.js
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/proto3_test.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/proto3_test.proto
index acb6716492..acb6716492 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/proto3_test.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/proto3_test.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test.proto
index 48cb37e112..48cb37e112 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test2.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test2.proto
index 44e55effcb..44e55effcb 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test2.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test2.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test3.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test3.proto
index 940a552ed5..940a552ed5 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test3.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test3.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test4.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test4.proto
index cf2451e9cb..cf2451e9cb 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test4.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test4.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test5.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test5.proto
index 34979517e5..34979517e5 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/test5.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/test5.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/testbinary.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/testbinary.proto
index 116f17fb50..116f17fb50 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/testbinary.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/testbinary.proto
diff --git a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/testempty.proto b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/testempty.proto
index 960bce4e5c..960bce4e5c 100644
--- a/third_party/protobuf/3.6.0/js/compatibility_tests/v3.1.0/testempty.proto
+++ b/third_party/protobuf/3.4.0/js/compatibility_tests/v3.1.0/testempty.proto
diff --git a/third_party/protobuf/3.6.0/js/data.proto b/third_party/protobuf/3.4.0/js/data.proto
index 74a8a994c7..74a8a994c7 100644
--- a/third_party/protobuf/3.6.0/js/data.proto
+++ b/third_party/protobuf/3.4.0/js/data.proto
diff --git a/third_party/protobuf/3.6.0/js/debug.js b/third_party/protobuf/3.4.0/js/debug.js
index ba51bbe01c..46b2485315 100644
--- a/third_party/protobuf/3.6.0/js/debug.js
+++ b/third_party/protobuf/3.4.0/js/debug.js
@@ -42,7 +42,7 @@ goog.require('jspb.Message');
/**
* Turns a proto into a human readable object that can i.e. be written to the
- * console: `console.log(jspb.debug.dump(myProto))`.
+ * console: {@code console.log(jspb.debug.dump(myProto))}.
* This function makes a best effort and may not work in all cases. It will not
* work in obfuscated and or optimized code.
* Use this in environments where {@see jspb.Message.prototype.toObject} is
@@ -74,22 +74,15 @@ 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/third_party/protobuf/3.6.0/js/debug_test.js b/third_party/protobuf/3.4.0/js/debug_test.js
index d0d646a5f8..702cc76e90 100644
--- a/third_party/protobuf/3.6.0/js/debug_test.js
+++ b/third_party/protobuf/3.4.0/js/debug_test.js
@@ -41,8 +41,6 @@ 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() {
@@ -76,15 +74,6 @@ 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/third_party/protobuf/3.6.0/js/gulpfile.js b/third_party/protobuf/3.4.0/js/gulpfile.js
index fc9559f934..fc9559f934 100644
--- a/third_party/protobuf/3.6.0/js/gulpfile.js
+++ b/third_party/protobuf/3.4.0/js/gulpfile.js
diff --git a/third_party/protobuf/3.6.0/js/jasmine.json b/third_party/protobuf/3.4.0/js/jasmine.json
index aeea72f857..aeea72f857 100644
--- a/third_party/protobuf/3.6.0/js/jasmine.json
+++ b/third_party/protobuf/3.4.0/js/jasmine.json
diff --git a/third_party/protobuf/3.6.0/js/map.js b/third_party/protobuf/3.4.0/js/map.js
index 2fb1483756..d423499f05 100644
--- a/third_party/protobuf/3.6.0/js/map.js
+++ b/third_party/protobuf/3.4.0/js/map.js
@@ -48,9 +48,9 @@ goog.forwardDeclare('jspb.BinaryWriter');
*
* @template K, V
*
- * @param {!Array<!Array<?>>} arr
+ * @param {!Array<!Array<!Object>>} arr
*
- * @param {?function(new:V, ?=)=} opt_valueCtor
+ * @param {?function(new:V)|function(new:V,?)=} opt_valueCtor
* The constructor for type V, if type V is a message type.
*
* @constructor
@@ -118,7 +118,7 @@ jspb.Map.prototype.toArray = function() {
strKeys.sort();
for (var i = 0; i < strKeys.length; i++) {
var entry = this.map_[strKeys[i]];
- var valueWrapper = /** @type {?jspb.Message} */ (entry.valueWrapper);
+ var valueWrapper = /** @type {!Object} */ (entry.valueWrapper);
if (valueWrapper) {
valueWrapper.toArray();
}
@@ -165,7 +165,7 @@ jspb.Map.prototype.toObject = function(includeInstance, valueToObject) {
*
* @template K, V
* @param {!Array<!Array<!Object>>} entries
- * @param {!function(new:V,?=)} valueCtor
+ * @param {!function(new:V)|function(new:V,?)} valueCtor
* The constructor for type V.
* @param {!function(!Object):V} valueFromObject
* The fromObject function for type V.
@@ -432,8 +432,7 @@ jspb.Map.prototype.serializeBinary = function(
valueWriterFn.call(writer, 2, this.wrapEntry_(entry),
opt_valueWriterCallback);
} else {
- /** @type {function(this:jspb.BinaryWriter,number,?)} */ (valueWriterFn)
- .call(writer, 2, entry.value);
+ valueWriterFn.call(writer, 2, entry.value);
}
writer.endSubMessage();
}
@@ -443,8 +442,7 @@ jspb.Map.prototype.serializeBinary = function(
/**
* Read one key/value message from the given BinaryReader. Compatible as the
* `reader` callback parameter to jspb.BinaryReader.readMessage, to be called
- * when a key/value pair submessage is encountered. If the Key is undefined,
- * we should default it to 0.
+ * when a key/value pair submessage is encountered.
* @template K, V
* @param {!jspb.Map} map
* @param {!jspb.BinaryReader} reader
@@ -458,17 +456,12 @@ jspb.Map.prototype.serializeBinary = function(
* readMessage, in which case the second callback arg form is used.
*
* @param {?function(V,!jspb.BinaryReader)=} opt_valueReaderCallback
- * The BinaryReader parsing callback for type V, if V is a message type
- *
- * @param {K=} opt_defaultKey
- * The default value for the type of map keys. Accepting map
- * entries with unset keys is required for maps to be backwards compatible
- * with the repeated message representation described here: goo.gl/zuoLAC
+ * The BinaryReader parsing callback for type V, if V is a message type.
*
*/
jspb.Map.deserializeBinary = function(map, reader, keyReaderFn, valueReaderFn,
- opt_valueReaderCallback, opt_defaultKey) {
- var key = opt_defaultKey;
+ opt_valueReaderCallback) {
+ var key = undefined;
var value = undefined;
while (reader.nextField()) {
@@ -476,20 +469,16 @@ jspb.Map.deserializeBinary = function(map, reader, keyReaderFn, valueReaderFn,
break;
}
var field = reader.getFieldNumber();
-
if (field == 1) {
// Key.
key = keyReaderFn.call(reader);
} else if (field == 2) {
// Value.
if (map.valueCtor_) {
- goog.asserts.assert(opt_valueReaderCallback);
value = new map.valueCtor_();
valueReaderFn.call(reader, value, opt_valueReaderCallback);
} else {
- value =
- (/** @type {function(this:jspb.BinaryReader):?} */ (valueReaderFn))
- .call(reader);
+ value = valueReaderFn.call(reader);
}
}
}
diff --git a/third_party/protobuf/3.6.0/js/maps_test.js b/third_party/protobuf/3.4.0/js/maps_test.js
index e496f446bd..e8dd2f219b 100644..100755
--- a/third_party/protobuf/3.6.0/js/maps_test.js
+++ b/third_party/protobuf/3.4.0/js/maps_test.js
@@ -35,11 +35,6 @@ goog.require('goog.userAgent');
goog.require('proto.jspb.test.MapValueEnum');
goog.require('proto.jspb.test.MapValueMessage');
goog.require('proto.jspb.test.TestMapFields');
-goog.require('proto.jspb.test.TestMapFieldsOptionalKeys');
-goog.require('proto.jspb.test.MapEntryOptionalKeysStringKey');
-goog.require('proto.jspb.test.MapEntryOptionalKeysInt32Key');
-goog.require('proto.jspb.test.MapEntryOptionalKeysInt64Key');
-goog.require('proto.jspb.test.MapEntryOptionalKeysBoolKey');
// CommonJS-LoadFromFile: test_pb proto.jspb.test
goog.require('proto.jspb.test.MapValueMessageNoBinary');
@@ -81,7 +76,7 @@ function toArray(iter) {
* Helper: generate test methods for this TestMapFields class.
* @param {?} msgInfo
* @param {?} submessageCtor
- * @param {string} suffix
+ * @param {!string} suffix
*/
function makeTests(msgInfo, submessageCtor, suffix) {
/**
@@ -265,39 +260,6 @@ function makeTests(msgInfo, submessageCtor, suffix) {
var decoded = msgInfo.deserializeBinary(serialized);
checkMapFields(decoded);
});
- /**
- * Tests deserialization of undefined map keys go to default values in binary format.
- */
- it('testMapDeserializationForUndefinedKeys', function() {
- var testMessageOptionalKeys = new proto.jspb.test.TestMapFieldsOptionalKeys();
- var mapEntryStringKey = new proto.jspb.test.MapEntryOptionalKeysStringKey();
- mapEntryStringKey.setValue("a");
- testMessageOptionalKeys.setMapStringString(mapEntryStringKey);
- var mapEntryInt32Key = new proto.jspb.test.MapEntryOptionalKeysInt32Key();
- mapEntryInt32Key.setValue("b");
- testMessageOptionalKeys.setMapInt32String(mapEntryInt32Key);
- var mapEntryInt64Key = new proto.jspb.test.MapEntryOptionalKeysInt64Key();
- mapEntryInt64Key.setValue("c");
- testMessageOptionalKeys.setMapInt64String(mapEntryInt64Key);
- var mapEntryBoolKey = new proto.jspb.test.MapEntryOptionalKeysBoolKey();
- mapEntryBoolKey.setValue("d");
- testMessageOptionalKeys.setMapBoolString(mapEntryBoolKey);
- var deserializedMessage = msgInfo.deserializeBinary(
- testMessageOptionalKeys.serializeBinary()
- );
- checkMapEquals(deserializedMessage.getMapStringStringMap(), [
- ['', 'a']
- ]);
- checkMapEquals(deserializedMessage.getMapInt32StringMap(), [
- [0, 'b']
- ]);
- checkMapEquals(deserializedMessage.getMapInt64StringMap(), [
- [0, 'c']
- ]);
- checkMapEquals(deserializedMessage.getMapBoolStringMap(), [
- [false, 'd']
- ]);
- });
}
diff --git a/third_party/protobuf/3.6.0/js/message.js b/third_party/protobuf/3.4.0/js/message.js
index 86d1829592..f7dcfa964e 100644
--- a/third_party/protobuf/3.6.0/js/message.js
+++ b/third_party/protobuf/3.4.0/js/message.js
@@ -205,14 +205,15 @@ 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.
+ * @define {boolean} Turning on this flag does NOT change the behavior of JSPB
+ * and only affects private internal state. It may, however, break some
+ * tests that use naive deeply-equals algorithms, because using a proto
+ * mutates its internal state.
+ * Projects are advised to turn this flag always on.
*/
-goog.define('jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS', true);
+goog.define('jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS', COMPILED);
+// TODO(b/19419436) Turn this on by default.
/**
@@ -277,13 +278,6 @@ 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}.
@@ -330,18 +324,6 @@ 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.
@@ -358,7 +340,7 @@ jspb.Message.getFieldNumber_ = function(msg, index) {
*/
jspb.Message.initialize = function(
msg, data, messageId, suggestedPivot, repeatedFields, opt_oneofFields) {
- msg.wrappers_ = null;
+ msg.wrappers_ = jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS ? null : {};
if (!data) {
data = messageId ? [messageId] : [];
}
@@ -371,24 +353,22 @@ 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];
if (fieldNumber < msg.pivot_) {
var index = jspb.Message.getIndex_(msg, fieldNumber);
- msg.array[index] =
- msg.array[index] || jspb.Message.EMPTY_LIST_SENTINEL_;
+ msg.array[index] = msg.array[index] ||
+ (jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS ?
+ jspb.Message.EMPTY_LIST_SENTINEL_ :
+ []);
} else {
jspb.Message.maybeInitEmptyExtensionObject_(msg);
- msg.extensionObject_[fieldNumber] = msg.extensionObject_[fieldNumber] ||
- jspb.Message.EMPTY_LIST_SENTINEL_;
+ msg.extensionObject_[fieldNumber] =
+ msg.extensionObject_[fieldNumber] ||
+ (jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS ?
+ jspb.Message.EMPTY_LIST_SENTINEL_ :
+ []);
}
}
}
@@ -396,9 +376,8 @@ 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.
- for (var i = 0; i < opt_oneofFields.length; i++) {
- jspb.Message.computeOneofCase(msg, opt_oneofFields[i]);
- }
+ goog.array.forEach(
+ opt_oneofFields, goog.partial(jspb.Message.computeOneofCase, msg));
}
};
@@ -449,7 +428,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_ = jspb.Message.getFieldNumber_(msg, foundIndex);
+ msg.pivot_ = foundIndex - msg.arrayIndexOffset_;
msg.extensionObject_ = obj;
return;
}
@@ -501,7 +480,8 @@ jspb.Message.toObjectList = function(field, toObjectFn, opt_includeInstance) {
// And not using it here to avoid a function call.
var result = [];
for (var i = 0; i < field.length; i++) {
- result[i] = toObjectFn.call(field[i], opt_includeInstance, field[i]);
+ result[i] = toObjectFn.call(field[i], opt_includeInstance,
+ /** @type {!jspb.Message} */ (field[i]));
}
return result;
};
@@ -534,11 +514,10 @@ jspb.Message.toObjectExtension = function(proto, obj, extensions,
} else {
if (fieldInfo.isRepeated) {
obj[name] = jspb.Message.toObjectList(
- /** @type {!Array<!jspb.Message>} */ (value),
+ /** @type {!Array<jspb.Message>} */ (value),
fieldInfo.toObjectFn, opt_includeInstance);
} else {
- obj[name] = fieldInfo.toObjectFn(
- opt_includeInstance, /** @type {!jspb.Message} */ (value));
+ obj[name] = fieldInfo.toObjectFn(opt_includeInstance, value);
}
}
}
@@ -911,111 +890,6 @@ jspb.Message.setField = function(msg, fieldNumber, value) {
/**
- * Sets the value of a non-extension integer field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
- * @param {number} fieldNumber The field number.
- * @param {number} value New value
- * @protected
- */
-jspb.Message.setProto3IntField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0);
-};
-
-
-/**
- * Sets the value of a non-extension integer, handled as string, field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
- * @param {number} fieldNumber The field number.
- * @param {number} value New value
- * @protected
- */
-jspb.Message.setProto3StringIntField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, '0');
-};
-
-/**
- * Sets the value of a non-extension floating point field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
- * @param {number} fieldNumber The field number.
- * @param {number} value New value
- * @protected
- */
-jspb.Message.setProto3FloatField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0.0);
-};
-
-
-/**
- * Sets the value of a non-extension boolean field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
- * @param {number} fieldNumber The field number.
- * @param {boolean} value New value
- * @protected
- */
-jspb.Message.setProto3BooleanField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, false);
-};
-
-
-/**
- * Sets the value of a non-extension String field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
- * @param {number} fieldNumber The field number.
- * @param {string} value New value
- * @protected
- */
-jspb.Message.setProto3StringField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, "");
-};
-
-
-/**
- * Sets the value of a non-extension Bytes field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
- * @param {number} fieldNumber The field number.
- * @param {!Uint8Array|string} value New value
- * @protected
- */
-jspb.Message.setProto3BytesField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, "");
-};
-
-
-/**
- * Sets the value of a non-extension enum field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
- * @param {number} fieldNumber The field number.
- * @param {number} value New value
- * @protected
- */
-jspb.Message.setProto3EnumField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0);
-};
-
-
-
-/**
- * Sets the value of a non-extension primitive field, with proto3 (non-nullable
- * primitives) semantics of ignoring values that are equal to the type's
- * default.
- * @template T
- * @param {!jspb.Message} msg A jspb proto.
- * @param {number} fieldNumber The field number.
- * @param {!Uint8Array|string|number|boolean|undefined} value New value
- * @param {!Uint8Array|string|number|boolean} defaultValue The default value.
- * @private
- */
-jspb.Message.setFieldIgnoringDefault_ = function(
- msg, fieldNumber, value, defaultValue) {
- if (value != defaultValue) {
- jspb.Message.setField(msg, fieldNumber, value);
- } else {
- msg.array[jspb.Message.getIndex_(msg, fieldNumber)] = null;
- }
-};
-
-
-/**
* Adds a value to a repeated, primitive field.
* @param {!jspb.Message} msg A jspb proto.
* @param {number} fieldNumber The field number.
@@ -1075,15 +949,14 @@ jspb.Message.computeOneofCase = function(msg, oneof) {
var oneofField;
var oneofValue;
- for (var i = 0; i < oneof.length; i++) {
- var fieldNumber = oneof[i];
+ goog.array.forEach(oneof, function(fieldNumber) {
var value = jspb.Message.getField(msg, fieldNumber);
- if (value != null) {
+ if (goog.isDefAndNotNull(value)) {
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
@@ -1274,7 +1147,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(
@@ -1351,7 +1224,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
*/
@@ -1414,7 +1287,7 @@ jspb.Message.prototype.setExtension = function(fieldInfo, value) {
if (fieldInfo.isMessageType()) {
self.wrappers_[fieldNumber] = value;
self.extensionObject_[fieldNumber] = goog.array.map(
- /** @type {!Array<!jspb.Message>} */ (value), function(msg) {
+ /** @type {Array<jspb.Message>} */ (value), function(msg) {
return msg.toArray();
});
} else {
@@ -1423,8 +1296,7 @@ jspb.Message.prototype.setExtension = function(fieldInfo, value) {
} else {
if (fieldInfo.isMessageType()) {
self.wrappers_[fieldNumber] = value;
- self.extensionObject_[fieldNumber] =
- value ? /** @type {!jspb.Message} */ (value).toArray() : value;
+ self.extensionObject_[fieldNumber] = value ? value.toArray() : value;
} else {
self.extensionObject_[fieldNumber] = value;
}
@@ -1526,15 +1398,9 @@ jspb.Message.compareFields = function(field1, field2) {
// If the fields are trivially equal, they're equal.
if (field1 == field2) return true;
+ // If the fields aren't trivially equal and one of them isn't an object,
+ // they can't possibly be equal.
if (!goog.isObject(field1) || !goog.isObject(field2)) {
- // NaN != NaN so we cover this case.
- if ((goog.isNumber(field1) && isNaN(field1)) ||
- (goog.isNumber(field2) && isNaN(field2))) {
- // One of the fields might be a string 'NaN'.
- return String(field1) == String(field2);
- }
- // If the fields aren't trivially equal and one of them isn't an object,
- // they can't possibly be equal.
return false;
}
@@ -1557,26 +1423,24 @@ jspb.Message.compareFields = function(field1, field2) {
// If they're both Arrays, compare them element by element except for the
// optional extension objects at the end, which we compare separately.
if (field1.constructor === Array) {
- var typedField1 = /** @type {!Array<?>} */ (field1);
- var typedField2 = /** @type {!Array<?>} */ (field2);
var extension1 = undefined;
var extension2 = undefined;
- var length = Math.max(typedField1.length, typedField2.length);
+ var length = Math.max(field1.length, field2.length);
for (var i = 0; i < length; i++) {
- var val1 = typedField1[i];
- var val2 = typedField2[i];
+ var val1 = field1[i];
+ var val2 = field2[i];
if (val1 && (val1.constructor == Object)) {
goog.asserts.assert(extension1 === undefined);
- goog.asserts.assert(i === typedField1.length - 1);
+ goog.asserts.assert(i === field1.length - 1);
extension1 = val1;
val1 = undefined;
}
if (val2 && (val2.constructor == Object)) {
goog.asserts.assert(extension2 === undefined);
- goog.asserts.assert(i === typedField2.length - 1);
+ goog.asserts.assert(i === field2.length - 1);
extension2 = val2;
val2 = undefined;
}
@@ -1699,13 +1563,8 @@ jspb.Message.clone_ = function(obj) {
var clonedArray = new Array(obj.length);
// Use array iteration where possible because it is faster than for-in.
for (var i = 0; i < obj.length; i++) {
- o = obj[i];
- if (o != null) {
- // NOTE:redundant null check existing for NTI compatibility.
- // see b/70515949
- clonedArray[i] = (typeof o == 'object') ?
- jspb.Message.clone_(goog.asserts.assert(o)) :
- o;
+ if ((o = obj[i]) != null) {
+ clonedArray[i] = typeof o == 'object' ? jspb.Message.clone_(o) : o;
}
}
return clonedArray;
@@ -1715,13 +1574,8 @@ jspb.Message.clone_ = function(obj) {
}
var clone = {};
for (var key in obj) {
- o = obj[key];
- if (o != null) {
- // NOTE:redundant null check existing for NTI compatibility.
- // see b/70515949
- clone[key] = (typeof o == 'object') ?
- jspb.Message.clone_(goog.asserts.assert(o)) :
- o;
+ if ((o = obj[key]) != null) {
+ clone[key] = typeof o == 'object' ? jspb.Message.clone_(o) : o;
}
}
return clone;
@@ -1737,9 +1591,6 @@ jspb.Message.registerMessageType = function(id, constructor) {
jspb.Message.registry_[id] = constructor;
// This is needed so we can later access messageId directly on the contructor,
// otherwise it is not available due to 'property collapsing' by the compiler.
- /**
- * @suppress {strictMissingProperties} messageId is not defined on Function
- */
constructor.messageId = id;
};
@@ -1760,11 +1611,7 @@ 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/third_party/protobuf/3.6.0/js/message_test.js b/third_party/protobuf/3.4.0/js/message_test.js
index 1be4109384..7d61dacbb3 100644
--- a/third_party/protobuf/3.6.0/js/message_test.js
+++ b/third_party/protobuf/3.4.0/js/message_test.js
@@ -34,7 +34,6 @@ goog.setTestOnly();
goog.require('goog.json');
goog.require('goog.string');
-goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.asserts');
goog.require('goog.userAgent');
@@ -86,16 +85,6 @@ 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([]);
@@ -418,18 +407,6 @@ describe('Message test suite', function() {
['hi',,, {100: [{200: 'a'}]}], ['hi', {100: [{200: 'a'}]}]));
});
- it('testEqualsNonFinite', function() {
- assertTrue(jspb.Message.compareFields(NaN, NaN));
- assertTrue(jspb.Message.compareFields(NaN, 'NaN'));
- assertTrue(jspb.Message.compareFields('NaN', NaN));
- assertTrue(jspb.Message.compareFields(Infinity, Infinity));
- assertTrue(jspb.Message.compareFields(Infinity, 'Infinity'));
- assertTrue(jspb.Message.compareFields('-Infinity', -Infinity));
- assertTrue(jspb.Message.compareFields([NaN], ['NaN']));
- assertFalse(jspb.Message.compareFields(undefined, NaN));
- assertFalse(jspb.Message.compareFields(NaN, undefined));
- });
-
it('testToMap', function() {
var p1 = new proto.jspb.test.Simple1(['k', ['v']]);
var p2 = new proto.jspb.test.Simple1(['k1', ['v1', 'v2']]);
diff --git a/third_party/protobuf/3.6.0/js/node_loader.js b/third_party/protobuf/3.4.0/js/node_loader.js
index 79211adda4..79211adda4 100644
--- a/third_party/protobuf/3.6.0/js/node_loader.js
+++ b/third_party/protobuf/3.4.0/js/node_loader.js
diff --git a/third_party/protobuf/3.6.0/js/package.json b/third_party/protobuf/3.4.0/js/package.json
index 325f2dcc58..c8b7538501 100644
--- a/third_party/protobuf/3.6.0/js/package.json
+++ b/third_party/protobuf/3.4.0/js/package.json
@@ -1,6 +1,6 @@
{
"name": "google-protobuf",
- "version": "3.6.0",
+ "version": "3.4.0",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [
diff --git a/third_party/protobuf/3.6.0/js/proto3_test.js b/third_party/protobuf/3.4.0/js/proto3_test.js
index 4aed88baab..81d6de2f5e 100644
--- a/third_party/protobuf/3.6.0/js/proto3_test.js
+++ b/third_party/protobuf/3.4.0/js/proto3_test.js
@@ -72,37 +72,6 @@ function bytesCompare(arr, expected) {
describe('proto3Test', function() {
-
- /**
- * Test default values don't affect equality test.
- */
- it('testEqualsProto3', function() {
- var msg1 = new proto.jspb.test.TestProto3();
- var msg2 = new proto.jspb.test.TestProto3();
- msg2.setOptionalString('');
-
- assertTrue(jspb.Message.equals(msg1, msg2));
- });
-
-
- /**
- * Test setting when a field has default semantics.
- */
- it('testSetProto3ToValueAndBackToDefault', function() {
- var msg = new proto.jspb.test.TestProto3();
-
- // Setting should work normally.
- msg.setOptionalString('optionalString');
- assertEquals(msg.getOptionalString(), 'optionalString');
-
- // Clearing should work too ...
- msg.setOptionalString('');
- assertEquals(msg.getOptionalString(), '');
-
- // ... and shouldn't affect the equality with a brand new message.
- assertTrue(jspb.Message.equals(msg, new proto.jspb.test.TestProto3()));
- });
-
/**
* Test defaults for proto3 message fields.
*/
@@ -256,65 +225,52 @@ describe('proto3Test', function() {
* Test that oneofs continue to have a notion of field presence.
*/
it('testOneofs', function() {
- // Default instance.
var msg = new proto.jspb.test.TestProto3();
+
assertEquals(msg.getOneofUint32(), 0);
assertEquals(msg.getOneofForeignMessage(), undefined);
assertEquals(msg.getOneofString(), '');
assertEquals(msg.getOneofBytes(), '');
-
assertFalse(msg.hasOneofUint32());
- assertFalse(msg.hasOneofForeignMessage());
assertFalse(msg.hasOneofString());
assertFalse(msg.hasOneofBytes());
- // Integer field.
msg.setOneofUint32(42);
assertEquals(msg.getOneofUint32(), 42);
assertEquals(msg.getOneofForeignMessage(), undefined);
assertEquals(msg.getOneofString(), '');
assertEquals(msg.getOneofBytes(), '');
-
assertTrue(msg.hasOneofUint32());
- assertFalse(msg.hasOneofForeignMessage());
assertFalse(msg.hasOneofString());
assertFalse(msg.hasOneofBytes());
- // Sub-message field.
+
var submsg = new proto.jspb.test.ForeignMessage();
msg.setOneofForeignMessage(submsg);
assertEquals(msg.getOneofUint32(), 0);
assertEquals(msg.getOneofForeignMessage(), submsg);
assertEquals(msg.getOneofString(), '');
assertEquals(msg.getOneofBytes(), '');
-
assertFalse(msg.hasOneofUint32());
- assertTrue(msg.hasOneofForeignMessage());
assertFalse(msg.hasOneofString());
assertFalse(msg.hasOneofBytes());
- // String field.
msg.setOneofString('hello');
assertEquals(msg.getOneofUint32(), 0);
assertEquals(msg.getOneofForeignMessage(), undefined);
assertEquals(msg.getOneofString(), 'hello');
assertEquals(msg.getOneofBytes(), '');
-
assertFalse(msg.hasOneofUint32());
- assertFalse(msg.hasOneofForeignMessage());
assertTrue(msg.hasOneofString());
assertFalse(msg.hasOneofBytes());
- // Bytes field.
msg.setOneofBytes(goog.crypt.base64.encodeString('\u00FF\u00FF'));
assertEquals(msg.getOneofUint32(), 0);
assertEquals(msg.getOneofForeignMessage(), undefined);
assertEquals(msg.getOneofString(), '');
assertEquals(msg.getOneofBytes_asB64(),
goog.crypt.base64.encodeString('\u00FF\u00FF'));
-
assertFalse(msg.hasOneofUint32());
- assertFalse(msg.hasOneofForeignMessage());
assertFalse(msg.hasOneofString());
assertTrue(msg.hasOneofBytes());
});
diff --git a/third_party/protobuf/3.6.0/js/proto3_test.proto b/third_party/protobuf/3.4.0/js/proto3_test.proto
index 0d073ea03e..0d073ea03e 100644
--- a/third_party/protobuf/3.6.0/js/proto3_test.proto
+++ b/third_party/protobuf/3.4.0/js/proto3_test.proto
diff --git a/third_party/protobuf/3.6.0/js/test.proto b/third_party/protobuf/3.4.0/js/test.proto
index 7c881c0dfd..7c881c0dfd 100644
--- a/third_party/protobuf/3.6.0/js/test.proto
+++ b/third_party/protobuf/3.4.0/js/test.proto
diff --git a/third_party/protobuf/3.6.0/js/test2.proto b/third_party/protobuf/3.4.0/js/test2.proto
index b67f93fa9e..b67f93fa9e 100644
--- a/third_party/protobuf/3.6.0/js/test2.proto
+++ b/third_party/protobuf/3.4.0/js/test2.proto
diff --git a/third_party/protobuf/3.6.0/js/test3.proto b/third_party/protobuf/3.4.0/js/test3.proto
index 940a552ed5..940a552ed5 100644
--- a/third_party/protobuf/3.6.0/js/test3.proto
+++ b/third_party/protobuf/3.4.0/js/test3.proto
diff --git a/third_party/protobuf/3.6.0/js/test4.proto b/third_party/protobuf/3.4.0/js/test4.proto
index cf2451e9cb..cf2451e9cb 100644
--- a/third_party/protobuf/3.6.0/js/test4.proto
+++ b/third_party/protobuf/3.4.0/js/test4.proto
diff --git a/third_party/protobuf/3.6.0/js/test5.proto b/third_party/protobuf/3.4.0/js/test5.proto
index 34979517e5..34979517e5 100644
--- a/third_party/protobuf/3.6.0/js/test5.proto
+++ b/third_party/protobuf/3.4.0/js/test5.proto
diff --git a/third_party/protobuf/3.6.0/js/test8.proto b/third_party/protobuf/3.4.0/js/test8.proto
index 2ae80dab67..2ae80dab67 100644
--- a/third_party/protobuf/3.6.0/js/test8.proto
+++ b/third_party/protobuf/3.4.0/js/test8.proto
diff --git a/third_party/protobuf/3.6.0/js/test_bootstrap.js b/third_party/protobuf/3.4.0/js/test_bootstrap.js
index 9d00a1c430..9d00a1c430 100644
--- a/third_party/protobuf/3.6.0/js/test_bootstrap.js
+++ b/third_party/protobuf/3.4.0/js/test_bootstrap.js
diff --git a/third_party/protobuf/3.6.0/js/testbinary.proto b/third_party/protobuf/3.4.0/js/testbinary.proto
index ed5bdfc68f..116f17fb50 100644
--- a/third_party/protobuf/3.6.0/js/testbinary.proto
+++ b/third_party/protobuf/3.4.0/js/testbinary.proto
@@ -201,38 +201,6 @@ message TestMapFields {
map<string, TestMapFields> map_string_testmapfields = 12;
}
-// These proto are 'mock map' entries to test the above map deserializing with
-// undefined keys. Make sure TestMapFieldsOptionalKeys is written to be
-// deserialized by TestMapFields
-message MapEntryOptionalKeysStringKey {
- optional string key = 1;
- optional string value = 2;
-}
-
-message MapEntryOptionalKeysInt32Key {
- optional int32 key = 1;
- optional string value = 2;
-}
-
-message MapEntryOptionalKeysInt64Key {
- optional int64 key = 1;
- optional string value = 2;
-}
-
-message MapEntryOptionalKeysBoolKey {
- optional bool key = 1;
- optional string value = 2;
-}
-
-message TestMapFieldsOptionalKeys {
- optional MapEntryOptionalKeysStringKey map_string_string = 1;
- optional MapEntryOptionalKeysInt32Key map_int32_string= 8;
- optional MapEntryOptionalKeysInt64Key map_int64_string = 9;
- optional MapEntryOptionalKeysBoolKey map_bool_string = 10;
-}
-
-// End mock-map entries
-
enum MapValueEnum {
MAP_VALUE_FOO = 0;
MAP_VALUE_BAR = 1;
diff --git a/third_party/protobuf/3.6.0/js/testempty.proto b/third_party/protobuf/3.4.0/js/testempty.proto
index 960bce4e5c..960bce4e5c 100644
--- a/third_party/protobuf/3.6.0/js/testempty.proto
+++ b/third_party/protobuf/3.4.0/js/testempty.proto
diff --git a/third_party/protobuf/3.6.0/kokoro/README.md b/third_party/protobuf/3.4.0/kokoro/README.md
index 0791c9253b..0791c9253b 100644
--- a/third_party/protobuf/3.6.0/kokoro/README.md
+++ b/third_party/protobuf/3.4.0/kokoro/README.md
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/build.sh b/third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/build.sh
index b8b57e358e..b8b57e358e 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/continuous.cfg
index 4289f6a715..4289f6a715 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/presubmit.cfg
index 4289f6a715..4289f6a715 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/cpp_distcheck/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/linux/cpp_distcheck/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/csharp/build.sh b/third_party/protobuf/3.4.0/kokoro/linux/csharp/build.sh
index de178b844d..de178b844d 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/linux/csharp/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/linux/csharp/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/csharp/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/linux/csharp/continuous.cfg
index 3d177670a9..3d177670a9 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/csharp/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/linux/csharp/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/csharp/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/linux/csharp/presubmit.cfg
index 3d177670a9..3d177670a9 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/csharp/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/linux/csharp/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/build.sh b/third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/build.sh
index b1ef27963f..b1ef27963f 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/continuous.cfg
index 4897f5c889..4897f5c889 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/presubmit.cfg
index 4897f5c889..4897f5c889 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_compatibility/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/linux/java_compatibility/presubmit.cfg
diff --git a/third_party/protobuf/3.4.0/kokoro/linux/prepare_build_linux_rc b/third_party/protobuf/3.4.0/kokoro/linux/prepare_build_linux_rc
new file mode 100644
index 0000000000..4c3f255dd5
--- /dev/null
+++ b/third_party/protobuf/3.4.0/kokoro/linux/prepare_build_linux_rc
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Source this rc script to prepare the environment for Linux builds
+
+# Set up dotnet
+sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
+sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
+sudo apt-get update
+sudo apt-get install -y dotnet-dev-1.0.4
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/build.sh b/third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/build.sh
index 041e65ffb6..041e65ffb6 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/continuous.cfg
index 4cf6bb077c..4cf6bb077c 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/presubmit.cfg
index 4cf6bb077c..4cf6bb077c 100644
--- a/third_party/protobuf/3.6.0/kokoro/linux/python_compatibility/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/linux/python_compatibility/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/cpp/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/cpp/build.sh
index bae2ebbc5f..bae2ebbc5f 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/cpp/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/cpp/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/cpp/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/cpp/continuous.cfg
index 4bea1cbbb1..4bea1cbbb1 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/cpp/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/cpp/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/cpp/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/cpp/presubmit.cfg
index 4bea1cbbb1..4bea1cbbb1 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/cpp/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/cpp/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/build.sh
index d729b63db1..d729b63db1 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/continuous.cfg
index 89441bcca0..89441bcca0 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/presubmit.cfg
index 89441bcca0..89441bcca0 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/cpp_distcheck/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/cpp_distcheck/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/javascript/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/javascript/build.sh
index 016832a32e..016832a32e 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/javascript/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/javascript/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/javascript/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/javascript/continuous.cfg
index b478cc1939..b478cc1939 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/javascript/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/javascript/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/javascript/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/javascript/presubmit.cfg
index b478cc1939..b478cc1939 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/javascript/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/javascript/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/jruby/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/jruby/build.sh
index c82eaebfbd..c82eaebfbd 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/jruby/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/jruby/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/jruby/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/jruby/continuous.cfg
index f1310fd349..f1310fd349 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/jruby/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/jruby/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/jruby/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/jruby/presubmit.cfg
index f1310fd349..f1310fd349 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/jruby/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/jruby/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/build.sh
index f96d2899d9..f96d2899d9 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/continuous.cfg
index 952874ed11..952874ed11 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/presubmit.cfg
index 952874ed11..952874ed11 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_cocoapods_integration/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_cocoapods_integration/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/build.sh
index 1055d72ecb..1055d72ecb 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/continuous.cfg
index 473d54554a..473d54554a 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/presubmit.cfg
index 473d54554a..473d54554a 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_debug/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_debug/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/build.sh
index 76ce3ba0b5..76ce3ba0b5 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/continuous.cfg
index 3cbfb685d8..3cbfb685d8 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/presubmit.cfg
index 3cbfb685d8..3cbfb685d8 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_ios_release/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_ios_release/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/build.sh
index 000be27460..000be27460 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/continuous.cfg
index 41bd46aa87..41bd46aa87 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/presubmit.cfg
index 41bd46aa87..41bd46aa87 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/objectivec_osx/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/objectivec_osx/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/build.sh
index 74878898fa..74878898fa 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/continuous.cfg
index ff345e9fc4..ff345e9fc4 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/presubmit.cfg
index ff345e9fc4..ff345e9fc4 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/php5.6_mac/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/php5.6_mac/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/build.sh
index e5a37e30ee..e5a37e30ee 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/continuous.cfg
index c2c1811920..c2c1811920 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/presubmit.cfg
index c2c1811920..c2c1811920 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/php7.0_mac/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/php7.0_mac/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/prepare_build_macos_rc b/third_party/protobuf/3.4.0/kokoro/macos/prepare_build_macos_rc
index fb975523a4..2b9f4df25f 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/prepare_build_macos_rc
+++ b/third_party/protobuf/3.4.0/kokoro/macos/prepare_build_macos_rc
@@ -5,7 +5,7 @@
##
# Select Xcode version
-export DEVELOPER_DIR=/Applications/Xcode_9.1.app/Contents/Developer
+export DEVELOPER_DIR=/Applications/Xcode_8.1.app/Contents/Developer
##
# Select C/C++ compilers
@@ -17,10 +17,8 @@ export CXX=g++
# Install Brew and core softwares
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-source $HOME/.rvm/scripts/rvm
brew tap homebrew/homebrew-php
-brew uninstall node icu4c
-brew install gflags gpg gpg2 node pcre php56 ruby
+brew install autoconf automake ccache cmake gflags gpg gpg2 libtool maven node pcre php56 ruby wget
##
# Install Tox
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/python/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/python/build.sh
index 6b17b95446..6b17b95446 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/python/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/python/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/python/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/python/continuous.cfg
index 0fc8b503e8..0fc8b503e8 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/python/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/python/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/python/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/python/presubmit.cfg
index 0fc8b503e8..0fc8b503e8 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/python/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/python/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/python_cpp/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/python_cpp/build.sh
index cb53def9d3..cb53def9d3 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/python_cpp/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/python_cpp/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/python_cpp/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/python_cpp/continuous.cfg
index 22f4a0e4c9..22f4a0e4c9 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/python_cpp/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/python_cpp/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/python_cpp/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/python_cpp/presubmit.cfg
index 22f4a0e4c9..22f4a0e4c9 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/python_cpp/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/python_cpp/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/ruby21/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/ruby21/build.sh
index 748ea65595..748ea65595 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/ruby21/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/ruby21/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/ruby21/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/ruby21/continuous.cfg
index 489796daf2..489796daf2 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/ruby21/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/ruby21/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/ruby21/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/ruby21/presubmit.cfg
index 489796daf2..489796daf2 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/ruby21/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/ruby21/presubmit.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/ruby22/build.sh b/third_party/protobuf/3.4.0/kokoro/macos/ruby22/build.sh
index 5c4de42952..5c4de42952 100644..100755
--- a/third_party/protobuf/3.6.0/kokoro/macos/ruby22/build.sh
+++ b/third_party/protobuf/3.4.0/kokoro/macos/ruby22/build.sh
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/ruby22/continuous.cfg b/third_party/protobuf/3.4.0/kokoro/macos/ruby22/continuous.cfg
index d27054417a..d27054417a 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/ruby22/continuous.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/ruby22/continuous.cfg
diff --git a/third_party/protobuf/3.6.0/kokoro/macos/ruby22/presubmit.cfg b/third_party/protobuf/3.4.0/kokoro/macos/ruby22/presubmit.cfg
index d27054417a..d27054417a 100644
--- a/third_party/protobuf/3.6.0/kokoro/macos/ruby22/presubmit.cfg
+++ b/third_party/protobuf/3.4.0/kokoro/macos/ruby22/presubmit.cfg
diff --git a/third_party/protobuf/3.4.0/libprotobuf_java.jar b/third_party/protobuf/3.4.0/libprotobuf_java.jar
new file mode 100755
index 0000000000..150f30eb57
--- /dev/null
+++ b/third_party/protobuf/3.4.0/libprotobuf_java.jar
Binary files differ
diff --git a/third_party/protobuf/3.4.0/libprotobuf_java_util.jar b/third_party/protobuf/3.4.0/libprotobuf_java_util.jar
new file mode 100755
index 0000000000..64d86434b2
--- /dev/null
+++ b/third_party/protobuf/3.4.0/libprotobuf_java_util.jar
Binary files differ
diff --git a/third_party/protobuf/3.6.0/m4/ac_system_extensions.m4 b/third_party/protobuf/3.4.0/m4/ac_system_extensions.m4
index 1ca2eeb1d8..1ca2eeb1d8 100644
--- a/third_party/protobuf/3.6.0/m4/ac_system_extensions.m4
+++ b/third_party/protobuf/3.4.0/m4/ac_system_extensions.m4
diff --git a/third_party/protobuf/3.6.0/m4/acx_check_suncc.m4 b/third_party/protobuf/3.4.0/m4/acx_check_suncc.m4
index 8bc0a890dc..8bc0a890dc 100644
--- a/third_party/protobuf/3.6.0/m4/acx_check_suncc.m4
+++ b/third_party/protobuf/3.4.0/m4/acx_check_suncc.m4
diff --git a/third_party/protobuf/3.4.0/m4/acx_pthread.m4 b/third_party/protobuf/3.4.0/m4/acx_pthread.m4
new file mode 100644
index 0000000000..89d42c7449
--- /dev/null
+++ b/third_party/protobuf/3.4.0/m4/acx_pthread.m4
@@ -0,0 +1,397 @@
+# This was retrieved from
+# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi
+# See also (perhaps for new versions?)
+# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi
+#
+# We've rewritten the inconsistency check code (from avahi), to work
+# more broadly. In particular, it no longer assumes ld accepts -zdefs.
+# This caused a restructing of the code, but the functionality has only
+# changed a little.
+
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl @summary figure out how to build C programs using POSIX threads
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl LIBS="$PTHREAD_LIBS $LIBS"
+dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
+dnl @version 2006-05-29
+dnl @license GPLWithACException
+dnl
+dnl Checks for GCC shared/pthread inconsistency based on work by
+dnl Marcin Owsiany <marcin@owsiany.pl>
+
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test x"$acx_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+ *solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
+ ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+ if test x"$acx_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [acx_pthread_ok=yes])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test "x$acx_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+ [attr_name=$attr; break])
+ done
+ AC_MSG_RESULT($attr_name)
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case "${host_cpu}-${host_os}" in
+ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ esac
+ AC_MSG_RESULT(${flag})
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+ else
+ PTHREAD_CC=$CC
+ fi
+
+ # The next part tries to detect GCC inconsistency with -shared on some
+ # architectures and systems. The problem is that in certain
+ # configurations, when -shared is specified, GCC "forgets" to
+ # internally use various flags which are still necessary.
+
+ #
+ # Prepare the flags
+ #
+ save_CFLAGS="$CFLAGS"
+ save_LIBS="$LIBS"
+ save_CC="$CC"
+
+ # Try with the flags determined by the earlier checks.
+ #
+ # -Wl,-z,defs forces link-time symbol resolution, so that the
+ # linking checks with -shared actually have any value
+ #
+ # FIXME: -fPIC is required for -shared on many architectures,
+ # so we specify it here, but the right way would probably be to
+ # properly detect whether it is actually required.
+ CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CC="$PTHREAD_CC"
+
+ # In order not to create several levels of indentation, we test
+ # the value of "$done" until we find the cure or run out of ideas.
+ done="no"
+
+ # First, make sure the CFLAGS we added are actually accepted by our
+ # compiler. If not (and OS X's ld, for instance, does not accept -z),
+ # then we can't do this test.
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
+ AC_TRY_LINK(,, , [done=yes])
+
+ if test "x$done" = xyes ; then
+ AC_MSG_RESULT([no])
+ else
+ AC_MSG_RESULT([yes])
+ fi
+ fi
+
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [done=yes])
+
+ if test "x$done" = xyes; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+
+ #
+ # Linux gcc on some architectures such as mips/mipsel forgets
+ # about -lpthread
+ #
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether -lpthread fixes that])
+ LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [done=yes])
+
+ if test "x$done" = xyes; then
+ AC_MSG_RESULT([yes])
+ PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+ #
+ # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
+ #
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether -lc_r fixes that])
+ LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [done=yes])
+
+ if test "x$done" = xyes; then
+ AC_MSG_RESULT([yes])
+ PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+ if test x"$done" = xno; then
+ # OK, we have run out of ideas
+ AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
+
+ # so it's not safe to assume that we may use pthreads
+ acx_pthread_ok=no
+ fi
+
+ AC_MSG_CHECKING([whether what we have so far is sufficient with -nostdlib])
+ CFLAGS="-nostdlib $CFLAGS"
+ # we need c with nostdlib
+ LIBS="$LIBS -lc"
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [done=yes],[done=no])
+
+ if test "x$done" = xyes; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether -lpthread saves the day])
+ LIBS="-lpthread $LIBS"
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [done=yes],[done=no])
+
+ if test "x$done" = xyes; then
+ AC_MSG_RESULT([yes])
+ PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries and -nostdlib])
+ fi
+ fi
+
+ CFLAGS="$save_CFLAGS"
+ LIBS="$save_LIBS"
+ CC="$save_CC"
+else
+ PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+ :
+else
+ acx_pthread_ok=no
+ $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD
diff --git a/third_party/protobuf/3.6.0/m4/ax_cxx_compile_stdcxx.m4 b/third_party/protobuf/3.4.0/m4/ax_cxx_compile_stdcxx.m4
index d3288e2fb2..d3288e2fb2 100644
--- a/third_party/protobuf/3.6.0/m4/ax_cxx_compile_stdcxx.m4
+++ b/third_party/protobuf/3.4.0/m4/ax_cxx_compile_stdcxx.m4
diff --git a/third_party/protobuf/3.6.0/m4/ax_prog_cc_for_build.m4 b/third_party/protobuf/3.4.0/m4/ax_prog_cc_for_build.m4
index 77fd346a79..77fd346a79 100644
--- a/third_party/protobuf/3.6.0/m4/ax_prog_cc_for_build.m4
+++ b/third_party/protobuf/3.4.0/m4/ax_prog_cc_for_build.m4
diff --git a/third_party/protobuf/3.6.0/m4/ax_prog_cxx_for_build.m4 b/third_party/protobuf/3.4.0/m4/ax_prog_cxx_for_build.m4
index 8cc0f73c0f..8cc0f73c0f 100644
--- a/third_party/protobuf/3.6.0/m4/ax_prog_cxx_for_build.m4
+++ b/third_party/protobuf/3.4.0/m4/ax_prog_cxx_for_build.m4
diff --git a/third_party/protobuf/3.6.0/m4/stl_hash.m4 b/third_party/protobuf/3.4.0/m4/stl_hash.m4
index d7def1af9b..d7def1af9b 100644
--- a/third_party/protobuf/3.6.0/m4/stl_hash.m4
+++ b/third_party/protobuf/3.4.0/m4/stl_hash.m4
diff --git a/third_party/protobuf/3.4.0/more_tests/Makefile b/third_party/protobuf/3.4.0/more_tests/Makefile
new file mode 100755
index 0000000000..286cf0f12c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/more_tests/Makefile
@@ -0,0 +1,41 @@
+# Additional tests to run before releasing a package.
+#
+# Run like:
+# make PACKAGE=/path/to/protobuf-VERSION.tar.gz
+#
+# Some of these tests require tools or make assumptions that may not be
+# available on end-user machines, so these cannot be part of "make check". For
+# example, we test that the headers compile with strict warning settings, but
+# since different compilers produce wildly different warnings we cannot assume
+# that this test will pass everywhere. If we ran it as part of "make check",
+# it could unnecessarily block users from running the real tests just because
+# their compiler produces some extra warnings that probably aren't a big deal.
+# So we run it separately.
+
+all: header_warning_test
+
+clean:
+ rm -rf src target header_warning_test.cc header_warning_test.o header_warning_test
+
+# Unpack the package into src, then install it into target.
+PACKAGE=protobuf.tar.gz
+
+src: $(PACKAGE)
+ tar zxvf $(PACKAGE)
+ mv `basename $(PACKAGE) .tar.gz` src
+
+target: src
+ (cd src && ./configure --prefix=$$PWD/../target --disable-shared)
+ (cd src && make -j4 check)
+ (cd src && make install)
+
+# Verify that headers produce no warnings even under strict settings.
+header_warning_test.cc: target
+ ( (cd target/include && find google/protobuf -name '*.h') | \
+ awk '{print "#include \""$$1"\""} ' > header_warning_test.cc )
+
+header_warning_test: header_warning_test.cc
+ # TODO(kenton): Consider adding -pedantic and -Weffc++. Currently these
+ # produce tons of extra warnings so we'll need to do some work first.
+ g++ -Itarget/include -Wall -Werror -Wsign-compare -O2 -c header_warning_test.cc
+ touch header_warning_test
diff --git a/third_party/protobuf/3.6.0/objectivec/.gitignore b/third_party/protobuf/3.4.0/objectivec/.gitignore
index f786ffce82..f786ffce82 100644
--- a/third_party/protobuf/3.6.0/objectivec/.gitignore
+++ b/third_party/protobuf/3.4.0/objectivec/.gitignore
diff --git a/third_party/protobuf/3.6.0/objectivec/DevTools/check_version_stamps.sh b/third_party/protobuf/3.4.0/objectivec/DevTools/check_version_stamps.sh
index 1acbe2a2b7..1acbe2a2b7 100644..100755
--- a/third_party/protobuf/3.6.0/objectivec/DevTools/check_version_stamps.sh
+++ b/third_party/protobuf/3.4.0/objectivec/DevTools/check_version_stamps.sh
diff --git a/third_party/protobuf/3.6.0/objectivec/DevTools/compile_testing_protos.sh b/third_party/protobuf/3.4.0/objectivec/DevTools/compile_testing_protos.sh
index d7f3f60589..d7f3f60589 100644..100755
--- a/third_party/protobuf/3.6.0/objectivec/DevTools/compile_testing_protos.sh
+++ b/third_party/protobuf/3.4.0/objectivec/DevTools/compile_testing_protos.sh
diff --git a/third_party/protobuf/3.6.0/objectivec/DevTools/full_mac_build.sh b/third_party/protobuf/3.4.0/objectivec/DevTools/full_mac_build.sh
index c673fcba37..8fe750a09f 100644..100755
--- a/third_party/protobuf/3.6.0/objectivec/DevTools/full_mac_build.sh
+++ b/third_party/protobuf/3.4.0/objectivec/DevTools/full_mac_build.sh
@@ -54,7 +54,7 @@ EOF
header() {
echo ""
echo "========================================================================"
- echo " ${@}"
+ echo " $*"
echo "========================================================================"
}
@@ -206,9 +206,10 @@ else
wrapped_make -j "${NUM_MAKE_JOBS}" all
wrapped_make -j "${NUM_MAKE_JOBS}" check
# Fire off the conformance tests also.
- cd conformance
+ (
+ cd conformance || exit
wrapped_make -j "${NUM_MAKE_JOBS}" test_cpp
- cd ..
+ )
fi
# Ensure the WKT sources checked in are current.
@@ -244,7 +245,8 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
exit 10
;;
7.* )
- echo "ERROR: Xcode 7.x no longer supported for building, please use 8.0 or higher." 1>&2
+ echo "ERROR: The unittests include Swift code that is now Swift 3.0." 1>&2
+ echo "ERROR: Xcode 8.0 or higher is required to build the test suite, but the library works with Xcode 7.x." 1>&2
exit 11
;;
8.0* )
@@ -252,36 +254,36 @@ 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-3]* )
+ 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=latest" # 64bit
+ -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
)
;;
- 9.[0-2]* )
+ 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=latest" # 64bit
- # 9.0-9.2 all seem to often fail running destinations in parallel
- -disable-concurrent-testing
+ -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
)
;;
- 9.3* )
+ 8.3* )
XCODEBUILD_TEST_BASE_IOS+=(
- # Xcode 9.3 chokes targeting iOS 8.x - http://www.openradar.me/39335367
- -destination "platform=iOS Simulator,name=iPhone 4s,OS=9.0" # 32bit
- -destination "platform=iOS Simulator,name=iPhone 7,OS=latest" # 64bit
- # 9.3 also seems to often fail running destinations in parallel
- -disable-concurrent-testing
+ -destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
+ -destination "platform=iOS Simulator,name=iPhone 7,OS=10.3" # 64bit
+ -destination "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit
+ -destination "platform=iOS Simulator,name=iPad Pro (9.7 inch),OS=10.3" # 64bit
)
;;
* )
- echo ""
- echo "ATTENTION: Time to update the simulator targets for Xcode ${XCODE_VERSION}"
- echo ""
- echo "Build aborted!"
+ echo "Time to update the simulator targets for Xcode ${XCODE_VERSION}"
exit 2
;;
esac
@@ -294,7 +296,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 2> /dev/null || true
+ killall Simulator
fi
if [[ "${DO_XCODE_OSX_TESTS}" == "yes" ]] ; then
XCODEBUILD_TEST_BASE_OSX=(
@@ -330,7 +332,8 @@ fi
if [[ "${DO_OBJC_CONFORMANCE_TESTS}" == "yes" ]] ; then
header "Running ObjC Conformance Tests"
- cd conformance
+ (
+ cd conformance || exit
wrapped_make -j "${NUM_MAKE_JOBS}" test_objc
- cd ..
+ )
fi
diff --git a/third_party/protobuf/3.6.0/objectivec/DevTools/pddm.py b/third_party/protobuf/3.4.0/objectivec/DevTools/pddm.py
index 0b5b7b406d..9a11fec449 100644..100755
--- a/third_party/protobuf/3.6.0/objectivec/DevTools/pddm.py
+++ b/third_party/protobuf/3.4.0/objectivec/DevTools/pddm.py
@@ -124,7 +124,6 @@ def _MacroRefRe(macro_names):
return re.compile(r'\b(?P<macro_ref>(?P<name>(%s))\((?P<args>.*?)\))' %
'|'.join(macro_names))
-
def _MacroArgRefRe(macro_arg_names):
# Takes in a list of macro arg names and makes a regex that will match
# uses of those args.
@@ -319,26 +318,25 @@ class MacroCollection(object):
return macro.body
assert len(arg_values) == len(macro.args)
args = dict(zip(macro.args, arg_values))
-
def _lookupArg(match):
val = args[match.group('name')]
opt = match.group('option')
if opt:
- if opt == 'S': # Spaces for the length
+ if opt == 'S': # Spaces for the length
return ' ' * len(val)
- elif opt == 'l': # Lowercase first character
+ elif opt == 'l': # Lowercase first character
if val:
return val[0].lower() + val[1:]
else:
return val
- elif opt == 'L': # All Lowercase
+ elif opt == 'L': # All Lowercase
return val.lower()
- elif opt == 'u': # Uppercase first character
+ elif opt == 'u': # Uppercase first character
if val:
return val[0].upper() + val[1:]
else:
return val
- elif opt == 'U': # All Uppercase
+ elif opt == 'U': # All Uppercase
return val.upper()
else:
raise PDDMError('Unknown arg option "%s$%s" while expanding "%s".%s'
@@ -352,7 +350,6 @@ class MacroCollection(object):
def _EvalMacrosRefs(self, text, macro_stack):
macro_ref_re = _MacroRefRe(self._macros.keys())
-
def _resolveMacro(match):
return self._Expand(match, macro_stack)
return macro_ref_re.sub(_resolveMacro, text)
@@ -499,10 +496,9 @@ class SourceFile(object):
# Add the ending marker.
if len(captured_lines) == 1:
result.append('//%%PDDM-EXPAND-END %s' %
- captured_lines[0][directive_len:].strip())
+ captured_lines[0][directive_len:].strip())
else:
- result.append('//%%PDDM-EXPAND-END (%s expansions)' %
- len(captured_lines))
+ result.append('//%%PDDM-EXPAND-END (%s expansions)' % len(captured_lines))
return result
@@ -673,15 +669,15 @@ def main(args):
if src_file.processed_content != src_file.original_content:
if not opts.dry_run:
- print('Updating for "%s".' % a_path)
+ print 'Updating for "%s".' % a_path
with open(a_path, 'w') as f:
f.write(src_file.processed_content)
else:
# Special result to indicate things need updating.
- print('Update needed for "%s".' % a_path)
+ print 'Update needed for "%s".' % a_path
result = 1
elif opts.verbose:
- print('No update for "%s".' % a_path)
+ print 'No update for "%s".' % a_path
return result
diff --git a/third_party/protobuf/3.6.0/objectivec/DevTools/pddm_tests.py b/third_party/protobuf/3.4.0/objectivec/DevTools/pddm_tests.py
index 9ac6a85501..8a73b8427b 100644..100755
--- a/third_party/protobuf/3.6.0/objectivec/DevTools/pddm_tests.py
+++ b/third_party/protobuf/3.4.0/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! Test failed to catch recursion.')
+ self.fail('Should throw exception, entry %d' % idx)
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! Test failed to catch macro parsing error.')
+ self.fail('Should throw exception, entry %d' % idx)
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! Test failed to catch expand error.')
+ self.fail('Should throw exception, entry %d' % idx)
except pddm.PDDMError as e:
self.assertEqual(e.message,
'No macro named "foobar".\n'
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBArray.h b/third_party/protobuf/3.4.0/objectivec/GPBArray.h
index 638b2882d3..638b2882d3 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBArray.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBArray.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBArray.m b/third_party/protobuf/3.4.0/objectivec/GPBArray.m
index 122e0304b3..f401631d12 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBArray.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBArray.m
@@ -2537,12 +2537,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
return [_array countByEnumeratingWithState:state objects:buffer count:len];
}
-- (void)enumerateObjectsUsingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block {
[_array enumerateObjectsUsingBlock:block];
}
- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block {
[_array enumerateObjectsWithOptions:opts usingBlock:block];
}
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBArray_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBArray_PackagePrivate.h
index 35a4538131..35a4538131 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBArray_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBArray_PackagePrivate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBBootstrap.h b/third_party/protobuf/3.4.0/objectivec/GPBBootstrap.h
index ed53ae7cbc..ed53ae7cbc 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBBootstrap.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBBootstrap.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream.h b/third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream.h
index fbe5009c92..fbe5009c92 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream.m b/third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream.m
index dd05ddb48e..22859e7711 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream.m
@@ -63,15 +63,9 @@ static void RaiseException(NSInteger code, NSString *reason) {
NSDictionary *exceptionInfo =
@{ GPBCodedInputStreamUnderlyingErrorKey: error };
- [[NSException exceptionWithName:GPBCodedInputStreamException
- reason:reason
- userInfo:exceptionInfo] raise];
-}
-
-static void CheckRecursionLimit(GPBCodedInputStreamState *state) {
- if (state->recursionDepth >= kDefaultRecursionLimit) {
- RaiseException(GPBCodedInputStreamErrorRecursionDepthExceeded, nil);
- }
+ [[[NSException alloc] initWithName:GPBCodedInputStreamException
+ reason:reason
+ userInfo:exceptionInfo] raise];
}
static void CheckSize(GPBCodedInputStreamState *state, size_t size) {
@@ -105,12 +99,47 @@ static int64_t ReadRawLittleEndian64(GPBCodedInputStreamState *state) {
return value;
}
+static int32_t ReadRawVarint32(GPBCodedInputStreamState *state) {
+ int8_t tmp = ReadRawByte(state);
+ if (tmp >= 0) {
+ return tmp;
+ }
+ int32_t result = tmp & 0x7f;
+ if ((tmp = ReadRawByte(state)) >= 0) {
+ result |= tmp << 7;
+ } else {
+ result |= (tmp & 0x7f) << 7;
+ if ((tmp = ReadRawByte(state)) >= 0) {
+ result |= tmp << 14;
+ } else {
+ result |= (tmp & 0x7f) << 14;
+ if ((tmp = ReadRawByte(state)) >= 0) {
+ result |= tmp << 21;
+ } else {
+ result |= (tmp & 0x7f) << 21;
+ result |= (tmp = ReadRawByte(state)) << 28;
+ if (tmp < 0) {
+ // Discard upper 32 bits.
+ for (int i = 0; i < 5; i++) {
+ if (ReadRawByte(state) >= 0) {
+ return result;
+ }
+ }
+ RaiseException(GPBCodedInputStreamErrorInvalidVarInt,
+ @"Invalid VarInt32");
+ }
+ }
+ }
+ }
+ return result;
+}
+
static int64_t ReadRawVarint64(GPBCodedInputStreamState *state) {
int32_t shift = 0;
int64_t result = 0;
while (shift < 64) {
int8_t b = ReadRawByte(state);
- result |= (int64_t)((uint64_t)(b & 0x7F) << shift);
+ result |= (int64_t)(b & 0x7F) << shift;
if ((b & 0x80) == 0) {
return result;
}
@@ -120,10 +149,6 @@ static int64_t ReadRawVarint64(GPBCodedInputStreamState *state) {
return 0;
}
-static int32_t ReadRawVarint32(GPBCodedInputStreamState *state) {
- return (int32_t)ReadRawVarint64(state);
-}
-
static void SkipRawData(GPBCodedInputStreamState *state, size_t size) {
CheckSize(state, size);
state->bufferPos += size;
@@ -427,7 +452,9 @@ void GPBCodedInputStreamCheckLastTagWas(GPBCodedInputStreamState *state,
- (void)readGroup:(int32_t)fieldNumber
message:(GPBMessage *)message
extensionRegistry:(GPBExtensionRegistry *)extensionRegistry {
- CheckRecursionLimit(&state_);
+ if (state_.recursionDepth >= kDefaultRecursionLimit) {
+ RaiseException(GPBCodedInputStreamErrorRecursionDepthExceeded, nil);
+ }
++state_.recursionDepth;
[message mergeFromCodedInputStream:self extensionRegistry:extensionRegistry];
GPBCodedInputStreamCheckLastTagWas(
@@ -437,7 +464,9 @@ void GPBCodedInputStreamCheckLastTagWas(GPBCodedInputStreamState *state,
- (void)readUnknownGroup:(int32_t)fieldNumber
message:(GPBUnknownFieldSet *)message {
- CheckRecursionLimit(&state_);
+ if (state_.recursionDepth >= kDefaultRecursionLimit) {
+ RaiseException(GPBCodedInputStreamErrorRecursionDepthExceeded, nil);
+ }
++state_.recursionDepth;
[message mergeFromCodedInputStream:self];
GPBCodedInputStreamCheckLastTagWas(
@@ -447,8 +476,10 @@ void GPBCodedInputStreamCheckLastTagWas(GPBCodedInputStreamState *state,
- (void)readMessage:(GPBMessage *)message
extensionRegistry:(GPBExtensionRegistry *)extensionRegistry {
- CheckRecursionLimit(&state_);
int32_t length = ReadRawVarint32(&state_);
+ if (state_.recursionDepth >= kDefaultRecursionLimit) {
+ RaiseException(GPBCodedInputStreamErrorRecursionDepthExceeded, nil);
+ }
size_t oldLimit = GPBCodedInputStreamPushLimit(&state_, length);
++state_.recursionDepth;
[message mergeFromCodedInputStream:self extensionRegistry:extensionRegistry];
@@ -461,8 +492,10 @@ void GPBCodedInputStreamCheckLastTagWas(GPBCodedInputStreamState *state,
extensionRegistry:(GPBExtensionRegistry *)extensionRegistry
field:(GPBFieldDescriptor *)field
parentMessage:(GPBMessage *)parentMessage {
- CheckRecursionLimit(&state_);
int32_t length = ReadRawVarint32(&state_);
+ if (state_.recursionDepth >= kDefaultRecursionLimit) {
+ RaiseException(GPBCodedInputStreamErrorRecursionDepthExceeded, nil);
+ }
size_t oldLimit = GPBCodedInputStreamPushLimit(&state_, length);
++state_.recursionDepth;
GPBDictionaryReadEntry(mapDictionary, self, extensionRegistry, field,
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream_PackagePrivate.h
index 43ec6e79b2..90bd0c92ce 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBCodedInputStream_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBCodedInputStream_PackagePrivate.h
@@ -34,6 +34,8 @@
#import "GPBCodedInputStream.h"
+#import <libkern/OSAtomic.h>
+
@class GPBUnknownFieldSet;
@class GPBFieldDescriptor;
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream.h b/third_party/protobuf/3.4.0/objectivec/GPBCodedOutputStream.h
index 23c404b853..23c404b853 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBCodedOutputStream.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream.m b/third_party/protobuf/3.4.0/objectivec/GPBCodedOutputStream.m
index b846c2fc9d..c299040f0b 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream.m
+++ b/third_party/protobuf/3.4.0/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;
}
@@ -942,10 +942,7 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state,
state_.position = length;
} else {
// Write is very big. Let's do it all at once.
- NSInteger written = [state_.output write:((uint8_t *)value) + offset maxLength:length];
- if (written != (NSInteger)length) {
- [NSException raise:GPBCodedOutputStreamException_WriteFailed format:@""];
- }
+ [state_.output write:((uint8_t *)value) + offset maxLength:length];
}
}
}
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBCodedOutputStream_PackagePrivate.h
index 2e7bb4c4a2..2e7bb4c4a2 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBCodedOutputStream_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBCodedOutputStream_PackagePrivate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBDescriptor.h b/third_party/protobuf/3.4.0/objectivec/GPBDescriptor.h
index 651f4de08f..651f4de08f 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBDescriptor.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBDescriptor.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBDescriptor.m b/third_party/protobuf/3.4.0/objectivec/GPBDescriptor.m
index 4b39c63b36..0753a9485b 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBDescriptor.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBDescriptor.m
@@ -411,7 +411,7 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex,
}
- (NSString *)name {
- return (NSString * _Nonnull)@(name_);
+ return @(name_);
}
- (GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber {
@@ -548,8 +548,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
// descriptor structure.
const uint8_t *bytes = (const uint8_t *)defaultValue_.valueData;
if (bytes) {
- uint32_t length;
- memcpy(&length, bytes, sizeof(length));
+ uint32_t length = *((uint32_t *)bytes);
length = ntohl(length);
bytes += sizeof(length);
defaultValue_.valueData =
@@ -582,7 +581,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
}
- (NSString *)name {
- return (NSString * _Nonnull)@(description_->name);
+ return @(description_->name);
}
- (BOOL)isRequired {
@@ -964,8 +963,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
const uint8_t *bytes =
(const uint8_t *)description->defaultValue.valueData;
if (bytes) {
- uint32_t length;
- memcpy(&length, bytes, sizeof(length));
+ uint32_t length = *((uint32_t *)bytes);
// The length is stored in network byte order.
length = ntohl(length);
bytes += sizeof(length);
@@ -998,7 +996,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
}
- (NSString *)singletonName {
- return (NSString * _Nonnull)@(description_->singletonName);
+ return @(description_->singletonName);
}
- (const char *)singletonNameC {
@@ -1029,6 +1027,10 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
return GPBExtensionIsRepeated(description_);
}
+- (BOOL)isMap {
+ return (description_->options & GPBFieldMapKeyMask) != 0;
+}
+
- (BOOL)isPackable {
return GPBExtensionIsPacked(description_);
}
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBDescriptor_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBDescriptor_PackagePrivate.h
index 452b3f8e7e..452b3f8e7e 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBDescriptor_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBDescriptor_PackagePrivate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBDictionary.h b/third_party/protobuf/3.4.0/objectivec/GPBDictionary.h
index a81165e815..9d674150e3 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBDictionary.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBDictionary.h
@@ -60,6 +60,55 @@ 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.
@@ -155,6 +204,55 @@ 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.
@@ -250,6 +348,55 @@ 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.
@@ -345,6 +492,55 @@ 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.
@@ -440,6 +636,55 @@ 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.
@@ -535,6 +780,55 @@ 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.
@@ -630,6 +924,55 @@ 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.
@@ -727,6 +1070,70 @@ 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.
@@ -887,6 +1294,55 @@ 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.
@@ -981,6 +1437,55 @@ 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.
@@ -1076,6 +1581,55 @@ 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.
@@ -1171,6 +1725,55 @@ 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.
@@ -1266,6 +1869,55 @@ 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.
@@ -1361,6 +2013,55 @@ 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.
@@ -1456,6 +2157,55 @@ 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.
@@ -1551,6 +2301,55 @@ 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.
@@ -1648,6 +2447,70 @@ 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.
@@ -1808,6 +2671,55 @@ 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.
@@ -1902,6 +2814,55 @@ 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.
@@ -1997,6 +2958,55 @@ 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.
@@ -2092,6 +3102,55 @@ 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.
@@ -2187,6 +3246,55 @@ 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.
@@ -2282,6 +3390,55 @@ 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.
@@ -2377,6 +3534,55 @@ 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.
@@ -2472,6 +3678,55 @@ 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.
@@ -2569,6 +3824,70 @@ 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.
@@ -2729,6 +4048,55 @@ 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.
@@ -2823,6 +4191,55 @@ 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.
@@ -2918,6 +4335,55 @@ 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.
@@ -3013,6 +4479,55 @@ 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.
@@ -3108,6 +4623,55 @@ 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.
@@ -3203,6 +4767,55 @@ 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.
@@ -3298,6 +4911,55 @@ 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.
@@ -3393,6 +5055,55 @@ 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.
@@ -3490,6 +5201,70 @@ 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.
@@ -3650,6 +5425,55 @@ 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.
@@ -3744,6 +5568,55 @@ 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.
@@ -3839,6 +5712,55 @@ 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.
@@ -3934,6 +5856,55 @@ 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.
@@ -4029,6 +6000,55 @@ 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.
@@ -4124,6 +6144,55 @@ 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.
@@ -4219,6 +6288,55 @@ 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.
@@ -4314,6 +6432,55 @@ 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.
@@ -4411,6 +6578,70 @@ 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.
@@ -4571,6 +6802,55 @@ 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.
@@ -4665,6 +6945,55 @@ 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.
@@ -4760,6 +7089,55 @@ 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.
@@ -4855,6 +7233,55 @@ 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.
@@ -4950,6 +7377,55 @@ 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.
@@ -5045,6 +7521,55 @@ 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.
@@ -5140,6 +7665,55 @@ 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.
@@ -5235,6 +7809,55 @@ 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.
@@ -5332,6 +7955,70 @@ 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.
@@ -5553,6 +8240,55 @@ 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.
@@ -5617,6 +8353,70 @@ 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/third_party/protobuf/3.6.0/objectivec/GPBDictionary.m b/third_party/protobuf/3.4.0/objectivec/GPBDictionary.m
index cedf5e549d..7713376e3f 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBDictionary.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBDictionary.m
@@ -596,6 +596,39 @@ 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];
//%}
@@ -652,6 +685,54 @@ 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];
//%}
@@ -907,6 +988,39 @@ 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];
//%}
@@ -1435,6 +1549,39 @@ 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];
}
@@ -1618,6 +1765,39 @@ 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];
}
@@ -1801,6 +1981,39 @@ 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];
}
@@ -1984,6 +2197,39 @@ 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];
}
@@ -2167,6 +2413,39 @@ 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];
}
@@ -2350,6 +2629,39 @@ 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];
}
@@ -2533,6 +2845,39 @@ 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];
}
@@ -2719,6 +3064,54 @@ 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];
}
@@ -2968,6 +3361,39 @@ 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];
}
@@ -3183,6 +3609,39 @@ 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];
}
@@ -3366,6 +3825,39 @@ 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];
}
@@ -3549,6 +4041,39 @@ 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];
}
@@ -3732,6 +4257,39 @@ 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];
}
@@ -3915,6 +4473,39 @@ 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];
}
@@ -4098,6 +4689,39 @@ 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];
}
@@ -4281,6 +4905,39 @@ 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];
}
@@ -4467,6 +5124,54 @@ 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];
}
@@ -4716,6 +5421,39 @@ 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];
}
@@ -4931,6 +5669,39 @@ 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];
}
@@ -5114,6 +5885,39 @@ 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];
}
@@ -5297,6 +6101,39 @@ 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];
}
@@ -5480,6 +6317,39 @@ 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];
}
@@ -5663,6 +6533,39 @@ 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];
}
@@ -5846,6 +6749,39 @@ 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];
}
@@ -6029,6 +6965,39 @@ 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];
}
@@ -6215,6 +7184,54 @@ 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];
}
@@ -6464,6 +7481,39 @@ 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];
}
@@ -6679,6 +7729,39 @@ 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];
}
@@ -6862,6 +7945,39 @@ 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];
}
@@ -7045,6 +8161,39 @@ 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];
}
@@ -7228,6 +8377,39 @@ 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];
}
@@ -7411,6 +8593,39 @@ 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];
}
@@ -7594,6 +8809,39 @@ 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];
}
@@ -7777,6 +9025,39 @@ 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];
}
@@ -7963,6 +9244,54 @@ 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];
}
@@ -8212,6 +9541,39 @@ 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];
}
@@ -8427,6 +9789,39 @@ 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];
}
@@ -8618,6 +10013,39 @@ 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];
}
@@ -8809,6 +10237,39 @@ 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];
}
@@ -9000,6 +10461,39 @@ 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];
}
@@ -9191,6 +10685,39 @@ 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];
}
@@ -9382,6 +10909,39 @@ 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];
}
@@ -9573,6 +11133,39 @@ 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];
}
@@ -9767,6 +11360,54 @@ 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];
}
@@ -10035,6 +11676,39 @@ 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];
}
@@ -10244,6 +11918,39 @@ 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];
}
@@ -10453,6 +12160,39 @@ 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];
}
@@ -10662,6 +12402,39 @@ 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];
}
@@ -10871,6 +12644,39 @@ 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];
}
@@ -11080,6 +12886,39 @@ 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];
}
@@ -11289,6 +13128,39 @@ 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];
}
@@ -11497,6 +13369,39 @@ 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];
}
@@ -11730,6 +13635,54 @@ 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];
}
@@ -12102,14 +14055,14 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
}
-- (void)enumerateKeysAndObjectsUsingBlock:(void (NS_NOESCAPE ^)(id key,
+- (void)enumerateKeysAndObjectsUsingBlock:(void (^)(id key,
id obj,
BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:block];
}
- (void)enumerateKeysAndObjectsWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (NS_NOESCAPE ^)(id key,
+ usingBlock:(void (^)(id key,
id obj,
BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsWithOptions:opts usingBlock:block];
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBDictionary_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBDictionary_PackagePrivate.h
index 7b921e8ec7..7b921e8ec7 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBDictionary_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBDictionary_PackagePrivate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBExtensionInternals.h b/third_party/protobuf/3.4.0/objectivec/GPBExtensionInternals.h
index 2b980aefa4..2b980aefa4 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBExtensionInternals.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBExtensionInternals.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBExtensionInternals.m b/third_party/protobuf/3.4.0/objectivec/GPBExtensionInternals.m
index 290c82a1bb..290c82a1bb 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBExtensionInternals.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBExtensionInternals.m
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBExtensionRegistry.h b/third_party/protobuf/3.4.0/objectivec/GPBExtensionRegistry.h
index d79632d28b..d79632d28b 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBExtensionRegistry.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBExtensionRegistry.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBExtensionRegistry.m b/third_party/protobuf/3.4.0/objectivec/GPBExtensionRegistry.m
index b056a52d95..b056a52d95 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBExtensionRegistry.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBExtensionRegistry.m
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBMessage.h b/third_party/protobuf/3.4.0/objectivec/GPBMessage.h
index 276740d2f9..276740d2f9 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBMessage.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBMessage.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBMessage.m b/third_party/protobuf/3.4.0/objectivec/GPBMessage.m
index db5d3b60cd..37cff6ceff 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBMessage.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBMessage.m
@@ -32,7 +32,6 @@
#import <objc/runtime.h>
#import <objc/message.h>
-#import <stdatomic.h>
#import "GPBArray_PackagePrivate.h"
#import "GPBCodedInputStream_PackagePrivate.h"
@@ -78,20 +77,6 @@ static NSString *const kGPBDataCoderKey = @"GPBData";
GPBMessage *autocreator_;
GPBFieldDescriptor *autocreatorField_;
GPBExtensionDescriptor *autocreatorExtension_;
-
- // A lock to provide mutual exclusion from internal data that can be modified
- // by *read* operations such as getters (autocreation of message fields and
- // message extensions, not setting of values). Used to guarantee thread safety
- // for concurrent reads on the message.
- // NOTE: OSSpinLock may seem like a good fit here but Apple engineers have
- // pointed out that they are vulnerable to live locking on iOS in cases of
- // priority inversion:
- // http://mjtsai.com/blog/2015/12/16/osspinlock-is-unsafe/
- // https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000372.html
- // Use of readOnlySemaphore_ must be prefaced by a call to
- // GPBPrepareReadOnlySemaphore to ensure it has been created. This allows
- // readOnlySemaphore_ to be only created when actually needed.
- _Atomic(dispatch_semaphore_t) readOnlySemaphore_;
}
@end
@@ -757,22 +742,16 @@ void GPBClearMessageAutocreator(GPBMessage *self) {
void GPBPrepareReadOnlySemaphore(GPBMessage *self) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Create the semaphore on demand (rather than init) as developers might not cause them
// to be needed, and the heap usage can add up. The atomic swap is used to avoid needing
// another lock around creating it.
if (self->readOnlySemaphore_ == nil) {
dispatch_semaphore_t worker = dispatch_semaphore_create(1);
- dispatch_semaphore_t expected = nil;
- if (!atomic_compare_exchange_strong(&self->readOnlySemaphore_, &expected, worker)) {
+ if (!OSAtomicCompareAndSwapPtrBarrier(NULL, worker, (void * volatile *)&(self->readOnlySemaphore_))) {
dispatch_release(worker);
}
-#if defined(__clang_analyzer__)
- // The Xcode 9.2 (and 9.3 beta) static analyzer thinks worker is leaked
- // (doesn't seem to know about atomic_compare_exchange_strong); so just
- // for the analyzer, let it think worker is also released in this case.
- else { dispatch_release(worker); }
-#endif
}
#pragma clang diagnostic pop
@@ -990,8 +969,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
newValue = [value copyWithZone:zone];
}
} else {
- if ((field.mapKeyDataType == GPBDataTypeString) &&
- GPBFieldDataTypeIsObject(field)) {
+ if (field.mapKeyDataType == GPBDataTypeString) {
// NSDictionary
newValue = [value mutableCopyWithZone:zone];
} else {
@@ -2048,12 +2026,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
[newInput release];
} else {
GPBUnknownFieldSet *unknownFields = GetOrMakeUnknownFields(self);
- // rawBytes was created via a NoCopy, so it can be reusing a
- // subrange of another NSData that might go out of scope as things
- // unwind, so a copy is needed to ensure what is saved in the
- // unknown fields stays valid.
- NSData *cloned = [NSData dataWithData:rawBytes];
- [unknownFields mergeMessageSetMessage:typeId data:cloned];
+ [unknownFields mergeMessageSetMessage:typeId data:rawBytes];
}
}
}
@@ -2618,14 +2591,13 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
if (other == self) {
return YES;
}
- if (![other isKindOfClass:[GPBMessage class]]) {
+ if (![other isKindOfClass:[self class]] &&
+ ![self isKindOfClass:[other 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_;
@@ -3025,10 +2997,7 @@ typedef struct ResolveIvarAccessorMethodResult {
SEL encodingSelector;
} ResolveIvarAccessorMethodResult;
-// |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,
+static void ResolveIvarGet(GPBFieldDescriptor *field,
ResolveIvarAccessorMethodResult *result) {
GPBDataType fieldDataType = GPBGetFieldDataType(field);
switch (fieldDataType) {
@@ -3070,8 +3039,7 @@ static void ResolveIvarGet(__unsafe_unretained GPBFieldDescriptor *field,
}
}
-// See comment about __unsafe_unretained on ResolveIvarGet.
-static void ResolveIvarSet(__unsafe_unretained GPBFieldDescriptor *field,
+static void ResolveIvarSet(GPBFieldDescriptor *field,
GPBFileSyntax syntax,
ResolveIvarAccessorMethodResult *result) {
GPBDataType fieldDataType = GPBGetFieldDataType(field);
@@ -3115,10 +3083,9 @@ static void ResolveIvarSet(__unsafe_unretained 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};
- // See comment about __unsafe_unretained on ResolveIvarGet.
- for (__unsafe_unretained GPBFieldDescriptor *field in descriptor->fields_) {
+ ResolveIvarAccessorMethodResult result = {NULL, NULL};
+ for (GPBFieldDescriptor *field in descriptor->fields_) {
BOOL isMapOrArray = GPBFieldIsMapOrArray(field);
if (!isMapOrArray) {
// Single fields.
@@ -3286,32 +3253,4 @@ id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) {
return GetOrCreateMapIvarWithField(self, field, syntax);
}
-id GPBGetObjectIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) {
- NSCAssert(!GPBFieldIsMapOrArray(field), @"Shouldn't get here");
- if (GPBGetHasIvarField(self, field)) {
- uint8_t *storage = (uint8_t *)self->messageStorage_;
- id *typePtr = (id *)&storage[field->description_->offset];
- return *typePtr;
- }
- // Not set...
-
- // Non messages (string/data), get their default.
- if (!GPBFieldDataTypeIsMessage(field)) {
- return field.defaultValue.valueMessage;
- }
-
- GPBPrepareReadOnlySemaphore(self);
- dispatch_semaphore_wait(self->readOnlySemaphore_, DISPATCH_TIME_FOREVER);
- GPBMessage *result = GPBGetObjectIvarWithFieldNoAutocreate(self, field);
- if (!result) {
- // For non repeated messages, create the object, set it and return it.
- // This object will not initially be visible via GPBGetHasIvar, so
- // we save its creator so it can become visible if it's mutated later.
- result = GPBCreateMessageWithAutocreator(field.msgClass, self, field);
- GPBSetAutocreatedRetainedObjectIvarWithField(self, field, result);
- }
- dispatch_semaphore_signal(self->readOnlySemaphore_);
- return result;
-}
-
#pragma clang diagnostic pop
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBMessage_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBMessage_PackagePrivate.h
index ca10983b3c..90834d4073 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBMessage_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBMessage_PackagePrivate.h
@@ -34,10 +34,6 @@
#import "GPBMessage.h"
-// TODO: Remove this import. Older generated code use the OSAtomic* apis,
-// so anyone that hasn't regenerated says building by having this. After
-// enough time has passed, this likely can be removed as folks should have
-// regenerated.
#import <libkern/OSAtomic.h>
#import "GPBBootstrap.h"
@@ -61,6 +57,20 @@ typedef struct GPBMessage_Storage *GPBMessage_StoragePtr;
// GPBMessage_Storage with _has_storage__ as the first field.
// Kept public because static functions need to access it.
GPBMessage_StoragePtr messageStorage_;
+
+ // A lock to provide mutual exclusion from internal data that can be modified
+ // by *read* operations such as getters (autocreation of message fields and
+ // message extensions, not setting of values). Used to guarantee thread safety
+ // for concurrent reads on the message.
+ // NOTE: OSSpinLock may seem like a good fit here but Apple engineers have
+ // pointed out that they are vulnerable to live locking on iOS in cases of
+ // priority inversion:
+ // http://mjtsai.com/blog/2015/12/16/osspinlock-is-unsafe/
+ // https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000372.html
+ // Use of readOnlySemaphore_ must be prefaced by a call to
+ // GPBPrepareReadOnlySemaphore to ensure it has been created. This allows
+ // readOnlySemaphore_ to be only created when actually needed.
+ dispatch_semaphore_t readOnlySemaphore_;
}
// Gets an extension value without autocreating the result if not found. (i.e.
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers.h b/third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers.h
index 68d8854eb8..68d8854eb8 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers.m b/third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers.m
index d04c8be155..d04c8be155 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers.m
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers_RuntimeSupport.h b/third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers_RuntimeSupport.h
index 04dde620a2..fea75b93bc 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBProtocolBuffers_RuntimeSupport.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBProtocolBuffers_RuntimeSupport.h
@@ -31,7 +31,7 @@
// This header is meant to only be used by the generated source, it should not
// be included in code using protocol buffers.
-#import "GPBBootstrap.h"
+#import "GPBProtocolBuffers.h"
#import "GPBDescriptor_PackagePrivate.h"
#import "GPBExtensionInternals.h"
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBRootObject.h b/third_party/protobuf/3.4.0/objectivec/GPBRootObject.h
index d2e2aebfcc..d2e2aebfcc 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBRootObject.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBRootObject.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBRootObject.m b/third_party/protobuf/3.4.0/objectivec/GPBRootObject.m
index bad2f9a7a1..585d205a21 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBRootObject.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBRootObject.m
@@ -43,14 +43,6 @@
- (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/third_party/protobuf/3.6.0/objectivec/GPBRootObject_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBRootObject_PackagePrivate.h
index 3c8f09c896..3c8f09c896 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBRootObject_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBRootObject_PackagePrivate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBRuntimeTypes.h b/third_party/protobuf/3.4.0/objectivec/GPBRuntimeTypes.h
index 4d552060b0..4d552060b0 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBRuntimeTypes.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBRuntimeTypes.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBUnknownField.h b/third_party/protobuf/3.4.0/objectivec/GPBUnknownField.h
index 5b96023b16..5b96023b16 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUnknownField.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUnknownField.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBUnknownField.m b/third_party/protobuf/3.4.0/objectivec/GPBUnknownField.m
index 9d5c97f382..30efe7563b 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUnknownField.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUnknownField.m
@@ -79,7 +79,7 @@
result->mutableFixed32List_ = [mutableFixed32List_ copyWithZone:zone];
result->mutableFixed64List_ = [mutableFixed64List_ copyWithZone:zone];
result->mutableLengthDelimitedList_ =
- [mutableLengthDelimitedList_ mutableCopyWithZone:zone];
+ [mutableLengthDelimitedList_ copyWithZone:zone];
result->mutableVarintList_ = [mutableVarintList_ copyWithZone:zone];
if (mutableGroupList_.count) {
result->mutableGroupList_ = [[NSMutableArray allocWithZone:zone]
@@ -97,7 +97,6 @@
if (self == object) return YES;
if (![object isKindOfClass:[GPBUnknownField class]]) return NO;
GPBUnknownField *field = (GPBUnknownField *)object;
- if (number_ != field->number_) return NO;
BOOL equalVarint =
(mutableVarintList_.count == 0 && field->mutableVarintList_.count == 0) ||
[mutableVarintList_ isEqual:field->mutableVarintList_];
@@ -203,9 +202,8 @@
}
- (NSString *)description {
- NSMutableString *description =
- [NSMutableString stringWithFormat:@"<%@ %p>: Field: %d {\n",
- [self class], self, number_];
+ NSMutableString *description = [NSMutableString
+ stringWithFormat:@"<%@ %p>: Field: %d {\n", [self class], self, number_];
[mutableVarintList_
enumerateValuesWithBlock:^(uint64_t value, NSUInteger idx, BOOL *stop) {
#pragma unused(idx, stop)
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet.h b/third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet.h
index 1b5f24f392..1b5f24f392 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet.m b/third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet.m
index a7335f050b..a7335f050b 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet.m
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet_PackagePrivate.h
index e27127ad1d..e27127ad1d 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUnknownFieldSet_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUnknownFieldSet_PackagePrivate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBUnknownField_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBUnknownField_PackagePrivate.h
index 2b4c789513..2b4c789513 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUnknownField_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUnknownField_PackagePrivate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBUtilities.h b/third_party/protobuf/3.4.0/objectivec/GPBUtilities.h
index 5464dfb356..5464dfb356 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUtilities.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUtilities.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBUtilities.m b/third_party/protobuf/3.4.0/objectivec/GPBUtilities.m
index e2a12ca4d3..5029ec73b3 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUtilities.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUtilities.m
@@ -49,19 +49,6 @@ 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;
@@ -291,7 +278,7 @@ BOOL GPBGetHasIvar(GPBMessage *self, int32_t idx, uint32_t fieldNumber) {
} else {
NSCAssert(idx != GPBNoHasBit, @"Invalid has bit.");
uint32_t byteIndex = idx / 32;
- uint32_t bitMask = (1U << (idx % 32));
+ uint32_t bitMask = (1 << (idx % 32));
BOOL hasIvar =
(self->messageStorage_->_has_storage_[byteIndex] & bitMask) ? YES : NO;
return hasIvar;
@@ -315,7 +302,7 @@ void GPBSetHasIvar(GPBMessage *self, int32_t idx, uint32_t fieldNumber,
NSCAssert(idx != GPBNoHasBit, @"Invalid has bit.");
uint32_t *has_storage = self->messageStorage_->_has_storage_;
uint32_t byte = idx / 32;
- uint32_t bitMask = (1U << (idx % 32));
+ uint32_t bitMask = (1 << (idx % 32));
if (value) {
has_storage[byte] |= bitMask;
} else {
@@ -355,14 +342,6 @@ 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];
@@ -385,24 +364,14 @@ 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
@@ -422,14 +391,6 @@ 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);
//%}
//%
@@ -437,14 +398,6 @@ 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);
//%}
//%
@@ -502,7 +455,7 @@ void GPBSetRetainedObjectIvarWithFieldInternal(GPBMessage *self,
GPBDataType fieldType = GPBGetFieldDataType(field);
BOOL isMapOrArray = GPBFieldIsMapOrArray(field);
BOOL fieldIsMessage = GPBDataTypeIsMessage(fieldType);
-#if defined(DEBUG) && DEBUG
+#ifdef DEBUG
if (value == nil && !isMapOrArray && !fieldIsMessage &&
field.hasDefaultValue) {
// Setting a message to nil is an obvious way to "clear" the value
@@ -628,6 +581,34 @@ id GPBGetObjectIvarWithFieldNoAutocreate(GPBMessage *self,
return *typePtr;
}
+id GPBGetObjectIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) {
+ NSCAssert(!GPBFieldIsMapOrArray(field), @"Shouldn't get here");
+ if (GPBGetHasIvarField(self, field)) {
+ uint8_t *storage = (uint8_t *)self->messageStorage_;
+ id *typePtr = (id *)&storage[field->description_->offset];
+ return *typePtr;
+ }
+ // Not set...
+
+ // Non messages (string/data), get their default.
+ if (!GPBFieldDataTypeIsMessage(field)) {
+ return field.defaultValue.valueMessage;
+ }
+
+ GPBPrepareReadOnlySemaphore(self);
+ dispatch_semaphore_wait(self->readOnlySemaphore_, DISPATCH_TIME_FOREVER);
+ GPBMessage *result = GPBGetObjectIvarWithFieldNoAutocreate(self, field);
+ if (!result) {
+ // For non repeated messages, create the object, set it and return it.
+ // This object will not initially be visible via GPBGetHasIvar, so
+ // we save its creator so it can become visible if it's mutated later.
+ result = GPBCreateMessageWithAutocreator(field.msgClass, self, field);
+ GPBSetAutocreatedRetainedObjectIvarWithField(self, field, result);
+ }
+ dispatch_semaphore_signal(self->readOnlySemaphore_);
+ return result;
+}
+
// Only exists for public api, no core code should use this.
int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field) {
GPBFileSyntax syntax = [self descriptor].file.syntax;
@@ -637,13 +618,6 @@ 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.
@@ -664,13 +638,6 @@ 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
@@ -696,13 +663,6 @@ 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.
@@ -728,13 +688,6 @@ 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) {
@@ -761,14 +714,6 @@ 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];
@@ -791,24 +736,14 @@ 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
@@ -829,14 +764,6 @@ 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];
@@ -859,24 +786,14 @@ 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
@@ -897,14 +814,6 @@ 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];
@@ -927,24 +836,14 @@ 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
@@ -965,14 +864,6 @@ 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];
@@ -995,24 +886,14 @@ 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
@@ -1033,14 +914,6 @@ 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];
@@ -1063,24 +936,14 @@ 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
@@ -1101,14 +964,6 @@ 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];
@@ -1131,24 +986,14 @@ 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
@@ -1174,14 +1019,6 @@ 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);
}
@@ -1189,14 +1026,6 @@ 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);
}
@@ -1206,14 +1035,6 @@ 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);
}
@@ -1221,14 +1042,6 @@ 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);
}
@@ -1238,14 +1051,6 @@ 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);
}
@@ -1253,14 +1058,6 @@ 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);
}
@@ -1270,14 +1067,6 @@ 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);
}
@@ -1285,14 +1074,6 @@ 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);
}
@@ -1356,40 +1137,8 @@ void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id
GPBSetObjectIvarWithField(self, field, array);
}
-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) {
+#if defined(DEBUG) && DEBUG
+static NSString *TypeToStr(GPBDataType dataType) {
switch (dataType) {
case GPBDataTypeBool:
return @"Bool";
@@ -1417,9 +1166,10 @@ static NSString *TypeToString(GPBDataType dataType) {
case GPBDataTypeGroup:
return @"Object";
case GPBDataTypeEnum:
- return @"Enum";
+ return @"Bool";
}
}
+#endif
// GPBGetMessageMapField is defined in GPBMessage.m
@@ -1435,8 +1185,8 @@ void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field,
if (dictionary) {
GPBDataType keyDataType = field.mapKeyDataType;
GPBDataType valueDataType = GPBGetFieldDataType(field);
- NSString *keyStr = TypeToString(keyDataType);
- NSString *valueStr = TypeToString(valueDataType);
+ NSString *keyStr = TypeToStr(keyDataType);
+ NSString *valueStr = TypeToStr(valueDataType);
if (keyDataType == GPBDataTypeString) {
keyStr = @"String";
}
@@ -1466,11 +1216,8 @@ 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;
}
@@ -2164,3 +1911,13 @@ 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/third_party/protobuf/3.6.0/objectivec/GPBUtilities_PackagePrivate.h b/third_party/protobuf/3.4.0/objectivec/GPBUtilities_PackagePrivate.h
index ed424ce399..16859d4875 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBUtilities_PackagePrivate.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBUtilities_PackagePrivate.h
@@ -124,7 +124,7 @@ GPB_INLINE int64_t GPBDecodeZigZag64(uint64_t n) {
// thus always taking 10 bytes on the wire.)
GPB_INLINE uint32_t GPBEncodeZigZag32(int32_t n) {
// Note: the right-shift must be arithmetic
- return ((uint32_t)n << 1) ^ (uint32_t)(n >> 31);
+ return (uint32_t)((n << 1) ^ (n >> 31));
}
// Encode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers
@@ -133,7 +133,7 @@ GPB_INLINE uint32_t GPBEncodeZigZag32(int32_t n) {
// thus always taking 10 bytes on the wire.)
GPB_INLINE uint64_t GPBEncodeZigZag64(int64_t n) {
// Note: the right-shift must be arithmetic
- return ((uint64_t)n << 1) ^ (uint64_t)(n >> 63);
+ return (uint64_t)((n << 1) ^ (n >> 63));
}
#pragma clang diagnostic push
@@ -309,8 +309,7 @@ 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. GPBRootObject conforms to
-// the protocol so that it is encoded in the Objective C runtime.
+// GPBMessageEncodingForSelector for details.
@protocol GPBMessageSignatureProtocol
@optional
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBWellKnownTypes.h b/third_party/protobuf/3.4.0/objectivec/GPBWellKnownTypes.h
index 04df417889..04df417889 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBWellKnownTypes.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBWellKnownTypes.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBWellKnownTypes.m b/third_party/protobuf/3.4.0/objectivec/GPBWellKnownTypes.m
index 2808afeb23..2808afeb23 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBWellKnownTypes.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBWellKnownTypes.m
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBWireFormat.h b/third_party/protobuf/3.4.0/objectivec/GPBWireFormat.h
index c5941a3824..c5941a3824 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBWireFormat.h
+++ b/third_party/protobuf/3.4.0/objectivec/GPBWireFormat.h
diff --git a/third_party/protobuf/3.6.0/objectivec/GPBWireFormat.m b/third_party/protobuf/3.4.0/objectivec/GPBWireFormat.m
index 860a339f9a..860a339f9a 100644
--- a/third_party/protobuf/3.6.0/objectivec/GPBWireFormat.m
+++ b/third_party/protobuf/3.4.0/objectivec/GPBWireFormat.m
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
index a41be9f280..cd7fcc9e30 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
@@ -37,31 +37,6 @@
8BF8193514A0DDA600A2C982 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
F401DC2D1A8D444600FCC765 /* GPBArray.m in Sources */ = {isa = PBXBuildFile; fileRef = F401DC2B1A8D444600FCC765 /* GPBArray.m */; };
F401DC331A8E5C0200FCC765 /* GPBArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F401DC321A8E5C0200FCC765 /* GPBArrayTests.m */; };
- F40EE4AB206BF8B90071091A /* GPBCompileTest01.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE488206BF8B00071091A /* GPBCompileTest01.m */; };
- F40EE4AC206BF8B90071091A /* GPBCompileTest02.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE481206BF8AE0071091A /* GPBCompileTest02.m */; };
- F40EE4AD206BF8B90071091A /* GPBCompileTest03.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE491206BF8B10071091A /* GPBCompileTest03.m */; };
- F40EE4AE206BF8B90071091A /* GPBCompileTest04.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE47E206BF8AE0071091A /* GPBCompileTest04.m */; };
- F40EE4AF206BF8B90071091A /* GPBCompileTest05.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE47F206BF8AE0071091A /* GPBCompileTest05.m */; };
- F40EE4B0206BF8B90071091A /* GPBCompileTest06.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE492206BF8B10071091A /* GPBCompileTest06.m */; };
- F40EE4B1206BF8B90071091A /* GPBCompileTest07.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE480206BF8AE0071091A /* GPBCompileTest07.m */; };
- F40EE4B2206BF8B90071091A /* GPBCompileTest08.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE47D206BF8AD0071091A /* GPBCompileTest08.m */; };
- F40EE4B3206BF8B90071091A /* GPBCompileTest09.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE484206BF8AF0071091A /* GPBCompileTest09.m */; };
- F40EE4B4206BF8B90071091A /* GPBCompileTest10.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE48C206BF8B00071091A /* GPBCompileTest10.m */; };
- F40EE4B5206BF8B90071091A /* GPBCompileTest11.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE493206BF8B20071091A /* GPBCompileTest11.m */; };
- F40EE4B6206BF8B90071091A /* GPBCompileTest12.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE490206BF8B10071091A /* GPBCompileTest12.m */; };
- F40EE4B7206BF8B90071091A /* GPBCompileTest13.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE483206BF8AF0071091A /* GPBCompileTest13.m */; };
- F40EE4B8206BF8B90071091A /* GPBCompileTest14.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE48F206BF8B10071091A /* GPBCompileTest14.m */; };
- F40EE4B9206BF8B90071091A /* GPBCompileTest15.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE489206BF8B00071091A /* GPBCompileTest15.m */; };
- F40EE4BA206BF8B90071091A /* GPBCompileTest16.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE48B206BF8B00071091A /* GPBCompileTest16.m */; };
- F40EE4BB206BF8B90071091A /* GPBCompileTest17.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE48D206BF8B00071091A /* GPBCompileTest17.m */; };
- F40EE4BC206BF8B90071091A /* GPBCompileTest18.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE48E206BF8B10071091A /* GPBCompileTest18.m */; };
- F40EE4BD206BF8B90071091A /* GPBCompileTest19.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE482206BF8AF0071091A /* GPBCompileTest19.m */; };
- F40EE4BE206BF8B90071091A /* GPBCompileTest20.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE485206BF8AF0071091A /* GPBCompileTest20.m */; };
- F40EE4BF206BF8B90071091A /* GPBCompileTest21.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE486206BF8AF0071091A /* GPBCompileTest21.m */; };
- F40EE4C0206BF8B90071091A /* GPBCompileTest22.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE48A206BF8B00071091A /* GPBCompileTest22.m */; };
- F40EE4C1206BF8B90071091A /* GPBCompileTest23.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE487206BF8B00071091A /* GPBCompileTest23.m */; };
- F40EE50B206C06640071091A /* GPBCompileTest24.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE508206C06440071091A /* GPBCompileTest24.m */; };
- F40EE50C206C06640071091A /* GPBCompileTest25.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE507206C06440071091A /* GPBCompileTest25.m */; };
F41C175D1833D3310064ED4D /* GPBPerfTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F41C175C1833D3310064ED4D /* GPBPerfTests.m */; };
F4353D1D1AB8822D005A6198 /* GPBDescriptorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D1C1AB8822D005A6198 /* GPBDescriptorTests.m */; };
F4353D231ABB1537005A6198 /* GPBDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D211ABB1537005A6198 /* GPBDictionary.m */; };
@@ -183,31 +158,6 @@
F401DC2A1A8D444600FCC765 /* GPBArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBArray.h; sourceTree = "<group>"; };
F401DC2B1A8D444600FCC765 /* GPBArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBArray.m; sourceTree = "<group>"; };
F401DC321A8E5C0200FCC765 /* GPBArrayTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBArrayTests.m; sourceTree = "<group>"; };
- F40EE47D206BF8AD0071091A /* GPBCompileTest08.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest08.m; sourceTree = "<group>"; };
- F40EE47E206BF8AE0071091A /* GPBCompileTest04.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest04.m; sourceTree = "<group>"; };
- F40EE47F206BF8AE0071091A /* GPBCompileTest05.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest05.m; sourceTree = "<group>"; };
- F40EE480206BF8AE0071091A /* GPBCompileTest07.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest07.m; sourceTree = "<group>"; };
- F40EE481206BF8AE0071091A /* GPBCompileTest02.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest02.m; sourceTree = "<group>"; };
- F40EE482206BF8AF0071091A /* GPBCompileTest19.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest19.m; sourceTree = "<group>"; };
- F40EE483206BF8AF0071091A /* GPBCompileTest13.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest13.m; sourceTree = "<group>"; };
- F40EE484206BF8AF0071091A /* GPBCompileTest09.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest09.m; sourceTree = "<group>"; };
- F40EE485206BF8AF0071091A /* GPBCompileTest20.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest20.m; sourceTree = "<group>"; };
- F40EE486206BF8AF0071091A /* GPBCompileTest21.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest21.m; sourceTree = "<group>"; };
- F40EE487206BF8B00071091A /* GPBCompileTest23.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest23.m; sourceTree = "<group>"; };
- F40EE488206BF8B00071091A /* GPBCompileTest01.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest01.m; sourceTree = "<group>"; };
- F40EE489206BF8B00071091A /* GPBCompileTest15.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest15.m; sourceTree = "<group>"; };
- F40EE48A206BF8B00071091A /* GPBCompileTest22.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest22.m; sourceTree = "<group>"; };
- F40EE48B206BF8B00071091A /* GPBCompileTest16.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest16.m; sourceTree = "<group>"; };
- F40EE48C206BF8B00071091A /* GPBCompileTest10.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest10.m; sourceTree = "<group>"; };
- F40EE48D206BF8B00071091A /* GPBCompileTest17.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest17.m; sourceTree = "<group>"; };
- F40EE48E206BF8B10071091A /* GPBCompileTest18.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest18.m; sourceTree = "<group>"; };
- F40EE48F206BF8B10071091A /* GPBCompileTest14.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest14.m; sourceTree = "<group>"; };
- F40EE490206BF8B10071091A /* GPBCompileTest12.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest12.m; sourceTree = "<group>"; };
- F40EE491206BF8B10071091A /* GPBCompileTest03.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest03.m; sourceTree = "<group>"; };
- F40EE492206BF8B10071091A /* GPBCompileTest06.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest06.m; sourceTree = "<group>"; };
- F40EE493206BF8B20071091A /* GPBCompileTest11.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest11.m; sourceTree = "<group>"; };
- F40EE507206C06440071091A /* GPBCompileTest25.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest25.m; sourceTree = "<group>"; };
- F40EE508206C06440071091A /* GPBCompileTest24.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest24.m; sourceTree = "<group>"; };
F41C175C1833D3310064ED4D /* GPBPerfTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBPerfTests.m; sourceTree = "<group>"; };
F4353D1C1AB8822D005A6198 /* GPBDescriptorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBDescriptorTests.m; sourceTree = "<group>"; };
F4353D201ABB1537005A6198 /* GPBDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBDictionary.h; sourceTree = "<group>"; };
@@ -445,31 +395,6 @@
F401DC321A8E5C0200FCC765 /* GPBArrayTests.m */,
7461B69B0F94FDF800A0C422 /* GPBCodedInputStreamTests.m */,
7461B69D0F94FDF800A0C422 /* GPBCodedOuputStreamTests.m */,
- F40EE488206BF8B00071091A /* GPBCompileTest01.m */,
- F40EE481206BF8AE0071091A /* GPBCompileTest02.m */,
- F40EE491206BF8B10071091A /* GPBCompileTest03.m */,
- F40EE47E206BF8AE0071091A /* GPBCompileTest04.m */,
- F40EE47F206BF8AE0071091A /* GPBCompileTest05.m */,
- F40EE492206BF8B10071091A /* GPBCompileTest06.m */,
- F40EE480206BF8AE0071091A /* GPBCompileTest07.m */,
- F40EE47D206BF8AD0071091A /* GPBCompileTest08.m */,
- F40EE484206BF8AF0071091A /* GPBCompileTest09.m */,
- F40EE48C206BF8B00071091A /* GPBCompileTest10.m */,
- F40EE493206BF8B20071091A /* GPBCompileTest11.m */,
- F40EE490206BF8B10071091A /* GPBCompileTest12.m */,
- F40EE483206BF8AF0071091A /* GPBCompileTest13.m */,
- F40EE48F206BF8B10071091A /* GPBCompileTest14.m */,
- F40EE489206BF8B00071091A /* GPBCompileTest15.m */,
- F40EE48B206BF8B00071091A /* GPBCompileTest16.m */,
- F40EE48D206BF8B00071091A /* GPBCompileTest17.m */,
- F40EE48E206BF8B10071091A /* GPBCompileTest18.m */,
- F40EE482206BF8AF0071091A /* GPBCompileTest19.m */,
- F40EE485206BF8AF0071091A /* GPBCompileTest20.m */,
- F40EE486206BF8AF0071091A /* GPBCompileTest21.m */,
- F40EE48A206BF8B00071091A /* GPBCompileTest22.m */,
- F40EE487206BF8B00071091A /* GPBCompileTest23.m */,
- F40EE508206C06440071091A /* GPBCompileTest24.m */,
- F40EE507206C06440071091A /* GPBCompileTest25.m */,
5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */,
F4353D1C1AB8822D005A6198 /* GPBDescriptorTests.m */,
F4C4B9E21E1D974F00D3B61D /* GPBDictionaryTests.m */,
@@ -637,7 +562,7 @@
attributes = {
LastSwiftUpdateCheck = 0710;
LastTestingUpgradeCheck = 0600;
- LastUpgradeCheck = 0930;
+ LastUpgradeCheck = 0800;
TargetAttributes = {
8BBEA4A5147C727100C4ADB7 = {
LastSwiftMigration = 0800;
@@ -736,53 +661,28 @@
buildActionMask = 2147483647;
files = (
8BBEA4A9147C727D00C4ADB7 /* GPBCodedInputStreamTests.m in Sources */,
- F40EE50B206C06640071091A /* GPBCompileTest24.m in Sources */,
- F40EE4BE206BF8B90071091A /* GPBCompileTest20.m in Sources */,
F401DC331A8E5C0200FCC765 /* GPBArrayTests.m in Sources */,
- F40EE4B4206BF8B90071091A /* GPBCompileTest10.m in Sources */,
F4353D361AC06F10005A6198 /* GPBDictionaryTests+Int64.m in Sources */,
- F40EE4C0206BF8B90071091A /* GPBCompileTest22.m in Sources */,
- F40EE4B2206BF8B90071091A /* GPBCompileTest08.m in Sources */,
- F40EE4BB206BF8B90071091A /* GPBCompileTest17.m in Sources */,
F4353D391AC06F10005A6198 /* GPBDictionaryTests+UInt64.m in Sources */,
8BBEA4AA147C727D00C4ADB7 /* GPBCodedOuputStreamTests.m in Sources */,
- F40EE4C1206BF8B90071091A /* GPBCompileTest23.m in Sources */,
8BBEA4AC147C727D00C4ADB7 /* GPBMessageTests.m in Sources */,
F4B51B1E1BBC610700744318 /* GPBObjectiveCPlusPlusTest.mm in Sources */,
- F40EE4BD206BF8B90071091A /* GPBCompileTest19.m in Sources */,
- F40EE4B0206BF8B90071091A /* GPBCompileTest06.m in Sources */,
- F40EE4B6206BF8B90071091A /* GPBCompileTest12.m in Sources */,
F4487C7F1AAF62CD00531423 /* GPBMessageTests+Serialization.m in Sources */,
- F40EE4AD206BF8B90071091A /* GPBCompileTest03.m in Sources */,
- F40EE4BC206BF8B90071091A /* GPBCompileTest18.m in Sources */,
- F40EE4B7206BF8B90071091A /* GPBCompileTest13.m in Sources */,
- F40EE4B9206BF8B90071091A /* GPBCompileTest15.m in Sources */,
- F40EE4B1206BF8B90071091A /* GPBCompileTest07.m in Sources */,
8B4248DC1A92933A00BC1EC6 /* GPBWellKnownTypesTest.m in Sources */,
- F40EE4BF206BF8B90071091A /* GPBCompileTest21.m in Sources */,
- F40EE4B5206BF8B90071091A /* GPBCompileTest11.m in Sources */,
F4F8D8831D789FD9002CE128 /* GPBUnittestProtos2.m in Sources */,
F4353D1D1AB8822D005A6198 /* GPBDescriptorTests.m in Sources */,
8B4248BB1A8C256A00BC1EC6 /* GPBSwiftTests.swift in Sources */,
- F40EE50C206C06640071091A /* GPBCompileTest25.m in Sources */,
F4584D821ECCB52A00803AB6 /* GPBExtensionRegistryTest.m in Sources */,
5102DABC1891A073002037B6 /* GPBConcurrencyTests.m in Sources */,
F4487C751AADF7F500531423 /* GPBMessageTests+Runtime.m in Sources */,
- F40EE4AC206BF8B90071091A /* GPBCompileTest02.m in Sources */,
F4353D351AC06F10005A6198 /* GPBDictionaryTests+Int32.m in Sources */,
- F40EE4AF206BF8B90071091A /* GPBCompileTest05.m in Sources */,
- F40EE4B8206BF8B90071091A /* GPBCompileTest14.m in Sources */,
8BBEA4B0147C727D00C4ADB7 /* GPBTestUtilities.m in Sources */,
- F40EE4AE206BF8B90071091A /* GPBCompileTest04.m in Sources */,
- F40EE4BA206BF8B90071091A /* GPBCompileTest16.m in Sources */,
F41C175D1833D3310064ED4D /* GPBPerfTests.m in Sources */,
F4353D341AC06F10005A6198 /* GPBDictionaryTests+Bool.m in Sources */,
F4487C831AAF6AB300531423 /* GPBMessageTests+Merge.m in Sources */,
- F40EE4AB206BF8B90071091A /* GPBCompileTest01.m in Sources */,
8BBEA4B6147C727D00C4ADB7 /* GPBUnknownFieldSetTest.m in Sources */,
F4353D371AC06F10005A6198 /* GPBDictionaryTests+String.m in Sources */,
F4353D381AC06F10005A6198 /* GPBDictionaryTests+UInt32.m in Sources */,
- F40EE4B3206BF8B90071091A /* GPBCompileTest09.m in Sources */,
8BBEA4B7147C727D00C4ADB7 /* GPBUtilitiesTests.m in Sources */,
F4C4B9E41E1D976300D3B61D /* GPBDictionaryTests.m in Sources */,
8BBEA4B8147C727D00C4ADB7 /* GPBWireFormatTests.m in Sources */,
@@ -818,7 +718,6 @@
7461B52F0F94FAFA00A0C422 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
PRODUCT_NAME = ProtocolBuffers;
@@ -828,7 +727,6 @@
7461B5300F94FAFA00A0C422 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
PRODUCT_NAME = ProtocolBuffers;
@@ -839,7 +737,6 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = (
"${PROJECT_DERIVED_FILE_DIR}/protos",
@@ -866,7 +763,6 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = (
"${PROJECT_DERIVED_FILE_DIR}/protos",
@@ -898,8 +794,6 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_STATIC_ANALYZER_MODE = deep;
CLANG_WARN_ASSIGN_ENUM = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_COMMA = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
@@ -909,8 +803,6 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
@@ -968,8 +860,6 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_STATIC_ANALYZER_MODE = deep;
CLANG_WARN_ASSIGN_ENUM = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_COMMA = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
@@ -979,8 +869,6 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
@@ -1029,7 +917,6 @@
F4487C4F1A9F8E0200531423 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
PRODUCT_NAME = TestSingleSourceBuild;
@@ -1039,7 +926,6 @@
F4487C501A9F8E0200531423 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
PRODUCT_NAME = TestSingleSourceBuild;
@@ -1049,14 +935,12 @@
F45BBC151B0CE3C6002D064D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
};
name = Debug;
};
F45BBC161B0CE3C6002D064D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
};
name = Release;
};
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 888be4da13..888be4da13 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
index 08de0be8d3..08de0be8d3 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
index 6653a1b02b..2883109c71 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0930"
+ LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
index 328771b8ce..b1243b79b2 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0930"
+ LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -54,8 +54,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- codeCoverageEnabled = "YES"
- shouldUseLaunchSchemeArgsEnv = "YES">
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
index 470652d07b..2211cb3757 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
@@ -25,6 +25,13 @@
8B79657B14992E3F002FFBFC /* GPBRootObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B79657914992E3E002FFBFC /* GPBRootObject.m */; };
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8B615C17DF7056002EE618 /* GPBARCUnittestProtos.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
8B96157414C8C38C00A2AC0B /* GPBDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B96157314C8C38C00A2AC0B /* GPBDescriptor.m */; };
+ 8B9742331A89D19F00DCE92C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8B9742321A89D19F00DCE92C /* LaunchScreen.xib */; };
+ 8B9742431A8AAA7800DCE92C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9742421A8AAA7800DCE92C /* CoreGraphics.framework */; };
+ 8B9A5EA61831993600A9D33B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 8B9A5EA81831993600A9D33B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9A5E9F1831913D00A9D33B /* UIKit.framework */; };
+ 8B9A5EAE1831993600A9D33B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8B9A5EAC1831993600A9D33B /* InfoPlist.strings */; };
+ 8B9A5EB41831993600A9D33B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B9A5EB31831993600A9D33B /* AppDelegate.m */; };
+ 8B9A5EB61831993600A9D33B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8B9A5EB51831993600A9D33B /* Images.xcassets */; };
8B9A5EEC18330A0F00A9D33B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9A5E9F1831913D00A9D33B /* UIKit.framework */; };
8BBEA4A9147C727D00C4ADB7 /* GPBCodedInputStreamTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B69B0F94FDF800A0C422 /* GPBCodedInputStreamTests.m */; };
8BBEA4AA147C727D00C4ADB7 /* GPBCodedOuputStreamTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B69D0F94FDF800A0C422 /* GPBCodedOuputStreamTests.m */; };
@@ -37,31 +44,6 @@
8BD3981F14BE59D70081D629 /* GPBUnittestProtos.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD3981E14BE59D70081D629 /* GPBUnittestProtos.m */; };
8BF8193514A0DDA600A2C982 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
F401DC351A8E5C6F00FCC765 /* GPBArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F401DC341A8E5C6F00FCC765 /* GPBArrayTests.m */; };
- F40EE4F0206BF91E0071091A /* GPBCompileTest01.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CD206BF9170071091A /* GPBCompileTest01.m */; };
- F40EE4F1206BF91E0071091A /* GPBCompileTest02.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4C6206BF9170071091A /* GPBCompileTest02.m */; };
- F40EE4F2206BF91E0071091A /* GPBCompileTest03.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D6206BF9190071091A /* GPBCompileTest03.m */; };
- F40EE4F3206BF91E0071091A /* GPBCompileTest04.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4C3206BF9160071091A /* GPBCompileTest04.m */; };
- F40EE4F4206BF91E0071091A /* GPBCompileTest05.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4C4206BF9160071091A /* GPBCompileTest05.m */; };
- F40EE4F5206BF91E0071091A /* GPBCompileTest06.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D7206BF9190071091A /* GPBCompileTest06.m */; };
- F40EE4F6206BF91E0071091A /* GPBCompileTest07.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4C5206BF9170071091A /* GPBCompileTest07.m */; };
- F40EE4F7206BF91E0071091A /* GPBCompileTest08.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4C2206BF9160071091A /* GPBCompileTest08.m */; };
- F40EE4F8206BF91E0071091A /* GPBCompileTest09.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4C9206BF9170071091A /* GPBCompileTest09.m */; };
- F40EE4F9206BF91E0071091A /* GPBCompileTest10.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D1206BF9180071091A /* GPBCompileTest10.m */; };
- F40EE4FA206BF91E0071091A /* GPBCompileTest11.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D8206BF9190071091A /* GPBCompileTest11.m */; };
- F40EE4FB206BF91E0071091A /* GPBCompileTest12.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D5206BF9180071091A /* GPBCompileTest12.m */; };
- F40EE4FC206BF91E0071091A /* GPBCompileTest13.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4C8206BF9170071091A /* GPBCompileTest13.m */; };
- F40EE4FD206BF91E0071091A /* GPBCompileTest14.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D4206BF9180071091A /* GPBCompileTest14.m */; };
- F40EE4FE206BF91E0071091A /* GPBCompileTest15.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CE206BF9170071091A /* GPBCompileTest15.m */; };
- F40EE4FF206BF91E0071091A /* GPBCompileTest16.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D0206BF9180071091A /* GPBCompileTest16.m */; };
- F40EE500206BF91E0071091A /* GPBCompileTest17.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D2206BF9180071091A /* GPBCompileTest17.m */; };
- F40EE501206BF91E0071091A /* GPBCompileTest18.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4D3206BF9180071091A /* GPBCompileTest18.m */; };
- F40EE502206BF91E0071091A /* GPBCompileTest19.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4C7206BF9170071091A /* GPBCompileTest19.m */; };
- F40EE503206BF91E0071091A /* GPBCompileTest20.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CA206BF9170071091A /* GPBCompileTest20.m */; };
- F40EE504206BF91E0071091A /* GPBCompileTest21.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CB206BF9170071091A /* GPBCompileTest21.m */; };
- F40EE505206BF91E0071091A /* GPBCompileTest22.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CF206BF9170071091A /* GPBCompileTest22.m */; };
- F40EE506206BF91E0071091A /* GPBCompileTest23.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CC206BF9170071091A /* GPBCompileTest23.m */; };
- F40EE511206C068D0071091A /* GPBCompileTest24.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE50E206C06880071091A /* GPBCompileTest24.m */; };
- F40EE512206C068D0071091A /* GPBCompileTest25.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE50D206C06880071091A /* GPBCompileTest25.m */; };
F41C175D1833D3310064ED4D /* GPBPerfTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F41C175C1833D3310064ED4D /* GPBPerfTests.m */; };
F4353D1F1AB88243005A6198 /* GPBDescriptorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */; };
F4353D271ABB156F005A6198 /* GPBDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D251ABB156F005A6198 /* GPBDictionary.m */; };
@@ -97,6 +79,13 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
+ 8B9A5ED01831994600A9D33B /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 8B9A5EA41831993600A9D33B;
+ remoteInfo = iOSTestHarness;
+ };
8BBEA4BC147C729A00C4ADB7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
@@ -174,8 +163,14 @@
8B8B615C17DF7056002EE618 /* GPBARCUnittestProtos.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBARCUnittestProtos.m; sourceTree = "<group>"; };
8B96157214C8B06000A2AC0B /* GPBDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBDescriptor.h; sourceTree = "<group>"; };
8B96157314C8C38C00A2AC0B /* GPBDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBDescriptor.m; sourceTree = "<group>"; };
+ 8B9742321A89D19F00DCE92C /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = "<group>"; };
8B9742421A8AAA7800DCE92C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
8B9A5E9F1831913D00A9D33B /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 8B9A5EA51831993600A9D33B /* iOSTestHarness.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSTestHarness.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 8B9A5EAB1831993600A9D33B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 8B9A5EAD1831993600A9D33B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 8B9A5EB31831993600A9D33B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 8B9A5EB51831993600A9D33B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
8BBD9DB016DD1DC8008E1EC1 /* unittest_lite.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = unittest_lite.proto; path = ../../src/google/protobuf/unittest_lite.proto; sourceTree = "<group>"; };
8BBEA4A6147C727100C4ADB7 /* UnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
8BCF338814ED799900BC5317 /* GPBProtocolBuffers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GPBProtocolBuffers.m; sourceTree = "<group>"; };
@@ -183,31 +178,6 @@
8BD3981E14BE59D70081D629 /* GPBUnittestProtos.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBUnittestProtos.m; sourceTree = "<group>"; };
8BEB5AE01498033E0078BF9D /* GPBRuntimeTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBRuntimeTypes.h; sourceTree = "<group>"; };
F401DC341A8E5C6F00FCC765 /* GPBArrayTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBArrayTests.m; sourceTree = "<group>"; };
- F40EE4C2206BF9160071091A /* GPBCompileTest08.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest08.m; sourceTree = "<group>"; };
- F40EE4C3206BF9160071091A /* GPBCompileTest04.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest04.m; sourceTree = "<group>"; };
- F40EE4C4206BF9160071091A /* GPBCompileTest05.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest05.m; sourceTree = "<group>"; };
- F40EE4C5206BF9170071091A /* GPBCompileTest07.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest07.m; sourceTree = "<group>"; };
- F40EE4C6206BF9170071091A /* GPBCompileTest02.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest02.m; sourceTree = "<group>"; };
- F40EE4C7206BF9170071091A /* GPBCompileTest19.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest19.m; sourceTree = "<group>"; };
- F40EE4C8206BF9170071091A /* GPBCompileTest13.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest13.m; sourceTree = "<group>"; };
- F40EE4C9206BF9170071091A /* GPBCompileTest09.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest09.m; sourceTree = "<group>"; };
- F40EE4CA206BF9170071091A /* GPBCompileTest20.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest20.m; sourceTree = "<group>"; };
- F40EE4CB206BF9170071091A /* GPBCompileTest21.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest21.m; sourceTree = "<group>"; };
- F40EE4CC206BF9170071091A /* GPBCompileTest23.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest23.m; sourceTree = "<group>"; };
- F40EE4CD206BF9170071091A /* GPBCompileTest01.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest01.m; sourceTree = "<group>"; };
- F40EE4CE206BF9170071091A /* GPBCompileTest15.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest15.m; sourceTree = "<group>"; };
- F40EE4CF206BF9170071091A /* GPBCompileTest22.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest22.m; sourceTree = "<group>"; };
- F40EE4D0206BF9180071091A /* GPBCompileTest16.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest16.m; sourceTree = "<group>"; };
- F40EE4D1206BF9180071091A /* GPBCompileTest10.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest10.m; sourceTree = "<group>"; };
- F40EE4D2206BF9180071091A /* GPBCompileTest17.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest17.m; sourceTree = "<group>"; };
- F40EE4D3206BF9180071091A /* GPBCompileTest18.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest18.m; sourceTree = "<group>"; };
- F40EE4D4206BF9180071091A /* GPBCompileTest14.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest14.m; sourceTree = "<group>"; };
- F40EE4D5206BF9180071091A /* GPBCompileTest12.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest12.m; sourceTree = "<group>"; };
- F40EE4D6206BF9190071091A /* GPBCompileTest03.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest03.m; sourceTree = "<group>"; };
- F40EE4D7206BF9190071091A /* GPBCompileTest06.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest06.m; sourceTree = "<group>"; };
- F40EE4D8206BF9190071091A /* GPBCompileTest11.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest11.m; sourceTree = "<group>"; };
- F40EE50D206C06880071091A /* GPBCompileTest25.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest25.m; sourceTree = "<group>"; };
- F40EE50E206C06880071091A /* GPBCompileTest24.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest24.m; sourceTree = "<group>"; };
F41C175C1833D3310064ED4D /* GPBPerfTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBPerfTests.m; sourceTree = "<group>"; };
F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBDescriptorTests.m; sourceTree = "<group>"; };
F4353D241ABB156F005A6198 /* GPBDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBDictionary.h; sourceTree = "<group>"; };
@@ -281,6 +251,16 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 8B9A5EA21831993600A9D33B /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8B9742431A8AAA7800DCE92C /* CoreGraphics.framework in Frameworks */,
+ 8B9A5EA81831993600A9D33B /* UIKit.framework in Frameworks */,
+ 8B9A5EA61831993600A9D33B /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
8BBEA4A3147C727100C4ADB7 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -323,6 +303,7 @@
children = (
7461B52E0F94FAF800A0C422 /* libProtocolBuffers.a */,
8BBEA4A6147C727100C4ADB7 /* UnitTests.xctest */,
+ 8B9A5EA51831993600A9D33B /* iOSTestHarness.app */,
F4487C6E1A9F8F8100531423 /* libTestSingleSourceBuild.a */,
);
name = Products;
@@ -444,6 +425,7 @@
7461B6940F94FDDD00A0C422 /* Tests */ = {
isa = PBXGroup;
children = (
+ 8B9A5EA91831993600A9D33B /* iOSTestHarness */,
8B4248B71A8BDD9600BC1EC6 /* protobuf */,
8B210CCD159383D60032D72D /* golden_message */,
8B210CCF159386920032D72D /* golden_packed_fields_message */,
@@ -451,31 +433,6 @@
F401DC341A8E5C6F00FCC765 /* GPBArrayTests.m */,
7461B69B0F94FDF800A0C422 /* GPBCodedInputStreamTests.m */,
7461B69D0F94FDF800A0C422 /* GPBCodedOuputStreamTests.m */,
- F40EE4CD206BF9170071091A /* GPBCompileTest01.m */,
- F40EE4C6206BF9170071091A /* GPBCompileTest02.m */,
- F40EE4D6206BF9190071091A /* GPBCompileTest03.m */,
- F40EE4C3206BF9160071091A /* GPBCompileTest04.m */,
- F40EE4C4206BF9160071091A /* GPBCompileTest05.m */,
- F40EE4D7206BF9190071091A /* GPBCompileTest06.m */,
- F40EE4C5206BF9170071091A /* GPBCompileTest07.m */,
- F40EE4C2206BF9160071091A /* GPBCompileTest08.m */,
- F40EE4C9206BF9170071091A /* GPBCompileTest09.m */,
- F40EE4D1206BF9180071091A /* GPBCompileTest10.m */,
- F40EE4D8206BF9190071091A /* GPBCompileTest11.m */,
- F40EE4D5206BF9180071091A /* GPBCompileTest12.m */,
- F40EE4C8206BF9170071091A /* GPBCompileTest13.m */,
- F40EE4D4206BF9180071091A /* GPBCompileTest14.m */,
- F40EE4CE206BF9170071091A /* GPBCompileTest15.m */,
- F40EE4D0206BF9180071091A /* GPBCompileTest16.m */,
- F40EE4D2206BF9180071091A /* GPBCompileTest17.m */,
- F40EE4D3206BF9180071091A /* GPBCompileTest18.m */,
- F40EE4C7206BF9170071091A /* GPBCompileTest19.m */,
- F40EE4CA206BF9170071091A /* GPBCompileTest20.m */,
- F40EE4CB206BF9170071091A /* GPBCompileTest21.m */,
- F40EE4CF206BF9170071091A /* GPBCompileTest22.m */,
- F40EE4CC206BF9170071091A /* GPBCompileTest23.m */,
- F40EE50E206C06880071091A /* GPBCompileTest24.m */,
- F40EE50D206C06880071091A /* GPBCompileTest25.m */,
5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */,
F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */,
F4C4B9E51E1D97BB00D3B61D /* GPBDictionaryTests.m */,
@@ -525,6 +482,26 @@
path = Tests;
sourceTree = "<group>";
};
+ 8B9A5EA91831993600A9D33B /* iOSTestHarness */ = {
+ isa = PBXGroup;
+ children = (
+ 8B9A5EB31831993600A9D33B /* AppDelegate.m */,
+ 8B9A5EB51831993600A9D33B /* Images.xcassets */,
+ 8B9A5EAA1831993600A9D33B /* Supporting Files */,
+ 8B9742321A89D19F00DCE92C /* LaunchScreen.xib */,
+ );
+ path = iOSTestHarness;
+ sourceTree = "<group>";
+ };
+ 8B9A5EAA1831993600A9D33B /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 8B9A5EAB1831993600A9D33B /* Info.plist */,
+ 8B9A5EAC1831993600A9D33B /* InfoPlist.strings */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
8BCF334414ED727300BC5317 /* Support */ = {
isa = PBXGroup;
children = (
@@ -599,6 +576,23 @@
productReference = 7461B52E0F94FAF800A0C422 /* libProtocolBuffers.a */;
productType = "com.apple.product-type.library.static";
};
+ 8B9A5EA41831993600A9D33B /* iOSTestHarness */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 8B9A5ECA1831993600A9D33B /* Build configuration list for PBXNativeTarget "iOSTestHarness" */;
+ buildPhases = (
+ 8B9A5EA11831993600A9D33B /* Sources */,
+ 8B9A5EA21831993600A9D33B /* Frameworks */,
+ 8B9A5EA31831993600A9D33B /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = iOSTestHarness;
+ productName = iOSTestHarness;
+ productReference = 8B9A5EA51831993600A9D33B /* iOSTestHarness.app */;
+ productType = "com.apple.product-type.application";
+ };
8BBEA4A5147C727100C4ADB7 /* UnitTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8BBEA4BA147C728600C4ADB7 /* Build configuration list for PBXNativeTarget "UnitTests" */;
@@ -613,6 +607,7 @@
dependencies = (
8BBEA4BD147C729A00C4ADB7 /* PBXTargetDependency */,
F45BBC131B0CDBBA002D064D /* PBXTargetDependency */,
+ 8B9A5ED11831994600A9D33B /* PBXTargetDependency */,
);
name = UnitTests;
productName = UnitTests;
@@ -644,7 +639,7 @@
attributes = {
LastSwiftUpdateCheck = 0710;
LastTestingUpgradeCheck = 0600;
- LastUpgradeCheck = 0930;
+ LastUpgradeCheck = 0800;
TargetAttributes = {
8BBEA4A5147C727100C4ADB7 = {
LastSwiftMigration = 0800;
@@ -668,6 +663,7 @@
targets = (
7461B52D0F94FAF800A0C422 /* ProtocolBuffers */,
8BBEA4A5147C727100C4ADB7 /* UnitTests */,
+ 8B9A5EA41831993600A9D33B /* iOSTestHarness */,
F4487C551A9F8F8100531423 /* TestSingleSourceBuild */,
F45BBC0E1B0CDB50002D064D /* Compile Unittest Protos */,
);
@@ -675,6 +671,16 @@
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
+ 8B9A5EA31831993600A9D33B /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8B9A5EAE1831993600A9D33B /* InfoPlist.strings in Resources */,
+ 8B9A5EB61831993600A9D33B /* Images.xcassets in Resources */,
+ 8B9742331A89D19F00DCE92C /* LaunchScreen.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
8BBEA4A1147C727100C4ADB7 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -738,58 +744,41 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 8B9A5EA11831993600A9D33B /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8B9A5EB41831993600A9D33B /* AppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
8BBEA4A2147C727100C4ADB7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8BBEA4A9147C727D00C4ADB7 /* GPBCodedInputStreamTests.m in Sources */,
- F40EE511206C068D0071091A /* GPBCompileTest24.m in Sources */,
- F40EE503206BF91E0071091A /* GPBCompileTest20.m in Sources */,
F401DC351A8E5C6F00FCC765 /* GPBArrayTests.m in Sources */,
- F40EE4F9206BF91E0071091A /* GPBCompileTest10.m in Sources */,
F4353D441AC06F31005A6198 /* GPBDictionaryTests+Int64.m in Sources */,
- F40EE505206BF91E0071091A /* GPBCompileTest22.m in Sources */,
- F40EE4F7206BF91E0071091A /* GPBCompileTest08.m in Sources */,
- F40EE500206BF91E0071091A /* GPBCompileTest17.m in Sources */,
F4353D471AC06F31005A6198 /* GPBDictionaryTests+UInt64.m in Sources */,
8BBEA4AA147C727D00C4ADB7 /* GPBCodedOuputStreamTests.m in Sources */,
- F40EE506206BF91E0071091A /* GPBCompileTest23.m in Sources */,
8BBEA4AC147C727D00C4ADB7 /* GPBMessageTests.m in Sources */,
F4487C811AAF62FC00531423 /* GPBMessageTests+Serialization.m in Sources */,
- F40EE502206BF91E0071091A /* GPBCompileTest19.m in Sources */,
- F40EE4F5206BF91E0071091A /* GPBCompileTest06.m in Sources */,
- F40EE4FB206BF91E0071091A /* GPBCompileTest12.m in Sources */,
8B4248E61A929C9900BC1EC6 /* GPBWellKnownTypesTest.m in Sources */,
- F40EE4F2206BF91E0071091A /* GPBCompileTest03.m in Sources */,
- F40EE501206BF91E0071091A /* GPBCompileTest18.m in Sources */,
- F40EE4FC206BF91E0071091A /* GPBCompileTest13.m in Sources */,
- F40EE4FE206BF91E0071091A /* GPBCompileTest15.m in Sources */,
- F40EE4F6206BF91E0071091A /* GPBCompileTest07.m in Sources */,
F4353D1F1AB88243005A6198 /* GPBDescriptorTests.m in Sources */,
- F40EE504206BF91E0071091A /* GPBCompileTest21.m in Sources */,
- F40EE4FA206BF91E0071091A /* GPBCompileTest11.m in Sources */,
F4F8D8861D78A193002CE128 /* GPBUnittestProtos2.m in Sources */,
F4B51B1C1BBC5C7100744318 /* GPBObjectiveCPlusPlusTest.mm in Sources */,
8B4248B41A8BD96E00BC1EC6 /* GPBSwiftTests.swift in Sources */,
- F40EE512206C068D0071091A /* GPBCompileTest25.m in Sources */,
F4584D831ECCB53600803AB6 /* GPBExtensionRegistryTest.m in Sources */,
5102DABC1891A073002037B6 /* GPBConcurrencyTests.m in Sources */,
F4487C771AADF84900531423 /* GPBMessageTests+Runtime.m in Sources */,
- F40EE4F1206BF91E0071091A /* GPBCompileTest02.m in Sources */,
F4353D431AC06F31005A6198 /* GPBDictionaryTests+Int32.m in Sources */,
- F40EE4F4206BF91E0071091A /* GPBCompileTest05.m in Sources */,
- F40EE4FD206BF91E0071091A /* GPBCompileTest14.m in Sources */,
8BBEA4B0147C727D00C4ADB7 /* GPBTestUtilities.m in Sources */,
- F40EE4F3206BF91E0071091A /* GPBCompileTest04.m in Sources */,
- F40EE4FF206BF91E0071091A /* GPBCompileTest16.m in Sources */,
F41C175D1833D3310064ED4D /* GPBPerfTests.m in Sources */,
F4353D421AC06F31005A6198 /* GPBDictionaryTests+Bool.m in Sources */,
F4487C851AAF6AC500531423 /* GPBMessageTests+Merge.m in Sources */,
- F40EE4F0206BF91E0071091A /* GPBCompileTest01.m in Sources */,
8BBEA4B6147C727D00C4ADB7 /* GPBUnknownFieldSetTest.m in Sources */,
F4353D451AC06F31005A6198 /* GPBDictionaryTests+String.m in Sources */,
F4353D461AC06F31005A6198 /* GPBDictionaryTests+UInt32.m in Sources */,
- F40EE4F8206BF91E0071091A /* GPBCompileTest09.m in Sources */,
8BBEA4B7147C727D00C4ADB7 /* GPBUtilitiesTests.m in Sources */,
F4C4B9E71E1D97BF00D3B61D /* GPBDictionaryTests.m in Sources */,
8BBEA4B8147C727D00C4ADB7 /* GPBWireFormatTests.m in Sources */,
@@ -809,6 +798,11 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
+ 8B9A5ED11831994600A9D33B /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 8B9A5EA41831993600A9D33B /* iOSTestHarness */;
+ targetProxy = 8B9A5ED01831994600A9D33B /* PBXContainerItemProxy */;
+ };
8BBEA4BD147C729A00C4ADB7 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 7461B52D0F94FAF800A0C422 /* ProtocolBuffers */;
@@ -821,11 +815,21 @@
};
/* End PBXTargetDependency section */
+/* Begin PBXVariantGroup section */
+ 8B9A5EAC1831993600A9D33B /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 8B9A5EAD1831993600A9D33B /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
/* Begin XCBuildConfiguration section */
7461B52F0F94FAFA00A0C422 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
PRODUCT_NAME = ProtocolBuffers;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -835,19 +839,48 @@
7461B5300F94FAFA00A0C422 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
PRODUCT_NAME = ProtocolBuffers;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
+ 8B9A5ECB1831993600A9D33B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ INFOPLIST_FILE = "$(SRCROOT)/Tests/iOSTestHarness/Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ PRODUCT_BUNDLE_IDENTIFIER = "com.google.${PRODUCT_NAME:rfc1034identifier}";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ 8B9A5ECC1831993600A9D33B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ INFOPLIST_FILE = "$(SRCROOT)/Tests/iOSTestHarness/Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ PRODUCT_BUNDLE_IDENTIFIER = "com.google.${PRODUCT_NAME:rfc1034identifier}";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
8BBEA4A7147C727100C4ADB7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
FRAMEWORK_SEARCH_PATHS = (
+ "\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"$(inherited)",
);
@@ -868,6 +901,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOSTestHarness.app/iOSTestHarness";
WARNING_CFLAGS = (
"$(inherited)",
"-Wno-documentation-unknown-command",
@@ -881,8 +915,8 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
FRAMEWORK_SEARCH_PATHS = (
+ "\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"$(inherited)",
);
@@ -902,6 +936,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOSTestHarness.app/iOSTestHarness";
WARNING_CFLAGS = (
"$(inherited)",
"-Wno-documentation-unknown-command",
@@ -921,8 +956,6 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_STATIC_ANALYZER_MODE = deep;
CLANG_WARN_ASSIGN_ENUM = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_COMMA = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
@@ -932,8 +965,6 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
@@ -992,8 +1023,6 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_STATIC_ANALYZER_MODE = deep;
CLANG_WARN_ASSIGN_ENUM = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_COMMA = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
@@ -1003,8 +1032,6 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
@@ -1054,7 +1081,6 @@
F4487C6C1A9F8F8100531423 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
PRODUCT_NAME = TestSingleSourceBuild;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -1064,7 +1090,6 @@
F4487C6D1A9F8F8100531423 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
PRODUCT_NAME = TestSingleSourceBuild;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -1074,14 +1099,12 @@
F45BBC0F1B0CDB50002D064D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
};
name = Debug;
};
F45BBC101B0CDB50002D064D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_ENABLE_OBJC_WEAK = YES;
};
name = Release;
};
@@ -1097,6 +1120,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 8B9A5ECA1831993600A9D33B /* Build configuration list for PBXNativeTarget "iOSTestHarness" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 8B9A5ECB1831993600A9D33B /* Debug */,
+ 8B9A5ECC1831993600A9D33B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
8BBEA4BA147C728600C4ADB7 /* Build configuration list for PBXNativeTarget "UnitTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 037a91dfae..037a91dfae 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
index 08de0be8d3..08de0be8d3 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
index 77483d381c..1ba3a32921 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0930"
+ LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
index bacbcba3a9..edbe689822 100644
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
+++ b/third_party/protobuf/3.4.0/objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0930"
+ LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -54,8 +54,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- codeCoverageEnabled = "YES"
- shouldUseLaunchSchemeArgsEnv = "YES">
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
@@ -95,15 +95,16 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
- <MacroExpansion>
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "7461B52D0F94FAF800A0C422"
- BuildableName = "libProtocolBuffers.a"
- BlueprintName = "ProtocolBuffers"
+ BlueprintIdentifier = "8B9A5EA41831993600A9D33B"
+ BuildableName = "iOSTestHarness.app"
+ BlueprintName = "iOSTestHarness"
ReferencedContainer = "container:ProtocolBuffers_iOS.xcodeproj">
</BuildableReference>
- </MacroExpansion>
+ </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
diff --git a/third_party/protobuf/3.6.0/objectivec/README.md b/third_party/protobuf/3.4.0/objectivec/README.md
index a02df33fca..7226f0b9a1 100644
--- a/third_party/protobuf/3.6.0/objectivec/README.md
+++ b/third_party/protobuf/3.4.0/objectivec/README.md
@@ -13,7 +13,7 @@ Requirements
The Objective C implementation requires:
- Objective C 2.0 Runtime (32bit & 64bit iOS, 64bit OS X).
-- Xcode 8.0 (or later).
+- Xcode 7.0 (or later).
- The library code does *not* use ARC (for performance reasons), but it all can
be called from ARC code.
@@ -33,21 +33,19 @@ Building
There are two ways to include the Runtime sources in your project:
-Add `objectivec/*.h`, `objectivec/google/protobuf/*.pbobjc.h`, and
-`objectivec/GPBProtocolBuffers.m` to your project.
+Add `objectivec/\*.h` & `objectivec/GPBProtocolBuffers.m` to your project.
*or*
-Add `objectivec/*.h`, `objectivec/google/protobuf/*.pbobjc.h`,
-`objectivec/google/protobuf/*.pbobjc.m`, and `objectivec/*.m` except for
+Add `objectivec/\*.h` & `objectivec/\*.m` except for
`objectivec/GPBProtocolBuffers.m` to your project.
If the target is using ARC, remember to turn off ARC (`-fno-objc-arc`) for the
`.m` files.
-The files generated by `protoc` for the `*.proto` files (`*.pbobjc.h` and
-`*.pbobjc.m`) are then also added to the target.
+The files generated by `protoc` for the `*.proto` files (`\*.pbobjc.h` and
+`\*.pbobjc.m`) are then also added to the target.
Usage
-----
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj
index b9df381a1c..b9df381a1c 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 6d874e28a5..6d874e28a5 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme
index 56f8782eb8..56f8782eb8 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h
index c7ab521d0f..c7ab521d0f 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m
index 08735a0068..08735a0068 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json
index 2db2b1c7c6..2db2b1c7c6 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib
index aa3547ca18..aa3547ca18 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist
index ed806e40d6..ed806e40d6 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m
index b230090e5e..b230090e5e 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework
index 27eeafc9c8..27eeafc9c8 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static
index 5dfc8de578..5dfc8de578 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/README.md b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/README.md
index 0878591886..0878591886 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/README.md
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/README.md
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework
index 913a289b8e..913a289b8e 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static
index e9b3c235dd..e9b3c235dd 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj
index 27fb553fd4..27fb553fd4 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 008f7b4a6f..008f7b4a6f 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme
index 9558dd7a17..9558dd7a17 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h
index 5eca690ca7..5eca690ca7 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m
index dd7b969af8..dd7b969af8 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json
index 36d2c80d88..36d2c80d88 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard
index 2e721e1833..2e721e1833 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard
index 82cd159ae3..82cd159ae3 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist
index 40c6215d90..40c6215d90 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h
index 777257b85a..777257b85a 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m
index c3b7e6c0cc..c3b7e6c0cc 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m
index 4df0b769cf..4df0b769cf 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/run_tests.sh b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/run_tests.sh
index 6d3e12be30..fc281e4cf0 100644..100755
--- a/third_party/protobuf/3.6.0/objectivec/Tests/CocoaPods/run_tests.sh
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/CocoaPods/run_tests.sh
@@ -78,7 +78,7 @@ fi
header() {
echo ""
echo "========================================================================"
- echo " ${@}"
+ echo " $*"
echo "========================================================================"
echo ""
}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBARCUnittestProtos.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBARCUnittestProtos.m
index 29f6ccf69a..29f6ccf69a 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBARCUnittestProtos.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBARCUnittestProtos.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBArrayTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBArrayTests.m
index e414d90a68..31f75501dc 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBArrayTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBArrayTests.m
@@ -39,7 +39,6 @@
// To let the testing macros work, add some extra methods to simplify things.
@interface GPBEnumArray (TestingTweak)
+ (instancetype)arrayWithValue:(int32_t)value;
-+ (instancetype)arrayWithCapacity:(NSUInteger)count;
- (instancetype)initWithValues:(const int32_t [])values
count:(NSUInteger)count;
@end
@@ -73,10 +72,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
rawValues:&value
count:1] autorelease];
}
-+ (instancetype)arrayWithCapacity:(NSUInteger)count {
- return [[[self alloc] initWithValidationFunction:TestingEnum_IsValidValue
- capacity:count] autorelease];
-}
- (instancetype)initWithValues:(const int32_t [])values
count:(NSUInteger)count {
return [self initWithValidationFunction:TestingEnum_IsValidValue
@@ -182,8 +177,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
//% XCTAssertNotEqual(idx, 0U);
//% ++idx2;
//% }];
-//% // Ensure description doesn't choke.
-//% XCTAssertTrue(array.description.length > 10);
//% [array release];
//%}
//%
@@ -208,10 +201,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
//% NAME$S count:GPBARRAYSIZE(kValues3)];
//% XCTAssertNotNil(array3);
//%
-//% // Identity
-//% XCTAssertTrue([array1 isEqual:array1]);
-//% // Wrong type doesn't blow up.
-//% XCTAssertFalse([array1 isEqual:@"bogus"]);
//% // 1/1Prime should be different objects, but equal.
//% XCTAssertNotEqual(array1, array1prime);
//% XCTAssertEqualObjects(array1, array1prime);
@@ -282,12 +271,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
//% [array add##HELPER##ValuesFromArray:array2];
//% XCTAssertEqual(array.count, 5U);
//%
-//% // Zero/nil inputs do nothing.
-//% [array addValues:kValues1 count:0];
-//% XCTAssertEqual(array.count, 5U);
-//% [array addValues:NULL count:5];
-//% XCTAssertEqual(array.count, 5U);
-//%
//% XCTAssertEqual([array valueAtIndex:0], VAL1);
//% XCTAssertEqual([array valueAtIndex:1], VAL2);
//% XCTAssertEqual([array valueAtIndex:2], VAL3);
@@ -408,9 +391,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
//%- (void)testInternalResizing {
//% const TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##NAME##Array *array =
-//% [GPB##NAME##Array arrayWithCapacity:GPBARRAYSIZE(kValues)];
+//% [[GPB##NAME##Array alloc] initWithValues:kValues
+//% NAME$S count:GPBARRAYSIZE(kValues)];
//% XCTAssertNotNil(array);
-//% [array addValues:kValues count:GPBARRAYSIZE(kValues)];
//%
//% // Add/remove to trigger the intneral buffer to grow/shrink.
//% for (int i = 0; i < 100; ++i) {
@@ -427,6 +410,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
//% XCTAssertEqual(array.count, 404U);
//% [array removeAll];
//% XCTAssertEqual(array.count, 0U);
+//% [array release];
//%}
//%
//%@end
@@ -526,8 +510,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertNotEqual(idx, 0U);
++idx2;
}];
- // Ensure description doesn't choke.
- XCTAssertTrue(array.description.length > 10);
[array release];
}
@@ -552,10 +534,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
count:GPBARRAYSIZE(kValues3)];
XCTAssertNotNil(array3);
- // Identity
- XCTAssertTrue([array1 isEqual:array1]);
- // Wrong type doesn't blow up.
- XCTAssertFalse([array1 isEqual:@"bogus"]);
// 1/1Prime should be different objects, but equal.
XCTAssertNotEqual(array1, array1prime);
XCTAssertEqualObjects(array1, array1prime);
@@ -626,12 +604,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
[array addValuesFromArray:array2];
XCTAssertEqual(array.count, 5U);
- // Zero/nil inputs do nothing.
- [array addValues:kValues1 count:0];
- XCTAssertEqual(array.count, 5U);
- [array addValues:NULL count:5];
- XCTAssertEqual(array.count, 5U);
-
XCTAssertEqual([array valueAtIndex:0], 1);
XCTAssertEqual([array valueAtIndex:1], 2);
XCTAssertEqual([array valueAtIndex:2], 3);
@@ -752,9 +724,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
- (void)testInternalResizing {
const int32_t kValues[] = { 1, 2, 3, 4 };
GPBInt32Array *array =
- [GPBInt32Array arrayWithCapacity:GPBARRAYSIZE(kValues)];
+ [[GPBInt32Array alloc] initWithValues:kValues
+ count:GPBARRAYSIZE(kValues)];
XCTAssertNotNil(array);
- [array addValues:kValues count:GPBARRAYSIZE(kValues)];
// Add/remove to trigger the intneral buffer to grow/shrink.
for (int i = 0; i < 100; ++i) {
@@ -771,6 +743,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertEqual(array.count, 404U);
[array removeAll];
XCTAssertEqual(array.count, 0U);
+ [array release];
}
@end
@@ -870,8 +843,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertNotEqual(idx, 0U);
++idx2;
}];
- // Ensure description doesn't choke.
- XCTAssertTrue(array.description.length > 10);
[array release];
}
@@ -896,10 +867,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
count:GPBARRAYSIZE(kValues3)];
XCTAssertNotNil(array3);
- // Identity
- XCTAssertTrue([array1 isEqual:array1]);
- // Wrong type doesn't blow up.
- XCTAssertFalse([array1 isEqual:@"bogus"]);
// 1/1Prime should be different objects, but equal.
XCTAssertNotEqual(array1, array1prime);
XCTAssertEqualObjects(array1, array1prime);
@@ -970,12 +937,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
[array addValuesFromArray:array2];
XCTAssertEqual(array.count, 5U);
- // Zero/nil inputs do nothing.
- [array addValues:kValues1 count:0];
- XCTAssertEqual(array.count, 5U);
- [array addValues:NULL count:5];
- XCTAssertEqual(array.count, 5U);
-
XCTAssertEqual([array valueAtIndex:0], 11U);
XCTAssertEqual([array valueAtIndex:1], 12U);
XCTAssertEqual([array valueAtIndex:2], 13U);
@@ -1096,9 +1057,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
- (void)testInternalResizing {
const uint32_t kValues[] = { 11U, 12U, 13U, 14U };
GPBUInt32Array *array =
- [GPBUInt32Array arrayWithCapacity:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32Array alloc] initWithValues:kValues
+ count:GPBARRAYSIZE(kValues)];
XCTAssertNotNil(array);
- [array addValues:kValues count:GPBARRAYSIZE(kValues)];
// Add/remove to trigger the intneral buffer to grow/shrink.
for (int i = 0; i < 100; ++i) {
@@ -1115,6 +1076,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertEqual(array.count, 404U);
[array removeAll];
XCTAssertEqual(array.count, 0U);
+ [array release];
}
@end
@@ -1214,8 +1176,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertNotEqual(idx, 0U);
++idx2;
}];
- // Ensure description doesn't choke.
- XCTAssertTrue(array.description.length > 10);
[array release];
}
@@ -1240,10 +1200,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
count:GPBARRAYSIZE(kValues3)];
XCTAssertNotNil(array3);
- // Identity
- XCTAssertTrue([array1 isEqual:array1]);
- // Wrong type doesn't blow up.
- XCTAssertFalse([array1 isEqual:@"bogus"]);
// 1/1Prime should be different objects, but equal.
XCTAssertNotEqual(array1, array1prime);
XCTAssertEqualObjects(array1, array1prime);
@@ -1314,12 +1270,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
[array addValuesFromArray:array2];
XCTAssertEqual(array.count, 5U);
- // Zero/nil inputs do nothing.
- [array addValues:kValues1 count:0];
- XCTAssertEqual(array.count, 5U);
- [array addValues:NULL count:5];
- XCTAssertEqual(array.count, 5U);
-
XCTAssertEqual([array valueAtIndex:0], 31LL);
XCTAssertEqual([array valueAtIndex:1], 32LL);
XCTAssertEqual([array valueAtIndex:2], 33LL);
@@ -1440,9 +1390,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
- (void)testInternalResizing {
const int64_t kValues[] = { 31LL, 32LL, 33LL, 34LL };
GPBInt64Array *array =
- [GPBInt64Array arrayWithCapacity:GPBARRAYSIZE(kValues)];
+ [[GPBInt64Array alloc] initWithValues:kValues
+ count:GPBARRAYSIZE(kValues)];
XCTAssertNotNil(array);
- [array addValues:kValues count:GPBARRAYSIZE(kValues)];
// Add/remove to trigger the intneral buffer to grow/shrink.
for (int i = 0; i < 100; ++i) {
@@ -1459,6 +1409,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertEqual(array.count, 404U);
[array removeAll];
XCTAssertEqual(array.count, 0U);
+ [array release];
}
@end
@@ -1558,8 +1509,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertNotEqual(idx, 0U);
++idx2;
}];
- // Ensure description doesn't choke.
- XCTAssertTrue(array.description.length > 10);
[array release];
}
@@ -1584,10 +1533,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
count:GPBARRAYSIZE(kValues3)];
XCTAssertNotNil(array3);
- // Identity
- XCTAssertTrue([array1 isEqual:array1]);
- // Wrong type doesn't blow up.
- XCTAssertFalse([array1 isEqual:@"bogus"]);
// 1/1Prime should be different objects, but equal.
XCTAssertNotEqual(array1, array1prime);
XCTAssertEqualObjects(array1, array1prime);
@@ -1658,12 +1603,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
[array addValuesFromArray:array2];
XCTAssertEqual(array.count, 5U);
- // Zero/nil inputs do nothing.
- [array addValues:kValues1 count:0];
- XCTAssertEqual(array.count, 5U);
- [array addValues:NULL count:5];
- XCTAssertEqual(array.count, 5U);
-
XCTAssertEqual([array valueAtIndex:0], 41ULL);
XCTAssertEqual([array valueAtIndex:1], 42ULL);
XCTAssertEqual([array valueAtIndex:2], 43ULL);
@@ -1784,9 +1723,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
- (void)testInternalResizing {
const uint64_t kValues[] = { 41ULL, 42ULL, 43ULL, 44ULL };
GPBUInt64Array *array =
- [GPBUInt64Array arrayWithCapacity:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64Array alloc] initWithValues:kValues
+ count:GPBARRAYSIZE(kValues)];
XCTAssertNotNil(array);
- [array addValues:kValues count:GPBARRAYSIZE(kValues)];
// Add/remove to trigger the intneral buffer to grow/shrink.
for (int i = 0; i < 100; ++i) {
@@ -1803,6 +1742,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertEqual(array.count, 404U);
[array removeAll];
XCTAssertEqual(array.count, 0U);
+ [array release];
}
@end
@@ -1902,8 +1842,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertNotEqual(idx, 0U);
++idx2;
}];
- // Ensure description doesn't choke.
- XCTAssertTrue(array.description.length > 10);
[array release];
}
@@ -1928,10 +1866,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
count:GPBARRAYSIZE(kValues3)];
XCTAssertNotNil(array3);
- // Identity
- XCTAssertTrue([array1 isEqual:array1]);
- // Wrong type doesn't blow up.
- XCTAssertFalse([array1 isEqual:@"bogus"]);
// 1/1Prime should be different objects, but equal.
XCTAssertNotEqual(array1, array1prime);
XCTAssertEqualObjects(array1, array1prime);
@@ -2002,12 +1936,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
[array addValuesFromArray:array2];
XCTAssertEqual(array.count, 5U);
- // Zero/nil inputs do nothing.
- [array addValues:kValues1 count:0];
- XCTAssertEqual(array.count, 5U);
- [array addValues:NULL count:5];
- XCTAssertEqual(array.count, 5U);
-
XCTAssertEqual([array valueAtIndex:0], 51.f);
XCTAssertEqual([array valueAtIndex:1], 52.f);
XCTAssertEqual([array valueAtIndex:2], 53.f);
@@ -2128,9 +2056,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
- (void)testInternalResizing {
const float kValues[] = { 51.f, 52.f, 53.f, 54.f };
GPBFloatArray *array =
- [GPBFloatArray arrayWithCapacity:GPBARRAYSIZE(kValues)];
+ [[GPBFloatArray alloc] initWithValues:kValues
+ count:GPBARRAYSIZE(kValues)];
XCTAssertNotNil(array);
- [array addValues:kValues count:GPBARRAYSIZE(kValues)];
// Add/remove to trigger the intneral buffer to grow/shrink.
for (int i = 0; i < 100; ++i) {
@@ -2147,6 +2075,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertEqual(array.count, 404U);
[array removeAll];
XCTAssertEqual(array.count, 0U);
+ [array release];
}
@end
@@ -2246,8 +2175,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertNotEqual(idx, 0U);
++idx2;
}];
- // Ensure description doesn't choke.
- XCTAssertTrue(array.description.length > 10);
[array release];
}
@@ -2272,10 +2199,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
count:GPBARRAYSIZE(kValues3)];
XCTAssertNotNil(array3);
- // Identity
- XCTAssertTrue([array1 isEqual:array1]);
- // Wrong type doesn't blow up.
- XCTAssertFalse([array1 isEqual:@"bogus"]);
// 1/1Prime should be different objects, but equal.
XCTAssertNotEqual(array1, array1prime);
XCTAssertEqualObjects(array1, array1prime);
@@ -2346,12 +2269,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
[array addValuesFromArray:array2];
XCTAssertEqual(array.count, 5U);
- // Zero/nil inputs do nothing.
- [array addValues:kValues1 count:0];
- XCTAssertEqual(array.count, 5U);
- [array addValues:NULL count:5];
- XCTAssertEqual(array.count, 5U);
-
XCTAssertEqual([array valueAtIndex:0], 61.);
XCTAssertEqual([array valueAtIndex:1], 62.);
XCTAssertEqual([array valueAtIndex:2], 63.);
@@ -2472,9 +2389,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
- (void)testInternalResizing {
const double kValues[] = { 61., 62., 63., 64. };
GPBDoubleArray *array =
- [GPBDoubleArray arrayWithCapacity:GPBARRAYSIZE(kValues)];
+ [[GPBDoubleArray alloc] initWithValues:kValues
+ count:GPBARRAYSIZE(kValues)];
XCTAssertNotNil(array);
- [array addValues:kValues count:GPBARRAYSIZE(kValues)];
// Add/remove to trigger the intneral buffer to grow/shrink.
for (int i = 0; i < 100; ++i) {
@@ -2491,6 +2408,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertEqual(array.count, 404U);
[array removeAll];
XCTAssertEqual(array.count, 0U);
+ [array release];
}
@end
@@ -2590,8 +2508,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertNotEqual(idx, 0U);
++idx2;
}];
- // Ensure description doesn't choke.
- XCTAssertTrue(array.description.length > 10);
[array release];
}
@@ -2616,10 +2532,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
count:GPBARRAYSIZE(kValues3)];
XCTAssertNotNil(array3);
- // Identity
- XCTAssertTrue([array1 isEqual:array1]);
- // Wrong type doesn't blow up.
- XCTAssertFalse([array1 isEqual:@"bogus"]);
// 1/1Prime should be different objects, but equal.
XCTAssertNotEqual(array1, array1prime);
XCTAssertEqualObjects(array1, array1prime);
@@ -2690,12 +2602,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
[array addValuesFromArray:array2];
XCTAssertEqual(array.count, 5U);
- // Zero/nil inputs do nothing.
- [array addValues:kValues1 count:0];
- XCTAssertEqual(array.count, 5U);
- [array addValues:NULL count:5];
- XCTAssertEqual(array.count, 5U);
-
XCTAssertEqual([array valueAtIndex:0], TRUE);
XCTAssertEqual([array valueAtIndex:1], TRUE);
XCTAssertEqual([array valueAtIndex:2], FALSE);
@@ -2816,9 +2722,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
- (void)testInternalResizing {
const BOOL kValues[] = { TRUE, TRUE, FALSE, FALSE };
GPBBoolArray *array =
- [GPBBoolArray arrayWithCapacity:GPBARRAYSIZE(kValues)];
+ [[GPBBoolArray alloc] initWithValues:kValues
+ count:GPBARRAYSIZE(kValues)];
XCTAssertNotNil(array);
- [array addValues:kValues count:GPBARRAYSIZE(kValues)];
// Add/remove to trigger the intneral buffer to grow/shrink.
for (int i = 0; i < 100; ++i) {
@@ -2835,6 +2741,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertEqual(array.count, 404U);
[array removeAll];
XCTAssertEqual(array.count, 0U);
+ [array release];
}
@end
@@ -2934,8 +2841,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertNotEqual(idx, 0U);
++idx2;
}];
- // Ensure description doesn't choke.
- XCTAssertTrue(array.description.length > 10);
[array release];
}
@@ -2960,10 +2865,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
count:GPBARRAYSIZE(kValues3)];
XCTAssertNotNil(array3);
- // Identity
- XCTAssertTrue([array1 isEqual:array1]);
- // Wrong type doesn't blow up.
- XCTAssertFalse([array1 isEqual:@"bogus"]);
// 1/1Prime should be different objects, but equal.
XCTAssertNotEqual(array1, array1prime);
XCTAssertEqualObjects(array1, array1prime);
@@ -3034,12 +2935,6 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
[array addRawValuesFromArray:array2];
XCTAssertEqual(array.count, 5U);
- // Zero/nil inputs do nothing.
- [array addValues:kValues1 count:0];
- XCTAssertEqual(array.count, 5U);
- [array addValues:NULL count:5];
- XCTAssertEqual(array.count, 5U);
-
XCTAssertEqual([array valueAtIndex:0], 71);
XCTAssertEqual([array valueAtIndex:1], 72);
XCTAssertEqual([array valueAtIndex:2], 73);
@@ -3160,9 +3055,9 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
- (void)testInternalResizing {
const int32_t kValues[] = { 71, 72, 73, 74 };
GPBEnumArray *array =
- [GPBEnumArray arrayWithCapacity:GPBARRAYSIZE(kValues)];
+ [[GPBEnumArray alloc] initWithValues:kValues
+ count:GPBARRAYSIZE(kValues)];
XCTAssertNotNil(array);
- [array addValues:kValues count:GPBARRAYSIZE(kValues)];
// Add/remove to trigger the intneral buffer to grow/shrink.
for (int i = 0; i < 100; ++i) {
@@ -3179,6 +3074,7 @@ static BOOL TestingEnum_IsValidValue2(int32_t value) {
XCTAssertEqual(array.count, 404U);
[array removeAll];
XCTAssertEqual(array.count, 0U);
+ [array release];
}
@end
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCodedInputStreamTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBCodedInputStreamTests.m
index f5aa69038f..cc40215698 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCodedInputStreamTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBCodedInputStreamTests.m
@@ -62,101 +62,52 @@
#define bytes(...) [self bytes_with_sentinel:0, __VA_ARGS__, 256]
- (void)testDecodeZigZag {
- [self assertReadZigZag32:bytes(0x0) value:0];
- [self assertReadZigZag32:bytes(0x1) value:-1];
- [self assertReadZigZag32:bytes(0x2) value:1];
- [self assertReadZigZag32:bytes(0x3) value:-2];
-
- [self assertReadZigZag32:bytes(0xFE, 0xFF, 0xFF, 0xFF, 0x07) value:(int32_t)0x3FFFFFFF];
- [self assertReadZigZag32:bytes(0xFF, 0xFF, 0xFF, 0xFF, 0x07) value:(int32_t)0xC0000000];
- [self assertReadZigZag32:bytes(0xFE, 0xFF, 0xFF, 0xFF, 0x0F) value:(int32_t)0x7FFFFFFF];
- [self assertReadZigZag32:bytes(0xFF, 0xFF, 0xFF, 0xFF, 0x0F) value:(int32_t)0x80000000];
-
- [self assertReadZigZag64:bytes(0x0) value:0];
- [self assertReadZigZag64:bytes(0x1) value:-1];
- [self assertReadZigZag64:bytes(0x2) value:1];
- [self assertReadZigZag64:bytes(0x3) value:-2];
-
- [self assertReadZigZag64:bytes(0xFE, 0xFF, 0xFF, 0xFF, 0x07) value:(int32_t)0x3FFFFFFF];
- [self assertReadZigZag64:bytes(0xFF, 0xFF, 0xFF, 0xFF, 0x07) value:(int32_t)0xC0000000];
- [self assertReadZigZag64:bytes(0xFE, 0xFF, 0xFF, 0xFF, 0x0F) value:(int32_t)0x7FFFFFFF];
- [self assertReadZigZag64:bytes(0xFF, 0xFF, 0xFF, 0xFF, 0x0F) value:(int32_t)0x80000000];
-
- [self assertReadZigZag64:bytes(0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01) value:0x7FFFFFFFFFFFFFFFL];
- [self assertReadZigZag64:bytes(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01) value:0x8000000000000000L];
+ XCTAssertEqual(0, GPBDecodeZigZag32(0));
+ XCTAssertEqual(-1, GPBDecodeZigZag32(1));
+ XCTAssertEqual(1, GPBDecodeZigZag32(2));
+ XCTAssertEqual(-2, GPBDecodeZigZag32(3));
+ XCTAssertEqual((int32_t)0x3FFFFFFF, GPBDecodeZigZag32(0x7FFFFFFE));
+ XCTAssertEqual((int32_t)0xC0000000, GPBDecodeZigZag32(0x7FFFFFFF));
+ XCTAssertEqual((int32_t)0x7FFFFFFF, GPBDecodeZigZag32(0xFFFFFFFE));
+ XCTAssertEqual((int32_t)0x80000000, GPBDecodeZigZag32(0xFFFFFFFF));
+
+ XCTAssertEqual((int64_t)0, GPBDecodeZigZag64(0));
+ XCTAssertEqual((int64_t)-1, GPBDecodeZigZag64(1));
+ XCTAssertEqual((int64_t)1, GPBDecodeZigZag64(2));
+ XCTAssertEqual((int64_t)-2, GPBDecodeZigZag64(3));
+ XCTAssertEqual((int64_t)0x000000003FFFFFFFL,
+ GPBDecodeZigZag64(0x000000007FFFFFFEL));
+ XCTAssertEqual((int64_t)0xFFFFFFFFC0000000L,
+ GPBDecodeZigZag64(0x000000007FFFFFFFL));
+ XCTAssertEqual((int64_t)0x000000007FFFFFFFL,
+ GPBDecodeZigZag64(0x00000000FFFFFFFEL));
+ XCTAssertEqual((int64_t)0xFFFFFFFF80000000L,
+ GPBDecodeZigZag64(0x00000000FFFFFFFFL));
+ XCTAssertEqual((int64_t)0x7FFFFFFFFFFFFFFFL,
+ GPBDecodeZigZag64(0xFFFFFFFFFFFFFFFEL));
+ XCTAssertEqual((int64_t)0x8000000000000000L,
+ GPBDecodeZigZag64(0xFFFFFFFFFFFFFFFFL));
}
- (void)assertReadVarint:(NSData*)data value:(int64_t)value {
- if (value <= INT32_MAX && value >= INT32_MIN) {
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual((int32_t)value, [input readInt32]);
- }
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual((int32_t)value, [input readEnum]);
- }
- }
- if (value <= UINT32_MAX && value >= 0) {
+ {
GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual((uint32_t)value, [input readUInt32]);
+ XCTAssertEqual((int32_t)value, [input readInt32]);
}
{
GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
XCTAssertEqual(value, [input readInt64]);
}
- if (value >= 0) {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual((uint64_t)value, [input readUInt64]);
- }
}
- (void)assertReadLittleEndian32:(NSData*)data value:(int32_t)value {
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value, [input readSFixed32]);
- }
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(GPBConvertInt32ToFloat(value), [input readFloat]);
- }
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual((uint32_t)value, [input readFixed32]);
- }
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value, [input readSFixed32]);
- }
-}
-
-- (void)assertReadLittleEndian64:(NSData*)data value:(int64_t)value {
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value, [input readSFixed64]);
- }
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(GPBConvertInt64ToDouble(value), [input readDouble]);
- }
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual((uint64_t)value, [input readFixed64]);
- }
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value, [input readSFixed64]);
- }
-}
-
-- (void)assertReadZigZag32:(NSData*)data value:(int64_t)value {
GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual((int32_t)value, [input readSInt32]);
+ XCTAssertEqual(value, [input readSFixed32]);
}
-- (void)assertReadZigZag64:(NSData*)data value:(int64_t)value {
+- (void)assertReadLittleEndian64:(NSData*)data value:(int64_t)value {
GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value, [input readSInt64]);
+ XCTAssertEqual(value, [input readSFixed64]);
}
- (void)assertReadVarintFailure:(NSData*)data {
@@ -177,28 +128,12 @@
XCTAssertEqual(((uint8_t*)data.bytes)[1], (uint8_t)0x74);
}
-- (void)testReadBool {
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:bytes(0x00)];
- XCTAssertEqual(NO, [input readBool]);
- }
- {
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:bytes(0x01)];
- XCTAssertEqual(YES, [input readBool]);
- }
-}
-
- (void)testReadVarint {
[self assertReadVarint:bytes(0x00) value:0];
[self assertReadVarint:bytes(0x01) value:1];
[self assertReadVarint:bytes(0x7f) value:127];
// 14882
[self assertReadVarint:bytes(0xa2, 0x74) value:(0x22 << 0) | (0x74 << 7)];
- // 1904930
- [self assertReadVarint:bytes(0xa2, 0xa2, 0x74) value:(0x22 << 0) | (0x22 << 7) | (0x74 << 14)];
- // 243831074
- [self assertReadVarint:bytes(0xa2, 0xa2, 0xa2, 0x74)
- value:(0x22 << 0) | (0x22 << 7) | (0x22 << 14) | (0x74 << 21)];
// 2961488830
[self assertReadVarint:bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b)
value:(0x3e << 0) | (0x77 << 7) | (0x12 << 14) |
@@ -220,7 +155,7 @@
0xa6, 0x01)
value:(0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) |
(0x3bLL << 28) | (0x56LL << 35) | (0x00LL << 42) |
- (0x05LL << 49) | (0x26LL << 56) | (0x01ULL << 63)];
+ (0x05LL << 49) | (0x26LL << 56) | (0x01LL << 63)];
// Failures
[self assertReadVarintFailure:bytes(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
@@ -228,45 +163,6 @@
[self assertReadVarintFailure:bytes(0x80)];
}
-- (void)testReadVarint32FromVarint64 {
- {
- // Turn on lower 31 bits of the upper half on a 64 bit varint.
- NSData* data = bytes(0x80, 0x80, 0x80, 0x80, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E);
-
- int32_t value32 = 0x0;
- GPBCodedInputStream* input32 = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value32, [input32 readInt32]);
-
- int64_t value64 = INT64_MAX & 0xFFFFFFFF00000000;
- GPBCodedInputStream* input64 = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value64, [input64 readInt64]);
- }
- {
- // Turn on lower 31 bits and lower 31 bits on upper half on a 64 bit varint.
- NSData* data = bytes(0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E);
-
- int32_t value32 = INT32_MAX;
- GPBCodedInputStream* input32 = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value32, [input32 readInt32]);
-
- int64_t value64 = INT64_MAX & 0xFFFFFFFF7FFFFFFF;
- GPBCodedInputStream* input64 = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value64, [input64 readInt64]);
- }
- {
- // Turn on bits 32 and 64 bit on a 64 bit varint.
- NSData* data = bytes(0x80, 0x80, 0x80, 0x80, 0x88, 0x80, 0x80, 0x80, 0x80, 0x01);
-
- int32_t value32 = INT32_MIN;
- GPBCodedInputStream* input32 = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value32, [input32 readInt32]);
-
- int64_t value64 = INT64_MIN | (0x01LL << 31);
- GPBCodedInputStream* input64 = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqual(value64, [input64 readInt64]);
- }
-}
-
- (void)testReadLittleEndian {
[self assertReadLittleEndian32:bytes(0x78, 0x56, 0x34, 0x12)
value:0x12345678];
@@ -369,27 +265,6 @@
XCTAssertThrows([input readBytes]);
}
-- (void)testReadEmptyString {
- NSData *data = bytes(0x00);
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertEqualObjects(@"", [input readString]);
-}
-
-- (void)testInvalidGroupEndTagThrows {
- NSData *data = bytes(0x0B, 0x1A, 0x02, 0x4B, 0x50, 0x14);
- GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
- XCTAssertThrowsSpecificNamed([input skipMessage],
- NSException,
- GPBCodedInputStreamException,
- @"should throw a GPBCodedInputStreamException exception ");
-}
-
-- (void)testBytesWithNegativeSize {
- NSData *data = bytes(0xFF, 0xFF, 0xFF, 0xFF, 0x0F);
- GPBCodedInputStream *input = [GPBCodedInputStream streamWithData:data];
- XCTAssertNil([input readBytes]);
-}
-
// Verifies fix for b/10315336.
// Note: Now that there isn't a custom string class under the hood, this test
// isn't as critical, but it does cover bad input and if a custom class is added
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCodedOuputStreamTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBCodedOuputStreamTests.m
index 109239d5f3..2ad326beb9 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCodedOuputStreamTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBCodedOuputStreamTests.m
@@ -266,7 +266,7 @@
value:(0x1b << 0) | (0x28 << 7) | (0x79 << 14) |
(0x42 << 21) | (0x3bLL << 28) | (0x56LL << 35) |
(0x00LL << 42) | (0x05LL << 49) | (0x26LL << 56) |
- (0x01ULL << 63)];
+ (0x01LL << 63)];
}
- (void)testWriteLittleEndian {
@@ -423,14 +423,4 @@
}
}
-- (void)testThatItThrowsWhenWriteRawPtrFails {
- NSOutputStream *output = [NSOutputStream outputStreamToMemory];
- GPBCodedOutputStream *codedOutput =
- [GPBCodedOutputStream streamWithOutputStream:output bufferSize:0]; // Skip buffering.
- [output close]; // Close the output stream to force failure on write.
- const char *cString = "raw";
- XCTAssertThrowsSpecificNamed([codedOutput writeRawPtr:cString offset:0 length:strlen(cString)],
- NSException, GPBCodedOutputStreamException_WriteFailed);
-}
-
@end
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBConcurrencyTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBConcurrencyTests.m
index daf75e7e72..daf75e7e72 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBConcurrencyTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBConcurrencyTests.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDescriptorTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDescriptorTests.m
index 199ea6557c..1e1c3de8d0 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDescriptorTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDescriptorTests.m
@@ -32,7 +32,7 @@
#import <objc/runtime.h>
-#import "GPBDescriptor_PackagePrivate.h"
+#import "GPBDescriptor.h"
#import "google/protobuf/Unittest.pbobjc.h"
#import "google/protobuf/UnittestObjc.pbobjc.h"
#import "google/protobuf/Descriptor.pbobjc.h"
@@ -83,8 +83,6 @@
XCTAssertNotNil(fieldDescriptorWithNumber.enumDescriptor);
XCTAssertEqualObjects(fieldDescriptorWithNumber.enumDescriptor.name,
@"TestAllTypes_NestedEnum");
- XCTAssertEqual(fieldDescriptorWithName.number, fieldDescriptorWithNumber.number);
- XCTAssertEqual(fieldDescriptorWithName.dataType, GPBDataTypeEnum);
// Foreign Enum
fieldDescriptorWithName = [descriptor fieldWithName:@"optionalForeignEnum"];
@@ -95,8 +93,6 @@
XCTAssertNotNil(fieldDescriptorWithNumber.enumDescriptor);
XCTAssertEqualObjects(fieldDescriptorWithNumber.enumDescriptor.name,
@"ForeignEnum");
- XCTAssertEqual(fieldDescriptorWithName.number, fieldDescriptorWithNumber.number);
- XCTAssertEqual(fieldDescriptorWithName.dataType, GPBDataTypeEnum);
// Import Enum
fieldDescriptorWithName = [descriptor fieldWithName:@"optionalImportEnum"];
@@ -107,8 +103,6 @@
XCTAssertNotNil(fieldDescriptorWithNumber.enumDescriptor);
XCTAssertEqualObjects(fieldDescriptorWithNumber.enumDescriptor.name,
@"ImportEnum");
- XCTAssertEqual(fieldDescriptorWithName.number, fieldDescriptorWithNumber.number);
- XCTAssertEqual(fieldDescriptorWithName.dataType, GPBDataTypeEnum);
// Nested Message
fieldDescriptorWithName = [descriptor fieldWithName:@"optionalNestedMessage"];
@@ -117,8 +111,6 @@
XCTAssertNotNil(fieldDescriptorWithNumber);
XCTAssertEqual(fieldDescriptorWithName, fieldDescriptorWithNumber);
XCTAssertNil(fieldDescriptorWithNumber.enumDescriptor);
- XCTAssertEqual(fieldDescriptorWithName.number, fieldDescriptorWithNumber.number);
- XCTAssertEqual(fieldDescriptorWithName.dataType, GPBDataTypeMessage);
// Foreign Message
fieldDescriptorWithName =
@@ -128,8 +120,6 @@
XCTAssertNotNil(fieldDescriptorWithNumber);
XCTAssertEqual(fieldDescriptorWithName, fieldDescriptorWithNumber);
XCTAssertNil(fieldDescriptorWithNumber.enumDescriptor);
- XCTAssertEqual(fieldDescriptorWithName.number, fieldDescriptorWithNumber.number);
- XCTAssertEqual(fieldDescriptorWithName.dataType, GPBDataTypeMessage);
// Import Message
fieldDescriptorWithName = [descriptor fieldWithName:@"optionalImportMessage"];
@@ -138,12 +128,6 @@
XCTAssertNotNil(fieldDescriptorWithNumber);
XCTAssertEqual(fieldDescriptorWithName, fieldDescriptorWithNumber);
XCTAssertNil(fieldDescriptorWithNumber.enumDescriptor);
- XCTAssertEqual(fieldDescriptorWithName.number, fieldDescriptorWithNumber.number);
- XCTAssertEqual(fieldDescriptorWithName.dataType, GPBDataTypeMessage);
-
- // Some failed lookups.
- XCTAssertNil([descriptor fieldWithName:@"NOT THERE"]);
- XCTAssertNil([descriptor fieldWithNumber:9876543]);
}
- (void)testEnumDescriptor {
@@ -175,7 +159,6 @@
XCTAssertNotNil(enumName);
XCTAssertTrue([descriptor getValue:&value forEnumTextFormatName:@"FOO"]);
XCTAssertEqual(value, TestAllTypes_NestedEnum_Foo);
- XCTAssertNil([descriptor textFormatNameForValue:99999]);
// Bad values
enumName = [descriptor enumNameForValue:0];
@@ -270,102 +253,4 @@
XCTAssertNil(bazString.containingOneof);
}
-- (void)testExtensiondDescriptor {
- Class msgClass = [TestAllExtensions class];
- Class packedMsgClass = [TestPackedExtensions class];
-
- // Int
-
- GPBExtensionDescriptor *descriptor = [UnittestRoot optionalInt32Extension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
- XCTAssertFalse(descriptor.isPackable);
- XCTAssertEqualObjects(descriptor.defaultValue, @0);
- XCTAssertNil(descriptor.enumDescriptor);
-
- descriptor = [UnittestRoot defaultInt32Extension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
- XCTAssertFalse(descriptor.isPackable);
- XCTAssertEqualObjects(descriptor.defaultValue, @41);
- XCTAssertNil(descriptor.enumDescriptor);
-
- // Enum
-
- descriptor = [UnittestRoot optionalNestedEnumExtension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
- XCTAssertFalse(descriptor.isPackable);
- XCTAssertEqual(descriptor.defaultValue, @1);
- XCTAssertEqualObjects(descriptor.enumDescriptor.name, @"TestAllTypes_NestedEnum");
-
- descriptor = [UnittestRoot defaultNestedEnumExtension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
- XCTAssertFalse(descriptor.isPackable);
- XCTAssertEqual(descriptor.defaultValue, @2);
- XCTAssertEqualObjects(descriptor.enumDescriptor.name, @"TestAllTypes_NestedEnum");
-
- // Message
-
- descriptor = [UnittestRoot optionalNestedMessageExtension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
- XCTAssertFalse(descriptor.isPackable);
- XCTAssertNil(descriptor.defaultValue);
- XCTAssertNil(descriptor.enumDescriptor);
-
- // Repeated Int
-
- descriptor = [UnittestRoot repeatedInt32Extension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
- XCTAssertFalse(descriptor.isPackable);
- XCTAssertNil(descriptor.defaultValue);
- XCTAssertNil(descriptor.enumDescriptor);
-
- descriptor = [UnittestRoot packedInt32Extension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, packedMsgClass); // ptr equality
- XCTAssertTrue(descriptor.isPackable);
- XCTAssertNil(descriptor.defaultValue);
- XCTAssertNil(descriptor.enumDescriptor);
-
- // Repeated Enum
-
- descriptor = [UnittestRoot repeatedNestedEnumExtension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
- XCTAssertFalse(descriptor.isPackable);
- XCTAssertNil(descriptor.defaultValue);
- XCTAssertEqualObjects(descriptor.enumDescriptor.name, @"TestAllTypes_NestedEnum");
-
- descriptor = [UnittestRoot packedEnumExtension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, packedMsgClass); // ptr equality
- XCTAssertTrue(descriptor.isPackable);
- XCTAssertNil(descriptor.defaultValue);
- XCTAssertEqualObjects(descriptor.enumDescriptor.name, @"ForeignEnum");
-
- // Repeated Message
-
- descriptor = [UnittestRoot repeatedNestedMessageExtension];
- XCTAssertNotNil(descriptor);
- XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
- XCTAssertFalse(descriptor.isPackable);
- XCTAssertNil(descriptor.defaultValue);
- XCTAssertNil(descriptor.enumDescriptor);
-
- // Compare (used internally for serialization).
-
- GPBExtensionDescriptor *ext1 = [UnittestRoot optionalInt32Extension];
- XCTAssertEqual(ext1.fieldNumber, 1u);
- GPBExtensionDescriptor *ext2 = [UnittestRoot optionalInt64Extension];
- XCTAssertEqual(ext2.fieldNumber, 2u);
-
- XCTAssertEqual([ext1 compareByFieldNumber:ext2], NSOrderedAscending);
- XCTAssertEqual([ext2 compareByFieldNumber:ext1], NSOrderedDescending);
- XCTAssertEqual([ext1 compareByFieldNumber:ext1], NSOrderedSame);
-}
-
@end
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Bool.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Bool.m
index 0af0c815ff..0dbe07b6e9 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Bool.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Bool.m
@@ -63,8 +63,7 @@
}
- (void)testOne {
- GPBBoolUInt32Dictionary *dict = [[GPBBoolUInt32Dictionary alloc] init];
- [dict setUInt32:100U forKey:YES];
+ GPBBoolUInt32Dictionary *dict = [GPBBoolUInt32Dictionary dictionaryWithUInt32:100U forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -77,7 +76,6 @@
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -216,18 +214,17 @@
XCTAssertNotNil(dict);
GPBBoolUInt32Dictionary *dict2 =
- [[GPBBoolUInt32Dictionary alloc] initWithDictionary:dict];
+ [GPBBoolUInt32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBBoolUInt32Dictionary *dict = [GPBBoolUInt32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -252,7 +249,6 @@
XCTAssertTrue([dict getUInt32:&value forKey:NO]);
XCTAssertEqual(value, 101U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -368,8 +364,7 @@
}
- (void)testOne {
- GPBBoolInt32Dictionary *dict = [[GPBBoolInt32Dictionary alloc] init];
- [dict setInt32:200 forKey:YES];
+ GPBBoolInt32Dictionary *dict = [GPBBoolInt32Dictionary dictionaryWithInt32:200 forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -382,7 +377,6 @@
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -521,18 +515,17 @@
XCTAssertNotNil(dict);
GPBBoolInt32Dictionary *dict2 =
- [[GPBBoolInt32Dictionary alloc] initWithDictionary:dict];
+ [GPBBoolInt32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBBoolInt32Dictionary *dict = [GPBBoolInt32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -557,7 +550,6 @@
XCTAssertTrue([dict getInt32:&value forKey:NO]);
XCTAssertEqual(value, 201);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -673,8 +665,7 @@
}
- (void)testOne {
- GPBBoolUInt64Dictionary *dict = [[GPBBoolUInt64Dictionary alloc] init];
- [dict setUInt64:300U forKey:YES];
+ GPBBoolUInt64Dictionary *dict = [GPBBoolUInt64Dictionary dictionaryWithUInt64:300U forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -687,7 +678,6 @@
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -826,18 +816,17 @@
XCTAssertNotNil(dict);
GPBBoolUInt64Dictionary *dict2 =
- [[GPBBoolUInt64Dictionary alloc] initWithDictionary:dict];
+ [GPBBoolUInt64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBBoolUInt64Dictionary *dict = [GPBBoolUInt64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -862,7 +851,6 @@
XCTAssertTrue([dict getUInt64:&value forKey:NO]);
XCTAssertEqual(value, 301U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -978,8 +966,7 @@
}
- (void)testOne {
- GPBBoolInt64Dictionary *dict = [[GPBBoolInt64Dictionary alloc] init];
- [dict setInt64:400 forKey:YES];
+ GPBBoolInt64Dictionary *dict = [GPBBoolInt64Dictionary dictionaryWithInt64:400 forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -992,7 +979,6 @@
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1131,18 +1117,17 @@
XCTAssertNotNil(dict);
GPBBoolInt64Dictionary *dict2 =
- [[GPBBoolInt64Dictionary alloc] initWithDictionary:dict];
+ [GPBBoolInt64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBBoolInt64Dictionary *dict = [GPBBoolInt64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1167,7 +1152,6 @@
XCTAssertTrue([dict getInt64:&value forKey:NO]);
XCTAssertEqual(value, 401);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1283,8 +1267,7 @@
}
- (void)testOne {
- GPBBoolBoolDictionary *dict = [[GPBBoolBoolDictionary alloc] init];
- [dict setBool:NO forKey:YES];
+ GPBBoolBoolDictionary *dict = [GPBBoolBoolDictionary dictionaryWithBool:NO forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1297,7 +1280,6 @@
XCTAssertEqual(aValue, NO);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1436,18 +1418,17 @@
XCTAssertNotNil(dict);
GPBBoolBoolDictionary *dict2 =
- [[GPBBoolBoolDictionary alloc] initWithDictionary:dict];
+ [GPBBoolBoolDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBBoolBoolDictionary *dict = [GPBBoolBoolDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1472,7 +1453,6 @@
XCTAssertTrue([dict getBool:&value forKey:NO]);
XCTAssertEqual(value, YES);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1588,8 +1568,7 @@
}
- (void)testOne {
- GPBBoolFloatDictionary *dict = [[GPBBoolFloatDictionary alloc] init];
- [dict setFloat:500.f forKey:YES];
+ GPBBoolFloatDictionary *dict = [GPBBoolFloatDictionary dictionaryWithFloat:500.f forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1602,7 +1581,6 @@
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1741,18 +1719,17 @@
XCTAssertNotNil(dict);
GPBBoolFloatDictionary *dict2 =
- [[GPBBoolFloatDictionary alloc] initWithDictionary:dict];
+ [GPBBoolFloatDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBBoolFloatDictionary *dict = [GPBBoolFloatDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1777,7 +1754,6 @@
XCTAssertTrue([dict getFloat:&value forKey:NO]);
XCTAssertEqual(value, 501.f);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1893,8 +1869,7 @@
}
- (void)testOne {
- GPBBoolDoubleDictionary *dict = [[GPBBoolDoubleDictionary alloc] init];
- [dict setDouble:600. forKey:YES];
+ GPBBoolDoubleDictionary *dict = [GPBBoolDoubleDictionary dictionaryWithDouble:600. forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -1907,7 +1882,6 @@
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2046,18 +2020,17 @@
XCTAssertNotNil(dict);
GPBBoolDoubleDictionary *dict2 =
- [[GPBBoolDoubleDictionary alloc] initWithDictionary:dict];
+ [GPBBoolDoubleDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBBoolDoubleDictionary *dict = [GPBBoolDoubleDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2082,7 +2055,6 @@
XCTAssertTrue([dict getDouble:&value forKey:NO]);
XCTAssertEqual(value, 601.);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2198,8 +2170,7 @@
}
- (void)testOne {
- GPBBoolObjectDictionary<NSString*> *dict = [[GPBBoolObjectDictionary alloc] init];
- [dict setObject:@"abc" forKey:YES];
+ GPBBoolObjectDictionary<NSString*> *dict = [GPBBoolObjectDictionary dictionaryWithObject:@"abc" forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
@@ -2209,7 +2180,6 @@
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2343,18 +2313,17 @@
XCTAssertNotNil(dict);
GPBBoolObjectDictionary<NSString*> *dict2 =
- [[GPBBoolObjectDictionary alloc] initWithDictionary:dict];
+ [GPBBoolObjectDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBBoolObjectDictionary<NSString*> *dict = [GPBBoolObjectDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2374,7 +2343,6 @@
XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
XCTAssertEqualObjects([dict objectForKey:NO], @"def");
[dict2 release];
- [dict release];
}
- (void)testRemove {
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Int32.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Int32.m
index 4ba30203b8..c539bdc2ed 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Int32.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Int32.m
@@ -45,6 +45,7 @@
// 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;
@@ -63,6 +64,14 @@ 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 {
@@ -94,8 +103,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32UInt32Dictionary *dict = [[GPBInt32UInt32Dictionary alloc] init];
- [dict setUInt32:100U forKey:11];
+ GPBInt32UInt32Dictionary *dict = [GPBInt32UInt32Dictionary dictionaryWithUInt32:100U forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -108,7 +116,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -251,18 +258,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32UInt32Dictionary *dict2 =
- [[GPBInt32UInt32Dictionary alloc] initWithDictionary:dict];
+ [GPBInt32UInt32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32UInt32Dictionary *dict = [GPBInt32UInt32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -293,7 +299,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:14]);
XCTAssertEqual(value, 103U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -455,8 +460,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32Int32Dictionary *dict = [[GPBInt32Int32Dictionary alloc] init];
- [dict setInt32:200 forKey:11];
+ GPBInt32Int32Dictionary *dict = [GPBInt32Int32Dictionary dictionaryWithInt32:200 forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -469,7 +473,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -612,18 +615,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32Int32Dictionary *dict2 =
- [[GPBInt32Int32Dictionary alloc] initWithDictionary:dict];
+ [GPBInt32Int32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32Int32Dictionary *dict = [GPBInt32Int32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -654,7 +656,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:14]);
XCTAssertEqual(value, 203);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -816,8 +817,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32UInt64Dictionary *dict = [[GPBInt32UInt64Dictionary alloc] init];
- [dict setUInt64:300U forKey:11];
+ GPBInt32UInt64Dictionary *dict = [GPBInt32UInt64Dictionary dictionaryWithUInt64:300U forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,7 +830,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -973,18 +972,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32UInt64Dictionary *dict2 =
- [[GPBInt32UInt64Dictionary alloc] initWithDictionary:dict];
+ [GPBInt32UInt64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32UInt64Dictionary *dict = [GPBInt32UInt64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1015,7 +1013,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:14]);
XCTAssertEqual(value, 303U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1177,8 +1174,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32Int64Dictionary *dict = [[GPBInt32Int64Dictionary alloc] init];
- [dict setInt64:400 forKey:11];
+ GPBInt32Int64Dictionary *dict = [GPBInt32Int64Dictionary dictionaryWithInt64:400 forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1191,7 +1187,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1334,18 +1329,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32Int64Dictionary *dict2 =
- [[GPBInt32Int64Dictionary alloc] initWithDictionary:dict];
+ [GPBInt32Int64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32Int64Dictionary *dict = [GPBInt32Int64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1376,7 +1370,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:14]);
XCTAssertEqual(value, 403);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1538,8 +1531,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32BoolDictionary *dict = [[GPBInt32BoolDictionary alloc] init];
- [dict setBool:YES forKey:11];
+ GPBInt32BoolDictionary *dict = [GPBInt32BoolDictionary dictionaryWithBool:YES forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1552,7 +1544,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1695,18 +1686,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32BoolDictionary *dict2 =
- [[GPBInt32BoolDictionary alloc] initWithDictionary:dict];
+ [GPBInt32BoolDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32BoolDictionary *dict = [GPBInt32BoolDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1737,7 +1727,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:14]);
XCTAssertEqual(value, NO);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1899,8 +1888,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32FloatDictionary *dict = [[GPBInt32FloatDictionary alloc] init];
- [dict setFloat:500.f forKey:11];
+ GPBInt32FloatDictionary *dict = [GPBInt32FloatDictionary dictionaryWithFloat:500.f forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1913,7 +1901,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2056,18 +2043,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32FloatDictionary *dict2 =
- [[GPBInt32FloatDictionary alloc] initWithDictionary:dict];
+ [GPBInt32FloatDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32FloatDictionary *dict = [GPBInt32FloatDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2098,7 +2084,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:14]);
XCTAssertEqual(value, 503.f);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2260,8 +2245,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32DoubleDictionary *dict = [[GPBInt32DoubleDictionary alloc] init];
- [dict setDouble:600. forKey:11];
+ GPBInt32DoubleDictionary *dict = [GPBInt32DoubleDictionary dictionaryWithDouble:600. forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2274,7 +2258,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2417,18 +2400,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32DoubleDictionary *dict2 =
- [[GPBInt32DoubleDictionary alloc] initWithDictionary:dict];
+ [GPBInt32DoubleDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32DoubleDictionary *dict = [GPBInt32DoubleDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2459,7 +2441,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:14]);
XCTAssertEqual(value, 603.);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2621,8 +2602,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32EnumDictionary *dict = [[GPBInt32EnumDictionary alloc] init];
- [dict setEnum:700 forKey:11];
+ GPBInt32EnumDictionary *dict = [GPBInt32EnumDictionary dictionaryWithEnum:700 forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2635,7 +2615,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2778,18 +2757,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32EnumDictionary *dict2 =
- [[GPBInt32EnumDictionary alloc] initWithDictionary:dict];
+ [GPBInt32EnumDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32EnumDictionary *dict = [GPBInt32EnumDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2820,7 +2798,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:14]);
XCTAssertEqual(value, 703);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -3143,20 +3120,19 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32EnumDictionary *dict2 =
- [[GPBInt32EnumDictionary alloc] initWithDictionary:dict];
+ [GPBInt32EnumDictionary dictionaryWithDictionary: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 alloc] initWithValidationFunction:TestingEnum_IsValidValue];
+ [GPBInt32EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3196,7 +3172,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:14]);
XCTAssertEqual(value, 803);
[dict2 release];
- [dict release];
}
- (void)testUnknownRemove {
@@ -3400,8 +3375,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32ObjectDictionary<NSString*> *dict = [[GPBInt32ObjectDictionary alloc] init];
- [dict setObject:@"abc" forKey:11];
+ GPBInt32ObjectDictionary<NSString*> *dict = [GPBInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:11], @"abc");
@@ -3411,7 +3385,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -3547,18 +3520,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32ObjectDictionary<NSString*> *dict2 =
- [[GPBInt32ObjectDictionary alloc] initWithDictionary:dict];
+ [GPBInt32ObjectDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt32ObjectDictionary<NSString*> *dict = [GPBInt32ObjectDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3580,7 +3552,6 @@ 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/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Int64.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Int64.m
index 966024b71b..b90cdf8c02 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+Int64.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+Int64.m
@@ -45,6 +45,7 @@
// 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;
@@ -63,6 +64,14 @@ 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 {
@@ -94,8 +103,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64UInt32Dictionary *dict = [[GPBInt64UInt32Dictionary alloc] init];
- [dict setUInt32:100U forKey:21LL];
+ GPBInt64UInt32Dictionary *dict = [GPBInt64UInt32Dictionary dictionaryWithUInt32:100U forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -108,7 +116,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -251,18 +258,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64UInt32Dictionary *dict2 =
- [[GPBInt64UInt32Dictionary alloc] initWithDictionary:dict];
+ [GPBInt64UInt32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64UInt32Dictionary *dict = [GPBInt64UInt32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -293,7 +299,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:24LL]);
XCTAssertEqual(value, 103U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -455,8 +460,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64Int32Dictionary *dict = [[GPBInt64Int32Dictionary alloc] init];
- [dict setInt32:200 forKey:21LL];
+ GPBInt64Int32Dictionary *dict = [GPBInt64Int32Dictionary dictionaryWithInt32:200 forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -469,7 +473,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -612,18 +615,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64Int32Dictionary *dict2 =
- [[GPBInt64Int32Dictionary alloc] initWithDictionary:dict];
+ [GPBInt64Int32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64Int32Dictionary *dict = [GPBInt64Int32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -654,7 +656,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:24LL]);
XCTAssertEqual(value, 203);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -816,8 +817,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64UInt64Dictionary *dict = [[GPBInt64UInt64Dictionary alloc] init];
- [dict setUInt64:300U forKey:21LL];
+ GPBInt64UInt64Dictionary *dict = [GPBInt64UInt64Dictionary dictionaryWithUInt64:300U forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,7 +830,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -973,18 +972,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64UInt64Dictionary *dict2 =
- [[GPBInt64UInt64Dictionary alloc] initWithDictionary:dict];
+ [GPBInt64UInt64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64UInt64Dictionary *dict = [GPBInt64UInt64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1015,7 +1013,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:24LL]);
XCTAssertEqual(value, 303U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1177,8 +1174,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64Int64Dictionary *dict = [[GPBInt64Int64Dictionary alloc] init];
- [dict setInt64:400 forKey:21LL];
+ GPBInt64Int64Dictionary *dict = [GPBInt64Int64Dictionary dictionaryWithInt64:400 forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1191,7 +1187,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1334,18 +1329,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64Int64Dictionary *dict2 =
- [[GPBInt64Int64Dictionary alloc] initWithDictionary:dict];
+ [GPBInt64Int64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64Int64Dictionary *dict = [GPBInt64Int64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1376,7 +1370,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:24LL]);
XCTAssertEqual(value, 403);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1538,8 +1531,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64BoolDictionary *dict = [[GPBInt64BoolDictionary alloc] init];
- [dict setBool:YES forKey:21LL];
+ GPBInt64BoolDictionary *dict = [GPBInt64BoolDictionary dictionaryWithBool:YES forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1552,7 +1544,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1695,18 +1686,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64BoolDictionary *dict2 =
- [[GPBInt64BoolDictionary alloc] initWithDictionary:dict];
+ [GPBInt64BoolDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64BoolDictionary *dict = [GPBInt64BoolDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1737,7 +1727,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:24LL]);
XCTAssertEqual(value, NO);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1899,8 +1888,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64FloatDictionary *dict = [[GPBInt64FloatDictionary alloc] init];
- [dict setFloat:500.f forKey:21LL];
+ GPBInt64FloatDictionary *dict = [GPBInt64FloatDictionary dictionaryWithFloat:500.f forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1913,7 +1901,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2056,18 +2043,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64FloatDictionary *dict2 =
- [[GPBInt64FloatDictionary alloc] initWithDictionary:dict];
+ [GPBInt64FloatDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64FloatDictionary *dict = [GPBInt64FloatDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2098,7 +2084,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:24LL]);
XCTAssertEqual(value, 503.f);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2260,8 +2245,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64DoubleDictionary *dict = [[GPBInt64DoubleDictionary alloc] init];
- [dict setDouble:600. forKey:21LL];
+ GPBInt64DoubleDictionary *dict = [GPBInt64DoubleDictionary dictionaryWithDouble:600. forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2274,7 +2258,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2417,18 +2400,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64DoubleDictionary *dict2 =
- [[GPBInt64DoubleDictionary alloc] initWithDictionary:dict];
+ [GPBInt64DoubleDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64DoubleDictionary *dict = [GPBInt64DoubleDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2459,7 +2441,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:24LL]);
XCTAssertEqual(value, 603.);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2621,8 +2602,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64EnumDictionary *dict = [[GPBInt64EnumDictionary alloc] init];
- [dict setEnum:700 forKey:21LL];
+ GPBInt64EnumDictionary *dict = [GPBInt64EnumDictionary dictionaryWithEnum:700 forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2635,7 +2615,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2778,18 +2757,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64EnumDictionary *dict2 =
- [[GPBInt64EnumDictionary alloc] initWithDictionary:dict];
+ [GPBInt64EnumDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64EnumDictionary *dict = [GPBInt64EnumDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2820,7 +2798,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:24LL]);
XCTAssertEqual(value, 703);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -3143,20 +3120,19 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64EnumDictionary *dict2 =
- [[GPBInt64EnumDictionary alloc] initWithDictionary:dict];
+ [GPBInt64EnumDictionary dictionaryWithDictionary: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 alloc] initWithValidationFunction:TestingEnum_IsValidValue];
+ [GPBInt64EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3196,7 +3172,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:24LL]);
XCTAssertEqual(value, 803);
[dict2 release];
- [dict release];
}
- (void)testUnknownRemove {
@@ -3400,8 +3375,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64ObjectDictionary<NSString*> *dict = [[GPBInt64ObjectDictionary alloc] init];
- [dict setObject:@"abc" forKey:21LL];
+ GPBInt64ObjectDictionary<NSString*> *dict = [GPBInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
@@ -3411,7 +3385,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -3547,18 +3520,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64ObjectDictionary<NSString*> *dict2 =
- [[GPBInt64ObjectDictionary alloc] initWithDictionary:dict];
+ [GPBInt64ObjectDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBInt64ObjectDictionary<NSString*> *dict = [GPBInt64ObjectDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3580,7 +3552,6 @@ 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/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+String.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+String.m
index 82d7952b07..5df1d51d59 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+String.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+String.m
@@ -45,6 +45,7 @@
// 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;
@@ -63,6 +64,14 @@ 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 {
@@ -94,8 +103,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringUInt32Dictionary *dict = [[GPBStringUInt32Dictionary alloc] init];
- [dict setUInt32:100U forKey:@"foo"];
+ GPBStringUInt32Dictionary *dict = [GPBStringUInt32Dictionary dictionaryWithUInt32:100U forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -108,7 +116,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -251,18 +258,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringUInt32Dictionary *dict2 =
- [[GPBStringUInt32Dictionary alloc] initWithDictionary:dict];
+ [GPBStringUInt32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBStringUInt32Dictionary *dict = [GPBStringUInt32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -293,7 +299,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:@"mumble"]);
XCTAssertEqual(value, 103U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -455,8 +460,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringInt32Dictionary *dict = [[GPBStringInt32Dictionary alloc] init];
- [dict setInt32:200 forKey:@"foo"];
+ GPBStringInt32Dictionary *dict = [GPBStringInt32Dictionary dictionaryWithInt32:200 forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -469,7 +473,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -612,18 +615,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringInt32Dictionary *dict2 =
- [[GPBStringInt32Dictionary alloc] initWithDictionary:dict];
+ [GPBStringInt32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBStringInt32Dictionary *dict = [GPBStringInt32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -654,7 +656,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:@"mumble"]);
XCTAssertEqual(value, 203);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -816,8 +817,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringUInt64Dictionary *dict = [[GPBStringUInt64Dictionary alloc] init];
- [dict setUInt64:300U forKey:@"foo"];
+ GPBStringUInt64Dictionary *dict = [GPBStringUInt64Dictionary dictionaryWithUInt64:300U forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,7 +830,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -973,18 +972,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringUInt64Dictionary *dict2 =
- [[GPBStringUInt64Dictionary alloc] initWithDictionary:dict];
+ [GPBStringUInt64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBStringUInt64Dictionary *dict = [GPBStringUInt64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1015,7 +1013,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:@"mumble"]);
XCTAssertEqual(value, 303U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1177,8 +1174,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringInt64Dictionary *dict = [[GPBStringInt64Dictionary alloc] init];
- [dict setInt64:400 forKey:@"foo"];
+ GPBStringInt64Dictionary *dict = [GPBStringInt64Dictionary dictionaryWithInt64:400 forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1191,7 +1187,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1334,18 +1329,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringInt64Dictionary *dict2 =
- [[GPBStringInt64Dictionary alloc] initWithDictionary:dict];
+ [GPBStringInt64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBStringInt64Dictionary *dict = [GPBStringInt64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1376,7 +1370,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:@"mumble"]);
XCTAssertEqual(value, 403);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1538,8 +1531,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringBoolDictionary *dict = [[GPBStringBoolDictionary alloc] init];
- [dict setBool:YES forKey:@"foo"];
+ GPBStringBoolDictionary *dict = [GPBStringBoolDictionary dictionaryWithBool:YES forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1552,7 +1544,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1695,18 +1686,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringBoolDictionary *dict2 =
- [[GPBStringBoolDictionary alloc] initWithDictionary:dict];
+ [GPBStringBoolDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBStringBoolDictionary *dict = [GPBStringBoolDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1737,7 +1727,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:@"mumble"]);
XCTAssertEqual(value, NO);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1899,8 +1888,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringFloatDictionary *dict = [[GPBStringFloatDictionary alloc] init];
- [dict setFloat:500.f forKey:@"foo"];
+ GPBStringFloatDictionary *dict = [GPBStringFloatDictionary dictionaryWithFloat:500.f forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1913,7 +1901,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2056,18 +2043,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringFloatDictionary *dict2 =
- [[GPBStringFloatDictionary alloc] initWithDictionary:dict];
+ [GPBStringFloatDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBStringFloatDictionary *dict = [GPBStringFloatDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2098,7 +2084,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:@"mumble"]);
XCTAssertEqual(value, 503.f);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2260,8 +2245,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringDoubleDictionary *dict = [[GPBStringDoubleDictionary alloc] init];
- [dict setDouble:600. forKey:@"foo"];
+ GPBStringDoubleDictionary *dict = [GPBStringDoubleDictionary dictionaryWithDouble:600. forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2274,7 +2258,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2417,18 +2400,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringDoubleDictionary *dict2 =
- [[GPBStringDoubleDictionary alloc] initWithDictionary:dict];
+ [GPBStringDoubleDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBStringDoubleDictionary *dict = [GPBStringDoubleDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2459,7 +2441,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:@"mumble"]);
XCTAssertEqual(value, 603.);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2621,8 +2602,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringEnumDictionary *dict = [[GPBStringEnumDictionary alloc] init];
- [dict setEnum:700 forKey:@"foo"];
+ GPBStringEnumDictionary *dict = [GPBStringEnumDictionary dictionaryWithEnum:700 forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2635,7 +2615,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2778,18 +2757,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringEnumDictionary *dict2 =
- [[GPBStringEnumDictionary alloc] initWithDictionary:dict];
+ [GPBStringEnumDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBStringEnumDictionary *dict = [GPBStringEnumDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2820,7 +2798,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:@"mumble"]);
XCTAssertEqual(value, 703);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -3143,20 +3120,19 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringEnumDictionary *dict2 =
- [[GPBStringEnumDictionary alloc] initWithDictionary:dict];
+ [GPBStringEnumDictionary dictionaryWithDictionary: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 alloc] initWithValidationFunction:TestingEnum_IsValidValue];
+ [GPBStringEnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3196,7 +3172,6 @@ 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/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+UInt32.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+UInt32.m
index 5314c58aa5..1d3f6f78b0 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+UInt32.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+UInt32.m
@@ -45,6 +45,7 @@
// 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;
@@ -63,6 +64,14 @@ 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 {
@@ -94,8 +103,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32UInt32Dictionary *dict = [[GPBUInt32UInt32Dictionary alloc] init];
- [dict setUInt32:100U forKey:1U];
+ GPBUInt32UInt32Dictionary *dict = [GPBUInt32UInt32Dictionary dictionaryWithUInt32:100U forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -108,7 +116,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -251,18 +258,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32UInt32Dictionary *dict2 =
- [[GPBUInt32UInt32Dictionary alloc] initWithDictionary:dict];
+ [GPBUInt32UInt32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32UInt32Dictionary *dict = [GPBUInt32UInt32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -293,7 +299,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:4U]);
XCTAssertEqual(value, 103U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -455,8 +460,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32Int32Dictionary *dict = [[GPBUInt32Int32Dictionary alloc] init];
- [dict setInt32:200 forKey:1U];
+ GPBUInt32Int32Dictionary *dict = [GPBUInt32Int32Dictionary dictionaryWithInt32:200 forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -469,7 +473,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -612,18 +615,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32Int32Dictionary *dict2 =
- [[GPBUInt32Int32Dictionary alloc] initWithDictionary:dict];
+ [GPBUInt32Int32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32Int32Dictionary *dict = [GPBUInt32Int32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -654,7 +656,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:4U]);
XCTAssertEqual(value, 203);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -816,8 +817,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32UInt64Dictionary *dict = [[GPBUInt32UInt64Dictionary alloc] init];
- [dict setUInt64:300U forKey:1U];
+ GPBUInt32UInt64Dictionary *dict = [GPBUInt32UInt64Dictionary dictionaryWithUInt64:300U forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,7 +830,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -973,18 +972,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32UInt64Dictionary *dict2 =
- [[GPBUInt32UInt64Dictionary alloc] initWithDictionary:dict];
+ [GPBUInt32UInt64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32UInt64Dictionary *dict = [GPBUInt32UInt64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1015,7 +1013,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:4U]);
XCTAssertEqual(value, 303U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1177,8 +1174,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32Int64Dictionary *dict = [[GPBUInt32Int64Dictionary alloc] init];
- [dict setInt64:400 forKey:1U];
+ GPBUInt32Int64Dictionary *dict = [GPBUInt32Int64Dictionary dictionaryWithInt64:400 forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1191,7 +1187,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1334,18 +1329,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32Int64Dictionary *dict2 =
- [[GPBUInt32Int64Dictionary alloc] initWithDictionary:dict];
+ [GPBUInt32Int64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32Int64Dictionary *dict = [GPBUInt32Int64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1376,7 +1370,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:4U]);
XCTAssertEqual(value, 403);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1538,8 +1531,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32BoolDictionary *dict = [[GPBUInt32BoolDictionary alloc] init];
- [dict setBool:YES forKey:1U];
+ GPBUInt32BoolDictionary *dict = [GPBUInt32BoolDictionary dictionaryWithBool:YES forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1552,7 +1544,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1695,18 +1686,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32BoolDictionary *dict2 =
- [[GPBUInt32BoolDictionary alloc] initWithDictionary:dict];
+ [GPBUInt32BoolDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32BoolDictionary *dict = [GPBUInt32BoolDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1737,7 +1727,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:4U]);
XCTAssertEqual(value, NO);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1899,8 +1888,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32FloatDictionary *dict = [[GPBUInt32FloatDictionary alloc] init];
- [dict setFloat:500.f forKey:1U];
+ GPBUInt32FloatDictionary *dict = [GPBUInt32FloatDictionary dictionaryWithFloat:500.f forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1913,7 +1901,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2056,18 +2043,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32FloatDictionary *dict2 =
- [[GPBUInt32FloatDictionary alloc] initWithDictionary:dict];
+ [GPBUInt32FloatDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32FloatDictionary *dict = [GPBUInt32FloatDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2098,7 +2084,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:4U]);
XCTAssertEqual(value, 503.f);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2260,8 +2245,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32DoubleDictionary *dict = [[GPBUInt32DoubleDictionary alloc] init];
- [dict setDouble:600. forKey:1U];
+ GPBUInt32DoubleDictionary *dict = [GPBUInt32DoubleDictionary dictionaryWithDouble:600. forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2274,7 +2258,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2417,18 +2400,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32DoubleDictionary *dict2 =
- [[GPBUInt32DoubleDictionary alloc] initWithDictionary:dict];
+ [GPBUInt32DoubleDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32DoubleDictionary *dict = [GPBUInt32DoubleDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2459,7 +2441,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:4U]);
XCTAssertEqual(value, 603.);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2621,8 +2602,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32EnumDictionary *dict = [[GPBUInt32EnumDictionary alloc] init];
- [dict setEnum:700 forKey:1U];
+ GPBUInt32EnumDictionary *dict = [GPBUInt32EnumDictionary dictionaryWithEnum:700 forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2635,7 +2615,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2778,18 +2757,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32EnumDictionary *dict2 =
- [[GPBUInt32EnumDictionary alloc] initWithDictionary:dict];
+ [GPBUInt32EnumDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32EnumDictionary *dict = [GPBUInt32EnumDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2820,7 +2798,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:4U]);
XCTAssertEqual(value, 703);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -3143,20 +3120,19 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32EnumDictionary *dict2 =
- [[GPBUInt32EnumDictionary alloc] initWithDictionary:dict];
+ [GPBUInt32EnumDictionary dictionaryWithDictionary: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 alloc] initWithValidationFunction:TestingEnum_IsValidValue];
+ [GPBUInt32EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3196,7 +3172,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:4U]);
XCTAssertEqual(value, 803);
[dict2 release];
- [dict release];
}
- (void)testUnknownRemove {
@@ -3400,8 +3375,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32ObjectDictionary<NSString*> *dict = [[GPBUInt32ObjectDictionary alloc] init];
- [dict setObject:@"abc" forKey:1U];
+ GPBUInt32ObjectDictionary<NSString*> *dict = [GPBUInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
@@ -3411,7 +3385,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -3547,18 +3520,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32ObjectDictionary<NSString*> *dict2 =
- [[GPBUInt32ObjectDictionary alloc] initWithDictionary:dict];
+ [GPBUInt32ObjectDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt32ObjectDictionary<NSString*> *dict = [GPBUInt32ObjectDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3580,7 +3552,6 @@ 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/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+UInt64.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+UInt64.m
index ccd063f5f7..94c116f67f 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests+UInt64.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests+UInt64.m
@@ -45,6 +45,7 @@
// 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;
@@ -63,6 +64,14 @@ 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 {
@@ -94,8 +103,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64UInt32Dictionary *dict = [[GPBUInt64UInt32Dictionary alloc] init];
- [dict setUInt32:100U forKey:31ULL];
+ GPBUInt64UInt32Dictionary *dict = [GPBUInt64UInt32Dictionary dictionaryWithUInt32:100U forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -108,7 +116,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -251,18 +258,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64UInt32Dictionary *dict2 =
- [[GPBUInt64UInt32Dictionary alloc] initWithDictionary:dict];
+ [GPBUInt64UInt32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64UInt32Dictionary *dict = [GPBUInt64UInt32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -293,7 +299,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:34ULL]);
XCTAssertEqual(value, 103U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -455,8 +460,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64Int32Dictionary *dict = [[GPBUInt64Int32Dictionary alloc] init];
- [dict setInt32:200 forKey:31ULL];
+ GPBUInt64Int32Dictionary *dict = [GPBUInt64Int32Dictionary dictionaryWithInt32:200 forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -469,7 +473,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -612,18 +615,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64Int32Dictionary *dict2 =
- [[GPBUInt64Int32Dictionary alloc] initWithDictionary:dict];
+ [GPBUInt64Int32Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64Int32Dictionary *dict = [GPBUInt64Int32Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -654,7 +656,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:34ULL]);
XCTAssertEqual(value, 203);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -816,8 +817,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64UInt64Dictionary *dict = [[GPBUInt64UInt64Dictionary alloc] init];
- [dict setUInt64:300U forKey:31ULL];
+ GPBUInt64UInt64Dictionary *dict = [GPBUInt64UInt64Dictionary dictionaryWithUInt64:300U forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,7 +830,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -973,18 +972,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64UInt64Dictionary *dict2 =
- [[GPBUInt64UInt64Dictionary alloc] initWithDictionary:dict];
+ [GPBUInt64UInt64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64UInt64Dictionary *dict = [GPBUInt64UInt64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1015,7 +1013,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:34ULL]);
XCTAssertEqual(value, 303U);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1177,8 +1174,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64Int64Dictionary *dict = [[GPBUInt64Int64Dictionary alloc] init];
- [dict setInt64:400 forKey:31ULL];
+ GPBUInt64Int64Dictionary *dict = [GPBUInt64Int64Dictionary dictionaryWithInt64:400 forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1191,7 +1187,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1334,18 +1329,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64Int64Dictionary *dict2 =
- [[GPBUInt64Int64Dictionary alloc] initWithDictionary:dict];
+ [GPBUInt64Int64Dictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64Int64Dictionary *dict = [GPBUInt64Int64Dictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1376,7 +1370,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:34ULL]);
XCTAssertEqual(value, 403);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1538,8 +1531,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64BoolDictionary *dict = [[GPBUInt64BoolDictionary alloc] init];
- [dict setBool:YES forKey:31ULL];
+ GPBUInt64BoolDictionary *dict = [GPBUInt64BoolDictionary dictionaryWithBool:YES forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1552,7 +1544,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -1695,18 +1686,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64BoolDictionary *dict2 =
- [[GPBUInt64BoolDictionary alloc] initWithDictionary:dict];
+ [GPBUInt64BoolDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64BoolDictionary *dict = [GPBUInt64BoolDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1737,7 +1727,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:34ULL]);
XCTAssertEqual(value, NO);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -1899,8 +1888,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64FloatDictionary *dict = [[GPBUInt64FloatDictionary alloc] init];
- [dict setFloat:500.f forKey:31ULL];
+ GPBUInt64FloatDictionary *dict = [GPBUInt64FloatDictionary dictionaryWithFloat:500.f forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1913,7 +1901,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2056,18 +2043,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64FloatDictionary *dict2 =
- [[GPBUInt64FloatDictionary alloc] initWithDictionary:dict];
+ [GPBUInt64FloatDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64FloatDictionary *dict = [GPBUInt64FloatDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2098,7 +2084,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:34ULL]);
XCTAssertEqual(value, 503.f);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2260,8 +2245,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64DoubleDictionary *dict = [[GPBUInt64DoubleDictionary alloc] init];
- [dict setDouble:600. forKey:31ULL];
+ GPBUInt64DoubleDictionary *dict = [GPBUInt64DoubleDictionary dictionaryWithDouble:600. forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2274,7 +2258,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2417,18 +2400,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64DoubleDictionary *dict2 =
- [[GPBUInt64DoubleDictionary alloc] initWithDictionary:dict];
+ [GPBUInt64DoubleDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64DoubleDictionary *dict = [GPBUInt64DoubleDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2459,7 +2441,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:34ULL]);
XCTAssertEqual(value, 603.);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -2621,8 +2602,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64EnumDictionary *dict = [[GPBUInt64EnumDictionary alloc] init];
- [dict setEnum:700 forKey:31ULL];
+ GPBUInt64EnumDictionary *dict = [GPBUInt64EnumDictionary dictionaryWithEnum:700 forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2635,7 +2615,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -2778,18 +2757,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64EnumDictionary *dict2 =
- [[GPBUInt64EnumDictionary alloc] initWithDictionary:dict];
+ [GPBUInt64EnumDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64EnumDictionary *dict = [GPBUInt64EnumDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2820,7 +2798,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:34ULL]);
XCTAssertEqual(value, 703);
[dict2 release];
- [dict release];
}
- (void)testRemove {
@@ -3143,20 +3120,19 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64EnumDictionary *dict2 =
- [[GPBUInt64EnumDictionary alloc] initWithDictionary:dict];
+ [GPBUInt64EnumDictionary dictionaryWithDictionary: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 alloc] initWithValidationFunction:TestingEnum_IsValidValue];
+ [GPBUInt64EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3196,7 +3172,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:34ULL]);
XCTAssertEqual(value, 803);
[dict2 release];
- [dict release];
}
- (void)testUnknownRemove {
@@ -3400,8 +3375,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64ObjectDictionary<NSString*> *dict = [[GPBUInt64ObjectDictionary alloc] init];
- [dict setObject:@"abc" forKey:31ULL];
+ GPBUInt64ObjectDictionary<NSString*> *dict = [GPBUInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
@@ -3411,7 +3385,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
- [dict release];
}
- (void)testBasics {
@@ -3547,18 +3520,17 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64ObjectDictionary<NSString*> *dict2 =
- [[GPBUInt64ObjectDictionary alloc] initWithDictionary:dict];
+ [GPBUInt64ObjectDictionary dictionaryWithDictionary: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 alloc] init];
+ GPBUInt64ObjectDictionary<NSString*> *dict = [GPBUInt64ObjectDictionary dictionary];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3580,7 +3552,6 @@ 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/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests.m
index 52b4b32806..52b4b32806 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests.pddm b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests.pddm
index 17f12c28f0..d6aa721190 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBDictionaryTests.pddm
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBDictionaryTests.pddm
@@ -78,8 +78,7 @@
//%}
//%
//%- (void)testOne {
-//% 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];
+//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##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)
@@ -89,7 +88,6 @@
//% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1);
//% XCTAssertNotEqual(stop, NULL);
//% }];
-//% [dict release];
//%}
//%
//%- (void)testBasics {
@@ -225,18 +223,17 @@
//% XCTAssertNotNil(dict);
//%
//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict];
+//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary: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 alloc] init];
+//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionary];
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
@@ -258,7 +255,6 @@
//%TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY3, VAL3)
//%TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY4, VAL4)
//% [dict2 release];
-//% [dict release];
//%}
//%
//%- (void)testRemove {
@@ -526,20 +522,19 @@
//% XCTAssertNotNil(dict);
//%
//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict];
+//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary: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 alloc] initWithValidationFunction:TestingEnum_IsValidValue];
+//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
@@ -566,7 +561,6 @@
//%TEST_VALUE##VHELPER(VALUE_NAME, dict, value, KEY4, kGPBUnrecognizedEnumeratorValue)
//%TEST_RAW_VALUE##VHELPER(dict, value, KEY4, VAL4)
//% [dict2 release];
-//% [dict release];
//%}
//%
//%- (void)testUnknownRemove {
@@ -735,6 +729,7 @@
//%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;
@@ -753,6 +748,14 @@
//%}
//%
//%@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 {
@@ -798,8 +801,7 @@
//%}
//%
//%- (void)testOne {
-//% 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];
+//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##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)
@@ -809,7 +811,6 @@
//% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1);
//% XCTAssertNotEqual(stop, NULL);
//% }];
-//% [dict release];
//%}
//%
//%- (void)testBasics {
@@ -943,18 +944,17 @@
//% XCTAssertNotNil(dict);
//%
//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict];
+//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary: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 alloc] init];
+//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionary];
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
@@ -974,7 +974,6 @@
//%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/third_party/protobuf/3.6.0/objectivec/Tests/GPBExtensionRegistryTest.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBExtensionRegistryTest.m
index b1168826f8..b1168826f8 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBExtensionRegistryTest.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBExtensionRegistryTest.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Merge.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Merge.m
index c0bd5897a4..c0bd5897a4 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Merge.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Merge.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Runtime.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Runtime.m
index 0058311b3b..0058311b3b 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Runtime.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Runtime.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Serialization.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Serialization.m
index 921feab73a..4a4c54476a 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests+Serialization.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests+Serialization.m
@@ -42,6 +42,10 @@
#import "google/protobuf/UnittestRuntimeProto2.pbobjc.h"
#import "google/protobuf/UnittestRuntimeProto3.pbobjc.h"
+static NSData *DataFromCStr(const char *str) {
+ return [NSData dataWithBytes:str length:strlen(str)];
+}
+
@interface MessageSerializationTests : GPBTestCase
@end
@@ -976,16 +980,6 @@
XCTAssertEqual(error.code, GPBCodedInputStreamErrorRecursionDepthExceeded);
}
-- (void)testParseDelimitedDataWithNegativeSize {
- NSData *data = DataFromCStr("\xFF\xFF\xFF\xFF\x0F");
- GPBCodedInputStream *input = [GPBCodedInputStream streamWithData:data];
- NSError *error;
- [GPBMessage parseDelimitedFromCodedInputStream:input
- extensionRegistry:nil
- error:&error];
- XCTAssertNil(error);
-}
-
#ifdef DEBUG
- (void)testErrorMissingRequiredField {
NSData *data = DataFromCStr("");
@@ -1114,10 +1108,10 @@
- (void)testMap_Proto2UnknownEnum {
TestEnumMapPlusExtra *orig = [[TestEnumMapPlusExtra alloc] init];
- orig.knownMapField = [[[GPBInt32EnumDictionary alloc]
- initWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue] autorelease];
- orig.unknownMapField = [[[GPBInt32EnumDictionary alloc]
- initWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue] autorelease];
+ orig.knownMapField = [GPBInt32EnumDictionary
+ dictionaryWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue];
+ orig.unknownMapField = [GPBInt32EnumDictionary
+ dictionaryWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue];
[orig.knownMapField setEnum:Proto2MapEnumPlusExtra_EProto2MapEnumFoo
forKey:0];
[orig.unknownMapField setEnum:Proto2MapEnumPlusExtra_EProto2MapEnumExtra
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests.m
index a314909657..c15535c508 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBMessageTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBMessageTests.m
@@ -1238,8 +1238,7 @@
// with different objects that are equal).
TestRecursiveMessageWithRepeatedField *message3 =
[TestRecursiveMessageWithRepeatedField message];
- message3.iToI = [[[GPBInt32Int32Dictionary alloc] init] autorelease];
- [message3.iToI setInt32:10 forKey:20];
+ message3.iToI = [GPBInt32Int32Dictionary dictionaryWithInt32:10 forKey:20];
message3.strToStr =
[NSMutableDictionary dictionaryWithObject:@"abc" forKey:@"123"];
XCTAssertNotNil(message.iToI);
@@ -1324,8 +1323,7 @@
XCTAssertFalse([message hasA]);
GPBInt32Int32Dictionary *iToI = [message.a.iToI retain];
XCTAssertEqual(iToI->_autocreator, message.a); // Pointer comparision
- message.a.iToI = [[[GPBInt32Int32Dictionary alloc] init] autorelease];
- [message.a.iToI setInt32:6 forKey:7];
+ message.a.iToI = [GPBInt32Int32Dictionary dictionaryWithInt32:6 forKey:7];
XCTAssertTrue([message hasA]);
XCTAssertNotEqual(message.a.iToI, iToI); // Pointer comparision
XCTAssertNil(iToI->_autocreator);
@@ -2052,55 +2050,4 @@
XCTAssertEqual([msg1 hash], [msg1Prime hash]);
}
-- (void)testCopyingMapFileds {
- TestMessageOfMaps *msg = [TestMessageOfMaps message];
-
- msg.strToStr[@"foo"] = @"bar";
-
- [msg.strToInt setInt32:1 forKey:@"mumble"];
- [msg.intToStr setObject:@"wee" forKey:42];
- [msg.intToInt setInt32:123 forKey:321];
-
- [msg.strToBool setBool:YES forKey:@"one"];
- [msg.boolToStr setObject:@"something" forKey:YES];
- [msg.boolToBool setBool:YES forKey:NO];
-
- [msg.intToBool setBool:YES forKey:13];
- [msg.boolToInt setInt32:111 forKey:NO];
-
- TestAllTypes *subMsg1 = [TestAllTypes message];
- subMsg1.optionalInt32 = 1;
- TestAllTypes *subMsg2 = [TestAllTypes message];
- subMsg1.optionalInt32 = 2;
- TestAllTypes *subMsg3 = [TestAllTypes message];
- subMsg1.optionalInt32 = 3;
-
- msg.strToMsg[@"baz"] = subMsg1;
- [msg.intToMsg setObject:subMsg2 forKey:222];
- [msg.boolToMsg setObject:subMsg3 forKey:YES];
-
- TestMessageOfMaps *msg2 = [[msg copy] autorelease];
- XCTAssertNotNil(msg2);
- XCTAssertEqualObjects(msg2, msg);
- XCTAssertTrue(msg2 != msg); // ptr compare
- XCTAssertTrue(msg.strToStr != msg2.strToStr); // ptr compare
- XCTAssertTrue(msg.intToStr != msg2.intToStr); // ptr compare
- XCTAssertTrue(msg.intToInt != msg2.intToInt); // ptr compare
- XCTAssertTrue(msg.strToBool != msg2.strToBool); // ptr compare
- XCTAssertTrue(msg.boolToStr != msg2.boolToStr); // ptr compare
- XCTAssertTrue(msg.boolToBool != msg2.boolToBool); // ptr compare
- XCTAssertTrue(msg.intToBool != msg2.intToBool); // ptr compare
- XCTAssertTrue(msg.boolToInt != msg2.boolToInt); // ptr compare
- XCTAssertTrue(msg.strToMsg != msg2.strToMsg); // ptr compare
- XCTAssertTrue(msg.intToMsg != msg2.intToMsg); // ptr compare
- XCTAssertTrue(msg.boolToMsg != msg2.boolToMsg); // ptr compare
-
- XCTAssertTrue(msg.strToMsg[@"baz"] != msg2.strToMsg[@"baz"]); // ptr compare
- XCTAssertEqualObjects(msg.strToMsg[@"baz"], msg2.strToMsg[@"baz"]);
- XCTAssertTrue([msg.intToMsg objectForKey:222] != [msg2.intToMsg objectForKey:222]); // ptr compare
- XCTAssertEqualObjects([msg.intToMsg objectForKey:222], [msg2.intToMsg objectForKey:222]);
- XCTAssertTrue([msg.boolToMsg objectForKey:YES] != [msg2.boolToMsg objectForKey:YES]); // ptr compare
- XCTAssertEqualObjects([msg.boolToMsg objectForKey:YES], [msg2.boolToMsg objectForKey:YES]);
-}
-
@end
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm b/third_party/protobuf/3.4.0/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm
index 9ba8fd0b90..9ba8fd0b90 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBPerfTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBPerfTests.m
index 8dd0ffc53c..8dd0ffc53c 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBPerfTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBPerfTests.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBSwiftTests.swift b/third_party/protobuf/3.4.0/objectivec/Tests/GPBSwiftTests.swift
index 9d8a0faeb0..9d8a0faeb0 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBSwiftTests.swift
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBSwiftTests.swift
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBTestUtilities.h b/third_party/protobuf/3.4.0/objectivec/Tests/GPBTestUtilities.h
index 780184b07c..44c808449d 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBTestUtilities.h
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBTestUtilities.h
@@ -39,9 +39,6 @@
@class TestUnpackedExtensions;
@class GPBExtensionRegistry;
-static inline NSData *DataFromCStr(const char *str) {
- return [NSData dataWithBytes:str length:strlen(str)];
-}
// Helper for uses of C arrays in tests cases.
#ifndef GPBARRAYSIZE
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBTestUtilities.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBTestUtilities.m
index ebccaac9c7..ebccaac9c7 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBTestUtilities.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBTestUtilities.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBUnittestProtos.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBUnittestProtos.m
index 756bd99ef7..756bd99ef7 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBUnittestProtos.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBUnittestProtos.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBUnittestProtos2.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBUnittestProtos2.m
index ef9f070222..ef9f070222 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBUnittestProtos2.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBUnittestProtos2.m
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/GPBUnknownFieldSetTest.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBUnknownFieldSetTest.m
new file mode 100644
index 0000000000..b2b5b21e61
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBUnknownFieldSetTest.m
@@ -0,0 +1,255 @@
+// 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.
+
+#import "GPBTestUtilities.h"
+
+#import "GPBUnknownField_PackagePrivate.h"
+#import "GPBUnknownFieldSet_PackagePrivate.h"
+#import "google/protobuf/Unittest.pbobjc.h"
+
+@interface GPBUnknownFieldSet (GPBUnknownFieldSetTest)
+- (void)getTags:(int32_t*)tags;
+@end
+
+@interface UnknownFieldSetTest : GPBTestCase {
+ @private
+ TestAllTypes* allFields_;
+ NSData* allFieldsData_;
+
+ // An empty message that has been parsed from allFieldsData. So, it has
+ // unknown fields of every type.
+ TestEmptyMessage* emptyMessage_;
+ GPBUnknownFieldSet* unknownFields_;
+}
+
+@end
+
+@implementation UnknownFieldSetTest
+
+- (void)setUp {
+ allFields_ = [self allSetRepeatedCount:kGPBDefaultRepeatCount];
+ allFieldsData_ = [allFields_ data];
+ emptyMessage_ = [TestEmptyMessage parseFromData:allFieldsData_ error:NULL];
+ unknownFields_ = emptyMessage_.unknownFields;
+}
+
+// Constructs a protocol buffer which contains fields with all the same
+// numbers as allFieldsData except that each field is some other wire
+// type.
+- (NSData*)getBizarroData {
+ GPBUnknownFieldSet* bizarroFields =
+ [[[GPBUnknownFieldSet alloc] init] autorelease];
+ NSUInteger count = [unknownFields_ countOfFields];
+ int32_t tags[count];
+ [unknownFields_ getTags:tags];
+ for (NSUInteger i = 0; i < count; ++i) {
+ int32_t tag = tags[i];
+ GPBUnknownField* field = [unknownFields_ getField:tag];
+ if (field.varintList.count == 0) {
+ // Original field is not a varint, so use a varint.
+ GPBUnknownField* varintField =
+ [[[GPBUnknownField alloc] initWithNumber:tag] autorelease];
+ [varintField addVarint:1];
+ [bizarroFields addField:varintField];
+ } else {
+ // Original field *is* a varint, so use something else.
+ GPBUnknownField* fixed32Field =
+ [[[GPBUnknownField alloc] initWithNumber:tag] autorelease];
+ [fixed32Field addFixed32:1];
+ [bizarroFields addField:fixed32Field];
+ }
+ }
+
+ return [bizarroFields data];
+}
+
+- (void)testSerialize {
+ // Check that serializing the UnknownFieldSet produces the original data
+ // again.
+ NSData* data = [emptyMessage_ data];
+ XCTAssertEqualObjects(allFieldsData_, data);
+}
+
+- (void)testCopyFrom {
+ TestEmptyMessage* message = [TestEmptyMessage message];
+ [message mergeFrom:emptyMessage_];
+
+ XCTAssertEqualObjects(emptyMessage_.data, message.data);
+}
+
+- (void)testMergeFrom {
+ GPBUnknownFieldSet* set1 = [[[GPBUnknownFieldSet alloc] init] autorelease];
+ GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease];
+ [field addVarint:2];
+ [set1 addField:field];
+ field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
+ [field addVarint:4];
+ [set1 addField:field];
+
+ GPBUnknownFieldSet* set2 = [[[GPBUnknownFieldSet alloc] init] autorelease];
+ field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
+ [field addVarint:1];
+ [set2 addField:field];
+ field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
+ [field addVarint:3];
+ [set2 addField:field];
+
+ GPBUnknownFieldSet* set3 = [[[GPBUnknownFieldSet alloc] init] autorelease];
+ field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
+ [field addVarint:1];
+ [set3 addField:field];
+ field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
+ [field addVarint:4];
+ [set3 addField:field];
+
+ GPBUnknownFieldSet* set4 = [[[GPBUnknownFieldSet alloc] init] autorelease];
+ field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease];
+ [field addVarint:2];
+ [set4 addField:field];
+ field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
+ [field addVarint:3];
+ [set4 addField:field];
+
+ TestEmptyMessage* source1 = [TestEmptyMessage message];
+ [source1 setUnknownFields:set1];
+ TestEmptyMessage* source2 = [TestEmptyMessage message];
+ [source2 setUnknownFields:set2];
+ TestEmptyMessage* source3 = [TestEmptyMessage message];
+ [source3 setUnknownFields:set3];
+ TestEmptyMessage* source4 = [TestEmptyMessage message];
+ [source4 setUnknownFields:set4];
+
+ TestEmptyMessage* destination1 = [TestEmptyMessage message];
+ [destination1 mergeFrom:source1];
+ [destination1 mergeFrom:source2];
+
+ TestEmptyMessage* destination2 = [TestEmptyMessage message];
+ [destination2 mergeFrom:source3];
+ [destination2 mergeFrom:source4];
+
+ XCTAssertEqualObjects(destination1.data, destination2.data);
+}
+
+- (void)testClearMessage {
+ TestEmptyMessage *message = [TestEmptyMessage message];
+ [message mergeFrom:emptyMessage_];
+ [message clear];
+ XCTAssertEqual(message.serializedSize, (size_t)0);
+}
+
+- (void)testParseKnownAndUnknown {
+ // Test mixing known and unknown fields when parsing.
+ GPBUnknownFieldSet *fields = [[unknownFields_ copy] autorelease];
+ GPBUnknownField *field =
+ [[[GPBUnknownField alloc] initWithNumber:123456] autorelease];
+ [field addVarint:654321];
+ [fields addField:field];
+
+ NSData* data = fields.data;
+ TestAllTypes* destination = [TestAllTypes parseFromData:data error:NULL];
+
+ [self assertAllFieldsSet:destination repeatedCount:kGPBDefaultRepeatCount];
+ XCTAssertEqual(destination.unknownFields.countOfFields, (NSUInteger)1);
+
+ GPBUnknownField* field2 = [destination.unknownFields getField:123456];
+ XCTAssertEqual(field2.varintList.count, (NSUInteger)1);
+ XCTAssertEqual(654321ULL, [field2.varintList valueAtIndex:0]);
+}
+
+- (void)testWrongTypeTreatedAsUnknown {
+ // Test that fields of the wrong wire type are treated like unknown fields
+ // when parsing.
+
+ NSData* bizarroData = [self getBizarroData];
+ TestAllTypes* allTypesMessage =
+ [TestAllTypes parseFromData:bizarroData error:NULL];
+ TestEmptyMessage* emptyMessage =
+ [TestEmptyMessage parseFromData:bizarroData error:NULL];
+
+ // All fields should have been interpreted as unknown, so the debug strings
+ // should be the same.
+ XCTAssertEqualObjects(emptyMessage.data, allTypesMessage.data);
+}
+
+- (void)testUnknownExtensions {
+ // Make sure fields are properly parsed to the UnknownFieldSet even when
+ // they are declared as extension numbers.
+
+ TestEmptyMessageWithExtensions* message =
+ [TestEmptyMessageWithExtensions parseFromData:allFieldsData_ error:NULL];
+
+ XCTAssertEqual(unknownFields_.countOfFields,
+ message.unknownFields.countOfFields);
+ XCTAssertEqualObjects(allFieldsData_, message.data);
+}
+
+- (void)testWrongExtensionTypeTreatedAsUnknown {
+ // Test that fields of the wrong wire type are treated like unknown fields
+ // when parsing extensions.
+
+ NSData* bizarroData = [self getBizarroData];
+ TestAllExtensions* allExtensionsMessage =
+ [TestAllExtensions parseFromData:bizarroData error:NULL];
+ TestEmptyMessage* emptyMessage =
+ [TestEmptyMessage parseFromData:bizarroData error:NULL];
+
+ // All fields should have been interpreted as unknown, so the debug strings
+ // should be the same.
+ XCTAssertEqualObjects(emptyMessage.data, allExtensionsMessage.data);
+}
+
+- (void)testLargeVarint {
+ GPBUnknownFieldSet* fields = [[unknownFields_ copy] autorelease];
+ GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
+ [field addVarint:0x7FFFFFFFFFFFFFFFL];
+ [fields addField:field];
+
+ NSData* data = [fields data];
+
+ GPBUnknownFieldSet* parsed = [[[GPBUnknownFieldSet alloc] init] autorelease];
+ [parsed mergeFromData:data];
+ GPBUnknownField* field2 = [parsed getField:1];
+ XCTAssertEqual(field2.varintList.count, (NSUInteger)1);
+ XCTAssertEqual(0x7FFFFFFFFFFFFFFFULL, [field2.varintList valueAtIndex:0]);
+}
+
+- (void)testMergingFields {
+ GPBUnknownField* field1 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
+ [field1 addVarint:1];
+ [field1 addFixed32:2];
+ [field1 addFixed64:3];
+ [field1 addLengthDelimited:[NSData dataWithBytes:"hello" length:5]];
+ [field1 addGroup:[[unknownFields_ copy] autorelease]];
+ GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:2] autorelease];
+ [field2 mergeFromField:field1];
+ XCTAssertEqualObjects(field1, field2);
+}
+
+@end
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBUtilitiesTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBUtilitiesTests.m
index 8a8ba93e5c..2e206a54ea 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBUtilitiesTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBUtilitiesTests.m
@@ -52,12 +52,12 @@
- (void)testRightShiftFunctions {
XCTAssertEqual((1UL << 31) >> 31, 1UL);
- XCTAssertEqual((int32_t)(1U << 31) >> 31, -1);
+ XCTAssertEqual((1 << 31) >> 31, -1);
XCTAssertEqual((1ULL << 63) >> 63, 1ULL);
- XCTAssertEqual((int64_t)(1ULL << 63) >> 63, -1LL);
+ XCTAssertEqual((1LL << 63) >> 63, -1LL);
- XCTAssertEqual(GPBLogicalRightShift32((1U << 31), 31), 1);
- XCTAssertEqual(GPBLogicalRightShift64((1ULL << 63), 63), 1LL);
+ XCTAssertEqual(GPBLogicalRightShift32((1 << 31), 31), 1);
+ XCTAssertEqual(GPBLogicalRightShift64((1LL << 63), 63), 1LL);
}
- (void)testGPBDecodeTextFormatName {
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBWellKnownTypesTest.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBWellKnownTypesTest.m
index 592d5afd4b..592d5afd4b 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBWellKnownTypesTest.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBWellKnownTypesTest.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBWireFormatTests.m b/third_party/protobuf/3.4.0/objectivec/Tests/GPBWireFormatTests.m
index dbeab21564..dbeab21564 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBWireFormatTests.m
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/GPBWireFormatTests.m
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/UnitTests-Bridging-Header.h b/third_party/protobuf/3.4.0/objectivec/Tests/UnitTests-Bridging-Header.h
index 46292fce73..46292fce73 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/UnitTests-Bridging-Header.h
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/UnitTests-Bridging-Header.h
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/UnitTests-Info.plist b/third_party/protobuf/3.4.0/objectivec/Tests/UnitTests-Info.plist
index 460a7d931c..460a7d931c 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/UnitTests-Info.plist
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/UnitTests-Info.plist
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/golden_message b/third_party/protobuf/3.4.0/objectivec/Tests/golden_message
index 7bceab4138..7bceab4138 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/golden_message
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/golden_message
Binary files differ
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/golden_packed_fields_message b/third_party/protobuf/3.4.0/objectivec/Tests/golden_packed_fields_message
index 7bceab4138..7bceab4138 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/golden_packed_fields_message
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/golden_packed_fields_message
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/AppDelegate.m b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/AppDelegate.m
new file mode 100644
index 0000000000..8c4a586bbd
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/AppDelegate.m
@@ -0,0 +1,35 @@
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+@property (strong, nonatomic) UIWindow *window;
+@end
+
+@implementation AppDelegate
+
+@synthesize window;
+
+- (BOOL)application:(UIApplication *)application
+ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ #pragma unused (application, launchOptions)
+
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ self.window.backgroundColor = [UIColor whiteColor];
+ [self.window makeKeyAndVisible];
+ self.window.rootViewController = [[UIViewController alloc] init];
+
+ UILabel *label =
+ [[UILabel alloc] initWithFrame:CGRectMake(0, 200, CGRectGetWidth(self.window.frame), 40)];
+ label.text = @"Protocol Buffer Test Harness";
+ label.textAlignment = NSTextAlignmentCenter;
+ [self.window addSubview:label];
+
+ return YES;
+}
+
+@end
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000000..0cbf9acc1c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,116 @@
+{
+ "images" : [
+ {
+ "idiom" : "iphone",
+ "size" : "29x29",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "29x29",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "29x29",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "40x40",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "40x40",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "iPhone6.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "iPhone6_2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "iPhone7_2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "iPhone7_3x.png",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "29x29",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "29x29",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "40x40",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "40x40",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "50x50",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "50x50",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "iPad6.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "iPad6_2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "iPad7.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "iPad7_2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "car",
+ "size" : "120x120",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png
new file mode 100644
index 0000000000..43da2ee434
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png
new file mode 100644
index 0000000000..2ec93704ca
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png
new file mode 100644
index 0000000000..aec8bc1b1b
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png
new file mode 100644
index 0000000000..e39cc3e754
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png
new file mode 100644
index 0000000000..5572d79f6f
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png
new file mode 100644
index 0000000000..2424997f93
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png
new file mode 100644
index 0000000000..10bfc3cfae
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png
new file mode 100644
index 0000000000..8d16f14dcc
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png
Binary files differ
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json
new file mode 100644
index 0000000000..5a2966687a
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json
@@ -0,0 +1,49 @@
+{
+ "images" : [
+ {
+ "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"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "minimum-system-version" : "7.0",
+ "subtype" : "retina4",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "minimum-system-version" : "7.0",
+ "extent" : "full-screen",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Info.plist b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Info.plist
new file mode 100644
index 0000000000..24bd333d0b
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/Info.plist
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ </array>
+</dict>
+</plist>
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/LaunchScreen.xib b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/LaunchScreen.xib
new file mode 100644
index 0000000000..22204bfe44
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/LaunchScreen.xib
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
+ <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="iN0-l3-epB">
+ <rect key="frame" x="0.0" y="0.0" width="630" height="503"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Protocol Buffer Test Harness" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
+ <rect key="frame" x="20" y="147" width="591" height="43"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="Kid-kn-2rF"/>
+ <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
+ <constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
+ </constraints>
+ <nil key="simulatedStatusBarMetrics"/>
+ <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ <point key="canvasLocation" x="479" y="456.5"/>
+ </view>
+ </objects>
+</document>
diff --git a/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/en.lproj/InfoPlist.strings b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/en.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..477b28ff8f
--- /dev/null
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/iOSTestHarness/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/text_format_map_unittest_data.txt b/third_party/protobuf/3.4.0/objectivec/Tests/text_format_map_unittest_data.txt
index ad1195e2f9..ad1195e2f9 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/text_format_map_unittest_data.txt
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/text_format_map_unittest_data.txt
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/text_format_unittest_data.txt b/third_party/protobuf/3.4.0/objectivec/Tests/text_format_unittest_data.txt
index d10f10006a..d10f10006a 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/text_format_unittest_data.txt
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/text_format_unittest_data.txt
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_cycle.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_cycle.proto
index afc1b0fe27..afc1b0fe27 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_cycle.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_cycle.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_deprecated.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_deprecated.proto
index 96a52bbbe2..96a52bbbe2 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_deprecated.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_deprecated.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_deprecated_file.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_deprecated_file.proto
index ef92e7de1a..ef92e7de1a 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_deprecated_file.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_deprecated_file.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_a.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_a.proto
index 6a227eb977..6a227eb977 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_a.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_a.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_b.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_b.proto
index 0da7ed3e4c..0da7ed3e4c 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_b.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_b.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_c.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_c.proto
index c702900a4a..c702900a4a 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_c.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_c.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_d.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_d.proto
index f9abe3ba59..f9abe3ba59 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_d.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_d.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_e.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_e.proto
index fe11663180..fe11663180 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_e.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_e.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_f.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_f.proto
index b9bed7239b..b9bed7239b 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_f.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_f.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_g.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_g.proto
index aee827b176..aee827b176 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_extension_chain_g.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_extension_chain_g.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_objc.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_objc.proto
index b0eb47237e..e5577faf0d 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_objc.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_objc.proto
@@ -58,27 +58,6 @@ message TestRecursiveMessageWithRepeatedField {
map<string, string> str_to_str = 5;
}
-// Message with a few types of maps to cover the different custom flows
-// in the runtime.
-message TestMessageOfMaps {
- map<string, string> str_to_str = 1;
-
- map<string, int32> str_to_int = 2;
- map<int32, string> int_to_str = 3;
- map<int32, int32> int_to_int = 4;
-
- map<string, bool> str_to_bool = 5;
- map<bool, string> bool_to_str = 6;
- map<bool, bool> bool_to_bool = 7;
-
- map<int32, bool> int_to_bool = 8;
- map<bool, int32> bool_to_int = 9;
-
- map<string, TestAllTypes> str_to_msg = 10;
- map<int32, TestAllTypes> int_to_msg = 11;
- map<bool, TestAllTypes> bool_to_msg = 12;
-}
-
// Recursive message and extension to for testing autocreators at different
// depths.
message TestRecursiveExtension {
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_objc_startup.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_objc_startup.proto
index aee7bd556b..aee7bd556b 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_objc_startup.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_objc_startup.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_runtime_proto2.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_runtime_proto2.proto
index ed835020af..ed835020af 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_runtime_proto2.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_runtime_proto2.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_runtime_proto3.proto b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_runtime_proto3.proto
index ad2e3620d3..ad2e3620d3 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/unittest_runtime_proto3.proto
+++ b/third_party/protobuf/3.4.0/objectivec/Tests/unittest_runtime_proto3.proto
diff --git a/third_party/protobuf/3.6.0/objectivec/generate_well_known_types.sh b/third_party/protobuf/3.4.0/objectivec/generate_well_known_types.sh
index 36c346031c..36c346031c 100644..100755
--- a/third_party/protobuf/3.6.0/objectivec/generate_well_known_types.sh
+++ b/third_party/protobuf/3.4.0/objectivec/generate_well_known_types.sh
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Any.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Any.pbobjc.h
index ad261898e4..b17e76f0aa 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Any.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Any.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
@@ -139,18 +135,17 @@ typedef GPB_ENUM(GPBAny_FieldNumber) {
@interface GPBAny : GPBMessage
/**
- * 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).
+ * A URL/resource name whose content describes the type of the
+ * serialized protocol buffer message.
*
- * 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:
+ * For URLs which use the scheme `http`, `https`, or no scheme, the
+ * following restrictions and interpretations apply:
*
* * 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
@@ -159,10 +154,6 @@ 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/third_party/protobuf/3.6.0/objectivec/google/protobuf/Any.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Any.pbobjc.m
index d210643f05..d210643f05 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Any.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Any.pbobjc.m
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Api.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Api.pbobjc.h
index c93f3f15d7..095fc2cd6d 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Api.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Api.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Api.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Api.pbobjc.m
index 58b47157de..58b47157de 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Api.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Api.pbobjc.m
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Duration.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Duration.pbobjc.h
index 3e36759072..d9a388ac1b 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Duration.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Duration.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Duration.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Duration.pbobjc.m
index bafb64a04f..bafb64a04f 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Duration.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Duration.pbobjc.m
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Empty.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Empty.pbobjc.h
index fdc247ae4b..bd49cfdbc3 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Empty.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Empty.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Empty.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Empty.pbobjc.m
index 506b500e04..506b500e04 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Empty.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Empty.pbobjc.m
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/FieldMask.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/FieldMask.pbobjc.h
index 73296d574f..07e6081852 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/FieldMask.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/FieldMask.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
@@ -256,12 +252,6 @@ typedef GPB_ENUM(GPBFieldMask_FieldNumber) {
*
* Note that oneof type names ("test_oneof" in this case) cannot be used in
* paths.
- *
- * ## Field Mask Verification
- *
- * The implementation of any API method which has a FieldMask type field in the
- * request should verify the included field paths, and return an
- * `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
**/
@interface GPBFieldMask : GPBMessage
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/FieldMask.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/FieldMask.pbobjc.m
index b0915af450..b0915af450 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/FieldMask.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/FieldMask.pbobjc.m
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/SourceContext.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/SourceContext.pbobjc.h
index e4923959ea..799d190ac6 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/SourceContext.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/SourceContext.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/SourceContext.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/SourceContext.pbobjc.m
index 83bfa3460b..83bfa3460b 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/SourceContext.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/SourceContext.pbobjc.m
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Struct.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Struct.pbobjc.h
index fb20425199..3fc80caa5a 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Struct.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Struct.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Struct.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Struct.pbobjc.m
index 816fd6df56..f36ec582f9 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Struct.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Struct.pbobjc.m
@@ -13,8 +13,6 @@
#import "GPBProtocolBuffers_RuntimeSupport.h"
#endif
-#import <stdatomic.h>
-
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Struct.pbobjc.h>
#else
@@ -53,7 +51,7 @@ static GPBFileDescriptor *GPBStructRoot_FileDescriptor(void) {
#pragma mark - Enum GPBNullValue
GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) {
- static _Atomic(GPBEnumDescriptor*) descriptor = nil;
+ static GPBEnumDescriptor *descriptor = NULL;
if (!descriptor) {
static const char *valueNames =
"NullValue\000";
@@ -66,8 +64,7 @@ GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) {
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBNullValue_IsValidValue];
- GPBEnumDescriptor *expected = nil;
- if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
+ if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
[worker release];
}
}
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Timestamp.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Timestamp.pbobjc.h
index 2c4b8b2050..5d74bd3274 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Timestamp.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Timestamp.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
@@ -119,9 +115,7 @@ 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. 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).
+ * is required, though only UTC (as indicated by "Z") is presently supported.
*
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
* 01:30 UTC on January 15, 2017.
@@ -132,8 +126,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://joda-time.sourceforge.net/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/third_party/protobuf/3.6.0/objectivec/google/protobuf/Timestamp.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Timestamp.pbobjc.m
index 4ab159fb9c..4ab159fb9c 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Timestamp.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Timestamp.pbobjc.m
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Type.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Type.pbobjc.h
index e14d15df61..1798697080 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Type.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Type.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Type.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Type.pbobjc.m
index bb64d87649..7a949388f8 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Type.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Type.pbobjc.m
@@ -13,8 +13,6 @@
#import "GPBProtocolBuffers_RuntimeSupport.h"
#endif
-#import <stdatomic.h>
-
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Type.pbobjc.h>
#import <Protobuf/Any.pbobjc.h>
@@ -56,7 +54,7 @@ static GPBFileDescriptor *GPBTypeRoot_FileDescriptor(void) {
#pragma mark - Enum GPBSyntax
GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) {
- static _Atomic(GPBEnumDescriptor*) descriptor = nil;
+ static GPBEnumDescriptor *descriptor = NULL;
if (!descriptor) {
static const char *valueNames =
"SyntaxProto2\000SyntaxProto3\000";
@@ -70,8 +68,7 @@ GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) {
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBSyntax_IsValidValue];
- GPBEnumDescriptor *expected = nil;
- if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
+ if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
[worker release];
}
}
@@ -371,7 +368,7 @@ void SetGPBField_Cardinality_RawValue(GPBField *message, int32_t value) {
#pragma mark - Enum GPBField_Kind
GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
- static _Atomic(GPBEnumDescriptor*) descriptor = nil;
+ static GPBEnumDescriptor *descriptor = NULL;
if (!descriptor) {
static const char *valueNames =
"TypeUnknown\000TypeDouble\000TypeFloat\000TypeInt"
@@ -407,8 +404,7 @@ GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBField_Kind_IsValidValue];
- GPBEnumDescriptor *expected = nil;
- if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
+ if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
[worker release];
}
}
@@ -445,7 +441,7 @@ BOOL GPBField_Kind_IsValidValue(int32_t value__) {
#pragma mark - Enum GPBField_Cardinality
GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
- static _Atomic(GPBEnumDescriptor*) descriptor = nil;
+ static GPBEnumDescriptor *descriptor = NULL;
if (!descriptor) {
static const char *valueNames =
"CardinalityUnknown\000CardinalityOptional\000C"
@@ -462,8 +458,7 @@ GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBField_Cardinality_IsValidValue];
- GPBEnumDescriptor *expected = nil;
- if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
+ if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
[worker release];
}
}
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Wrappers.pbobjc.h b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Wrappers.pbobjc.h
index 0411e1ec0d..3cb9fe77dc 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Wrappers.pbobjc.h
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Wrappers.pbobjc.h
@@ -8,13 +8,9 @@
#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/GPBDescriptor.h>
- #import <Protobuf/GPBMessage.h>
- #import <Protobuf/GPBRootObject.h>
+ #import <Protobuf/GPBProtocolBuffers.h>
#else
- #import "GPBDescriptor.h"
- #import "GPBMessage.h"
- #import "GPBRootObject.h"
+ #import "GPBProtocolBuffers.h"
#endif
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
diff --git a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Wrappers.pbobjc.m b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Wrappers.pbobjc.m
index 5479eb127b..5479eb127b 100644
--- a/third_party/protobuf/3.6.0/objectivec/google/protobuf/Wrappers.pbobjc.m
+++ b/third_party/protobuf/3.4.0/objectivec/google/protobuf/Wrappers.pbobjc.m
diff --git a/third_party/protobuf/3.6.0/php/README.md b/third_party/protobuf/3.4.0/php/README.md
index da7884ea6a..cebeb3e5a2 100644
--- a/third_party/protobuf/3.6.0/php/README.md
+++ b/third_party/protobuf/3.4.0/php/README.md
@@ -16,7 +16,7 @@ generation functionality.
To use PHP runtime library requires:
-- C extension: PHP 5.5, 5.6, or 7.
+- C extension: PHP 5.5.x or 5.6.x.
- PHP package: PHP 5.5, 5.6 or 7.
## Installation
diff --git a/third_party/protobuf/3.6.0/php/composer.json b/third_party/protobuf/3.4.0/php/composer.json
index 34e0447c80..34e0447c80 100644
--- a/third_party/protobuf/3.6.0/php/composer.json
+++ b/third_party/protobuf/3.4.0/php/composer.json
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/array.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/array.c
index e69bef4299..e69bef4299 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/array.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/array.c
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/config.m4 b/third_party/protobuf/3.4.0/php/ext/google/protobuf/config.m4
index ab032e466b..ab032e466b 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/config.m4
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/config.m4
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/def.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/def.c
index fa33830b93..f885c1452f 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/def.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/def.c
@@ -30,6 +30,9 @@
#include "protobuf.h"
+const char* const kReservedNames[] = {"Empty", "ECHO", "ARRAY"};
+const int kReservedNamesSize = 3;
+
// Forward declare.
static void descriptor_init_c_instance(Descriptor* intern TSRMLS_DC);
static void descriptor_free_c(Descriptor* object TSRMLS_DC);
@@ -112,6 +115,33 @@ static void append_map_entry_name(char *result, const char *field_name,
check_upb_status(&status, msg); \
} while (0)
+// Define PHP class
+#define DEFINE_PROTOBUF_INIT_CLASS(CLASSNAME, CAMELNAME, LOWERNAME) \
+ PHP_PROTO_INIT_CLASS_START(CLASSNAME, CAMELNAME, LOWERNAME) \
+ PHP_PROTO_INIT_CLASS_END
+
+#define DEFINE_PROTOBUF_CREATE(NAME, LOWERNAME) \
+ PHP_PROTO_OBJECT_CREATE_START(NAME, LOWERNAME) \
+ LOWERNAME##_init_c_instance(intern TSRMLS_CC); \
+ PHP_PROTO_OBJECT_CREATE_END(NAME, LOWERNAME)
+
+#define DEFINE_PROTOBUF_FREE(CAMELNAME, LOWERNAME) \
+ PHP_PROTO_OBJECT_FREE_START(CAMELNAME, LOWERNAME) \
+ LOWERNAME##_free_c(intern TSRMLS_CC); \
+ PHP_PROTO_OBJECT_FREE_END
+
+#define DEFINE_PROTOBUF_DTOR(CAMELNAME, LOWERNAME) \
+ PHP_PROTO_OBJECT_DTOR_START(CAMELNAME, LOWERNAME) \
+ PHP_PROTO_OBJECT_DTOR_END
+
+#define DEFINE_CLASS(NAME, LOWERNAME, string_name) \
+ zend_class_entry *LOWERNAME##_type; \
+ zend_object_handlers *LOWERNAME##_handlers; \
+ DEFINE_PROTOBUF_FREE(NAME, LOWERNAME) \
+ DEFINE_PROTOBUF_DTOR(NAME, LOWERNAME) \
+ DEFINE_PROTOBUF_CREATE(NAME, LOWERNAME) \
+ DEFINE_PROTOBUF_INIT_CLASS(string_name, NAME, LOWERNAME)
+
// -----------------------------------------------------------------------------
// GPBType
// -----------------------------------------------------------------------------
@@ -249,11 +279,9 @@ PHP_METHOD(Descriptor, getField) {
MAKE_STD_ZVAL(field_hashtable_value);
ZVAL_OBJ(field_hashtable_value, field_descriptor_type->create_object(
field_descriptor_type TSRMLS_CC));
- Z_DELREF_P(field_hashtable_value);
#else
field_hashtable_value =
field_descriptor_type->create_object(field_descriptor_type TSRMLS_CC);
- --GC_REFCOUNT(field_hashtable_value);
#endif
FieldDescriptor *field_php =
UNBOX_HASHTABLE_VALUE(FieldDescriptor, field_hashtable_value);
@@ -629,7 +657,7 @@ zend_object *internal_generated_pool_php;
#endif
InternalDescriptorPool *generated_pool; // The actual generated pool
-void init_generated_pool_once(TSRMLS_D) {
+static void init_generated_pool_once(TSRMLS_D) {
if (generated_pool == NULL) {
#if PHP_MAJOR_VERSION < 7
MAKE_STD_ZVAL(generated_pool_php);
@@ -718,194 +746,115 @@ PHP_METHOD(InternalDescriptorPool, getGeneratedPool) {
#endif
}
-static size_t classname_len_max(const char *fullname,
- const char *package,
- const char *php_namespace,
- const char *prefix) {
- size_t fullname_len = strlen(fullname);
- size_t package_len = 0;
- size_t prefix_len = 0;
- size_t namespace_len = 0;
- size_t length = fullname_len;
- int i, segment, classname_start = 0;
-
- if (package != NULL) {
- package_len = strlen(package);
- }
- if (prefix != NULL) {
- prefix_len = strlen(prefix);
- }
- if (php_namespace != NULL) {
- namespace_len = strlen(php_namespace);
- }
-
- // Process package
- if (package_len > 0) {
- segment = 1;
- for (i = 0; i < package_len; i++) {
- if (package[i] == '.') {
- segment++;
- }
- }
- // In case of reserved name in package.
- length += 3 * segment;
-
- classname_start = package_len + 1;
- }
+static void classname_no_prefix(const char *fullname, const char *package_name,
+ char *class_name) {
+ size_t i = 0, j;
+ bool first_char = true, is_reserved = false;
+ size_t pkg_name_len = package_name == NULL ? 0 : strlen(package_name);
+ size_t message_name_start = package_name == NULL ? 0 : pkg_name_len + 1;
+ size_t message_len = (strlen(fullname) - message_name_start);
- // Process class name
- segment = 1;
- for (i = classname_start; i < fullname_len; i++) {
- if (fullname[i] == '.') {
- segment++;
+ // Submessage is concatenated with its containing messages by '_'.
+ for (j = message_name_start; j < message_name_start + message_len; j++) {
+ if (fullname[j] == '.') {
+ class_name[i++] = '_';
+ } else {
+ class_name[i++] = fullname[j];
}
}
- if (prefix_len == 0) {
- length += 3 * segment;
- } else {
- length += prefix_len * segment;
- }
-
- // The additional 2, one is for preceding '.' and the other is for trailing 0.
- return length + namespace_len + 2;
-}
-
-static bool is_reserved(const char *segment, int length) {
- bool result;
- char* lower = ALLOC_N(char, length + 1);
- memset(lower, 0, length + 1);
- memcpy(lower, segment, length);
- int i = 0;
- while(lower[i]) {
- lower[i] = (char)tolower(lower[i]);
- i++;
- }
- lower[length] = 0;
- result = is_reserved_name(lower);
- FREE(lower);
- return result;
}
-static char* fill_prefix(const char *segment, int length,
- const char *prefix_given,
- const char *package_name, char *classname) {
+static const char *classname_prefix(const char *classname,
+ const char *prefix_given,
+ const char *package_name) {
size_t i;
+ bool is_reserved = false;
if (prefix_given != NULL && strcmp(prefix_given, "") != 0) {
- size_t prefix_len = strlen(prefix_given);
- memcpy(classname, prefix_given, strlen(prefix_given));
- classname += prefix_len;
- } else {
- if (is_reserved(segment, length)) {
- if (package_name != NULL &&
- strcmp("google.protobuf", package_name) == 0) {
- memcpy(classname, "GPB", 3);
- classname += 3;
- } else {
- memcpy(classname, "PB", 2);
- classname += 2;
- }
- }
- }
- return classname;
-}
-
-static char* fill_segment(const char *segment, int length,
- char *classname, bool use_camel) {
- memcpy(classname, segment, length);
- if (use_camel && (segment[0] < 'A' || segment[0] > 'Z')) {
- classname[0] += 'A' - 'a';
+ return prefix_given;
}
- return classname + length;
-}
-static char* fill_namespace(const char *package, const char *namespace_given,
- char *classname) {
- if (namespace_given != NULL) {
- size_t namespace_len = strlen(namespace_given);
- memcpy(classname, namespace_given, namespace_len);
- classname += namespace_len;
- *classname = '\\';
- classname++;
- } else if (package != NULL) {
- int i = 0, j, offset = 0;
- size_t package_len = strlen(package);
- while (i < package_len) {
- j = i;
- while (j < package_len && package[j] != '.') {
- j++;
- }
- classname = fill_prefix(package + i, j - i, "", package, classname);
- classname = fill_segment(package + i, j - i, classname, true);
- classname[0] = '\\';
- classname++;
- i = j + 1;
+ for (i = 0; i < kReservedNamesSize; i++) {
+ if (strcmp(kReservedNames[i], classname) == 0) {
+ is_reserved = true;
+ break;
}
}
- return classname;
-}
-static char* fill_classname(const char *fullname,
- const char *package,
- const char *namespace_given,
- const char *prefix, char *classname) {
- int classname_start = 0;
- if (package != NULL) {
- size_t package_len = strlen(package);
- classname_start = package_len == 0 ? 0 : package_len + 1;
- }
- size_t fullname_len = strlen(fullname);
- classname = fill_prefix(fullname + classname_start,
- fullname_len - classname_start,
- prefix, package, classname);
-
- int i = classname_start, j;
- while (i < fullname_len) {
- j = i;
- while (j < fullname_len && fullname[j] != '.') {
- j++;
- }
- classname = fill_segment(fullname + i, j - i, classname, false);
- if (j != fullname_len) {
- *classname = '_';
- classname++;
+ if (is_reserved) {
+ if (package_name != NULL && strcmp("google.protobuf", package_name) == 0) {
+ return "GPB";
+ } else {
+ return "PB";
}
- i = j + 1;
}
- return classname;
-}
-static char* fill_qualified_classname(const char *fullname,
- const char *package,
- const char *namespace_given,
- const char *prefix, char *classname) {
- classname = fill_namespace(package, namespace_given, classname);
- return fill_classname(fullname, package, namespace_given, prefix, classname);
+ return "";
}
-static void classname_no_prefix(const char *fullname, const char *package_name,
- char *class_name) {
- size_t i = 0, j;
- bool first_char = true, is_reserved = false;
- size_t pkg_name_len = package_name == NULL ? 0 : strlen(package_name);
- size_t message_name_start = package_name == NULL ? 0 : pkg_name_len + 1;
- size_t message_len = (strlen(fullname) - message_name_start);
+static void convert_to_class_name_inplace(const char *package,
+ const char *namespace_given,
+ const char *prefix, char *classname) {
+ size_t prefix_len = prefix == NULL ? 0 : strlen(prefix);
+ size_t classname_len = strlen(classname);
+ int i = 0, j;
+ bool first_char = true;
- // Submessage is concatenated with its containing messages by '_'.
- for (j = message_name_start; j < message_name_start + message_len; j++) {
- if (fullname[j] == '.') {
- class_name[i++] = '_';
- } else {
- class_name[i++] = fullname[j];
+ size_t package_len = package == NULL ? 0 : strlen(package);
+ size_t namespace_given_len =
+ namespace_given == NULL ? 0 : strlen(namespace_given);
+ bool use_namespace_given = namespace_given != NULL;
+ size_t namespace_len =
+ use_namespace_given ? namespace_given_len : package_len;
+
+ int offset = namespace_len != 0 ? 2 : 0;
+
+ for (j = 0; j < classname_len; j++) {
+ classname[namespace_len + prefix_len + classname_len + offset - 1 - j] =
+ classname[classname_len - j - 1];
+ }
+
+ if (namespace_len != 0) {
+ classname[i++] = '\\';
+ for (j = 0; j < namespace_len; j++) {
+ if (use_namespace_given) {
+ classname[i++] = namespace_given[j];
+ continue;
+ }
+ // php packages are divided by '\'.
+ if (package[j] == '.') {
+ classname[i++] = '\\';
+ first_char = true;
+ } else if (first_char) {
+ // PHP package uses camel case.
+ if (package[j] < 'A' || package[j] > 'Z') {
+ classname[i++] = package[j] + 'A' - 'a';
+ } else {
+ classname[i++] = package[j];
+ }
+ first_char = false;
+ } else {
+ classname[i++] = package[j];
+ }
}
+ classname[i++] = '\\';
}
+
+ memcpy(classname + i, prefix, prefix_len);
}
-void internal_add_generated_file(const char *data, PHP_PROTO_SIZE data_len,
- InternalDescriptorPool *pool TSRMLS_DC) {
+PHP_METHOD(InternalDescriptorPool, internalAddGeneratedFile) {
+ char *data = NULL;
+ PHP_PROTO_SIZE data_len;
upb_filedef **files;
size_t i;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) ==
+ FAILURE) {
+ return;
+ }
+
+ InternalDescriptorPool *pool = UNBOX(InternalDescriptorPool, getThis());
CHECK_UPB(files = upb_loaddescriptor(data, data_len, &pool, &status),
"Parse binary descriptors to internal descriptors failed");
@@ -940,14 +889,20 @@ void internal_add_generated_file(const char *data, PHP_PROTO_SIZE data_len,
* bytes allocated, one for '.', one for trailing 0, and 3 for 'GPB' if \
* given message is google.protobuf.Empty.*/ \
const char *fullname = upb_##def_type_lower##_fullname(def_type_lower); \
- const char *package = upb_filedef_package(files[0]); \
const char *php_namespace = upb_filedef_phpnamespace(files[0]); \
const char *prefix_given = upb_filedef_phpprefix(files[0]); \
- size_t classname_len = classname_len_max(fullname, package, \
- php_namespace, prefix_given); \
+ size_t classname_len = strlen(fullname) + 5; \
+ if (prefix_given != NULL) { \
+ classname_len += strlen(prefix_given); \
+ } \
+ if (php_namespace != NULL) { \
+ classname_len += strlen(php_namespace); \
+ } \
char *classname = ecalloc(sizeof(char), classname_len); \
- fill_qualified_classname(fullname, package, php_namespace, \
- prefix_given, classname); \
+ const char *package = upb_filedef_package(files[0]); \
+ classname_no_prefix(fullname, package, classname); \
+ const char *prefix = classname_prefix(classname, prefix_given, package); \
+ convert_to_class_name_inplace(package, php_namespace, prefix, classname); \
PHP_PROTO_CE_DECLARE pce; \
if (php_proto_zend_lookup_class(classname, strlen(classname), &pce) == \
FAILURE) { \
@@ -958,8 +913,6 @@ void internal_add_generated_file(const char *data, PHP_PROTO_SIZE data_len,
desc->klass = PHP_PROTO_CE_UNREF(pce); \
} \
add_ce_obj(desc->klass, desc_php); \
- add_proto_obj(upb_##def_type_lower##_fullname(desc->def_type_lower), \
- desc_php); \
efree(classname); \
break; \
}
@@ -986,21 +939,6 @@ void internal_add_generated_file(const char *data, PHP_PROTO_SIZE data_len,
upb_gfree(files);
}
-PHP_METHOD(InternalDescriptorPool, internalAddGeneratedFile) {
- char *data = NULL;
- PHP_PROTO_SIZE data_len;
- upb_filedef **files;
- size_t i;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) ==
- FAILURE) {
- return;
- }
-
- InternalDescriptorPool *pool = UNBOX(InternalDescriptorPool, getThis());
- internal_add_generated_file(data, data_len, pool TSRMLS_CC);
-}
-
PHP_METHOD(DescriptorPool, getDescriptorByClassName) {
DescriptorPool *public_pool = UNBOX(DescriptorPool, getThis());
InternalDescriptorPool *pool = public_pool->intern;
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/encode_decode.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/encode_decode.c
index a8c47f4d35..89e75d6a0d 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/encode_decode.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/encode_decode.c
@@ -142,23 +142,6 @@ static const void* newhandlerdata(upb_handlers* h, uint32_t ofs) {
return hd_ofs;
}
-typedef size_t (*encodeunknown_handlerfunc)(void* _sink, const void* hd,
- const char* ptr, size_t len,
- const upb_bufhandle* handle);
-
-typedef struct {
- encodeunknown_handlerfunc handler;
-} unknownfields_handlerdata_t;
-
-// Creates a handlerdata for unknown fields.
-static const void *newunknownfieldshandlerdata(upb_handlers* h) {
- unknownfields_handlerdata_t* hd =
- (unknownfields_handlerdata_t*)malloc(sizeof(unknownfields_handlerdata_t));
- hd->handler = stringsink_string;
- upb_handlers_addcleanup(h, hd, free);
- return hd;
-}
-
typedef struct {
size_t ofs;
const upb_msgdef *md;
@@ -484,11 +467,11 @@ static void map_slot_init(void* memory, upb_fieldtype_t type, zval* cache) {
// Store zval** in memory in order to be consistent with the layout of
// singular fields.
zval** holder = ALLOC(zval*);
- *(zval***)memory = holder;
zval* tmp;
MAKE_STD_ZVAL(tmp);
PHP_PROTO_ZVAL_STRINGL(tmp, "", 0, 1);
*holder = tmp;
+ *(zval***)memory = holder;
#else
*(zval**)memory = cache;
PHP_PROTO_ZVAL_STRINGL(*(zval**)memory, "", 0, 1);
@@ -521,7 +504,7 @@ static void map_slot_uninit(void* memory, upb_fieldtype_t type) {
case UPB_TYPE_BYTES: {
#if PHP_MAJOR_VERSION < 7
zval** holder = *(zval***)memory;
- zval_ptr_dtor(holder);
+ php_proto_zval_ptr_dtor(*holder);
FREE(holder);
#else
php_proto_zval_ptr_dtor(*(zval**)memory);
@@ -961,24 +944,6 @@ static void add_handlers_for_oneof_field(upb_handlers *h,
upb_handlerattr_uninit(&attr);
}
-static bool add_unknown_handler(void* closure, const void* hd, const char* buf,
- size_t size) {
- encodeunknown_handlerfunc handler =
- ((unknownfields_handlerdata_t*)hd)->handler;
-
- MessageHeader* msg = (MessageHeader*)closure;
- stringsink* unknown = DEREF(message_data(msg), 0, stringsink*);
- if (unknown == NULL) {
- DEREF(message_data(msg), 0, stringsink*) = ALLOC(stringsink);
- unknown = DEREF(message_data(msg), 0, stringsink*);
- stringsink_init(unknown);
- }
-
- handler(unknown, NULL, buf, size, NULL);
-
- return true;
-}
-
static void add_handlers_for_message(const void* closure,
upb_handlers* h) {
const upb_msgdef* msgdef = upb_handlers_msgdef(h);
@@ -1002,10 +967,6 @@ static void add_handlers_for_message(const void* closure,
desc->layout = create_layout(desc->msgdef);
}
- upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER;
- upb_handlerattr_sethandlerdata(&attr, newunknownfieldshandlerdata(h));
- upb_handlers_setunknown(h, add_unknown_handler, &attr);
-
for (upb_msg_field_begin(&i, desc->msgdef);
!upb_msg_field_done(&i);
upb_msg_field_next(&i)) {
@@ -1317,11 +1278,6 @@ static void putrawmsg(MessageHeader* msg, const Descriptor* desc,
}
}
- stringsink* unknown = DEREF(message_data(msg), 0, stringsink*);
- if (unknown != NULL) {
- upb_sink_putunknown(sink, unknown->ptr, unknown->len);
- }
-
upb_sink_endmsg(sink, &status);
}
@@ -1402,6 +1358,7 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink,
RepeatedField* intern = UNBOX(RepeatedField, array);
HashTable *ht = PHP_PROTO_HASH_OF(intern->array);
size = zend_hash_num_elements(ht);
+ // size = zend_hash_num_elements(PHP_PROTO_HASH_OF(intern->array));
if (size == 0) return;
upb_sink_startseq(sink, getsel(f, UPB_HANDLER_STARTSEQ), &subsink);
@@ -1488,9 +1445,9 @@ static const upb_handlers* msgdef_json_serialize_handlers(
// PHP encode/decode methods
// -----------------------------------------------------------------------------
-void serialize_to_string(zval* val, zval* return_value TSRMLS_DC) {
+PHP_METHOD(Message, serializeToString) {
Descriptor* desc =
- UNBOX_HASHTABLE_VALUE(Descriptor, get_ce_obj(Z_OBJCE_P(val)));
+ UNBOX_HASHTABLE_VALUE(Descriptor, get_ce_obj(Z_OBJCE_P(getThis())));
stringsink sink;
stringsink_init(&sink);
@@ -1504,7 +1461,7 @@ void serialize_to_string(zval* val, zval* return_value TSRMLS_DC) {
stackenv_init(&se, "Error occurred during encoding: %s");
encoder = upb_pb_encoder_create(&se.env, serialize_handlers, &sink.sink);
- putmsg(val, desc, upb_pb_encoder_input(encoder), 0 TSRMLS_CC);
+ putmsg(getThis(), desc, upb_pb_encoder_input(encoder), 0 TSRMLS_CC);
PHP_PROTO_RETVAL_STRINGL(sink.ptr, sink.len, 1);
@@ -1513,26 +1470,6 @@ void serialize_to_string(zval* val, zval* return_value TSRMLS_DC) {
}
}
-PHP_METHOD(Message, serializeToString) {
- serialize_to_string(getThis(), return_value TSRMLS_CC);
-}
-
-void merge_from_string(const char* data, int data_len, const Descriptor* desc,
- MessageHeader* msg) {
- const upb_pbdecodermethod* method = msgdef_decodermethod(desc);
- const upb_handlers* h = upb_pbdecodermethod_desthandlers(method);
- stackenv se;
- upb_sink sink;
- upb_pbdecoder* decoder;
- stackenv_init(&se, "Error occurred during parsing: %s");
-
- upb_sink_reset(&sink, h, msg);
- decoder = upb_pbdecoder_create(&se.env, method, &sink);
- upb_bufsrc_putbuf(data, data_len, upb_pbdecoder_input(decoder));
-
- stackenv_uninit(&se);
-}
-
PHP_METHOD(Message, mergeFromString) {
Descriptor* desc =
UNBOX_HASHTABLE_VALUE(Descriptor, get_ce_obj(Z_OBJCE_P(getThis())));
@@ -1546,7 +1483,20 @@ PHP_METHOD(Message, mergeFromString) {
return;
}
- merge_from_string(data, data_len, desc, msg);
+ {
+ const upb_pbdecodermethod* method = msgdef_decodermethod(desc);
+ const upb_handlers* h = upb_pbdecodermethod_desthandlers(method);
+ stackenv se;
+ upb_sink sink;
+ upb_pbdecoder* decoder;
+ stackenv_init(&se, "Error occurred during parsing: %s");
+
+ upb_sink_reset(&sink, h, msg);
+ decoder = upb_pbdecoder_create(&se.env, method, &sink);
+ upb_bufsrc_putbuf(data, data_len, upb_pbdecoder_input(decoder));
+
+ stackenv_uninit(&se);
+ }
}
PHP_METHOD(Message, serializeToJsonString) {
@@ -1613,103 +1563,3 @@ PHP_METHOD(Message, mergeFromJsonString) {
stackenv_uninit(&se);
}
}
-
-// TODO(teboring): refactoring with putrawmsg
-static void discard_unknown_fields(MessageHeader* msg) {
- upb_msg_field_iter it;
-
- stringsink* unknown = DEREF(message_data(msg), 0, stringsink*);
- if (unknown != NULL) {
- stringsink_uninit(unknown);
- FREE(unknown);
- DEREF(message_data(msg), 0, stringsink*) = NULL;
- }
-
- // Recursively discard unknown fields of submessages.
- Descriptor* desc = msg->descriptor;
- TSRMLS_FETCH();
- for (upb_msg_field_begin(&it, desc->msgdef);
- !upb_msg_field_done(&it);
- upb_msg_field_next(&it)) {
- upb_fielddef* f = upb_msg_iter_field(&it);
- uint32_t offset = desc->layout->fields[upb_fielddef_index(f)].offset;
- bool containing_oneof = false;
-
- if (upb_fielddef_containingoneof(f)) {
- uint32_t oneof_case_offset =
- desc->layout->fields[upb_fielddef_index(f)].case_offset;
- // For a oneof, check that this field is actually present -- skip all the
- // below if not.
- if (DEREF(message_data(msg), oneof_case_offset, uint32_t) !=
- upb_fielddef_number(f)) {
- continue;
- }
- // Otherwise, fall through to the appropriate singular-field handler
- // below.
- containing_oneof = true;
- }
-
- if (is_map_field(f)) {
- MapIter map_it;
- int len, size;
- const upb_fielddef* value_field;
-
- value_field = map_field_value(f);
- if (!upb_fielddef_issubmsg(value_field)) continue;
-
- zval* map_php = CACHED_PTR_TO_ZVAL_PTR(
- DEREF(message_data(msg), offset, CACHED_VALUE*));
- if (map_php == NULL) continue;
-
- Map* intern = UNBOX(Map, map_php);
- for (map_begin(map_php, &map_it TSRMLS_CC);
- !map_done(&map_it); map_next(&map_it)) {
- upb_value value = map_iter_value(&map_it, &len);
- void* memory = raw_value(upb_value_memory(&value), value_field);
-#if PHP_MAJOR_VERSION < 7
- MessageHeader *submsg = UNBOX(MessageHeader, *(zval**)memory);
-#else
- MessageHeader *submsg =
- (MessageHeader*)((char*)(Z_OBJ_P((zval*)memory)) -
- XtOffsetOf(MessageHeader, std));
-#endif
- discard_unknown_fields(submsg);
- }
- } else if (upb_fielddef_isseq(f)) {
- if (!upb_fielddef_issubmsg(f)) continue;
-
- zval* array_php = CACHED_PTR_TO_ZVAL_PTR(
- DEREF(message_data(msg), offset, CACHED_VALUE*));
- if (array_php == NULL) continue;
-
- int size, i;
- RepeatedField* intern = UNBOX(RepeatedField, array_php);
- HashTable *ht = PHP_PROTO_HASH_OF(intern->array);
- size = zend_hash_num_elements(ht);
- if (size == 0) continue;
-
- for (i = 0; i < size; i++) {
- void* memory = repeated_field_index_native(intern, i TSRMLS_CC);
-#if PHP_MAJOR_VERSION < 7
- MessageHeader *submsg = UNBOX(MessageHeader, *(zval**)memory);
-#else
- MessageHeader *submsg =
- (MessageHeader*)((char*)(Z_OBJ_P((zval*)memory)) -
- XtOffsetOf(MessageHeader, std));
-#endif
- discard_unknown_fields(submsg);
- }
- } else if (upb_fielddef_issubmsg(f)) {
- zval* submsg_php = CACHED_PTR_TO_ZVAL_PTR(
- DEREF(message_data(msg), offset, CACHED_VALUE*));
- if (Z_TYPE_P(submsg_php) == IS_NULL) continue;
- MessageHeader* submsg = UNBOX(MessageHeader, submsg_php);
- discard_unknown_fields(submsg);
- }
- }
-}
-
-PHP_METHOD(Message, discardUnknownFields) {
- MessageHeader* msg = UNBOX(MessageHeader, getThis());
- discard_unknown_fields(msg);
-}
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/map.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/map.c
index ab8a518a4f..2680b5478c 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/map.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/map.c
@@ -293,46 +293,13 @@ static bool map_field_read_dimension(zval *object, zval *key, int type,
}
}
-static bool map_index_unset(Map *intern, const char* keyval, int length) {
- upb_value old_value;
- if (upb_strtable_remove2(&intern->table, keyval, length, &old_value)) {
- switch (intern->value_type) {
- case UPB_TYPE_MESSAGE: {
-#if PHP_MAJOR_VERSION < 7
- zval_ptr_dtor(upb_value_memory(&old_value));
-#else
- zend_object* object = *(zend_object**)upb_value_memory(&old_value);
- if(--GC_REFCOUNT(object) == 0) {
- zend_objects_store_del(object);
- }
-#endif
- break;
- }
- case UPB_TYPE_STRING:
- case UPB_TYPE_BYTES: {
-#if PHP_MAJOR_VERSION < 7
- zval_ptr_dtor(upb_value_memory(&old_value));
-#else
- zend_string* object = *(zend_string**)upb_value_memory(&old_value);
- zend_string_release(object);
-#endif
- break;
- }
- default:
- break;
- }
- }
-}
-
bool map_index_set(Map *intern, const char* keyval, int length, upb_value v) {
// Replace any existing value by issuing a 'remove' operation first.
- map_index_unset(intern, keyval, length);
-
+ upb_strtable_remove2(&intern->table, keyval, length, NULL);
if (!upb_strtable_insert2(&intern->table, keyval, length, v)) {
zend_error(E_USER_ERROR, "Could not insert into table");
return false;
}
-
return true;
}
@@ -359,7 +326,12 @@ static void map_field_write_dimension(zval *object, zval *key,
v.ctype = UPB_CTYPE_UINT64;
#endif
- map_index_set(intern, keyval, length, v);
+ // Replace any existing value by issuing a 'remove' operation first.
+ upb_strtable_remove2(&intern->table, keyval, length, NULL);
+ if (!upb_strtable_insert2(&intern->table, keyval, length, v)) {
+ zend_error(E_USER_ERROR, "Could not insert into table");
+ return;
+ }
}
static bool map_field_unset_dimension(zval *object, zval *key TSRMLS_DC) {
@@ -376,7 +348,7 @@ static bool map_field_unset_dimension(zval *object, zval *key TSRMLS_DC) {
v.ctype = UPB_CTYPE_UINT64;
#endif
- map_index_unset(intern, keyval, length);
+ upb_strtable_remove2(&intern->table, keyval, length, &v);
return true;
}
diff --git a/third_party/protobuf/3.4.0/php/ext/google/protobuf/message.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/message.c
new file mode 100644
index 0000000000..519786ddf9
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/message.c
@@ -0,0 +1,344 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2014 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 <php.h>
+#include <stdlib.h>
+
+#include "protobuf.h"
+
+static zend_class_entry* message_type;
+zend_object_handlers* message_handlers;
+
+static zend_function_entry message_methods[] = {
+ PHP_ME(Message, clear, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Message, serializeToString, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Message, mergeFromString, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Message, serializeToJsonString, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Message, mergeFromJsonString, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Message, mergeFrom, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Message, readOneof, NULL, ZEND_ACC_PROTECTED)
+ PHP_ME(Message, writeOneof, NULL, ZEND_ACC_PROTECTED)
+ PHP_ME(Message, whichOneof, NULL, ZEND_ACC_PROTECTED)
+ PHP_ME(Message, __construct, NULL, ZEND_ACC_PROTECTED)
+ {NULL, NULL, NULL}
+};
+
+// Forward declare static functions.
+
+#if PHP_MAJOR_VERSION < 7
+static void message_set_property(zval* object, zval* member, zval* value,
+ php_proto_zend_literal key TSRMLS_DC);
+static zval* message_get_property(zval* object, zval* member, int type,
+ const zend_literal* key TSRMLS_DC);
+static zval** message_get_property_ptr_ptr(zval* object, zval* member, int type,
+ php_proto_zend_literal key TSRMLS_DC);
+static HashTable* message_get_gc(zval* object, zval*** table, int* n TSRMLS_DC);
+#else
+static void message_set_property(zval* object, zval* member, zval* value,
+ void** cache_slot);
+static zval* message_get_property(zval* object, zval* member, int type,
+ void** cache_slot, zval* rv);
+static zval* message_get_property_ptr_ptr(zval* object, zval* member, int type,
+ void** cache_slot);
+static HashTable* message_get_gc(zval* object, zval** table, int* n);
+#endif
+static HashTable* message_get_properties(zval* object TSRMLS_DC);
+
+// -----------------------------------------------------------------------------
+// PHP Message Handlers
+// -----------------------------------------------------------------------------
+
+// Define object free method.
+PHP_PROTO_OBJECT_FREE_START(MessageHeader, message)
+ FREE(intern->data);
+PHP_PROTO_OBJECT_FREE_END
+
+PHP_PROTO_OBJECT_DTOR_START(MessageHeader, message)
+PHP_PROTO_OBJECT_DTOR_END
+
+// Define object create method.
+PHP_PROTO_OBJECT_CREATE_START(MessageHeader, message)
+// Because php call this create func before calling the sub-message's
+// constructor defined in PHP, it's possible that the decriptor of this class
+// hasn't been added to descritpor pool (when the class is first
+// instantiated). In that case, we will defer the initialization of the custom
+// data to the parent Message's constructor, which will be called by
+// sub-message's constructors after the descriptor has been added.
+PHP_PROTO_OBJECT_CREATE_END(MessageHeader, message)
+
+// Init class entry.
+PHP_PROTO_INIT_CLASS_START("Google\\Protobuf\\Internal\\Message",
+ MessageHeader, message)
+ message_handlers->write_property = message_set_property;
+ message_handlers->read_property = message_get_property;
+ message_handlers->get_property_ptr_ptr = message_get_property_ptr_ptr;
+ message_handlers->get_properties = message_get_properties;
+ message_handlers->get_gc = message_get_gc;
+PHP_PROTO_INIT_CLASS_END
+
+#if PHP_MAJOR_VERSION < 7
+static void message_set_property(zval* object, zval* member, zval* value,
+ php_proto_zend_literal key TSRMLS_DC) {
+#else
+static void message_set_property(zval* object, zval* member, zval* value,
+ void** cache_slot) {
+#endif
+ if (Z_TYPE_P(member) != IS_STRING) {
+ zend_error(E_USER_ERROR, "Unexpected type for field name");
+ return;
+ }
+
+#if PHP_MAJOR_VERSION < 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION == 0)
+ if (Z_OBJCE_P(object) != EG(scope)) {
+#else
+ if (Z_OBJCE_P(object) != zend_get_executed_scope()) {
+#endif
+ // User cannot set property directly (e.g., $m->a = 1)
+ zend_error(E_USER_ERROR, "Cannot access private property.");
+ return;
+ }
+
+ const upb_fielddef* field;
+
+ MessageHeader* self = UNBOX(MessageHeader, object);
+
+ field = upb_msgdef_ntofz(self->descriptor->msgdef, Z_STRVAL_P(member));
+ if (field == NULL) {
+ zend_error(E_USER_ERROR, "Unknown field: %s", Z_STRVAL_P(member));
+ }
+
+ layout_set(self->descriptor->layout, self, field, value TSRMLS_CC);
+}
+
+#if PHP_MAJOR_VERSION < 7
+static zval* message_get_property(zval* object, zval* member, int type,
+ const zend_literal* key TSRMLS_DC) {
+#else
+static zval* message_get_property(zval* object, zval* member, int type,
+ void** cache_slot, zval* rv) {
+#endif
+ if (Z_TYPE_P(member) != IS_STRING) {
+ zend_error(E_USER_ERROR, "Property name has to be a string.");
+ return PHP_PROTO_GLOBAL_UNINITIALIZED_ZVAL;
+ }
+
+#if PHP_MAJOR_VERSION < 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION == 0)
+ if (Z_OBJCE_P(object) != EG(scope)) {
+#else
+ if (Z_OBJCE_P(object) != zend_get_executed_scope()) {
+#endif
+ // User cannot get property directly (e.g., $a = $m->a)
+ zend_error(E_USER_ERROR, "Cannot access private property.");
+ return PHP_PROTO_GLOBAL_UNINITIALIZED_ZVAL;
+ }
+
+ MessageHeader* self = UNBOX(MessageHeader, object);
+ const upb_fielddef* field;
+ field = upb_msgdef_ntofz(self->descriptor->msgdef, Z_STRVAL_P(member));
+ if (field == NULL) {
+ return PHP_PROTO_GLOBAL_UNINITIALIZED_ZVAL;
+ }
+
+ zend_property_info* property_info;
+#if PHP_MAJOR_VERSION < 7
+ property_info =
+ zend_get_property_info(Z_OBJCE_P(object), member, true TSRMLS_CC);
+ return layout_get(
+ self->descriptor->layout, message_data(self), field,
+ OBJ_PROP(Z_OBJ_P(object), property_info->offset) TSRMLS_CC);
+#else
+ property_info =
+ zend_get_property_info(Z_OBJCE_P(object), Z_STR_P(member), true);
+ return layout_get(
+ self->descriptor->layout, message_data(self), field,
+ OBJ_PROP(Z_OBJ_P(object), property_info->offset) TSRMLS_CC);
+#endif
+}
+
+#if PHP_MAJOR_VERSION < 7
+static zval** message_get_property_ptr_ptr(zval* object, zval* member, int type,
+ php_proto_zend_literal key
+ TSRMLS_DC) {
+#else
+static zval* message_get_property_ptr_ptr(zval* object, zval* member, int type,
+ void** cache_slot) {
+#endif
+ return NULL;
+}
+
+static HashTable* message_get_properties(zval* object TSRMLS_DC) {
+ return NULL;
+}
+
+static HashTable* message_get_gc(zval* object, CACHED_VALUE** table,
+ int* n TSRMLS_DC) {
+ zend_object* zobj = Z_OBJ_P(object);
+ *table = zobj->properties_table;
+ *n = zobj->ce->default_properties_count;
+ return NULL;
+}
+
+// -----------------------------------------------------------------------------
+// C Message Utilities
+// -----------------------------------------------------------------------------
+
+void* message_data(MessageHeader* msg) {
+ return msg->data;
+}
+
+void custom_data_init(const zend_class_entry* ce,
+ MessageHeader* intern PHP_PROTO_TSRMLS_DC) {
+ Descriptor* desc = UNBOX_HASHTABLE_VALUE(Descriptor, get_ce_obj(ce));
+ intern->data = ALLOC_N(uint8_t, desc->layout->size);
+ memset(message_data(intern), 0, desc->layout->size);
+ // We wrap first so that everything in the message object is GC-rooted in
+ // case a collection happens during object creation in layout_init().
+ intern->descriptor = desc;
+ layout_init(desc->layout, message_data(intern),
+ &intern->std PHP_PROTO_TSRMLS_CC);
+}
+
+void build_class_from_descriptor(
+ PHP_PROTO_HASHTABLE_VALUE php_descriptor TSRMLS_DC) {
+ Descriptor* desc = UNBOX_HASHTABLE_VALUE(Descriptor, php_descriptor);
+
+ // Map entries don't have existing php class.
+ if (upb_msgdef_mapentry(desc->msgdef)) {
+ return;
+ }
+
+ zend_class_entry* registered_ce = desc->klass;
+
+ if (desc->layout == NULL) {
+ MessageLayout* layout = create_layout(desc->msgdef);
+ desc->layout = layout;
+ }
+
+ registered_ce->create_object = message_create;
+}
+
+// -----------------------------------------------------------------------------
+// PHP Methods
+// -----------------------------------------------------------------------------
+
+// At the first time the message is created, the class entry hasn't been
+// modified. As a result, the first created instance will be a normal zend
+// object. Here, we manually modify it to our message in such a case.
+PHP_METHOD(Message, __construct) {
+ zend_class_entry* ce = Z_OBJCE_P(getThis());
+ if (EXPECTED(class_added(ce))) {
+ MessageHeader* intern = UNBOX(MessageHeader, getThis());
+ custom_data_init(ce, intern PHP_PROTO_TSRMLS_CC);
+ }
+}
+
+PHP_METHOD(Message, clear) {
+ MessageHeader* msg = UNBOX(MessageHeader, getThis());
+ Descriptor* desc = msg->descriptor;
+ zend_class_entry* ce = desc->klass;
+
+ object_properties_init(&msg->std, ce);
+ layout_init(desc->layout, message_data(msg), &msg->std TSRMLS_CC);
+}
+
+PHP_METHOD(Message, mergeFrom) {
+ zval* value;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &value,
+ message_type) == FAILURE) {
+ return;
+ }
+
+ MessageHeader* from = UNBOX(MessageHeader, value);
+ MessageHeader* to = UNBOX(MessageHeader, getThis());
+
+ if(from->descriptor != to->descriptor) {
+ zend_error(E_USER_ERROR, "Cannot merge messages with different class.");
+ return;
+ }
+
+ layout_merge(from->descriptor->layout, from, to TSRMLS_CC);
+}
+
+PHP_METHOD(Message, readOneof) {
+ PHP_PROTO_LONG index;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) ==
+ FAILURE) {
+ return;
+ }
+
+ MessageHeader* msg = UNBOX(MessageHeader, getThis());
+
+ const upb_fielddef* field = upb_msgdef_itof(msg->descriptor->msgdef, index);
+
+ int property_cache_index =
+ msg->descriptor->layout->fields[upb_fielddef_index(field)].cache_index;
+ zval* property_ptr = CACHED_PTR_TO_ZVAL_PTR(
+ OBJ_PROP(Z_OBJ_P(getThis()), property_cache_index));
+
+ // Unlike singular fields, oneof fields share cached property. So we cannot
+ // let lay_get modify the cached property. Instead, we pass in the return
+ // value directly.
+ layout_get(msg->descriptor->layout, message_data(msg), field,
+ ZVAL_PTR_TO_CACHED_PTR(return_value) TSRMLS_CC);
+}
+
+PHP_METHOD(Message, writeOneof) {
+ PHP_PROTO_LONG index;
+ zval* value;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &index, &value) ==
+ FAILURE) {
+ return;
+ }
+
+ MessageHeader* msg = UNBOX(MessageHeader, getThis());
+
+ const upb_fielddef* field = upb_msgdef_itof(msg->descriptor->msgdef, index);
+
+ layout_set(msg->descriptor->layout, msg, field, value TSRMLS_CC);
+}
+
+PHP_METHOD(Message, whichOneof) {
+ char* oneof_name;
+ PHP_PROTO_SIZE length;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &oneof_name,
+ &length) == FAILURE) {
+ return;
+ }
+
+ MessageHeader* msg = UNBOX(MessageHeader, getThis());
+
+ const upb_oneofdef* oneof =
+ upb_msgdef_ntoo(msg->descriptor->msgdef, oneof_name, length);
+ const char* oneof_case_name = layout_get_oneof_case(
+ msg->descriptor->layout, message_data(msg), oneof TSRMLS_CC);
+ PHP_PROTO_RETURN_STRING(oneof_case_name, 1);
+}
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/package.xml b/third_party/protobuf/3.4.0/php/ext/google/protobuf/package.xml
index 3a556acf37..20a45bc63c 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/package.xml
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/package.xml
@@ -10,11 +10,11 @@
<email>protobuf-opensource@google.com</email>
<active>yes</active>
</lead>
- <date>2018-03-06</date>
- <time>11:02:07</time>
+ <date>2017-01-13</date>
+ <time>16:06:07</time>
<version>
- <release>3.5.2</release>
- <api>3.5.2</api>
+ <release>3.3.2</release>
+ <api>3.3.0</api>
</version>
<stability>
<release>stable</release>
@@ -136,101 +136,5 @@ GA release.
GA release.
</notes>
</release>
- <release>
- <version>
- <release>3.4.0</release>
- <api>3.4.0</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2017-08-16</date>
- <time>15:33:07</time>
- <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
- <notes>
-GA release.
- </notes>
- </release>
- <release>
- <version>
- <release>3.4.1</release>
- <api>3.4.1</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2017-09-14</date>
- <time>11:02:07</time>
- <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
- <notes>
-GA release.
- </notes>
- </release>
- <release>
- <version>
- <release>3.5.0</release>
- <api>3.5.0</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2017-11-15</date>
- <time>11:02:07</time>
- <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
- <notes>
-GA release.
- </notes>
- </release>
- <release>
- <version>
- <release>3.5.0.1</release>
- <api>3.5.0.1</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2017-12-06</date>
- <time>11:02:07</time>
- <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
- <notes>
-GA release.
- </notes>
- </release>
- <release>
- <version>
- <release>3.5.1</release>
- <api>3.5.1</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2017-12-11</date>
- <time>11:02:07</time>
- <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
- <notes>
-GA release.
- </notes>
- </release>
- <release>
- <version>
- <release>3.5.2</release>
- <api>3.5.2</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2018-03-06</date>
- <time>11:02:07</time>
- <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
- <notes>
-G A release.
- </notes>
- </release>
</changelog>
</package>
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/protobuf.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/protobuf.c
index da00302f2c..dc73003069 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/protobuf.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/protobuf.c
@@ -46,10 +46,6 @@ static HashTable* upb_def_to_php_obj_map;
// Global map from message/enum's php class entry to corresponding wrapper
// Descriptor/EnumDescriptor instances.
static HashTable* ce_to_php_obj_map;
-// Global map from message/enum's proto fully-qualified name to corresponding
-// wrapper Descriptor/EnumDescriptor instances.
-static HashTable* proto_to_php_obj_map;
-static HashTable* reserved_names;
// -----------------------------------------------------------------------------
// Global maps.
@@ -84,22 +80,6 @@ static void add_to_list(HashTable* t, void* value) {
(void**)&pDest);
}
-static void add_to_strtable(HashTable* t, const char* key, int key_size,
- void* value) {
- zval* pDest = NULL;
- php_proto_zend_hash_update_mem(t, key, key_size, &value, sizeof(void*),
- (void**)&pDest);
-}
-
-static void* get_from_strtable(const HashTable* t, const char* key, int key_size) {
- void** value;
- if (php_proto_zend_hash_find_mem(t, key, key_size, (void**)&value) ==
- FAILURE) {
- return NULL;
- }
- return *value;
-}
-
void add_def_obj(const void* def, PHP_PROTO_HASHTABLE_VALUE value) {
#if PHP_MAJOR_VERSION < 7
Z_ADDREF_P(value);
@@ -130,65 +110,6 @@ bool class_added(const void* ce) {
return exist_in_table(ce_to_php_obj_map, ce);
}
-void add_proto_obj(const char* proto, PHP_PROTO_HASHTABLE_VALUE value) {
-#if PHP_MAJOR_VERSION < 7
- Z_ADDREF_P(value);
-#else
- ++GC_REFCOUNT(value);
-#endif
- add_to_strtable(proto_to_php_obj_map, proto, strlen(proto), value);
-}
-
-PHP_PROTO_HASHTABLE_VALUE get_proto_obj(const char* proto) {
- return (PHP_PROTO_HASHTABLE_VALUE)get_from_strtable(proto_to_php_obj_map,
- proto, strlen(proto));
-}
-
-// -----------------------------------------------------------------------------
-// Well Known Types.
-// -----------------------------------------------------------------------------
-
-bool is_inited_file_any;
-bool is_inited_file_api;
-bool is_inited_file_duration;
-bool is_inited_file_field_mask;
-bool is_inited_file_empty;
-bool is_inited_file_source_context;
-bool is_inited_file_struct;
-bool is_inited_file_timestamp;
-bool is_inited_file_type;
-bool is_inited_file_wrappers;
-
-// -----------------------------------------------------------------------------
-// Reserved Name.
-// -----------------------------------------------------------------------------
-
-// Although we already have kReservedNames, we still add them to hash table to
-// speed up look up.
-const char *const kReservedNames[] = {
- "abstract", "and", "array", "as", "break",
- "callable", "case", "catch", "class", "clone",
- "const", "continue", "declare", "default", "die",
- "do", "echo", "else", "elseif", "empty",
- "enddeclare", "endfor", "endforeach", "endif", "endswitch",
- "endwhile", "eval", "exit", "extends", "final",
- "for", "foreach", "function", "global", "goto",
- "if", "implements", "include", "include_once", "instanceof",
- "insteadof", "interface", "isset", "list", "namespace",
- "new", "or", "print", "private", "protected",
- "public", "require", "require_once", "return", "static",
- "switch", "throw", "trait", "try", "unset",
- "use", "var", "while", "xor", "int",
- "float", "bool", "string", "true", "false",
- "null", "void", "iterable"};
-const int kReservedNamesSize = 73;
-
-bool is_reserved_name(const char* name) {
- void** value;
- return (php_proto_zend_hash_find(reserved_names, name, strlen(name),
- (void**)&value) == SUCCESS);
-}
-
// -----------------------------------------------------------------------------
// Utilities.
// -----------------------------------------------------------------------------
@@ -197,15 +118,8 @@ zend_function_entry protobuf_functions[] = {
ZEND_FE_END
};
-static const zend_module_dep protobuf_deps[] = {
- ZEND_MOD_OPTIONAL("date")
- ZEND_MOD_END
-};
-
zend_module_entry protobuf_module_entry = {
- STANDARD_MODULE_HEADER_EX,
- NULL,
- protobuf_deps,
+ STANDARD_MODULE_HEADER,
PHP_PROTOBUF_EXTNAME, // extension name
protobuf_functions, // function list
PHP_MINIT(protobuf), // process startup
@@ -243,39 +157,16 @@ static void php_proto_hashtable_descriptor_release(zval* value) {
#endif
static PHP_RINIT_FUNCTION(protobuf) {
- int i = 0;
-
ALLOC_HASHTABLE(upb_def_to_php_obj_map);
zend_hash_init(upb_def_to_php_obj_map, 16, NULL, HASHTABLE_VALUE_DTOR, 0);
ALLOC_HASHTABLE(ce_to_php_obj_map);
zend_hash_init(ce_to_php_obj_map, 16, NULL, HASHTABLE_VALUE_DTOR, 0);
- ALLOC_HASHTABLE(proto_to_php_obj_map);
- zend_hash_init(proto_to_php_obj_map, 16, NULL, HASHTABLE_VALUE_DTOR, 0);
-
- ALLOC_HASHTABLE(reserved_names);
- zend_hash_init(reserved_names, 16, NULL, NULL, 0);
- for (i = 0; i < kReservedNamesSize; i++) {
- php_proto_zend_hash_update(reserved_names, kReservedNames[i],
- strlen(kReservedNames[i]));
- }
-
generated_pool = NULL;
generated_pool_php = NULL;
internal_generated_pool_php = NULL;
- is_inited_file_any = false;
- is_inited_file_api = false;
- is_inited_file_duration = false;
- is_inited_file_field_mask = false;
- is_inited_file_empty = false;
- is_inited_file_source_context = false;
- is_inited_file_struct = false;
- is_inited_file_timestamp = false;
- is_inited_file_type = false;
- is_inited_file_wrappers = false;
-
return 0;
}
@@ -286,12 +177,6 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) {
zend_hash_destroy(ce_to_php_obj_map);
FREE_HASHTABLE(ce_to_php_obj_map);
- zend_hash_destroy(proto_to_php_obj_map);
- FREE_HASHTABLE(proto_to_php_obj_map);
-
- zend_hash_destroy(reserved_names);
- FREE_HASHTABLE(reserved_names);
-
#if PHP_MAJOR_VERSION < 7
if (generated_pool_php != NULL) {
zval_dtor(generated_pool_php);
@@ -314,17 +199,6 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) {
}
#endif
- is_inited_file_any = true;
- is_inited_file_api = true;
- is_inited_file_duration = true;
- is_inited_file_field_mask = true;
- is_inited_file_empty = true;
- is_inited_file_source_context = true;
- is_inited_file_struct = true;
- is_inited_file_timestamp = true;
- is_inited_file_type = true;
- is_inited_file_wrappers = true;
-
return 0;
}
@@ -344,48 +218,6 @@ static PHP_MINIT_FUNCTION(protobuf) {
repeated_field_iter_init(TSRMLS_C);
util_init(TSRMLS_C);
- gpb_metadata_any_init(TSRMLS_C);
- gpb_metadata_api_init(TSRMLS_C);
- gpb_metadata_duration_init(TSRMLS_C);
- gpb_metadata_field_mask_init(TSRMLS_C);
- gpb_metadata_empty_init(TSRMLS_C);
- gpb_metadata_source_context_init(TSRMLS_C);
- gpb_metadata_struct_init(TSRMLS_C);
- gpb_metadata_timestamp_init(TSRMLS_C);
- gpb_metadata_type_init(TSRMLS_C);
- gpb_metadata_wrappers_init(TSRMLS_C);
-
- any_init(TSRMLS_C);
- api_init(TSRMLS_C);
- bool_value_init(TSRMLS_C);
- bytes_value_init(TSRMLS_C);
- double_value_init(TSRMLS_C);
- duration_init(TSRMLS_C);
- enum_init(TSRMLS_C);
- enum_value_init(TSRMLS_C);
- field_cardinality_init(TSRMLS_C);
- field_init(TSRMLS_C);
- field_kind_init(TSRMLS_C);
- field_mask_init(TSRMLS_C);
- float_value_init(TSRMLS_C);
- empty_init(TSRMLS_C);
- int32_value_init(TSRMLS_C);
- int64_value_init(TSRMLS_C);
- list_value_init(TSRMLS_C);
- method_init(TSRMLS_C);
- mixin_init(TSRMLS_C);
- null_value_init(TSRMLS_C);
- option_init(TSRMLS_C);
- source_context_init(TSRMLS_C);
- string_value_init(TSRMLS_C);
- struct_init(TSRMLS_C);
- syntax_init(TSRMLS_C);
- timestamp_init(TSRMLS_C);
- type_init(TSRMLS_C);
- u_int32_value_init(TSRMLS_C);
- u_int64_value_init(TSRMLS_C);
- value_init(TSRMLS_C);
-
return 0;
}
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/protobuf.h b/third_party/protobuf/3.4.0/php/ext/google/protobuf/protobuf.h
index c15bde2d19..f9e9d22986 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/protobuf.h
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/protobuf.h
@@ -37,7 +37,7 @@
#include "upb.h"
#define PHP_PROTOBUF_EXTNAME "protobuf"
-#define PHP_PROTOBUF_VERSION "3.5.2"
+#define PHP_PROTOBUF_VERSION "3.3.2"
#define MAX_LENGTH_OF_INT64 20
#define SIZEOF_INT64 8
@@ -77,34 +77,15 @@
#define php_proto_zend_hash_index_update_zval(ht, h, pData) \
zend_hash_index_update(ht, h, &(pData), sizeof(void*), NULL)
-#define php_proto_zend_hash_update_zval(ht, key, key_len, value) \
- zend_hash_update(ht, key, key_len, value, sizeof(void*), NULL)
-
-#define php_proto_zend_hash_update(ht, key, key_len) \
- zend_hash_update(ht, key, key_len, 0, 0, NULL)
-
#define php_proto_zend_hash_index_update_mem(ht, h, pData, nDataSize, pDest) \
zend_hash_index_update(ht, h, pData, nDataSize, pDest)
-#define php_proto_zend_hash_update_mem(ht, key, key_len, pData, nDataSize, \
- pDest) \
- zend_hash_update(ht, key, key_len, pData, nDataSize, pDest)
-
#define php_proto_zend_hash_index_find_zval(ht, h, pDest) \
zend_hash_index_find(ht, h, pDest)
-#define php_proto_zend_hash_find(ht, key, key_len, pDest) \
- zend_hash_find(ht, key, key_len, pDest)
-
#define php_proto_zend_hash_index_find_mem(ht, h, pDest) \
zend_hash_index_find(ht, h, pDest)
-#define php_proto_zend_hash_find_zval(ht, key, key_len, pDest) \
- zend_hash_find(ht, key, key_len, pDest)
-
-#define php_proto_zend_hash_find_mem(ht, key, key_len, pDest) \
- zend_hash_find(ht, key, key_len, pDest)
-
#define php_proto_zend_hash_next_index_insert_zval(ht, pData) \
zend_hash_next_index_insert(ht, pData, sizeof(void*), NULL)
@@ -122,27 +103,6 @@
#define PHP_PROTO_WRAP_OBJECT_END \
};
-#define PHP_PROTO_INIT_SUBMSGCLASS_START(CLASSNAME, CAMELNAME, LOWWERNAME) \
- void LOWWERNAME##_init(TSRMLS_D) { \
- zend_class_entry class_type; \
- const char* class_name = CLASSNAME; \
- INIT_CLASS_ENTRY_EX(class_type, CLASSNAME, strlen(CLASSNAME), \
- LOWWERNAME##_methods); \
- LOWWERNAME##_type = zend_register_internal_class(&class_type TSRMLS_CC); \
- LOWWERNAME##_type->create_object = message_create;
-#define PHP_PROTO_INIT_SUBMSGCLASS_END \
- }
-
-#define PHP_PROTO_INIT_ENUMCLASS_START(CLASSNAME, CAMELNAME, LOWWERNAME) \
- void LOWWERNAME##_init(TSRMLS_D) { \
- zend_class_entry class_type; \
- const char* class_name = CLASSNAME; \
- INIT_CLASS_ENTRY_EX(class_type, CLASSNAME, strlen(CLASSNAME), \
- LOWWERNAME##_methods); \
- LOWWERNAME##_type = zend_register_internal_class(&class_type TSRMLS_CC);
-#define PHP_PROTO_INIT_ENUMCLASS_END \
- }
-
#define PHP_PROTO_INIT_CLASS_START(CLASSNAME, CAMELNAME, LOWWERNAME) \
void LOWWERNAME##_init(TSRMLS_D) { \
zend_class_entry class_type; \
@@ -182,8 +142,6 @@
#define CACHED_TO_ZVAL_PTR(VALUE) (VALUE)
#define CACHED_PTR_TO_ZVAL_PTR(VALUE) (*VALUE)
#define ZVAL_PTR_TO_CACHED_PTR(VALUE) (&VALUE)
-#define ZVAL_PTR_TO_CACHED_VALUE(VALUE) (VALUE)
-#define ZVAL_TO_CACHED_VALUE(VALUE) (&VALUE)
#define CREATE_OBJ_ON_ALLOCATED_ZVAL_PTR(zval_ptr, class_type) \
ZVAL_OBJ(zval_ptr, class_type->create_object(class_type TSRMLS_CC));
@@ -244,8 +202,6 @@
#define php_proto_zend_lookup_class(name, name_length, ce) \
zend_lookup_class(name, name_length, ce TSRMLS_CC)
-#define PHP_PROTO_RETVAL_ZVAL(value) ZVAL_ZVAL(return_value, value, 1, 0)
-
#else // PHP_MAJOR_VERSION >= 7
#define php_proto_zend_literal void**
@@ -278,15 +234,6 @@ static inline int php_proto_zend_hash_index_update_zval(HashTable* ht, ulong h,
return result != NULL ? SUCCESS : FAILURE;
}
-static inline int php_proto_zend_hash_update(HashTable* ht, const char* key,
- size_t key_len) {
- void* result = NULL;
- zval temp;
- ZVAL_LONG(&temp, 0);
- result = zend_hash_str_update(ht, key, key_len, &temp);
- return result != NULL ? SUCCESS : FAILURE;
-}
-
static inline int php_proto_zend_hash_index_update_mem(HashTable* ht, ulong h,
void* pData, uint nDataSize,
void** pDest) {
@@ -296,23 +243,6 @@ static inline int php_proto_zend_hash_index_update_mem(HashTable* ht, ulong h,
return result != NULL ? SUCCESS : FAILURE;
}
-static inline int php_proto_zend_hash_update_zval(HashTable* ht,
- const char* key, uint key_len,
- zval* pData) {
- zend_string* internal_key = zend_string_init(key, key_len, 0);
- zend_hash_update(ht, internal_key, pData);
-}
-
-static inline int php_proto_zend_hash_update_mem(HashTable* ht, const char* key,
- uint key_len, void* pData,
- uint nDataSize, void** pDest) {
- zend_string* internal_key = zend_string_init(key, key_len, 0);
- void* result = zend_hash_update_mem(ht, internal_key, pData, nDataSize);
- zend_string_release(internal_key);
- if (pDest != NULL) *pDest = result;
- return result != NULL ? SUCCESS : FAILURE;
-}
-
static inline int php_proto_zend_hash_index_find_zval(const HashTable* ht,
ulong h, void** pDest) {
zval* result = zend_hash_index_find(ht, h);
@@ -320,13 +250,6 @@ static inline int php_proto_zend_hash_index_find_zval(const HashTable* ht,
return result != NULL ? SUCCESS : FAILURE;
}
-static inline int php_proto_zend_hash_find(const HashTable* ht, const char* key,
- size_t key_len, void** pDest) {
- void* result = NULL;
- result = zend_hash_str_find(ht, key, key_len);
- return result != NULL ? SUCCESS : FAILURE;
-}
-
static inline int php_proto_zend_hash_index_find_mem(const HashTable* ht,
ulong h, void** pDest) {
void* result = NULL;
@@ -335,25 +258,6 @@ static inline int php_proto_zend_hash_index_find_mem(const HashTable* ht,
return result != NULL ? SUCCESS : FAILURE;
}
-static inline int php_proto_zend_hash_find_zval(const HashTable* ht,
- const char* key, uint key_len,
- void** pDest) {
- zend_string* internal_key = zend_string_init(key, key_len, 1);
- zval* result = zend_hash_find(ht, internal_key);
- if (pDest != NULL) *pDest = result;
- return result != NULL ? SUCCESS : FAILURE;
-}
-
-static inline int php_proto_zend_hash_find_mem(const HashTable* ht,
- const char* key, uint key_len,
- void** pDest) {
- zend_string* internal_key = zend_string_init(key, key_len, 1);
- void* result = zend_hash_find_ptr(ht, internal_key);
- zend_string_release(internal_key);
- if (pDest != NULL) *pDest = result;
- return result != NULL ? SUCCESS : FAILURE;
-}
-
static inline int php_proto_zend_hash_next_index_insert_zval(HashTable* ht,
void* pData) {
zval tmp;
@@ -388,27 +292,6 @@ static inline int php_proto_zend_hash_get_current_data_ex(HashTable* ht,
zend_object std; \
};
-#define PHP_PROTO_INIT_SUBMSGCLASS_START(CLASSNAME, CAMELNAME, LOWWERNAME) \
- void LOWWERNAME##_init(TSRMLS_D) { \
- zend_class_entry class_type; \
- const char* class_name = CLASSNAME; \
- INIT_CLASS_ENTRY_EX(class_type, CLASSNAME, strlen(CLASSNAME), \
- LOWWERNAME##_methods); \
- LOWWERNAME##_type = zend_register_internal_class(&class_type TSRMLS_CC); \
- LOWWERNAME##_type->create_object = message_create;
-#define PHP_PROTO_INIT_SUBMSGCLASS_END \
- }
-
-#define PHP_PROTO_INIT_ENUMCLASS_START(CLASSNAME, CAMELNAME, LOWWERNAME) \
- void LOWWERNAME##_init(TSRMLS_D) { \
- zend_class_entry class_type; \
- const char* class_name = CLASSNAME; \
- INIT_CLASS_ENTRY_EX(class_type, CLASSNAME, strlen(CLASSNAME), \
- LOWWERNAME##_methods); \
- LOWWERNAME##_type = zend_register_internal_class(&class_type TSRMLS_CC);
-#define PHP_PROTO_INIT_ENUMCLASS_END \
- }
-
#define PHP_PROTO_INIT_CLASS_START(CLASSNAME, CAMELNAME, LOWWERNAME) \
void LOWWERNAME##_init(TSRMLS_D) { \
zend_class_entry class_type; \
@@ -454,8 +337,6 @@ static inline int php_proto_zend_hash_get_current_data_ex(HashTable* ht,
#define CACHED_TO_ZVAL_PTR(VALUE) (&VALUE)
#define CACHED_PTR_TO_ZVAL_PTR(VALUE) (VALUE)
#define ZVAL_PTR_TO_CACHED_PTR(VALUE) (VALUE)
-#define ZVAL_PTR_TO_CACHED_VALUE(VALUE) (*VALUE)
-#define ZVAL_TO_CACHED_VALUE(VALUE) (VALUE)
#define CREATE_OBJ_ON_ALLOCATED_ZVAL_PTR(zval_ptr, class_type) \
ZVAL_OBJ(zval_ptr, class_type->create_object(class_type));
@@ -509,148 +390,41 @@ static inline int php_proto_zend_lookup_class(
return *ce != NULL ? SUCCESS : FAILURE;
}
-#define PHP_PROTO_RETVAL_ZVAL(value) ZVAL_COPY(return_value, value)
-
#endif // PHP_MAJOR_VERSION >= 7
-#if PHP_MAJOR_VERSION < 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION == 0)
-#define PHP_PROTO_FAKE_SCOPE_BEGIN(klass) \
- zend_class_entry* old_scope = EG(scope); \
- EG(scope) = klass;
-#define PHP_PROTO_FAKE_SCOPE_RESTART(klass) \
- old_scope = EG(scope); \
- EG(scope) = klass;
-#define PHP_PROTO_FAKE_SCOPE_END EG(scope) = old_scope;
-#else
-#define PHP_PROTO_FAKE_SCOPE_BEGIN(klass) \
- zend_class_entry* old_scope = EG(fake_scope); \
- EG(fake_scope) = klass;
-#define PHP_PROTO_FAKE_SCOPE_RESTART(klass) \
- old_scope = EG(fake_scope); \
- EG(fake_scope) = klass;
-#define PHP_PROTO_FAKE_SCOPE_END EG(fake_scope) = old_scope;
-#endif
-
-// Define PHP class
-#define DEFINE_PROTOBUF_INIT_CLASS(CLASSNAME, CAMELNAME, LOWERNAME) \
- PHP_PROTO_INIT_CLASS_START(CLASSNAME, CAMELNAME, LOWERNAME) \
- PHP_PROTO_INIT_CLASS_END
-
-#define DEFINE_PROTOBUF_CREATE(NAME, LOWERNAME) \
- PHP_PROTO_OBJECT_CREATE_START(NAME, LOWERNAME) \
- LOWERNAME##_init_c_instance(intern TSRMLS_CC); \
- PHP_PROTO_OBJECT_CREATE_END(NAME, LOWERNAME)
-
-#define DEFINE_PROTOBUF_FREE(CAMELNAME, LOWERNAME) \
- PHP_PROTO_OBJECT_FREE_START(CAMELNAME, LOWERNAME) \
- LOWERNAME##_free_c(intern TSRMLS_CC); \
- PHP_PROTO_OBJECT_FREE_END
-
-#define DEFINE_PROTOBUF_DTOR(CAMELNAME, LOWERNAME) \
- PHP_PROTO_OBJECT_DTOR_START(CAMELNAME, LOWERNAME) \
- PHP_PROTO_OBJECT_DTOR_END
-
-#define DEFINE_CLASS(NAME, LOWERNAME, string_name) \
- zend_class_entry *LOWERNAME##_type; \
- zend_object_handlers *LOWERNAME##_handlers; \
- DEFINE_PROTOBUF_FREE(NAME, LOWERNAME) \
- DEFINE_PROTOBUF_DTOR(NAME, LOWERNAME) \
- DEFINE_PROTOBUF_CREATE(NAME, LOWERNAME) \
- DEFINE_PROTOBUF_INIT_CLASS(string_name, NAME, LOWERNAME)
-
// -----------------------------------------------------------------------------
// Forward Declaration
// ----------------------------------------------------------------------------
-struct Any;
-struct Api;
-struct BoolValue;
-struct BytesValue;
-struct Descriptor;
struct DescriptorPool;
-struct DoubleValue;
-struct Duration;
-struct Enum;
+struct Descriptor;
struct EnumDescriptor;
-struct EnumValue;
struct EnumValueDescriptor;
-struct Field;
struct FieldDescriptor;
-struct FieldMask;
-struct Field_Cardinality;
-struct Field_Kind;
-struct FloatValue;
-struct GPBEmpty;
-struct Int32Value;
-struct Int64Value;
struct InternalDescriptorPool;
-struct ListValue;
-struct Map;
-struct MapIter;
struct MessageField;
struct MessageHeader;
struct MessageLayout;
-struct Method;
-struct Mixin;
-struct NullValue;
-struct Oneof;
-struct Option;
struct RepeatedField;
struct RepeatedFieldIter;
-struct SourceContext;
-struct StringValue;
-struct Struct;
-struct Syntax;
-struct Timestamp;
-struct Type;
-struct UInt32Value;
-struct UInt64Value;
-struct Value;
-
-typedef struct Any Any;
-typedef struct Api Api;
-typedef struct BoolValue BoolValue;
-typedef struct BytesValue BytesValue;
-typedef struct Descriptor Descriptor;
+struct Map;
+struct MapIter;
+struct Oneof;
+
typedef struct DescriptorPool DescriptorPool;
-typedef struct DoubleValue DoubleValue;
-typedef struct Duration Duration;
+typedef struct Descriptor Descriptor;
typedef struct EnumDescriptor EnumDescriptor;
-typedef struct Enum Enum;
typedef struct EnumValueDescriptor EnumValueDescriptor;
-typedef struct EnumValue EnumValue;
-typedef struct Field_Cardinality Field_Cardinality;
typedef struct FieldDescriptor FieldDescriptor;
-typedef struct Field Field;
-typedef struct Field_Kind Field_Kind;
-typedef struct FieldMask FieldMask;
-typedef struct FloatValue FloatValue;
-typedef struct GPBEmpty GPBEmpty;
-typedef struct Int32Value Int32Value;
-typedef struct Int64Value Int64Value;
typedef struct InternalDescriptorPool InternalDescriptorPool;
-typedef struct ListValue ListValue;
-typedef struct MapIter MapIter;
-typedef struct Map Map;
typedef struct MessageField MessageField;
typedef struct MessageHeader MessageHeader;
typedef struct MessageLayout MessageLayout;
-typedef struct Method Method;
-typedef struct Mixin Mixin;
-typedef struct NullValue NullValue;
-typedef struct Oneof Oneof;
-typedef struct Option Option;
-typedef struct RepeatedFieldIter RepeatedFieldIter;
typedef struct RepeatedField RepeatedField;
-typedef struct SourceContext SourceContext;
-typedef struct StringValue StringValue;
-typedef struct Struct Struct;
-typedef struct Syntax Syntax;
-typedef struct Timestamp Timestamp;
-typedef struct Type Type;
-typedef struct UInt32Value UInt32Value;
-typedef struct UInt64Value UInt64Value;
-typedef struct Value Value;
+typedef struct RepeatedFieldIter RepeatedFieldIter;
+typedef struct Map Map;
+typedef struct MapIter MapIter;
+typedef struct Oneof Oneof;
// -----------------------------------------------------------------------------
// Globals.
@@ -660,60 +434,19 @@ ZEND_BEGIN_MODULE_GLOBALS(protobuf)
ZEND_END_MODULE_GLOBALS(protobuf)
// Init module and PHP classes.
-void any_init(TSRMLS_D);
-void api_init(TSRMLS_D);
-void bool_value_init(TSRMLS_D);
-void bytes_value_init(TSRMLS_D);
void descriptor_init(TSRMLS_D);
-void descriptor_pool_init(TSRMLS_D);
-void double_value_init(TSRMLS_D);
-void duration_init(TSRMLS_D);
-void empty_init(TSRMLS_D);
void enum_descriptor_init(TSRMLS_D);
-void enum_init(TSRMLS_D);
-void enum_value_init(TSRMLS_D);
-void field_cardinality_init(TSRMLS_D);
+void descriptor_pool_init(TSRMLS_D);
+void internal_descriptor_pool_init(TSRMLS_D);
void field_descriptor_init(TSRMLS_D);
-void field_init(TSRMLS_D);
-void field_kind_init(TSRMLS_D);
-void field_mask_init(TSRMLS_D);
-void float_value_init(TSRMLS_D);
void gpb_type_init(TSRMLS_D);
-void int32_value_init(TSRMLS_D);
-void int64_value_init(TSRMLS_D);
-void internal_descriptor_pool_init(TSRMLS_D);
-void list_value_init(TSRMLS_D);
void map_field_init(TSRMLS_D);
void map_field_iter_init(TSRMLS_D);
-void message_init(TSRMLS_D);
-void method_init(TSRMLS_D);
-void mixin_init(TSRMLS_D);
-void null_value_init(TSRMLS_D);
void oneof_descriptor_init(TSRMLS_D);
-void option_init(TSRMLS_D);
void repeated_field_init(TSRMLS_D);
void repeated_field_iter_init(TSRMLS_D);
-void source_context_init(TSRMLS_D);
-void string_value_init(TSRMLS_D);
-void struct_init(TSRMLS_D);
-void syntax_init(TSRMLS_D);
-void timestamp_init(TSRMLS_D);
-void type_init(TSRMLS_D);
-void uint32_value_init(TSRMLS_D);
-void uint64_value_init(TSRMLS_D);
void util_init(TSRMLS_D);
-void value_init(TSRMLS_D);
-
-void gpb_metadata_any_init(TSRMLS_D);
-void gpb_metadata_api_init(TSRMLS_D);
-void gpb_metadata_duration_init(TSRMLS_D);
-void gpb_metadata_field_mask_init(TSRMLS_D);
-void gpb_metadata_empty_init(TSRMLS_D);
-void gpb_metadata_source_context_init(TSRMLS_D);
-void gpb_metadata_struct_init(TSRMLS_D);
-void gpb_metadata_timestamp_init(TSRMLS_D);
-void gpb_metadata_type_init(TSRMLS_D);
-void gpb_metadata_wrappers_init(TSRMLS_D);
+void message_init(TSRMLS_D);
// Global map from upb {msg,enum}defs to wrapper Descriptor/EnumDescriptor
// instances.
@@ -726,11 +459,6 @@ void add_ce_obj(const void* ce, PHP_PROTO_HASHTABLE_VALUE value);
PHP_PROTO_HASHTABLE_VALUE get_ce_obj(const void* ce);
bool class_added(const void* ce);
-// Global map from message/enum's proto fully-qualified name to corresponding
-// wrapper Descriptor/EnumDescriptor instances.
-void add_proto_obj(const char* proto, PHP_PROTO_HASHTABLE_VALUE value);
-PHP_PROTO_HASHTABLE_VALUE get_proto_obj(const char* proto);
-
extern zend_class_entry* map_field_type;
extern zend_class_entry* repeated_field_type;
@@ -754,10 +482,6 @@ PHP_PROTO_WRAP_OBJECT_END
PHP_METHOD(InternalDescriptorPool, getGeneratedPool);
PHP_METHOD(InternalDescriptorPool, internalAddGeneratedFile);
-void internal_add_generated_file(const char* data, PHP_PROTO_SIZE data_len,
- InternalDescriptorPool* pool TSRMLS_DC);
-void init_generated_pool_once(TSRMLS_D);
-
// wrapper of generated pool
#if PHP_MAJOR_VERSION < 7
extern zval* generated_pool_php;
@@ -843,7 +567,6 @@ void custom_data_init(const zend_class_entry* ce,
void build_class_from_descriptor(
PHP_PROTO_HASHTABLE_VALUE php_descriptor TSRMLS_DC);
-extern zend_class_entry* message_type;
extern zend_object_handlers* message_handlers;
// -----------------------------------------------------------------------------
@@ -931,8 +654,6 @@ void layout_merge(MessageLayout* layout, MessageHeader* from,
const char* layout_get_oneof_case(MessageLayout* layout, const void* storage,
const upb_oneofdef* oneof TSRMLS_DC);
void free_layout(MessageLayout* layout);
-void* slot_memory(MessageLayout* layout, const void* storage,
- const upb_fielddef* field);
PHP_METHOD(Message, clear);
PHP_METHOD(Message, mergeFrom);
@@ -953,15 +674,11 @@ PHP_METHOD(Message, __construct);
// This is called from the message class creation code.
const upb_pbdecodermethod *new_fillmsg_decodermethod(Descriptor *desc,
const void *owner);
-void serialize_to_string(zval* val, zval* return_value TSRMLS_DC);
-void merge_from_string(const char* data, int data_len, const Descriptor* desc,
- MessageHeader* msg);
PHP_METHOD(Message, serializeToString);
PHP_METHOD(Message, mergeFromString);
PHP_METHOD(Message, serializeToJsonString);
PHP_METHOD(Message, mergeFromJsonString);
-PHP_METHOD(Message, discardUnknownFields);
// -----------------------------------------------------------------------------
// Type check / conversion.
@@ -976,11 +693,6 @@ bool protobuf_convert_to_double(zval* from, double* to);
bool protobuf_convert_to_bool(zval* from, int8_t* to);
bool protobuf_convert_to_string(zval* from);
-void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type,
- zval* val, zval* return_value);
-void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type,
- PHP_PROTO_LONG value_type, zval* val, zval* return_value);
-
PHP_METHOD(Util, checkInt32);
PHP_METHOD(Util, checkUint32);
PHP_METHOD(Util, checkInt64);
@@ -1169,255 +881,6 @@ extern zend_class_entry* oneof_descriptor_type;
#define ONEOF_CASE_NONE 0
// -----------------------------------------------------------------------------
-// Well Known Type.
-// -----------------------------------------------------------------------------
-
-extern bool is_inited_file_any;
-extern bool is_inited_file_api;
-extern bool is_inited_file_duration;
-extern bool is_inited_file_field_mask;
-extern bool is_inited_file_empty;
-extern bool is_inited_file_source_context;
-extern bool is_inited_file_struct;
-extern bool is_inited_file_timestamp;
-extern bool is_inited_file_type;
-extern bool is_inited_file_wrappers;
-
-PHP_METHOD(GPBMetadata_Any, initOnce);
-PHP_METHOD(GPBMetadata_Api, initOnce);
-PHP_METHOD(GPBMetadata_Duration, initOnce);
-PHP_METHOD(GPBMetadata_FieldMask, initOnce);
-PHP_METHOD(GPBMetadata_Empty, initOnce);
-PHP_METHOD(GPBMetadata_SourceContext, initOnce);
-PHP_METHOD(GPBMetadata_Struct, initOnce);
-PHP_METHOD(GPBMetadata_Timestamp, initOnce);
-PHP_METHOD(GPBMetadata_Type, initOnce);
-PHP_METHOD(GPBMetadata_Wrappers, initOnce);
-
-PHP_METHOD(Any, __construct);
-PHP_METHOD(Any, getTypeUrl);
-PHP_METHOD(Any, setTypeUrl);
-PHP_METHOD(Any, getValue);
-PHP_METHOD(Any, setValue);
-PHP_METHOD(Any, unpack);
-PHP_METHOD(Any, pack);
-PHP_METHOD(Any, is);
-
-PHP_METHOD(Duration, __construct);
-PHP_METHOD(Duration, getSeconds);
-PHP_METHOD(Duration, setSeconds);
-PHP_METHOD(Duration, getNanos);
-PHP_METHOD(Duration, setNanos);
-
-PHP_METHOD(Timestamp, __construct);
-PHP_METHOD(Timestamp, fromDateTime);
-PHP_METHOD(Timestamp, toDateTime);
-PHP_METHOD(Timestamp, getSeconds);
-PHP_METHOD(Timestamp, setSeconds);
-PHP_METHOD(Timestamp, getNanos);
-PHP_METHOD(Timestamp, setNanos);
-
-PHP_METHOD(Api, __construct);
-PHP_METHOD(Api, getName);
-PHP_METHOD(Api, setName);
-PHP_METHOD(Api, getMethods);
-PHP_METHOD(Api, setMethods);
-PHP_METHOD(Api, getOptions);
-PHP_METHOD(Api, setOptions);
-PHP_METHOD(Api, getVersion);
-PHP_METHOD(Api, setVersion);
-PHP_METHOD(Api, getSourceContext);
-PHP_METHOD(Api, setSourceContext);
-PHP_METHOD(Api, getMixins);
-PHP_METHOD(Api, setMixins);
-PHP_METHOD(Api, getSyntax);
-PHP_METHOD(Api, setSyntax);
-
-PHP_METHOD(BoolValue, __construct);
-PHP_METHOD(BoolValue, getValue);
-PHP_METHOD(BoolValue, setValue);
-
-PHP_METHOD(BytesValue, __construct);
-PHP_METHOD(BytesValue, getValue);
-PHP_METHOD(BytesValue, setValue);
-
-PHP_METHOD(DoubleValue, __construct);
-PHP_METHOD(DoubleValue, getValue);
-PHP_METHOD(DoubleValue, setValue);
-
-PHP_METHOD(Enum, __construct);
-PHP_METHOD(Enum, getName);
-PHP_METHOD(Enum, setName);
-PHP_METHOD(Enum, getEnumvalue);
-PHP_METHOD(Enum, setEnumvalue);
-PHP_METHOD(Enum, getOptions);
-PHP_METHOD(Enum, setOptions);
-PHP_METHOD(Enum, getSourceContext);
-PHP_METHOD(Enum, setSourceContext);
-PHP_METHOD(Enum, getSyntax);
-PHP_METHOD(Enum, setSyntax);
-
-PHP_METHOD(EnumValue, __construct);
-PHP_METHOD(EnumValue, getName);
-PHP_METHOD(EnumValue, setName);
-PHP_METHOD(EnumValue, getNumber);
-PHP_METHOD(EnumValue, setNumber);
-PHP_METHOD(EnumValue, getOptions);
-PHP_METHOD(EnumValue, setOptions);
-
-PHP_METHOD(FieldMask, __construct);
-PHP_METHOD(FieldMask, getPaths);
-PHP_METHOD(FieldMask, setPaths);
-
-PHP_METHOD(Field, __construct);
-PHP_METHOD(Field, getKind);
-PHP_METHOD(Field, setKind);
-PHP_METHOD(Field, getCardinality);
-PHP_METHOD(Field, setCardinality);
-PHP_METHOD(Field, getNumber);
-PHP_METHOD(Field, setNumber);
-PHP_METHOD(Field, getName);
-PHP_METHOD(Field, setName);
-PHP_METHOD(Field, getTypeUrl);
-PHP_METHOD(Field, setTypeUrl);
-PHP_METHOD(Field, getOneofIndex);
-PHP_METHOD(Field, setOneofIndex);
-PHP_METHOD(Field, getPacked);
-PHP_METHOD(Field, setPacked);
-PHP_METHOD(Field, getOptions);
-PHP_METHOD(Field, setOptions);
-PHP_METHOD(Field, getJsonName);
-PHP_METHOD(Field, setJsonName);
-PHP_METHOD(Field, getDefaultValue);
-PHP_METHOD(Field, setDefaultValue);
-
-PHP_METHOD(FloatValue, __construct);
-PHP_METHOD(FloatValue, getValue);
-PHP_METHOD(FloatValue, setValue);
-
-PHP_METHOD(GPBEmpty, __construct);
-
-PHP_METHOD(Int32Value, __construct);
-PHP_METHOD(Int32Value, getValue);
-PHP_METHOD(Int32Value, setValue);
-
-PHP_METHOD(Int64Value, __construct);
-PHP_METHOD(Int64Value, getValue);
-PHP_METHOD(Int64Value, setValue);
-
-PHP_METHOD(ListValue, __construct);
-PHP_METHOD(ListValue, getValues);
-PHP_METHOD(ListValue, setValues);
-
-PHP_METHOD(Method, __construct);
-PHP_METHOD(Method, getName);
-PHP_METHOD(Method, setName);
-PHP_METHOD(Method, getRequestTypeUrl);
-PHP_METHOD(Method, setRequestTypeUrl);
-PHP_METHOD(Method, getRequestStreaming);
-PHP_METHOD(Method, setRequestStreaming);
-PHP_METHOD(Method, getResponseTypeUrl);
-PHP_METHOD(Method, setResponseTypeUrl);
-PHP_METHOD(Method, getResponseStreaming);
-PHP_METHOD(Method, setResponseStreaming);
-PHP_METHOD(Method, getOptions);
-PHP_METHOD(Method, setOptions);
-PHP_METHOD(Method, getSyntax);
-PHP_METHOD(Method, setSyntax);
-
-PHP_METHOD(Mixin, __construct);
-PHP_METHOD(Mixin, getName);
-PHP_METHOD(Mixin, setName);
-PHP_METHOD(Mixin, getRoot);
-PHP_METHOD(Mixin, setRoot);
-
-PHP_METHOD(Option, __construct);
-PHP_METHOD(Option, getName);
-PHP_METHOD(Option, setName);
-PHP_METHOD(Option, getValue);
-PHP_METHOD(Option, setValue);
-
-PHP_METHOD(SourceContext, __construct);
-PHP_METHOD(SourceContext, getFileName);
-PHP_METHOD(SourceContext, setFileName);
-
-PHP_METHOD(StringValue, __construct);
-PHP_METHOD(StringValue, getValue);
-PHP_METHOD(StringValue, setValue);
-
-PHP_METHOD(Struct, __construct);
-PHP_METHOD(Struct, getFields);
-PHP_METHOD(Struct, setFields);
-
-PHP_METHOD(Type, __construct);
-PHP_METHOD(Type, getName);
-PHP_METHOD(Type, setName);
-PHP_METHOD(Type, getFields);
-PHP_METHOD(Type, setFields);
-PHP_METHOD(Type, getOneofs);
-PHP_METHOD(Type, setOneofs);
-PHP_METHOD(Type, getOptions);
-PHP_METHOD(Type, setOptions);
-PHP_METHOD(Type, getSourceContext);
-PHP_METHOD(Type, setSourceContext);
-PHP_METHOD(Type, getSyntax);
-PHP_METHOD(Type, setSyntax);
-
-PHP_METHOD(UInt32Value, __construct);
-PHP_METHOD(UInt32Value, getValue);
-PHP_METHOD(UInt32Value, setValue);
-
-PHP_METHOD(UInt64Value, __construct);
-PHP_METHOD(UInt64Value, getValue);
-PHP_METHOD(UInt64Value, setValue);
-
-PHP_METHOD(Value, __construct);
-PHP_METHOD(Value, getNullValue);
-PHP_METHOD(Value, setNullValue);
-PHP_METHOD(Value, getNumberValue);
-PHP_METHOD(Value, setNumberValue);
-PHP_METHOD(Value, getStringValue);
-PHP_METHOD(Value, setStringValue);
-PHP_METHOD(Value, getBoolValue);
-PHP_METHOD(Value, setBoolValue);
-PHP_METHOD(Value, getStructValue);
-PHP_METHOD(Value, setStructValue);
-PHP_METHOD(Value, getListValue);
-PHP_METHOD(Value, setListValue);
-PHP_METHOD(Value, getKind);
-
-extern zend_class_entry* any_type;
-extern zend_class_entry* api_type;
-extern zend_class_entry* bool_value_type;
-extern zend_class_entry* bytes_value_type;
-extern zend_class_entry* double_value_type;
-extern zend_class_entry* duration_type;
-extern zend_class_entry* empty_type;
-extern zend_class_entry* enum_type;
-extern zend_class_entry* enum_value_type;
-extern zend_class_entry* field_cardinality_type;
-extern zend_class_entry* field_kind_type;
-extern zend_class_entry* field_mask_type;
-extern zend_class_entry* field_type;
-extern zend_class_entry* float_value_type;
-extern zend_class_entry* int32_value_type;
-extern zend_class_entry* int64_value_type;
-extern zend_class_entry* list_value_type;
-extern zend_class_entry* method_type;
-extern zend_class_entry* mixin_type;
-extern zend_class_entry* null_value_type;
-extern zend_class_entry* option_type;
-extern zend_class_entry* source_context_type;
-extern zend_class_entry* string_value_type;
-extern zend_class_entry* struct_type;
-extern zend_class_entry* syntax_type;
-extern zend_class_entry* timestamp_type;
-extern zend_class_entry* type_type;
-extern zend_class_entry* uint32_value_type;
-extern zend_class_entry* uint64_value_type;
-extern zend_class_entry* value_type;
-
-// -----------------------------------------------------------------------------
// Upb.
// -----------------------------------------------------------------------------
@@ -1447,20 +910,4 @@ const zend_class_entry* field_type_class(
.bucket.obj.object))
#endif
-// Message handler
-static inline zval* php_proto_message_read_property(
- zval* msg, zval* member PHP_PROTO_TSRMLS_DC) {
-#if PHP_MAJOR_VERSION < 7
- return message_handlers->read_property(msg, member, BP_VAR_R,
- NULL PHP_PROTO_TSRMLS_CC);
-#else
- return message_handlers->read_property(msg, member, BP_VAR_R, NULL,
- NULL PHP_PROTO_TSRMLS_CC);
-#endif
-}
-
-// Reserved name
-bool is_reserved_name(const char* name);
-bool is_valid_constant_name(const char* name);
-
#endif // __GOOGLE_PROTOBUF_PHP_PROTOBUF_H__
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/storage.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/storage.c
index e7910c85de..4830e15f23 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/storage.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/storage.c
@@ -560,6 +560,11 @@ static size_t align_up_to(size_t offset, size_t granularity) {
return (offset + granularity - 1) & ~(granularity - 1);
}
+static void* slot_memory(MessageLayout* layout, const void* storage,
+ const upb_fielddef* field) {
+ return ((uint8_t*)storage) + layout->fields[upb_fielddef_index(field)].offset;
+}
+
static uint32_t* slot_oneof_case(MessageLayout* layout, const void* storage,
const upb_fielddef* field) {
return (uint32_t*)(((uint8_t*)storage) +
@@ -571,11 +576,6 @@ static int slot_property_cache(MessageLayout* layout, const void* storage,
return layout->fields[upb_fielddef_index(field)].cache_index;
}
-void* slot_memory(MessageLayout* layout, const void* storage,
- const upb_fielddef* field) {
- return ((uint8_t*)storage) + layout->fields[upb_fielddef_index(field)].offset;
-}
-
MessageLayout* create_layout(const upb_msgdef* msgdef) {
MessageLayout* layout = ALLOC(MessageLayout);
int nfields = upb_msgdef_numfields(msgdef);
@@ -583,12 +583,9 @@ MessageLayout* create_layout(const upb_msgdef* msgdef) {
upb_msg_oneof_iter oit;
size_t off = 0;
int i = 0;
-
- // Reserve space for unknown fields.
- off += sizeof(void*);
-
TSRMLS_FETCH();
Descriptor* desc = UNBOX_HASHTABLE_VALUE(Descriptor, get_def_obj(msgdef));
+
layout->fields = ALLOC_N(MessageField, nfields);
for (upb_msg_field_begin(&it, msgdef); !upb_msg_field_done(&it);
@@ -747,10 +744,6 @@ void layout_init(MessageLayout* layout, void* storage,
zend_object* object PHP_PROTO_TSRMLS_DC) {
int i;
upb_msg_field_iter it;
-
- // Init unknown fields
- memset(storage, 0, sizeof(void*));
-
for (upb_msg_field_begin(&it, layout->msgdef), i = 0; !upb_msg_field_done(&it);
upb_msg_field_next(&it), i++) {
const upb_fielddef* field = upb_msg_iter_field(&it);
@@ -863,41 +856,12 @@ void layout_set(MessageLayout* layout, MessageHeader* header,
zval* property_ptr = CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory);
if (EXPECTED(property_ptr != val)) {
- zend_class_entry *subce = NULL;
- zval converted_value;
-
- if (upb_fielddef_ismap(field)) {
- const upb_msgdef* mapmsg = upb_fielddef_msgsubdef(field);
- const upb_fielddef* keyfield = upb_msgdef_ntof(mapmsg, "key", 3);
- const upb_fielddef* valuefield = upb_msgdef_ntof(mapmsg, "value", 5);
- if (upb_fielddef_descriptortype(valuefield) ==
- UPB_DESCRIPTOR_TYPE_MESSAGE) {
- const upb_msgdef* submsg = upb_fielddef_msgsubdef(valuefield);
- Descriptor* subdesc =
- UNBOX_HASHTABLE_VALUE(Descriptor, get_def_obj(submsg));
- subce = subdesc->klass;
- }
- check_map_field(subce, upb_fielddef_descriptortype(keyfield),
- upb_fielddef_descriptortype(valuefield), val,
- &converted_value);
- } else {
- if (upb_fielddef_type(field) == UPB_TYPE_MESSAGE) {
- const upb_msgdef* submsg = upb_fielddef_msgsubdef(field);
- Descriptor* subdesc =
- UNBOX_HASHTABLE_VALUE(Descriptor, get_def_obj(submsg));
- subce = subdesc->klass;
- }
-
- check_repeated_field(subce, upb_fielddef_descriptortype(field), val,
- &converted_value);
- }
#if PHP_MAJOR_VERSION < 7
- REPLACE_ZVAL_VALUE((zval**)memory, &converted_value, 1);
+ REPLACE_ZVAL_VALUE((zval**)memory, val, 1);
#else
- php_proto_zval_ptr_dtor(property_ptr);
- ZVAL_ZVAL(property_ptr, &converted_value, 1, 0);
+ php_proto_zval_ptr_dtor(property_ptr);
+ ZVAL_ZVAL(property_ptr, val, 1, 0);
#endif
- zval_dtor(&converted_value);
}
} else {
upb_fieldtype_t type = upb_fielddef_type(field);
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/type_check.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/type_check.c
index 85f5051eda..fada8d6a79 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/type_check.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/type_check.c
@@ -428,15 +428,21 @@ PHP_METHOD(Util, checkMessage) {
RETURN_ZVAL(val, 1, 0);
}
-void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type,
- zval* val, zval* return_value) {
+PHP_METHOD(Util, checkRepeatedField) {
+ zval* val;
+ PHP_PROTO_LONG type;
+ const zend_class_entry* klass = NULL;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|C", &val, &type,
+ &klass) == FAILURE) {
+ return;
+ }
+
#if PHP_MAJOR_VERSION >= 7
if (Z_ISREF_P(val)) {
ZVAL_DEREF(val);
}
#endif
- TSRMLS_FETCH();
if (Z_TYPE_P(val) == IS_ARRAY) {
HashTable* table = HASH_OF(val);
HashPosition pointer;
@@ -461,7 +467,8 @@ void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type,
CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC);
}
- RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 1);
+ Z_DELREF_P(CACHED_TO_ZVAL_PTR(repeated_field));
+ RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 0);
} else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) {
@@ -485,28 +492,24 @@ void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type,
zend_error(E_USER_ERROR, "Incorrect repeated field type.");
return;
}
+
}
-PHP_METHOD(Util, checkRepeatedField) {
+PHP_METHOD(Util, checkMapField) {
zval* val;
- PHP_PROTO_LONG type;
+ PHP_PROTO_LONG key_type, value_type;
const zend_class_entry* klass = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|C", &val, &type,
- &klass) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll|C", &val, &key_type,
+ &value_type, &klass) == FAILURE) {
return;
}
- RETURN_ZVAL(val, 1, 0);
-}
-void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type,
- PHP_PROTO_LONG value_type, zval* val, zval* return_value) {
#if PHP_MAJOR_VERSION >= 7
if (Z_ISREF_P(val)) {
ZVAL_DEREF(val);
}
#endif
- TSRMLS_FETCH();
if (Z_TYPE_P(val) == IS_ARRAY) {
HashTable* table = Z_ARRVAL_P(val);
HashPosition pointer;
@@ -532,10 +535,10 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type,
map_field_handlers->write_dimension(
CACHED_TO_ZVAL_PTR(map_field), &key,
CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC);
- zval_dtor(&key);
}
- RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 1);
+ Z_DELREF_P(CACHED_TO_ZVAL_PTR(map_field));
+ RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 0);
} else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) {
zend_error(E_USER_ERROR, "Given value is not an instance of %s.",
@@ -562,14 +565,3 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type,
return;
}
}
-
-PHP_METHOD(Util, checkMapField) {
- zval* val;
- PHP_PROTO_LONG key_type, value_type;
- const zend_class_entry* klass = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll|C", &val, &key_type,
- &value_type, &klass) == FAILURE) {
- return;
- }
- RETURN_ZVAL(val, 1, 0);
-}
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/upb.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/upb.c
index e01f3bfd6e..d701dcbaaf 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/upb.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/upb.c
@@ -1,2507 +1,5 @@
// Amalgamated source file
#include "upb.h"
-/* This file was generated by upbc (the upb compiler) from the input
- * file:
- *
- * google/protobuf/descriptor.proto
- *
- * Do not edit -- your changes will be discarded when the file is
- * regenerated. */
-
-#include <stddef.h>
-
-
-struct google_protobuf_FileDescriptorSet {
- upb_array* file;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_FileDescriptorSet_submsgs[1] = {
- &google_protobuf_FileDescriptorProto_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_FileDescriptorSet__fields[1] = {
- {1, offsetof(google_protobuf_FileDescriptorSet, file), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorSet_msginit = {
- &google_protobuf_FileDescriptorSet_submsgs[0],
- &google_protobuf_FileDescriptorSet__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_FileDescriptorSet), 1, 0, false, true
-};
-
-google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_env *env) {
- google_protobuf_FileDescriptorSet *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_FileDescriptorSet *msg = google_protobuf_FileDescriptorSet_new(env);
- if (upb_decode(buf, msg, &google_protobuf_FileDescriptorSet_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_FileDescriptorSet_serialize(google_protobuf_FileDescriptorSet *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, env, size);
-}
-const upb_array* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg) {
- return msg->file;
-}
-void google_protobuf_FileDescriptorSet_set_file(google_protobuf_FileDescriptorSet *msg, upb_array* value) {
- msg->file = value;
-}
-struct google_protobuf_FileDescriptorProto {
- upb_stringview name;
- upb_stringview package;
- upb_stringview syntax;
- google_protobuf_FileOptions* options;
- google_protobuf_SourceCodeInfo* source_code_info;
- upb_array* dependency;
- upb_array* message_type;
- upb_array* enum_type;
- upb_array* service;
- upb_array* extension;
- upb_array* public_dependency;
- upb_array* weak_dependency;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_FileDescriptorProto_submsgs[6] = {
- &google_protobuf_DescriptorProto_msginit,
- &google_protobuf_EnumDescriptorProto_msginit,
- &google_protobuf_FieldDescriptorProto_msginit,
- &google_protobuf_FileOptions_msginit,
- &google_protobuf_ServiceDescriptorProto_msginit,
- &google_protobuf_SourceCodeInfo_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_FileDescriptorProto__fields[12] = {
- {1, offsetof(google_protobuf_FileDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {2, offsetof(google_protobuf_FileDescriptorProto, package), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {3, offsetof(google_protobuf_FileDescriptorProto, dependency), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3},
- {4, offsetof(google_protobuf_FileDescriptorProto, message_type), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
- {5, offsetof(google_protobuf_FileDescriptorProto, enum_type), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 1, 11, 3},
- {6, offsetof(google_protobuf_FileDescriptorProto, service), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 4, 11, 3},
- {7, offsetof(google_protobuf_FileDescriptorProto, extension), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 2, 11, 3},
- {8, offsetof(google_protobuf_FileDescriptorProto, options), 3, UPB_NOT_IN_ONEOF, 3, 11, 1},
- {9, offsetof(google_protobuf_FileDescriptorProto, source_code_info), 4, UPB_NOT_IN_ONEOF, 5, 11, 1},
- {10, offsetof(google_protobuf_FileDescriptorProto, public_dependency), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3},
- {11, offsetof(google_protobuf_FileDescriptorProto, weak_dependency), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3},
- {12, offsetof(google_protobuf_FileDescriptorProto, syntax), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorProto_msginit = {
- &google_protobuf_FileDescriptorProto_submsgs[0],
- &google_protobuf_FileDescriptorProto__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_FileDescriptorProto), 12, 0, false, true
-};
-
-google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_env *env) {
- google_protobuf_FileDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_FileDescriptorProto *msg = google_protobuf_FileDescriptorProto_new(env);
- if (upb_decode(buf, msg, &google_protobuf_FileDescriptorProto_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_FileDescriptorProto_serialize(google_protobuf_FileDescriptorProto *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, env, size);
-}
-upb_stringview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) {
- return msg->name;
-}
-void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_stringview value) {
- msg->name = value;
-}
-upb_stringview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) {
- return msg->package;
-}
-void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_stringview value) {
- msg->package = value;
-}
-const upb_array* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg) {
- return msg->dependency;
-}
-void google_protobuf_FileDescriptorProto_set_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) {
- msg->dependency = value;
-}
-const upb_array* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg) {
- return msg->message_type;
-}
-void google_protobuf_FileDescriptorProto_set_message_type(google_protobuf_FileDescriptorProto *msg, upb_array* value) {
- msg->message_type = value;
-}
-const upb_array* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg) {
- return msg->enum_type;
-}
-void google_protobuf_FileDescriptorProto_set_enum_type(google_protobuf_FileDescriptorProto *msg, upb_array* value) {
- msg->enum_type = value;
-}
-const upb_array* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg) {
- return msg->service;
-}
-void google_protobuf_FileDescriptorProto_set_service(google_protobuf_FileDescriptorProto *msg, upb_array* value) {
- msg->service = value;
-}
-const upb_array* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg) {
- return msg->extension;
-}
-void google_protobuf_FileDescriptorProto_set_extension(google_protobuf_FileDescriptorProto *msg, upb_array* value) {
- msg->extension = value;
-}
-const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) {
- return msg->options;
-}
-void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
- msg->options = value;
-}
-const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) {
- return msg->source_code_info;
-}
-void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
- msg->source_code_info = value;
-}
-const upb_array* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg) {
- return msg->public_dependency;
-}
-void google_protobuf_FileDescriptorProto_set_public_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) {
- msg->public_dependency = value;
-}
-const upb_array* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg) {
- return msg->weak_dependency;
-}
-void google_protobuf_FileDescriptorProto_set_weak_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) {
- msg->weak_dependency = value;
-}
-upb_stringview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) {
- return msg->syntax;
-}
-void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_stringview value) {
- msg->syntax = value;
-}
-struct google_protobuf_DescriptorProto {
- upb_stringview name;
- google_protobuf_MessageOptions* options;
- upb_array* field;
- upb_array* nested_type;
- upb_array* enum_type;
- upb_array* extension_range;
- upb_array* extension;
- upb_array* oneof_decl;
- upb_array* reserved_range;
- upb_array* reserved_name;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_DescriptorProto_submsgs[8] = {
- &google_protobuf_DescriptorProto_msginit,
- &google_protobuf_DescriptorProto_ExtensionRange_msginit,
- &google_protobuf_DescriptorProto_ReservedRange_msginit,
- &google_protobuf_EnumDescriptorProto_msginit,
- &google_protobuf_FieldDescriptorProto_msginit,
- &google_protobuf_MessageOptions_msginit,
- &google_protobuf_OneofDescriptorProto_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_DescriptorProto__fields[10] = {
- {1, offsetof(google_protobuf_DescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {2, offsetof(google_protobuf_DescriptorProto, field), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 4, 11, 3},
- {3, offsetof(google_protobuf_DescriptorProto, nested_type), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
- {4, offsetof(google_protobuf_DescriptorProto, enum_type), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 3, 11, 3},
- {5, offsetof(google_protobuf_DescriptorProto, extension_range), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 1, 11, 3},
- {6, offsetof(google_protobuf_DescriptorProto, extension), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 4, 11, 3},
- {7, offsetof(google_protobuf_DescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 5, 11, 1},
- {8, offsetof(google_protobuf_DescriptorProto, oneof_decl), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 6, 11, 3},
- {9, offsetof(google_protobuf_DescriptorProto, reserved_range), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 2, 11, 3},
- {10, offsetof(google_protobuf_DescriptorProto, reserved_name), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_msginit = {
- &google_protobuf_DescriptorProto_submsgs[0],
- &google_protobuf_DescriptorProto__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_DescriptorProto), 10, 0, false, true
-};
-
-google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_env *env) {
- google_protobuf_DescriptorProto *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_DescriptorProto *msg = google_protobuf_DescriptorProto_new(env);
- if (upb_decode(buf, msg, &google_protobuf_DescriptorProto_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_DescriptorProto_serialize(google_protobuf_DescriptorProto *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, env, size);
-}
-upb_stringview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) {
- return msg->name;
-}
-void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_stringview value) {
- msg->name = value;
-}
-const upb_array* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg) {
- return msg->field;
-}
-void google_protobuf_DescriptorProto_set_field(google_protobuf_DescriptorProto *msg, upb_array* value) {
- msg->field = value;
-}
-const upb_array* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg) {
- return msg->nested_type;
-}
-void google_protobuf_DescriptorProto_set_nested_type(google_protobuf_DescriptorProto *msg, upb_array* value) {
- msg->nested_type = value;
-}
-const upb_array* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg) {
- return msg->enum_type;
-}
-void google_protobuf_DescriptorProto_set_enum_type(google_protobuf_DescriptorProto *msg, upb_array* value) {
- msg->enum_type = value;
-}
-const upb_array* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg) {
- return msg->extension_range;
-}
-void google_protobuf_DescriptorProto_set_extension_range(google_protobuf_DescriptorProto *msg, upb_array* value) {
- msg->extension_range = value;
-}
-const upb_array* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg) {
- return msg->extension;
-}
-void google_protobuf_DescriptorProto_set_extension(google_protobuf_DescriptorProto *msg, upb_array* value) {
- msg->extension = value;
-}
-const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) {
- return msg->options;
-}
-void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
- msg->options = value;
-}
-const upb_array* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg) {
- return msg->oneof_decl;
-}
-void google_protobuf_DescriptorProto_set_oneof_decl(google_protobuf_DescriptorProto *msg, upb_array* value) {
- msg->oneof_decl = value;
-}
-const upb_array* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg) {
- return msg->reserved_range;
-}
-void google_protobuf_DescriptorProto_set_reserved_range(google_protobuf_DescriptorProto *msg, upb_array* value) {
- msg->reserved_range = value;
-}
-const upb_array* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg) {
- return msg->reserved_name;
-}
-void google_protobuf_DescriptorProto_set_reserved_name(google_protobuf_DescriptorProto *msg, upb_array* value) {
- msg->reserved_name = value;
-}
-struct google_protobuf_DescriptorProto_ExtensionRange {
- int32_t start;
- int32_t end;
- google_protobuf_ExtensionRangeOptions* options;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = {
- &google_protobuf_ExtensionRangeOptions_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_DescriptorProto_ExtensionRange__fields[3] = {
- {1, offsetof(google_protobuf_DescriptorProto_ExtensionRange, start), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
- {2, offsetof(google_protobuf_DescriptorProto_ExtensionRange, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
- {3, offsetof(google_protobuf_DescriptorProto_ExtensionRange, options), 2, UPB_NOT_IN_ONEOF, 0, 11, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ExtensionRange_msginit = {
- &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0],
- &google_protobuf_DescriptorProto_ExtensionRange__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_DescriptorProto_ExtensionRange), 3, 0, false, true
-};
-
-google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_env *env) {
- google_protobuf_DescriptorProto_ExtensionRange *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_DescriptorProto_ExtensionRange *msg = google_protobuf_DescriptorProto_ExtensionRange_new(env);
- if (upb_decode(buf, msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_DescriptorProto_ExtensionRange_serialize(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, env, size);
-}
-int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) {
- return msg->start;
-}
-void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
- msg->start = value;
-}
-int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) {
- return msg->end;
-}
-void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
- msg->end = value;
-}
-const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) {
- return msg->options;
-}
-void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
- msg->options = value;
-}
-struct google_protobuf_DescriptorProto_ReservedRange {
- int32_t start;
- int32_t end;
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_DescriptorProto_ReservedRange__fields[2] = {
- {1, offsetof(google_protobuf_DescriptorProto_ReservedRange, start), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
- {2, offsetof(google_protobuf_DescriptorProto_ReservedRange, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ReservedRange_msginit = {
- NULL,
- &google_protobuf_DescriptorProto_ReservedRange__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_DescriptorProto_ReservedRange), 2, 0, false, true
-};
-
-google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_env *env) {
- google_protobuf_DescriptorProto_ReservedRange *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_DescriptorProto_ReservedRange *msg = google_protobuf_DescriptorProto_ReservedRange_new(env);
- if (upb_decode(buf, msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_DescriptorProto_ReservedRange_serialize(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, env, size);
-}
-int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg) {
- return msg->start;
-}
-void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
- msg->start = value;
-}
-int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg) {
- return msg->end;
-}
-void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
- msg->end = value;
-}
-struct google_protobuf_ExtensionRangeOptions {
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_ExtensionRangeOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_ExtensionRangeOptions__fields[1] = {
- {999, offsetof(google_protobuf_ExtensionRangeOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_ExtensionRangeOptions_msginit = {
- &google_protobuf_ExtensionRangeOptions_submsgs[0],
- &google_protobuf_ExtensionRangeOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_ExtensionRangeOptions), 1, 0, false, true
-};
-
-google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_env *env) {
- google_protobuf_ExtensionRangeOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_ExtensionRangeOptions *msg = google_protobuf_ExtensionRangeOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_ExtensionRangeOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_ExtensionRangeOptions_serialize(google_protobuf_ExtensionRangeOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, env, size);
-}
-const upb_array* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_ExtensionRangeOptions_set_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_FieldDescriptorProto {
- google_protobuf_FieldDescriptorProto_Label label;
- google_protobuf_FieldDescriptorProto_Type type;
- int32_t number;
- int32_t oneof_index;
- upb_stringview name;
- upb_stringview extendee;
- upb_stringview type_name;
- upb_stringview default_value;
- upb_stringview json_name;
- google_protobuf_FieldOptions* options;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_FieldDescriptorProto_submsgs[1] = {
- &google_protobuf_FieldOptions_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_FieldDescriptorProto__fields[10] = {
- {1, offsetof(google_protobuf_FieldDescriptorProto, name), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {2, offsetof(google_protobuf_FieldDescriptorProto, extendee), 5, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {3, offsetof(google_protobuf_FieldDescriptorProto, number), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
- {4, offsetof(google_protobuf_FieldDescriptorProto, label), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1},
- {5, offsetof(google_protobuf_FieldDescriptorProto, type), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1},
- {6, offsetof(google_protobuf_FieldDescriptorProto, type_name), 6, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {7, offsetof(google_protobuf_FieldDescriptorProto, default_value), 7, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {8, offsetof(google_protobuf_FieldDescriptorProto, options), 9, UPB_NOT_IN_ONEOF, 0, 11, 1},
- {9, offsetof(google_protobuf_FieldDescriptorProto, oneof_index), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
- {10, offsetof(google_protobuf_FieldDescriptorProto, json_name), 8, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_FieldDescriptorProto_msginit = {
- &google_protobuf_FieldDescriptorProto_submsgs[0],
- &google_protobuf_FieldDescriptorProto__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_FieldDescriptorProto), 10, 0, false, true
-};
-
-google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_env *env) {
- google_protobuf_FieldDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_FieldDescriptorProto *msg = google_protobuf_FieldDescriptorProto_new(env);
- if (upb_decode(buf, msg, &google_protobuf_FieldDescriptorProto_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_FieldDescriptorProto_serialize(google_protobuf_FieldDescriptorProto *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, env, size);
-}
-upb_stringview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->name;
-}
-void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) {
- msg->name = value;
-}
-upb_stringview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->extendee;
-}
-void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) {
- msg->extendee = value;
-}
-int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->number;
-}
-void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
- msg->number = value;
-}
-google_protobuf_FieldDescriptorProto_Label google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->label;
-}
-void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Label value) {
- msg->label = value;
-}
-google_protobuf_FieldDescriptorProto_Type google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->type;
-}
-void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Type value) {
- msg->type = value;
-}
-upb_stringview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->type_name;
-}
-void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) {
- msg->type_name = value;
-}
-upb_stringview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->default_value;
-}
-void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) {
- msg->default_value = value;
-}
-const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->options;
-}
-void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
- msg->options = value;
-}
-int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->oneof_index;
-}
-void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
- msg->oneof_index = value;
-}
-upb_stringview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) {
- return msg->json_name;
-}
-void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) {
- msg->json_name = value;
-}
-struct google_protobuf_OneofDescriptorProto {
- upb_stringview name;
- google_protobuf_OneofOptions* options;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_OneofDescriptorProto_submsgs[1] = {
- &google_protobuf_OneofOptions_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_OneofDescriptorProto__fields[2] = {
- {1, offsetof(google_protobuf_OneofDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {2, offsetof(google_protobuf_OneofDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 0, 11, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_OneofDescriptorProto_msginit = {
- &google_protobuf_OneofDescriptorProto_submsgs[0],
- &google_protobuf_OneofDescriptorProto__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_OneofDescriptorProto), 2, 0, false, true
-};
-
-google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_env *env) {
- google_protobuf_OneofDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_OneofDescriptorProto *msg = google_protobuf_OneofDescriptorProto_new(env);
- if (upb_decode(buf, msg, &google_protobuf_OneofDescriptorProto_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_OneofDescriptorProto_serialize(google_protobuf_OneofDescriptorProto *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, env, size);
-}
-upb_stringview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) {
- return msg->name;
-}
-void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_stringview value) {
- msg->name = value;
-}
-const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) {
- return msg->options;
-}
-void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
- msg->options = value;
-}
-struct google_protobuf_EnumDescriptorProto {
- upb_stringview name;
- google_protobuf_EnumOptions* options;
- upb_array* value;
- upb_array* reserved_range;
- upb_array* reserved_name;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_EnumDescriptorProto_submsgs[3] = {
- &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit,
- &google_protobuf_EnumOptions_msginit,
- &google_protobuf_EnumValueDescriptorProto_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_EnumDescriptorProto__fields[5] = {
- {1, offsetof(google_protobuf_EnumDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {2, offsetof(google_protobuf_EnumDescriptorProto, value), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 2, 11, 3},
- {3, offsetof(google_protobuf_EnumDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 1, 11, 1},
- {4, offsetof(google_protobuf_EnumDescriptorProto, reserved_range), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
- {5, offsetof(google_protobuf_EnumDescriptorProto, reserved_name), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_msginit = {
- &google_protobuf_EnumDescriptorProto_submsgs[0],
- &google_protobuf_EnumDescriptorProto__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_EnumDescriptorProto), 5, 0, false, true
-};
-
-google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_env *env) {
- google_protobuf_EnumDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_EnumDescriptorProto *msg = google_protobuf_EnumDescriptorProto_new(env);
- if (upb_decode(buf, msg, &google_protobuf_EnumDescriptorProto_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_EnumDescriptorProto_serialize(google_protobuf_EnumDescriptorProto *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, env, size);
-}
-upb_stringview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) {
- return msg->name;
-}
-void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_stringview value) {
- msg->name = value;
-}
-const upb_array* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg) {
- return msg->value;
-}
-void google_protobuf_EnumDescriptorProto_set_value(google_protobuf_EnumDescriptorProto *msg, upb_array* value) {
- msg->value = value;
-}
-const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) {
- return msg->options;
-}
-void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
- msg->options = value;
-}
-const upb_array* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg) {
- return msg->reserved_range;
-}
-void google_protobuf_EnumDescriptorProto_set_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_array* value) {
- msg->reserved_range = value;
-}
-const upb_array* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg) {
- return msg->reserved_name;
-}
-void google_protobuf_EnumDescriptorProto_set_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_array* value) {
- msg->reserved_name = value;
-}
-struct google_protobuf_EnumDescriptorProto_EnumReservedRange {
- int32_t start;
- int32_t end;
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = {
- {1, offsetof(google_protobuf_EnumDescriptorProto_EnumReservedRange, start), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
- {2, offsetof(google_protobuf_EnumDescriptorProto_EnumReservedRange, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = {
- NULL,
- &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_EnumDescriptorProto_EnumReservedRange), 2, 0, false, true
-};
-
-google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_env *env) {
- google_protobuf_EnumDescriptorProto_EnumReservedRange *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_EnumDescriptorProto_EnumReservedRange *msg = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(env);
- if (upb_decode(buf, msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, env, size);
-}
-int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) {
- return msg->start;
-}
-void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
- msg->start = value;
-}
-int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) {
- return msg->end;
-}
-void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
- msg->end = value;
-}
-struct google_protobuf_EnumValueDescriptorProto {
- int32_t number;
- upb_stringview name;
- google_protobuf_EnumValueOptions* options;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_EnumValueDescriptorProto_submsgs[1] = {
- &google_protobuf_EnumValueOptions_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_EnumValueDescriptorProto__fields[3] = {
- {1, offsetof(google_protobuf_EnumValueDescriptorProto, name), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {2, offsetof(google_protobuf_EnumValueDescriptorProto, number), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
- {3, offsetof(google_protobuf_EnumValueDescriptorProto, options), 2, UPB_NOT_IN_ONEOF, 0, 11, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_EnumValueDescriptorProto_msginit = {
- &google_protobuf_EnumValueDescriptorProto_submsgs[0],
- &google_protobuf_EnumValueDescriptorProto__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_EnumValueDescriptorProto), 3, 0, false, true
-};
-
-google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_env *env) {
- google_protobuf_EnumValueDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_EnumValueDescriptorProto *msg = google_protobuf_EnumValueDescriptorProto_new(env);
- if (upb_decode(buf, msg, &google_protobuf_EnumValueDescriptorProto_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_EnumValueDescriptorProto_serialize(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, env, size);
-}
-upb_stringview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) {
- return msg->name;
-}
-void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_stringview value) {
- msg->name = value;
-}
-int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) {
- return msg->number;
-}
-void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
- msg->number = value;
-}
-const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) {
- return msg->options;
-}
-void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
- msg->options = value;
-}
-struct google_protobuf_ServiceDescriptorProto {
- upb_stringview name;
- google_protobuf_ServiceOptions* options;
- upb_array* method;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_ServiceDescriptorProto_submsgs[2] = {
- &google_protobuf_MethodDescriptorProto_msginit,
- &google_protobuf_ServiceOptions_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_ServiceDescriptorProto__fields[3] = {
- {1, offsetof(google_protobuf_ServiceDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {2, offsetof(google_protobuf_ServiceDescriptorProto, method), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
- {3, offsetof(google_protobuf_ServiceDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 1, 11, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_ServiceDescriptorProto_msginit = {
- &google_protobuf_ServiceDescriptorProto_submsgs[0],
- &google_protobuf_ServiceDescriptorProto__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_ServiceDescriptorProto), 3, 0, false, true
-};
-
-google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_env *env) {
- google_protobuf_ServiceDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_ServiceDescriptorProto *msg = google_protobuf_ServiceDescriptorProto_new(env);
- if (upb_decode(buf, msg, &google_protobuf_ServiceDescriptorProto_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_ServiceDescriptorProto_serialize(google_protobuf_ServiceDescriptorProto *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, env, size);
-}
-upb_stringview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) {
- return msg->name;
-}
-void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_stringview value) {
- msg->name = value;
-}
-const upb_array* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg) {
- return msg->method;
-}
-void google_protobuf_ServiceDescriptorProto_set_method(google_protobuf_ServiceDescriptorProto *msg, upb_array* value) {
- msg->method = value;
-}
-const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) {
- return msg->options;
-}
-void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
- msg->options = value;
-}
-struct google_protobuf_MethodDescriptorProto {
- bool client_streaming;
- bool server_streaming;
- upb_stringview name;
- upb_stringview input_type;
- upb_stringview output_type;
- google_protobuf_MethodOptions* options;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_MethodDescriptorProto_submsgs[1] = {
- &google_protobuf_MethodOptions_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_MethodDescriptorProto__fields[6] = {
- {1, offsetof(google_protobuf_MethodDescriptorProto, name), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {2, offsetof(google_protobuf_MethodDescriptorProto, input_type), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {3, offsetof(google_protobuf_MethodDescriptorProto, output_type), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {4, offsetof(google_protobuf_MethodDescriptorProto, options), 5, UPB_NOT_IN_ONEOF, 0, 11, 1},
- {5, offsetof(google_protobuf_MethodDescriptorProto, client_streaming), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {6, offsetof(google_protobuf_MethodDescriptorProto, server_streaming), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_MethodDescriptorProto_msginit = {
- &google_protobuf_MethodDescriptorProto_submsgs[0],
- &google_protobuf_MethodDescriptorProto__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_MethodDescriptorProto), 6, 0, false, true
-};
-
-google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_env *env) {
- google_protobuf_MethodDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_MethodDescriptorProto *msg = google_protobuf_MethodDescriptorProto_new(env);
- if (upb_decode(buf, msg, &google_protobuf_MethodDescriptorProto_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_MethodDescriptorProto_serialize(google_protobuf_MethodDescriptorProto *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, env, size);
-}
-upb_stringview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) {
- return msg->name;
-}
-void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_stringview value) {
- msg->name = value;
-}
-upb_stringview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) {
- return msg->input_type;
-}
-void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value) {
- msg->input_type = value;
-}
-upb_stringview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) {
- return msg->output_type;
-}
-void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value) {
- msg->output_type = value;
-}
-const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) {
- return msg->options;
-}
-void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
- msg->options = value;
-}
-bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) {
- return msg->client_streaming;
-}
-void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
- msg->client_streaming = value;
-}
-bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) {
- return msg->server_streaming;
-}
-void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
- msg->server_streaming = value;
-}
-struct google_protobuf_FileOptions {
- google_protobuf_FileOptions_OptimizeMode optimize_for;
- bool java_multiple_files;
- bool cc_generic_services;
- bool java_generic_services;
- bool py_generic_services;
- bool java_generate_equals_and_hash;
- bool deprecated;
- bool java_string_check_utf8;
- bool cc_enable_arenas;
- bool php_generic_services;
- upb_stringview java_package;
- upb_stringview java_outer_classname;
- upb_stringview go_package;
- upb_stringview objc_class_prefix;
- upb_stringview csharp_namespace;
- upb_stringview swift_prefix;
- upb_stringview php_class_prefix;
- upb_stringview php_namespace;
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_FileOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_FileOptions__fields[19] = {
- {1, offsetof(google_protobuf_FileOptions, java_package), 10, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {8, offsetof(google_protobuf_FileOptions, java_outer_classname), 11, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {9, offsetof(google_protobuf_FileOptions, optimize_for), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1},
- {10, offsetof(google_protobuf_FileOptions, java_multiple_files), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {11, offsetof(google_protobuf_FileOptions, go_package), 12, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {16, offsetof(google_protobuf_FileOptions, cc_generic_services), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {17, offsetof(google_protobuf_FileOptions, java_generic_services), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {18, offsetof(google_protobuf_FileOptions, py_generic_services), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {20, offsetof(google_protobuf_FileOptions, java_generate_equals_and_hash), 5, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {23, offsetof(google_protobuf_FileOptions, deprecated), 6, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {27, offsetof(google_protobuf_FileOptions, java_string_check_utf8), 7, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {31, offsetof(google_protobuf_FileOptions, cc_enable_arenas), 8, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {36, offsetof(google_protobuf_FileOptions, objc_class_prefix), 13, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {37, offsetof(google_protobuf_FileOptions, csharp_namespace), 14, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {39, offsetof(google_protobuf_FileOptions, swift_prefix), 15, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {40, offsetof(google_protobuf_FileOptions, php_class_prefix), 16, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {41, offsetof(google_protobuf_FileOptions, php_namespace), 17, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {42, offsetof(google_protobuf_FileOptions, php_generic_services), 9, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {999, offsetof(google_protobuf_FileOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_FileOptions_msginit = {
- &google_protobuf_FileOptions_submsgs[0],
- &google_protobuf_FileOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_FileOptions), 19, 0, false, true
-};
-
-google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_env *env) {
- google_protobuf_FileOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_FileOptions *msg = google_protobuf_FileOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_FileOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_FileOptions_serialize(google_protobuf_FileOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_FileOptions_msginit, env, size);
-}
-upb_stringview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) {
- return msg->java_package;
-}
-void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_stringview value) {
- msg->java_package = value;
-}
-upb_stringview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) {
- return msg->java_outer_classname;
-}
-void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_stringview value) {
- msg->java_outer_classname = value;
-}
-google_protobuf_FileOptions_OptimizeMode google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) {
- return msg->optimize_for;
-}
-void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, google_protobuf_FileOptions_OptimizeMode value) {
- msg->optimize_for = value;
-}
-bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) {
- return msg->java_multiple_files;
-}
-void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
- msg->java_multiple_files = value;
-}
-upb_stringview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) {
- return msg->go_package;
-}
-void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_stringview value) {
- msg->go_package = value;
-}
-bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) {
- return msg->cc_generic_services;
-}
-void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
- msg->cc_generic_services = value;
-}
-bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) {
- return msg->java_generic_services;
-}
-void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
- msg->java_generic_services = value;
-}
-bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) {
- return msg->py_generic_services;
-}
-void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
- msg->py_generic_services = value;
-}
-bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) {
- return msg->java_generate_equals_and_hash;
-}
-void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
- msg->java_generate_equals_and_hash = value;
-}
-bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) {
- return msg->deprecated;
-}
-void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
- msg->deprecated = value;
-}
-bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) {
- return msg->java_string_check_utf8;
-}
-void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
- msg->java_string_check_utf8 = value;
-}
-bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) {
- return msg->cc_enable_arenas;
-}
-void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
- msg->cc_enable_arenas = value;
-}
-upb_stringview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) {
- return msg->objc_class_prefix;
-}
-void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value) {
- msg->objc_class_prefix = value;
-}
-upb_stringview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) {
- return msg->csharp_namespace;
-}
-void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_stringview value) {
- msg->csharp_namespace = value;
-}
-upb_stringview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) {
- return msg->swift_prefix;
-}
-void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_stringview value) {
- msg->swift_prefix = value;
-}
-upb_stringview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) {
- return msg->php_class_prefix;
-}
-void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value) {
- msg->php_class_prefix = value;
-}
-upb_stringview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) {
- return msg->php_namespace;
-}
-void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_stringview value) {
- msg->php_namespace = value;
-}
-bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) {
- return msg->php_generic_services;
-}
-void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
- msg->php_generic_services = value;
-}
-const upb_array* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_FileOptions_set_uninterpreted_option(google_protobuf_FileOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_MessageOptions {
- bool message_set_wire_format;
- bool no_standard_descriptor_accessor;
- bool deprecated;
- bool map_entry;
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_MessageOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_MessageOptions__fields[5] = {
- {1, offsetof(google_protobuf_MessageOptions, message_set_wire_format), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {2, offsetof(google_protobuf_MessageOptions, no_standard_descriptor_accessor), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {3, offsetof(google_protobuf_MessageOptions, deprecated), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {7, offsetof(google_protobuf_MessageOptions, map_entry), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {999, offsetof(google_protobuf_MessageOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_MessageOptions_msginit = {
- &google_protobuf_MessageOptions_submsgs[0],
- &google_protobuf_MessageOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_MessageOptions), 5, 0, false, true
-};
-
-google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_env *env) {
- google_protobuf_MessageOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_MessageOptions *msg = google_protobuf_MessageOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_MessageOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_MessageOptions_serialize(google_protobuf_MessageOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_MessageOptions_msginit, env, size);
-}
-bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg) {
- return msg->message_set_wire_format;
-}
-void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
- msg->message_set_wire_format = value;
-}
-bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) {
- return msg->no_standard_descriptor_accessor;
-}
-void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
- msg->no_standard_descriptor_accessor = value;
-}
-bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg) {
- return msg->deprecated;
-}
-void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
- msg->deprecated = value;
-}
-bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg) {
- return msg->map_entry;
-}
-void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
- msg->map_entry = value;
-}
-const upb_array* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_MessageOptions_set_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_FieldOptions {
- google_protobuf_FieldOptions_CType ctype;
- google_protobuf_FieldOptions_JSType jstype;
- bool packed;
- bool deprecated;
- bool lazy;
- bool weak;
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_FieldOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_FieldOptions__fields[7] = {
- {1, offsetof(google_protobuf_FieldOptions, ctype), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1},
- {2, offsetof(google_protobuf_FieldOptions, packed), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {3, offsetof(google_protobuf_FieldOptions, deprecated), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {5, offsetof(google_protobuf_FieldOptions, lazy), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {6, offsetof(google_protobuf_FieldOptions, jstype), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1},
- {10, offsetof(google_protobuf_FieldOptions, weak), 5, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {999, offsetof(google_protobuf_FieldOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_FieldOptions_msginit = {
- &google_protobuf_FieldOptions_submsgs[0],
- &google_protobuf_FieldOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_FieldOptions), 7, 0, false, true
-};
-
-google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_env *env) {
- google_protobuf_FieldOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_FieldOptions *msg = google_protobuf_FieldOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_FieldOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_FieldOptions_serialize(google_protobuf_FieldOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_FieldOptions_msginit, env, size);
-}
-google_protobuf_FieldOptions_CType google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) {
- return msg->ctype;
-}
-void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_CType value) {
- msg->ctype = value;
-}
-bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) {
- return msg->packed;
-}
-void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
- msg->packed = value;
-}
-bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) {
- return msg->deprecated;
-}
-void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
- msg->deprecated = value;
-}
-bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) {
- return msg->lazy;
-}
-void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
- msg->lazy = value;
-}
-google_protobuf_FieldOptions_JSType google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) {
- return msg->jstype;
-}
-void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_JSType value) {
- msg->jstype = value;
-}
-bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) {
- return msg->weak;
-}
-void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
- msg->weak = value;
-}
-const upb_array* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_FieldOptions_set_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_OneofOptions {
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_OneofOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_OneofOptions__fields[1] = {
- {999, offsetof(google_protobuf_OneofOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_OneofOptions_msginit = {
- &google_protobuf_OneofOptions_submsgs[0],
- &google_protobuf_OneofOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_OneofOptions), 1, 0, false, true
-};
-
-google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_env *env) {
- google_protobuf_OneofOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_OneofOptions *msg = google_protobuf_OneofOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_OneofOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_OneofOptions_serialize(google_protobuf_OneofOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_OneofOptions_msginit, env, size);
-}
-const upb_array* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_OneofOptions_set_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_EnumOptions {
- bool allow_alias;
- bool deprecated;
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_EnumOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_EnumOptions__fields[3] = {
- {2, offsetof(google_protobuf_EnumOptions, allow_alias), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {3, offsetof(google_protobuf_EnumOptions, deprecated), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {999, offsetof(google_protobuf_EnumOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_EnumOptions_msginit = {
- &google_protobuf_EnumOptions_submsgs[0],
- &google_protobuf_EnumOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_EnumOptions), 3, 0, false, true
-};
-
-google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_env *env) {
- google_protobuf_EnumOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_EnumOptions *msg = google_protobuf_EnumOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_EnumOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_EnumOptions_serialize(google_protobuf_EnumOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_EnumOptions_msginit, env, size);
-}
-bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg) {
- return msg->allow_alias;
-}
-void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
- msg->allow_alias = value;
-}
-bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg) {
- return msg->deprecated;
-}
-void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
- msg->deprecated = value;
-}
-const upb_array* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_EnumOptions_set_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_EnumValueOptions {
- bool deprecated;
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_EnumValueOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_EnumValueOptions__fields[2] = {
- {1, offsetof(google_protobuf_EnumValueOptions, deprecated), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {999, offsetof(google_protobuf_EnumValueOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_EnumValueOptions_msginit = {
- &google_protobuf_EnumValueOptions_submsgs[0],
- &google_protobuf_EnumValueOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_EnumValueOptions), 2, 0, false, true
-};
-
-google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_env *env) {
- google_protobuf_EnumValueOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_EnumValueOptions *msg = google_protobuf_EnumValueOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_EnumValueOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_EnumValueOptions_serialize(google_protobuf_EnumValueOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, env, size);
-}
-bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg) {
- return msg->deprecated;
-}
-void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
- msg->deprecated = value;
-}
-const upb_array* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_EnumValueOptions_set_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_ServiceOptions {
- bool deprecated;
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_ServiceOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_ServiceOptions__fields[2] = {
- {33, offsetof(google_protobuf_ServiceOptions, deprecated), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {999, offsetof(google_protobuf_ServiceOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_ServiceOptions_msginit = {
- &google_protobuf_ServiceOptions_submsgs[0],
- &google_protobuf_ServiceOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_ServiceOptions), 2, 0, false, true
-};
-
-google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_env *env) {
- google_protobuf_ServiceOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_ServiceOptions *msg = google_protobuf_ServiceOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_ServiceOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_ServiceOptions_serialize(google_protobuf_ServiceOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, env, size);
-}
-bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg) {
- return msg->deprecated;
-}
-void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
- msg->deprecated = value;
-}
-const upb_array* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_ServiceOptions_set_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_MethodOptions {
- google_protobuf_MethodOptions_IdempotencyLevel idempotency_level;
- bool deprecated;
- upb_array* uninterpreted_option;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_MethodOptions_submsgs[1] = {
- &google_protobuf_UninterpretedOption_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_MethodOptions__fields[3] = {
- {33, offsetof(google_protobuf_MethodOptions, deprecated), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1},
- {34, offsetof(google_protobuf_MethodOptions, idempotency_level), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1},
- {999, offsetof(google_protobuf_MethodOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_MethodOptions_msginit = {
- &google_protobuf_MethodOptions_submsgs[0],
- &google_protobuf_MethodOptions__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_MethodOptions), 3, 0, false, true
-};
-
-google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_env *env) {
- google_protobuf_MethodOptions *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_MethodOptions *msg = google_protobuf_MethodOptions_new(env);
- if (upb_decode(buf, msg, &google_protobuf_MethodOptions_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_MethodOptions_serialize(google_protobuf_MethodOptions *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_MethodOptions_msginit, env, size);
-}
-bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) {
- return msg->deprecated;
-}
-void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
- msg->deprecated = value;
-}
-google_protobuf_MethodOptions_IdempotencyLevel google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) {
- return msg->idempotency_level;
-}
-void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, google_protobuf_MethodOptions_IdempotencyLevel value) {
- msg->idempotency_level = value;
-}
-const upb_array* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg) {
- return msg->uninterpreted_option;
-}
-void google_protobuf_MethodOptions_set_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_array* value) {
- msg->uninterpreted_option = value;
-}
-struct google_protobuf_UninterpretedOption {
- uint64_t positive_int_value;
- int64_t negative_int_value;
- double double_value;
- upb_stringview identifier_value;
- upb_stringview string_value;
- upb_stringview aggregate_value;
- upb_array* name;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_UninterpretedOption_submsgs[1] = {
- &google_protobuf_UninterpretedOption_NamePart_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_UninterpretedOption__fields[7] = {
- {2, offsetof(google_protobuf_UninterpretedOption, name), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
- {3, offsetof(google_protobuf_UninterpretedOption, identifier_value), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {4, offsetof(google_protobuf_UninterpretedOption, positive_int_value), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 4, 1},
- {5, offsetof(google_protobuf_UninterpretedOption, negative_int_value), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 3, 1},
- {6, offsetof(google_protobuf_UninterpretedOption, double_value), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 1, 1},
- {7, offsetof(google_protobuf_UninterpretedOption, string_value), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 12, 1},
- {8, offsetof(google_protobuf_UninterpretedOption, aggregate_value), 5, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_msginit = {
- &google_protobuf_UninterpretedOption_submsgs[0],
- &google_protobuf_UninterpretedOption__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_UninterpretedOption), 7, 0, false, true
-};
-
-google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_env *env) {
- google_protobuf_UninterpretedOption *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_UninterpretedOption *msg = google_protobuf_UninterpretedOption_new(env);
- if (upb_decode(buf, msg, &google_protobuf_UninterpretedOption_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_UninterpretedOption_serialize(google_protobuf_UninterpretedOption *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, env, size);
-}
-const upb_array* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg) {
- return msg->name;
-}
-void google_protobuf_UninterpretedOption_set_name(google_protobuf_UninterpretedOption *msg, upb_array* value) {
- msg->name = value;
-}
-upb_stringview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) {
- return msg->identifier_value;
-}
-void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_stringview value) {
- msg->identifier_value = value;
-}
-uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) {
- return msg->positive_int_value;
-}
-void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
- msg->positive_int_value = value;
-}
-int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) {
- return msg->negative_int_value;
-}
-void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
- msg->negative_int_value = value;
-}
-double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) {
- return msg->double_value;
-}
-void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
- msg->double_value = value;
-}
-upb_stringview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) {
- return msg->string_value;
-}
-void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_stringview value) {
- msg->string_value = value;
-}
-upb_stringview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg) {
- return msg->aggregate_value;
-}
-void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_stringview value) {
- msg->aggregate_value = value;
-}
-struct google_protobuf_UninterpretedOption_NamePart {
- bool is_extension;
- upb_stringview name_part;
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_UninterpretedOption_NamePart__fields[2] = {
- {1, offsetof(google_protobuf_UninterpretedOption_NamePart, name_part), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 2},
- {2, offsetof(google_protobuf_UninterpretedOption_NamePart, is_extension), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 2},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_NamePart_msginit = {
- NULL,
- &google_protobuf_UninterpretedOption_NamePart__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_UninterpretedOption_NamePart), 2, 0, false, true
-};
-
-google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_env *env) {
- google_protobuf_UninterpretedOption_NamePart *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_UninterpretedOption_NamePart *msg = google_protobuf_UninterpretedOption_NamePart_new(env);
- if (upb_decode(buf, msg, &google_protobuf_UninterpretedOption_NamePart_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_UninterpretedOption_NamePart_serialize(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, env, size);
-}
-upb_stringview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) {
- return msg->name_part;
-}
-void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_stringview value) {
- msg->name_part = value;
-}
-bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) {
- return msg->is_extension;
-}
-void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
- msg->is_extension = value;
-}
-struct google_protobuf_SourceCodeInfo {
- upb_array* location;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_SourceCodeInfo_submsgs[1] = {
- &google_protobuf_SourceCodeInfo_Location_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_SourceCodeInfo__fields[1] = {
- {1, offsetof(google_protobuf_SourceCodeInfo, location), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_msginit = {
- &google_protobuf_SourceCodeInfo_submsgs[0],
- &google_protobuf_SourceCodeInfo__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_SourceCodeInfo), 1, 0, false, true
-};
-
-google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_env *env) {
- google_protobuf_SourceCodeInfo *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_SourceCodeInfo *msg = google_protobuf_SourceCodeInfo_new(env);
- if (upb_decode(buf, msg, &google_protobuf_SourceCodeInfo_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_SourceCodeInfo_serialize(google_protobuf_SourceCodeInfo *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, env, size);
-}
-const upb_array* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg) {
- return msg->location;
-}
-void google_protobuf_SourceCodeInfo_set_location(google_protobuf_SourceCodeInfo *msg, upb_array* value) {
- msg->location = value;
-}
-struct google_protobuf_SourceCodeInfo_Location {
- upb_stringview leading_comments;
- upb_stringview trailing_comments;
- upb_array* path;
- upb_array* span;
- upb_array* leading_detached_comments;
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_SourceCodeInfo_Location__fields[5] = {
- {1, offsetof(google_protobuf_SourceCodeInfo_Location, path), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3},
- {2, offsetof(google_protobuf_SourceCodeInfo_Location, span), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3},
- {3, offsetof(google_protobuf_SourceCodeInfo_Location, leading_comments), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {4, offsetof(google_protobuf_SourceCodeInfo_Location, trailing_comments), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {6, offsetof(google_protobuf_SourceCodeInfo_Location, leading_detached_comments), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_Location_msginit = {
- NULL,
- &google_protobuf_SourceCodeInfo_Location__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_SourceCodeInfo_Location), 5, 0, false, true
-};
-
-google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_env *env) {
- google_protobuf_SourceCodeInfo_Location *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_SourceCodeInfo_Location *msg = google_protobuf_SourceCodeInfo_Location_new(env);
- if (upb_decode(buf, msg, &google_protobuf_SourceCodeInfo_Location_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_SourceCodeInfo_Location_serialize(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, env, size);
-}
-const upb_array* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg) {
- return msg->path;
-}
-void google_protobuf_SourceCodeInfo_Location_set_path(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) {
- msg->path = value;
-}
-const upb_array* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg) {
- return msg->span;
-}
-void google_protobuf_SourceCodeInfo_Location_set_span(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) {
- msg->span = value;
-}
-upb_stringview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) {
- return msg->leading_comments;
-}
-void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value) {
- msg->leading_comments = value;
-}
-upb_stringview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) {
- return msg->trailing_comments;
-}
-void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value) {
- msg->trailing_comments = value;
-}
-const upb_array* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg) {
- return msg->leading_detached_comments;
-}
-void google_protobuf_SourceCodeInfo_Location_set_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) {
- msg->leading_detached_comments = value;
-}
-struct google_protobuf_GeneratedCodeInfo {
- upb_array* annotation;
-};
-
-static const upb_msglayout_msginit_v1 *const google_protobuf_GeneratedCodeInfo_submsgs[1] = {
- &google_protobuf_GeneratedCodeInfo_Annotation_msginit,
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_GeneratedCodeInfo__fields[1] = {
- {1, offsetof(google_protobuf_GeneratedCodeInfo, annotation), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_msginit = {
- &google_protobuf_GeneratedCodeInfo_submsgs[0],
- &google_protobuf_GeneratedCodeInfo__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_GeneratedCodeInfo), 1, 0, false, true
-};
-
-google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_env *env) {
- google_protobuf_GeneratedCodeInfo *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_GeneratedCodeInfo *msg = google_protobuf_GeneratedCodeInfo_new(env);
- if (upb_decode(buf, msg, &google_protobuf_GeneratedCodeInfo_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_GeneratedCodeInfo_serialize(google_protobuf_GeneratedCodeInfo *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, env, size);
-}
-const upb_array* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg) {
- return msg->annotation;
-}
-void google_protobuf_GeneratedCodeInfo_set_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_array* value) {
- msg->annotation = value;
-}
-struct google_protobuf_GeneratedCodeInfo_Annotation {
- int32_t begin;
- int32_t end;
- upb_stringview source_file;
- upb_array* path;
-};
-
-static const upb_msglayout_fieldinit_v1 google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = {
- {1, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, path), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3},
- {2, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, source_file), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1},
- {3, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, begin), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
- {4, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1},
-};
-
-const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_Annotation_msginit = {
- NULL,
- &google_protobuf_GeneratedCodeInfo_Annotation__fields[0],
- NULL,
- NULL, /* TODO. default_msg */
- UPB_ALIGNED_SIZEOF(google_protobuf_GeneratedCodeInfo_Annotation), 4, 0, false, true
-};
-
-google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_env *env) {
- google_protobuf_GeneratedCodeInfo_Annotation *msg = upb_env_malloc(env, sizeof(*msg));
- memset(msg, 0, sizeof(*msg)); /* TODO: defaults */
- return msg;
-}
-google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_stringview buf, upb_env *env) {
- google_protobuf_GeneratedCodeInfo_Annotation *msg = google_protobuf_GeneratedCodeInfo_Annotation_new(env);
- if (upb_decode(buf, msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, env)) {
- return msg;
- } else {
- return NULL;
- }
-}
-char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env, size_t *size) {
- return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, env, size);
-}
-const upb_array* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg) {
- return msg->path;
-}
-void google_protobuf_GeneratedCodeInfo_Annotation_set_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_array* value) {
- msg->path = value;
-}
-upb_stringview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) {
- return msg->source_file;
-}
-void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_stringview value) {
- msg->source_file = value;
-}
-int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) {
- return msg->begin;
-}
-void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
- msg->begin = value;
-}
-int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) {
- return msg->end;
-}
-void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
- msg->end = value;
-}
-
-
-/* Maps descriptor type -> upb field type. */
-const uint8_t upb_desctype_to_fieldtype[] = {
- UPB_WIRE_TYPE_END_GROUP, /* ENDGROUP */
- UPB_TYPE_DOUBLE, /* DOUBLE */
- UPB_TYPE_FLOAT, /* FLOAT */
- UPB_TYPE_INT64, /* INT64 */
- UPB_TYPE_UINT64, /* UINT64 */
- UPB_TYPE_INT32, /* INT32 */
- UPB_TYPE_UINT64, /* FIXED64 */
- UPB_TYPE_UINT32, /* FIXED32 */
- UPB_TYPE_BOOL, /* BOOL */
- UPB_TYPE_STRING, /* STRING */
- UPB_TYPE_MESSAGE, /* GROUP */
- UPB_TYPE_MESSAGE, /* MESSAGE */
- UPB_TYPE_BYTES, /* BYTES */
- UPB_TYPE_UINT32, /* UINT32 */
- UPB_TYPE_ENUM, /* ENUM */
- UPB_TYPE_INT32, /* SFIXED32 */
- UPB_TYPE_INT64, /* SFIXED64 */
- UPB_TYPE_INT32, /* SINT32 */
- UPB_TYPE_INT64, /* SINT64 */
-};
-
-/* Data pertaining to the parse. */
-typedef struct {
- upb_env *env;
- /* Current decoding pointer. Points to the beginning of a field until we
- * have finished decoding the whole field. */
- const char *ptr;
-} upb_decstate;
-
-/* Data pertaining to a single message frame. */
-typedef struct {
- const char *limit;
- int32_t group_number; /* 0 if we are not parsing a group. */
-
- /* These members are unset for an unknown group frame. */
- char *msg;
- const upb_msglayout_msginit_v1 *m;
-} upb_decframe;
-
-#define CHK(x) if (!(x)) { return false; }
-
-static bool upb_skip_unknowngroup(upb_decstate *d, int field_number,
- const char *limit);
-static bool upb_decode_message(upb_decstate *d, const char *limit,
- int group_number, char *msg,
- const upb_msglayout_msginit_v1 *l);
-
-static bool upb_decode_varint(const char **ptr, const char *limit,
- uint64_t *val) {
- uint8_t byte;
- int bitpos = 0;
- const char *p = *ptr;
- *val = 0;
-
- do {
- CHK(bitpos < 70 && p < limit);
- byte = *p;
- *val |= (uint64_t)(byte & 0x7F) << bitpos;
- p++;
- bitpos += 7;
- } while (byte & 0x80);
-
- *ptr = p;
- return true;
-}
-
-static bool upb_decode_varint32(const char **ptr, const char *limit,
- uint32_t *val) {
- uint64_t u64;
- CHK(upb_decode_varint(ptr, limit, &u64) && u64 <= UINT32_MAX);
- *val = u64;
- return true;
-}
-
-static bool upb_decode_64bit(const char **ptr, const char *limit,
- uint64_t *val) {
- CHK(limit - *ptr >= 8);
- memcpy(val, *ptr, 8);
- *ptr += 8;
- return true;
-}
-
-static bool upb_decode_32bit(const char **ptr, const char *limit,
- uint32_t *val) {
- CHK(limit - *ptr >= 4);
- memcpy(val, *ptr, 4);
- *ptr += 4;
- return true;
-}
-
-static bool upb_decode_tag(const char **ptr, const char *limit,
- int *field_number, int *wire_type) {
- uint32_t tag = 0;
- CHK(upb_decode_varint32(ptr, limit, &tag));
- *field_number = tag >> 3;
- *wire_type = tag & 7;
- return true;
-}
-
-static int32_t upb_zzdecode_32(uint32_t n) {
- return (n >> 1) ^ -(int32_t)(n & 1);
-}
-
-static int64_t upb_zzdecode_64(uint64_t n) {
- return (n >> 1) ^ -(int64_t)(n & 1);
-}
-
-static bool upb_decode_string(const char **ptr, const char *limit,
- upb_stringview *val) {
- uint32_t len;
-
- CHK(upb_decode_varint32(ptr, limit, &len) &&
- len < INT32_MAX &&
- limit - *ptr >= (int32_t)len);
-
- *val = upb_stringview_make(*ptr, len);
- *ptr += len;
- return true;
-}
-
-static void upb_set32(void *msg, size_t ofs, uint32_t val) {
- memcpy((char*)msg + ofs, &val, sizeof(val));
-}
-
-static bool upb_append_unknown(upb_decstate *d, upb_decframe *frame,
- const char *start) {
- UPB_UNUSED(d);
- UPB_UNUSED(frame);
- UPB_UNUSED(start);
- return true;
-}
-
-static bool upb_skip_unknownfielddata(upb_decstate *d, upb_decframe *frame,
- int field_number, int wire_type) {
- switch (wire_type) {
- case UPB_WIRE_TYPE_VARINT: {
- uint64_t val;
- return upb_decode_varint(&d->ptr, frame->limit, &val);
- }
- case UPB_WIRE_TYPE_32BIT: {
- uint32_t val;
- return upb_decode_32bit(&d->ptr, frame->limit, &val);
- }
- case UPB_WIRE_TYPE_64BIT: {
- uint64_t val;
- return upb_decode_64bit(&d->ptr, frame->limit, &val);
- }
- case UPB_WIRE_TYPE_DELIMITED: {
- upb_stringview val;
- return upb_decode_string(&d->ptr, frame->limit, &val);
- }
- case UPB_WIRE_TYPE_START_GROUP:
- return upb_skip_unknowngroup(d, field_number, frame->limit);
- case UPB_WIRE_TYPE_END_GROUP:
- CHK(field_number == frame->group_number);
- frame->limit = d->ptr;
- return true;
- }
- return false;
-}
-
-static bool upb_array_grow(upb_array *arr, size_t elements) {
- size_t needed = arr->len + elements;
- size_t new_size = UPB_MAX(arr->size, 8);
- size_t new_bytes;
- size_t old_bytes;
- void *new_data;
-
- while (new_size < needed) {
- new_size *= 2;
- }
-
- old_bytes = arr->len * arr->element_size;
- new_bytes = new_size * arr->element_size;
- new_data = upb_realloc(arr->alloc, arr->data, old_bytes, new_bytes);
- CHK(new_data);
-
- arr->data = new_data;
- arr->size = new_size;
- return true;
-}
-
-static void *upb_array_reserve(upb_array *arr, size_t elements) {
- if (arr->size - arr->len < elements) {
- CHK(upb_array_grow(arr, elements));
- }
- return (char*)arr->data + (arr->len * arr->element_size);
-}
-
-static void *upb_array_add(upb_array *arr, size_t elements) {
- void *ret = upb_array_reserve(arr, elements);
- arr->len += elements;
- return ret;
-}
-
-static upb_array *upb_getarr(upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- UPB_ASSERT(field->label == UPB_LABEL_REPEATED);
- return *(upb_array**)&frame->msg[field->offset];
-}
-
-static upb_array *upb_getorcreatearr(upb_decstate *d,
- upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- upb_array *arr = upb_getarr(frame, field);
-
- if (!arr) {
- arr = upb_env_malloc(d->env, sizeof(*arr));
- if (!arr) {
- return NULL;
- }
- upb_array_init(arr, upb_desctype_to_fieldtype[field->descriptortype],
- upb_arena_alloc(upb_env_arena(d->env)));
- *(upb_array**)&frame->msg[field->offset] = arr;
- }
-
- return arr;
-}
-
-static void upb_sethasbit(upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- UPB_ASSERT(field->hasbit != UPB_NO_HASBIT);
- frame->msg[field->hasbit / 8] |= (1 << (field->hasbit % 8));
-}
-
-static void upb_setoneofcase(upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- UPB_ASSERT(field->oneof_index != UPB_NOT_IN_ONEOF);
- upb_set32(frame->msg, frame->m->oneofs[field->oneof_index].case_offset,
- field->number);
-}
-
-static char *upb_decode_prepareslot(upb_decstate *d,
- upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- char *field_mem = frame->msg + field->offset;
- upb_array *arr;
-
- if (field->label == UPB_LABEL_REPEATED) {
- arr = upb_getorcreatearr(d, frame, field);
- field_mem = upb_array_reserve(arr, 1);
- }
-
- return field_mem;
-}
-
-static void upb_decode_setpresent(upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- if (field->label == UPB_LABEL_REPEATED) {
- upb_array *arr = upb_getarr(frame, field);
- UPB_ASSERT(arr->len < arr->size);
- arr->len++;
- } else if (field->oneof_index != UPB_NOT_IN_ONEOF) {
- upb_setoneofcase(frame, field);
- } else if (field->hasbit != UPB_NO_HASBIT) {
- upb_sethasbit(frame, field);
- }
-}
-
-static bool upb_decode_submsg(upb_decstate *d,
- upb_decframe *frame,
- const char *limit,
- const upb_msglayout_fieldinit_v1 *field,
- int group_number) {
- char *submsg_slot = upb_decode_prepareslot(d, frame, field);
- char *submsg = *(void**)submsg_slot;
- const upb_msglayout_msginit_v1 *subm;
-
- UPB_ASSERT(field->submsg_index != UPB_NO_SUBMSG);
- subm = frame->m->submsgs[field->submsg_index];
- UPB_ASSERT(subm);
-
- if (!submsg) {
- submsg = upb_env_malloc(d->env, upb_msg_sizeof((upb_msglayout *)subm));
- CHK(submsg);
- submsg = upb_msg_init(
- submsg, (upb_msglayout*)subm, upb_arena_alloc(upb_env_arena(d->env)));
- *(void**)submsg_slot = submsg;
- }
-
- upb_decode_message(d, limit, group_number, submsg, subm);
-
- return true;
-}
-
-static bool upb_decode_varintfield(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field) {
- uint64_t val;
- void *field_mem;
-
- field_mem = upb_decode_prepareslot(d, frame, field);
- CHK(field_mem);
- CHK(upb_decode_varint(&d->ptr, frame->limit, &val));
-
- switch ((upb_descriptortype_t)field->descriptortype) {
- case UPB_DESCRIPTOR_TYPE_INT64:
- case UPB_DESCRIPTOR_TYPE_UINT64:
- memcpy(field_mem, &val, sizeof(val));
- break;
- case UPB_DESCRIPTOR_TYPE_INT32:
- case UPB_DESCRIPTOR_TYPE_UINT32:
- case UPB_DESCRIPTOR_TYPE_ENUM: {
- uint32_t val32 = val;
- memcpy(field_mem, &val32, sizeof(val32));
- break;
- }
- case UPB_DESCRIPTOR_TYPE_BOOL: {
- bool valbool = val != 0;
- memcpy(field_mem, &valbool, sizeof(valbool));
- break;
- }
- case UPB_DESCRIPTOR_TYPE_SINT32: {
- int32_t decoded = upb_zzdecode_32(val);
- memcpy(field_mem, &decoded, sizeof(decoded));
- break;
- }
- case UPB_DESCRIPTOR_TYPE_SINT64: {
- int64_t decoded = upb_zzdecode_64(val);
- memcpy(field_mem, &decoded, sizeof(decoded));
- break;
- }
- default:
- return upb_append_unknown(d, frame, field_start);
- }
-
- upb_decode_setpresent(frame, field);
- return true;
-}
-
-static bool upb_decode_64bitfield(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field) {
- void *field_mem;
- uint64_t val;
-
- field_mem = upb_decode_prepareslot(d, frame, field);
- CHK(field_mem);
- CHK(upb_decode_64bit(&d->ptr, frame->limit, &val));
-
- switch ((upb_descriptortype_t)field->descriptortype) {
- case UPB_DESCRIPTOR_TYPE_DOUBLE:
- case UPB_DESCRIPTOR_TYPE_FIXED64:
- case UPB_DESCRIPTOR_TYPE_SFIXED64:
- memcpy(field_mem, &val, sizeof(val));
- break;
- default:
- return upb_append_unknown(d, frame, field_start);
- }
-
- upb_decode_setpresent(frame, field);
- return true;
-}
-
-static bool upb_decode_32bitfield(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field) {
- void *field_mem;
- uint32_t val;
-
- field_mem = upb_decode_prepareslot(d, frame, field);
- CHK(field_mem);
- CHK(upb_decode_32bit(&d->ptr, frame->limit, &val));
-
- switch ((upb_descriptortype_t)field->descriptortype) {
- case UPB_DESCRIPTOR_TYPE_FLOAT:
- case UPB_DESCRIPTOR_TYPE_FIXED32:
- case UPB_DESCRIPTOR_TYPE_SFIXED32:
- memcpy(field_mem, &val, sizeof(val));
- break;
- default:
- return upb_append_unknown(d, frame, field_start);
- }
-
- upb_decode_setpresent(frame, field);
- return true;
-}
-
-static bool upb_decode_fixedpacked(upb_array *arr, upb_stringview data,
- int elem_size) {
- int elements = data.size / elem_size;
- void *field_mem;
-
- CHK((size_t)(elements * elem_size) == data.size);
- field_mem = upb_array_add(arr, elements);
- CHK(field_mem);
- memcpy(field_mem, data.data, data.size);
- return true;
-}
-
-static bool upb_decode_toarray(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field,
- upb_stringview val) {
- upb_array *arr = upb_getorcreatearr(d, frame, field);
-
-#define VARINT_CASE(ctype, decode) { \
- const char *ptr = val.data; \
- const char *limit = ptr + val.size; \
- while (ptr < limit) { \
- uint64_t val; \
- void *field_mem; \
- ctype decoded; \
- CHK(upb_decode_varint(&ptr, limit, &val)); \
- decoded = (decode)(val); \
- field_mem = upb_array_add(arr, 1); \
- CHK(field_mem); \
- memcpy(field_mem, &decoded, sizeof(ctype)); \
- } \
- return true; \
-}
-
- switch ((upb_descriptortype_t)field->descriptortype) {
- case UPB_DESCRIPTOR_TYPE_STRING:
- case UPB_DESCRIPTOR_TYPE_BYTES: {
- void *field_mem = upb_array_add(arr, 1);
- CHK(field_mem);
- memcpy(field_mem, &val, sizeof(val));
- return true;
- }
- case UPB_DESCRIPTOR_TYPE_FLOAT:
- case UPB_DESCRIPTOR_TYPE_FIXED32:
- case UPB_DESCRIPTOR_TYPE_SFIXED32:
- return upb_decode_fixedpacked(arr, val, sizeof(int32_t));
- case UPB_DESCRIPTOR_TYPE_DOUBLE:
- case UPB_DESCRIPTOR_TYPE_FIXED64:
- case UPB_DESCRIPTOR_TYPE_SFIXED64:
- return upb_decode_fixedpacked(arr, val, sizeof(int64_t));
- case UPB_DESCRIPTOR_TYPE_INT32:
- case UPB_DESCRIPTOR_TYPE_UINT32:
- case UPB_DESCRIPTOR_TYPE_ENUM:
- /* TODO: proto2 enum field that isn't in the enum. */
- VARINT_CASE(uint32_t, uint32_t);
- case UPB_DESCRIPTOR_TYPE_INT64:
- case UPB_DESCRIPTOR_TYPE_UINT64:
- VARINT_CASE(uint64_t, uint64_t);
- case UPB_DESCRIPTOR_TYPE_BOOL:
- VARINT_CASE(bool, bool);
- case UPB_DESCRIPTOR_TYPE_SINT32:
- VARINT_CASE(int32_t, upb_zzdecode_32);
- case UPB_DESCRIPTOR_TYPE_SINT64:
- VARINT_CASE(int64_t, upb_zzdecode_64);
- case UPB_DESCRIPTOR_TYPE_MESSAGE: {
- const upb_msglayout_msginit_v1 *subm;
- char *submsg;
- void *field_mem;
-
- CHK(val.size <= (size_t)(frame->limit - val.data));
- d->ptr -= val.size;
-
- /* Create elemente message. */
- UPB_ASSERT(field->submsg_index != UPB_NO_SUBMSG);
- subm = frame->m->submsgs[field->submsg_index];
- UPB_ASSERT(subm);
-
- submsg = upb_env_malloc(d->env, upb_msg_sizeof((upb_msglayout *)subm));
- CHK(submsg);
- submsg = upb_msg_init(submsg, (upb_msglayout*)subm,
- upb_arena_alloc(upb_env_arena(d->env)));
-
- field_mem = upb_array_add(arr, 1);
- CHK(field_mem);
- *(void**)field_mem = submsg;
-
- return upb_decode_message(
- d, val.data + val.size, frame->group_number, submsg, subm);
- }
- case UPB_DESCRIPTOR_TYPE_GROUP:
- return upb_append_unknown(d, frame, field_start);
- }
-#undef VARINT_CASE
- UPB_UNREACHABLE();
-}
-
-static bool upb_decode_delimitedfield(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field) {
- upb_stringview val;
-
- CHK(upb_decode_string(&d->ptr, frame->limit, &val));
-
- if (field->label == UPB_LABEL_REPEATED) {
- return upb_decode_toarray(d, frame, field_start, field, val);
- } else {
- switch ((upb_descriptortype_t)field->descriptortype) {
- case UPB_DESCRIPTOR_TYPE_STRING:
- case UPB_DESCRIPTOR_TYPE_BYTES: {
- void *field_mem = upb_decode_prepareslot(d, frame, field);
- CHK(field_mem);
- memcpy(field_mem, &val, sizeof(val));
- break;
- }
- case UPB_DESCRIPTOR_TYPE_MESSAGE:
- CHK(val.size <= (size_t)(frame->limit - val.data));
- d->ptr -= val.size;
- CHK(upb_decode_submsg(d, frame, val.data + val.size, field, 0));
- break;
- default:
- /* TODO(haberman): should we accept the last element of a packed? */
- return upb_append_unknown(d, frame, field_start);
- }
- upb_decode_setpresent(frame, field);
- return true;
- }
-}
-
-static const upb_msglayout_fieldinit_v1 *upb_find_field(
- const upb_msglayout_msginit_v1 *l, uint32_t field_number) {
- /* Lots of optimization opportunities here. */
- int i;
- for (i = 0; i < l->field_count; i++) {
- if (l->fields[i].number == field_number) {
- return &l->fields[i];
- }
- }
-
- return NULL; /* Unknown field. */
-}
-
-static bool upb_decode_field(upb_decstate *d, upb_decframe *frame) {
- int field_number;
- int wire_type;
- const char *field_start = d->ptr;
- const upb_msglayout_fieldinit_v1 *field;
-
- CHK(upb_decode_tag(&d->ptr, frame->limit, &field_number, &wire_type));
- field = upb_find_field(frame->m, field_number);
-
- if (field) {
- switch (wire_type) {
- case UPB_WIRE_TYPE_VARINT:
- return upb_decode_varintfield(d, frame, field_start, field);
- case UPB_WIRE_TYPE_32BIT:
- return upb_decode_32bitfield(d, frame, field_start, field);
- case UPB_WIRE_TYPE_64BIT:
- return upb_decode_64bitfield(d, frame, field_start, field);
- case UPB_WIRE_TYPE_DELIMITED:
- return upb_decode_delimitedfield(d, frame, field_start, field);
- case UPB_WIRE_TYPE_START_GROUP:
- CHK(field->descriptortype == UPB_DESCRIPTOR_TYPE_GROUP);
- return upb_decode_submsg(d, frame, frame->limit, field, field_number);
- case UPB_WIRE_TYPE_END_GROUP:
- CHK(frame->group_number == field_number)
- frame->limit = d->ptr;
- return true;
- default:
- return false;
- }
- } else {
- CHK(field_number != 0);
- return upb_skip_unknownfielddata(d, frame, field_number, wire_type);
- }
-}
-
-static bool upb_skip_unknowngroup(upb_decstate *d, int field_number,
- const char *limit) {
- upb_decframe frame;
- frame.msg = NULL;
- frame.m = NULL;
- frame.group_number = field_number;
- frame.limit = limit;
-
- while (d->ptr < frame.limit) {
- int wire_type;
- int field_number;
-
- CHK(upb_decode_tag(&d->ptr, frame.limit, &field_number, &wire_type));
- CHK(upb_skip_unknownfielddata(d, &frame, field_number, wire_type));
- }
-
- return true;
-}
-
-static bool upb_decode_message(upb_decstate *d, const char *limit,
- int group_number, char *msg,
- const upb_msglayout_msginit_v1 *l) {
- upb_decframe frame;
- frame.group_number = group_number;
- frame.limit = limit;
- frame.msg = msg;
- frame.m = l;
-
- while (d->ptr < frame.limit) {
- CHK(upb_decode_field(d, &frame));
- }
-
- return true;
-}
-
-bool upb_decode(upb_stringview buf, void *msg,
- const upb_msglayout_msginit_v1 *l, upb_env *env) {
- upb_decstate state;
- state.ptr = buf.data;
- state.env = env;
-
- return upb_decode_message(&state, buf.data + buf.size, 0, msg, l);
-}
-
-#undef CHK
#include <ctype.h>
@@ -2828,7 +326,6 @@ static bool assign_msg_indices(upb_msgdef *m, upb_status *s) {
v = upb_value_bool(true);
upb_inttable_insert(&t, UPB_STARTMSG_SELECTOR, v);
upb_inttable_insert(&t, UPB_ENDMSG_SELECTOR, v);
- upb_inttable_insert(&t, UPB_UNKNOWN_SELECTOR, v);
for(upb_msg_field_begin(&j, m);
!upb_msg_field_done(&j);
upb_msg_field_next(&j)) {
@@ -4862,405 +2359,6 @@ bool upb_symtab_done(const upb_symtab_iter *iter) {
const upb_def *upb_symtab_iter_def(const upb_symtab_iter *iter) {
return upb_value_getptr(upb_strtable_iter_value(&iter->iter));
}
-/* We encode backwards, to avoid pre-computing lengths (one-pass encode). */
-
-
-#define UPB_PB_VARINT_MAX_LEN 10
-#define CHK(x) do { if (!(x)) { return false; } } while(0)
-
-/* Maps descriptor type -> upb field type. */
-static const uint8_t upb_desctype_to_fieldtype2[] = {
- UPB_WIRE_TYPE_END_GROUP, /* ENDGROUP */
- UPB_TYPE_DOUBLE, /* DOUBLE */
- UPB_TYPE_FLOAT, /* FLOAT */
- UPB_TYPE_INT64, /* INT64 */
- UPB_TYPE_UINT64, /* UINT64 */
- UPB_TYPE_INT32, /* INT32 */
- UPB_TYPE_UINT64, /* FIXED64 */
- UPB_TYPE_UINT32, /* FIXED32 */
- UPB_TYPE_BOOL, /* BOOL */
- UPB_TYPE_STRING, /* STRING */
- UPB_TYPE_MESSAGE, /* GROUP */
- UPB_TYPE_MESSAGE, /* MESSAGE */
- UPB_TYPE_BYTES, /* BYTES */
- UPB_TYPE_UINT32, /* UINT32 */
- UPB_TYPE_ENUM, /* ENUM */
- UPB_TYPE_INT32, /* SFIXED32 */
- UPB_TYPE_INT64, /* SFIXED64 */
- UPB_TYPE_INT32, /* SINT32 */
- UPB_TYPE_INT64, /* SINT64 */
-};
-
-static size_t upb_encode_varint(uint64_t val, char *buf) {
- size_t i;
- if (val < 128) { buf[0] = val; return 1; }
- i = 0;
- while (val) {
- uint8_t byte = val & 0x7fU;
- val >>= 7;
- if (val) byte |= 0x80U;
- buf[i++] = byte;
- }
- return i;
-}
-
-static uint32_t upb_zzencode_32(int32_t n) { return (n << 1) ^ (n >> 31); }
-static uint64_t upb_zzencode_64(int64_t n) { return (n << 1) ^ (n >> 63); }
-
-typedef struct {
- upb_env *env;
- char *buf, *ptr, *limit;
-} upb_encstate;
-
-static size_t upb_roundup_pow2(size_t bytes) {
- size_t ret = 128;
- while (ret < bytes) {
- ret *= 2;
- }
- return ret;
-}
-
-static bool upb_encode_growbuffer(upb_encstate *e, size_t bytes) {
- size_t old_size = e->limit - e->buf;
- size_t new_size = upb_roundup_pow2(bytes + (e->limit - e->ptr));
- char *new_buf = upb_env_realloc(e->env, e->buf, old_size, new_size);
- CHK(new_buf);
-
- /* We want previous data at the end, realloc() put it at the beginning. */
- memmove(new_buf + new_size - old_size, e->buf, old_size);
-
- e->ptr = new_buf + new_size - (e->limit - e->ptr);
- e->limit = new_buf + new_size;
- e->buf = new_buf;
- return true;
-}
-
-/* Call to ensure that at least "bytes" bytes are available for writing at
- * e->ptr. Returns false if the bytes could not be allocated. */
-static bool upb_encode_reserve(upb_encstate *e, size_t bytes) {
- CHK(UPB_LIKELY((size_t)(e->ptr - e->buf) >= bytes) ||
- upb_encode_growbuffer(e, bytes));
-
- e->ptr -= bytes;
- return true;
-}
-
-/* Writes the given bytes to the buffer, handling reserve/advance. */
-static bool upb_put_bytes(upb_encstate *e, const void *data, size_t len) {
- CHK(upb_encode_reserve(e, len));
- memcpy(e->ptr, data, len);
- return true;
-}
-
-static bool upb_put_fixed64(upb_encstate *e, uint64_t val) {
- /* TODO(haberman): byte-swap for big endian. */
- return upb_put_bytes(e, &val, sizeof(uint64_t));
-}
-
-static bool upb_put_fixed32(upb_encstate *e, uint32_t val) {
- /* TODO(haberman): byte-swap for big endian. */
- return upb_put_bytes(e, &val, sizeof(uint32_t));
-}
-
-static bool upb_put_varint(upb_encstate *e, uint64_t val) {
- size_t len;
- char *start;
- CHK(upb_encode_reserve(e, UPB_PB_VARINT_MAX_LEN));
- len = upb_encode_varint(val, e->ptr);
- start = e->ptr + UPB_PB_VARINT_MAX_LEN - len;
- memmove(start, e->ptr, len);
- e->ptr = start;
- return true;
-}
-
-static bool upb_put_double(upb_encstate *e, double d) {
- uint64_t u64;
- UPB_ASSERT(sizeof(double) == sizeof(uint64_t));
- memcpy(&u64, &d, sizeof(uint64_t));
- return upb_put_fixed64(e, u64);
-}
-
-static bool upb_put_float(upb_encstate *e, float d) {
- uint32_t u32;
- UPB_ASSERT(sizeof(float) == sizeof(uint32_t));
- memcpy(&u32, &d, sizeof(uint32_t));
- return upb_put_fixed32(e, u32);
-}
-
-static uint32_t upb_readcase(const char *msg, const upb_msglayout_msginit_v1 *m,
- int oneof_index) {
- uint32_t ret;
- memcpy(&ret, msg + m->oneofs[oneof_index].case_offset, sizeof(ret));
- return ret;
-}
-
-static bool upb_readhasbit(const char *msg,
- const upb_msglayout_fieldinit_v1 *f) {
- UPB_ASSERT(f->hasbit != UPB_NO_HASBIT);
- return msg[f->hasbit / 8] & (1 << (f->hasbit % 8));
-}
-
-static bool upb_put_tag(upb_encstate *e, int field_number, int wire_type) {
- return upb_put_varint(e, (field_number << 3) | wire_type);
-}
-
-static bool upb_put_fixedarray(upb_encstate *e, const upb_array *arr,
- size_t size) {
- size_t bytes = arr->len * size;
- return upb_put_bytes(e, arr->data, bytes) && upb_put_varint(e, bytes);
-}
-
-bool upb_encode_message(upb_encstate *e, const char *msg,
- const upb_msglayout_msginit_v1 *m,
- size_t *size);
-
-static bool upb_encode_array(upb_encstate *e, const char *field_mem,
- const upb_msglayout_msginit_v1 *m,
- const upb_msglayout_fieldinit_v1 *f) {
- const upb_array *arr = *(const upb_array**)field_mem;
-
- if (arr == NULL || arr->len == 0) {
- return true;
- }
-
- UPB_ASSERT(arr->type == upb_desctype_to_fieldtype2[f->descriptortype]);
-
-#define VARINT_CASE(ctype, encode) { \
- ctype *start = arr->data; \
- ctype *ptr = start + arr->len; \
- size_t pre_len = e->limit - e->ptr; \
- do { \
- ptr--; \
- CHK(upb_put_varint(e, encode)); \
- } while (ptr != start); \
- CHK(upb_put_varint(e, e->limit - e->ptr - pre_len)); \
-} \
-break; \
-do { ; } while(0)
-
- switch (f->descriptortype) {
- case UPB_DESCRIPTOR_TYPE_DOUBLE:
- CHK(upb_put_fixedarray(e, arr, sizeof(double)));
- break;
- case UPB_DESCRIPTOR_TYPE_FLOAT:
- CHK(upb_put_fixedarray(e, arr, sizeof(float)));
- break;
- case UPB_DESCRIPTOR_TYPE_SFIXED64:
- case UPB_DESCRIPTOR_TYPE_FIXED64:
- CHK(upb_put_fixedarray(e, arr, sizeof(uint64_t)));
- break;
- case UPB_DESCRIPTOR_TYPE_FIXED32:
- case UPB_DESCRIPTOR_TYPE_SFIXED32:
- CHK(upb_put_fixedarray(e, arr, sizeof(uint32_t)));
- break;
- case UPB_DESCRIPTOR_TYPE_INT64:
- case UPB_DESCRIPTOR_TYPE_UINT64:
- VARINT_CASE(uint64_t, *ptr);
- case UPB_DESCRIPTOR_TYPE_UINT32:
- VARINT_CASE(uint32_t, *ptr);
- case UPB_DESCRIPTOR_TYPE_INT32:
- case UPB_DESCRIPTOR_TYPE_ENUM:
- VARINT_CASE(int32_t, (int64_t)*ptr);
- case UPB_DESCRIPTOR_TYPE_BOOL:
- VARINT_CASE(bool, *ptr);
- case UPB_DESCRIPTOR_TYPE_SINT32:
- VARINT_CASE(int32_t, upb_zzencode_32(*ptr));
- case UPB_DESCRIPTOR_TYPE_SINT64:
- VARINT_CASE(int64_t, upb_zzencode_64(*ptr));
- case UPB_DESCRIPTOR_TYPE_STRING:
- case UPB_DESCRIPTOR_TYPE_BYTES: {
- upb_stringview *start = arr->data;
- upb_stringview *ptr = start + arr->len;
- do {
- ptr--;
- CHK(upb_put_bytes(e, ptr->data, ptr->size) &&
- upb_put_varint(e, ptr->size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
- } while (ptr != start);
- return true;
- }
- case UPB_DESCRIPTOR_TYPE_GROUP: {
- void **start = arr->data;
- void **ptr = start + arr->len;
- const upb_msglayout_msginit_v1 *subm = m->submsgs[f->submsg_index];
- do {
- size_t size;
- ptr--;
- CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP) &&
- upb_encode_message(e, *ptr, subm, &size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP));
- } while (ptr != start);
- return true;
- }
- case UPB_DESCRIPTOR_TYPE_MESSAGE: {
- void **start = arr->data;
- void **ptr = start + arr->len;
- const upb_msglayout_msginit_v1 *subm = m->submsgs[f->submsg_index];
- do {
- size_t size;
- ptr--;
- CHK(upb_encode_message(e, *ptr, subm, &size) &&
- upb_put_varint(e, size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
- } while (ptr != start);
- return true;
- }
- }
-#undef VARINT_CASE
-
- /* We encode all primitive arrays as packed, regardless of what was specified
- * in the .proto file. Could special case 1-sized arrays. */
- CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
- return true;
-}
-
-static bool upb_encode_scalarfield(upb_encstate *e, const char *field_mem,
- const upb_msglayout_msginit_v1 *m,
- const upb_msglayout_fieldinit_v1 *f,
- bool is_proto3) {
- bool skip_zero_value = is_proto3 && f->oneof_index == UPB_NOT_IN_ONEOF;
-
-#define CASE(ctype, type, wire_type, encodeval) do { \
- ctype val = *(ctype*)field_mem; \
- if (skip_zero_value && val == 0) { \
- return true; \
- } \
- return upb_put_ ## type(e, encodeval) && \
- upb_put_tag(e, f->number, wire_type); \
-} while(0)
-
- switch (f->descriptortype) {
- case UPB_DESCRIPTOR_TYPE_DOUBLE:
- CASE(double, double, UPB_WIRE_TYPE_64BIT, val);
- case UPB_DESCRIPTOR_TYPE_FLOAT:
- CASE(float, float, UPB_WIRE_TYPE_32BIT, val);
- case UPB_DESCRIPTOR_TYPE_INT64:
- case UPB_DESCRIPTOR_TYPE_UINT64:
- CASE(uint64_t, varint, UPB_WIRE_TYPE_VARINT, val);
- case UPB_DESCRIPTOR_TYPE_UINT32:
- CASE(uint32_t, varint, UPB_WIRE_TYPE_VARINT, val);
- case UPB_DESCRIPTOR_TYPE_INT32:
- case UPB_DESCRIPTOR_TYPE_ENUM:
- CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, (int64_t)val);
- case UPB_DESCRIPTOR_TYPE_SFIXED64:
- case UPB_DESCRIPTOR_TYPE_FIXED64:
- CASE(uint64_t, fixed64, UPB_WIRE_TYPE_64BIT, val);
- case UPB_DESCRIPTOR_TYPE_FIXED32:
- case UPB_DESCRIPTOR_TYPE_SFIXED32:
- CASE(uint32_t, fixed32, UPB_WIRE_TYPE_32BIT, val);
- case UPB_DESCRIPTOR_TYPE_BOOL:
- CASE(bool, varint, UPB_WIRE_TYPE_VARINT, val);
- case UPB_DESCRIPTOR_TYPE_SINT32:
- CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_32(val));
- case UPB_DESCRIPTOR_TYPE_SINT64:
- CASE(int64_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_64(val));
- case UPB_DESCRIPTOR_TYPE_STRING:
- case UPB_DESCRIPTOR_TYPE_BYTES: {
- upb_stringview view = *(upb_stringview*)field_mem;
- if (skip_zero_value && view.size == 0) {
- return true;
- }
- return upb_put_bytes(e, view.data, view.size) &&
- upb_put_varint(e, view.size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED);
- }
- case UPB_DESCRIPTOR_TYPE_GROUP: {
- size_t size;
- void *submsg = *(void**)field_mem;
- const upb_msglayout_msginit_v1 *subm = m->submsgs[f->submsg_index];
- if (skip_zero_value && submsg == NULL) {
- return true;
- }
- return upb_put_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP) &&
- upb_encode_message(e, submsg, subm, &size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP);
- }
- case UPB_DESCRIPTOR_TYPE_MESSAGE: {
- size_t size;
- void *submsg = *(void**)field_mem;
- const upb_msglayout_msginit_v1 *subm = m->submsgs[f->submsg_index];
- if (skip_zero_value && submsg == NULL) {
- return true;
- }
- return upb_encode_message(e, submsg, subm, &size) &&
- upb_put_varint(e, size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED);
- }
- }
-#undef CASE
- UPB_UNREACHABLE();
-}
-
-bool upb_encode_hasscalarfield(const char *msg,
- const upb_msglayout_msginit_v1 *m,
- const upb_msglayout_fieldinit_v1 *f) {
- if (f->oneof_index != UPB_NOT_IN_ONEOF) {
- return upb_readcase(msg, m, f->oneof_index) == f->number;
- } else if (m->is_proto2) {
- return upb_readhasbit(msg, f);
- } else {
- /* For proto3, we'll test for the field being empty later. */
- return true;
- }
-}
-
-bool upb_encode_message(upb_encstate* e, const char *msg,
- const upb_msglayout_msginit_v1 *m,
- size_t *size) {
- int i;
- size_t pre_len = e->limit - e->ptr;
-
- if (msg == NULL) {
- return true;
- }
-
- for (i = m->field_count - 1; i >= 0; i--) {
- const upb_msglayout_fieldinit_v1 *f = &m->fields[i];
-
- if (f->label == UPB_LABEL_REPEATED) {
- CHK(upb_encode_array(e, msg + f->offset, m, f));
- } else {
- if (upb_encode_hasscalarfield(msg, m, f)) {
- if (f->oneof_index == UPB_NOT_IN_ONEOF) {
- CHK(upb_encode_scalarfield(e, msg + f->offset, m, f, !m->is_proto2));
- } else {
- const upb_msglayout_oneofinit_v1 *o = &m->oneofs[f->oneof_index];
- CHK(upb_encode_scalarfield(e, msg + o->data_offset,
- m, f, !m->is_proto2));
- }
- }
- }
- }
-
- *size = (e->limit - e->ptr) - pre_len;
- return true;
-}
-
-char *upb_encode(const void *msg, const upb_msglayout_msginit_v1 *m,
- upb_env *env, size_t *size) {
- upb_encstate e;
- e.env = env;
- e.buf = NULL;
- e.limit = NULL;
- e.ptr = NULL;
-
- if (!upb_encode_message(&e, msg, m, size)) {
- *size = 0;
- return NULL;
- }
-
- *size = e.limit - e.ptr;
-
- if (*size == 0) {
- static char ch;
- return &ch;
- } else {
- UPB_ASSERT(e.ptr);
- return e.ptr;
- }
-}
-
-#undef CHK
/*
** TODO(haberman): it's unclear whether a lot of the consistency checks should
** UPB_ASSERT() or return false.
@@ -5632,12 +2730,6 @@ SETTER(endseq, upb_endfield_handlerfunc*, UPB_HANDLER_ENDSEQ)
#undef SETTER
-bool upb_handlers_setunknown(upb_handlers *h, upb_unknown_handlerfunc *func,
- upb_handlerattr *attr) {
- return doset(h, UPB_UNKNOWN_SELECTOR, NULL, UPB_HANDLER_INT32,
- (upb_func *)func, attr);
-}
-
bool upb_handlers_setstartmsg(upb_handlers *h, upb_startmsg_handlerfunc *func,
upb_handlerattr *attr) {
return doset(h, UPB_STARTMSG_SELECTOR, NULL, UPB_HANDLER_INT32,
@@ -5987,8 +3079,7 @@ bool upb_fieldtype_mapkeyok(upb_fieldtype_t type) {
void *upb_array_pack(const upb_array *arr, void *p, size_t *ofs, size_t size);
void *upb_map_pack(const upb_map *map, void *p, size_t *ofs, size_t size);
-#define PTR_AT(msg, ofs, type) (type*)((char*)msg + ofs)
-#define VOIDPTR_AT(msg, ofs) PTR_AT(msg, ofs, void)
+#define CHARPTR_AT(msg, ofs) ((char*)msg + ofs)
#define ENCODE_MAX_NESTING 64
#define CHECK_TRUE(x) if (!(x)) { return false; }
@@ -6026,24 +3117,16 @@ static size_t upb_msgval_sizeof(upb_fieldtype_t type) {
return 4;
case UPB_TYPE_BOOL:
return 1;
+ case UPB_TYPE_BYTES:
case UPB_TYPE_MESSAGE:
return sizeof(void*);
- case UPB_TYPE_BYTES:
case UPB_TYPE_STRING:
- return sizeof(upb_stringview);
+ return sizeof(char*) + sizeof(size_t);
}
UPB_UNREACHABLE();
}
-static uint8_t upb_msg_fieldsize(const upb_msglayout_fieldinit_v1 *field) {
- if (field->label == UPB_LABEL_REPEATED) {
- return sizeof(void*);
- } else {
- return upb_msgval_sizeof(upb_desctype_to_fieldtype[field->descriptortype]);
- }
-}
-
-static uint8_t upb_msg_fielddefsize(const upb_fielddef *f) {
+static uint8_t upb_msg_fieldsize(const upb_fielddef *f) {
if (upb_fielddef_isseq(f)) {
return sizeof(void*);
} else {
@@ -6087,6 +3170,7 @@ static upb_ctype_t upb_fieldtotabtype(upb_fieldtype_t type) {
}
static upb_msgval upb_msgval_fromdefault(const upb_fielddef *f) {
+ /* TODO(haberman): improve/optimize this (maybe use upb_msgval in fielddef) */
switch (upb_fielddef_type(f)) {
case UPB_TYPE_FLOAT:
return upb_msgval_float(upb_fielddef_defaultfloat(f));
@@ -6098,7 +3182,7 @@ static upb_msgval upb_msgval_fromdefault(const upb_fielddef *f) {
case UPB_TYPE_BYTES: {
size_t len;
const char *ptr = upb_fielddef_defaultstr(f, &len);
- return upb_msgval_makestr(ptr, len);
+ return upb_msgval_str(ptr, len);
}
case UPB_TYPE_MESSAGE:
return upb_msgval_msg(NULL);
@@ -6121,44 +3205,63 @@ static upb_msgval upb_msgval_fromdefault(const upb_fielddef *f) {
/** upb_msglayout *************************************************************/
struct upb_msglayout {
- struct upb_msglayout_msginit_v1 data;
+ upb_msgfactory *factory;
+ const upb_msgdef *msgdef;
+ size_t size;
+ size_t extdict_offset;
+ void *default_msg;
+ uint32_t *field_offsets;
+ uint32_t *case_offsets;
+ uint32_t *hasbits;
+ bool has_extdict;
+ uint8_t align;
};
+static void upb_msg_checkfield(const upb_msglayout *l, const upb_fielddef *f) {
+ UPB_ASSERT(l->msgdef == upb_fielddef_containingtype(f));
+}
+
static void upb_msglayout_free(upb_msglayout *l) {
- upb_gfree(l->data.default_msg);
+ upb_gfree(l->default_msg);
upb_gfree(l);
}
+const upb_msgdef *upb_msglayout_msgdef(const upb_msglayout *l) {
+ return l->msgdef;
+}
+
static size_t upb_msglayout_place(upb_msglayout *l, size_t size) {
size_t ret;
- l->data.size = align_up(l->data.size, size);
- ret = l->data.size;
- l->data.size += size;
+ l->size = align_up(l->size, size);
+ l->align = align_up(l->align, size);
+ ret = l->size;
+ l->size += size;
return ret;
}
static uint32_t upb_msglayout_offset(const upb_msglayout *l,
const upb_fielddef *f) {
- return l->data.fields[upb_fielddef_index(f)].offset;
+ return l->field_offsets[upb_fielddef_index(f)];
}
static uint32_t upb_msglayout_hasbit(const upb_msglayout *l,
const upb_fielddef *f) {
- return l->data.fields[upb_fielddef_index(f)].hasbit;
+ return l->hasbits[upb_fielddef_index(f)];
}
-static bool upb_msglayout_initdefault(upb_msglayout *l, const upb_msgdef *m) {
+static bool upb_msglayout_initdefault(upb_msglayout *l) {
+ const upb_msgdef *m = l->msgdef;
upb_msg_field_iter it;
- if (upb_msgdef_syntax(m) == UPB_SYNTAX_PROTO2 && l->data.size) {
+ if (upb_msgdef_syntax(m) == UPB_SYNTAX_PROTO2 && l->size) {
/* Allocate default message and set default values in it. */
- l->data.default_msg = upb_gmalloc(l->data.size);
- if (!l->data.default_msg) {
+ l->default_msg = upb_gmalloc(l->size);
+ if (!l->default_msg) {
return false;
}
- memset(l->data.default_msg, 0, l->data.size);
+ memset(l->default_msg, 0, l->size);
for (upb_msg_field_begin(&it, m); !upb_msg_field_done(&it);
upb_msg_field_next(&it)) {
@@ -6168,14 +3271,10 @@ static bool upb_msglayout_initdefault(upb_msglayout *l, const upb_msgdef *m) {
continue;
}
- /* TODO(haberman): handle strings. */
if (!upb_fielddef_isstring(f) &&
!upb_fielddef_issubmsg(f) &&
!upb_fielddef_isseq(f)) {
- upb_msg_set(l->data.default_msg,
- upb_fielddef_index(f),
- upb_msgval_fromdefault(f),
- l);
+ upb_msg_set(l->default_msg, f, upb_msgval_fromdefault(f), l);
}
}
}
@@ -6183,48 +3282,27 @@ static bool upb_msglayout_initdefault(upb_msglayout *l, const upb_msgdef *m) {
return true;
}
-static bool upb_msglayout_init(const upb_msgdef *m,
- upb_msglayout *l,
- upb_msgfactory *factory) {
+static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) {
upb_msg_field_iter it;
upb_msg_oneof_iter oit;
+ upb_msglayout *l;
size_t hasbit;
- size_t submsg_count = 0;
- const upb_msglayout_msginit_v1 **submsgs;
- upb_msglayout_fieldinit_v1 *fields;
- upb_msglayout_oneofinit_v1 *oneofs;
+ size_t array_size = upb_msgdef_numfields(m) + upb_msgdef_numoneofs(m);
- for (upb_msg_field_begin(&it, m);
- !upb_msg_field_done(&it);
- upb_msg_field_next(&it)) {
- const upb_fielddef* f = upb_msg_iter_field(&it);
- if (upb_fielddef_issubmsg(f)) {
- submsg_count++;
- }
+ if (upb_msgdef_syntax(m) == UPB_SYNTAX_PROTO2) {
+ array_size += upb_msgdef_numfields(m); /* hasbits. */
}
- memset(l, 0, sizeof(*l));
+ l = upb_gmalloc(sizeof(*l) + (sizeof(uint32_t) * array_size));
+ if (!l) return NULL;
- fields = upb_gmalloc(upb_msgdef_numfields(m) * sizeof(*fields));
- submsgs = upb_gmalloc(submsg_count * sizeof(*submsgs));
- oneofs = upb_gmalloc(upb_msgdef_numoneofs(m) * sizeof(*oneofs));
-
- if ((!fields && upb_msgdef_numfields(m)) ||
- (!submsgs && submsg_count) ||
- (!oneofs && upb_msgdef_numoneofs(m))) {
- /* OOM. */
- upb_gfree(fields);
- upb_gfree(submsgs);
- upb_gfree(oneofs);
- return false;
- }
+ memset(l, 0, sizeof(*l));
- l->data.field_count = upb_msgdef_numfields(m);
- l->data.oneof_count = upb_msgdef_numoneofs(m);
- l->data.fields = fields;
- l->data.submsgs = submsgs;
- l->data.oneofs = oneofs;
- l->data.is_proto2 = (upb_msgdef_syntax(m) == UPB_SYNTAX_PROTO2);
+ l->msgdef = m;
+ l->align = 1;
+ l->field_offsets = (uint32_t*)CHARPTR_AT(l, sizeof(*l));
+ l->case_offsets = l->field_offsets + upb_msgdef_numfields(m);
+ l->hasbits = l->case_offsets + upb_msgdef_numoneofs(m);
/* Allocate data offsets in three stages:
*
@@ -6235,87 +3313,83 @@ static bool upb_msglayout_init(const upb_msgdef *m,
* OPT: There is a lot of room for optimization here to minimize the size.
*/
- /* Allocate hasbits and set basic field attributes. */
- submsg_count = 0;
- for (upb_msg_field_begin(&it, m), hasbit = 0;
+ /* Allocate hasbits. Start at sizeof(void*) for upb_alloc*. */
+ for (upb_msg_field_begin(&it, m), hasbit = sizeof(void*) * 8;
!upb_msg_field_done(&it);
upb_msg_field_next(&it)) {
const upb_fielddef* f = upb_msg_iter_field(&it);
- upb_msglayout_fieldinit_v1 *field = &fields[upb_fielddef_index(f)];
-
- field->number = upb_fielddef_number(f);
- field->descriptortype = upb_fielddef_descriptortype(f);
- field->label = upb_fielddef_label(f);
-
- if (upb_fielddef_containingoneof(f)) {
- field->oneof_index = upb_oneofdef_index(upb_fielddef_containingoneof(f));
- } else {
- field->oneof_index = UPB_NOT_IN_ONEOF;
- }
-
- if (upb_fielddef_issubmsg(f)) {
- const upb_msglayout *sub_layout =
- upb_msgfactory_getlayout(factory, upb_fielddef_msgsubdef(f));
- field->submsg_index = submsg_count++;
- submsgs[field->submsg_index] = &sub_layout->data;
- } else {
- field->submsg_index = UPB_NO_SUBMSG;
- }
if (upb_fielddef_haspresence(f) && !upb_fielddef_containingoneof(f)) {
- field->hasbit = hasbit++;
- } else {
- field->hasbit = UPB_NO_HASBIT;
+ l->hasbits[upb_fielddef_index(f)] = hasbit++;
}
}
/* Account for space used by hasbits. */
- l->data.size = div_round_up(hasbit, 8);
+ l->size = div_round_up(hasbit, 8);
/* Allocate non-oneof fields. */
for (upb_msg_field_begin(&it, m); !upb_msg_field_done(&it);
upb_msg_field_next(&it)) {
const upb_fielddef* f = upb_msg_iter_field(&it);
- size_t field_size = upb_msg_fielddefsize(f);
+ size_t field_size = upb_msg_fieldsize(f);
size_t index = upb_fielddef_index(f);
+
if (upb_fielddef_containingoneof(f)) {
/* Oneofs are handled separately below. */
continue;
}
- fields[index].offset = upb_msglayout_place(l, field_size);
+ l->field_offsets[index] = upb_msglayout_place(l, field_size);
}
/* Allocate oneof fields. Each oneof field consists of a uint32 for the case
* and space for the actual data. */
for (upb_msg_oneof_begin(&oit, m); !upb_msg_oneof_done(&oit);
upb_msg_oneof_next(&oit)) {
- const upb_oneofdef* o = upb_msg_iter_oneof(&oit);
+ const upb_oneofdef* oneof = upb_msg_iter_oneof(&oit);
upb_oneof_iter fit;
-
size_t case_size = sizeof(uint32_t); /* Could potentially optimize this. */
- upb_msglayout_oneofinit_v1 *oneof = &oneofs[upb_oneofdef_index(o)];
size_t field_size = 0;
+ size_t case_offset;
+ size_t val_offset;
/* Calculate field size: the max of all field sizes. */
- for (upb_oneof_begin(&fit, o);
+ for (upb_oneof_begin(&fit, oneof);
!upb_oneof_done(&fit);
upb_oneof_next(&fit)) {
const upb_fielddef* f = upb_oneof_iter_field(&fit);
- field_size = UPB_MAX(field_size, upb_msg_fielddefsize(f));
+ field_size = UPB_MAX(field_size, upb_msg_fieldsize(f));
}
/* Align and allocate case offset. */
- oneof->case_offset = upb_msglayout_place(l, case_size);
- oneof->data_offset = upb_msglayout_place(l, field_size);
+ case_offset = upb_msglayout_place(l, case_size);
+ val_offset = upb_msglayout_place(l, field_size);
+
+ l->case_offsets[upb_oneofdef_index(oneof)] = case_offset;
+
+ /* Assign all fields in the oneof this same offset. */
+ for (upb_oneof_begin(&fit, oneof); !upb_oneof_done(&fit);
+ upb_oneof_next(&fit)) {
+ const upb_fielddef* f = upb_oneof_iter_field(&fit);
+ l->field_offsets[upb_fielddef_index(f)] = val_offset;
+ }
}
/* Size of the entire structure should be a multiple of its greatest
- * alignment. TODO: track overall alignment for real? */
- l->data.size = align_up(l->data.size, 8);
+ * alignment. */
+ l->size = align_up(l->size, l->align);
+
+ if (upb_msglayout_initdefault(l)) {
+ return l;
+ } else {
+ upb_msglayout_free(l);
+ return NULL;
+ }
+}
- return upb_msglayout_initdefault(l, m);
+upb_msgfactory *upb_msglayout_factory(const upb_msglayout *layout) {
+ return layout->factory;
}
@@ -6370,14 +3444,11 @@ const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f,
UPB_ASSERT(upb_value_getptr(v));
return upb_value_getptr(v);
} else {
- /* In case of circular dependency, layout has to be inserted first. */
- upb_msglayout *l = upb_gmalloc(sizeof(*l));
upb_msgfactory *mutable_f = (void*)f;
+ upb_msglayout *l = upb_msglayout_new(m);
upb_inttable_insertptr(&mutable_f->layouts, m, upb_value_ptr(l));
UPB_ASSERT(l);
- if (!upb_msglayout_init(m, l, f)) {
- upb_msglayout_free(l);
- }
+ l->factory = f;
return l;
}
}
@@ -6386,15 +3457,16 @@ const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f,
void *upb_msg_startstr(void *msg, const void *hd, size_t size_hint) {
uint32_t ofs = (uintptr_t)hd;
- upb_alloc *alloc = upb_msg_alloc(msg);
+ /* We pass NULL here because we know we can get away with it. */
+ upb_alloc *alloc = upb_msg_alloc(msg, NULL);
upb_msgval val;
UPB_UNUSED(size_hint);
val = upb_msgval_read(msg, ofs, upb_msgval_sizeof(UPB_TYPE_STRING));
- upb_free(alloc, (void*)val.str.data);
- val.str.data = NULL;
- val.str.size = 0;
+ upb_free(alloc, (void*)val.str.ptr);
+ val.str.ptr = NULL;
+ val.str.len = 0;
upb_msgval_write(msg, ofs, val, upb_msgval_sizeof(UPB_TYPE_STRING));
return msg;
@@ -6403,22 +3475,23 @@ void *upb_msg_startstr(void *msg, const void *hd, size_t size_hint) {
size_t upb_msg_str(void *msg, const void *hd, const char *ptr, size_t size,
const upb_bufhandle *handle) {
uint32_t ofs = (uintptr_t)hd;
- upb_alloc *alloc = upb_msg_alloc(msg);
+ /* We pass NULL here because we know we can get away with it. */
+ upb_alloc *alloc = upb_msg_alloc(msg, NULL);
upb_msgval val;
size_t newsize;
UPB_UNUSED(handle);
val = upb_msgval_read(msg, ofs, upb_msgval_sizeof(UPB_TYPE_STRING));
- newsize = val.str.size + size;
- val.str.data = upb_realloc(alloc, (void*)val.str.data, val.str.size, newsize);
+ newsize = val.str.len + size;
+ val.str.ptr = upb_realloc(alloc, (void*)val.str.ptr, val.str.len, newsize);
- if (!val.str.data) {
+ if (!val.str.ptr) {
return false;
}
- memcpy((char*)val.str.data + val.str.size, ptr, size);
- val.str.size = newsize;
+ memcpy((char*)val.str.ptr + val.str.len, ptr, size);
+ val.str.len = newsize;
upb_msgval_write(msg, ofs, val, upb_msgval_sizeof(UPB_TYPE_STRING));
return size;
}
@@ -6483,14 +3556,13 @@ static upb_selector_t getsel2(const upb_fielddef *f, upb_handlertype_t type) {
static bool upb_visitor_hasfield(const upb_msg *msg, const upb_fielddef *f,
const upb_msglayout *layout) {
- int field_index = upb_fielddef_index(f);
if (upb_fielddef_isseq(f)) {
- return upb_msgval_getarr(upb_msg_get(msg, field_index, layout)) != NULL;
+ return upb_msgval_getarr(upb_msg_get(msg, f, layout)) != NULL;
} else if (upb_msgdef_syntax(upb_fielddef_containingtype(f)) ==
UPB_SYNTAX_PROTO2) {
- return upb_msg_has(msg, field_index, layout);
+ return upb_msg_has(msg, f, layout);
} else {
- upb_msgval val = upb_msg_get(msg, field_index, layout);
+ upb_msgval val = upb_msg_get(msg, f, layout);
switch (upb_fielddef_type(f)) {
case UPB_TYPE_FLOAT:
return upb_msgval_getfloat(val) != 0;
@@ -6509,7 +3581,7 @@ static bool upb_visitor_hasfield(const upb_msg *msg, const upb_fielddef *f,
return upb_msgval_getuint64(val) != 0;
case UPB_TYPE_STRING:
case UPB_TYPE_BYTES:
- return upb_msgval_getstr(val).size > 0;
+ return upb_msgval_getstr(val) && upb_msgval_getstrlen(val) > 0;
case UPB_TYPE_MESSAGE:
return upb_msgval_getmsg(val) != NULL;
}
@@ -6520,7 +3592,7 @@ static bool upb_visitor_hasfield(const upb_msg *msg, const upb_fielddef *f,
static bool upb_visitor_visitmsg2(const upb_msg *msg,
const upb_msglayout *layout, upb_sink *sink,
int depth) {
- const upb_msgdef *md = upb_handlers_msgdef(sink->handlers);
+ const upb_msgdef *md = upb_msglayout_msgdef(layout);
upb_msg_field_iter i;
upb_status status;
@@ -6542,7 +3614,7 @@ static bool upb_visitor_visitmsg2(const upb_msg *msg,
continue;
}
- val = upb_msg_get(msg, upb_fielddef_index(f), layout);
+ val = upb_msg_get(msg, f, layout);
if (upb_fielddef_isseq(f)) {
const upb_array *arr = upb_msgval_getarr(val);
@@ -6611,160 +3683,194 @@ bool upb_visitor_visitmsg(upb_visitor *visitor, const upb_msg *msg) {
/* If we always read/write as a consistent type to each address, this shouldn't
* violate aliasing.
*/
-#define DEREF(msg, ofs, type) *PTR_AT(msg, ofs, type)
+#define DEREF(msg, ofs, type) *(type*)CHARPTR_AT(msg, ofs)
-/* Internal members of a upb_msg. We can change this without breaking binary
- * compatibility. We put these before the user's data. The user's upb_msg*
- * points after the upb_msg_internal. */
+static upb_inttable *upb_msg_trygetextdict(const upb_msg *msg,
+ const upb_msglayout *l) {
+ return l->has_extdict ? DEREF(msg, l->extdict_offset, upb_inttable*) : NULL;
+}
-/* Used when a message is not extendable. */
-typedef struct {
- /* TODO(haberman): add unknown fields. */
- upb_alloc *alloc;
-} upb_msg_internal;
+static upb_inttable *upb_msg_getextdict(upb_msg *msg,
+ const upb_msglayout *l,
+ upb_alloc *a) {
+ upb_inttable *ext_dict;
+ UPB_ASSERT(l->has_extdict);
-/* Used when a message is extendable. */
-typedef struct {
- upb_inttable *extdict;
- upb_msg_internal base;
-} upb_msg_internal_withext;
+ ext_dict = upb_msg_trygetextdict(msg, l);
-static int upb_msg_internalsize(const upb_msglayout *l) {
- return sizeof(upb_msg_internal) - l->data.extendable * sizeof(void*);
-}
+ if (!ext_dict) {
+ ext_dict = upb_malloc(a, sizeof(upb_inttable));
-static upb_msg_internal *upb_msg_getinternal(upb_msg *msg) {
- return VOIDPTR_AT(msg, -sizeof(upb_msg_internal));
-}
+ if (!ext_dict) {
+ return NULL;
+ }
-static const upb_msg_internal *upb_msg_getinternal_const(const upb_msg *msg) {
- return VOIDPTR_AT(msg, -sizeof(upb_msg_internal));
-}
+ /* Use an 8-byte type to ensure all bytes are copied. */
+ if (!upb_inttable_init2(ext_dict, UPB_CTYPE_INT64, a)) {
+ upb_free(a, ext_dict);
+ return NULL;
+ }
-static upb_msg_internal_withext *upb_msg_getinternalwithext(
- upb_msg *msg, const upb_msglayout *l) {
- UPB_ASSERT(l->data.extendable);
- return VOIDPTR_AT(msg, -sizeof(upb_msg_internal_withext));
-}
+ DEREF(msg, l->extdict_offset, upb_inttable*) = ext_dict;
+ }
-static const upb_msglayout_fieldinit_v1 *upb_msg_checkfield(
- int field_index, const upb_msglayout *l) {
- UPB_ASSERT(field_index >= 0 && field_index < l->data.field_count);
- return &l->data.fields[field_index];
+ return ext_dict;
}
-static bool upb_msg_inoneof(const upb_msglayout_fieldinit_v1 *field) {
- return field->oneof_index != UPB_NOT_IN_ONEOF;
+static uint32_t upb_msg_getoneofint(const upb_msg *msg,
+ const upb_oneofdef *o,
+ const upb_msglayout *l) {
+ size_t oneof_ofs = l->case_offsets[upb_oneofdef_index(o)];
+ return DEREF(msg, oneof_ofs, uint8_t);
}
-static uint32_t *upb_msg_oneofcase(const upb_msg *msg, int field_index,
- const upb_msglayout *l) {
- const upb_msglayout_fieldinit_v1 *field = upb_msg_checkfield(field_index, l);
- UPB_ASSERT(upb_msg_inoneof(field));
- return PTR_AT(msg, l->data.oneofs[field->oneof_index].case_offset, uint32_t);
+static void upb_msg_setoneofcase(const upb_msg *msg,
+ const upb_oneofdef *o,
+ const upb_msglayout *l,
+ uint32_t val) {
+ size_t oneof_ofs = l->case_offsets[upb_oneofdef_index(o)];
+ DEREF(msg, oneof_ofs, uint8_t) = val;
}
-size_t upb_msg_sizeof(const upb_msglayout *l) {
- return l->data.size + upb_msg_internalsize(l);
+
+static bool upb_msg_oneofis(const upb_msg *msg, const upb_msglayout *l,
+ const upb_oneofdef *o, const upb_fielddef *f) {
+ return upb_msg_getoneofint(msg, o, l) == upb_fielddef_number(f);
}
-upb_msg *upb_msg_init(void *mem, const upb_msglayout *l, upb_alloc *a) {
- upb_msg *msg = VOIDPTR_AT(mem, upb_msg_internalsize(l));
+size_t upb_msg_sizeof(const upb_msglayout *l) { return l->size; }
- /* Initialize normal members. */
- if (l->data.default_msg) {
- memcpy(msg, l->data.default_msg, l->data.size);
+void upb_msg_init(upb_msg *msg, const upb_msglayout *l, upb_alloc *a) {
+ if (l->default_msg) {
+ memcpy(msg, l->default_msg, l->size);
} else {
- memset(msg, 0, l->data.size);
+ memset(msg, 0, l->size);
}
- /* Initialize internal members. */
- upb_msg_getinternal(msg)->alloc = a;
-
- if (l->data.extendable) {
- upb_msg_getinternalwithext(msg, l)->extdict = NULL;
- }
-
- return msg;
+ /* Set arena pointer. */
+ memcpy(msg, &a, sizeof(a));
}
-void *upb_msg_uninit(upb_msg *msg, const upb_msglayout *l) {
- if (l->data.extendable) {
- upb_inttable *ext_dict = upb_msg_getinternalwithext(msg, l)->extdict;
- if (ext_dict) {
- upb_inttable_uninit2(ext_dict, upb_msg_alloc(msg));
- upb_free(upb_msg_alloc(msg), ext_dict);
- }
+void upb_msg_uninit(upb_msg *msg, const upb_msglayout *l) {
+ upb_inttable *ext_dict = upb_msg_trygetextdict(msg, l);
+ if (ext_dict) {
+ upb_inttable_uninit2(ext_dict, upb_msg_alloc(msg, l));
}
-
- return VOIDPTR_AT(msg, -upb_msg_internalsize(l));
}
upb_msg *upb_msg_new(const upb_msglayout *l, upb_alloc *a) {
- void *mem = upb_malloc(a, upb_msg_sizeof(l));
- return mem ? upb_msg_init(mem, l, a) : NULL;
+ upb_msg *msg = upb_malloc(a, upb_msg_sizeof(l));
+
+ if (msg) {
+ upb_msg_init(msg, l, a);
+ }
+
+ return msg;
}
void upb_msg_free(upb_msg *msg, const upb_msglayout *l) {
- upb_free(upb_msg_alloc(msg), upb_msg_uninit(msg, l));
+ upb_msg_uninit(msg, l);
+ upb_free(upb_msg_alloc(msg, l), msg);
}
-upb_alloc *upb_msg_alloc(const upb_msg *msg) {
- return upb_msg_getinternal_const(msg)->alloc;
+upb_alloc *upb_msg_alloc(const upb_msg *msg, const upb_msglayout *l) {
+ upb_alloc *alloc;
+ UPB_UNUSED(l);
+ memcpy(&alloc, msg, sizeof(alloc));
+ return alloc;
}
bool upb_msg_has(const upb_msg *msg,
- int field_index,
+ const upb_fielddef *f,
const upb_msglayout *l) {
- const upb_msglayout_fieldinit_v1 *field = upb_msg_checkfield(field_index, l);
+ const upb_oneofdef *o;
+ upb_msg_checkfield(l, f);
+ UPB_ASSERT(upb_fielddef_haspresence(f));
- UPB_ASSERT(l->data.is_proto2);
-
- if (upb_msg_inoneof(field)) {
+ if (upb_fielddef_isextension(f)) {
+ /* Extensions are set when they are present in the extension dict. */
+ upb_inttable *ext_dict = upb_msg_trygetextdict(msg, l);
+ upb_value v;
+ return ext_dict != NULL &&
+ upb_inttable_lookup32(ext_dict, upb_fielddef_number(f), &v);
+ } else if ((o = upb_fielddef_containingoneof(f)) != NULL) {
/* Oneofs are set when the oneof number is set to this field. */
- return *upb_msg_oneofcase(msg, field_index, l) == field->number;
+ return upb_msg_getoneofint(msg, o, l) == upb_fielddef_number(f);
} else {
/* Other fields are set when their hasbit is set. */
- uint32_t hasbit = l->data.fields[field_index].hasbit;
+ uint32_t hasbit = l->hasbits[upb_fielddef_index(f)];
return DEREF(msg, hasbit / 8, char) | (1 << (hasbit % 8));
}
}
-upb_msgval upb_msg_get(const upb_msg *msg, int field_index,
+upb_msgval upb_msg_get(const upb_msg *msg, const upb_fielddef *f,
const upb_msglayout *l) {
- const upb_msglayout_fieldinit_v1 *field = upb_msg_checkfield(field_index, l);
- int size = upb_msg_fieldsize(field);
+ upb_msg_checkfield(l, f);
- if (upb_msg_inoneof(field)) {
- if (*upb_msg_oneofcase(msg, field_index, l) == field->number) {
- size_t ofs = l->data.oneofs[field->oneof_index].data_offset;
- return upb_msgval_read(msg, ofs, size);
+ if (upb_fielddef_isextension(f)) {
+ upb_inttable *ext_dict = upb_msg_trygetextdict(msg, l);
+ upb_value val;
+ if (upb_inttable_lookup32(ext_dict, upb_fielddef_number(f), &val)) {
+ return upb_msgval_fromval(val);
} else {
- /* Return default. */
- return upb_msgval_read(l->data.default_msg, field->offset, size);
+ return upb_msgval_fromdefault(f);
}
} else {
- return upb_msgval_read(msg, field->offset, size);
+ size_t ofs = l->field_offsets[upb_fielddef_index(f)];
+ const upb_oneofdef *o = upb_fielddef_containingoneof(f);
+ upb_msgval ret;
+
+ if (o && !upb_msg_oneofis(msg, l, o, f)) {
+ /* Oneof defaults can't come from the message because the memory is reused
+ * by all types in the oneof. */
+ return upb_msgval_fromdefault(f);
+ }
+
+ ret = upb_msgval_read(msg, ofs, upb_msg_fieldsize(f));
+ return ret;
}
}
-void upb_msg_set(upb_msg *msg, int field_index, upb_msgval val,
+bool upb_msg_set(upb_msg *msg,
+ const upb_fielddef *f,
+ upb_msgval val,
const upb_msglayout *l) {
- const upb_msglayout_fieldinit_v1 *field = upb_msg_checkfield(field_index, l);
- int size = upb_msg_fieldsize(field);
-
- if (upb_msg_inoneof(field)) {
- size_t ofs = l->data.oneofs[field->oneof_index].data_offset;
- *upb_msg_oneofcase(msg, field_index, l) = field->number;
- upb_msgval_write(msg, ofs, val, size);
+ upb_alloc *a = upb_msg_alloc(msg, l);
+ upb_msg_checkfield(l, f);
+
+ if (upb_fielddef_isextension(f)) {
+ /* TODO(haberman): introduce table API that can do this in one call. */
+ upb_inttable *ext = upb_msg_getextdict(msg, l, a);
+ upb_value val2 = upb_toval(val);
+ if (!upb_inttable_replace(ext, upb_fielddef_number(f), val2) &&
+ !upb_inttable_insert2(ext, upb_fielddef_number(f), val2, a)) {
+ return false;
+ }
} else {
- upb_msgval_write(msg, field->offset, val, size);
+ size_t ofs = l->field_offsets[upb_fielddef_index(f)];
+ const upb_oneofdef *o = upb_fielddef_containingoneof(f);
+
+ if (o) {
+ upb_msg_setoneofcase(msg, o, l, upb_fielddef_number(f));
+ }
+
+ upb_msgval_write(msg, ofs, val, upb_msg_fieldsize(f));
}
+ return true;
}
/** upb_array *****************************************************************/
+struct upb_array {
+ upb_fieldtype_t type;
+ uint8_t element_size;
+ void *data; /* Each element is element_size. */
+ size_t len; /* Measured in elements. */
+ size_t size; /* Measured in elements. */
+ upb_alloc *alloc;
+};
+
#define DEREF_ARR(arr, i, type) ((type*)arr->data)[i]
size_t upb_array_sizeof(upb_fieldtype_t type) {
@@ -6859,8 +3965,8 @@ static void upb_map_tokey(upb_fieldtype_t type, upb_msgval *key,
switch (type) {
case UPB_TYPE_STRING:
/* Point to string data of the input key. */
- *out_key = key->str.data;
- *out_len = key->str.size;
+ *out_key = key->str.ptr;
+ *out_len = key->str.len;
return;
case UPB_TYPE_BOOL:
case UPB_TYPE_INT32:
@@ -6885,7 +3991,7 @@ static upb_msgval upb_map_fromkey(upb_fieldtype_t type, const char *key,
size_t len) {
switch (type) {
case UPB_TYPE_STRING:
- return upb_msgval_makestr(key, len);
+ return upb_msgval_str(key, len);
case UPB_TYPE_BOOL:
case UPB_TYPE_INT32:
case UPB_TYPE_UINT32:
@@ -9345,138 +6451,138 @@ static upb_inttable reftables[268];
#endif
static const upb_msgdef msgs[22] = {
- UPB_MSGDEF_INIT("google.protobuf.DescriptorProto", 41, 8, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[0], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[0]), false, UPB_SYNTAX_PROTO2, &reftables[0], &reftables[1]),
- UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ExtensionRange", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[11], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[16]), false, UPB_SYNTAX_PROTO2, &reftables[2], &reftables[3]),
- UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ReservedRange", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[14], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[20]), false, UPB_SYNTAX_PROTO2, &reftables[4], &reftables[5]),
- UPB_MSGDEF_INIT("google.protobuf.EnumDescriptorProto", 12, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[17], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[24]), false, UPB_SYNTAX_PROTO2, &reftables[6], &reftables[7]),
- UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 9, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[0], &arrays[21], 4, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[28]), false, UPB_SYNTAX_PROTO2, &reftables[8], &reftables[9]),
- UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 9, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[25], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[32]), false, UPB_SYNTAX_PROTO2, &reftables[10], &reftables[11]),
- UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[2], &arrays[29], 2, 1), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[36]), false, UPB_SYNTAX_PROTO2, &reftables[12], &reftables[13]),
- UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 24, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[31], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[40]), false, UPB_SYNTAX_PROTO2, &reftables[14], &reftables[15]),
- UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 13, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[4], &arrays[42], 11, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[56]), false, UPB_SYNTAX_PROTO2, &reftables[16], &reftables[17]),
- UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 43, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[53], 13, 12), UPB_STRTABLE_INIT(12, 15, UPB_CTYPE_PTR, 4, &strentries[72]), false, UPB_SYNTAX_PROTO2, &reftables[18], &reftables[19]),
- UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 7, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[66], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[88]), false, UPB_SYNTAX_PROTO2, &reftables[20], &reftables[21]),
- UPB_MSGDEF_INIT("google.protobuf.FileOptions", 38, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 42, 17), UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]),
- UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 11, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[110], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]),
- UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 16, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[118], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]),
- UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 8, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[125], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]),
- UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[126], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]),
- UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 12, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[128], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]),
- UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 8, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[132], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]),
- UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 7, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[133], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]),
- UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 20, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[135], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]),
- UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 19, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[142], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]),
- UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 7, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[151], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]),
+ UPB_MSGDEF_INIT("google.protobuf.DescriptorProto", 40, 8, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[0], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[0]), false, UPB_SYNTAX_PROTO2, &reftables[0], &reftables[1]),
+ UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ExtensionRange", 4, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[11], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[16]), false, UPB_SYNTAX_PROTO2, &reftables[2], &reftables[3]),
+ UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ReservedRange", 4, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[14], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[20]), false, UPB_SYNTAX_PROTO2, &reftables[4], &reftables[5]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[17], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[24]), false, UPB_SYNTAX_PROTO2, &reftables[6], &reftables[7]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[0], &arrays[21], 4, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[28]), false, UPB_SYNTAX_PROTO2, &reftables[8], &reftables[9]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 8, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[25], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[32]), false, UPB_SYNTAX_PROTO2, &reftables[10], &reftables[11]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 7, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[2], &arrays[29], 2, 1), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[36]), false, UPB_SYNTAX_PROTO2, &reftables[12], &reftables[13]),
+ UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 23, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[31], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[40]), false, UPB_SYNTAX_PROTO2, &reftables[14], &reftables[15]),
+ UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 12, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[4], &arrays[42], 11, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[56]), false, UPB_SYNTAX_PROTO2, &reftables[16], &reftables[17]),
+ UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 42, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[53], 13, 12), UPB_STRTABLE_INIT(12, 15, UPB_CTYPE_PTR, 4, &strentries[72]), false, UPB_SYNTAX_PROTO2, &reftables[18], &reftables[19]),
+ UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[66], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[88]), false, UPB_SYNTAX_PROTO2, &reftables[20], &reftables[21]),
+ UPB_MSGDEF_INIT("google.protobuf.FileOptions", 37, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 42, 17), UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]),
+ UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 10, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[110], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]),
+ UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 15, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[118], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]),
+ UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[125], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]),
+ UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[126], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]),
+ UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[128], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]),
+ UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[132], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]),
+ UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[133], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]),
+ UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 19, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[135], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]),
+ UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[142], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]),
+ UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[151], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]),
};
static const upb_fielddef fields[107] = {
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "aggregate_value", 8, &msgs[20], NULL, 16, 6, {0},&reftables[44], &reftables[45]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "allow_alias", 2, &msgs[4], NULL, 7, 1, {0},&reftables[46], &reftables[47]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_enable_arenas", 31, &msgs[11], NULL, 24, 12, {0},&reftables[48], &reftables[49]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_generic_services", 16, &msgs[11], NULL, 18, 6, {0},&reftables[50], &reftables[51]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "client_streaming", 5, &msgs[13], NULL, 14, 4, {0},&reftables[52], &reftables[53]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "csharp_namespace", 37, &msgs[11], NULL, 28, 14, {0},&reftables[54], &reftables[55]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "ctype", 1, &msgs[8], (const upb_def*)(&enums[2]), 7, 1, {0},&reftables[56], &reftables[57]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "default_value", 7, &msgs[7], NULL, 17, 7, {0},&reftables[58], &reftables[59]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "dependency", 3, &msgs[9], NULL, 31, 8, {0},&reftables[60], &reftables[61]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 9, 3, {0},&reftables[62], &reftables[63]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 7, 1, {0},&reftables[64], &reftables[65]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 9, 3, {0},&reftables[66], &reftables[67]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 23, &msgs[11], NULL, 22, 10, {0},&reftables[68], &reftables[69]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 7, 1, {0},&reftables[70], &reftables[71]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 8, 2, {0},&reftables[72], &reftables[73]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 7, 1, {0},&reftables[74], &reftables[75]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, false, "double_value", 6, &msgs[20], NULL, 12, 4, {0},&reftables[76], &reftables[77]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[2], NULL, 4, 1, {0},&reftables[78], &reftables[79]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[1], NULL, 4, 1, {0},&reftables[80], &reftables[81]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 14, 1, {0},&reftables[82], &reftables[83]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 19, 2, {0},&reftables[84], &reftables[85]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "extendee", 2, &msgs[7], NULL, 8, 2, {0},&reftables[86], &reftables[87]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 6, &msgs[0], (const upb_def*)(&msgs[7]), 25, 4, {0},&reftables[88], &reftables[89]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 7, &msgs[9], (const upb_def*)(&msgs[7]), 20, 3, {0},&reftables[90], &reftables[91]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension_range", 5, &msgs[0], (const upb_def*)(&msgs[1]), 22, 3, {0},&reftables[92], &reftables[93]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "field", 2, &msgs[0], (const upb_def*)(&msgs[7]), 13, 0, {0},&reftables[94], &reftables[95]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "file", 1, &msgs[10], (const upb_def*)(&msgs[9]), 6, 0, {0},&reftables[96], &reftables[97]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "go_package", 11, &msgs[11], NULL, 15, 5, {0},&reftables[98], &reftables[99]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "identifier_value", 3, &msgs[20], NULL, 7, 1, {0},&reftables[100], &reftables[101]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "input_type", 2, &msgs[13], NULL, 8, 2, {0},&reftables[102], &reftables[103]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, false, false, "is_extension", 2, &msgs[21], NULL, 6, 1, {0},&reftables[104], &reftables[105]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generate_equals_and_hash", 20, &msgs[11], NULL, 21, 9, {0},&reftables[106], &reftables[107]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generic_services", 17, &msgs[11], NULL, 19, 7, {0},&reftables[108], &reftables[109]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_multiple_files", 10, &msgs[11], NULL, 14, 4, {0},&reftables[110], &reftables[111]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_outer_classname", 8, &msgs[11], NULL, 10, 2, {0},&reftables[112], &reftables[113]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_package", 1, &msgs[11], NULL, 7, 1, {0},&reftables[114], &reftables[115]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_string_check_utf8", 27, &msgs[11], NULL, 23, 11, {0},&reftables[116], &reftables[117]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "javanano_use_deprecated_package", 38, &msgs[11], NULL, 31, 15, {0},&reftables[118], &reftables[119]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "json_name", 10, &msgs[7], NULL, 21, 9, {0},&reftables[120], &reftables[121]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "jstype", 6, &msgs[8], (const upb_def*)(&enums[3]), 11, 5, {0},&reftables[122], &reftables[123]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "label", 4, &msgs[7], (const upb_def*)(&enums[0]), 12, 4, {0},&reftables[124], &reftables[125]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "lazy", 5, &msgs[8], NULL, 10, 4, {0},&reftables[126], &reftables[127]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "leading_comments", 3, &msgs[19], NULL, 9, 2, {0},&reftables[128], &reftables[129]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "leading_detached_comments", 6, &msgs[19], NULL, 17, 4, {0},&reftables[130], &reftables[131]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "location", 1, &msgs[18], (const upb_def*)(&msgs[19]), 6, 0, {0},&reftables[132], &reftables[133]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "map_entry", 7, &msgs[12], NULL, 10, 4, {0},&reftables[134], &reftables[135]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "message_set_wire_format", 1, &msgs[12], NULL, 7, 1, {0},&reftables[136], &reftables[137]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "message_type", 4, &msgs[9], (const upb_def*)(&msgs[0]), 11, 0, {0},&reftables[138], &reftables[139]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "method", 2, &msgs[16], (const upb_def*)(&msgs[13]), 7, 0, {0},&reftables[140], &reftables[141]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 6, 0, {0},&reftables[142], &reftables[143]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 5, 1, {0},&reftables[144], &reftables[145]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 23, 6, {0},&reftables[146], &reftables[147]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 9, 2, {0},&reftables[148], &reftables[149]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 9, 2, {0},&reftables[150], &reftables[151]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 3, 0, {0},&reftables[152], &reftables[153]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 5, 1, {0},&reftables[154], &reftables[155]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 5, 1, {0},&reftables[156], &reftables[157]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 33, 8, {0},&reftables[158], &reftables[159]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, false, "name_part", 1, &msgs[21], NULL, 3, 0, {0},&reftables[160], &reftables[161]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, false, "negative_int_value", 5, &msgs[20], NULL, 11, 3, {0},&reftables[162], &reftables[163]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "nested_type", 3, &msgs[0], (const upb_def*)(&msgs[0]), 16, 1, {0},&reftables[164], &reftables[165]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "no_standard_descriptor_accessor", 2, &msgs[12], NULL, 8, 2, {0},&reftables[166], &reftables[167]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 11, 3, {0},&reftables[168], &reftables[169]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 8, 2, {0},&reftables[170], &reftables[171]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "objc_class_prefix", 36, &msgs[11], NULL, 25, 13, {0},&reftables[172], &reftables[173]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "oneof_decl", 8, &msgs[0], (const upb_def*)(&msgs[15]), 29, 6, {0},&reftables[174], &reftables[175]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "oneof_index", 9, &msgs[7], NULL, 20, 8, {0},&reftables[176], &reftables[177]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "optimize_for", 9, &msgs[11], (const upb_def*)(&enums[4]), 13, 3, {0},&reftables[178], &reftables[179]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 26, 5, {0},&reftables[180], &reftables[181]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 21, 4, {0},&reftables[182], &reftables[183]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 4, 0, {0},&reftables[184], &reftables[185]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 4, 0, {0},&reftables[186], &reftables[187]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 8, 1, {0},&reftables[188], &reftables[189]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 8, 1, {0},&reftables[190], &reftables[191]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 4, 0, {0},&reftables[192], &reftables[193]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "output_type", 3, &msgs[13], NULL, 11, 3, {0},&reftables[194], &reftables[195]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "package", 2, &msgs[9], NULL, 26, 7, {0},&reftables[196], &reftables[197]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "packed", 2, &msgs[8], NULL, 8, 2, {0},&reftables[198], &reftables[199]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "path", 1, &msgs[19], NULL, 5, 0, {0},&reftables[200], &reftables[201]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_class_prefix", 40, &msgs[11], NULL, 32, 16, {0},&reftables[202], &reftables[203]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_namespace", 41, &msgs[11], NULL, 35, 17, {0},&reftables[204], &reftables[205]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 10, 2, {0},&reftables[206], &reftables[207]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 36, 9, {0},&reftables[208], &reftables[209]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 20, 8, {0},&reftables[210], &reftables[211]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 38, 9, {0},&reftables[212], &reftables[213]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 32, 7, {0},&reftables[214], &reftables[215]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 15, 5, {0},&reftables[216], &reftables[217]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 17, 2, {0},&reftables[218], &reftables[219]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 22, 5, {0},&reftables[220], &reftables[221]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 8, 1, {0},&reftables[222], &reftables[223]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 3, 0, {0},&reftables[224], &reftables[225]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 3, 0, {0},&reftables[226], &reftables[227]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 13, 5, {0},&reftables[228], &reftables[229]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 40, 11, {0},&reftables[230], &reftables[231]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 12, 3, {0},&reftables[232], &reftables[233]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 13, 5, {0},&reftables[234], &reftables[235]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 14, 6, {0},&reftables[236], &reftables[237]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[238], &reftables[239]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[240], &reftables[241]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[242], &reftables[243]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[244], &reftables[245]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[246], &reftables[247]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[248], &reftables[249]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[250], &reftables[251]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 7, 0, {0},&reftables[252], &reftables[253]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 12, 6, {0},&reftables[254], &reftables[255]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 39, 10, {0},&reftables[256], &reftables[257]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "aggregate_value", 8, &msgs[20], NULL, 15, 6, {0},&reftables[44], &reftables[45]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "allow_alias", 2, &msgs[4], NULL, 6, 1, {0},&reftables[46], &reftables[47]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_enable_arenas", 31, &msgs[11], NULL, 23, 12, {0},&reftables[48], &reftables[49]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_generic_services", 16, &msgs[11], NULL, 17, 6, {0},&reftables[50], &reftables[51]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "client_streaming", 5, &msgs[13], NULL, 13, 4, {0},&reftables[52], &reftables[53]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "csharp_namespace", 37, &msgs[11], NULL, 27, 14, {0},&reftables[54], &reftables[55]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "ctype", 1, &msgs[8], (const upb_def*)(&enums[2]), 6, 1, {0},&reftables[56], &reftables[57]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "default_value", 7, &msgs[7], NULL, 16, 7, {0},&reftables[58], &reftables[59]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "dependency", 3, &msgs[9], NULL, 30, 8, {0},&reftables[60], &reftables[61]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 8, 3, {0},&reftables[62], &reftables[63]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 6, 1, {0},&reftables[64], &reftables[65]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 8, 3, {0},&reftables[66], &reftables[67]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 23, &msgs[11], NULL, 21, 10, {0},&reftables[68], &reftables[69]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 6, 1, {0},&reftables[70], &reftables[71]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 7, 2, {0},&reftables[72], &reftables[73]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 6, 1, {0},&reftables[74], &reftables[75]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, false, "double_value", 6, &msgs[20], NULL, 11, 4, {0},&reftables[76], &reftables[77]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[2], NULL, 3, 1, {0},&reftables[78], &reftables[79]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[1], NULL, 3, 1, {0},&reftables[80], &reftables[81]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 13, 1, {0},&reftables[82], &reftables[83]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 18, 2, {0},&reftables[84], &reftables[85]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "extendee", 2, &msgs[7], NULL, 7, 2, {0},&reftables[86], &reftables[87]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 6, &msgs[0], (const upb_def*)(&msgs[7]), 24, 4, {0},&reftables[88], &reftables[89]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 7, &msgs[9], (const upb_def*)(&msgs[7]), 19, 3, {0},&reftables[90], &reftables[91]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension_range", 5, &msgs[0], (const upb_def*)(&msgs[1]), 21, 3, {0},&reftables[92], &reftables[93]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "field", 2, &msgs[0], (const upb_def*)(&msgs[7]), 12, 0, {0},&reftables[94], &reftables[95]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "file", 1, &msgs[10], (const upb_def*)(&msgs[9]), 5, 0, {0},&reftables[96], &reftables[97]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "go_package", 11, &msgs[11], NULL, 14, 5, {0},&reftables[98], &reftables[99]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "identifier_value", 3, &msgs[20], NULL, 6, 1, {0},&reftables[100], &reftables[101]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "input_type", 2, &msgs[13], NULL, 7, 2, {0},&reftables[102], &reftables[103]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, false, false, "is_extension", 2, &msgs[21], NULL, 5, 1, {0},&reftables[104], &reftables[105]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generate_equals_and_hash", 20, &msgs[11], NULL, 20, 9, {0},&reftables[106], &reftables[107]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generic_services", 17, &msgs[11], NULL, 18, 7, {0},&reftables[108], &reftables[109]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_multiple_files", 10, &msgs[11], NULL, 13, 4, {0},&reftables[110], &reftables[111]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_outer_classname", 8, &msgs[11], NULL, 9, 2, {0},&reftables[112], &reftables[113]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_package", 1, &msgs[11], NULL, 6, 1, {0},&reftables[114], &reftables[115]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_string_check_utf8", 27, &msgs[11], NULL, 22, 11, {0},&reftables[116], &reftables[117]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "javanano_use_deprecated_package", 38, &msgs[11], NULL, 30, 15, {0},&reftables[118], &reftables[119]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "json_name", 10, &msgs[7], NULL, 20, 9, {0},&reftables[120], &reftables[121]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "jstype", 6, &msgs[8], (const upb_def*)(&enums[3]), 10, 5, {0},&reftables[122], &reftables[123]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "label", 4, &msgs[7], (const upb_def*)(&enums[0]), 11, 4, {0},&reftables[124], &reftables[125]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "lazy", 5, &msgs[8], NULL, 9, 4, {0},&reftables[126], &reftables[127]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "leading_comments", 3, &msgs[19], NULL, 8, 2, {0},&reftables[128], &reftables[129]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "leading_detached_comments", 6, &msgs[19], NULL, 16, 4, {0},&reftables[130], &reftables[131]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "location", 1, &msgs[18], (const upb_def*)(&msgs[19]), 5, 0, {0},&reftables[132], &reftables[133]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "map_entry", 7, &msgs[12], NULL, 9, 4, {0},&reftables[134], &reftables[135]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "message_set_wire_format", 1, &msgs[12], NULL, 6, 1, {0},&reftables[136], &reftables[137]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "message_type", 4, &msgs[9], (const upb_def*)(&msgs[0]), 10, 0, {0},&reftables[138], &reftables[139]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "method", 2, &msgs[16], (const upb_def*)(&msgs[13]), 6, 0, {0},&reftables[140], &reftables[141]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 5, 0, {0},&reftables[142], &reftables[143]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 4, 1, {0},&reftables[144], &reftables[145]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 22, 6, {0},&reftables[146], &reftables[147]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 8, 2, {0},&reftables[148], &reftables[149]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 8, 2, {0},&reftables[150], &reftables[151]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 2, 0, {0},&reftables[152], &reftables[153]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 4, 1, {0},&reftables[154], &reftables[155]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 4, 1, {0},&reftables[156], &reftables[157]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 32, 8, {0},&reftables[158], &reftables[159]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, false, "name_part", 1, &msgs[21], NULL, 2, 0, {0},&reftables[160], &reftables[161]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, false, "negative_int_value", 5, &msgs[20], NULL, 10, 3, {0},&reftables[162], &reftables[163]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "nested_type", 3, &msgs[0], (const upb_def*)(&msgs[0]), 15, 1, {0},&reftables[164], &reftables[165]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "no_standard_descriptor_accessor", 2, &msgs[12], NULL, 7, 2, {0},&reftables[166], &reftables[167]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 10, 3, {0},&reftables[168], &reftables[169]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 7, 2, {0},&reftables[170], &reftables[171]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "objc_class_prefix", 36, &msgs[11], NULL, 24, 13, {0},&reftables[172], &reftables[173]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "oneof_decl", 8, &msgs[0], (const upb_def*)(&msgs[15]), 28, 6, {0},&reftables[174], &reftables[175]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "oneof_index", 9, &msgs[7], NULL, 19, 8, {0},&reftables[176], &reftables[177]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "optimize_for", 9, &msgs[11], (const upb_def*)(&enums[4]), 12, 3, {0},&reftables[178], &reftables[179]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 25, 5, {0},&reftables[180], &reftables[181]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 20, 4, {0},&reftables[182], &reftables[183]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 3, 0, {0},&reftables[184], &reftables[185]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 3, 0, {0},&reftables[186], &reftables[187]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 7, 1, {0},&reftables[188], &reftables[189]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 7, 1, {0},&reftables[190], &reftables[191]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 3, 0, {0},&reftables[192], &reftables[193]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "output_type", 3, &msgs[13], NULL, 10, 3, {0},&reftables[194], &reftables[195]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "package", 2, &msgs[9], NULL, 25, 7, {0},&reftables[196], &reftables[197]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "packed", 2, &msgs[8], NULL, 7, 2, {0},&reftables[198], &reftables[199]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "path", 1, &msgs[19], NULL, 4, 0, {0},&reftables[200], &reftables[201]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_class_prefix", 40, &msgs[11], NULL, 31, 16, {0},&reftables[202], &reftables[203]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_namespace", 41, &msgs[11], NULL, 34, 17, {0},&reftables[204], &reftables[205]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 9, 2, {0},&reftables[206], &reftables[207]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 35, 9, {0},&reftables[208], &reftables[209]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 19, 8, {0},&reftables[210], &reftables[211]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 37, 9, {0},&reftables[212], &reftables[213]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 31, 7, {0},&reftables[214], &reftables[215]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 14, 5, {0},&reftables[216], &reftables[217]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 16, 2, {0},&reftables[218], &reftables[219]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 21, 5, {0},&reftables[220], &reftables[221]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 7, 1, {0},&reftables[222], &reftables[223]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 2, 0, {0},&reftables[224], &reftables[225]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 2, 0, {0},&reftables[226], &reftables[227]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 12, 5, {0},&reftables[228], &reftables[229]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 39, 11, {0},&reftables[230], &reftables[231]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 11, 3, {0},&reftables[232], &reftables[233]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 12, 5, {0},&reftables[234], &reftables[235]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 13, 6, {0},&reftables[236], &reftables[237]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[238], &reftables[239]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[240], &reftables[241]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[242], &reftables[243]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[244], &reftables[245]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[246], &reftables[247]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[248], &reftables[249]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[250], &reftables[251]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 6, 0, {0},&reftables[252], &reftables[253]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 11, 6, {0},&reftables[254], &reftables[255]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 38, 10, {0},&reftables[256], &reftables[257]),
};
static const upb_enumdef enums[5] = {
@@ -10295,7 +7401,6 @@ typedef struct {
struct upb_descreader {
upb_sink sink;
upb_inttable files;
- upb_strtable files_by_name;
upb_filedef *file; /* The last file in files. */
upb_descreader_frame stack[UPB_MAX_MESSAGE_NESTING];
int stack_len;
@@ -10462,7 +7567,6 @@ static size_t file_onname(void *closure, const void *hd, const char *buf,
UPB_UNUSED(handle);
name = upb_gstrndup(buf, n);
- upb_strtable_insert(&r->files_by_name, name, upb_value_ptr(r->file));
/* XXX: see comment at the top of the file. */
ok = upb_filedef_setname(r->file, name, NULL);
upb_gfree(name);
@@ -10576,18 +7680,6 @@ static void *file_startext(void *closure, const void *hd) {
return r;
}
-static size_t file_ondep(void *closure, const void *hd, const char *buf,
- size_t n, const upb_bufhandle *handle) {
- upb_descreader *r = closure;
- upb_value val;
- if (upb_strtable_lookup2(&r->files_by_name, buf, n, &val)) {
- upb_filedef_adddep(r->file, upb_value_getptr(val));
- }
- UPB_UNUSED(hd);
- UPB_UNUSED(handle);
- return n;
-}
-
/** Handlers for google.protobuf.EnumValueDescriptorProto. *********************/
static bool enumval_startmsg(void *closure, const void *hd) {
@@ -11032,8 +8124,6 @@ static void reghandlers(const void *closure, upb_handlers *h) {
&file_startenum, NULL);
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, extension),
&file_startext, NULL);
- upb_handlers_setstring(h, F(FileDescriptorProto, dependency),
- &file_ondep, NULL);
} else if (upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)) {
upb_handlers_setstartmsg(h, &enumval_startmsg, NULL);
upb_handlers_setendmsg(h, &enumval_endmsg, NULL);
@@ -11093,7 +8183,6 @@ void descreader_cleanup(void *_r) {
upb_gfree(r->name);
upb_inttable_uninit(&r->files);
- upb_strtable_uninit(&r->files_by_name);
upb_inttable_uninit(&r->oneofs);
upb_gfree(r->default_string);
while (r->stack_len > 0) {
@@ -11112,7 +8201,6 @@ upb_descreader *upb_descreader_create(upb_env *e, const upb_handlers *h) {
}
upb_inttable_init(&r->files, UPB_CTYPE_PTR);
- upb_strtable_init(&r->files_by_name, UPB_CTYPE_PTR);
upb_inttable_init(&r->oneofs, UPB_CTYPE_PTR);
upb_sink_reset(upb_descreader_input(r), h, r);
r->stack_len = 0;
@@ -11412,7 +8500,7 @@ static void put32(compiler *c, uint32_t v) {
*c->pc++ = v;
}
-static void putop(compiler *c, int op, ...) {
+static void putop(compiler *c, opcode op, ...) {
va_list ap;
va_start(ap, op);
@@ -12695,6 +9783,7 @@ have_tag:
return upb_pbdecoder_suspend(d);
}
+ /* TODO: deliver to unknown field callback. */
switch (wire_type) {
case UPB_WIRE_TYPE_32BIT:
CHECK_RETURN(skip(d, 4));
@@ -12732,8 +9821,6 @@ have_tag:
}
if (d->top->groupnum >= 0) {
- /* TODO: More code needed for handling unknown groups. */
- upb_sink_putunknown(&d->top->sink, d->checkpoint, d->ptr - d->checkpoint);
return DECODE_OK;
}
@@ -13589,12 +10676,6 @@ static void *encode_startdelimfield(void *c, const void *hd) {
return ok ? c : UPB_BREAK;
}
-static bool encode_unknown(void *c, const void *hd, const char *buf,
- size_t len) {
- UPB_UNUSED(hd);
- return encode_bytes(c, buf, len) && commit(c);
-}
-
static bool encode_enddelimfield(void *c, const void *hd) {
UPB_UNUSED(hd);
return end_delim(c);
@@ -13657,7 +10738,6 @@ static void newhandlers_callback(const void *closure, upb_handlers *h) {
upb_handlers_setstartmsg(h, startmsg, NULL);
upb_handlers_setendmsg(h, endmsg, NULL);
- upb_handlers_setunknown(h, encode_unknown, NULL);
m = upb_handlers_msgdef(h);
for(upb_msg_field_begin(&i, m);
@@ -14270,9 +11350,8 @@ done:
** - handling of keys/escape-sequences/etc that span input buffers.
*/
+#include <assert.h>
#include <errno.h>
-#include <float.h>
-#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -14857,160 +11936,103 @@ static void start_number(upb_json_parser *p, const char *ptr) {
capture_begin(p, ptr);
}
-static bool parse_number(upb_json_parser *p, bool is_quoted);
+static bool parse_number(upb_json_parser *p);
static bool end_number(upb_json_parser *p, const char *ptr) {
if (!capture_end(p, ptr)) {
return false;
}
- return parse_number(p, false);
+ return parse_number(p);
}
-/* |buf| is NULL-terminated. |buf| itself will never include quotes;
- * |is_quoted| tells us whether this text originally appeared inside quotes. */
-static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
- bool is_quoted) {
- size_t len = strlen(buf);
- const char *bufend = buf + len;
+static bool parse_number(upb_json_parser *p) {
+ size_t len;
+ const char *buf;
+ const char *myend;
char *end;
- upb_fieldtype_t type = upb_fielddef_type(p->top->f);
- double val;
- double dummy;
- double inf = 1.0 / 0.0; /* C89 does not have an INFINITY macro. */
-
- errno = 0;
- if (len == 0 || buf[0] == ' ') {
+ /* strtol() and friends unfortunately do not support specifying the length of
+ * the input string, so we need to force a copy into a NULL-terminated buffer. */
+ if (!multipart_text(p, "\0", 1, false)) {
return false;
}
- /* For integer types, first try parsing with integer-specific routines.
- * If these succeed, they will be more accurate for int64/uint64 than
- * strtod().
- */
- switch (type) {
+ buf = accumulate_getptr(p, &len);
+ myend = buf + len - 1; /* One for NULL. */
+
+ /* XXX: We are using strtol to parse integers, but this is wrong as even
+ * integers can be represented as 1e6 (for example), which strtol can't
+ * handle correctly.
+ *
+ * XXX: Also, we can't handle large integers properly because strto[u]ll
+ * isn't in C89.
+ *
+ * XXX: Also, we don't properly check floats for overflow, since strtof
+ * isn't in C89. */
+ switch (upb_fielddef_type(p->top->f)) {
case UPB_TYPE_ENUM:
case UPB_TYPE_INT32: {
- long val = strtol(buf, &end, 0);
- if (errno == ERANGE || end != bufend) {
- break;
- } else if (val > INT32_MAX || val < INT32_MIN) {
- return false;
- } else {
+ long val = strtol(p->accumulated, &end, 0);
+ if (val > INT32_MAX || val < INT32_MIN || errno == ERANGE || end != myend)
+ goto err;
+ else
upb_sink_putint32(&p->top->sink, parser_getsel(p), val);
- return true;
- }
- }
- case UPB_TYPE_UINT32: {
- unsigned long val = strtoul(buf, &end, 0);
- if (end != bufend) {
- break;
- } else if (val > UINT32_MAX || errno == ERANGE) {
- return false;
- } else {
- upb_sink_putuint32(&p->top->sink, parser_getsel(p), val);
- return true;
- }
+ break;
}
- /* XXX: We can't handle [u]int64 properly on 32-bit machines because
- * strto[u]ll isn't in C89. */
case UPB_TYPE_INT64: {
- long val = strtol(buf, &end, 0);
- if (errno == ERANGE || end != bufend) {
- break;
- } else {
+ long long val = strtol(p->accumulated, &end, 0);
+ if (val > INT64_MAX || val < INT64_MIN || errno == ERANGE || end != myend)
+ goto err;
+ else
upb_sink_putint64(&p->top->sink, parser_getsel(p), val);
- return true;
- }
+ break;
}
- case UPB_TYPE_UINT64: {
+ case UPB_TYPE_UINT32: {
unsigned long val = strtoul(p->accumulated, &end, 0);
- if (end != bufend) {
- break;
- } else if (errno == ERANGE) {
- return false;
- } else {
- upb_sink_putuint64(&p->top->sink, parser_getsel(p), val);
- return true;
- }
+ if (val > UINT32_MAX || errno == ERANGE || end != myend)
+ goto err;
+ else
+ upb_sink_putuint32(&p->top->sink, parser_getsel(p), val);
+ break;
}
- default:
+ case UPB_TYPE_UINT64: {
+ unsigned long long val = strtoul(p->accumulated, &end, 0);
+ if (val > UINT64_MAX || errno == ERANGE || end != myend)
+ goto err;
+ else
+ upb_sink_putuint64(&p->top->sink, parser_getsel(p), val);
break;
- }
-
- if (type != UPB_TYPE_DOUBLE && type != UPB_TYPE_FLOAT && is_quoted) {
- /* Quoted numbers for integer types are not allowed to be in double form. */
- return false;
- }
-
- if (len == strlen("Infinity") && strcmp(buf, "Infinity") == 0) {
- /* C89 does not have an INFINITY macro. */
- val = inf;
- } else if (len == strlen("-Infinity") && strcmp(buf, "-Infinity") == 0) {
- val = -inf;
- } else {
- val = strtod(buf, &end);
- if (errno == ERANGE || end != bufend) {
- return false;
}
- }
-
- switch (type) {
-#define CASE(capitaltype, smalltype, ctype, min, max) \
- case UPB_TYPE_ ## capitaltype: { \
- if (modf(val, &dummy) != 0 || val > max || val < min) { \
- return false; \
- } else { \
- upb_sink_put ## smalltype(&p->top->sink, parser_getsel(p), \
- (ctype)val); \
- return true; \
- } \
- break; \
+ case UPB_TYPE_DOUBLE: {
+ double val = strtod(p->accumulated, &end);
+ if (errno == ERANGE || end != myend)
+ goto err;
+ else
+ upb_sink_putdouble(&p->top->sink, parser_getsel(p), val);
+ break;
}
- case UPB_TYPE_ENUM:
- CASE(INT32, int32, int32_t, INT32_MIN, INT32_MAX);
- CASE(INT64, int64, int64_t, INT64_MIN, INT64_MAX);
- CASE(UINT32, uint32, uint32_t, 0, UINT32_MAX);
- CASE(UINT64, uint64, uint64_t, 0, UINT64_MAX);
-#undef CASE
-
- case UPB_TYPE_DOUBLE:
- upb_sink_putdouble(&p->top->sink, parser_getsel(p), val);
- return true;
- case UPB_TYPE_FLOAT:
- if ((val > FLT_MAX || val < -FLT_MAX) && val != inf && val != -inf) {
- return false;
- } else {
+ case UPB_TYPE_FLOAT: {
+ float val = strtod(p->accumulated, &end);
+ if (errno == ERANGE || end != myend)
+ goto err;
+ else
upb_sink_putfloat(&p->top->sink, parser_getsel(p), val);
- return true;
- }
+ break;
+ }
default:
- return false;
+ UPB_ASSERT(false);
}
-}
-static bool parse_number(upb_json_parser *p, bool is_quoted) {
- size_t len;
- const char *buf;
-
- /* strtol() and friends unfortunately do not support specifying the length of
- * the input string, so we need to force a copy into a NULL-terminated buffer. */
- if (!multipart_text(p, "\0", 1, false)) {
- return false;
- }
+ multipart_end(p);
- buf = accumulate_getptr(p, &len);
+ return true;
- if (parse_number_from_buffer(p, buf, is_quoted)) {
- multipart_end(p);
- return true;
- } else {
- upb_status_seterrf(&p->status, "error parsing number: %s", buf);
- upb_env_reporterror(p->env, &p->status);
- multipart_end(p);
- return false;
- }
+err:
+ upb_status_seterrf(&p->status, "error parsing number: %s", buf);
+ upb_env_reporterror(p->env, &p->status);
+ multipart_end(p);
+ return false;
}
static bool parser_putbool(upb_json_parser *p, bool val) {
@@ -15063,16 +12085,17 @@ static bool start_stringval(upb_json_parser *p) {
multipart_startaccum(p);
return true;
}
- } else if (upb_fielddef_type(p->top->f) != UPB_TYPE_BOOL &&
- upb_fielddef_type(p->top->f) != UPB_TYPE_MESSAGE) {
- /* No need to push a frame -- numeric values in quotes remain in the
- * current parser frame. These values must accmulate so we can convert
- * them all at once at the end. */
+ } else if (upb_fielddef_type(p->top->f) == UPB_TYPE_ENUM) {
+ /* No need to push a frame -- symbolic enum names in quotes remain in the
+ * current parser frame.
+ *
+ * Enum string values must accumulate so we can look up the value in a table
+ * once it is complete. */
multipart_startaccum(p);
return true;
} else {
upb_status_seterrf(&p->status,
- "String specified for bool or submessage field: %s",
+ "String specified for non-string/non-enum field: %s",
upb_fielddef_name(p->top->f));
upb_env_reporterror(p->env, &p->status);
return false;
@@ -15119,15 +12142,6 @@ static bool end_stringval(upb_json_parser *p) {
break;
}
- case UPB_TYPE_INT32:
- case UPB_TYPE_INT64:
- case UPB_TYPE_UINT32:
- case UPB_TYPE_UINT64:
- case UPB_TYPE_DOUBLE:
- case UPB_TYPE_FLOAT:
- ok = parse_number(p, true);
- break;
-
default:
UPB_ASSERT(false);
upb_status_seterrmsg(&p->status, "Internal error in JSON decoder");
@@ -15171,7 +12185,7 @@ static bool parse_mapentry_key(upb_json_parser *p) {
case UPB_TYPE_UINT32:
case UPB_TYPE_UINT64:
/* Invoke end_number. The accum buffer has the number's text already. */
- if (!parse_number(p, true)) {
+ if (!parse_number(p)) {
return false;
}
break;
@@ -15462,11 +12476,11 @@ static void end_object(upb_json_parser *p) {
* final state once, when the closing '"' is seen. */
-#line 1310 "upb/json/parser.rl"
+#line 1244 "upb/json/parser.rl"
-#line 1222 "upb/json/parser.c"
+#line 1156 "upb/json/parser.c"
static const char _json_actions[] = {
0, 1, 0, 1, 2, 1, 3, 1,
5, 1, 6, 1, 7, 1, 8, 1,
@@ -15615,7 +12629,7 @@ static const int json_en_value_machine = 27;
static const int json_en_main = 1;
-#line 1313 "upb/json/parser.rl"
+#line 1247 "upb/json/parser.rl"
size_t parse(void *closure, const void *hd, const char *buf, size_t size,
const upb_bufhandle *handle) {
@@ -15637,7 +12651,7 @@ size_t parse(void *closure, const void *hd, const char *buf, size_t size,
capture_resume(parser, buf);
-#line 1393 "upb/json/parser.c"
+#line 1327 "upb/json/parser.c"
{
int _klen;
unsigned int _trans;
@@ -15712,118 +12726,118 @@ _match:
switch ( *_acts++ )
{
case 0:
-#line 1225 "upb/json/parser.rl"
+#line 1159 "upb/json/parser.rl"
{ p--; {cs = stack[--top]; goto _again;} }
break;
case 1:
-#line 1226 "upb/json/parser.rl"
+#line 1160 "upb/json/parser.rl"
{ p--; {stack[top++] = cs; cs = 10; goto _again;} }
break;
case 2:
-#line 1230 "upb/json/parser.rl"
+#line 1164 "upb/json/parser.rl"
{ start_text(parser, p); }
break;
case 3:
-#line 1231 "upb/json/parser.rl"
+#line 1165 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_text(parser, p)); }
break;
case 4:
-#line 1237 "upb/json/parser.rl"
+#line 1171 "upb/json/parser.rl"
{ start_hex(parser); }
break;
case 5:
-#line 1238 "upb/json/parser.rl"
+#line 1172 "upb/json/parser.rl"
{ hexdigit(parser, p); }
break;
case 6:
-#line 1239 "upb/json/parser.rl"
+#line 1173 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_hex(parser)); }
break;
case 7:
-#line 1245 "upb/json/parser.rl"
+#line 1179 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(escape(parser, p)); }
break;
case 8:
-#line 1251 "upb/json/parser.rl"
+#line 1185 "upb/json/parser.rl"
{ p--; {cs = stack[--top]; goto _again;} }
break;
case 9:
-#line 1254 "upb/json/parser.rl"
+#line 1188 "upb/json/parser.rl"
{ {stack[top++] = cs; cs = 19; goto _again;} }
break;
case 10:
-#line 1256 "upb/json/parser.rl"
+#line 1190 "upb/json/parser.rl"
{ p--; {stack[top++] = cs; cs = 27; goto _again;} }
break;
case 11:
-#line 1261 "upb/json/parser.rl"
+#line 1195 "upb/json/parser.rl"
{ start_member(parser); }
break;
case 12:
-#line 1262 "upb/json/parser.rl"
+#line 1196 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_membername(parser)); }
break;
case 13:
-#line 1265 "upb/json/parser.rl"
+#line 1199 "upb/json/parser.rl"
{ end_member(parser); }
break;
case 14:
-#line 1271 "upb/json/parser.rl"
+#line 1205 "upb/json/parser.rl"
{ start_object(parser); }
break;
case 15:
-#line 1274 "upb/json/parser.rl"
+#line 1208 "upb/json/parser.rl"
{ end_object(parser); }
break;
case 16:
-#line 1280 "upb/json/parser.rl"
+#line 1214 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(start_array(parser)); }
break;
case 17:
-#line 1284 "upb/json/parser.rl"
+#line 1218 "upb/json/parser.rl"
{ end_array(parser); }
break;
case 18:
-#line 1289 "upb/json/parser.rl"
+#line 1223 "upb/json/parser.rl"
{ start_number(parser, p); }
break;
case 19:
-#line 1290 "upb/json/parser.rl"
+#line 1224 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_number(parser, p)); }
break;
case 20:
-#line 1292 "upb/json/parser.rl"
+#line 1226 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(start_stringval(parser)); }
break;
case 21:
-#line 1293 "upb/json/parser.rl"
+#line 1227 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_stringval(parser)); }
break;
case 22:
-#line 1295 "upb/json/parser.rl"
+#line 1229 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(parser_putbool(parser, true)); }
break;
case 23:
-#line 1297 "upb/json/parser.rl"
+#line 1231 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(parser_putbool(parser, false)); }
break;
case 24:
-#line 1299 "upb/json/parser.rl"
+#line 1233 "upb/json/parser.rl"
{ /* null value */ }
break;
case 25:
-#line 1301 "upb/json/parser.rl"
+#line 1235 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(start_subobject(parser)); }
break;
case 26:
-#line 1302 "upb/json/parser.rl"
+#line 1236 "upb/json/parser.rl"
{ end_subobject(parser); }
break;
case 27:
-#line 1307 "upb/json/parser.rl"
+#line 1241 "upb/json/parser.rl"
{ p--; {cs = stack[--top]; goto _again;} }
break;
-#line 1579 "upb/json/parser.c"
+#line 1513 "upb/json/parser.c"
}
}
@@ -15836,7 +12850,7 @@ _again:
_out: {}
}
-#line 1334 "upb/json/parser.rl"
+#line 1268 "upb/json/parser.rl"
if (p != pe) {
upb_status_seterrf(&parser->status, "Parse error at '%.*s'\n", pe - p, p);
@@ -15877,13 +12891,13 @@ static void json_parser_reset(upb_json_parser *p) {
/* Emit Ragel initialization of the parser. */
-#line 1633 "upb/json/parser.c"
+#line 1567 "upb/json/parser.c"
{
cs = json_start;
top = 0;
}
-#line 1374 "upb/json/parser.rl"
+#line 1308 "upb/json/parser.rl"
p->current_state = cs;
p->parser_top = top;
accumulate_clear(p);
@@ -16180,23 +13194,10 @@ static void putstring(upb_json_printer *p, const char *buf, unsigned int len) {
* Right now we use %.8g and %.17g for float/double, respectively, to match
* proto2::util::JsonFormat's defaults. May want to change this later. */
-const char neginf[] = "\"-Infinity\"";
-const char inf[] = "\"Infinity\"";
-
static size_t fmt_double(double val, char* buf, size_t length) {
- if (val == (1.0 / 0.0)) {
- CHKLENGTH(length >= strlen(inf));
- strcpy(buf, inf);
- return strlen(inf);
- } else if (val == (-1.0 / 0.0)) {
- CHKLENGTH(length >= strlen(neginf));
- strcpy(buf, neginf);
- return strlen(neginf);
- } else {
- size_t n = _upb_snprintf(buf, length, "%.17g", val);
- CHKLENGTH(n > 0 && n < length);
- return n;
- }
+ size_t n = _upb_snprintf(buf, length, "%.17g", val);
+ CHKLENGTH(n > 0 && n < length);
+ return n;
}
static size_t fmt_float(float val, char* buf, size_t length) {
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/upb.h b/third_party/protobuf/3.4.0/php/ext/google/protobuf/upb.h
index f441c89c83..4b51275dbb 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/upb.h
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/upb.h
@@ -1,5 +1,76 @@
// Amalgamated source file
/*
+** Defs are upb's internal representation of the constructs that can appear
+** in a .proto file:
+**
+** - upb::MessageDef (upb_msgdef): describes a "message" construct.
+** - upb::FieldDef (upb_fielddef): describes a message field.
+** - upb::FileDef (upb_filedef): describes a .proto file and its defs.
+** - upb::EnumDef (upb_enumdef): describes an enum.
+** - upb::OneofDef (upb_oneofdef): describes a oneof.
+** - upb::Def (upb_def): base class of all the others.
+**
+** TODO: definitions of services.
+**
+** Like upb_refcounted objects, defs are mutable only until frozen, and are
+** only thread-safe once frozen.
+**
+** This is a mixed C/C++ interface that offers a full API to both languages.
+** See the top-level README for more information.
+*/
+
+#ifndef UPB_DEF_H_
+#define UPB_DEF_H_
+
+/*
+** upb::RefCounted (upb_refcounted)
+**
+** A refcounting scheme that supports circular refs. It accomplishes this by
+** partitioning the set of objects into groups such that no cycle spans groups;
+** we can then reference-count the group as a whole and ignore refs within the
+** group. When objects are mutable, these groups are computed very
+** conservatively; we group any objects that have ever had a link between them.
+** When objects are frozen, we compute strongly-connected components which
+** allows us to be precise and only group objects that are actually cyclic.
+**
+** This is a mixed C/C++ interface that offers a full API to both languages.
+** See the top-level README for more information.
+*/
+
+#ifndef UPB_REFCOUNTED_H_
+#define UPB_REFCOUNTED_H_
+
+/*
+** upb_table
+**
+** This header is INTERNAL-ONLY! Its interfaces are not public or stable!
+** This file defines very fast int->upb_value (inttable) and string->upb_value
+** (strtable) hash tables.
+**
+** The table uses chained scatter with Brent's variation (inspired by the Lua
+** implementation of hash tables). The hash function for strings is Austin
+** Appleby's "MurmurHash."
+**
+** The inttable uses uintptr_t as its key, which guarantees it can be used to
+** store pointers or integers of at least 32 bits (upb isn't really useful on
+** systems where sizeof(void*) < 4).
+**
+** The table must be homogenous (all values of the same type). In debug
+** mode, we check this on insert and lookup.
+*/
+
+#ifndef UPB_TABLE_H_
+#define UPB_TABLE_H_
+
+// php.h intentionally defined NDEBUG. We have to define this macro in order to
+// be used together with php.h
+#ifndef NDEBUG
+#define NDEBUG
+#endif
+
+#include <stdint.h>
+#include <string.h>
+/*
** This file contains shared definitions that are widely used across upb.
**
** This is a mixed C/C++ interface that offers a full API to both languages.
@@ -35,9 +106,6 @@ template <int N> class InlinedEnvironment;
#define UPB_INLINE static
#endif
-/* Hints to the compiler about likely/unlikely branches. */
-#define UPB_LIKELY(x) __builtin_expect((x),1)
-
/* Define UPB_BIG_ENDIAN manually if you're on big endian and your compiler
* doesn't provide these preprocessor symbols. */
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
@@ -299,16 +367,6 @@ class PointerBase2 : public PointerBase<T, Base> {
#endif
-/* A list of types as they are encoded on-the-wire. */
-typedef enum {
- UPB_WIRE_TYPE_VARINT = 0,
- UPB_WIRE_TYPE_64BIT = 1,
- UPB_WIRE_TYPE_DELIMITED = 2,
- UPB_WIRE_TYPE_START_GROUP = 3,
- UPB_WIRE_TYPE_END_GROUP = 4,
- UPB_WIRE_TYPE_32BIT = 5
-} upb_wiretype_t;
-
/* upb::ErrorSpace ************************************************************/
@@ -637,7 +695,7 @@ void upb_env_uninit(upb_env *e);
void upb_env_initonly(upb_env *e);
-UPB_INLINE upb_arena *upb_env_arena(upb_env *e) { return (upb_arena*)e; }
+upb_arena *upb_env_arena(upb_env *e);
bool upb_env_ok(const upb_env *e);
void upb_env_seterrorfunc(upb_env *e, upb_error_func *func, void *ud);
@@ -737,106 +795,6 @@ template <int N> class upb::InlinedEnvironment : public upb::Environment {
#endif /* UPB_H_ */
-/*
-** upb_decode: parsing into a upb_msg using a upb_msglayout.
-*/
-
-#ifndef UPB_DECODE_H_
-#define UPB_DECODE_H_
-
-/*
-** upb::Message is a representation for protobuf messages.
-**
-** However it differs from other common representations like
-** google::protobuf::Message in one key way: it does not prescribe any
-** ownership between messages and submessages, and it relies on the
-** client to delete each message/submessage/array/map at the appropriate
-** time.
-**
-** A client can access a upb::Message without knowing anything about
-** ownership semantics, but to create or mutate a message a user needs
-** to implement the memory management themselves.
-**
-** Currently all messages, arrays, and maps store a upb_alloc* internally.
-** Mutating operations use this when they require dynamically-allocated
-** memory. We could potentially eliminate this size overhead later by
-** letting the user flip a bit on the factory that prevents this from
-** being stored. The user would then need to use separate functions where
-** the upb_alloc* is passed explicitly. However for handlers to populate
-** such structures, they would need a place to store this upb_alloc* during
-** parsing; upb_handlers don't currently have a good way to accommodate this.
-**
-** TODO: UTF-8 checking?
-**/
-
-#ifndef UPB_MSG_H_
-#define UPB_MSG_H_
-
-/*
-** Defs are upb's internal representation of the constructs that can appear
-** in a .proto file:
-**
-** - upb::MessageDef (upb_msgdef): describes a "message" construct.
-** - upb::FieldDef (upb_fielddef): describes a message field.
-** - upb::FileDef (upb_filedef): describes a .proto file and its defs.
-** - upb::EnumDef (upb_enumdef): describes an enum.
-** - upb::OneofDef (upb_oneofdef): describes a oneof.
-** - upb::Def (upb_def): base class of all the others.
-**
-** TODO: definitions of services.
-**
-** Like upb_refcounted objects, defs are mutable only until frozen, and are
-** only thread-safe once frozen.
-**
-** This is a mixed C/C++ interface that offers a full API to both languages.
-** See the top-level README for more information.
-*/
-
-#ifndef UPB_DEF_H_
-#define UPB_DEF_H_
-
-/*
-** upb::RefCounted (upb_refcounted)
-**
-** A refcounting scheme that supports circular refs. It accomplishes this by
-** partitioning the set of objects into groups such that no cycle spans groups;
-** we can then reference-count the group as a whole and ignore refs within the
-** group. When objects are mutable, these groups are computed very
-** conservatively; we group any objects that have ever had a link between them.
-** When objects are frozen, we compute strongly-connected components which
-** allows us to be precise and only group objects that are actually cyclic.
-**
-** This is a mixed C/C++ interface that offers a full API to both languages.
-** See the top-level README for more information.
-*/
-
-#ifndef UPB_REFCOUNTED_H_
-#define UPB_REFCOUNTED_H_
-
-/*
-** upb_table
-**
-** This header is INTERNAL-ONLY! Its interfaces are not public or stable!
-** This file defines very fast int->upb_value (inttable) and string->upb_value
-** (strtable) hash tables.
-**
-** The table uses chained scatter with Brent's variation (inspired by the Lua
-** implementation of hash tables). The hash function for strings is Austin
-** Appleby's "MurmurHash."
-**
-** The inttable uses uintptr_t as its key, which guarantees it can be used to
-** store pointers or integers of at least 32 bits (upb isn't really useful on
-** systems where sizeof(void*) < 4).
-**
-** The table must be homogenous (all values of the same type). In debug
-** mode, we check this on insert and lookup.
-*/
-
-#ifndef UPB_TABLE_H_
-#define UPB_TABLE_H_
-
-#include <stdint.h>
-#include <string.h>
#ifdef __cplusplus
extern "C" {
@@ -3899,6 +3857,196 @@ inline bool FileDef::AddDependency(const FileDef* file) {
#endif /* UPB_DEF_H_ */
/*
+** This file contains definitions of structs that should be considered private
+** and NOT stable across versions of upb.
+**
+** The only reason they are declared here and not in .c files is to allow upb
+** and the application (if desired) to embed statically-initialized instances
+** of structures like defs.
+**
+** If you include this file, all guarantees of ABI compatibility go out the
+** window! Any code that includes this file needs to recompile against the
+** exact same version of upb that they are linking against.
+**
+** You also need to recompile if you change the value of the UPB_DEBUG_REFS
+** flag.
+*/
+
+
+#ifndef UPB_STATICINIT_H_
+#define UPB_STATICINIT_H_
+
+#ifdef __cplusplus
+/* Because of how we do our typedefs, this header can't be included from C++. */
+#error This file cannot be included from C++
+#endif
+
+/* upb_refcounted *************************************************************/
+
+
+/* upb_def ********************************************************************/
+
+struct upb_def {
+ upb_refcounted base;
+
+ const char *fullname;
+ const upb_filedef* file;
+ char type; /* A upb_deftype_t (char to save space) */
+
+ /* Used as a flag during the def's mutable stage. Must be false unless
+ * it is currently being used by a function on the stack. This allows
+ * us to easily determine which defs were passed into the function's
+ * current invocation. */
+ bool came_from_user;
+};
+
+#define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \
+ { UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false }
+
+
+/* upb_fielddef ***************************************************************/
+
+struct upb_fielddef {
+ upb_def base;
+
+ union {
+ int64_t sint;
+ uint64_t uint;
+ double dbl;
+ float flt;
+ void *bytes;
+ } defaultval;
+ union {
+ const upb_msgdef *def; /* If !msg_is_symbolic. */
+ char *name; /* If msg_is_symbolic. */
+ } msg;
+ union {
+ const upb_def *def; /* If !subdef_is_symbolic. */
+ char *name; /* If subdef_is_symbolic. */
+ } sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */
+ bool subdef_is_symbolic;
+ bool msg_is_symbolic;
+ const upb_oneofdef *oneof;
+ bool default_is_string;
+ bool type_is_set_; /* False until type is explicitly set. */
+ bool is_extension_;
+ bool lazy_;
+ bool packed_;
+ upb_intfmt_t intfmt;
+ bool tagdelim;
+ upb_fieldtype_t type_;
+ upb_label_t label_;
+ uint32_t number_;
+ uint32_t selector_base; /* Used to index into a upb::Handlers table. */
+ uint32_t index_;
+};
+
+extern const struct upb_refcounted_vtbl upb_fielddef_vtbl;
+
+#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \
+ packed, name, num, msgdef, subdef, selector_base, \
+ index, defaultval, refs, ref2s) \
+ { \
+ UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \
+ defaultval, {msgdef}, {subdef}, NULL, false, false, \
+ type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \
+ lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \
+ }
+
+
+/* upb_msgdef *****************************************************************/
+
+struct upb_msgdef {
+ upb_def base;
+
+ size_t selector_count;
+ uint32_t submsg_field_count;
+
+ /* Tables for looking up fields by number and name. */
+ upb_inttable itof; /* int to field */
+ upb_strtable ntof; /* name to field/oneof */
+
+ /* Is this a map-entry message? */
+ bool map_entry;
+
+ /* Whether this message has proto2 or proto3 semantics. */
+ upb_syntax_t syntax;
+
+ /* TODO(haberman): proper extension ranges (there can be multiple). */
+};
+
+extern const struct upb_refcounted_vtbl upb_msgdef_vtbl;
+
+/* TODO: also support static initialization of the oneofs table. This will be
+ * needed if we compile in descriptors that contain oneofs. */
+#define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \
+ map_entry, syntax, refs, ref2s) \
+ { \
+ UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \
+ selector_count, submsg_field_count, itof, ntof, map_entry, syntax \
+ }
+
+
+/* upb_enumdef ****************************************************************/
+
+struct upb_enumdef {
+ upb_def base;
+
+ upb_strtable ntoi;
+ upb_inttable iton;
+ int32_t defaultval;
+};
+
+extern const struct upb_refcounted_vtbl upb_enumdef_vtbl;
+
+#define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \
+ { UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \
+ iton, defaultval }
+
+
+/* upb_oneofdef ***************************************************************/
+
+struct upb_oneofdef {
+ upb_refcounted base;
+
+ uint32_t index; /* Index within oneofs. */
+ const char *name;
+ upb_strtable ntof;
+ upb_inttable itof;
+ const upb_msgdef *parent;
+};
+
+extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl;
+
+#define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \
+ { UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof }
+
+
+/* upb_symtab *****************************************************************/
+
+struct upb_symtab {
+ upb_refcounted base;
+
+ upb_strtable symtab;
+};
+
+struct upb_filedef {
+ upb_refcounted base;
+
+ const char *name;
+ const char *package;
+ const char *phpprefix;
+ const char *phpnamespace;
+ upb_syntax_t syntax;
+
+ upb_inttable defs;
+ upb_inttable deps;
+};
+
+extern const struct upb_refcounted_vtbl upb_filedef_vtbl;
+
+#endif /* UPB_STATICINIT_H_ */
+/*
** upb::Handlers (upb_handlers)
**
** A upb_handlers is like a virtual table for a upb_msgdef. Each field of the
@@ -4002,8 +4150,7 @@ UPB_END_EXTERN_C
/* Static selectors for upb::Handlers. */
#define UPB_STARTMSG_SELECTOR 0
#define UPB_ENDMSG_SELECTOR 1
-#define UPB_UNKNOWN_SELECTOR 2
-#define UPB_STATIC_SELECTOR_COUNT 3
+#define UPB_STATIC_SELECTOR_COUNT 2
/* Static selectors for upb::BytesHandler. */
#define UPB_STARTSTR_SELECTOR 0
@@ -4532,8 +4679,6 @@ UPB_BEGIN_EXTERN_C
/* Native C API. */
/* Handler function typedefs. */
-typedef bool upb_unknown_handlerfunc(void *c, const void *hd, const char *buf,
- size_t n);
typedef bool upb_startmsg_handlerfunc(void *c, const void*);
typedef bool upb_endmsg_handlerfunc(void *c, const void *, upb_status *status);
typedef void* upb_startfield_handlerfunc(void *c, const void *hd);
@@ -4587,8 +4732,6 @@ const upb_status *upb_handlers_status(upb_handlers *h);
void upb_handlers_clearerr(upb_handlers *h);
const upb_msgdef *upb_handlers_msgdef(const upb_handlers *h);
bool upb_handlers_addcleanup(upb_handlers *h, void *p, upb_handlerfree *hfree);
-bool upb_handlers_setunknown(upb_handlers *h, upb_unknown_handlerfunc *func,
- upb_handlerattr *attr);
bool upb_handlers_setstartmsg(upb_handlers *h, upb_startmsg_handlerfunc *func,
upb_handlerattr *attr);
@@ -6158,18 +6301,6 @@ UPB_INLINE size_t upb_sink_putstring(upb_sink *s, upb_selector_t sel,
return handler(s->closure, hd, buf, n, handle);
}
-UPB_INLINE bool upb_sink_putunknown(upb_sink *s, const char *buf, size_t n) {
- typedef upb_unknown_handlerfunc func;
- func *handler;
- const void *hd;
- if (!s->handlers) return true;
- handler = (func *)upb_handlers_gethandler(s->handlers, UPB_UNKNOWN_SELECTOR);
-
- if (!handler) return n;
- hd = upb_handlers_gethandlerdata(s->handlers, UPB_UNKNOWN_SELECTOR);
- return handler(s->closure, hd, buf, n);
-}
-
UPB_INLINE bool upb_sink_startmsg(upb_sink *s) {
typedef upb_startmsg_handlerfunc func;
func *startmsg;
@@ -6374,6 +6505,34 @@ inline bool BufferSource::PutBuffer(const char *buf, size_t len,
#endif
#endif
+/*
+** upb::Message is a representation for protobuf messages.
+**
+** However it differs from other common representations like
+** google::protobuf::Message in one key way: it does not prescribe any
+** ownership between messages and submessages, and it relies on the
+** client to delete each message/submessage/array/map at the appropriate
+** time.
+**
+** A client can access a upb::Message without knowing anything about
+** ownership semantics, but to create or mutate a message a user needs
+** to implement the memory management themselves.
+**
+** Currently all messages, arrays, and maps store a upb_alloc* internally.
+** Mutating operations use this when they require dynamically-allocated
+** memory. We could potentially eliminate this size overhead later by
+** letting the user flip a bit on the factory that prevents this from
+** being stored. The user would then need to use separate functions where
+** the upb_alloc* is passed explicitly. However for handlers to populate
+** such structures, they would need a place to store this upb_alloc* during
+** parsing; upb_handlers don't currently have a good way to accommodate this.
+**
+** TODO: UTF-8 checking?
+**/
+
+#ifndef UPB_MSG_H_
+#define UPB_MSG_H_
+
#ifdef __cplusplus
@@ -6410,6 +6569,21 @@ typedef void upb_msg;
* instances of this from a upb_msgfactory, and the factory always owns the
* msglayout. */
+/* Gets the factory for this layout */
+upb_msgfactory *upb_msglayout_factory(const upb_msglayout *l);
+
+/* Get the msglayout for a submessage. This requires that this field is a
+ * submessage, ie. upb_fielddef_issubmsg(upb_msglayout_msgdef(l)) == true.
+ *
+ * Since map entry messages don't have layouts, if upb_fielddef_ismap(f) == true
+ * then this function will return the layout for the map's value. It requires
+ * that the value type of the map field is a submessage. */
+const upb_msglayout *upb_msglayout_sublayout(const upb_msglayout *l,
+ const upb_fielddef *f);
+
+/* Returns the msgdef for this msglayout. */
+const upb_msgdef *upb_msglayout_msgdef(const upb_msglayout *l);
+
/** upb_visitor ***************************************************************/
@@ -6455,23 +6629,6 @@ const upb_visitorplan *upb_msgfactory_getvisitorplan(upb_msgfactory *f,
const upb_handlers *h);
-/** upb_stringview ************************************************************/
-
-typedef struct {
- const char *data;
- size_t size;
-} upb_stringview;
-
-UPB_INLINE upb_stringview upb_stringview_make(const char *data, size_t size) {
- upb_stringview ret;
- ret.data = data;
- ret.size = size;
- return ret;
-}
-
-#define UPB_STRINGVIEW_INIT(ptr, len) {ptr, len}
-
-
/** upb_msgval ****************************************************************/
/* A union representing all possible protobuf values. Used for generic get/set
@@ -6489,7 +6646,10 @@ typedef union {
const upb_msg* msg;
const upb_array* arr;
const void* ptr;
- upb_stringview str;
+ struct {
+ const char *ptr;
+ size_t len;
+ } str;
} upb_msgval;
#define ACCESSORS(name, membername, ctype) \
@@ -6516,12 +6676,22 @@ ACCESSORS(map, map, const upb_map*)
ACCESSORS(msg, msg, const upb_msg*)
ACCESSORS(ptr, ptr, const void*)
ACCESSORS(arr, arr, const upb_array*)
-ACCESSORS(str, str, upb_stringview)
#undef ACCESSORS
-UPB_INLINE upb_msgval upb_msgval_makestr(const char *data, size_t size) {
- return upb_msgval_str(upb_stringview_make(data, size));
+UPB_INLINE upb_msgval upb_msgval_str(const char *ptr, size_t len) {
+ upb_msgval ret;
+ ret.str.ptr = ptr;
+ ret.str.len = len;
+ return ret;
+}
+
+UPB_INLINE const char* upb_msgval_getstr(upb_msgval val) {
+ return val.str.ptr;
+}
+
+UPB_INLINE size_t upb_msgval_getstrlen(upb_msgval val) {
+ return val.str.len;
}
@@ -6546,29 +6716,19 @@ size_t upb_msg_sizeof(const upb_msglayout *l);
* upb_msg_uninit() must be called to release internally-allocated memory
* unless the allocator is an arena that does not require freeing.
*
- * Please note that upb_msg_init() may return a value that is different than
- * |msg|, so you must assign the return value and not cast your memory block
- * to upb_msg* directly!
- *
* Please note that upb_msg_uninit() does *not* free any submessages, maps,
* or arrays referred to by this message's fields. You must free them manually
- * yourself.
- *
- * upb_msg_uninit returns the original memory block, which may be useful if
- * you dynamically allocated it (though upb_msg_new() would normally be more
- * appropriate in this case). */
-upb_msg *upb_msg_init(void *msg, const upb_msglayout *l, upb_alloc *a);
-void *upb_msg_uninit(upb_msg *msg, const upb_msglayout *l);
+ * yourself. */
+void upb_msg_init(upb_msg *msg, const upb_msglayout *l, upb_alloc *a);
+void upb_msg_uninit(upb_msg *msg, const upb_msglayout *l);
/* Like upb_msg_init() / upb_msg_uninit(), except the message's memory is
* allocated / freed from the given upb_alloc. */
upb_msg *upb_msg_new(const upb_msglayout *l, upb_alloc *a);
void upb_msg_free(upb_msg *msg, const upb_msglayout *l);
-/* Returns the upb_alloc for the given message.
- * TODO(haberman): get rid of this? Not sure we want to be storing this
- * for every message. */
-upb_alloc *upb_msg_alloc(const upb_msg *msg);
+/* Returns the upb_alloc for the given message. */
+upb_alloc *upb_msg_alloc(const upb_msg *msg, const upb_msglayout *l);
/* Packs the tree of messages rooted at "msg" into a single hunk of memory,
* allocated from the given allocator. */
@@ -6588,14 +6748,25 @@ void *upb_msg_pack(const upb_msg *msg, const upb_msglayout *l,
* arenas).
*/
upb_msgval upb_msg_get(const upb_msg *msg,
- int field_index,
+ const upb_fielddef *f,
const upb_msglayout *l);
/* May only be called for fields where upb_fielddef_haspresence(f) == true. */
bool upb_msg_has(const upb_msg *msg,
- int field_index,
+ const upb_fielddef *f,
const upb_msglayout *l);
+/* Returns NULL if no field in the oneof is set. */
+const upb_fielddef *upb_msg_getoneofcase(const upb_msg *msg,
+ const upb_oneofdef *o,
+ const upb_msglayout *l);
+
+/* Returns true if any field in the oneof is set. */
+bool upb_msg_hasoneof(const upb_msg *msg,
+ const upb_oneofdef *o,
+ const upb_msglayout *l);
+
+
/* Mutable message API. May only be called by the owner of the message who
* knows its ownership scheme and how to keep it consistent. */
@@ -6603,8 +6774,8 @@ bool upb_msg_has(const upb_msg *msg,
* management: if you overwrite a pointer to a msg/array/map/string without
* cleaning it up (or using an arena) it will leak.
*/
-void upb_msg_set(upb_msg *msg,
- int field_index,
+bool upb_msg_set(upb_msg *msg,
+ const upb_fielddef *f,
upb_msgval val,
const upb_msglayout *l);
@@ -6615,7 +6786,12 @@ void upb_msg_set(upb_msg *msg,
* arrays/maps/strings/msgs that this field may have pointed to.
*/
bool upb_msg_clearfield(upb_msg *msg,
- int field_index,
+ const upb_fielddef *f,
+ const upb_msglayout *l);
+
+/* Clears all fields in the oneof such that none of them are set. */
+bool upb_msg_clearoneof(upb_msg *msg,
+ const upb_oneofdef *o,
const upb_msglayout *l);
/* TODO(haberman): copyfrom()/mergefrom()? */
@@ -6728,288 +6904,9 @@ bool upb_msg_getscalarhandlerdata(const upb_handlers *h,
size_t *offset,
int32_t *hasbit);
-
-/** Interfaces for generated code *********************************************/
-
-#define UPB_NOT_IN_ONEOF UINT16_MAX
-#define UPB_NO_HASBIT UINT16_MAX
-#define UPB_NO_SUBMSG UINT16_MAX
-
-typedef struct {
- uint32_t number;
- uint32_t offset; /* If in a oneof, offset of default in default_msg below. */
- uint16_t hasbit; /* UPB_NO_HASBIT if no hasbit. */
- uint16_t oneof_index; /* UPB_NOT_IN_ONEOF if not in a oneof. */
- uint16_t submsg_index; /* UPB_NO_SUBMSG if no submsg. */
- uint8_t type;
- uint8_t label;
-} upb_msglayout_fieldinit_v1;
-
-typedef struct {
- uint32_t data_offset;
- uint32_t case_offset;
-} upb_msglayout_oneofinit_v1;
-
-typedef struct upb_msglayout_msginit_v1 {
- const struct upb_msglayout_msginit_v1 *const* submsgs;
- const upb_msglayout_fieldinit_v1 *fields;
- const upb_msglayout_oneofinit_v1 *oneofs;
- void *default_msg;
- /* Must be aligned to sizeof(void*). Doesn't include internal members like
- * unknown fields, extension dict, pointer to msglayout, etc. */
- uint32_t size;
- uint16_t field_count;
- uint16_t oneof_count;
- bool extendable;
- bool is_proto2;
-} upb_msglayout_msginit_v1;
-
-#define UPB_ALIGN_UP_TO(val, align) ((val + (align - 1)) & -align)
-#define UPB_ALIGNED_SIZEOF(type) UPB_ALIGN_UP_TO(sizeof(type), sizeof(void*))
-
-/* Initialize/uninitialize a msglayout from a msginit. If upb uses v1
- * internally, this will not allocate any memory. Should only be used by
- * generated code. */
-upb_msglayout *upb_msglayout_frominit_v1(
- const upb_msglayout_msginit_v1 *init, upb_alloc *a);
-void upb_msglayout_uninit_v1(upb_msglayout *layout, upb_alloc *a);
-
UPB_END_EXTERN_C
#endif /* UPB_MSG_H_ */
-
-UPB_BEGIN_EXTERN_C
-
-bool upb_decode(upb_stringview buf, void *msg,
- const upb_msglayout_msginit_v1 *l, upb_env *env);
-
-UPB_END_EXTERN_C
-
-#endif /* UPB_DECODE_H_ */
-/*
-** structs.int.h: structures definitions that are internal to upb.
-*/
-
-#ifndef UPB_STRUCTS_H_
-#define UPB_STRUCTS_H_
-
-struct upb_array {
- upb_fieldtype_t type;
- uint8_t element_size;
- void *data; /* Each element is element_size. */
- size_t len; /* Measured in elements. */
- size_t size; /* Measured in elements. */
- upb_alloc *alloc;
-};
-
-#endif /* UPB_STRUCTS_H_ */
-
-/*
-** This file contains definitions of structs that should be considered private
-** and NOT stable across versions of upb.
-**
-** The only reason they are declared here and not in .c files is to allow upb
-** and the application (if desired) to embed statically-initialized instances
-** of structures like defs.
-**
-** If you include this file, all guarantees of ABI compatibility go out the
-** window! Any code that includes this file needs to recompile against the
-** exact same version of upb that they are linking against.
-**
-** You also need to recompile if you change the value of the UPB_DEBUG_REFS
-** flag.
-*/
-
-
-#ifndef UPB_STATICINIT_H_
-#define UPB_STATICINIT_H_
-
-#ifdef __cplusplus
-/* Because of how we do our typedefs, this header can't be included from C++. */
-#error This file cannot be included from C++
-#endif
-
-/* upb_refcounted *************************************************************/
-
-
-/* upb_def ********************************************************************/
-
-struct upb_def {
- upb_refcounted base;
-
- const char *fullname;
- const upb_filedef* file;
- char type; /* A upb_deftype_t (char to save space) */
-
- /* Used as a flag during the def's mutable stage. Must be false unless
- * it is currently being used by a function on the stack. This allows
- * us to easily determine which defs were passed into the function's
- * current invocation. */
- bool came_from_user;
-};
-
-#define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \
- { UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false }
-
-
-/* upb_fielddef ***************************************************************/
-
-struct upb_fielddef {
- upb_def base;
-
- union {
- int64_t sint;
- uint64_t uint;
- double dbl;
- float flt;
- void *bytes;
- } defaultval;
- union {
- const upb_msgdef *def; /* If !msg_is_symbolic. */
- char *name; /* If msg_is_symbolic. */
- } msg;
- union {
- const upb_def *def; /* If !subdef_is_symbolic. */
- char *name; /* If subdef_is_symbolic. */
- } sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */
- bool subdef_is_symbolic;
- bool msg_is_symbolic;
- const upb_oneofdef *oneof;
- bool default_is_string;
- bool type_is_set_; /* False until type is explicitly set. */
- bool is_extension_;
- bool lazy_;
- bool packed_;
- upb_intfmt_t intfmt;
- bool tagdelim;
- upb_fieldtype_t type_;
- upb_label_t label_;
- uint32_t number_;
- uint32_t selector_base; /* Used to index into a upb::Handlers table. */
- uint32_t index_;
-};
-
-extern const struct upb_refcounted_vtbl upb_fielddef_vtbl;
-
-#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \
- packed, name, num, msgdef, subdef, selector_base, \
- index, defaultval, refs, ref2s) \
- { \
- UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \
- defaultval, {msgdef}, {subdef}, NULL, false, false, \
- type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \
- lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \
- }
-
-
-/* upb_msgdef *****************************************************************/
-
-struct upb_msgdef {
- upb_def base;
-
- size_t selector_count;
- uint32_t submsg_field_count;
-
- /* Tables for looking up fields by number and name. */
- upb_inttable itof; /* int to field */
- upb_strtable ntof; /* name to field/oneof */
-
- /* Is this a map-entry message? */
- bool map_entry;
-
- /* Whether this message has proto2 or proto3 semantics. */
- upb_syntax_t syntax;
-
- /* TODO(haberman): proper extension ranges (there can be multiple). */
-};
-
-extern const struct upb_refcounted_vtbl upb_msgdef_vtbl;
-
-/* TODO: also support static initialization of the oneofs table. This will be
- * needed if we compile in descriptors that contain oneofs. */
-#define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \
- map_entry, syntax, refs, ref2s) \
- { \
- UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \
- selector_count, submsg_field_count, itof, ntof, map_entry, syntax \
- }
-
-
-/* upb_enumdef ****************************************************************/
-
-struct upb_enumdef {
- upb_def base;
-
- upb_strtable ntoi;
- upb_inttable iton;
- int32_t defaultval;
-};
-
-extern const struct upb_refcounted_vtbl upb_enumdef_vtbl;
-
-#define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \
- { UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \
- iton, defaultval }
-
-
-/* upb_oneofdef ***************************************************************/
-
-struct upb_oneofdef {
- upb_refcounted base;
-
- uint32_t index; /* Index within oneofs. */
- const char *name;
- upb_strtable ntof;
- upb_inttable itof;
- const upb_msgdef *parent;
-};
-
-extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl;
-
-#define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \
- { UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof }
-
-
-/* upb_symtab *****************************************************************/
-
-struct upb_symtab {
- upb_refcounted base;
-
- upb_strtable symtab;
-};
-
-struct upb_filedef {
- upb_refcounted base;
-
- const char *name;
- const char *package;
- const char *phpprefix;
- const char *phpnamespace;
- upb_syntax_t syntax;
-
- upb_inttable defs;
- upb_inttable deps;
-};
-
-extern const struct upb_refcounted_vtbl upb_filedef_vtbl;
-
-#endif /* UPB_STATICINIT_H_ */
-/*
-** upb_encode: parsing into a upb_msg using a upb_msglayout.
-*/
-
-#ifndef UPB_ENCODE_H_
-#define UPB_ENCODE_H_
-
-
-UPB_BEGIN_EXTERN_C
-
-char *upb_encode(const void *msg, const upb_msglayout_msginit_v1 *l,
- upb_env *env, size_t *size);
-
-UPB_END_EXTERN_C
-
-#endif /* UPB_ENCODE_H_ */
/*
** upb::descriptor::Reader (upb_descreader)
**
@@ -8399,9 +8296,21 @@ UPB_INLINE void upb_pbdecoder_unpackdispatch(uint64_t dispatch, uint64_t *ofs,
extern "C" {
#endif
+/* A list of types as they are encoded on-the-wire. */
+typedef enum {
+ UPB_WIRE_TYPE_VARINT = 0,
+ UPB_WIRE_TYPE_64BIT = 1,
+ UPB_WIRE_TYPE_DELIMITED = 2,
+ UPB_WIRE_TYPE_START_GROUP = 3,
+ UPB_WIRE_TYPE_END_GROUP = 4,
+ UPB_WIRE_TYPE_32BIT = 5
+} upb_wiretype_t;
+
#define UPB_MAX_WIRE_TYPE 5
-/* The maximum number of bytes that it takes to encode a 64-bit varint. */
+/* The maximum number of bytes that it takes to encode a 64-bit varint.
+ * Note that with a better encoding this could be 9 (TODO: write up a
+ * wiki document about this). */
#define UPB_PB_VARINT_MAX_LEN 10
/* Array of the "native" (ie. non-packed-repeated) wire type for the given a
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/utf8.c b/third_party/protobuf/3.4.0/php/ext/google/protobuf/utf8.c
index 2752a08b05..2752a08b05 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/utf8.c
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/utf8.c
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/utf8.h b/third_party/protobuf/3.4.0/php/ext/google/protobuf/utf8.h
index 28b8d874a8..28b8d874a8 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/utf8.h
+++ b/third_party/protobuf/3.4.0/php/ext/google/protobuf/utf8.h
diff --git a/third_party/protobuf/3.6.0/php/generate_descriptor_protos.sh b/third_party/protobuf/3.4.0/php/generate_descriptor_protos.sh
index 372ad69c6c..372ad69c6c 100644..100755
--- a/third_party/protobuf/3.6.0/php/generate_descriptor_protos.sh
+++ b/third_party/protobuf/3.4.0/php/generate_descriptor_protos.sh
diff --git a/third_party/protobuf/3.6.0/php/phpunit.xml b/third_party/protobuf/3.4.0/php/phpunit.xml
index 87440bbdbb..d7077038dd 100644
--- a/third_party/protobuf/3.6.0/php/phpunit.xml
+++ b/third_party/protobuf/3.4.0/php/phpunit.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<phpunit bootstrap="./tests/bootstrap_phpunit.php"
+<phpunit bootstrap="./vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="protobuf-tests">
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/third_party/protobuf/3.4.0/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
index e6362f2bfb..60722d00aa 100644
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
@@ -46,13 +46,13 @@ class Descriptor
->repeated('reserved_name', \Google\Protobuf\Internal\GPBType::STRING, 10)
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.DescriptorProto.ExtensionRange', \Google\Protobuf\Internal\DescriptorProto\ExtensionRange::class)
+ $pool->addMessage('google.protobuf.internal.DescriptorProto.ExtensionRange', \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class)
->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1)
->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2)
->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.ExtensionRangeOptions')
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.DescriptorProto.ReservedRange', \Google\Protobuf\Internal\DescriptorProto\ReservedRange::class)
+ $pool->addMessage('google.protobuf.internal.DescriptorProto.ReservedRange', \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class)
->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1)
->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2)
->finalizeToPool();
@@ -110,13 +110,6 @@ class Descriptor
->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1)
->repeated('value', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.EnumValueDescriptorProto')
->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.EnumOptions')
- ->repeated('reserved_range', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.EnumDescriptorProto.EnumReservedRange')
- ->repeated('reserved_name', \Google\Protobuf\Internal\GPBType::STRING, 5)
- ->finalizeToPool();
-
- $pool->addMessage('google.protobuf.internal.EnumDescriptorProto.EnumReservedRange', \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange::class)
- ->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1)
- ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2)
->finalizeToPool();
$pool->addMessage('google.protobuf.internal.EnumValueDescriptorProto', \Google\Protobuf\Internal\EnumValueDescriptorProto::class)
@@ -151,7 +144,7 @@ class Descriptor
->optional('cc_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 16)
->optional('java_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 17)
->optional('py_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 18)
- ->optional('php_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 42)
+ ->optional('php_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 19)
->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 23)
->optional('cc_enable_arenas', \Google\Protobuf\Internal\GPBType::BOOL, 31)
->optional('objc_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 36)
@@ -159,8 +152,6 @@ class Descriptor
->optional('swift_prefix', \Google\Protobuf\Internal\GPBType::STRING, 39)
->optional('php_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 40)
->optional('php_namespace', \Google\Protobuf\Internal\GPBType::STRING, 41)
- ->optional('php_metadata_namespace', \Google\Protobuf\Internal\GPBType::STRING, 44)
- ->optional('ruby_package', \Google\Protobuf\Internal\GPBType::STRING, 45)
->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption')
->finalizeToPool();
@@ -242,7 +233,7 @@ class Descriptor
->optional('aggregate_value', \Google\Protobuf\Internal\GPBType::STRING, 8)
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.UninterpretedOption.NamePart', \Google\Protobuf\Internal\UninterpretedOption\NamePart::class)
+ $pool->addMessage('google.protobuf.internal.UninterpretedOption.NamePart', \Google\Protobuf\Internal\UninterpretedOption_NamePart::class)
->required('name_part', \Google\Protobuf\Internal\GPBType::STRING, 1)
->required('is_extension', \Google\Protobuf\Internal\GPBType::BOOL, 2)
->finalizeToPool();
@@ -251,7 +242,7 @@ class Descriptor
->repeated('location', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.SourceCodeInfo.Location')
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.SourceCodeInfo.Location', \Google\Protobuf\Internal\SourceCodeInfo\Location::class)
+ $pool->addMessage('google.protobuf.internal.SourceCodeInfo.Location', \Google\Protobuf\Internal\SourceCodeInfo_Location::class)
->repeated('path', \Google\Protobuf\Internal\GPBType::INT32, 1)
->repeated('span', \Google\Protobuf\Internal\GPBType::INT32, 2)
->optional('leading_comments', \Google\Protobuf\Internal\GPBType::STRING, 3)
@@ -263,7 +254,7 @@ class Descriptor
->repeated('annotation', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.GeneratedCodeInfo.Annotation')
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.GeneratedCodeInfo.Annotation', \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation::class)
+ $pool->addMessage('google.protobuf.internal.GeneratedCodeInfo.Annotation', \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class)
->repeated('path', \Google\Protobuf\Internal\GPBType::INT32, 1)
->optional('source_file', \Google\Protobuf\Internal\GPBType::STRING, 2)
->optional('begin', \Google\Protobuf\Internal\GPBType::INT32, 3)
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Descriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Descriptor.php
index 986b81e12d..986b81e12d 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Descriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Descriptor.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/DescriptorPool.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/DescriptorPool.php
index 119f0e2e60..119f0e2e60 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/DescriptorPool.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/DescriptorPool.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumDescriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/EnumDescriptor.php
index a8b56c0d46..a8b56c0d46 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumDescriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/EnumDescriptor.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumValueDescriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/EnumValueDescriptor.php
index e76e199718..e76e199718 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumValueDescriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/EnumValueDescriptor.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/FieldDescriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/FieldDescriptor.php
index ac9271f98b..ac9271f98b 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/FieldDescriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/FieldDescriptor.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/CodedInputStream.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/CodedInputStream.php
index b612da5b7b..6131d5d1f9 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/CodedInputStream.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/CodedInputStream.php
@@ -78,18 +78,13 @@ class CodedInputStream
return $this->buffer_end - $this->current;
}
- public function current()
+ private function current()
{
return $this->total_bytes_read -
($this->buffer_end - $this->current +
$this->buffer_size_after_limit);
}
- public function substr($start, $end)
- {
- return substr($this->buffer, $start, $end - $start);
- }
-
private function recomputeBufferLimits()
{
$this->buffer_end += $this->buffer_size_after_limit;
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/CodedOutputStream.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/CodedOutputStream.php
index f75e9c6626..4525d8dd29 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/CodedOutputStream.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/CodedOutputStream.php
@@ -101,7 +101,7 @@ class CodedOutputStream
return true;
}
- public static function writeVarintToArray($value, &$buffer, $trim = false)
+ private static function writeVarintToArray($value, &$buffer, $trim = false)
{
$current = 0;
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/Descriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/Descriptor.php
index ee3a8bdec5..ee3a8bdec5 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/Descriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/Descriptor.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorPool.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorPool.php
index 304c16158e..65d1a884eb 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorPool.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorPool.php
@@ -109,30 +109,18 @@ class DescriptorPool
public function getDescriptorByClassName($klass)
{
- if (isset($this->class_to_desc[$klass])) {
- return $this->class_to_desc[$klass];
- } else {
- return null;
- }
+ return $this->class_to_desc[$klass];
}
public function getEnumDescriptorByClassName($klass)
{
- if (isset($this->class_to_enum_desc[$klass])) {
- return $this->class_to_enum_desc[$klass];
- } else {
- return null;
- }
+ return $this->class_to_enum_desc[$klass];
}
public function getDescriptorByProtoName($proto)
{
- if (isset($this->proto_to_class[$proto])) {
- $klass = $this->proto_to_class[$proto];
- return $this->class_to_desc[$klass];
- } else {
- return null;
- }
+ $klass = $this->proto_to_class[$proto];
+ return $this->class_to_desc[$klass];
}
public function getEnumDescriptorByProtoName($proto)
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto.php
index 3b215d52ae..1d6959b71d 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto.php
@@ -71,29 +71,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
private $reserved_name;
private $has_reserved_name = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $field
- * @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $extension
- * @type \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $nested_type
- * @type \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $enum_type
- * @type \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $extension_range
- * @type \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $oneof_decl
- * @type \Google\Protobuf\Internal\MessageOptions $options
- * @type \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range
- * @type string[]|\Google\Protobuf\Internal\RepeatedField $reserved_name
- * Reserved field names, which may not be used by fields in the same message.
- * A given name may only be reserved once.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -247,12 +227,12 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
- * @param \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\DescriptorProto_ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setExtensionRange($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto\ExtensionRange::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class);
$this->extension_range = $arr;
$this->has_extension_range = true;
@@ -331,12 +311,12 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
- * @param \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\DescriptorProto_ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setReservedRange($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto\ReservedRange::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class);
$this->reserved_range = $arr;
$this->has_reserved_range = true;
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php
index c06a0a6ea9..1d45599577 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\DescriptorProto;
+namespace Google\Protobuf\Internal;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>google.protobuf.DescriptorProto.ExtensionRange</code>
*/
-class ExtensionRange extends \Google\Protobuf\Internal\Message
+class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>optional int32 start = 1;</code>
@@ -31,20 +31,9 @@ class ExtensionRange extends \Google\Protobuf\Internal\Message
private $options = null;
private $has_options = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int $start
- * @type int $end
- * @type \Google\Protobuf\Internal\ExtensionRangeOptions $options
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -133,6 +122,3 @@ class ExtensionRange extends \Google\Protobuf\Internal\Message
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(ExtensionRange::class, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php
index 73c964faa0..b1022d6154 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\DescriptorProto;
+namespace Google\Protobuf\Internal;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -17,7 +17,7 @@ use Google\Protobuf\Internal\GPBUtil;
*
* Generated from protobuf message <code>google.protobuf.DescriptorProto.ReservedRange</code>
*/
-class ReservedRange extends \Google\Protobuf\Internal\Message
+class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message
{
/**
* Inclusive.
@@ -34,21 +34,9 @@ class ReservedRange extends \Google\Protobuf\Internal\Message
private $end = 0;
private $has_end = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int $start
- * Inclusive.
- * @type int $end
- * Exclusive.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -117,6 +105,3 @@ class ReservedRange extends \Google\Protobuf\Internal\Message
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(ReservedRange::class, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php
index 08397284e9..08397284e9 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumDescriptor.php
index 01649fec4f..01649fec4f 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumDescriptor.php
diff --git a/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
new file mode 100644
index 0000000000..816fbae544
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
@@ -0,0 +1,126 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+use Google\Protobuf\Internal\GPBType;
+use Google\Protobuf\Internal\GPBWire;
+use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\InputStream;
+use Google\Protobuf\Internal\GPBUtil;
+
+/**
+ * Describes an enum type.
+ *
+ * Generated from protobuf message <code>google.protobuf.EnumDescriptorProto</code>
+ */
+class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Generated from protobuf field <code>optional string name = 1;</code>
+ */
+ private $name = '';
+ private $has_name = false;
+ /**
+ * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
+ */
+ private $value;
+ private $has_value = false;
+ /**
+ * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
+ */
+ private $options = null;
+ private $has_options = false;
+
+ public function __construct() {
+ \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
+ parent::__construct();
+ }
+
+ /**
+ * Generated from protobuf field <code>optional string name = 1;</code>
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Generated from protobuf field <code>optional string name = 1;</code>
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+ $this->has_name = true;
+
+ return $this;
+ }
+
+ public function hasName()
+ {
+ return $this->has_name;
+ }
+
+ /**
+ * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
+ * @param \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setValue($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class);
+ $this->value = $arr;
+ $this->has_value = true;
+
+ return $this;
+ }
+
+ public function hasValue()
+ {
+ return $this->has_value;
+ }
+
+ /**
+ * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
+ * @return \Google\Protobuf\Internal\EnumOptions
+ */
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ /**
+ * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
+ * @param \Google\Protobuf\Internal\EnumOptions $var
+ * @return $this
+ */
+ public function setOptions($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumOptions::class);
+ $this->options = $var;
+ $this->has_options = true;
+
+ return $this;
+ }
+
+ public function hasOptions()
+ {
+ return $this->has_options;
+ }
+
+}
+
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumOptions.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumOptions.php
index 3d74c81c21..3f598a41e7 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumOptions.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumOptions.php
@@ -41,27 +41,9 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
private $uninterpreted_option;
private $has_uninterpreted_option = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type bool $allow_alias
- * Set this option to true to allow mapping different tag names to the same
- * value.
- * @type bool $deprecated
- * Is this enum deprecated?
- * Depending on the target platform, this can emit Deprecated annotations
- * for the enum, or it will be completely ignored; in the very least, this
- * is a formalization for deprecating enums.
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here. See above.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php
index 50bda008e8..e363220fc1 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php
@@ -33,20 +33,9 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message
private $options = null;
private $has_options = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * @type int $number
- * @type \Google\Protobuf\Internal\EnumValueOptions $options
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php
index a267c6d5e2..db8de174d7 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php
@@ -33,24 +33,9 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message
private $uninterpreted_option;
private $has_uninterpreted_option = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type bool $deprecated
- * Is this enum value deprecated?
- * Depending on the target platform, this can emit Deprecated annotations
- * for the enum value, or it will be completely ignored; in the very least,
- * this is a formalization for deprecating enum values.
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here. See above.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptor.php
index 6644a2e053..1443c6fd0b 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptor.php
@@ -181,12 +181,6 @@ class FieldDescriptor
$this->getMessageType()->getOptions()->getMapEntry();
}
- public function isTimestamp()
- {
- return $this->getType() == GPBType::MESSAGE &&
- $this->getMessageType()->getClass() === "Google\Protobuf\Timestamp";
- }
-
private static function isTypePackable($field_type)
{
return ($field_type !== GPBType::STRING &&
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
index e578197515..10c2759330 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
@@ -94,47 +94,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
private $options = null;
private $has_options = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * @type int $number
- * @type int $label
- * @type int $type
- * If type_name is set, this need not be set. If both this and type_name
- * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
- * @type string $type_name
- * For message and enum types, this is the name of the type. If the name
- * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
- * rules are used to find the type (i.e. first the nested types within this
- * message are searched, then within the parent, on up to the root
- * namespace).
- * @type string $extendee
- * For extensions, this is the name of the type being extended. It is
- * resolved in the same manner as type_name.
- * @type string $default_value
- * For numeric types, contains the original text representation of the value.
- * For booleans, "true" or "false".
- * For strings, contains the default text contents (not escaped in any way).
- * For bytes, contains the C escaped value. All bytes >= 128 are escaped.
- * TODO(kenton): Base-64 encode?
- * @type int $oneof_index
- * If set, gives the index of a oneof in the containing type's oneof_decl
- * list. This field is a member of that oneof.
- * @type string $json_name
- * JSON name of this field. The value is set by protocol compiler. If the
- * user has set a "json_name" option on this field, that option's value
- * will be used. Otherwise, it's deduced from the field's name by converting
- * it to camelCase.
- * @type \Google\Protobuf\Internal\FieldOptions $options
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
index b105088e6a..f2a32fdf21 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
@@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\FieldDescriptorProto;
+namespace Google\Protobuf\Internal;
/**
- * Protobuf type <code>google.protobuf.FieldDescriptorProto.Label</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
*/
-class Label
+class FieldDescriptorProto_Label
{
/**
* 0 is reserved for errors
@@ -25,6 +25,3 @@ class Label
const LABEL_REPEATED = 3;
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Label::class, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
index ea228a77fe..1b022debe8 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
@@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\FieldDescriptorProto;
+namespace Google\Protobuf\Internal;
/**
- * Protobuf type <code>google.protobuf.FieldDescriptorProto.Type</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
*/
-class Type
+class FieldDescriptorProto_Type
{
/**
* 0 is reserved for errors.
@@ -105,6 +105,3 @@ class Type
const TYPE_SINT64 = 18;
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Type::class, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions.php
index 751c278d78..169f860be0 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions.php
@@ -107,73 +107,9 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
private $uninterpreted_option;
private $has_uninterpreted_option = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int $ctype
- * The ctype option instructs the C++ code generator to use a different
- * representation of the field than it normally would. See the specific
- * options below. This option is not yet implemented in the open source
- * release -- sorry, we'll try to include it in a future version!
- * @type bool $packed
- * The packed option can be enabled for repeated primitive fields to enable
- * a more efficient representation on the wire. Rather than repeatedly
- * writing the tag and type for each element, the entire array is encoded as
- * a single length-delimited blob. In proto3, only explicit setting it to
- * false will avoid using packed encoding.
- * @type int $jstype
- * The jstype option determines the JavaScript type used for values of the
- * field. The option is permitted only for 64 bit integral and fixed types
- * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
- * is represented as JavaScript string, which avoids loss of precision that
- * can happen when a large value is converted to a floating point JavaScript.
- * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
- * use the JavaScript "number" type. The behavior of the default option
- * JS_NORMAL is implementation dependent.
- * This option is an enum to permit additional types to be added, e.g.
- * goog.math.Integer.
- * @type bool $lazy
- * Should this field be parsed lazily? Lazy applies only to message-type
- * fields. It means that when the outer message is initially parsed, the
- * inner message's contents will not be parsed but instead stored in encoded
- * form. The inner message will actually be parsed when it is first accessed.
- * This is only a hint. Implementations are free to choose whether to use
- * eager or lazy parsing regardless of the value of this option. However,
- * setting this option true suggests that the protocol author believes that
- * using lazy parsing on this field is worth the additional bookkeeping
- * overhead typically needed to implement it.
- * This option does not affect the public interface of any generated code;
- * all method signatures remain the same. Furthermore, thread-safety of the
- * interface is not affected by this option; const methods remain safe to
- * call from multiple threads concurrently, while non-const methods continue
- * to require exclusive access.
- * Note that implementations may choose not to check required fields within
- * a lazy sub-message. That is, calling IsInitialized() on the outer message
- * may return true even if the inner message has missing required fields.
- * This is necessary because otherwise the inner message would have to be
- * parsed in order to perform the check, defeating the purpose of lazy
- * parsing. An implementation which chooses not to check required fields
- * must be consistent about it. That is, for any particular sub-message, the
- * implementation must either *always* check its required fields, or *never*
- * check its required fields, regardless of whether or not the message has
- * been parsed.
- * @type bool $deprecated
- * Is this field deprecated?
- * Depending on the target platform, this can emit Deprecated annotations
- * for accessors, or it will be completely ignored; in the very least, this
- * is a formalization for deprecating fields.
- * @type bool $weak
- * For Google-internal migration only. Do not use.
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here. See above.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions/CType.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions_CType.php
index 016197acb5..0f33072d11 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions/CType.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions_CType.php
@@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\FieldOptions;
+namespace Google\Protobuf\Internal;
/**
- * Protobuf type <code>google.protobuf.FieldOptions.CType</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
*/
-class CType
+class FieldOptions_CType
{
/**
* Default mode.
@@ -25,6 +25,3 @@ class CType
const STRING_PIECE = 2;
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(CType::class, \Google\Protobuf\Internal\FieldOptions_CType::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
index f7b78a1b31..73bdf3f20e 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
@@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\FieldOptions;
+namespace Google\Protobuf\Internal;
/**
- * Protobuf type <code>google.protobuf.FieldOptions.JSType</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
*/
-class JSType
+class FieldOptions_JSType
{
/**
* Use the default type.
@@ -29,6 +29,3 @@ class JSType
const JS_NUMBER = 2;
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(JSType::class, \Google\Protobuf\Internal\FieldOptions_JSType::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptor.php
index 038da38cfb..038da38cfb 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptor.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
index cb10aa7939..9ee222d19b 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
@@ -99,42 +99,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
private $syntax = '';
private $has_syntax = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * file name, relative to root of source tree
- * @type string $package
- * e.g. "foo", "foo.bar", etc.
- * @type string[]|\Google\Protobuf\Internal\RepeatedField $dependency
- * Names of files imported by this file.
- * @type int[]|\Google\Protobuf\Internal\RepeatedField $public_dependency
- * Indexes of the public imported files in the dependency list above.
- * @type int[]|\Google\Protobuf\Internal\RepeatedField $weak_dependency
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * @type \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $message_type
- * All top-level definitions in this file.
- * @type \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $enum_type
- * @type \Google\Protobuf\Internal\ServiceDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $service
- * @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $extension
- * @type \Google\Protobuf\Internal\FileOptions $options
- * @type \Google\Protobuf\Internal\SourceCodeInfo $source_code_info
- * This field contains optional information about the original source code.
- * You may safely remove this entire field without harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * @type string $syntax
- * The syntax of the proto file.
- * The supported values are "proto2" and "proto3".
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php
index 9907b17d73..0b2cf95766 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php
@@ -24,18 +24,9 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message
private $file;
private $has_file = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Google\Protobuf\Internal\FileDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $file
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileOptions.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileOptions.php
index c6b36bbc89..c2dd5e08f3 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileOptions.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileOptions.php
@@ -109,7 +109,7 @@ class FileOptions extends \Google\Protobuf\Internal\Message
private $py_generic_services = false;
private $has_py_generic_services = false;
/**
- * Generated from protobuf field <code>optional bool php_generic_services = 42 [default = false];</code>
+ * Generated from protobuf field <code>optional bool php_generic_services = 19 [default = false];</code>
*/
private $php_generic_services = false;
private $has_php_generic_services = false;
@@ -174,126 +174,16 @@ class FileOptions extends \Google\Protobuf\Internal\Message
private $php_namespace = '';
private $has_php_namespace = false;
/**
- * Use this option to change the namespace of php generated metadata classes.
- * Default is empty. When this option is empty, the proto file name will be used
- * for determining the namespace.
- *
- * Generated from protobuf field <code>optional string php_metadata_namespace = 44;</code>
- */
- private $php_metadata_namespace = '';
- private $has_php_metadata_namespace = false;
- /**
- * Use this option to change the package of ruby generated classes. Default
- * is empty. When this option is not set, the package name will be used for
- * determining the ruby package.
- *
- * Generated from protobuf field <code>optional string ruby_package = 45;</code>
- */
- private $ruby_package = '';
- private $has_ruby_package = false;
- /**
- * The parser stores options it doesn't recognize here.
- * See the documentation for the "Options" section above.
+ * The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
*/
private $uninterpreted_option;
private $has_uninterpreted_option = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $java_package
- * Sets the Java package where classes generated from this .proto will be
- * placed. By default, the proto package is used, but this is often
- * inappropriate because proto packages do not normally start with backwards
- * domain names.
- * @type string $java_outer_classname
- * If set, all the classes from the .proto file are wrapped in a single
- * outer class with the given name. This applies to both Proto1
- * (equivalent to the old "--one_java_file" option) and Proto2 (where
- * a .proto always translates to a single class, but you may want to
- * explicitly choose the class name).
- * @type bool $java_multiple_files
- * If set true, then the Java code generator will generate a separate .java
- * file for each top-level message, enum, and service defined in the .proto
- * file. Thus, these types will *not* be nested inside the outer class
- * named by java_outer_classname. However, the outer class will still be
- * generated to contain the file's getDescriptor() method as well as any
- * top-level extensions defined in the file.
- * @type bool $java_generate_equals_and_hash
- * This option does nothing.
- * @type bool $java_string_check_utf8
- * If set true, then the Java2 code generator will generate code that
- * throws an exception whenever an attempt is made to assign a non-UTF-8
- * byte sequence to a string field.
- * Message reflection will do the same.
- * However, an extension field still accepts non-UTF-8 byte sequences.
- * This option has no effect on when used with the lite runtime.
- * @type int $optimize_for
- * @type string $go_package
- * Sets the Go package where structs generated from this .proto will be
- * placed. If omitted, the Go package will be derived from the following:
- * - The basename of the package import path, if provided.
- * - Otherwise, the package statement in the .proto file, if present.
- * - Otherwise, the basename of the .proto file, without extension.
- * @type bool $cc_generic_services
- * Should generic services be generated in each language? "Generic" services
- * are not specific to any particular RPC system. They are generated by the
- * main code generators in each language (without additional plugins).
- * Generic services were the only kind of service generation supported by
- * early versions of google.protobuf.
- * Generic services are now considered deprecated in favor of using plugins
- * that generate code specific to your particular RPC system. Therefore,
- * these default to false. Old code which depends on generic services should
- * explicitly set them to true.
- * @type bool $java_generic_services
- * @type bool $py_generic_services
- * @type bool $php_generic_services
- * @type bool $deprecated
- * Is this file deprecated?
- * Depending on the target platform, this can emit Deprecated annotations
- * for everything in the file, or it will be completely ignored; in the very
- * least, this is a formalization for deprecating files.
- * @type bool $cc_enable_arenas
- * Enables the use of arenas for the proto messages in this file. This applies
- * only to generated classes for C++.
- * @type string $objc_class_prefix
- * Sets the objective c class prefix which is prepended to all objective c
- * generated classes from this .proto. There is no default.
- * @type string $csharp_namespace
- * Namespace for generated classes; defaults to the package.
- * @type string $swift_prefix
- * By default Swift generators will take the proto package and CamelCase it
- * replacing '.' with underscore and use that to prefix the types/symbols
- * defined. When this options is provided, they will use this value instead
- * to prefix the types/symbols defined.
- * @type string $php_class_prefix
- * Sets the php class prefix which is prepended to all php generated classes
- * from this .proto. Default is empty.
- * @type string $php_namespace
- * Use this option to change the namespace of php generated classes. Default
- * is empty. When this option is empty, the package name will be used for
- * determining the namespace.
- * @type string $php_metadata_namespace
- * Use this option to change the namespace of php generated metadata classes.
- * Default is empty. When this option is empty, the proto file name will be used
- * for determining the namespace.
- * @type string $ruby_package
- * Use this option to change the package of ruby generated classes. Default
- * is empty. When this option is not set, the package name will be used for
- * determining the ruby package.
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here.
- * See the documentation for the "Options" section above.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -663,7 +553,7 @@ class FileOptions extends \Google\Protobuf\Internal\Message
}
/**
- * Generated from protobuf field <code>optional bool php_generic_services = 42 [default = false];</code>
+ * Generated from protobuf field <code>optional bool php_generic_services = 19 [default = false];</code>
* @return bool
*/
public function getPhpGenericServices()
@@ -672,7 +562,7 @@ class FileOptions extends \Google\Protobuf\Internal\Message
}
/**
- * Generated from protobuf field <code>optional bool php_generic_services = 42 [default = false];</code>
+ * Generated from protobuf field <code>optional bool php_generic_services = 19 [default = false];</code>
* @param bool $var
* @return $this
*/
@@ -937,80 +827,7 @@ class FileOptions extends \Google\Protobuf\Internal\Message
}
/**
- * Use this option to change the namespace of php generated metadata classes.
- * Default is empty. When this option is empty, the proto file name will be used
- * for determining the namespace.
- *
- * Generated from protobuf field <code>optional string php_metadata_namespace = 44;</code>
- * @return string
- */
- public function getPhpMetadataNamespace()
- {
- return $this->php_metadata_namespace;
- }
-
- /**
- * Use this option to change the namespace of php generated metadata classes.
- * Default is empty. When this option is empty, the proto file name will be used
- * for determining the namespace.
- *
- * Generated from protobuf field <code>optional string php_metadata_namespace = 44;</code>
- * @param string $var
- * @return $this
- */
- public function setPhpMetadataNamespace($var)
- {
- GPBUtil::checkString($var, True);
- $this->php_metadata_namespace = $var;
- $this->has_php_metadata_namespace = true;
-
- return $this;
- }
-
- public function hasPhpMetadataNamespace()
- {
- return $this->has_php_metadata_namespace;
- }
-
- /**
- * Use this option to change the package of ruby generated classes. Default
- * is empty. When this option is not set, the package name will be used for
- * determining the ruby package.
- *
- * Generated from protobuf field <code>optional string ruby_package = 45;</code>
- * @return string
- */
- public function getRubyPackage()
- {
- return $this->ruby_package;
- }
-
- /**
- * Use this option to change the package of ruby generated classes. Default
- * is empty. When this option is not set, the package name will be used for
- * determining the ruby package.
- *
- * Generated from protobuf field <code>optional string ruby_package = 45;</code>
- * @param string $var
- * @return $this
- */
- public function setRubyPackage($var)
- {
- GPBUtil::checkString($var, True);
- $this->ruby_package = $var;
- $this->has_ruby_package = true;
-
- return $this;
- }
-
- public function hasRubyPackage()
- {
- return $this->has_ruby_package;
- }
-
- /**
- * The parser stores options it doesn't recognize here.
- * See the documentation for the "Options" section above.
+ * The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @return \Google\Protobuf\Internal\RepeatedField
@@ -1021,8 +838,7 @@ class FileOptions extends \Google\Protobuf\Internal\Message
}
/**
- * The parser stores options it doesn't recognize here.
- * See the documentation for the "Options" section above.
+ * The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
index 3dd60bf6e1..4dd56ef893 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
@@ -2,14 +2,14 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\FileOptions;
+namespace Google\Protobuf\Internal;
/**
* Generated classes can be optimized for speed or code size.
*
- * Protobuf type <code>google.protobuf.FileOptions.OptimizeMode</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
*/
-class OptimizeMode
+class FileOptions_OptimizeMode
{
/**
* Generate complete code for parsing, serialization,
@@ -31,6 +31,3 @@ class OptimizeMode
const LITE_RUNTIME = 3;
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(OptimizeMode::class, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php
index 402d542f39..402d542f39 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBJsonWire.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBJsonWire.php
index 9ae57ab36c..97789356c2 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBJsonWire.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBJsonWire.php
@@ -38,26 +38,19 @@ class GPBJsonWire
public static function serializeFieldToStream(
$value,
$field,
- &$output, $has_field_name = true)
+ &$output)
{
- if ($has_field_name) {
- $output->writeRaw("\"", 1);
- $field_name = GPBJsonWire::formatFieldName($field);
- $output->writeRaw($field_name, strlen($field_name));
- $output->writeRaw("\":", 2);
- }
- return static::serializeFieldValueToStream(
- $value,
- $field,
- $output,
- !$has_field_name);
+ $output->writeRaw("\"", 1);
+ $field_name = GPBJsonWire::formatFieldName($field);
+ $output->writeRaw($field_name, strlen($field_name));
+ $output->writeRaw("\":", 2);
+ return static::serializeFieldValueToStream($value, $field, $output);
}
- public static function serializeFieldValueToStream(
+ private static function serializeFieldValueToStream(
$values,
$field,
- &$output,
- $is_well_known = false)
+ &$output)
{
if ($field->isMap()) {
$output->writeRaw("{", 1);
@@ -91,8 +84,7 @@ class GPBJsonWire
if (!static::serializeSingularFieldValueToStream(
$key,
$key_field,
- $output,
- $is_well_known)) {
+ $output)) {
return false;
}
if ($additional_quote) {
@@ -102,8 +94,7 @@ class GPBJsonWire
if (!static::serializeSingularFieldValueToStream(
$value,
$value_field,
- $output,
- $is_well_known)) {
+ $output)) {
return false;
}
}
@@ -121,8 +112,7 @@ class GPBJsonWire
if (!static::serializeSingularFieldValueToStream(
$value,
$field,
- $output,
- $is_well_known)) {
+ $output)) {
return false;
}
}
@@ -132,15 +122,14 @@ class GPBJsonWire
return static::serializeSingularFieldValueToStream(
$values,
$field,
- $output,
- $is_well_known);
+ $output);
}
}
private static function serializeSingularFieldValueToStream(
$value,
$field,
- &$output, $is_well_known = false)
+ &$output)
{
switch ($field->getType()) {
case GPBType::SFIXED32:
@@ -197,10 +186,6 @@ class GPBJsonWire
break;
case GPBType::ENUM:
$enum_desc = $field->getEnumType();
- if ($enum_desc->getClass() === "Google\Protobuf\NullValue") {
- $output->writeRaw("null", 4);
- break;
- }
$enum_value_desc = $enum_desc->getValueByNumber($value);
if (!is_null($enum_value_desc)) {
$str_value = $enum_value_desc->getName();
@@ -220,11 +205,7 @@ class GPBJsonWire
}
break;
case GPBType::BYTES:
- $bytes_value = base64_encode($value);
- $output->writeRaw("\"", 1);
- $output->writeRaw($bytes_value, strlen($bytes_value));
- $output->writeRaw("\"", 1);
- break;
+ $value = base64_encode($value);
case GPBType::STRING:
$value = json_encode($value);
$output->writeRaw($value, strlen($value));
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBLabel.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBLabel.php
index 0fb238415b..0fb238415b 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBLabel.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBLabel.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBType.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBType.php
index fa849ceb06..fa849ceb06 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBType.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBType.php
diff --git a/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBUtil.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBUtil.php
new file mode 100644
index 0000000000..6fe360687d
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBUtil.php
@@ -0,0 +1,343 @@
+<?php
+
+// 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.
+
+namespace Google\Protobuf\Internal;
+
+use Google\Protobuf\Internal\GPBType;
+use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\MapField;
+
+class GPBUtil
+{
+ public static function divideInt64ToInt32($value, &$high, &$low, $trim = false)
+ {
+ $isNeg = (bccomp($value, 0) < 0);
+ if ($isNeg) {
+ $value = bcsub(0, $value);
+ }
+
+ $high = bcdiv($value, 4294967296);
+ $low = bcmod($value, 4294967296);
+ if (bccomp($high, 2147483647) > 0) {
+ $high = (int) bcsub($high, 4294967296);
+ } else {
+ $high = (int) $high;
+ }
+ if (bccomp($low, 2147483647) > 0) {
+ $low = (int) bcsub($low, 4294967296);
+ } else {
+ $low = (int) $low;
+ }
+
+ if ($isNeg) {
+ $high = ~$high;
+ $low = ~$low;
+ $low++;
+ if (!$low) {
+ $high = (int)($high + 1);
+ }
+ }
+
+ if ($trim) {
+ $high = 0;
+ }
+ }
+
+ public static function checkString(&$var, $check_utf8)
+ {
+ if (is_array($var) || is_object($var)) {
+ throw new \InvalidArgumentException("Expect string.");
+ }
+ if (!is_string($var)) {
+ $var = strval($var);
+ }
+ if ($check_utf8 && !preg_match('//u', $var)) {
+ throw new \Exception("Expect utf-8 encoding.");
+ }
+ }
+
+ public static function checkEnum(&$var)
+ {
+ static::checkInt32($var);
+ }
+
+ public static function checkInt32(&$var)
+ {
+ if (is_numeric($var)) {
+ $var = intval($var);
+ } else {
+ throw new \Exception("Expect integer.");
+ }
+ }
+
+ public static function checkUint32(&$var)
+ {
+ if (is_numeric($var)) {
+ if (PHP_INT_SIZE === 8) {
+ $var = intval($var);
+ $var |= ((-(($var >> 31) & 0x1)) & ~0xFFFFFFFF);
+ } else {
+ if (bccomp($var, 0x7FFFFFFF) > 0) {
+ $var = bcsub($var, "4294967296");
+ }
+ $var = (int) $var;
+ }
+ } else {
+ throw new \Exception("Expect integer.");
+ }
+ }
+
+ public static function checkInt64(&$var)
+ {
+ if (is_numeric($var)) {
+ if (PHP_INT_SIZE == 8) {
+ $var = intval($var);
+ } else {
+ if (is_float($var) ||
+ is_integer($var) ||
+ (is_string($var) &&
+ bccomp($var, "9223372036854774784") < 0)) {
+ $var = number_format($var, 0, ".", "");
+ }
+ }
+ } else {
+ throw new \Exception("Expect integer.");
+ }
+ }
+
+ public static function checkUint64(&$var)
+ {
+ if (is_numeric($var)) {
+ if (PHP_INT_SIZE == 8) {
+ $var = intval($var);
+ } else {
+ $var = number_format($var, 0, ".", "");
+ }
+ } else {
+ throw new \Exception("Expect integer.");
+ }
+ }
+
+ public static function checkFloat(&$var)
+ {
+ if (is_float($var) || is_numeric($var)) {
+ $var = floatval($var);
+ } else {
+ throw new \Exception("Expect float.");
+ }
+ }
+
+ public static function checkDouble(&$var)
+ {
+ if (is_float($var) || is_numeric($var)) {
+ $var = floatval($var);
+ } else {
+ throw new \Exception("Expect float.");
+ }
+ }
+
+ public static function checkBool(&$var)
+ {
+ if (is_array($var) || is_object($var)) {
+ throw new \Exception("Expect boolean.");
+ }
+ $var = boolval($var);
+ }
+
+ public static function checkMessage(&$var, $klass)
+ {
+ if (!$var instanceof $klass && !is_null($var)) {
+ throw new \Exception("Expect message.");
+ }
+ }
+
+ public static function checkRepeatedField(&$var, $type, $klass = null)
+ {
+ if (!$var instanceof RepeatedField && !is_array($var)) {
+ throw new \Exception("Expect array.");
+ }
+ if (is_array($var)) {
+ $tmp = new RepeatedField($type, $klass);
+ foreach ($var as $value) {
+ $tmp[] = $value;
+ }
+ return $tmp;
+ } else {
+ if ($var->getType() != $type) {
+ throw new \Exception(
+ "Expect repeated field of different type.");
+ }
+ if ($var->getType() === GPBType::MESSAGE &&
+ $var->getClass() !== $klass) {
+ throw new \Exception(
+ "Expect repeated field of different message.");
+ }
+ return $var;
+ }
+ }
+
+ public static function checkMapField(&$var, $key_type, $value_type, $klass = null)
+ {
+ if (!$var instanceof MapField && !is_array($var)) {
+ throw new \Exception("Expect dict.");
+ }
+ if (is_array($var)) {
+ $tmp = new MapField($key_type, $value_type, $klass);
+ foreach ($var as $key => $value) {
+ $tmp[$key] = $value;
+ }
+ return $tmp;
+ } else {
+ if ($var->getKeyType() != $key_type) {
+ throw new \Exception("Expect map field of key type.");
+ }
+ if ($var->getValueType() != $value_type) {
+ throw new \Exception("Expect map field of value type.");
+ }
+ if ($var->getValueType() === GPBType::MESSAGE &&
+ $var->getValueClass() !== $klass) {
+ throw new \Exception(
+ "Expect map field of different value message.");
+ }
+ return $var;
+ }
+ }
+
+ public static function Int64($value)
+ {
+ return new Int64($value);
+ }
+
+ public static function Uint64($value)
+ {
+ return new Uint64($value);
+ }
+
+ public static function getClassNamePrefix(
+ $classname,
+ $file_proto)
+ {
+ $option = $file_proto->getOptions();
+ $prefix = is_null($option) ? "" : $option->getPhpClassPrefix();
+ if ($prefix !== "") {
+ return $prefix;
+ }
+
+ $reserved_words = array("Empty", "ECHO", "ARRAY");
+ foreach ($reserved_words as $reserved_word) {
+ if ($classname === $reserved_word) {
+ if ($file_proto->getPackage() === "google.protobuf") {
+ return "GPB";
+ } else {
+ return "PB";
+ }
+ }
+ }
+
+ return "";
+ }
+
+ public static function getClassNameWithoutPackage(
+ $name,
+ $file_proto)
+ {
+ $classname = implode('_', array_map('ucwords', explode('.', $name)));
+ return static::getClassNamePrefix($classname, $file_proto) . $classname;
+ }
+
+ public static function getFullClassName(
+ $proto,
+ $containing,
+ $file_proto,
+ &$message_name_without_package,
+ &$classname,
+ &$fullname)
+ {
+ // Full name needs to start with '.'.
+ $message_name_without_package = $proto->getName();
+ if ($containing !== "") {
+ $message_name_without_package =
+ $containing . "." . $message_name_without_package;
+ }
+
+ $package = $file_proto->getPackage();
+ if ($package === "") {
+ $fullname = "." . $message_name_without_package;
+ } else {
+ $fullname = "." . $package . "." . $message_name_without_package;
+ }
+
+ $class_name_without_package =
+ static::getClassNameWithoutPackage($message_name_without_package, $file_proto);
+
+ $option = $file_proto->getOptions();
+ if (!is_null($option) && $option->hasPhpNamespace()) {
+ $namespace = $option->getPhpNamespace();
+ if ($namespace !== "") {
+ $classname = $namespace . "\\" . $class_name_without_package;
+ return;
+ } else {
+ $classname = $class_name_without_package;
+ return;
+ }
+ }
+
+ if ($package === "") {
+ $classname = $class_name_without_package;
+ } else {
+ $classname =
+ implode('\\', array_map('ucwords', explode('.', $package))).
+ "\\".$class_name_without_package;
+ }
+ }
+
+ public static function combineInt32ToInt64($high, $low)
+ {
+ $isNeg = $high < 0;
+ if ($isNeg) {
+ $high = ~$high;
+ $low = ~$low;
+ $low++;
+ if (!$low) {
+ $high = (int) ($high + 1);
+ }
+ }
+ $result = bcadd(bcmul($high, 4294967296), $low);
+ if ($low < 0) {
+ $result = bcadd($result, 4294967296);
+ }
+ if ($isNeg) {
+ $result = bcsub(0, $result);
+ }
+ return $result;
+ }
+}
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBWire.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBWire.php
index e7eec552c8..e7eec552c8 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBWire.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBWire.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBWireType.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBWireType.php
index c1ad370e09..c1ad370e09 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBWireType.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GPBWireType.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
index f5a65bea46..ae2ad74558 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
@@ -28,20 +28,9 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
private $annotation;
private $has_annotation = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $annotation
- * An Annotation connects some span of text in generated code to an element
- * of its generating .proto file.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -61,12 +50,12 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
* of its generating .proto file.
*
* Generated from protobuf field <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
- * @param \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAnnotation($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class);
$this->annotation = $arr;
$this->has_annotation = true;
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
index 09f958d251..22ac2337c6 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\GeneratedCodeInfo;
+namespace Google\Protobuf\Internal;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>google.protobuf.GeneratedCodeInfo.Annotation</code>
*/
-class Annotation extends \Google\Protobuf\Internal\Message
+class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
{
/**
* Identifies the element in the original source .proto file. This field
@@ -48,29 +48,9 @@ class Annotation extends \Google\Protobuf\Internal\Message
private $end = 0;
private $has_end = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int[]|\Google\Protobuf\Internal\RepeatedField $path
- * Identifies the element in the original source .proto file. This field
- * is formatted the same as SourceCodeInfo.Location.path.
- * @type string $source_file
- * Identifies the filesystem path to the original source .proto.
- * @type int $begin
- * Identifies the starting offset in bytes in the generated code
- * that relates to the identified object.
- * @type int $end
- * Identifies the ending offset in bytes in the generated code that
- * relates to the identified offset. The end offset should be one past
- * the last relevant byte (so the length of the text = end - begin).
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -211,6 +191,3 @@ class Annotation extends \Google\Protobuf\Internal\Message
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Annotation::class, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php
index d22bc305b2..d22bc305b2 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php
index ed5d1660ba..ed5d1660ba 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapEntry.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapEntry.php
index 9c32f1eac7..9c32f1eac7 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapEntry.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapEntry.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapField.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapField.php
index 38736dad88..38736dad88 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapField.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapField.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapFieldIter.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapFieldIter.php
index 88e6c8b255..88e6c8b255 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MapFieldIter.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MapFieldIter.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/Message.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/Message.php
index 73ac375e5e..e1009f2f90 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/Message.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/Message.php
@@ -44,10 +44,6 @@ use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
use Google\Protobuf\Internal\MapEntry;
use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\ListValue;
-use Google\Protobuf\Value;
-use Google\Protobuf\Struct;
-use Google\Protobuf\NullValue;
/**
* Parent class of all proto messages. Users should not instantiate this class
@@ -61,40 +57,25 @@ class Message
* @ignore
*/
private $desc;
- private $unknown = "";
/**
* @ignore
*/
- public function __construct($data = NULL)
+ public function __construct($desc = NULL)
{
// MapEntry message is shared by all types of map fields, whose
// descriptors are different from each other. Thus, we cannot find a
// specific descriptor from the descriptor pool.
- if ($this instanceof MapEntry) {
- $this->initWithDescriptor($data);
- } else {
- $this->initWithGeneratedPool();
- if (is_array($data)) {
- $this->mergeFromArray($data);
- } else if (!empty($data)) {
- throw new \InvalidArgumentException(
- 'Message constructor must be an array or null.'
- );
+ if (get_class($this) === 'Google\Protobuf\Internal\MapEntry') {
+ $this->desc = $desc;
+ foreach ($desc->getField() as $field) {
+ $setter = $field->getSetter();
+ $this->$setter($this->defaultValue($field));
}
+ return;
}
- }
-
- /**
- * @ignore
- */
- private function initWithGeneratedPool()
- {
$pool = DescriptorPool::getGeneratedPool();
$this->desc = $pool->getDescriptorByClassName(get_class($this));
- if (is_null($this->desc)) {
- user_error(get_class($this) . " is not found in descriptor pool.");
- }
foreach ($this->desc->getField() as $field) {
$setter = $field->getSetter();
if ($field->isMap()) {
@@ -162,19 +143,6 @@ class Message
}
}
- /**
- * @ignore
- */
- private function initWithDescriptor(Descriptor $desc)
- {
- $this->desc = $desc;
- foreach ($desc->getField() as $field) {
- $setter = $field->getSetter();
- $defaultValue = $this->defaultValue($field);
- $this->$setter($defaultValue);
- }
- }
-
protected function readOneof($number)
{
$field = $this->desc->getFieldByNumber($number);
@@ -255,14 +223,13 @@ class Message
/**
* @ignore
*/
- private function skipField($input, $tag)
+ private static function skipField($input, $tag)
{
$number = GPBWire::getTagFieldNumber($tag);
if ($number === 0) {
throw new GPBDecodeException("Illegal field number zero.");
}
- $start = $input->current();
switch (GPBWire::getTagWireType($tag)) {
case GPBWireType::VARINT:
$uint64 = 0;
@@ -270,21 +237,21 @@ class Message
throw new GPBDecodeException(
"Unexpected EOF inside varint.");
}
- break;
+ return;
case GPBWireType::FIXED64:
$uint64 = 0;
if (!$input->readLittleEndian64($uint64)) {
throw new GPBDecodeException(
"Unexpected EOF inside fixed64.");
}
- break;
+ return;
case GPBWireType::FIXED32:
$uint32 = 0;
if (!$input->readLittleEndian32($uint32)) {
throw new GPBDecodeException(
"Unexpected EOF inside fixed32.");
}
- break;
+ return;
case GPBWireType::LENGTH_DELIMITED:
$length = 0;
if (!$input->readVarint32($length)) {
@@ -296,18 +263,13 @@ class Message
throw new GPBDecodeException(
"Unexpected EOF inside length delimited data.");
}
- break;
+ return;
case GPBWireType::START_GROUP:
case GPBWireType::END_GROUP:
throw new GPBDecodeException("Unexpected wire type.");
default:
throw new GPBDecodeException("Unexpected wire type.");
}
- $end = $input->current();
-
- $bytes = str_repeat(chr(0), CodedOutputStream::MAX_VARINT64_BYTES);
- $size = CodedOutputStream::writeVarintToArray($tag, $bytes, true);
- $this->unknown .= substr($bytes, 0, $size) . $input->substr($start, $end);
}
/**
@@ -458,7 +420,7 @@ class Message
}
if ($value_format === GPBWire::UNKNOWN) {
- $this->skipField($input, $tag);
+ self::skipField($input, $tag);
return;
} elseif ($value_format === GPBWire::NORMAL_FORMAT) {
self::parseFieldFromStreamNoTag($input, $field, $value);
@@ -496,7 +458,6 @@ class Message
*/
public function clear()
{
- $this->unknown = "";
foreach ($this->desc->getField() as $field) {
$setter = $field->getSetter();
if ($field->isMap()) {
@@ -601,43 +562,6 @@ class Message
}
/**
- * Clear all unknown fields previously parsed.
- * @return null.
- */
- public function discardUnknownFields()
- {
- $this->unknown = "";
- foreach ($this->desc->getField() as $field) {
- if ($field->getType() != GPBType::MESSAGE) {
- continue;
- }
- if ($field->isMap()) {
- $value_field = $field->getMessageType()->getFieldByNumber(2);
- if ($value_field->getType() != GPBType::MESSAGE) {
- continue;
- }
- $getter = $field->getGetter();
- $map = $this->$getter();
- foreach ($map as $key => $value) {
- $value->discardUnknownFields();
- }
- } else if ($field->getLabel() === GPBLabel::REPEATED) {
- $getter = $field->getGetter();
- $arr = $this->$getter();
- foreach ($arr as $sub) {
- $sub->discardUnknownFields();
- }
- } else if ($field->getLabel() === GPBLabel::OPTIONAL) {
- $getter = $field->getGetter();
- $sub = $this->$getter();
- if (!is_null($sub)) {
- $sub->discardUnknownFields();
- }
- }
- }
- }
-
- /**
* Merges the contents of the specified message into current message.
*
* This method merges the contents of the specified message into the
@@ -652,58 +576,58 @@ class Message
*/
public function mergeFrom($msg)
{
- if (get_class($this) !== get_class($msg)) {
- user_error("Cannot merge messages with different class.");
- return;
- }
-
- foreach ($this->desc->getField() as $field) {
- $setter = $field->getSetter();
- $getter = $field->getGetter();
- if ($field->isMap()) {
- if (count($msg->$getter()) != 0) {
- $value_field = $field->getMessageType()->getFieldByNumber(2);
- foreach ($msg->$getter() as $key => $value) {
- if ($value_field->getType() == GPBType::MESSAGE) {
- $klass = $value_field->getMessageType()->getClass();
- $copy = new $klass;
- $copy->mergeFrom($value);
-
- $this->kvUpdateHelper($field, $key, $copy);
- } else {
- $this->kvUpdateHelper($field, $key, $value);
- }
- }
- }
- } else if ($field->getLabel() === GPBLabel::REPEATED) {
- if (count($msg->$getter()) != 0) {
- foreach ($msg->$getter() as $tmp) {
- if ($field->getType() == GPBType::MESSAGE) {
- $klass = $field->getMessageType()->getClass();
- $copy = new $klass;
- $copy->mergeFrom($tmp);
- $this->appendHelper($field, $copy);
- } else {
- $this->appendHelper($field, $tmp);
- }
- }
- }
- } else if ($field->getLabel() === GPBLabel::OPTIONAL) {
- if($msg->$getter() !== $this->defaultValue($field)) {
- $tmp = $msg->$getter();
- if ($field->getType() == GPBType::MESSAGE) {
- if (is_null($this->$getter())) {
- $klass = $field->getMessageType()->getClass();
- $new_msg = new $klass;
- $this->$setter($new_msg);
- }
- $this->$getter()->mergeFrom($tmp);
- } else {
- $this->$setter($tmp);
- }
- }
- }
- }
+ if (get_class($this) !== get_class($msg)) {
+ user_error("Cannot merge messages with different class.");
+ return;
+ }
+
+ foreach ($this->desc->getField() as $field) {
+ $setter = $field->getSetter();
+ $getter = $field->getGetter();
+ if ($field->isMap()) {
+ if (count($msg->$getter()) != 0) {
+ $value_field = $field->getMessageType()->getFieldByNumber(2);
+ foreach ($msg->$getter() as $key => $value) {
+ if ($value_field->getType() == GPBType::MESSAGE) {
+ $klass = $value_field->getMessageType()->getClass();
+ $copy = new $klass;
+ $copy->mergeFrom($value);
+
+ $this->kvUpdateHelper($field, $key, $copy);
+ } else {
+ $this->kvUpdateHelper($field, $key, $value);
+ }
+ }
+ }
+ } else if ($field->getLabel() === GPBLabel::REPEATED) {
+ if (count($msg->$getter()) != 0) {
+ foreach ($msg->$getter() as $tmp) {
+ if ($field->getType() == GPBType::MESSAGE) {
+ $klass = $field->getMessageType()->getClass();
+ $copy = new $klass;
+ $copy->mergeFrom($tmp);
+ $this->appendHelper($field, $copy);
+ } else {
+ $this->appendHelper($field, $tmp);
+ }
+ }
+ }
+ } else if ($field->getLabel() === GPBLabel::OPTIONAL) {
+ if($msg->$getter() !== $this->defaultValue($field)) {
+ $tmp = $msg->$getter();
+ if ($field->getType() == GPBType::MESSAGE) {
+ if (is_null($this->$getter())) {
+ $klass = $field->getMessageType()->getClass();
+ $new_msg = new $klass;
+ $this->$setter($new_msg);
+ }
+ $this->$getter()->mergeFrom($tmp);
+ } else {
+ $this->$setter($tmp);
+ }
+ }
+ }
+ }
}
/**
@@ -766,94 +690,47 @@ class Message
$field,
$is_map_key = false)
{
+ if (is_null($value)) {
+ return $this->defaultValue($field);
+ }
switch ($field->getType()) {
case GPBType::MESSAGE:
$klass = $field->getMessageType()->getClass();
+ if (!is_object($value) && !is_array($value)) {
+ throw new \Exception("Expect message.");
+ }
$submsg = new $klass;
-
- if (is_a($submsg, "Google\Protobuf\Duration")) {
- if (is_null($value)) {
- return $this->defaultValue($field);
- } else if (!is_string($value)) {
- throw new GPBDecodeException("Expect string.");
- }
- return GPBUtil::parseDuration($value);
- } else if ($field->isTimestamp()) {
- if (is_null($value)) {
- return $this->defaultValue($field);
- } else if (!is_string($value)) {
- throw new GPBDecodeException("Expect string.");
- }
- try {
- $timestamp = GPBUtil::parseTimestamp($value);
- } catch (\Exception $e) {
- throw new GPBDecodeException(
- "Invalid RFC 3339 timestamp: ".$e->getMessage());
- }
-
- $submsg->setSeconds($timestamp->getSeconds());
- $submsg->setNanos($timestamp->getNanos());
- } else if (is_a($submsg, "Google\Protobuf\FieldMask")) {
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
- try {
- return GPBUtil::parseFieldMask($value);
- } catch (\Exception $e) {
- throw new GPBDecodeException(
- "Invalid FieldMask: ".$e->getMessage());
- }
- } else {
- if (is_null($value) &&
- !is_a($submsg, "Google\Protobuf\Value")) {
- return $this->defaultValue($field);
- }
- if (GPBUtil::hasSpecialJsonMapping($submsg)) {
- } elseif (!is_object($value) && !is_array($value)) {
- throw new GPBDecodeException("Expect message.");
- }
+ if (!is_null($value) &&
+ $klass !== "Google\Protobuf\Any") {
$submsg->mergeFromJsonArray($value);
}
return $submsg;
case GPBType::ENUM:
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
if (is_integer($value)) {
return $value;
+ } else {
+ $enum_value =
+ $field->getEnumType()->getValueByName($value);
}
- $enum_value = $field->getEnumType()->getValueByName($value);
if (!is_null($enum_value)) {
return $enum_value->getNumber();
}
- throw new GPBDecodeException(
- "Enum field only accepts integer or enum value name");
case GPBType::STRING:
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
if (!is_string($value)) {
- throw new GPBDecodeException(
- "String field only accepts string value");
+ throw new GPBDecodeException("Expect string");
}
return $value;
case GPBType::BYTES:
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
if (!is_string($value)) {
- throw new GPBDecodeException(
- "Byte field only accepts string value");
+ throw new GPBDecodeException("Expect string");
}
$proto_value = base64_decode($value, true);
if ($proto_value === false) {
- throw new GPBDecodeException("Invalid base64 characters");
+ throw new GPBDecodeException(
+ "Invalid base64 characters");
}
return $proto_value;
case GPBType::BOOL:
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
if ($is_map_key) {
if ($value === "true") {
return true;
@@ -862,18 +739,25 @@ class Message
return false;
}
throw new GPBDecodeException(
- "Bool field only accepts bool value");
+ "Bool field only accept bool value");
}
if (!is_bool($value)) {
throw new GPBDecodeException(
- "Bool field only accepts bool value");
+ "Bool field only accept bool value");
}
return $value;
case GPBType::FLOAT:
- case GPBType::DOUBLE:
- if (is_null($value)) {
- return $this->defaultValue($field);
+ if ($value === "Infinity") {
+ return INF;
+ }
+ if ($value === "-Infinity") {
+ return -INF;
+ }
+ if ($value === "NaN") {
+ return NAN;
}
+ return $value;
+ case GPBType::DOUBLE:
if ($value === "Infinity") {
return INF;
}
@@ -885,11 +769,6 @@ class Message
}
return $value;
case GPBType::INT32:
- case GPBType::SINT32:
- case GPBType::SFIXED32:
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
if (!is_numeric($value)) {
throw new GPBDecodeException(
"Invalid data type for int32 field");
@@ -904,10 +783,6 @@ class Message
}
return $value;
case GPBType::UINT32:
- case GPBType::FIXED32:
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
if (!is_numeric($value)) {
throw new GPBDecodeException(
"Invalid data type for uint32 field");
@@ -918,11 +793,6 @@ class Message
}
return $value;
case GPBType::INT64:
- case GPBType::SINT64:
- case GPBType::SFIXED64:
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
if (!is_numeric($value)) {
throw new GPBDecodeException(
"Invalid data type for int64 field");
@@ -937,10 +807,6 @@ class Message
}
return $value;
case GPBType::UINT64:
- case GPBType::FIXED64:
- if (is_null($value)) {
- return $this->defaultValue($field);
- }
if (!is_numeric($value)) {
throw new GPBDecodeException(
"Invalid data type for int64 field");
@@ -953,140 +819,14 @@ class Message
$value = bcsub($value, "18446744073709551616");
}
return $value;
+ case GPBType::FIXED64:
+ return $value;
default:
return $value;
}
}
- /**
- * Populates the message from a user-supplied PHP array. Array keys
- * correspond to Message properties and nested message properties.
- *
- * Example:
- * ```
- * $message->mergeFromArray([
- * 'name' => 'This is a message name',
- * 'interval' => [
- * 'startTime' => time() - 60,
- * 'endTime' => time(),
- * ]
- * ]);
- * ```
- *
- * @param array $array An array containing message properties and values.
- * @return null.
- * @throws Exception Invalid data.
- */
- protected function mergeFromArray(array $array)
- {
- // Just call the setters for the field names
- foreach ($array as $key => $value) {
- $field = $this->desc->getFieldByName($key);
- if (is_null($field)) {
- throw new \UnexpectedValueException(
- 'Invalid message property: ' . $key);
- }
- $setter = $field->getSetter();
- $this->$setter($value);
- }
- }
-
- protected function mergeFromJsonArray($array)
- {
- if (is_a($this, "Google\Protobuf\Any")) {
- $this->clear();
- $this->setTypeUrl($array["@type"]);
- $msg = $this->unpack();
- if (GPBUtil::hasSpecialJsonMapping($msg)) {
- $msg->mergeFromJsonArray($array["value"]);
- } else {
- unset($array["@type"]);
- $msg->mergeFromJsonArray($array);
- }
- $this->setValue($msg->serializeToString());
- return;
- }
- if (is_a($this, "Google\Protobuf\DoubleValue") ||
- is_a($this, "Google\Protobuf\FloatValue") ||
- is_a($this, "Google\Protobuf\Int64Value") ||
- is_a($this, "Google\Protobuf\UInt64Value") ||
- is_a($this, "Google\Protobuf\Int32Value") ||
- is_a($this, "Google\Protobuf\UInt32Value") ||
- is_a($this, "Google\Protobuf\BoolValue") ||
- is_a($this, "Google\Protobuf\StringValue")) {
- $this->setValue($array);
- return;
- }
- if (is_a($this, "Google\Protobuf\BytesValue")) {
- $this->setValue(base64_decode($array));
- return;
- }
- if (is_a($this, "Google\Protobuf\Duration")) {
- $this->mergeFrom(GPBUtil::parseDuration($array));
- return;
- }
- if (is_a($this, "Google\Protobuf\FieldMask")) {
- $this->mergeFrom(GPBUtil::parseFieldMask($array));
- return;
- }
- if (is_a($this, "Google\Protobuf\Timestamp")) {
- $this->mergeFrom(GPBUtil::parseTimestamp($array));
- return;
- }
- if (is_a($this, "Google\Protobuf\Struct")) {
- $fields = $this->getFields();
- foreach($array as $key => $value) {
- $v = new Value();
- $v->mergeFromJsonArray($value);
- $fields[$key] = $v;
- }
- }
- if (is_a($this, "Google\Protobuf\Value")) {
- if (is_bool($array)) {
- $this->setBoolValue($array);
- } elseif (is_string($array)) {
- $this->setStringValue($array);
- } elseif (is_null($array)) {
- $this->setNullValue(0);
- } elseif (is_double($array) || is_integer($array)) {
- $this->setNumberValue($array);
- } elseif (is_array($array)) {
- if (array_values($array) !== $array) {
- // Associative array
- $struct_value = $this->getStructValue();
- if (is_null($struct_value)) {
- $struct_value = new Struct();
- $this->setStructValue($struct_value);
- }
- foreach ($array as $key => $v) {
- $value = new Value();
- $value->mergeFromJsonArray($v);
- $values = $struct_value->getFields();
- $values[$key]= $value;
- }
- } else {
- // Array
- $list_value = $this->getListValue();
- if (is_null($list_value)) {
- $list_value = new ListValue();
- $this->setListValue($list_value);
- }
- foreach ($array as $v) {
- $value = new Value();
- $value->mergeFromJsonArray($v);
- $values = $list_value->getValues();
- $values[]= $value;
- }
- }
- } else {
- throw new GPBDecodeException("Invalid type for Value.");
- }
- return;
- }
- $this->mergeFromArrayJsonImpl($array);
- }
-
- private function mergeFromArrayJsonImpl($array)
+ private function mergeFromJsonArray($array)
{
foreach ($array as $key => $value) {
$field = $this->desc->getFieldByJsonName($key);
@@ -1096,6 +836,7 @@ class Message
continue;
}
}
+ $setter = $field->getSetter();
if ($field->isMap()) {
if (is_null($value)) {
continue;
@@ -1107,13 +848,15 @@ class Message
throw new \Exception(
"Map value field element cannot be null.");
}
- $proto_key = $this->convertJsonValueToProtoValue(
- $tmp_key,
- $key_field,
- true);
- $proto_value = $this->convertJsonValueToProtoValue(
- $tmp_value,
- $value_field);
+ $proto_key =
+ $this->convertJsonValueToProtoValue(
+ $tmp_key,
+ $key_field,
+ true);
+ $proto_value =
+ $this->convertJsonValueToProtoValue(
+ $tmp_value,
+ $value_field);
self::kvUpdateHelper($field, $proto_key, $proto_value);
}
} else if ($field->isRepeated()) {
@@ -1125,16 +868,14 @@ class Message
throw new \Exception(
"Repeated field elements cannot be null.");
}
- $proto_value = $this->convertJsonValueToProtoValue(
- $tmp,
- $field);
+ $proto_value =
+ $this->convertJsonValueToProtoValue($tmp, $field);
self::appendHelper($field, $proto_value);
}
} else {
$setter = $field->getSetter();
- $proto_value = $this->convertJsonValueToProtoValue(
- $value,
- $field);
+ $proto_value =
+ $this->convertJsonValueToProtoValue($value, $field);
if ($field->getType() === GPBType::MESSAGE) {
if (is_null($proto_value)) {
continue;
@@ -1156,14 +897,14 @@ class Message
*/
public function parseFromJsonStream($input)
{
- $array = json_decode($input->getData(), true, 512, JSON_BIGINT_AS_STRING);
+ $array = json_decode($input->getData(), JSON_BIGINT_AS_STRING);
if (is_null($array)) {
throw new GPBDecodeException(
"Cannot decode json string.");
}
try {
$this->mergeFromJsonArray($array);
- } catch (\Exception $e) {
+ } catch (Exception $e) {
throw new GPBDecodeException($e->getMessage());
}
}
@@ -1272,8 +1013,7 @@ class Message
{
$getter = $field->getGetter();
$values = $this->$getter();
- return GPBJsonWire::serializeFieldToStream(
- $values, $field, $output, !GPBUtil::hasSpecialJsonMapping($this));
+ return GPBJsonWire::serializeFieldToStream($values, $field, $output);
}
/**
@@ -1287,7 +1027,6 @@ class Message
return false;
}
}
- $output->writeRaw($this->unknown, strlen($this->unknown));
return true;
}
@@ -1296,71 +1035,22 @@ class Message
*/
public function serializeToJsonStream(&$output)
{
- if (is_a($this, 'Google\Protobuf\Any')) {
- $output->writeRaw("{", 1);
- $type_field = $this->desc->getFieldByNumber(1);
- $value_msg = $this->unpack();
-
- // Serialize type url.
- $output->writeRaw("\"@type\":", 8);
- $output->writeRaw("\"", 1);
- $output->writeRaw($this->getTypeUrl(), strlen($this->getTypeUrl()));
- $output->writeRaw("\"", 1);
-
- // Serialize value
- if (GPBUtil::hasSpecialJsonMapping($value_msg)) {
- $output->writeRaw(",\"value\":", 9);
- $value_msg->serializeToJsonStream($output);
- } else {
- $value_fields = $value_msg->desc->getField();
- foreach ($value_fields as $field) {
- if ($value_msg->existField($field)) {
- $output->writeRaw(",", 1);
- if (!$value_msg->serializeFieldToJsonStream($output, $field)) {
- return false;
- }
- }
+ $output->writeRaw("{", 1);
+ $fields = $this->desc->getField();
+ $first = true;
+ foreach ($fields as $field) {
+ if ($this->existField($field)) {
+ if ($first) {
+ $first = false;
+ } else {
+ $output->writeRaw(",", 1);
}
- }
-
- $output->writeRaw("}", 1);
- } elseif (is_a($this, 'Google\Protobuf\FieldMask')) {
- $field_mask = GPBUtil::formatFieldMask($this);
- $output->writeRaw("\"", 1);
- $output->writeRaw($field_mask, strlen($field_mask));
- $output->writeRaw("\"", 1);
- } elseif (is_a($this, 'Google\Protobuf\Duration')) {
- $duration = GPBUtil::formatDuration($this) . "s";
- $output->writeRaw("\"", 1);
- $output->writeRaw($duration, strlen($duration));
- $output->writeRaw("\"", 1);
- } elseif (get_class($this) === 'Google\Protobuf\Timestamp') {
- $timestamp = GPBUtil::formatTimestamp($this);
- $timestamp = json_encode($timestamp);
- $output->writeRaw($timestamp, strlen($timestamp));
- } else {
- if (!GPBUtil::hasSpecialJsonMapping($this)) {
- $output->writeRaw("{", 1);
- }
- $fields = $this->desc->getField();
- $first = true;
- foreach ($fields as $field) {
- if ($this->existField($field) ||
- GPBUtil::hasJsonValue($this)) {
- if ($first) {
- $first = false;
- } else {
- $output->writeRaw(",", 1);
- }
- if (!$this->serializeFieldToJsonStream($output, $field)) {
- return false;
- }
+ if (!$this->serializeFieldToJsonStream($output, $field)) {
+ return false;
}
}
- if (!GPBUtil::hasSpecialJsonMapping($this)) {
- $output->writeRaw("}", 1);
- }
}
+ $output->writeRaw("}", 1);
return true;
}
@@ -1542,10 +1232,6 @@ class Message
break;
case GPBType::ENUM:
$enum_desc = $field->getEnumType();
- if ($enum_desc->getClass() === "Google\Protobuf\NullValue") {
- $size += 4;
- break;
- }
$enum_value_desc = $enum_desc->getValueByNumber($value);
if (!is_null($enum_value_desc)) {
$size += 2; // size for ""
@@ -1567,12 +1253,6 @@ class Message
$size += strlen($value);
break;
case GPBType::BYTES:
- # if (is_a($this, "Google\Protobuf\BytesValue")) {
- # $size += strlen(json_encode($value));
- # } else {
- # $size += strlen(base64_encode($value));
- # $size += 2; // size for \"\"
- # }
$size += strlen(base64_encode($value));
$size += 2; // size for \"\"
break;
@@ -1658,17 +1338,13 @@ class Message
private function fieldJsonByteSize($field)
{
$size = 0;
-
if ($field->isMap()) {
$getter = $field->getGetter();
$values = $this->$getter();
$count = count($values);
if ($count !== 0) {
- if (!GPBUtil::hasSpecialJsonMapping($this)) {
- $size += 3; // size for "\"\":".
- $size += strlen($field->getJsonName()); // size for field name
- }
- $size += 2; // size for "{}".
+ $size += 5; // size for "\"\":{}".
+ $size += strlen($field->getJsonName()); // size for field name
$size += $count - 1; // size for commas
$getter = $field->getGetter();
$map_entry = $field->getMessageType();
@@ -1700,22 +1376,17 @@ class Message
$values = $this->$getter();
$count = count($values);
if ($count !== 0) {
- if (!GPBUtil::hasSpecialJsonMapping($this)) {
- $size += 3; // size for "\"\":".
- $size += strlen($field->getJsonName()); // size for field name
- }
- $size += 2; // size for "[]".
+ $size += 5; // size for "\"\":[]".
+ $size += strlen($field->getJsonName()); // size for field name
$size += $count - 1; // size for commas
$getter = $field->getGetter();
foreach ($values as $value) {
$size += $this->fieldDataOnlyJsonByteSize($field, $value);
}
}
- } elseif ($this->existField($field) || GPBUtil::hasJsonValue($this)) {
- if (!GPBUtil::hasSpecialJsonMapping($this)) {
- $size += 3; // size for "\"\":".
- $size += strlen($field->getJsonName()); // size for field name
- }
+ } elseif ($this->existField($field)) {
+ $size += 3; // size for "\"\":".
+ $size += strlen($field->getJsonName()); // size for field name
$getter = $field->getGetter();
$value = $this->$getter();
$size += $this->fieldDataOnlyJsonByteSize($field, $value);
@@ -1734,7 +1405,6 @@ class Message
foreach ($fields as $field) {
$size += $this->fieldByteSize($field);
}
- $size += strlen($this->unknown);
return $size;
}
@@ -1770,53 +1440,21 @@ class Message
public function jsonByteSize()
{
$size = 0;
- if (is_a($this, 'Google\Protobuf\Any')) {
- // Size for "{}".
- $size += 2;
- // Size for "\"@type\":".
- $size += 8;
-
- // Size for url. +2 for "" /.
- $size += strlen($this->getTypeUrl()) + 2;
-
- $value_msg = $this->unpack();
- if (GPBUtil::hasSpecialJsonMapping($value_msg)) {
- // Size for "\",value\":".
- $size += 9;
- $size += $value_msg->jsonByteSize();
- } else {
- // Size for value. +1 for comma, -2 for "{}".
- $size += $value_msg->jsonByteSize() -1;
- }
- } elseif (get_class($this) === 'Google\Protobuf\FieldMask') {
- $field_mask = GPBUtil::formatFieldMask($this);
- $size += strlen($field_mask) + 2; // 2 for ""
- } elseif (get_class($this) === 'Google\Protobuf\Duration') {
- $duration = GPBUtil::formatDuration($this) . "s";
- $size += strlen($duration) + 2; // 2 for ""
- } elseif (get_class($this) === 'Google\Protobuf\Timestamp') {
- $timestamp = GPBUtil::formatTimestamp($this);
- $timestamp = json_encode($timestamp);
- $size += strlen($timestamp);
- } else {
- if (!GPBUtil::hasSpecialJsonMapping($this)) {
- // Size for "{}".
- $size += 2;
- }
+ // Size for "{}".
+ $size += 2;
- $fields = $this->desc->getField();
- $count = 0;
- foreach ($fields as $field) {
- $field_size = $this->fieldJsonByteSize($field);
- $size += $field_size;
- if ($field_size != 0) {
- $count++;
- }
+ $fields = $this->desc->getField();
+ $count = 0;
+ foreach ($fields as $field) {
+ $field_size = $this->fieldJsonByteSize($field);
+ $size += $field_size;
+ if ($field_size != 0) {
+ $count++;
}
- // size for comma
- $size += $count > 0 ? ($count - 1) : 0;
}
+ // size for comma
+ $size += $count > 0 ? ($count - 1) : 0;
return $size;
}
}
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php
index 2724d2673d..2724d2673d 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MessageOptions.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MessageOptions.php
index bf490de686..99ff3d0ee2 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MessageOptions.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MessageOptions.php
@@ -87,63 +87,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
private $uninterpreted_option;
private $has_uninterpreted_option = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type bool $message_set_wire_format
- * Set true to use the old proto1 MessageSet wire format for extensions.
- * This is provided for backwards-compatibility with the MessageSet wire
- * format. You should not use this for any other reason: It's less
- * efficient, has fewer features, and is more complicated.
- * The message must be defined exactly as follows:
- * message Foo {
- * option message_set_wire_format = true;
- * extensions 4 to max;
- * }
- * Note that the message cannot have any defined fields; MessageSets only
- * have extensions.
- * All extensions of your type must be singular messages; e.g. they cannot
- * be int32s, enums, or repeated messages.
- * Because this is an option, the above two restrictions are not enforced by
- * the protocol compiler.
- * @type bool $no_standard_descriptor_accessor
- * Disables the generation of the standard "descriptor()" accessor, which can
- * conflict with a field of the same name. This is meant to make migration
- * from proto1 easier; new code should avoid fields named "descriptor".
- * @type bool $deprecated
- * Is this message deprecated?
- * Depending on the target platform, this can emit Deprecated annotations
- * for the message, or it will be completely ignored; in the very least,
- * this is a formalization for deprecating messages.
- * @type bool $map_entry
- * Whether the message is an automatically generated map entry type for the
- * maps field.
- * For maps fields:
- * map<KeyType, ValueType> map_field = 1;
- * The parsed descriptor looks like:
- * message MapFieldEntry {
- * option map_entry = true;
- * optional KeyType key = 1;
- * optional ValueType value = 2;
- * }
- * repeated MapFieldEntry map_field = 1;
- * Implementations may choose not to generate the map_entry=true message, but
- * use a native map in the target language to hold the keys and values.
- * The reflection APIs in such implementions still need to work as
- * if the field is a repeated message field.
- * NOTE: Do not set the option in .proto files. Always use the maps syntax
- * instead. The option should only be implicitly set by the proto compiler
- * parser.
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here. See above.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
index 1bd5dd3e1c..ccfce2dbd6 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
@@ -55,27 +55,9 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
private $server_streaming = false;
private $has_server_streaming = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * @type string $input_type
- * Input and output type names. These are resolved in the same way as
- * FieldDescriptorProto.type_name, but must refer to a message type.
- * @type string $output_type
- * @type \Google\Protobuf\Internal\MethodOptions $options
- * @type bool $client_streaming
- * Identifies if client streams multiple client messages
- * @type bool $server_streaming
- * Identifies if server streams multiple server messages
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodOptions.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodOptions.php
index a2c729a9bb..baa806b7aa 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodOptions.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodOptions.php
@@ -38,25 +38,9 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
private $uninterpreted_option;
private $has_uninterpreted_option = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type bool $deprecated
- * Is this method deprecated?
- * Depending on the target platform, this can emit Deprecated annotations
- * for the method, or it will be completely ignored; in the very least,
- * this is a formalization for deprecating methods.
- * @type int $idempotency_level
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here. See above.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
index dcc30e271c..9e06d8eea5 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
@@ -2,16 +2,16 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\MethodOptions;
+namespace Google\Protobuf\Internal;
/**
* Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
* or neither? HTTP based RPC implementation may choose GET verb for safe
* methods, and PUT verb for idempotent methods instead of the default POST.
*
- * Protobuf type <code>google.protobuf.MethodOptions.IdempotencyLevel</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
*/
-class IdempotencyLevel
+class MethodOptions_IdempotencyLevel
{
/**
* Generated from protobuf enum <code>IDEMPOTENCY_UNKNOWN = 0;</code>
@@ -31,6 +31,3 @@ class IdempotencyLevel
const IDEMPOTENT = 2;
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(IdempotencyLevel::class, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofDescriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofDescriptor.php
index 67b107f6a4..67b107f6a4 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofDescriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofDescriptor.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
index 9ecfe5cbfe..15ff061074 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
@@ -28,19 +28,9 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message
private $options = null;
private $has_options = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * @type \Google\Protobuf\Internal\OneofOptions $options
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofField.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofField.php
index 2c689e836c..2c689e836c 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofField.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofField.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofOptions.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofOptions.php
index 46b516f301..e5b4633d59 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/OneofOptions.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/OneofOptions.php
@@ -23,19 +23,9 @@ class OneofOptions extends \Google\Protobuf\Internal\Message
private $uninterpreted_option;
private $has_uninterpreted_option = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here. See above.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RawInputStream.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RawInputStream.php
index 4e7ed5cb42..4e7ed5cb42 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RawInputStream.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RawInputStream.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RepeatedField.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RepeatedField.php
index 797b3b3a9c..797b3b3a9c 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RepeatedField.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RepeatedField.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php
index 2b6f82309b..2b6f82309b 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
index 8de7afd0bc..da88e9c444 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
@@ -33,20 +33,9 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
private $options = null;
private $has_options = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * @type \Google\Protobuf\Internal\MethodDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $method
- * @type \Google\Protobuf\Internal\ServiceOptions $options
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ServiceOptions.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/ServiceOptions.php
index 67162f3764..3e7214a1eb 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ServiceOptions.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/ServiceOptions.php
@@ -33,24 +33,9 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
private $uninterpreted_option;
private $has_uninterpreted_option = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type bool $deprecated
- * Is this service deprecated?
- * Depending on the target platform, this can emit Deprecated annotations
- * for the service, or it will be completely ignored; in the very least,
- * this is a formalization for deprecating services.
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here. See above.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
index 6e413f77a2..6ce05ed420 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
@@ -66,59 +66,9 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
private $location;
private $has_location = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $location
- * A Location identifies a piece of source code in a .proto file which
- * corresponds to a particular definition. This information is intended
- * to be useful to IDEs, code indexers, documentation generators, and similar
- * tools.
- * For example, say we have a file like:
- * message Foo {
- * optional string foo = 1;
- * }
- * Let's look at just the field definition:
- * optional string foo = 1;
- * ^ ^^ ^^ ^ ^^^
- * a bc de f ghi
- * We have the following locations:
- * span path represents
- * [a,i) [ 4, 0, 2, 0 ] The whole field definition.
- * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
- * [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
- * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
- * [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
- * Notes:
- * - A location may refer to a repeated field itself (i.e. not to any
- * particular index within it). This is used whenever a set of elements are
- * logically enclosed in a single code segment. For example, an entire
- * extend block (possibly containing multiple extension definitions) will
- * have an outer location whose path refers to the "extensions" repeated
- * field without an index.
- * - Multiple locations may have the same path. This happens when a single
- * logical declaration is spread out across multiple places. The most
- * obvious example is the "extend" block again -- there may be multiple
- * extend blocks in the same scope, each of which will have the same path.
- * - A location's span is not always a subset of its parent's span. For
- * example, the "extendee" of an extension declaration appears at the
- * beginning of the "extend" block and is shared by all extensions within
- * the block.
- * - Just because a location's span is a subset of some other location's span
- * does not mean that it is a descendent. For example, a "group" defines
- * both a type and a field in a single declaration. Thus, the locations
- * corresponding to the type and field and their components will overlap.
- * - Code which tries to interpret locations should probably be designed to
- * ignore those that it doesn't understand, as more types of locations could
- * be recorded in the future.
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -216,12 +166,12 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
* be recorded in the future.
*
* Generated from protobuf field <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
- * @param \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\SourceCodeInfo_Location[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLocation($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo\Location::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class);
$this->location = $arr;
$this->has_location = true;
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
index bad247a11f..19ed2bc229 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\SourceCodeInfo;
+namespace Google\Protobuf\Internal;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>google.protobuf.SourceCodeInfo.Location</code>
*/
-class Location extends \Google\Protobuf\Internal\Message
+class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
{
/**
* Identifies which part of the FileDescriptorProto was defined at this
@@ -106,84 +106,9 @@ class Location extends \Google\Protobuf\Internal\Message
private $leading_detached_comments;
private $has_leading_detached_comments = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int[]|\Google\Protobuf\Internal\RepeatedField $path
- * Identifies which part of the FileDescriptorProto was defined at this
- * location.
- * Each element is a field number or an index. They form a path from
- * the root FileDescriptorProto to the place where the definition. For
- * example, this path:
- * [ 4, 3, 2, 7, 1 ]
- * refers to:
- * file.message_type(3) // 4, 3
- * .field(7) // 2, 7
- * .name() // 1
- * This is because FileDescriptorProto.message_type has field number 4:
- * repeated DescriptorProto message_type = 4;
- * and DescriptorProto.field has field number 2:
- * repeated FieldDescriptorProto field = 2;
- * and FieldDescriptorProto.name has field number 1:
- * optional string name = 1;
- * Thus, the above path gives the location of a field name. If we removed
- * the last element:
- * [ 4, 3, 2, 7 ]
- * this path refers to the whole field declaration (from the beginning
- * of the label to the terminating semicolon).
- * @type int[]|\Google\Protobuf\Internal\RepeatedField $span
- * Always has exactly three or four elements: start line, start column,
- * end line (optional, otherwise assumed same as start line), end column.
- * These are packed into a single field for efficiency. Note that line
- * and column numbers are zero-based -- typically you will want to add
- * 1 to each before displaying to a user.
- * @type string $leading_comments
- * If this SourceCodeInfo represents a complete declaration, these are any
- * comments appearing before and after the declaration which appear to be
- * attached to the declaration.
- * A series of line comments appearing on consecutive lines, with no other
- * tokens appearing on those lines, will be treated as a single comment.
- * leading_detached_comments will keep paragraphs of comments that appear
- * before (but not connected to) the current element. Each paragraph,
- * separated by empty lines, will be one comment element in the repeated
- * field.
- * Only the comment content is provided; comment markers (e.g. //) are
- * stripped out. For block comments, leading whitespace and an asterisk
- * will be stripped from the beginning of each line other than the first.
- * Newlines are included in the output.
- * Examples:
- * optional int32 foo = 1; // Comment attached to foo.
- * // Comment attached to bar.
- * optional int32 bar = 2;
- * optional string baz = 3;
- * // Comment attached to baz.
- * // Another line attached to baz.
- * // Comment attached to qux.
- * //
- * // Another line attached to qux.
- * optional double qux = 4;
- * // Detached comment for corge. This is not leading or trailing comments
- * // to qux or corge because there are blank lines separating it from
- * // both.
- * // Detached comment for corge paragraph 2.
- * optional string corge = 5;
- * /&#42; Block comment attached
- * * to corge. Leading asterisks
- * * will be removed. *&#47;
- * /&#42; Block comment attached to
- * * grault. *&#47;
- * optional int32 grault = 6;
- * // ignored detached comments.
- * @type string $trailing_comments
- * @type string[]|\Google\Protobuf\Internal\RepeatedField $leading_detached_comments
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -458,6 +383,3 @@ class Location extends \Google\Protobuf\Internal\Message
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Location::class, \Google\Protobuf\Internal\SourceCodeInfo_Location::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php
index 3b517ec552..4d342eb33b 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php
@@ -61,26 +61,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
private $aggregate_value = '';
private $has_aggregate_value = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $name
- * @type string $identifier_value
- * The value of the uninterpreted option, in whatever type the tokenizer
- * identified it as during parsing. Exactly one of these should be set.
- * @type int|string $positive_int_value
- * @type int|string $negative_int_value
- * @type float $double_value
- * @type string $string_value
- * @type string $aggregate_value
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -94,12 +77,12 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
- * @param \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\UninterpretedOption_NamePart[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setName($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption\NamePart::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class);
$this->name = $arr;
$this->has_name = true;
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
index 92ee4b44b9..c9a6fc3c7f 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal\UninterpretedOption;
+namespace Google\Protobuf\Internal;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -19,7 +19,7 @@ use Google\Protobuf\Internal\GPBUtil;
*
* Generated from protobuf message <code>google.protobuf.UninterpretedOption.NamePart</code>
*/
-class NamePart extends \Google\Protobuf\Internal\Message
+class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>required string name_part = 1;</code>
@@ -32,19 +32,9 @@ class NamePart extends \Google\Protobuf\Internal\Message
private $is_extension = false;
private $has_is_extension = false;
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name_part
- * @type bool $is_extension
- * }
- */
- public function __construct($data = NULL) {
+ public function __construct() {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
+ parent::__construct();
}
/**
@@ -105,6 +95,3 @@ class NamePart extends \Google\Protobuf\Internal\Message
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(NamePart::class, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/OneofDescriptor.php b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/OneofDescriptor.php
index d9736634e3..d9736634e3 100644
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/OneofDescriptor.php
+++ b/third_party/protobuf/3.4.0/php/src/Google/Protobuf/OneofDescriptor.php
diff --git a/third_party/protobuf/3.6.0/php/src/phpdoc.dist.xml b/third_party/protobuf/3.4.0/php/src/phpdoc.dist.xml
index dd3130253f..dd3130253f 100644
--- a/third_party/protobuf/3.6.0/php/src/phpdoc.dist.xml
+++ b/third_party/protobuf/3.4.0/php/src/phpdoc.dist.xml
diff --git a/third_party/protobuf/3.6.0/php/tests/array_test.php b/third_party/protobuf/3.4.0/php/tests/array_test.php
index 36a649ed19..1a26d72a88 100644
--- a/third_party/protobuf/3.6.0/php/tests/array_test.php
+++ b/third_party/protobuf/3.4.0/php/tests/array_test.php
@@ -5,7 +5,7 @@ require_once('test_util.php');
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBType;
use Foo\TestMessage;
-use Foo\TestMessage\Sub;
+use Foo\TestMessage_Sub;
class RepeatedFieldTest extends PHPUnit_Framework_TestCase
{
@@ -456,10 +456,10 @@ class RepeatedFieldTest extends PHPUnit_Framework_TestCase
public function testMessage()
{
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
// Test append.
- $sub_m = new Sub();
+ $sub_m = new TestMessage_Sub();
$sub_m->setA(1);
$arr[] = $sub_m;
$this->assertSame(1, $arr[0]->getA());
@@ -467,15 +467,15 @@ class RepeatedFieldTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, count($arr));
// Test set.
- $sub_m = new Sub();
+ $sub_m = new TestMessage_Sub();
$sub_m->setA(2);
$arr[0] = $sub_m;
$this->assertSame(2, $arr[0]->getA());
// Test foreach.
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
for ($i = 0; $i < 3; $i++) {
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
$arr[$i]->setA($i);
}
$i = 0;
diff --git a/third_party/protobuf/3.6.0/php/tests/autoload.php b/third_party/protobuf/3.4.0/php/tests/autoload.php
index b98b13abdf..0a917fc51a 100644..100755
--- a/third_party/protobuf/3.6.0/php/tests/autoload.php
+++ b/third_party/protobuf/3.4.0/php/tests/autoload.php
@@ -1,7 +1,5 @@
<?php
-error_reporting(E_ALL);
-
function getGeneratedFiles($dir, &$results = array())
{
$files = scandir($dir);
diff --git a/third_party/protobuf/3.6.0/php/tests/compatibility_test.sh b/third_party/protobuf/3.4.0/php/tests/compatibility_test.sh
index 7caa46e7ad..6f1e49000b 100644..100755
--- a/third_party/protobuf/3.6.0/php/tests/compatibility_test.sh
+++ b/third_party/protobuf/3.4.0/php/tests/compatibility_test.sh
@@ -20,6 +20,7 @@ function generate_proto() {
$PROTOC1 --php_out=generated proto/test_include.proto
$PROTOC2 --php_out=generated proto/test.proto proto/test_no_namespace.proto proto/test_prefix.proto
pushd ../../src
+ $PROTOC2 --php_out=../php/tests/generated google/protobuf/empty.proto
$PROTOC2 --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto
popd
}
diff --git a/third_party/protobuf/3.6.0/php/tests/descriptors_test.php b/third_party/protobuf/3.4.0/php/tests/descriptors_test.php
index 93683b82fd..17e8a4f2fd 100644
--- a/third_party/protobuf/3.6.0/php/tests/descriptors_test.php
+++ b/third_party/protobuf/3.4.0/php/tests/descriptors_test.php
@@ -10,7 +10,7 @@ use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\MapField;
use Descriptors\TestDescriptorsEnum;
use Descriptors\TestDescriptorsMessage;
-use Descriptors\TestDescriptorsMessage\Sub;
+use Descriptors\TestDescriptorsMessage_Sub;
class DescriptorsTest extends TestBase
{
diff --git a/third_party/protobuf/3.6.0/php/tests/encode_decode_test.php b/third_party/protobuf/3.4.0/php/tests/encode_decode_test.php
index d36b883e1e..b43dffb4fe 100644
--- a/third_party/protobuf/3.6.0/php/tests/encode_decode_test.php
+++ b/third_party/protobuf/3.4.0/php/tests/encode_decode_test.php
@@ -7,7 +7,7 @@ use Google\Protobuf\RepeatedField;
use Google\Protobuf\GPBType;
use Foo\TestEnum;
use Foo\TestMessage;
-use Foo\TestMessage\Sub;
+use Foo\TestMessage_Sub;
use Foo\TestPackedMessage;
use Foo\TestRandomFieldOrder;
use Foo\TestUnpackedMessage;
@@ -82,7 +82,7 @@ class EncodeDecodeTest extends TestBase
$n->mergeFromString($data);
$this->assertSame('abc', $n->getOneofString());
- $sub_m = new Sub();
+ $sub_m = new TestMessage_Sub();
$sub_m->setA(1);
$m->setOneofMessage($sub_m);
$data = $m->serializeToString();
@@ -105,7 +105,7 @@ class EncodeDecodeTest extends TestBase
$this->assertSame("oneof_string", $n->getMyOneof());
$this->assertSame("", $n->getOneofString());
- $sub_m = new Sub();
+ $sub_m = new TestMessage_Sub();
$m->setOneofMessage($sub_m);
$data = $m->serializeToString();
$n = new TestMessage();
@@ -441,78 +441,6 @@ class EncodeDecodeTest extends TestBase
$m->mergeFromString(hex2bin('D205'));
}
- public function testUnknown()
- {
- // Test preserve unknown for varint.
- $m = new TestMessage();
- $from = hex2bin('F80601'); // TODO(teboring): Add a util to encode
- // varint for better readability
- $m->mergeFromString($from);
- $to = $m->serializeToString();
- $this->assertSame(bin2hex($from), bin2hex($to));
-
- // Test preserve unknown for 64-bit.
- $m = new TestMessage();
- $from = hex2bin('F9060000000000000000');
- $m->mergeFromString($from);
- $to = $m->serializeToString();
- $this->assertSame(bin2hex($from), bin2hex($to));
-
- // Test preserve unknown for length delimited.
- $m = new TestMessage();
- $from = hex2bin('FA0600');
- $m->mergeFromString($from);
- $to = $m->serializeToString();
- $this->assertSame(bin2hex($from), bin2hex($to));
-
- // Test preserve unknown for 32-bit.
- $m = new TestMessage();
- $from = hex2bin('FD0600000000');
- $m->mergeFromString($from);
- $to = $m->serializeToString();
- $this->assertSame(bin2hex($from), bin2hex($to));
-
- // Test discard unknown in message.
- $m = new TestMessage();
- $from = hex2bin('F80601');
- $m->mergeFromString($from);
- $m->discardUnknownFields();
- $to = $m->serializeToString();
- $this->assertSame("", bin2hex($to));
-
- // Test discard unknown for singular message field.
- $m = new TestMessage();
- $from = hex2bin('8A0103F80601');
- $m->mergeFromString($from);
- $m->discardUnknownFields();
- $to = $m->serializeToString();
- $this->assertSame("8a0100", bin2hex($to));
-
- // Test discard unknown for repeated message field.
- $m = new TestMessage();
- $from = hex2bin('FA0203F80601');
- $m->mergeFromString($from);
- $m->discardUnknownFields();
- $to = $m->serializeToString();
- $this->assertSame("fa0200", bin2hex($to));
-
- // Test discard unknown for map message value field.
- $m = new TestMessage();
- $from = hex2bin("BA050708011203F80601");
- $m->mergeFromString($from);
- $m->discardUnknownFields();
- $to = $m->serializeToString();
- $this->assertSame("ba050408011200", bin2hex($to));
-
- // Test discard unknown for singular message field.
- $m = new TestMessage();
- $from = hex2bin('9A0403F80601');
- $m->mergeFromString($from);
- $m->discardUnknownFields();
- $to = $m->serializeToString();
- $this->assertSame("9a0400", bin2hex($to));
- }
-
public function testJsonEncode()
{
$from = new TestMessage();
diff --git a/third_party/protobuf/3.6.0/php/tests/gdb_test.sh b/third_party/protobuf/3.4.0/php/tests/gdb_test.sh
index 36fa31bbb2..484e2edfbb 100644..100755
--- a/third_party/protobuf/3.6.0/php/tests/gdb_test.sh
+++ b/third_party/protobuf/3.4.0/php/tests/gdb_test.sh
@@ -1,17 +1,9 @@
#!/bin/bash
-VERSION=$1
-
-export PATH=/usr/local/php-$VERSION/bin:$PATH
-export C_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$C_INCLUDE_PATH
-export CPLUS_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$CPLUS_INCLUDE_PATH
-
-php -i | grep "Configuration"
-
# gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which
# phpunit` --bootstrap autoload.php tmp_test.php
#
-gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php generated_class_test.php
+gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php encode_decode_test.php
#
# gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
#
diff --git a/third_party/protobuf/3.4.0/php/tests/generated_class_test.php b/third_party/protobuf/3.4.0/php/tests/generated_class_test.php
new file mode 100644
index 0000000000..86e68683c0
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/tests/generated_class_test.php
@@ -0,0 +1,718 @@
+<?php
+
+require_once('generated/NoNamespaceEnum.php');
+require_once('generated/NoNamespaceMessage.php');
+require_once('test_base.php');
+require_once('test_util.php');
+
+use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\MapField;
+use Google\Protobuf\Internal\GPBType;
+use Foo\TestEnum;
+use Foo\TestIncludeNamespaceMessage;
+use Foo\TestIncludePrefixMessage;
+use Foo\TestMessage;
+use Foo\TestMessage_Sub;
+use Foo\TestReverseFieldOrder;
+use Php\Test\TestNamespace;
+
+class GeneratedClassTest extends TestBase
+{
+
+ #########################################################
+ # Test field accessors.
+ #########################################################
+
+ public function testSetterGetter()
+ {
+ $m = new TestMessage();
+ $m->setOptionalInt32(1);
+ $this->assertSame(1, $m->getOptionalInt32());
+ }
+
+ #########################################################
+ # Test int32 field.
+ #########################################################
+
+ public function testInt32Field()
+ {
+ $m = new TestMessage();
+
+ // Set integer.
+ $m->setOptionalInt32(MAX_INT32);
+ $this->assertSame(MAX_INT32, $m->getOptionalInt32());
+ $m->setOptionalInt32(MIN_INT32);
+ $this->assertSame(MIN_INT32, $m->getOptionalInt32());
+
+ // Set float.
+ $m->setOptionalInt32(1.1);
+ $this->assertSame(1, $m->getOptionalInt32());
+ $m->setOptionalInt32(MAX_INT32_FLOAT);
+ $this->assertSame(MAX_INT32, $m->getOptionalInt32());
+ $m->setOptionalInt32(MIN_INT32_FLOAT);
+ $this->assertSame(MIN_INT32, $m->getOptionalInt32());
+
+ // Set string.
+ $m->setOptionalInt32('2');
+ $this->assertSame(2, $m->getOptionalInt32());
+ $m->setOptionalInt32('3.1');
+ $this->assertSame(3, $m->getOptionalInt32());
+ $m->setOptionalInt32(MAX_INT32_STRING);
+ $this->assertSame(MAX_INT32, $m->getOptionalInt32());
+ $m->setOptionalInt32(MIN_INT32_STRING);
+ $this->assertSame(MIN_INT32, $m->getOptionalInt32());
+ }
+
+ #########################################################
+ # Test uint32 field.
+ #########################################################
+
+ public function testUint32Field()
+ {
+ $m = new TestMessage();
+
+ // Set integer.
+ $m->setOptionalUint32(MAX_UINT32);
+ $this->assertSame(-1, $m->getOptionalUint32());
+ $m->setOptionalUint32(-1);
+ $this->assertSame(-1, $m->getOptionalUint32());
+ $m->setOptionalUint32(MIN_UINT32);
+ $this->assertSame(MIN_INT32, $m->getOptionalUint32());
+
+ // Set float.
+ $m->setOptionalUint32(1.1);
+ $this->assertSame(1, $m->getOptionalUint32());
+ $m->setOptionalUint32(MAX_UINT32_FLOAT);
+ $this->assertSame(-1, $m->getOptionalUint32());
+ $m->setOptionalUint32(-1.0);
+ $this->assertSame(-1, $m->getOptionalUint32());
+ $m->setOptionalUint32(MIN_UINT32_FLOAT);
+ $this->assertSame(MIN_INT32, $m->getOptionalUint32());
+
+ // Set string.
+ $m->setOptionalUint32('2');
+ $this->assertSame(2, $m->getOptionalUint32());
+ $m->setOptionalUint32('3.1');
+ $this->assertSame(3, $m->getOptionalUint32());
+ $m->setOptionalUint32(MAX_UINT32_STRING);
+ $this->assertSame(-1, $m->getOptionalUint32());
+ $m->setOptionalUint32('-1.0');
+ $this->assertSame(-1, $m->getOptionalUint32());
+ $m->setOptionalUint32(MIN_UINT32_STRING);
+ $this->assertSame(MIN_INT32, $m->getOptionalUint32());
+ }
+
+ #########################################################
+ # Test int64 field.
+ #########################################################
+
+ public function testInt64Field()
+ {
+ $m = new TestMessage();
+
+ // Set integer.
+ $m->setOptionalInt64(MAX_INT64);
+ $this->assertSame(MAX_INT64, $m->getOptionalInt64());
+ $m->setOptionalInt64(MIN_INT64);
+ $this->assertEquals(MIN_INT64, $m->getOptionalInt64());
+
+ // Set float.
+ $m->setOptionalInt64(1.1);
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame('1', $m->getOptionalInt64());
+ } else {
+ $this->assertSame(1, $m->getOptionalInt64());
+ }
+
+ // Set string.
+ $m->setOptionalInt64('2');
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame('2', $m->getOptionalInt64());
+ } else {
+ $this->assertSame(2, $m->getOptionalInt64());
+ }
+
+ $m->setOptionalInt64('3.1');
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame('3', $m->getOptionalInt64());
+ } else {
+ $this->assertSame(3, $m->getOptionalInt64());
+ }
+
+ $m->setOptionalInt64(MAX_INT64_STRING);
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame(MAX_INT64_STRING, $m->getOptionalInt64());
+ } else {
+ $this->assertSame(MAX_INT64, $m->getOptionalInt64());
+ }
+
+ $m->setOptionalInt64(MIN_INT64_STRING);
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame(MIN_INT64_STRING, $m->getOptionalInt64());
+ } else {
+ $this->assertSame(MIN_INT64, $m->getOptionalInt64());
+ }
+ }
+
+ #########################################################
+ # Test uint64 field.
+ #########################################################
+
+ public function testUint64Field()
+ {
+ $m = new TestMessage();
+
+ // Set integer.
+ $m->setOptionalUint64(MAX_UINT64);
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame(MAX_UINT64_STRING, $m->getOptionalUint64());
+ } else {
+ $this->assertSame(MAX_UINT64, $m->getOptionalUint64());
+ }
+
+ // Set float.
+ $m->setOptionalUint64(1.1);
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame('1', $m->getOptionalUint64());
+ } else {
+ $this->assertSame(1, $m->getOptionalUint64());
+ }
+
+ // Set string.
+ $m->setOptionalUint64('2');
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame('2', $m->getOptionalUint64());
+ } else {
+ $this->assertSame(2, $m->getOptionalUint64());
+ }
+
+ $m->setOptionalUint64('3.1');
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame('3', $m->getOptionalUint64());
+ } else {
+ $this->assertSame(3, $m->getOptionalUint64());
+ }
+
+ $m->setOptionalUint64(MAX_UINT64_STRING);
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame(MAX_UINT64_STRING, $m->getOptionalUint64());
+ } else {
+ $this->assertSame(MAX_UINT64, $m->getOptionalUint64());
+ }
+ }
+
+ #########################################################
+ # Test enum field.
+ #########################################################
+
+ public function testEnumField()
+ {
+ $m = new TestMessage();
+
+ // Set enum.
+ $m->setOptionalEnum(TestEnum::ONE);
+ $this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
+
+ // Set integer.
+ $m->setOptionalEnum(1);
+ $this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
+
+ // Set float.
+ $m->setOptionalEnum(1.1);
+ $this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
+
+ // Set string.
+ $m->setOptionalEnum("1");
+ $this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
+ }
+
+ public function testNestedEnum()
+ {
+ $m = new TestMessage();
+ $m->setOptionalNestedEnum(\Foo\TestMessage_NestedEnum::ZERO);
+ }
+
+ #########################################################
+ # Test float field.
+ #########################################################
+
+ public function testFloatField()
+ {
+ $m = new TestMessage();
+
+ // Set integer.
+ $m->setOptionalFloat(1);
+ $this->assertEquals(1.0, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
+
+ // Set float.
+ $m->setOptionalFloat(1.1);
+ $this->assertEquals(1.1, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
+
+ // Set string.
+ $m->setOptionalFloat('2');
+ $this->assertEquals(2.0, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
+ $m->setOptionalFloat('3.1');
+ $this->assertEquals(3.1, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
+ }
+
+ #########################################################
+ # Test double field.
+ #########################################################
+
+ public function testDoubleField()
+ {
+ $m = new TestMessage();
+
+ // Set integer.
+ $m->setOptionalDouble(1);
+ $this->assertEquals(1.0, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
+
+ // Set float.
+ $m->setOptionalDouble(1.1);
+ $this->assertEquals(1.1, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
+
+ // Set string.
+ $m->setOptionalDouble('2');
+ $this->assertEquals(2.0, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
+ $m->setOptionalDouble('3.1');
+ $this->assertEquals(3.1, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
+ }
+
+ #########################################################
+ # Test bool field.
+ #########################################################
+
+ public function testBoolField()
+ {
+ $m = new TestMessage();
+
+ // Set bool.
+ $m->setOptionalBool(true);
+ $this->assertSame(true, $m->getOptionalBool());
+
+ // Set integer.
+ $m->setOptionalBool(-1);
+ $this->assertSame(true, $m->getOptionalBool());
+
+ // Set float.
+ $m->setOptionalBool(1.1);
+ $this->assertSame(true, $m->getOptionalBool());
+
+ // Set string.
+ $m->setOptionalBool('');
+ $this->assertSame(false, $m->getOptionalBool());
+ }
+
+ #########################################################
+ # Test string field.
+ #########################################################
+
+ public function testStringField()
+ {
+ $m = new TestMessage();
+
+ // Set string.
+ $m->setOptionalString('abc');
+ $this->assertSame('abc', $m->getOptionalString());
+
+ // Set integer.
+ $m->setOptionalString(1);
+ $this->assertSame('1', $m->getOptionalString());
+
+ // Set double.
+ $m->setOptionalString(1.1);
+ $this->assertSame('1.1', $m->getOptionalString());
+
+ // Set bool.
+ $m->setOptionalString(true);
+ $this->assertSame('1', $m->getOptionalString());
+ }
+
+ #########################################################
+ # Test bytes field.
+ #########################################################
+
+ public function testBytesField()
+ {
+ $m = new TestMessage();
+
+ // Set string.
+ $m->setOptionalBytes('abc');
+ $this->assertSame('abc', $m->getOptionalBytes());
+
+ // Set integer.
+ $m->setOptionalBytes(1);
+ $this->assertSame('1', $m->getOptionalBytes());
+
+ // Set double.
+ $m->setOptionalBytes(1.1);
+ $this->assertSame('1.1', $m->getOptionalBytes());
+
+ // Set bool.
+ $m->setOptionalBytes(true);
+ $this->assertSame('1', $m->getOptionalBytes());
+ }
+
+ public function testBytesFieldInvalidUTF8Success()
+ {
+ $m = new TestMessage();
+ $hex = hex2bin("ff");
+ $m->setOptionalBytes($hex);
+ }
+
+ #########################################################
+ # Test message field.
+ #########################################################
+
+ public function testMessageField()
+ {
+ $m = new TestMessage();
+
+ $sub_m = new TestMessage_Sub();
+ $sub_m->setA(1);
+ $m->setOptionalMessage($sub_m);
+ $this->assertSame(1, $m->getOptionalMessage()->getA());
+
+ $null = null;
+ $m->setOptionalMessage($null);
+ $this->assertNull($m->getOptionalMessage());
+ }
+
+ #########################################################
+ # Test repeated field.
+ #########################################################
+
+ public function testRepeatedField()
+ {
+ $m = new TestMessage();
+
+ $repeated_int32 = new RepeatedField(GPBType::INT32);
+ $m->setRepeatedInt32($repeated_int32);
+ $this->assertSame($repeated_int32, $m->getRepeatedInt32());
+ }
+
+ public function testRepeatedFieldViaArray()
+ {
+ $m = new TestMessage();
+
+ $arr = array();
+ $m->setRepeatedInt32($arr);
+ $this->assertSame(0, count($m->getRepeatedInt32()));
+
+ $arr = array(1, 2.1, "3");
+ $m->setRepeatedInt32($arr);
+ $this->assertTrue($m->getRepeatedInt32() instanceof RepeatedField);
+ $this->assertSame("Google\Protobuf\Internal\RepeatedField",
+ get_class($m->getRepeatedInt32()));
+ $this->assertSame(3, count($m->getRepeatedInt32()));
+ $this->assertSame(1, $m->getRepeatedInt32()[0]);
+ $this->assertSame(2, $m->getRepeatedInt32()[1]);
+ $this->assertSame(3, $m->getRepeatedInt32()[2]);
+ $this->assertFalse($arr instanceof RepeatedField);
+ }
+
+ #########################################################
+ # Test map field.
+ #########################################################
+
+ public function testMapField()
+ {
+ $m = new TestMessage();
+
+ $map_int32_int32 = new MapField(GPBType::INT32, GPBType::INT32);
+ $m->setMapInt32Int32($map_int32_int32);
+ $this->assertSame($map_int32_int32, $m->getMapInt32Int32());
+ }
+
+ public function testMapFieldViaArray()
+ {
+ $m = new TestMessage();
+
+ $dict = array();
+ $m->setMapInt32Int32($dict);
+ $this->assertSame(0, count($m->getMapInt32Int32()));
+
+ $dict = array(5 => 5, 6.1 => 6.1, "7" => "7");
+ $m->setMapInt32Int32($dict);
+ $this->assertTrue($m->getMapInt32Int32() instanceof MapField);
+ $this->assertSame(3, count($m->getMapInt32Int32()));
+ $this->assertSame(5, $m->getMapInt32Int32()[5]);
+ $this->assertSame(6, $m->getMapInt32Int32()[6]);
+ $this->assertSame(7, $m->getMapInt32Int32()[7]);
+ $this->assertFalse($dict instanceof MapField);
+ }
+
+ #########################################################
+ # Test oneof field.
+ #########################################################
+
+ public function testOneofField() {
+ $m = new TestMessage();
+
+ $this->assertSame("", $m->getMyOneof());
+
+ $m->setOneofInt32(1);
+ $this->assertSame(1, $m->getOneofInt32());
+ $this->assertSame(0.0, $m->getOneofFloat());
+ $this->assertSame('', $m->getOneofString());
+ $this->assertSame(NULL, $m->getOneofMessage());
+ $this->assertSame("oneof_int32", $m->getMyOneof());
+
+ $m->setOneofFloat(2.0);
+ $this->assertSame(0, $m->getOneofInt32());
+ $this->assertSame(2.0, $m->getOneofFloat());
+ $this->assertSame('', $m->getOneofString());
+ $this->assertSame(NULL, $m->getOneofMessage());
+ $this->assertSame("oneof_float", $m->getMyOneof());
+
+ $m->setOneofString('abc');
+ $this->assertSame(0, $m->getOneofInt32());
+ $this->assertSame(0.0, $m->getOneofFloat());
+ $this->assertSame('abc', $m->getOneofString());
+ $this->assertSame(NULL, $m->getOneofMessage());
+ $this->assertSame("oneof_string", $m->getMyOneof());
+
+ $sub_m = new TestMessage_Sub();
+ $sub_m->setA(1);
+ $m->setOneofMessage($sub_m);
+ $this->assertSame(0, $m->getOneofInt32());
+ $this->assertSame(0.0, $m->getOneofFloat());
+ $this->assertSame('', $m->getOneofString());
+ $this->assertSame(1, $m->getOneofMessage()->getA());
+ $this->assertSame("oneof_message", $m->getMyOneof());
+ }
+
+ #########################################################
+ # Test clear method.
+ #########################################################
+
+ public function testMessageClear()
+ {
+ $m = new TestMessage();
+ $this->setFields($m);
+ $this->expectFields($m);
+ $m->clear();
+ $this->expectEmptyFields($m);
+ }
+
+ #########################################################
+ # Test mergeFrom method.
+ #########################################################
+
+ public function testMessageMergeFrom()
+ {
+ $m = new TestMessage();
+ $this->setFields($m);
+ $this->expectFields($m);
+ $arr = $m->getOptionalMessage()->getB();
+ $arr[] = 1;
+
+ $n = new TestMessage();
+
+ // Singular
+ $n->setOptionalInt32(100);
+ $sub1 = new TestMessage_Sub();
+ $sub1->setA(101);
+
+ $b = $sub1->getB();
+ $b[] = 102;
+ $sub1->setB($b);
+
+ $n->setOptionalMessage($sub1);
+
+ // Repeated
+ $repeatedInt32 = $n->getRepeatedInt32();
+ $repeatedInt32[] = 200;
+ $n->setRepeatedInt32($repeatedInt32);
+
+ $repeatedString = $n->getRepeatedString();
+ $repeatedString[] = 'abc';
+ $n->setRepeatedString($repeatedString);
+
+ $sub2 = new TestMessage_Sub();
+ $sub2->setA(201);
+ $repeatedMessage = $n->getRepeatedMessage();
+ $repeatedMessage[] = $sub2;
+ $n->setRepeatedMessage($repeatedMessage);
+
+ // Map
+ $mapInt32Int32 = $n->getMapInt32Int32();
+ $mapInt32Int32[1] = 300;
+ $mapInt32Int32[-62] = 301;
+ $n->setMapInt32Int32($mapInt32Int32);
+
+ $mapStringString = $n->getMapStringString();
+ $mapStringString['def'] = 'def';
+ $n->setMapStringString($mapStringString);
+
+ $mapInt32Message = $n->getMapInt32Message();
+ $mapInt32Message[1] = new TestMessage_Sub();
+ $mapInt32Message[1]->setA(302);
+ $mapInt32Message[2] = new TestMessage_Sub();
+ $mapInt32Message[2]->setA(303);
+ $n->setMapInt32Message($mapInt32Message);
+
+ $m->mergeFrom($n);
+
+ $this->assertSame(100, $m->getOptionalInt32());
+ $this->assertSame(42, $m->getOptionalUint32());
+ $this->assertSame(101, $m->getOptionalMessage()->getA());
+ $this->assertSame(2, count($m->getOptionalMessage()->getB()));
+ $this->assertSame(1, $m->getOptionalMessage()->getB()[0]);
+ $this->assertSame(102, $m->getOptionalMessage()->getB()[1]);
+
+ $this->assertSame(3, count($m->getRepeatedInt32()));
+ $this->assertSame(200, $m->getRepeatedInt32()[2]);
+ $this->assertSame(2, count($m->getRepeatedUint32()));
+ $this->assertSame(3, count($m->getRepeatedString()));
+ $this->assertSame('abc', $m->getRepeatedString()[2]);
+ $this->assertSame(3, count($m->getRepeatedMessage()));
+ $this->assertSame(201, $m->getRepeatedMessage()[2]->getA());
+
+ $this->assertSame(2, count($m->getMapInt32Int32()));
+ $this->assertSame(300, $m->getMapInt32Int32()[1]);
+ $this->assertSame(301, $m->getMapInt32Int32()[-62]);
+ $this->assertSame(1, count($m->getMapUint32Uint32()));
+ $this->assertSame(2, count($m->getMapStringString()));
+ $this->assertSame('def', $m->getMapStringString()['def']);
+
+ $this->assertSame(2, count($m->getMapInt32Message()));
+ $this->assertSame(302, $m->getMapInt32Message()[1]->getA());
+ $this->assertSame(303, $m->getMapInt32Message()[2]->getA());
+
+ $this->assertSame("", $m->getMyOneof());
+
+ // Check sub-messages are copied by value.
+ $n->getOptionalMessage()->setA(-101);
+ $this->assertSame(101, $m->getOptionalMessage()->getA());
+
+ $repeatedMessage = $n->getRepeatedMessage();
+ $repeatedMessage[0]->setA(-201);
+ $n->setRepeatedMessage($repeatedMessage);
+ $this->assertSame(201, $m->getRepeatedMessage()[2]->getA());
+
+ $mapInt32Message = $n->getMapInt32Message();
+ $mapInt32Message[1]->setA(-302);
+ $n->setMapInt32Message($mapInt32Message);
+
+ $this->assertSame(302, $m->getMapInt32Message()[1]->getA());
+
+ // Test merge oneof.
+ $m = new TestMessage();
+
+ $n = new TestMessage();
+ $n->setOneofInt32(1);
+ $m->mergeFrom($n);
+ $this->assertSame(1, $m->getOneofInt32());
+
+ $sub = new TestMessage_Sub();
+ $n->setOneofMessage($sub);
+ $n->getOneofMessage()->setA(400);
+ $m->mergeFrom($n);
+ $this->assertSame(400, $m->getOneofMessage()->getA());
+ $n->getOneofMessage()->setA(-400);
+ $this->assertSame(400, $m->getOneofMessage()->getA());
+
+ // Test all fields
+ $m = new TestMessage();
+ $n = new TestMessage();
+ $this->setFields($m);
+ $n->mergeFrom($m);
+ $this->expectFields($n);
+ }
+
+ #########################################################
+ # Test message/enum without namespace.
+ #########################################################
+
+ public function testMessageWithoutNamespace()
+ {
+ $m = new TestMessage();
+ $sub = new NoNameSpaceMessage();
+ $m->setOptionalNoNamespaceMessage($sub);
+ $repeatedNoNamespaceMessage = $m->getRepeatedNoNamespaceMessage();
+ $repeatedNoNamespaceMessage[] = new NoNameSpaceMessage();
+ $m->setRepeatedNoNamespaceMessage($repeatedNoNamespaceMessage);
+
+ $n = new NoNamespaceMessage();
+ $n->setB(NoNamespaceMessage_NestedEnum::ZERO);
+ }
+
+ public function testEnumWithoutNamespace()
+ {
+ $m = new TestMessage();
+ $m->setOptionalNoNamespaceEnum(NoNameSpaceEnum::VALUE_A);
+ $repeatedNoNamespaceEnum = $m->getRepeatedNoNamespaceEnum();
+ $repeatedNoNamespaceEnum[] = NoNameSpaceEnum::VALUE_A;
+ $m->setRepeatedNoNamespaceEnum($repeatedNoNamespaceEnum);
+ }
+
+ #########################################################
+ # Test message with given prefix.
+ #########################################################
+
+ public function testPrefixMessage()
+ {
+ $m = new TestIncludePrefixMessage();
+ $n = new PrefixTestPrefix();
+ $n->setA(1);
+ $m->setPrefixMessage($n);
+ $this->assertSame(1, $m->getPrefixMessage()->getA());
+ }
+
+ #########################################################
+ # Test message with given namespace.
+ #########################################################
+
+ public function testNamespaceMessage()
+ {
+ $m = new TestIncludeNamespaceMessage();
+
+ $n = new TestNamespace();
+ $n->setA(1);
+ $m->setNamespaceMessage($n);
+ $this->assertSame(1, $m->getNamespaceMessage()->getA());
+
+ $n = new TestEmptyNamespace();
+ $n->setA(1);
+ $m->setEmptyNamespaceMessage($n);
+ $this->assertSame(1, $m->getEmptyNamespaceMessage()->getA());
+ }
+
+ #########################################################
+ # Test prefix for reserved words.
+ #########################################################
+
+ public function testPrefixForReservedWords()
+ {
+ $m = new \Foo\TestMessage_Empty();
+ $m = new \Foo\PBEmpty();
+ $m = new \PrefixEmpty();
+ $m = new \Foo\PBARRAY();
+ }
+
+ #########################################################
+ # Test fluent setters.
+ #########################################################
+
+ public function testFluentSetters()
+ {
+ $m = (new TestMessage())
+ ->setOptionalInt32(1)
+ ->setOptionalUInt32(2);
+ $this->assertSame(1, $m->getOptionalInt32());
+ $this->assertSame(2, $m->getOptionalUInt32());
+ }
+
+ #########################################################
+ # Test Reverse Field Order.
+ #########################################################
+
+ public function testReverseFieldOrder()
+ {
+ $m = new TestReverseFieldOrder();
+ $m->setB("abc");
+ $this->assertSame("abc", $m->getB());
+ $this->assertNotSame("abc", $m->getA());
+ }
+}
diff --git a/third_party/protobuf/3.6.0/php/tests/generated_phpdoc_test.php b/third_party/protobuf/3.4.0/php/tests/generated_phpdoc_test.php
index 526927fc28..6c1a26f7a2 100644
--- a/third_party/protobuf/3.6.0/php/tests/generated_phpdoc_test.php
+++ b/third_party/protobuf/3.4.0/php/tests/generated_phpdoc_test.php
@@ -16,14 +16,6 @@ class GeneratedPhpdocTest extends TestBase
$this->assertContains('foo.TestMessage', $doc);
}
- public function testPhpDocForConstructor()
- {
- $class = new ReflectionClass('Foo\TestMessage');
- $doc = $class->getMethod('__construct')->getDocComment();
- $this->assertContains('@param array $data', $doc);
- $this->assertContains('@type int $optional_int32', $doc);
- }
-
/**
* @dataProvider providePhpDocForGettersAndSetters
*/
@@ -201,7 +193,7 @@ class GeneratedPhpdocTest extends TestBase
[
'setRepeatedMessage',
],
- '@param \Foo\TestMessage\Sub[]|\Google\Protobuf\Internal\RepeatedField $var'
+ '@param \Foo\TestMessage_Sub[]|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[
@@ -294,14 +286,14 @@ class GeneratedPhpdocTest extends TestBase
'getOptionalMessage',
'getOneofMessage'
],
- '@return \Foo\TestMessage\Sub'
+ '@return \Foo\TestMessage_Sub'
],
[
[
'setOptionalMessage',
'setOneofMessage'
],
- '@param \Foo\TestMessage\Sub $var'
+ '@param \Foo\TestMessage_Sub $var'
],
[
[
diff --git a/third_party/protobuf/3.6.0/php/tests/generated_service_test.php b/third_party/protobuf/3.4.0/php/tests/generated_service_test.php
index 5407db9a3e..5407db9a3e 100644
--- a/third_party/protobuf/3.6.0/php/tests/generated_service_test.php
+++ b/third_party/protobuf/3.4.0/php/tests/generated_service_test.php
diff --git a/third_party/protobuf/3.6.0/php/tests/map_field_test.php b/third_party/protobuf/3.4.0/php/tests/map_field_test.php
index 447bdd9b36..cffa2526d0 100644
--- a/third_party/protobuf/3.6.0/php/tests/map_field_test.php
+++ b/third_party/protobuf/3.4.0/php/tests/map_field_test.php
@@ -5,7 +5,7 @@ require_once('test_util.php');
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\MapField;
use Foo\TestMessage;
-use Foo\TestMessage\Sub;
+use Foo\TestMessage_Sub;
class MapFieldTest extends PHPUnit_Framework_TestCase {
@@ -408,10 +408,10 @@ class MapFieldTest extends PHPUnit_Framework_TestCase {
public function testMessage() {
$arr = new MapField(GPBType::INT32,
- GPBType::MESSAGE, Sub::class);
+ GPBType::MESSAGE, TestMessage_Sub::class);
// Test append.
- $sub_m = new Sub();
+ $sub_m = new TestMessage_Sub();
$sub_m->setA(1);
$arr[0] = $sub_m;
$this->assertSame(1, $arr[0]->getA());
@@ -420,9 +420,9 @@ class MapFieldTest extends PHPUnit_Framework_TestCase {
// Test foreach.
$arr = new MapField(GPBType::INT32,
- GPBType::MESSAGE, Sub::class);
+ GPBType::MESSAGE, TestMessage_Sub::class);
for ($i = 0; $i < 3; $i++) {
- $arr[$i] = new Sub();;
+ $arr[$i] = new TestMessage_Sub();;
$arr[$i]->setA($i);
}
$i = 0;
diff --git a/third_party/protobuf/3.4.0/php/tests/memory_leak_test.php b/third_party/protobuf/3.4.0/php/tests/memory_leak_test.php
new file mode 100644
index 0000000000..a92694d05c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/tests/memory_leak_test.php
@@ -0,0 +1,106 @@
+<?php
+
+# phpunit has memory leak by itself. Thus, it cannot be used to test memory leak.
+
+require_once('generated/NoNamespaceEnum.php');
+require_once('generated/NoNamespaceMessage.php');
+require_once('generated/NoNamespaceMessage_NestedEnum.php');
+require_once('generated/PrefixEmpty.php');
+require_once('generated/PrefixTestPrefix.php');
+require_once('generated/TestEmptyNamespace.php');
+require_once('generated/Bar/TestInclude.php');
+require_once('generated/Foo/PBARRAY.php');
+require_once('generated/Foo/PBEmpty.php');
+require_once('generated/Foo/TestEnum.php');
+require_once('generated/Foo/TestIncludeNamespaceMessage.php');
+require_once('generated/Foo/TestIncludePrefixMessage.php');
+require_once('generated/Foo/TestMessage.php');
+require_once('generated/Foo/TestMessage_Empty.php');
+require_once('generated/Foo/TestMessage_NestedEnum.php');
+require_once('generated/Foo/TestMessage_Sub.php');
+require_once('generated/Foo/TestPackedMessage.php');
+require_once('generated/Foo/TestPhpDoc.php');
+require_once('generated/Foo/TestRandomFieldOrder.php');
+require_once('generated/Foo/TestReverseFieldOrder.php');
+require_once('generated/Foo/TestUnpackedMessage.php');
+require_once('generated/GPBMetadata/Proto/Test.php');
+require_once('generated/GPBMetadata/Proto/TestEmptyPhpNamespace.php');
+require_once('generated/GPBMetadata/Proto/TestInclude.php');
+require_once('generated/GPBMetadata/Proto/TestNoNamespace.php');
+require_once('generated/GPBMetadata/Proto/TestPhpNamespace.php');
+require_once('generated/GPBMetadata/Proto/TestPrefix.php');
+require_once('generated/Php/Test/TestNamespace.php');
+require_once('test_util.php');
+
+use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\GPBType;
+use Foo\TestMessage;
+use Foo\TestMessage_Sub;
+
+$from = new TestMessage();
+TestUtil::setTestMessage($from);
+TestUtil::assertTestMessage($from);
+
+$data = $from->serializeToString();
+
+$to = new TestMessage();
+$to->mergeFromString($data);
+
+TestUtil::assertTestMessage($to);
+
+$from->setRecursive($from);
+
+$arr = new RepeatedField(GPBType::MESSAGE, TestMessage::class);
+$arr[] = new TestMessage;
+$arr[0]->SetRepeatedRecursive($arr);
+
+// Test oneof fields.
+$m = new TestMessage();
+
+$m->setOneofInt32(1);
+assert(1 === $m->getOneofInt32());
+assert(0.0 === $m->getOneofFloat());
+assert('' === $m->getOneofString());
+assert(NULL === $m->getOneofMessage());
+$data = $m->serializeToString();
+$n = new TestMessage();
+$n->mergeFromString($data);
+assert(1 === $n->getOneofInt32());
+
+$m->setOneofFloat(2.0);
+assert(0 === $m->getOneofInt32());
+assert(2.0 === $m->getOneofFloat());
+assert('' === $m->getOneofString());
+assert(NULL === $m->getOneofMessage());
+$data = $m->serializeToString();
+$n = new TestMessage();
+$n->mergeFromString($data);
+assert(2.0 === $n->getOneofFloat());
+
+$m->setOneofString('abc');
+assert(0 === $m->getOneofInt32());
+assert(0.0 === $m->getOneofFloat());
+assert('abc' === $m->getOneofString());
+assert(NULL === $m->getOneofMessage());
+$data = $m->serializeToString();
+$n = new TestMessage();
+$n->mergeFromString($data);
+assert('abc' === $n->getOneofString());
+
+$sub_m = new TestMessage_Sub();
+$sub_m->setA(1);
+$m->setOneofMessage($sub_m);
+assert(0 === $m->getOneofInt32());
+assert(0.0 === $m->getOneofFloat());
+assert('' === $m->getOneofString());
+assert(1 === $m->getOneofMessage()->getA());
+$data = $m->serializeToString();
+$n = new TestMessage();
+$n->mergeFromString($data);
+assert(1 === $n->getOneofMessage()->getA());
+
+# $from = new TestMessage();
+# $to = new TestMessage();
+# TestUtil::setTestMessage($from);
+# $to->mergeFrom($from);
+# TestUtil::assertTestMessage($to);
diff --git a/third_party/protobuf/3.6.0/php/tests/php_implementation_test.php b/third_party/protobuf/3.4.0/php/tests/php_implementation_test.php
index 323a36ff09..5dbc9233cf 100644
--- a/third_party/protobuf/3.6.0/php/tests/php_implementation_test.php
+++ b/third_party/protobuf/3.4.0/php/tests/php_implementation_test.php
@@ -3,9 +3,8 @@
require_once('test_base.php');
require_once('test_util.php');
-use Foo\TestEnum;
use Foo\TestMessage;
-use Foo\TestMessage\Sub;
+use Foo\TestMessage_Sub;
use Foo\TestPackedMessage;
use Google\Protobuf\Internal\CodedInputStream;
use Google\Protobuf\Internal\FileDescriptorSet;
@@ -16,6 +15,7 @@ use Google\Protobuf\Internal\CodedOutputStream;
class ImplementationTest extends TestBase
{
+
public function testReadInt32()
{
$value = null;
@@ -513,75 +513,4 @@ class ImplementationTest extends TestBase
TestUtil::setTestPackedMessage($m);
$this->assertSame(166, $m->byteSize());
}
-
- /**
- * @expectedException UnexpectedValueException
- * @expectedExceptionMessage Invalid message property: optionalInt32
- */
- public function testArrayConstructorJsonCaseThrowsException()
- {
- $m = new TestMessage([
- 'optionalInt32' => -42,
- ]);
- }
-
- /**
- * @expectedException Exception
- * @expectedExceptionMessage Expect Foo\TestMessage_Sub.
- */
- public function testArraysForMessagesThrowsException()
- {
- $m = new TestMessage([
- 'optional_message' => [
- 'a' => 33
- ]
- ]);
- }
-
- public function testArrayConstructorWithNullValues()
- {
- $requestData = [
- 'optional_bool' => null,
- 'optional_string' => null,
- 'optional_bytes' => null,
- 'optional_message' => null,
- ];
-
- $m = new TestMessage($requestData);
-
- $this->assertSame(false, $m->getOptionalBool());
- $this->assertSame('', $m->getOptionalString());
- $this->assertSame('', $m->getOptionalBytes());
- $this->assertSame(null, $m->getOptionalMessage());
- }
-
- /**
- * @dataProvider provideArrayConstructorWithNullValuesThrowsException
- * @expectedException Exception
- */
- public function testArrayConstructorWithNullValuesThrowsException($requestData)
- {
- $m = new TestMessage($requestData);
- }
-
- public function provideArrayConstructorWithNullValuesThrowsException()
- {
- return [
- [['optional_int32' => null]],
- [['optional_int64' => null]],
- [['optional_uint32' => null]],
- [['optional_uint64' => null]],
- [['optional_sint32' => null]],
- [['optional_sint64' => null]],
- [['optional_fixed32' => null]],
- [['optional_fixed64' => null]],
- [['optional_sfixed32' => null]],
- [['optional_sfixed64' => null]],
- [['optional_float' => null]],
- [['optional_double' => null]],
- [['optional_enum' => null]],
- [['repeated_int32' => null]],
- [['map_int32_int32' => null]],
- ];
- }
}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test.proto b/third_party/protobuf/3.4.0/php/tests/proto/test.proto
index d0109d83a5..a90f3d1d7a 100644
--- a/third_party/protobuf/3.6.0/php/tests/proto/test.proto
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test.proto
@@ -115,8 +115,6 @@ message TestMessage {
message Empty {
int32 a = 1;
}
-
- reserved 111;
}
enum TestEnum {
@@ -194,10 +192,3 @@ message TestReverseFieldOrder {
repeated int32 a = 2;
string b = 1;
}
-
-message testLowerCaseMessage {
-}
-
-enum testLowerCaseEnum {
- VALUE = 0;
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_descriptors.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_descriptors.proto
index d42aec7cec..d42aec7cec 100644
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_descriptors.proto
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_descriptors.proto
diff --git a/third_party/protobuf/3.4.0/php/tests/proto/test_empty_php_namespace.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_empty_php_namespace.proto
new file mode 100644
index 0000000000..7b4bc74d14
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_empty_php_namespace.proto
@@ -0,0 +1,8 @@
+syntax = "proto3";
+
+package foo;
+option php_namespace = "";
+
+message TestEmptyNamespace {
+ int32 a = 1;
+}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_import_descriptor_proto.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_import_descriptor_proto.proto
index 2a19940dec..2a19940dec 100644
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_import_descriptor_proto.proto
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_import_descriptor_proto.proto
diff --git a/third_party/protobuf/3.4.0/php/tests/proto/test_include.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_include.proto
new file mode 100644
index 0000000000..9844617fa8
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_include.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+package bar;
+
+message TestInclude {
+ int32 a = 1;
+}
diff --git a/third_party/protobuf/3.4.0/php/tests/proto/test_no_namespace.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_no_namespace.proto
new file mode 100644
index 0000000000..58f13d47bc
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_no_namespace.proto
@@ -0,0 +1,16 @@
+syntax = "proto3";
+
+message NoNamespaceMessage {
+ int32 a = 1;
+
+ enum NestedEnum {
+ ZERO = 0;
+ }
+ NestedEnum b = 2;
+ repeated NestedEnum c = 3;
+}
+
+enum NoNamespaceEnum {
+ VALUE_A = 0;
+ VALUE_B = 1;
+}
diff --git a/third_party/protobuf/3.4.0/php/tests/proto/test_php_namespace.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_php_namespace.proto
new file mode 100644
index 0000000000..713187b9b0
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_php_namespace.proto
@@ -0,0 +1,8 @@
+syntax = "proto3";
+
+package foo;
+option php_namespace = "Php\\Test";
+
+message TestNamespace {
+ int32 a = 1;
+}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_prefix.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_prefix.proto
index 3fa11381b0..9bfbad7f82 100644
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_prefix.proto
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_prefix.proto
@@ -4,14 +4,6 @@ option php_class_prefix = "Prefix";
message TestPrefix {
int32 a = 1;
- NestedMessage nested_message = 2;
- NestedEnum nested_enum = 3;
- message NestedMessage {
- int32 a = 1;
- }
- enum NestedEnum {
- ZERO = 0;
- };
}
// Test prefix for reserved words.
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_service.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_service.proto
index a03dbc46d7..a03dbc46d7 100644
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_service.proto
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_service.proto
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_service_namespace.proto b/third_party/protobuf/3.4.0/php/tests/proto/test_service_namespace.proto
index 719aa484ef..719aa484ef 100644
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_service_namespace.proto
+++ b/third_party/protobuf/3.4.0/php/tests/proto/test_service_namespace.proto
diff --git a/third_party/protobuf/3.6.0/php/tests/test.sh b/third_party/protobuf/3.4.0/php/tests/test.sh
index 6e70eb2ab9..c35372d308 100644..100755
--- a/third_party/protobuf/3.6.0/php/tests/test.sh
+++ b/third_party/protobuf/3.4.0/php/tests/test.sh
@@ -1,11 +1,5 @@
#!/bin/bash
-VERSION=$1
-
-export PATH=/usr/local/php-$VERSION/bin:$PATH
-export C_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$C_INCLUDE_PATH
-export CPLUS_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$CPLUS_INCLUDE_PATH
-
# Compile c extension
pushd ../ext/google/protobuf/
make clean || true
@@ -31,15 +25,3 @@ done
export ZEND_DONT_UNLOAD_MODULES=1
export USE_ZEND_ALLOC=0
valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
-
-# TODO(teboring): Only for debug (phpunit has memory leak which blocks this beging used by
-# regresssion test.)
-
-# for t in "${tests[@]}"
-# do
-# echo "****************************"
-# echo "* $t (memory leak)"
-# echo "****************************"
-# valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t
-# echo ""
-# done
diff --git a/third_party/protobuf/3.6.0/php/tests/test_base.php b/third_party/protobuf/3.4.0/php/tests/test_base.php
index 80f603c77a..dc5e73f579 100644
--- a/third_party/protobuf/3.6.0/php/tests/test_base.php
+++ b/third_party/protobuf/3.4.0/php/tests/test_base.php
@@ -2,7 +2,7 @@
use Foo\TestMessage;
use Foo\TestEnum;
-use Foo\TestMessage\Sub;
+use Foo\TestMessage_Sub;
class TestBase extends PHPUnit_Framework_TestCase
{
diff --git a/third_party/protobuf/3.6.0/php/tests/test_util.php b/third_party/protobuf/3.4.0/php/tests/test_util.php
index a676d097ed..c8afdd3e79 100644
--- a/third_party/protobuf/3.6.0/php/tests/test_util.php
+++ b/third_party/protobuf/3.4.0/php/tests/test_util.php
@@ -2,7 +2,7 @@
use Foo\TestEnum;
use Foo\TestMessage;
-use Foo\TestMessage\Sub;
+use Foo\TestMessage_Sub;
use Foo\TestPackedMessage;
use Foo\TestUnpackedMessage;
@@ -67,7 +67,7 @@ class TestUtil
$m->setOptionalString('a');
$m->setOptionalBytes('b');
$m->setOptionalEnum(TestEnum::ONE);
- $sub = new Sub();
+ $sub = new TestMessage_Sub();
$m->setOptionalMessage($sub);
$m->getOptionalMessage()->SetA(33);
@@ -87,7 +87,7 @@ class TestUtil
self::appendHelper($m, 'RepeatedString', 'a');
self::appendHelper($m, 'RepeatedBytes', 'b');
self::appendHelper($m, 'RepeatedEnum', TestEnum::ZERO);
- self::appendHelper($m, 'RepeatedMessage', new Sub());
+ self::appendHelper($m, 'RepeatedMessage', new TestMessage_Sub());
$m->getRepeatedMessage()[0]->setA(34);
self::appendHelper($m, 'RepeatedInt32', -52);
@@ -106,7 +106,7 @@ class TestUtil
self::appendHelper($m, 'RepeatedString', 'c');
self::appendHelper($m, 'RepeatedBytes', 'd');
self::appendHelper($m, 'RepeatedEnum', TestEnum::ONE);
- self::appendHelper($m, 'RepeatedMessage', new Sub());
+ self::appendHelper($m, 'RepeatedMessage', new TestMessage_Sub());
$m->getRepeatedMessage()[1]->SetA(35);
self::kvUpdateHelper($m, 'MapInt32Int32', -62, -62);
@@ -125,13 +125,13 @@ class TestUtil
self::kvUpdateHelper($m, 'MapStringString', 'e', 'e');
self::kvUpdateHelper($m, 'MapInt32Bytes', 1, 'f');
self::kvUpdateHelper($m, 'MapInt32Enum', 1, TestEnum::ONE);
- self::kvUpdateHelper($m, 'MapInt32Message', 1, new Sub());
+ self::kvUpdateHelper($m, 'MapInt32Message', 1, new TestMessage_Sub());
$m->getMapInt32Message()[1]->SetA(36);
}
public static function setTestMessage2(TestMessage $m)
{
- $sub = new Sub();
+ $sub = new TestMessage_Sub();
$m->setOptionalInt32(-142);
$m->setOptionalInt64(-143);
@@ -168,7 +168,7 @@ class TestUtil
self::appendHelper($m, 'RepeatedString', 'aa');
self::appendHelper($m, 'RepeatedBytes', 'bb');
self::appendHelper($m, 'RepeatedEnum', TestEnum::TWO);
- self::appendHelper($m, 'RepeatedMessage', new Sub());
+ self::appendHelper($m, 'RepeatedMessage', new TestMessage_Sub());
$m->getRepeatedMessage()[0]->setA(134);
self::kvUpdateHelper($m, 'MapInt32Int32', -62, -162);
@@ -187,7 +187,7 @@ class TestUtil
self::kvUpdateHelper($m, 'MapStringString', 'e', 'ee');
self::kvUpdateHelper($m, 'MapInt32Bytes', 1, 'ff');
self::kvUpdateHelper($m, 'MapInt32Enum', 1, TestEnum::TWO);
- self::kvUpdateHelper($m, 'MapInt32Message', 1, new Sub());
+ self::kvUpdateHelper($m, 'MapInt32Message', 1, new TestMessage_Sub());
$m->getMapInt32Message()[1]->SetA(136);
self::kvUpdateHelper($m, 'MapInt32Int32', -162, -162);
@@ -206,7 +206,7 @@ class TestUtil
self::kvUpdateHelper($m, 'MapStringString', 'ee', 'ee');
self::kvUpdateHelper($m, 'MapInt32Bytes', 2, 'ff');
self::kvUpdateHelper($m, 'MapInt32Enum', 2, TestEnum::TWO);
- self::kvUpdateHelper($m, 'MapInt32Message', 2, new Sub());
+ self::kvUpdateHelper($m, 'MapInt32Message', 2, new TestMessage_Sub());
$m->getMapInt32Message()[2]->SetA(136);
}
diff --git a/third_party/protobuf/3.6.0/php/tests/undefined_test.php b/third_party/protobuf/3.4.0/php/tests/undefined_test.php
index f844457131..dc6b708618 100644
--- a/third_party/protobuf/3.6.0/php/tests/undefined_test.php
+++ b/third_party/protobuf/3.4.0/php/tests/undefined_test.php
@@ -5,7 +5,7 @@ require_once('test_util.php');
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBType;
use Foo\TestMessage;
-use Foo\TestMessage\Sub;
+use Foo\TestMessage_Sub;
class UndefinedTest extends PHPUnit_Framework_TestCase
{
@@ -35,7 +35,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testInt32AppendMessageFail()
{
$arr = new RepeatedField(GPBType::INT32);
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
}
/**
@@ -45,7 +45,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::INT32);
$arr[] = 0;
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -73,7 +73,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testUint32AppendMessageFail()
{
$arr = new RepeatedField(GPBType::UINT32);
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
}
/**
@@ -83,7 +83,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::UINT32);
$arr[] = 0;
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -111,7 +111,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testInt64AppendMessageFail()
{
$arr = new RepeatedField(GPBType::INT64);
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
}
/**
@@ -121,7 +121,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::INT64);
$arr[] = 0;
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -149,7 +149,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testUint64AppendMessageFail()
{
$arr = new RepeatedField(GPBType::UINT64);
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
}
/**
@@ -159,7 +159,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::UINT64);
$arr[] = 0;
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -187,7 +187,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testFloatAppendMessageFail()
{
$arr = new RepeatedField(GPBType::FLOAT);
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
}
/**
@@ -197,7 +197,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::FLOAT);
$arr[] = 0.0;
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -225,7 +225,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testDoubleAppendMessageFail()
{
$arr = new RepeatedField(GPBType::DOUBLE);
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
}
/**
@@ -235,7 +235,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::DOUBLE);
$arr[] = 0.0;
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -244,7 +244,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testBoolAppendMessageFail()
{
$arr = new RepeatedField(GPBType::BOOL);
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
}
/**
@@ -254,7 +254,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::BOOL);
$arr[] = true;
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -263,7 +263,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testStringAppendMessageFail()
{
$arr = new RepeatedField(GPBType::STRING);
- $arr[] = new Sub();
+ $arr[] = new TestMessage_Sub();
}
/**
@@ -273,7 +273,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::STRING);
$arr[] = 'abc';
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -302,7 +302,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
*/
public function testMessageAppendIntFail()
{
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
$arr[] = 1;
}
@@ -311,8 +311,8 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
*/
public function testMessageSetIntFail()
{
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = new Sub;
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
+ $arr[] = new TestMessage_Sub;
$arr[0] = 'abc';
}
@@ -321,7 +321,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
*/
public function testMessageAppendStringFail()
{
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
$arr[] = 'abc';
}
@@ -330,8 +330,8 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
*/
public function testMessageSetStringFail()
{
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = new Sub;
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
+ $arr[] = new TestMessage_Sub;
$arr[0] = 'abc';
}
@@ -340,7 +340,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
*/
public function testMessageAppendOtherMessageFail()
{
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
$arr[] = new TestMessage;
}
@@ -349,7 +349,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
*/
public function testMessageAppendNullFail()
{
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
$null = null;
$arr[] = $null;
}
@@ -359,8 +359,8 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
*/
public function testMessageSetNullFail()
{
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = new Sub();
+ $arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
+ $arr[] = new TestMessage_Sub();
$null = null;
$arr[0] = $null;
}
@@ -397,7 +397,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr = new RepeatedField(GPBType::INT32);
$arr[] = 0;
- $arr[new Sub()] = 0;
+ $arr[new TestMessage_Sub()] = 0;
}
/**
@@ -656,7 +656,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testMessageMergeFromInvalidTypeFail()
{
$m = new TestMessage();
- $n = new Sub();
+ $n = new TestMessage_Sub();
$m->mergeFrom($n);
}
@@ -684,7 +684,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testInt32SetMessageKeyFail()
{
$arr = new MapField(GPBType::INT32, GPBType::INT32);
- $arr[new Sub()] = 0;
+ $arr[new TestMessage_Sub()] = 0;
}
/**
@@ -693,7 +693,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testInt32SetMessageValueFail()
{
$arr = new MapField(GPBType::INT32, GPBType::INT32);
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -720,7 +720,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testUint32SetMessageKeyFail()
{
$arr = new MapField(GPBType::UINT32, GPBType::UINT32);
- $arr[new Sub()] = 0;
+ $arr[new TestMessage_Sub()] = 0;
}
/**
@@ -729,7 +729,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testUint32SetMessageValueFail()
{
$arr = new MapField(GPBType::UINT32, GPBType::UINT32);
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -756,7 +756,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testInt64SetMessageKeyFail()
{
$arr = new MapField(GPBType::INT64, GPBType::INT64);
- $arr[new Sub()] = 0;
+ $arr[new TestMessage_Sub()] = 0;
}
/**
@@ -765,7 +765,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testInt64SetMessageValueFail()
{
$arr = new MapField(GPBType::INT64, GPBType::INT64);
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -792,7 +792,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testUint64SetMessageKeyFail()
{
$arr = new MapField(GPBType::UINT64, GPBType::UINT64);
- $arr[new Sub()] = 0;
+ $arr[new TestMessage_Sub()] = 0;
}
/**
@@ -801,7 +801,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testUint64SetMessageValueFail()
{
$arr = new MapField(GPBType::UINT64, GPBType::UINT64);
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -819,7 +819,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testDoubleSetMessageValueFail()
{
$arr = new MapField(GPBType::INT64, GPBType::DOUBLE);
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
@@ -828,7 +828,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testBoolSetMessageKeyFail()
{
$arr = new MapField(GPBType::BOOL, GPBType::BOOL);
- $arr[new Sub()] = true;
+ $arr[new TestMessage_Sub()] = true;
}
/**
@@ -837,7 +837,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testBoolSetMessageValueFail()
{
$arr = new MapField(GPBType::BOOL, GPBType::BOOL);
- $arr[true] = new Sub();
+ $arr[true] = new TestMessage_Sub();
}
/**
@@ -864,7 +864,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testStringSetMessageKeyFail()
{
$arr = new MapField(GPBType::STRING, GPBType::STRING);
- $arr[new Sub()] = 'abc';
+ $arr[new TestMessage_Sub()] = 'abc';
}
/**
@@ -873,7 +873,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
public function testStringSetMessageValueFail()
{
$arr = new MapField(GPBType::STRING, GPBType::STRING);
- $arr['abc'] = new Sub();
+ $arr['abc'] = new TestMessage_Sub();
}
/**
@@ -903,7 +903,7 @@ class UndefinedTest extends PHPUnit_Framework_TestCase
{
$arr =
new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class);
- $arr[0] = new Sub();
+ $arr[0] = new TestMessage_Sub();
}
/**
diff --git a/third_party/protobuf/3.4.0/php/tests/well_known_test.php b/third_party/protobuf/3.4.0/php/tests/well_known_test.php
new file mode 100644
index 0000000000..0c2aec13a9
--- /dev/null
+++ b/third_party/protobuf/3.4.0/php/tests/well_known_test.php
@@ -0,0 +1,17 @@
+<?php
+
+use Google\Protobuf\GPBEmpty;
+
+class WellKnownTest extends PHPUnit_Framework_TestCase {
+
+ public function testNone()
+ {
+ $msg = new GPBEmpty();
+ }
+
+ public function testImportDescriptorProto()
+ {
+ $msg = new TestImportDescriptorProto();
+ }
+
+}
diff --git a/third_party/protobuf/3.6.0/post_process_dist.sh b/third_party/protobuf/3.4.0/post_process_dist.sh
index 5b14de6720..a5f95800b8 100644..100755
--- a/third_party/protobuf/3.6.0/post_process_dist.sh
+++ b/third_party/protobuf/3.4.0/post_process_dist.sh
@@ -27,7 +27,7 @@ fi
set -ex
-LANGUAGES="cpp csharp java js objectivec python ruby php all"
+LANGUAGES="cpp csharp java javanano js objectivec python ruby php"
BASENAME=`basename $1 .tar.gz`
VERSION=${BASENAME:9}
diff --git a/third_party/protobuf/3.6.0/protobuf-lite.pc.in b/third_party/protobuf/3.4.0/protobuf-lite.pc.in
index 80f1f46195..80f1f46195 100644
--- a/third_party/protobuf/3.6.0/protobuf-lite.pc.in
+++ b/third_party/protobuf/3.4.0/protobuf-lite.pc.in
diff --git a/third_party/protobuf/3.6.0/protobuf.bzl b/third_party/protobuf/3.4.0/protobuf.bzl
index 78f19c621a..23380babc3 100644
--- a/third_party/protobuf/3.6.0/protobuf.bzl
+++ b/third_party/protobuf/3.4.0/protobuf.bzl
@@ -45,11 +45,8 @@ def _CcSrcs(srcs, use_grpc_plugin=False):
def _CcOuts(srcs, use_grpc_plugin=False):
return _CcHdrs(srcs, use_grpc_plugin) + _CcSrcs(srcs, use_grpc_plugin)
-def _PyOuts(srcs, use_grpc_plugin=False):
- ret = [s[:-len(".proto")] + "_pb2.py" for s in srcs]
- if use_grpc_plugin:
- ret += [s[:-len(".proto")] + "_pb2_grpc.py" for s in srcs]
- return ret
+def _PyOuts(srcs):
+ return [s[:-len(".proto")] + "_pb2.py" for s in srcs]
def _RelativeOutputPath(path, include, dest=""):
if include == None:
@@ -174,10 +171,10 @@ def cc_proto_library(
deps=[],
cc_libs=[],
include=None,
- protoc="@com_google_protobuf//:protoc",
+ protoc="//:protoc",
internal_bootstrap_hack=False,
use_grpc_plugin=False,
- default_runtime="@com_google_protobuf//:protobuf",
+ default_runtime="//:protobuf",
**kargs):
"""Bazel rule to create a C++ protobuf library from proto source files
@@ -320,8 +317,8 @@ def py_proto_library(
py_libs=[],
py_extra_srcs=[],
include=None,
- default_runtime="@com_google_protobuf//:protobuf_python",
- protoc="@com_google_protobuf//:protoc",
+ default_runtime="//:protobuf_python",
+ protoc="//:protoc",
use_grpc_plugin=False,
**kargs):
"""Bazel rule to create a Python protobuf library from proto source files
@@ -347,7 +344,7 @@ def py_proto_library(
**kargs: other keyword arguments that are passed to cc_library.
"""
- outs = _PyOuts(srcs, use_grpc_plugin)
+ outs = _PyOuts(srcs)
includes = []
if include != None:
@@ -403,15 +400,3 @@ 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/third_party/protobuf/3.6.0/protobuf.pc.in b/third_party/protobuf/3.4.0/protobuf.pc.in
index 490149034d..490149034d 100644
--- a/third_party/protobuf/3.6.0/protobuf.pc.in
+++ b/third_party/protobuf/3.4.0/protobuf.pc.in
diff --git a/third_party/protobuf/3.6.0/protoc-artifacts/Dockerfile b/third_party/protobuf/3.4.0/protoc-artifacts/Dockerfile
index c346586b12..36b547a24c 100644
--- a/third_party/protobuf/3.6.0/protoc-artifacts/Dockerfile
+++ b/third_party/protobuf/3.4.0/protoc-artifacts/Dockerfile
@@ -11,16 +11,13 @@ RUN yum install -y git \
libtool \
glibc-static.i686 \
glibc-devel \
- glibc-devel.i686 \
- && \
- yum clean all
+ glibc-devel.i686
# Install Java 8
RUN wget -q --no-cookies --no-check-certificate \
- --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
- "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz" \
+ --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz" \
-O - | tar xz -C /var/local
-ENV JAVA_HOME /var/local/jdk1.8.0_131
+ENV JAVA_HOME /var/local/jdk1.8.0_45
ENV PATH $JAVA_HOME/bin:$PATH
# Install Maven
@@ -29,17 +26,15 @@ RUN wget -q http://apache.cs.utah.edu/maven/maven-3/3.3.9/binaries/apache-maven-
ENV PATH /var/local/apache-maven-3.3.9/bin:$PATH
# Install GCC 4.7 to support -static-libstdc++
-RUN wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d && \
- bash -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo' && \
- bash -c "sed -e 's/\$basearch/i386/g' /etc/yum.repos.d/devtools-1.1.repo > /etc/yum.repos.d/devtools-i386-1.1.repo" && \
- sed -e 's/testing-/testing-i386-/g' -i /etc/yum.repos.d/devtools-i386-1.1.repo && \
- rpm --rebuilddb && \
- yum install -y devtoolset-1.1 \
+RUN wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d
+RUN bash -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo'
+RUN bash -c "sed -e 's/\$basearch/i386/g' /etc/yum.repos.d/devtools-1.1.repo > /etc/yum.repos.d/devtools-i386-1.1.repo"
+RUN sed -e 's/testing-/testing-i386-/g' -i /etc/yum.repos.d/devtools-i386-1.1.repo
+RUN rpm --rebuilddb && yum install -y devtoolset-1.1 \
devtoolset-1.1-libstdc++-devel \
- devtoolset-1.1-libstdc++-devel.i686 && \
- yum clean all
+ devtoolset-1.1-libstdc++-devel.i686
-COPY scl-enable-devtoolset.sh /var/local/
+RUN git clone --depth 1 https://github.com/google/protobuf.git
# Start in devtoolset environment that uses GCC 4.7
-ENTRYPOINT ["/var/local/scl-enable-devtoolset.sh"]
+CMD ["scl", "enable", "devtoolset-1.1", "bash"]
diff --git a/third_party/protobuf/3.6.0/protoc-artifacts/README.md b/third_party/protobuf/3.4.0/protoc-artifacts/README.md
index dcaec9877f..17eb77f840 100644
--- a/third_party/protobuf/3.6.0/protoc-artifacts/README.md
+++ b/third_party/protobuf/3.4.0/protoc-artifacts/README.md
@@ -68,11 +68,11 @@ 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, x86_64 and cross compiled aarch_64)
+- Linux (x86_32 and x86_64)
- Windows (x86_32 and x86_64) with
- - Cygwin64 with MinGW compilers (x86_64)
- - MSYS with MinGW32 (x86_32)
- - Cross compile in Linux with MinGW-w64 (x86_32, x86_64)
+ - Cygwin64 with MinGW compilers (x86_64)
+ - MSYS with MinGW32 (x86_32)
+ - Cross compile in Linux with MinGW-w64 (x86_32, x86_64)
- MacOSX (x86_32 and x86_64)
As for MSYS2/MinGW64 for Windows: protoc will build, but it insists on
@@ -99,9 +99,6 @@ $ 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``
@@ -140,14 +137,10 @@ $ docker build -t protoc-artifacts .
To run the image:
```
-$ docker run -it --rm=true protoc-artifacts bash
+$ docker run -it --rm=true protoc-artifacts
```
-To checkout protobuf (run within the container):
-```
-$ # Replace v3.5.1 with the version you want
-$ wget -O - https://github.com/google/protobuf/archive/v3.5.1.tar.gz | tar xvzp
-```
+The Protobuf repository has been cloned into ``/protobuf``.
### Tips for deploying on Windows
Under Windows the following error may occur: ``gpg: cannot open tty `no tty':
@@ -181,9 +174,8 @@ stored:
### Tested build environments
We have successfully built artifacts on the following environments:
- Linux x86_32 and x86_64:
- - Centos 6.6 (within Docker 1.6.1)
- - Ubuntu 14.04.2 64-bit
-- Linux aarch_64: Cross compiled with `g++-aarch64-linux-gnu` on Ubuntu 14.04.2 64-bit
+ - Centos 6.6 (within Docker 1.6.1)
+ - Ubuntu 14.04.2 64-bit
- Windows x86_32: MSYS with ``mingw32-gcc-g++ 4.8.1-4`` on Windows 7 64-bit
- Windows x86_32: Cross compile with ``i686-w64-mingw32-g++ 4.8.2`` on Ubuntu 14.04.2 64-bit
- Windows x86_64: Cygwin64 with ``mingw64-x86_64-gcc-g++ 4.8.3-1`` on Windows 7 64-bit
diff --git a/third_party/protobuf/3.6.0/protoc-artifacts/build-protoc.sh b/third_party/protobuf/3.4.0/protoc-artifacts/build-protoc.sh
index b78abbcf52..29acff9fb1 100644..100755
--- a/third_party/protobuf/3.6.0/protoc-artifacts/build-protoc.sh
+++ b/third_party/protobuf/3.4.0/protoc-artifacts/build-protoc.sh
@@ -6,17 +6,11 @@
# Usage: build-protoc.sh <OS> <ARCH> <TARGET>
# <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-plugin
# <TARGET> can be "protoc" or "protoc-gen-javalite"
-#
-# The script now supports cross-compiling windows and linux-arm64 in linux-x86
-# environment. Required packages:
-# - Windows: i686-w64-mingw32-gcc (32bit) and x86_64-w64-mingw32-gcc (64bit)
-# - Arm64: g++-aarch64-linux-gnu
-
OS=$1
ARCH=$2
MAKE_TARGET=$3
-if [[ $# < 3 ]]; then
+if [[ $# -lt 3 ]]; then
echo "No arguments provided. This script is intended to be run from Maven."
exit 1
fi
@@ -79,10 +73,6 @@ checkArch ()
assertEq $format "elf32-i386" $LINENO
elif [[ "$ARCH" == x86_64 ]]; then
assertEq $format "elf64-x86-64" $LINENO
- elif [[ "$ARCH" == aarch_64 ]]; then
- assertEq $format "elf64-little" $LINENO
- elif [[ "$ARCH" == ppcle_64 ]]; then
- assertEq $format "elf64-powerpcle" $LINENO
else
fail "Unsupported arch: $ARCH"
fi
@@ -126,11 +116,6 @@ checkDependencies ()
white_list="linux-gate\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux\.so\.2"
elif [[ "$ARCH" == x86_64 ]]; then
white_list="linux-vdso\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux-x86-64\.so\.2"
- elif [[ "$ARCH" == ppcle_64 ]]; then
- white_list="linux-vdso64\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|libz\.so\.1\|ld64\.so\.2"
- elif [[ "$ARCH" == aarch_64 ]]; then
- dump_cmd='objdump -p '"$1"' | grep NEEDED'
- white_list="libpthread\.so\.0\|libc\.so\.6\|ld-linux-aarch64\.so\.1"
fi
elif [[ "$OS" == osx ]]; then
dump_cmd='otool -L '"$1"' | fgrep dylib'
@@ -195,10 +180,6 @@ elif [[ "$(uname)" == Linux* ]]; then
CXXFLAGS="$CXXFLAGS -m64"
elif [[ "$ARCH" == x86_32 ]]; then
CXXFLAGS="$CXXFLAGS -m32"
- elif [[ "$ARCH" == aarch_64 ]]; then
- CONFIGURE_ARGS="$CONFIGURE_ARGS --host=aarch64-linux-gnu"
- elif [[ "$ARCH" == ppcle_64 ]]; then
- CXXFLAGS="$CXXFLAGS -m64"
else
fail "Unsupported arch: $ARCH"
fi
diff --git a/third_party/protobuf/3.6.0/protoc-artifacts/build-zip.sh b/third_party/protobuf/3.4.0/protoc-artifacts/build-zip.sh
index 26b6cc930e..b46029eed7 100644..100755
--- a/third_party/protobuf/3.6.0/protoc-artifacts/build-zip.sh
+++ b/third_party/protobuf/3.4.0/protoc-artifacts/build-zip.sh
@@ -13,14 +13,12 @@ Example:
This script will download pre-built protoc or protoc plugin binaries from maven
repository and create .zip packages suitable to be included in the github
release page. If the target is protoc, well-known type .proto files will also be
-included. Each invocation will create 7 zip packages:
+included. Each invocation will create 5 zip packages:
dist/<TARGET>-<VERSION_NUMBER>-win32.zip
dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip
dist/<TARGET>-<VERSION_NUMBER>-osx-x86_64.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-x86_32.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip
- dist/<TARGET>-<VERSION_NUMBER>-linux-aarch_64.zip
- dist/<TARGET>-<VERSION_NUMBER>-linux-ppcle_64.zip
EOF
exit 1
fi
@@ -35,8 +33,6 @@ declare -a FILE_NAMES=( \
osx-x86_64.zip osx-x86_64.exe \
linux-x86_32.zip linux-x86_32.exe \
linux-x86_64.zip linux-x86_64.exe \
- linux-aarch_64.zip linux-aarch_64.exe \
- linux-ppcle_64.zip linux-ppcle_64.exe \
)
# List of all well-known types to be included.
@@ -62,7 +58,7 @@ DIR=$(mktemp -d)
# Copy over well-known types.
mkdir -p ${DIR}/include/google/protobuf/compiler
-for PROTO in ${WELL_KNOWN_TYPES[@]}; do
+for PROTO in "${WELL_KNOWN_TYPES[@]}"; do
cp -f ../src/${PROTO} ${DIR}/include/${PROTO}
done
diff --git a/third_party/protobuf/3.6.0/protoc-artifacts/pom.xml b/third_party/protobuf/3.4.0/protoc-artifacts/pom.xml
index 667a021524..d68709ea6e 100644
--- a/third_party/protobuf/3.6.0/protoc-artifacts/pom.xml
+++ b/third_party/protobuf/3.4.0/protoc-artifacts/pom.xml
@@ -10,7 +10,7 @@
</parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
- <version>3.6.0</version>
+ <version>3.4.0</version>
<packaging>pom</packaging>
<name>Protobuf Compiler</name>
<description>
@@ -37,7 +37,7 @@
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
- <version>1.5.0.Final</version>
+ <version>1.2.3.Final</version>
</extension>
</extensions>
<plugins>
diff --git a/third_party/protobuf/3.6.0/python/MANIFEST.in b/third_party/protobuf/3.4.0/python/MANIFEST.in
index 5fb01922a0..260888263b 100644
--- a/third_party/protobuf/3.6.0/python/MANIFEST.in
+++ b/third_party/protobuf/3.4.0/python/MANIFEST.in
@@ -4,9 +4,6 @@ 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/third_party/protobuf/3.6.0/python/README.md b/third_party/protobuf/3.4.0/python/README.md
index 4c19429700..4c19429700 100644
--- a/third_party/protobuf/3.6.0/python/README.md
+++ b/third_party/protobuf/3.4.0/python/README.md
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto
index 9f55e037f6..9f55e037f6 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto
index d3ce4d7f95..d3ce4d7f95 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto
index e2d9701045..e2d9701045 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto
index df98ac4bd1..df98ac4bd1 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto
index c701b4460b..c701b4460b 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto
index 6a82299a52..6a82299a52 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
index a785f79faf..a785f79faf 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
index 6eb2d86f51..6eb2d86f51 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
index e591d29447..e591d29447 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
index c115b11171..c115b11171 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
index ea5d1b13fe..ea5d1b13fe 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
index 3497f09fa6..3497f09fa6 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
index cffb4122c5..cffb4122c5 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/setup.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/setup.py
index b41d54d4fe..b41d54d4fe 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/setup.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/setup.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/test.sh b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/test.sh
index 78c16ad1ca..78c16ad1ca 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/test.sh
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/test.sh
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/__init__.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/__init__.py
index 5585614122..5585614122 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/__init__.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/__init__.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/__init__.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/__init__.py
index 5585614122..5585614122 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/__init__.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/__init__.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py
index 5585614122..5585614122 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py
index 64c6956f8f..64c6956f8f 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py
index c74f882e78..c74f882e78 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py
index 8343aba1e1..8343aba1e1 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message
index 4dd62cd3bb..4dd62cd3bb 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message
Binary files differ
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message
index ee28d38830..ee28d38830 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message
Binary files differ
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py
index e71b295bb6..53e9d50780 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py
@@ -55,11 +55,6 @@ from google.protobuf.internal import api_implementation
from google.protobuf.internal import test_util
from google.protobuf import message
-try:
- cmp # Python 2
-except NameError:
- cmp = lambda x, y: (x > y) - (x < y) # Python 3
-
# Python pre-2.6 does not have isinf() or isnan() functions, so we have
# to provide our own.
def isnan(val):
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py
index e04f8252c0..e04f8252c0 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py
index e2c9db0377..e2c9db0377 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py
index 8267cd2c65..8267cd2c65 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt
index bbe5882634..bbe5882634 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt
index 0a217f025d..0a217f025d 100644
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt
diff --git a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py
index 7600778603..7600778603 100644..100755
--- a/third_party/protobuf/3.6.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py
+++ b/third_party/protobuf/3.4.0/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py
diff --git a/third_party/protobuf/3.6.0/python/google/__init__.py b/third_party/protobuf/3.4.0/python/google/__init__.py
index 5585614122..5585614122 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/__init__.py
+++ b/third_party/protobuf/3.4.0/python/google/__init__.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/__init__.py b/third_party/protobuf/3.4.0/python/google/protobuf/__init__.py
index 58a3f040cb..d26da0dfc1 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/__init__.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/__init__.py
@@ -30,7 +30,7 @@
# Copyright 2007 Google Inc. All Rights Reserved.
-__version__ = '3.6.0'
+__version__ = '3.4.0'
if __name__ != '__main__':
try:
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/descriptor.py b/third_party/protobuf/3.4.0/python/google/protobuf/descriptor.py
index 8a9ba3da48..b1f3ca38d7 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/descriptor.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/descriptor.py
@@ -34,7 +34,6 @@ file, in types that make this information accessible in Python.
__author__ = 'robinson@google.com (Will Robinson)'
-import threading
import six
from google.protobuf.internal import api_implementation
@@ -42,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)
@@ -73,24 +72,6 @@ else:
DescriptorMetaclass = type
-class _Lock(object):
- """Wrapper class of threading.Lock(), which is allowed by 'with'."""
-
- def __new__(cls):
- self = object.__new__(cls)
- self._lock = threading.Lock() # pylint: disable=protected-access
- return self
-
- def __enter__(self):
- self._lock.acquire()
-
- def __exit__(self, exc_type, exc_value, exc_tb):
- self._lock.release()
-
-
-_lock = threading.Lock()
-
-
class DescriptorBase(six.with_metaclass(DescriptorMetaclass)):
"""Descriptors base class.
@@ -111,17 +92,16 @@ class DescriptorBase(six.with_metaclass(DescriptorMetaclass)):
# subclasses" of this descriptor class.
_C_DESCRIPTOR_CLASS = ()
- def __init__(self, options, serialized_options, options_class_name):
+ def __init__(self, options, options_class_name):
"""Initialize the descriptor given its options message and the name of the
class of the options message. The name of the class is required in case
the options message is None and has to be created.
"""
self._options = options
self._options_class_name = options_class_name
- self._serialized_options = serialized_options
# Does this descriptor have non-default options?
- self.has_options = (options is not None) or (serialized_options is not None)
+ self.has_options = options is not None
def _SetOptions(self, options, options_class_name):
"""Sets the descriptor's options
@@ -143,23 +123,14 @@ class DescriptorBase(six.with_metaclass(DescriptorMetaclass)):
"""
if self._options:
return self._options
-
from google.protobuf import descriptor_pb2
try:
- options_class = getattr(descriptor_pb2,
- self._options_class_name)
+ options_class = getattr(descriptor_pb2, self._options_class_name)
except AttributeError:
raise RuntimeError('Unknown options class name %s!' %
(self._options_class_name))
-
- with _lock:
- if self._serialized_options is None:
- self._options = options_class()
- else:
- self._options = _ParseOptions(options_class(),
- self._serialized_options)
-
- return self._options
+ self._options = options_class()
+ return self._options
class _NestedDescriptorBase(DescriptorBase):
@@ -167,7 +138,7 @@ class _NestedDescriptorBase(DescriptorBase):
def __init__(self, options, options_class_name, name, full_name,
file, containing_type, serialized_start=None,
- serialized_end=None, serialized_options=None):
+ serialized_end=None):
"""Constructor.
Args:
@@ -186,10 +157,9 @@ class _NestedDescriptorBase(DescriptorBase):
file.serialized_pb that describes this descriptor.
serialized_end: The end index (exclusive) in block in the
file.serialized_pb that describes this descriptor.
- serialized_options: Protocol message serilized options or None.
"""
super(_NestedDescriptorBase, self).__init__(
- options, serialized_options, options_class_name)
+ options, options_class_name)
self.name = name
# TODO(falk): Add function to calculate full_name instead of having it in
@@ -280,7 +250,6 @@ class Descriptor(_NestedDescriptorBase):
def __new__(cls, name, full_name, filename, containing_type, fields,
nested_types, enum_types, extensions, options=None,
- serialized_options=None,
is_extendable=True, extension_ranges=None, oneofs=None,
file=None, serialized_start=None, serialized_end=None, # pylint: disable=redefined-builtin
syntax=None):
@@ -292,7 +261,6 @@ class Descriptor(_NestedDescriptorBase):
# name of the argument.
def __init__(self, name, full_name, filename, containing_type, fields,
nested_types, enum_types, extensions, options=None,
- serialized_options=None,
is_extendable=True, extension_ranges=None, oneofs=None,
file=None, serialized_start=None, serialized_end=None, # pylint: disable=redefined-builtin
syntax=None):
@@ -305,7 +273,7 @@ class Descriptor(_NestedDescriptorBase):
super(Descriptor, self).__init__(
options, 'MessageOptions', name, full_name, file,
containing_type, serialized_start=serialized_start,
- serialized_end=serialized_end, serialized_options=serialized_options)
+ serialized_end=serialized_end)
# We have fields in addition to fields_by_name and fields_by_number,
# so that:
@@ -524,9 +492,8 @@ class FieldDescriptor(DescriptorBase):
def __new__(cls, name, full_name, index, number, type, cpp_type, label,
default_value, message_type, enum_type, containing_type,
is_extension, extension_scope, options=None,
- serialized_options=None,
has_default_value=True, containing_oneof=None, json_name=None,
- file=None): # pylint: disable=redefined-builtin
+ file=None):
_message.Message._CheckCalledFromGeneratedFile()
if is_extension:
return _message.default_pool.FindExtensionByName(full_name)
@@ -536,9 +503,8 @@ class FieldDescriptor(DescriptorBase):
def __init__(self, name, full_name, index, number, type, cpp_type, label,
default_value, message_type, enum_type, containing_type,
is_extension, extension_scope, options=None,
- serialized_options=None,
has_default_value=True, containing_oneof=None, json_name=None,
- file=None): # pylint: disable=redefined-builtin
+ file=None):
"""The arguments are as described in the description of FieldDescriptor
attributes above.
@@ -546,8 +512,7 @@ class FieldDescriptor(DescriptorBase):
(to deal with circular references between message types, for example).
Likewise for extension_scope.
"""
- super(FieldDescriptor, self).__init__(
- options, serialized_options, 'FieldOptions')
+ super(FieldDescriptor, self).__init__(options, 'FieldOptions')
self.name = name
self.full_name = full_name
self.file = file
@@ -633,15 +598,13 @@ class EnumDescriptor(_NestedDescriptorBase):
_C_DESCRIPTOR_CLASS = _message.EnumDescriptor
def __new__(cls, name, full_name, filename, values,
- containing_type=None, options=None,
- serialized_options=None, file=None, # pylint: disable=redefined-builtin
+ containing_type=None, options=None, file=None,
serialized_start=None, serialized_end=None):
_message.Message._CheckCalledFromGeneratedFile()
return _message.default_pool.FindEnumTypeByName(full_name)
def __init__(self, name, full_name, filename, values,
- containing_type=None, options=None,
- serialized_options=None, file=None, # pylint: disable=redefined-builtin
+ containing_type=None, options=None, file=None,
serialized_start=None, serialized_end=None):
"""Arguments are as described in the attribute description above.
@@ -651,7 +614,7 @@ class EnumDescriptor(_NestedDescriptorBase):
super(EnumDescriptor, self).__init__(
options, 'EnumOptions', name, full_name, file,
containing_type, serialized_start=serialized_start,
- serialized_end=serialized_end, serialized_options=serialized_options)
+ serialized_end=serialized_end)
self.values = values
for value in self.values:
@@ -687,9 +650,7 @@ class EnumValueDescriptor(DescriptorBase):
if _USE_C_DESCRIPTORS:
_C_DESCRIPTOR_CLASS = _message.EnumValueDescriptor
- def __new__(cls, name, index, number,
- type=None, # pylint: disable=redefined-builtin
- options=None, serialized_options=None):
+ def __new__(cls, name, index, number, type=None, options=None):
_message.Message._CheckCalledFromGeneratedFile()
# There is no way we can build a complete EnumValueDescriptor with the
# given parameters (the name of the Enum is not known, for example).
@@ -697,12 +658,9 @@ class EnumValueDescriptor(DescriptorBase):
# constructor, which will ignore it, so returning None is good enough.
return None
- def __init__(self, name, index, number,
- type=None, # pylint: disable=redefined-builtin
- options=None, serialized_options=None):
+ def __init__(self, name, index, number, type=None, options=None):
"""Arguments are as described in the attribute description above."""
- super(EnumValueDescriptor, self).__init__(
- options, serialized_options, 'EnumValueOptions')
+ super(EnumValueDescriptor, self).__init__(options, 'EnumValueOptions')
self.name = name
self.index = index
self.number = number
@@ -727,17 +685,14 @@ class OneofDescriptor(DescriptorBase):
_C_DESCRIPTOR_CLASS = _message.OneofDescriptor
def __new__(
- cls, name, full_name, index, containing_type, fields, options=None,
- serialized_options=None):
+ cls, name, full_name, index, containing_type, fields, options=None):
_message.Message._CheckCalledFromGeneratedFile()
return _message.default_pool.FindOneofByName(full_name)
def __init__(
- self, name, full_name, index, containing_type, fields, options=None,
- serialized_options=None):
+ self, name, full_name, index, containing_type, fields, options=None):
"""Arguments are as described in the attribute description above."""
- super(OneofDescriptor, self).__init__(
- options, serialized_options, 'OneofOptions')
+ super(OneofDescriptor, self).__init__(options, 'OneofOptions')
self.name = name
self.full_name = full_name
self.index = index
@@ -766,19 +721,17 @@ class ServiceDescriptor(_NestedDescriptorBase):
if _USE_C_DESCRIPTORS:
_C_DESCRIPTOR_CLASS = _message.ServiceDescriptor
- def __new__(cls, name, full_name, index, methods, options=None,
- serialized_options=None, file=None, # pylint: disable=redefined-builtin
+ def __new__(cls, name, full_name, index, methods, options=None, file=None, # pylint: disable=redefined-builtin
serialized_start=None, serialized_end=None):
_message.Message._CheckCalledFromGeneratedFile() # pylint: disable=protected-access
return _message.default_pool.FindServiceByName(full_name)
- def __init__(self, name, full_name, index, methods, options=None,
- serialized_options=None, file=None, # pylint: disable=redefined-builtin
+ def __init__(self, name, full_name, index, methods, options=None, file=None,
serialized_start=None, serialized_end=None):
super(ServiceDescriptor, self).__init__(
options, 'ServiceOptions', name, full_name, file,
None, serialized_start=serialized_start,
- serialized_end=serialized_end, serialized_options=serialized_options)
+ serialized_end=serialized_end)
self.index = index
self.methods = methods
self.methods_by_name = dict((m.name, m) for m in methods)
@@ -819,19 +772,18 @@ class MethodDescriptor(DescriptorBase):
_C_DESCRIPTOR_CLASS = _message.MethodDescriptor
def __new__(cls, name, full_name, index, containing_service,
- input_type, output_type, options=None, serialized_options=None):
+ input_type, output_type, options=None):
_message.Message._CheckCalledFromGeneratedFile() # pylint: disable=protected-access
return _message.default_pool.FindMethodByName(full_name)
def __init__(self, name, full_name, index, containing_service,
- input_type, output_type, options=None, serialized_options=None):
+ input_type, output_type, options=None):
"""The arguments are as described in the description of MethodDescriptor
attributes above.
Note that containing_service may be None, and may be set later if necessary.
"""
- super(MethodDescriptor, self).__init__(
- options, serialized_options, 'MethodOptions')
+ super(MethodDescriptor, self).__init__(options, 'MethodOptions')
self.name = name
self.full_name = full_name
self.index = index
@@ -866,8 +818,7 @@ class FileDescriptor(DescriptorBase):
if _USE_C_DESCRIPTORS:
_C_DESCRIPTOR_CLASS = _message.FileDescriptor
- def __new__(cls, name, package, options=None,
- serialized_options=None, serialized_pb=None,
+ def __new__(cls, name, package, options=None, serialized_pb=None,
dependencies=None, public_dependencies=None,
syntax=None, pool=None):
# FileDescriptor() is called from various places, not only from generated
@@ -879,13 +830,11 @@ class FileDescriptor(DescriptorBase):
else:
return super(FileDescriptor, cls).__new__(cls)
- def __init__(self, name, package, options=None,
- serialized_options=None, serialized_pb=None,
+ def __init__(self, name, package, options=None, serialized_pb=None,
dependencies=None, public_dependencies=None,
syntax=None, pool=None):
"""Constructor."""
- super(FileDescriptor, self).__init__(
- options, serialized_options, 'FileOptions')
+ super(FileDescriptor, self).__init__(options, 'FileOptions')
if pool is None:
from google.protobuf import descriptor_pool
@@ -1003,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 = binascii.hexlify(os.urandom(16)).decode('ascii')
+ proto_name = str(uuid.uuid4())
if package:
file_descriptor_proto.name = os.path.join(package.replace('.', '/'),
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/descriptor_database.py b/third_party/protobuf/3.4.0/python/google/protobuf/descriptor_database.py
index 8b7715cd49..eb45e1274c 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/descriptor_database.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/descriptor_database.py
@@ -32,8 +32,6 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
-import warnings
-
class Error(Exception):
pass
@@ -66,20 +64,21 @@ 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:
- for name in _ExtractSymbols(message, package):
- self._AddSymbol(name, file_desc_proto)
+ self._file_desc_protos_by_symbol.update(
+ (name, file_desc_proto) for name in _ExtractSymbols(message, package))
for enum in file_desc_proto.enum_type:
- self._AddSymbol(('.'.join((package, enum.name))), file_desc_proto)
+ self._file_desc_protos_by_symbol[
+ '.'.join((package, enum.name))] = file_desc_proto
for extension in file_desc_proto.extension:
- self._AddSymbol(('.'.join((package, extension.name))), file_desc_proto)
+ self._file_desc_protos_by_symbol[
+ '.'.join((package, extension.name))] = file_desc_proto
for service in file_desc_proto.service:
- self._AddSymbol(('.'.join((package, service.name))), file_desc_proto)
+ self._file_desc_protos_by_symbol[
+ '.'.join((package, service.name))] = file_desc_proto
def FindFileByName(self, name):
"""Finds the file descriptor proto by file name.
@@ -108,7 +107,6 @@ class DescriptorDatabase(object):
'some.package.name.Message'
'some.package.name.Message.NestedEnum'
- 'some.package.name.Message.some_field'
The file descriptor proto containing the specified symbol must be added to
this database using the Add method or else an error will be raised.
@@ -122,25 +120,8 @@ class DescriptorDatabase(object):
Raises:
KeyError if no file contains the specified symbol.
"""
- try:
- return self._file_desc_protos_by_symbol[symbol]
- except KeyError:
- # Fields, enum values, and nested extensions are not in
- # _file_desc_protos_by_symbol. Try to find the top level
- # descriptor. Non-existent nested symbol under a valid top level
- # descriptor can also be found. The behavior is the same with
- # protobuf C++.
- 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
+
+ return self._file_desc_protos_by_symbol[symbol]
def _ExtractSymbols(desc_proto, package):
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/descriptor_pool.py b/third_party/protobuf/3.4.0/python/google/protobuf/descriptor_pool.py
index 8983f76f01..3dbe0fd024 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/descriptor_pool.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/descriptor_pool.py
@@ -58,7 +58,6 @@ 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
@@ -128,8 +127,8 @@ class DescriptorPool(object):
self._service_descriptors = {}
self._file_descriptors = {}
self._toplevel_extensions = {}
- # TODO(jieluo): Remove _file_desc_by_toplevel_extension after
- # maybe year 2020 for compatibility issue (with 3.4.1 only).
+ # TODO(jieluo): Remove _file_desc_by_toplevel_extension when
+ # FieldDescriptor.file is added in code gen.
self._file_desc_by_toplevel_extension = {}
# We store extensions in two two-level mappings: The first key is the
# descriptor of the message being extended, the second key is the extension
@@ -137,29 +136,6 @@ 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.
@@ -196,8 +172,6 @@ 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)
@@ -213,7 +187,6 @@ 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)
@@ -227,7 +200,6 @@ 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):
@@ -247,7 +219,6 @@ 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:
@@ -285,8 +256,7 @@ class DescriptorPool(object):
self._AddFileDescriptor(file_desc)
# TODO(jieluo): This is a temporary solution for FieldDescriptor.file.
- # FieldDescriptor.file is added in code gen. Remove this solution after
- # maybe 2020 for compatibility reason (with 3.4.1 only).
+ # Remove it when FieldDescriptor.file is added in code gen.
for extension in file_desc.extensions_by_name.values():
self._file_desc_by_toplevel_extension[
extension.full_name] = file_desc
@@ -435,23 +405,6 @@ class DescriptorPool(object):
message_descriptor = self.FindMessageTypeByName(message_name)
return message_descriptor.fields_by_name[field_name]
- def FindOneofByName(self, full_name):
- """Loads the named oneof descriptor from the pool.
-
- Args:
- full_name: The full name of the oneof descriptor to load.
-
- Returns:
- The oneof descriptor for the named oneof.
-
- Raises:
- KeyError: if the oneof cannot be found in the pool.
- """
- full_name = _NormalizeFullyQualifiedName(full_name)
- message_name, _, oneof_name = full_name.rpartition('.')
- message_descriptor = self.FindMessageTypeByName(message_name)
- return message_descriptor.oneofs_by_name[oneof_name]
-
def FindExtensionByName(self, full_name):
"""Loads the named extension descriptor from the pool.
@@ -718,7 +671,6 @@ 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
@@ -757,7 +709,6 @@ 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
@@ -954,7 +905,6 @@ 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/third_party/protobuf/3.6.0/benchmarks/__init__.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/__init__.py
index e69de29bb2..e69de29bb2 100644..100755
--- a/third_party/protobuf/3.6.0/benchmarks/__init__.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/__init__.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/_parameterized.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/_parameterized.py
index f2c0b305b9..23a78f037e 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/_parameterized.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/_parameterized.py
@@ -37,8 +37,8 @@ argument tuples.
A simple example:
- class AdditionExample(parameterized.TestCase):
- @parameterized.parameters(
+ class AdditionExample(parameterized.ParameterizedTestCase):
+ @parameterized.Parameters(
(1, 2, 3),
(4, 5, 9),
(1, 1, 3))
@@ -54,8 +54,8 @@ fail due to an assertion error (1 + 1 != 3).
Parameters for invididual test cases can be tuples (with positional parameters)
or dictionaries (with named parameters):
- class AdditionExample(parameterized.TestCase):
- @parameterized.parameters(
+ class AdditionExample(parameterized.ParameterizedTestCase):
+ @parameterized.Parameters(
{'op1': 1, 'op2': 2, 'result': 3},
{'op1': 4, 'op2': 5, 'result': 9},
)
@@ -77,13 +77,13 @@ stay the same across several invocations, object representations like
'<__main__.Foo object at 0x23d8610>'
are turned into '<__main__.Foo>'. For even more descriptive names,
-especially in test logs, you can use the named_parameters decorator. In
+especially in test logs, you can use the NamedParameters decorator. In
this case, only tuples are supported, and the first parameters has to
be a string (or an object that returns an apt name when converted via
str()):
- class NamedExample(parameterized.TestCase):
- @parameterized.named_parameters(
+ class NamedExample(parameterized.ParameterizedTestCase):
+ @parameterized.NamedParameters(
('Normal', 'aa', 'aaa', True),
('EmptyPrefix', '', 'abc', True),
('BothEmpty', '', '', True))
@@ -103,13 +103,13 @@ from the command line:
Parameterized Classes
=====================
If invocation arguments are shared across test methods in a single
-TestCase class, instead of decorating all test methods
+ParameterizedTestCase class, instead of decorating all test methods
individually, the class itself can be decorated:
- @parameterized.parameters(
+ @parameterized.Parameters(
(1, 2, 3)
(4, 5, 9))
- class ArithmeticTest(parameterized.TestCase):
+ class ArithmeticTest(parameterized.ParameterizedTestCase):
def testAdd(self, arg1, arg2, result):
self.assertEqual(arg1 + arg2, result)
@@ -122,8 +122,8 @@ If parameters should be shared across several test cases, or are dynamically
created from other sources, a single non-tuple iterable can be passed into
the decorator. This iterable will be used to obtain the test cases:
- class AdditionExample(parameterized.TestCase):
- @parameterized.parameters(
+ class AdditionExample(parameterized.ParameterizedTestCase):
+ @parameterized.Parameters(
c.op1, c.op2, c.result for c in testcases
)
def testAddition(self, op1, op2, result):
@@ -135,8 +135,8 @@ Single-Argument Test Methods
If a test method takes only one argument, the single argument does not need to
be wrapped into a tuple:
- class NegativeNumberExample(parameterized.TestCase):
- @parameterized.parameters(
+ class NegativeNumberExample(parameterized.ParameterizedTestCase):
+ @parameterized.Parameters(
-1, -3, -4, -5
)
def testIsNegative(self, arg):
@@ -212,7 +212,7 @@ class _ParameterizedTestIter(object):
def __call__(self, *args, **kwargs):
raise RuntimeError('You appear to be running a parameterized test case '
'without having inherited from parameterized.'
- 'TestCase. This is bad because none of '
+ 'ParameterizedTestCase. This is bad because none of '
'your test cases are actually being run.')
def __iter__(self):
@@ -306,7 +306,7 @@ def _ParameterDecorator(naming_type, testcases):
return _Apply
-def parameters(*testcases): # pylint: disable=invalid-name
+def Parameters(*testcases):
"""A decorator for creating parameterized tests.
See the module docstring for a usage example.
@@ -321,7 +321,7 @@ def parameters(*testcases): # pylint: disable=invalid-name
return _ParameterDecorator(_ARGUMENT_REPR, testcases)
-def named_parameters(*testcases): # pylint: disable=invalid-name
+def NamedParameters(*testcases):
"""A decorator for creating parameterized tests.
See the module docstring for a usage example. The first element of
@@ -348,7 +348,7 @@ class TestGeneratorMetaclass(type):
up as tests by the unittest framework.
In general, it is supposed to be used in conjunction with the
- parameters decorator.
+ Parameters decorator.
"""
def __new__(mcs, class_name, bases, dct):
@@ -385,8 +385,8 @@ def _UpdateClassDictForParamTestCase(dct, id_suffix, name, iterator):
id_suffix[new_name] = getattr(func, '__x_extra_id__', '')
-class TestCase(unittest.TestCase):
- """Base class for test cases using the parameters decorator."""
+class ParameterizedTestCase(unittest.TestCase):
+ """Base class for test cases using the Parameters decorator."""
__metaclass__ = TestGeneratorMetaclass
def _OriginalName(self):
@@ -409,10 +409,10 @@ class TestCase(unittest.TestCase):
self._id_suffix.get(self._testMethodName, ''))
-def CoopTestCase(other_base_class):
+def CoopParameterizedTestCase(other_base_class):
"""Returns a new base class with a cooperative metaclass base.
- This enables the TestCase to be used in combination
+ This enables the ParameterizedTestCase to be used in combination
with other base classes that have custom metaclasses, such as
mox.MoxTestBase.
@@ -425,7 +425,7 @@ def CoopTestCase(other_base_class):
from google3.testing.pybase import parameterized
- class ExampleTest(parameterized.CoopTestCase(mox.MoxTestBase)):
+ class ExampleTest(parameterized.CoopParameterizedTestCase(mox.MoxTestBase)):
...
Args:
@@ -439,5 +439,5 @@ def CoopTestCase(other_base_class):
(other_base_class.__metaclass__,
TestGeneratorMetaclass), {})
return metaclass(
- 'CoopTestCase',
- (other_base_class, TestCase), {})
+ 'CoopParameterizedTestCase',
+ (other_base_class, ParameterizedTestCase), {})
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/any_test.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/any_test.proto
index 1a563fd948..76a7ebd68d 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/any_test.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/any_test.proto
@@ -39,7 +39,6 @@ import "google/protobuf/any.proto";
message TestAny {
optional google.protobuf.Any value = 1;
optional int32 int_value = 2;
- map<string,int32> map_value = 3;
extensions 10 to max;
}
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/api_implementation.cc b/third_party/protobuf/3.4.0/python/google/protobuf/internal/api_implementation.cc
index 6db12e8dc6..6db12e8dc6 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/api_implementation.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/api_implementation.cc
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/api_implementation.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/api_implementation.py
index ab9e7812c5..422af5902d 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/api_implementation.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/api_implementation.py
@@ -61,18 +61,10 @@ if _api_version < 0: # Still unspecified?
del _use_fast_cpp_protos
_api_version = 2
except ImportError:
- try:
- # pylint: disable=g-import-not-at-top
- from google.protobuf.internal import use_pure_python
- del use_pure_python # Avoids a pylint error and namespace pollution.
- except ImportError:
- # TODO(b/74017912): It's unsafe to enable :use_fast_cpp_protos by default;
- # it can cause data loss if you have any Python-only extensions to any
- # message passed back and forth with C++ code.
- #
- # TODO(b/17427486): Once that bug is fixed, we want to make both Python 2
- # and Python 3 default to `_api_version = 2` (C++ implementation V2).
- pass
+ if _proto_extension_modules_exist_in_build:
+ if sys.version_info[0] >= 3: # Python 3 defaults to C++ impl v2.
+ _api_version = 2
+ # TODO(b/17427486): Make Python 2 default to C++ impl v2.
_default_implementation_type = (
'python' if _api_version <= 0 else 'cpp')
@@ -145,29 +137,3 @@ def Version():
# For internal use only
def IsPythonDefaultSerializationDeterministic():
return _python_deterministic_proto_serialization
-
-# DO NOT USE: For migration and testing only. Will be removed when Proto3
-# defaults to preserve unknowns.
-if _implementation_type == 'cpp':
- try:
- # pylint: disable=g-import-not-at-top
- from google.protobuf.pyext import _message
-
- def GetPythonProto3PreserveUnknownsDefault():
- return _message.GetPythonProto3PreserveUnknownsDefault()
-
- def SetPythonProto3PreserveUnknownsDefault(preserve):
- _message.SetPythonProto3PreserveUnknownsDefault(preserve)
- except ImportError:
- # Unrecognized cpp implementation. Skipping the unknown fields APIs.
- pass
-else:
- _python_proto3_preserve_unknowns_default = True
-
- def GetPythonProto3PreserveUnknownsDefault():
- return _python_proto3_preserve_unknowns_default
-
- def SetPythonProto3PreserveUnknownsDefault(preserve):
- global _python_proto3_preserve_unknowns_default
- _python_proto3_preserve_unknowns_default = preserve
-
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/containers.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/containers.py
index c6a3692aff..68be9e54a8 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/containers.py
+++ b/third_party/protobuf/3.4.0/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,14 +584,12 @@ 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/third_party/protobuf/3.6.0/python/google/protobuf/internal/decoder.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/decoder.py
index 52b64915c4..ff3e6d306c 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/decoder.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/decoder.py
@@ -181,7 +181,7 @@ def ReadTag(buffer, pos):
while six.indexbytes(buffer, pos) & 0x80:
pos += 1
pos += 1
- return (six.binary_type(buffer[start:pos]), pos)
+ return (buffer[start:pos], pos)
# --------------------------------------------------------------------
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_database_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_database_test.py
index f97477b3db..5225a45821 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_database_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_database_test.py
@@ -38,9 +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
from google.protobuf.internal import factory_test2_pb2
from google.protobuf import descriptor_database
@@ -56,69 +54,16 @@ class DescriptorDatabaseTest(unittest.TestCase):
self.assertEqual(file_desc_proto, db.FindFileByName(
'google/protobuf/internal/factory_test2.proto'))
- # Can find message type.
self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
'google.protobuf.python.internal.Factory2Message'))
- # Can find nested message type.
self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
'google.protobuf.python.internal.Factory2Message.NestedFactory2Message'))
- # Can find enum type.
self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
'google.protobuf.python.internal.Factory2Enum'))
- # Can find nested enum type.
self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
'google.protobuf.python.internal.Factory2Message.NestedFactory2Enum'))
self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
'google.protobuf.python.internal.MessageWithNestedEnumOnly.NestedEnum'))
- # Can find field.
- self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
- 'google.protobuf.python.internal.Factory2Message.list_field'))
- # Can find enum value.
- self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
- 'google.protobuf.python.internal.Factory2Enum.FACTORY_2_VALUE_0'))
- # Can find top level extension.
- self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
- 'google.protobuf.python.internal.another_field'))
- # Can find nested extension inside a message.
- self.assertEqual(file_desc_proto, db.FindFileContainingSymbol(
- 'google.protobuf.python.internal.Factory2Message.one_more_field'))
-
- # Can find service.
- file_desc_proto2 = descriptor_pb2.FileDescriptorProto.FromString(
- unittest_pb2.DESCRIPTOR.serialized_pb)
- db.Add(file_desc_proto2)
- self.assertEqual(file_desc_proto2, db.FindFileContainingSymbol(
- 'protobuf_unittest.TestService'))
-
- # Non-existent field under a valid top level symbol can also be
- # found. The behavior is the same with protobuf C++.
- self.assertEqual(file_desc_proto2, db.FindFileContainingSymbol(
- 'protobuf_unittest.TestAllTypes.none_field'))
-
- self.assertRaises(KeyError,
- 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/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test.py
index 2cbf78138d..6015e6f8ad 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test.py
@@ -34,10 +34,8 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
-import copy
import os
import sys
-import warnings
try:
import unittest2 as unittest #PY26
@@ -62,8 +60,26 @@ from google.protobuf import message_factory
from google.protobuf import symbol_database
+class DescriptorPoolTest(unittest.TestCase):
-class DescriptorPoolTestBase(object):
+ def setUp(self):
+ # TODO(jieluo): Should make the pool which is created by
+ # serialized_pb same with generated pool.
+ # TODO(jieluo): More test coverage for the generated pool.
+ self.pool = descriptor_pool.DescriptorPool()
+ self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString(
+ factory_test1_pb2.DESCRIPTOR.serialized_pb)
+ self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString(
+ factory_test2_pb2.DESCRIPTOR.serialized_pb)
+ self.pool.Add(self.factory_test1_fd)
+ self.pool.Add(self.factory_test2_fd)
+
+ self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString(
+ unittest_import_public_pb2.DESCRIPTOR.serialized_pb))
+ self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString(
+ unittest_import_pb2.DESCRIPTOR.serialized_pb))
+ self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString(
+ unittest_pb2.DESCRIPTOR.serialized_pb))
def testFindFileByName(self):
name1 = 'google/protobuf/internal/factory_test1.proto'
@@ -215,27 +231,6 @@ class DescriptorPoolTestBase(object):
msg2.fields_by_name[name].containing_oneof)
self.assertIn(msg2.fields_by_name[name], msg2.oneofs[0].fields)
- def testFindTypeErrors(self):
- self.assertRaises(TypeError, self.pool.FindExtensionByNumber, '')
-
- # TODO(jieluo): Fix python to raise correct errors.
- if api_implementation.Type() == 'cpp':
- self.assertRaises(TypeError, self.pool.FindMethodByName, 0)
- self.assertRaises(KeyError, self.pool.FindMethodByName, '')
- error_type = TypeError
- else:
- error_type = AttributeError
- self.assertRaises(error_type, self.pool.FindMessageTypeByName, 0)
- self.assertRaises(error_type, self.pool.FindFieldByName, 0)
- self.assertRaises(error_type, self.pool.FindExtensionByName, 0)
- self.assertRaises(error_type, self.pool.FindEnumTypeByName, 0)
- self.assertRaises(error_type, self.pool.FindOneofByName, 0)
- self.assertRaises(error_type, self.pool.FindServiceByName, 0)
- self.assertRaises(error_type, self.pool.FindFileContainingSymbol, 0)
- if api_implementation.Type() == 'python':
- error_type = KeyError
- self.assertRaises(error_type, self.pool.FindFileByName, 0)
-
def testFindMessageTypeByNameFailure(self):
with self.assertRaises(KeyError):
self.pool.FindMessageTypeByName('Does not exist')
@@ -275,11 +270,6 @@ class DescriptorPoolTestBase(object):
self.pool.FindEnumTypeByName('Does not exist')
def testFindFieldByName(self):
- if isinstance(self, SecondaryDescriptorFromDescriptorDB):
- if api_implementation.Type() == 'cpp':
- # TODO(jieluo): Fix cpp extension to find field correctly
- # when descriptor pool is using an underlying database.
- return
field = self.pool.FindFieldByName(
'google.protobuf.python.internal.Factory1Message.list_value')
self.assertEqual(field.name, 'list_value')
@@ -289,24 +279,7 @@ class DescriptorPoolTestBase(object):
with self.assertRaises(KeyError):
self.pool.FindFieldByName('Does not exist')
- def testFindOneofByName(self):
- if isinstance(self, SecondaryDescriptorFromDescriptorDB):
- if api_implementation.Type() == 'cpp':
- # TODO(jieluo): Fix cpp extension to find oneof correctly
- # when descriptor pool is using an underlying database.
- return
- oneof = self.pool.FindOneofByName(
- 'google.protobuf.python.internal.Factory2Message.oneof_field')
- self.assertEqual(oneof.name, 'oneof_field')
- with self.assertRaises(KeyError):
- self.pool.FindOneofByName('Does not exist')
-
def testFindExtensionByName(self):
- if isinstance(self, SecondaryDescriptorFromDescriptorDB):
- if api_implementation.Type() == 'cpp':
- # TODO(jieluo): Fix cpp extension to find extension correctly
- # when descriptor pool is using an underlying database.
- return
# An extension defined in a message.
extension = self.pool.FindExtensionByName(
'google.protobuf.python.internal.Factory2Message.one_more_field')
@@ -379,8 +352,6 @@ class DescriptorPoolTestBase(object):
def testFindService(self):
service = self.pool.FindServiceByName('protobuf_unittest.TestService')
self.assertEqual(service.full_name, 'protobuf_unittest.TestService')
- with self.assertRaises(KeyError):
- self.pool.FindServiceByName('Does not exist')
def testUserDefinedDB(self):
db = descriptor_database.DescriptorDatabase()
@@ -390,17 +361,24 @@ class DescriptorPoolTestBase(object):
self.testFindMessageTypeByName()
def testAddSerializedFile(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
self.pool = descriptor_pool.DescriptorPool()
self.pool.AddSerializedFile(self.factory_test1_fd.SerializeToString())
self.pool.AddSerializedFile(self.factory_test2_fd.SerializeToString())
self.testFindMessageTypeByName()
+ def testComplexNesting(self):
+ more_messages_desc = descriptor_pb2.FileDescriptorProto.FromString(
+ more_messages_pb2.DESCRIPTOR.serialized_pb)
+ test1_desc = descriptor_pb2.FileDescriptorProto.FromString(
+ descriptor_pool_test1_pb2.DESCRIPTOR.serialized_pb)
+ test2_desc = descriptor_pb2.FileDescriptorProto.FromString(
+ descriptor_pool_test2_pb2.DESCRIPTOR.serialized_pb)
+ self.pool.Add(more_messages_desc)
+ self.pool.Add(test1_desc)
+ self.pool.Add(test2_desc)
+ TEST1_FILE.CheckFile(self, self.pool)
+ TEST2_FILE.CheckFile(self, self.pool)
+
def testEnumDefaultValue(self):
"""Test the default value of enums which don't start at zero."""
@@ -419,12 +397,6 @@ class DescriptorPoolTestBase(object):
self.assertIs(file_descriptor, descriptor_pool_test1_pb2.DESCRIPTOR)
_CheckDefaultValue(file_descriptor)
- 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
# Then check the dynamic pool and its internal DescriptorDatabase.
descriptor_proto = descriptor_pb2.FileDescriptorProto.FromString(
descriptor_pool_test1_pb2.DESCRIPTOR.serialized_pb)
@@ -472,156 +444,6 @@ class DescriptorPoolTestBase(object):
unittest_pb2.TestAllTypes.DESCRIPTOR.full_name))
_CheckDefaultValues(message_class())
- def testAddFileDescriptor(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
- file_desc = descriptor_pb2.FileDescriptorProto(name='some/file.proto')
- self.pool.Add(file_desc)
- self.pool.AddSerializedFile(file_desc.SerializeToString())
-
- def testComplexNesting(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
- more_messages_desc = descriptor_pb2.FileDescriptorProto.FromString(
- more_messages_pb2.DESCRIPTOR.serialized_pb)
- test1_desc = descriptor_pb2.FileDescriptorProto.FromString(
- descriptor_pool_test1_pb2.DESCRIPTOR.serialized_pb)
- test2_desc = descriptor_pb2.FileDescriptorProto.FromString(
- descriptor_pool_test2_pb2.DESCRIPTOR.serialized_pb)
- self.pool.Add(more_messages_desc)
- self.pool.Add(test1_desc)
- self.pool.Add(test2_desc)
- 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):
-
- def setUp(self):
- self.pool = descriptor_pool.Default()
- self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString(
- factory_test1_pb2.DESCRIPTOR.serialized_pb)
- self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString(
- factory_test2_pb2.DESCRIPTOR.serialized_pb)
-
- def testFindMethods(self):
- self.assertIs(
- self.pool.FindFileByName('google/protobuf/unittest.proto'),
- unittest_pb2.DESCRIPTOR)
- self.assertIs(
- self.pool.FindMessageTypeByName('protobuf_unittest.TestAllTypes'),
- unittest_pb2.TestAllTypes.DESCRIPTOR)
- self.assertIs(
- self.pool.FindFieldByName(
- 'protobuf_unittest.TestAllTypes.optional_int32'),
- unittest_pb2.TestAllTypes.DESCRIPTOR.fields_by_name['optional_int32'])
- self.assertIs(
- self.pool.FindEnumTypeByName('protobuf_unittest.ForeignEnum'),
- unittest_pb2.ForeignEnum.DESCRIPTOR)
- self.assertIs(
- self.pool.FindExtensionByName(
- 'protobuf_unittest.optional_int32_extension'),
- unittest_pb2.DESCRIPTOR.extensions_by_name['optional_int32_extension'])
- self.assertIs(
- self.pool.FindOneofByName('protobuf_unittest.TestAllTypes.oneof_field'),
- unittest_pb2.TestAllTypes.DESCRIPTOR.oneofs_by_name['oneof_field'])
- self.assertIs(
- self.pool.FindServiceByName('protobuf_unittest.TestService'),
- unittest_pb2.DESCRIPTOR.services_by_name['TestService'])
-
-
-class CreateDescriptorPoolTest(DescriptorPoolTestBase, unittest.TestCase):
-
- def setUp(self):
- self.pool = descriptor_pool.DescriptorPool()
- self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString(
- factory_test1_pb2.DESCRIPTOR.serialized_pb)
- self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString(
- factory_test2_pb2.DESCRIPTOR.serialized_pb)
- self.pool.Add(self.factory_test1_fd)
- self.pool.Add(self.factory_test2_fd)
-
- self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString(
- unittest_import_public_pb2.DESCRIPTOR.serialized_pb))
- self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString(
- unittest_import_pb2.DESCRIPTOR.serialized_pb))
- self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString(
- unittest_pb2.DESCRIPTOR.serialized_pb))
-
-
-class SecondaryDescriptorFromDescriptorDB(DescriptorPoolTestBase,
- unittest.TestCase):
-
- def setUp(self):
- self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString(
- factory_test1_pb2.DESCRIPTOR.serialized_pb)
- self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString(
- factory_test2_pb2.DESCRIPTOR.serialized_pb)
- db = descriptor_database.DescriptorDatabase()
- db.Add(self.factory_test1_fd)
- db.Add(self.factory_test2_fd)
- db.Add(descriptor_pb2.FileDescriptorProto.FromString(
- unittest_import_public_pb2.DESCRIPTOR.serialized_pb))
- db.Add(descriptor_pb2.FileDescriptorProto.FromString(
- unittest_import_pb2.DESCRIPTOR.serialized_pb))
- db.Add(descriptor_pb2.FileDescriptorProto.FromString(
- unittest_pb2.DESCRIPTOR.serialized_pb))
- self.pool = descriptor_pool.DescriptorPool(descriptor_db=db)
-
class ProtoFile(object):
@@ -746,11 +568,6 @@ class MessageField(object):
test.assertEqual(msg_desc, field_desc.containing_type)
test.assertEqual(field_type_desc, field_desc.message_type)
test.assertEqual(file_desc, field_desc.file)
- # TODO(jieluo): Fix python and cpp extension diff for message field
- # default value.
- if api_implementation.Type() == 'cpp':
- test.assertRaises(
- NotImplementedError, getattr, field_desc, 'default_value')
class StringField(object):
@@ -922,25 +739,6 @@ class AddDescriptorTest(unittest.TestCase):
'some/file.proto')
self.assertEqual(pool.FindMessageTypeByName('package.Message').name,
'Message')
- # Test no package
- file_proto = descriptor_pb2.FileDescriptorProto(
- name='some/filename/container.proto')
- message_proto = file_proto.message_type.add(
- name='TopMessage')
- message_proto.field.add(
- name='bb',
- number=1,
- type=descriptor_pb2.FieldDescriptorProto.TYPE_INT32,
- label=descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL)
- enum_proto = file_proto.enum_type.add(name='TopEnum')
- enum_proto.value.add(name='FOREIGN_FOO', number=4)
- file_proto.service.add(name='TopService')
- pool = descriptor_pool.DescriptorPool()
- pool.Add(file_proto)
- self.assertEqual('TopMessage',
- pool.FindMessageTypeByName('TopMessage').name)
- self.assertEqual('TopEnum', pool.FindEnumTypeByName('TopEnum').name)
- self.assertEqual('TopService', pool.FindServiceByName('TopService').name)
def testFileDescriptorOptionsWithCustomDescriptorPool(self):
# Create a descriptor pool, and add a new FileDescriptorProto to it.
@@ -959,18 +757,40 @@ class AddDescriptorTest(unittest.TestCase):
# The object returned by GetOptions() is cached.
self.assertIs(options, file_descriptor.GetOptions())
- def testAddTypeError(self):
- pool = descriptor_pool.DescriptorPool()
- with self.assertRaises(TypeError):
- pool.AddDescriptor(0)
- with self.assertRaises(TypeError):
- pool.AddEnumDescriptor(0)
- with self.assertRaises(TypeError):
- pool.AddServiceDescriptor(0)
- with self.assertRaises(TypeError):
- pool.AddExtensionDescriptor(0)
- with self.assertRaises(TypeError):
- pool.AddFileDescriptor(0)
+
+class DefaultPoolTest(unittest.TestCase):
+
+ def testFindMethods(self):
+ pool = descriptor_pool.Default()
+ self.assertIs(
+ pool.FindFileByName('google/protobuf/unittest.proto'),
+ unittest_pb2.DESCRIPTOR)
+ self.assertIs(
+ pool.FindMessageTypeByName('protobuf_unittest.TestAllTypes'),
+ unittest_pb2.TestAllTypes.DESCRIPTOR)
+ self.assertIs(
+ pool.FindFieldByName('protobuf_unittest.TestAllTypes.optional_int32'),
+ unittest_pb2.TestAllTypes.DESCRIPTOR.fields_by_name['optional_int32'])
+ self.assertIs(
+ pool.FindEnumTypeByName('protobuf_unittest.ForeignEnum'),
+ unittest_pb2.ForeignEnum.DESCRIPTOR)
+ if api_implementation.Type() != 'cpp':
+ self.skipTest('Only the C++ implementation correctly indexes all types')
+ self.assertIs(
+ pool.FindExtensionByName('protobuf_unittest.optional_int32_extension'),
+ unittest_pb2.DESCRIPTOR.extensions_by_name['optional_int32_extension'])
+ self.assertIs(
+ pool.FindOneofByName('protobuf_unittest.TestAllTypes.oneof_field'),
+ unittest_pb2.TestAllTypes.DESCRIPTOR.oneofs_by_name['oneof_field'])
+ self.assertIs(
+ pool.FindServiceByName('protobuf_unittest.TestService'),
+ unittest_pb2.DESCRIPTOR.services_by_name['TestService'])
+
+ def testAddFileDescriptor(self):
+ pool = descriptor_pool.Default()
+ file_desc = descriptor_pb2.FileDescriptorProto(name='some/file.proto')
+ pool.Add(file_desc)
+ pool.AddSerializedFile(file_desc.SerializeToString())
TEST1_FILE = ProtoFile(
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test1.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test1.proto
index 00816b78ec..00816b78ec 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test1.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test1.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test2.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test2.proto
index a218eccb9f..a218eccb9f 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_pool_test2.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_pool_test2.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_test.py
index 02a43d15a9..c0010081fc 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/descriptor_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/descriptor_test.py
@@ -107,12 +107,6 @@ class DescriptorTest(unittest.TestCase):
self.my_message.enum_types_by_name[
'ForeignEnum'].values_by_number[4].name,
self.my_message.EnumValueName('ForeignEnum', 4))
- with self.assertRaises(KeyError):
- self.my_message.EnumValueName('ForeignEnum', 999)
- with self.assertRaises(KeyError):
- self.my_message.EnumValueName('NoneEnum', 999)
- with self.assertRaises(TypeError):
- self.my_message.EnumValueName()
def testEnumFixups(self):
self.assertEqual(self.my_enum, self.my_enum.values[0].type)
@@ -140,17 +134,15 @@ class DescriptorTest(unittest.TestCase):
def testSimpleCustomOptions(self):
file_descriptor = unittest_custom_options_pb2.DESCRIPTOR
- message_descriptor = (unittest_custom_options_pb2.
- TestMessageWithCustomOptions.DESCRIPTOR)
+ message_descriptor =\
+ unittest_custom_options_pb2.TestMessageWithCustomOptions.DESCRIPTOR
field_descriptor = message_descriptor.fields_by_name['field1']
oneof_descriptor = message_descriptor.oneofs_by_name['AnOneof']
enum_descriptor = message_descriptor.enum_types_by_name['AnEnum']
- enum_value_descriptor = (message_descriptor.
- enum_values_by_name['ANENUM_VAL2'])
- other_enum_value_descriptor = (message_descriptor.
- enum_values_by_name['ANENUM_VAL1'])
- service_descriptor = (unittest_custom_options_pb2.
- TestServiceWithCustomOptions.DESCRIPTOR)
+ enum_value_descriptor =\
+ message_descriptor.enum_values_by_name['ANENUM_VAL2']
+ service_descriptor =\
+ unittest_custom_options_pb2.TestServiceWithCustomOptions.DESCRIPTOR
method_descriptor = service_descriptor.FindMethodByName('Foo')
file_options = file_descriptor.GetOptions()
@@ -186,11 +178,6 @@ class DescriptorTest(unittest.TestCase):
unittest_custom_options_pb2.DummyMessageContainingEnum.DESCRIPTOR)
self.assertTrue(file_descriptor.has_options)
self.assertFalse(message_descriptor.has_options)
- self.assertTrue(field_descriptor.has_options)
- self.assertTrue(oneof_descriptor.has_options)
- self.assertTrue(enum_descriptor.has_options)
- self.assertTrue(enum_value_descriptor.has_options)
- self.assertFalse(other_enum_value_descriptor.has_options)
def testDifferentCustomOptionTypes(self):
kint32min = -2**31
@@ -413,12 +400,6 @@ class DescriptorTest(unittest.TestCase):
self.assertEqual(self.my_file.name, 'some/filename/some.proto')
self.assertEqual(self.my_file.package, 'protobuf_unittest')
self.assertEqual(self.my_file.pool, self.pool)
- self.assertFalse(self.my_file.has_options)
- self.assertEqual('proto2', self.my_file.syntax)
- file_proto = descriptor_pb2.FileDescriptorProto()
- self.my_file.CopyToProto(file_proto)
- self.assertEqual(self.my_file.serialized_pb,
- file_proto.SerializeToString())
# Generated modules also belong to the default pool.
self.assertEqual(unittest_pb2.DESCRIPTOR.pool, descriptor_pool.Default())
@@ -426,31 +407,13 @@ class DescriptorTest(unittest.TestCase):
api_implementation.Type() != 'cpp' or api_implementation.Version() != 2,
'Immutability of descriptors is only enforced in v2 implementation')
def testImmutableCppDescriptor(self):
- file_descriptor = unittest_pb2.DESCRIPTOR
message_descriptor = unittest_pb2.TestAllTypes.DESCRIPTOR
- field_descriptor = message_descriptor.fields_by_name['optional_int32']
- enum_descriptor = message_descriptor.enum_types_by_name['NestedEnum']
- oneof_descriptor = message_descriptor.oneofs_by_name['oneof_field']
with self.assertRaises(AttributeError):
message_descriptor.fields_by_name = None
with self.assertRaises(TypeError):
message_descriptor.fields_by_name['Another'] = None
with self.assertRaises(TypeError):
message_descriptor.fields.append(None)
- with self.assertRaises(AttributeError):
- field_descriptor.containing_type = message_descriptor
- with self.assertRaises(AttributeError):
- file_descriptor.has_options = False
- with self.assertRaises(AttributeError):
- field_descriptor.has_options = False
- with self.assertRaises(AttributeError):
- oneof_descriptor.has_options = False
- with self.assertRaises(AttributeError):
- enum_descriptor.has_options = False
- with self.assertRaises(AttributeError) as e:
- message_descriptor.has_options = True
- self.assertEqual('attribute is not writable: has_options',
- str(e.exception))
class NewDescriptorTest(DescriptorTest):
@@ -479,12 +442,6 @@ class GeneratedDescriptorTest(unittest.TestCase):
self.CheckDescriptorMapping(message_descriptor.fields_by_name)
self.CheckDescriptorMapping(message_descriptor.fields_by_number)
self.CheckDescriptorMapping(message_descriptor.fields_by_camelcase_name)
- self.CheckDescriptorMapping(message_descriptor.enum_types_by_name)
- self.CheckDescriptorMapping(message_descriptor.enum_values_by_name)
- self.CheckDescriptorMapping(message_descriptor.oneofs_by_name)
- self.CheckDescriptorMapping(message_descriptor.enum_types[0].values_by_name)
- # Test extension range
- self.assertEqual(message_descriptor.extension_ranges, [])
def CheckFieldDescriptor(self, field_descriptor):
# Basic properties
@@ -493,7 +450,6 @@ class GeneratedDescriptorTest(unittest.TestCase):
self.assertEqual(field_descriptor.full_name,
'protobuf_unittest.TestAllTypes.optional_int32')
self.assertEqual(field_descriptor.containing_type.name, 'TestAllTypes')
- self.assertEqual(field_descriptor.file, unittest_pb2.DESCRIPTOR)
# Test equality and hashability
self.assertEqual(field_descriptor, field_descriptor)
self.assertEqual(
@@ -505,73 +461,32 @@ class GeneratedDescriptorTest(unittest.TestCase):
field_descriptor)
self.assertIn(field_descriptor, [field_descriptor])
self.assertIn(field_descriptor, {field_descriptor: None})
- self.assertEqual(None, field_descriptor.extension_scope)
- self.assertEqual(None, field_descriptor.enum_type)
- if api_implementation.Type() == 'cpp':
- # For test coverage only
- self.assertEqual(field_descriptor.id, field_descriptor.id)
def CheckDescriptorSequence(self, sequence):
# Verifies that a property like 'messageDescriptor.fields' has all the
# properties of an immutable abc.Sequence.
- self.assertNotEqual(sequence,
- unittest_pb2.TestAllExtensions.DESCRIPTOR.fields)
- self.assertNotEqual(sequence, [])
- self.assertNotEqual(sequence, 1)
- self.assertFalse(sequence == 1) # Only for cpp test coverage
- self.assertEqual(sequence, sequence)
- expected_list = list(sequence)
- self.assertEqual(expected_list, sequence)
self.assertGreater(len(sequence), 0) # Sized
- self.assertEqual(len(sequence), len(expected_list)) # Iterable
- self.assertEqual(sequence[len(sequence) -1], sequence[-1])
+ self.assertEqual(len(sequence), len(list(sequence))) # Iterable
item = sequence[0]
self.assertEqual(item, sequence[0])
self.assertIn(item, sequence) # Container
self.assertEqual(sequence.index(item), 0)
self.assertEqual(sequence.count(item), 1)
- other_item = unittest_pb2.NestedTestAllTypes.DESCRIPTOR.fields[0]
- self.assertNotIn(other_item, sequence)
- self.assertEqual(sequence.count(other_item), 0)
- self.assertRaises(ValueError, sequence.index, other_item)
- self.assertRaises(ValueError, sequence.index, [])
reversed_iterator = reversed(sequence)
self.assertEqual(list(reversed_iterator), list(sequence)[::-1])
self.assertRaises(StopIteration, next, reversed_iterator)
- expected_list[0] = 'change value'
- self.assertNotEqual(expected_list, sequence)
- # TODO(jieluo): Change __repr__ support for DescriptorSequence.
- if api_implementation.Type() == 'python':
- self.assertEqual(str(list(sequence)), str(sequence))
- else:
- self.assertEqual(str(sequence)[0], '<')
def CheckDescriptorMapping(self, mapping):
# Verifies that a property like 'messageDescriptor.fields' has all the
# properties of an immutable abc.Mapping.
- self.assertNotEqual(
- mapping, unittest_pb2.TestAllExtensions.DESCRIPTOR.fields_by_name)
- self.assertNotEqual(mapping, {})
- self.assertNotEqual(mapping, 1)
- self.assertFalse(mapping == 1) # Only for cpp test coverage
- excepted_dict = dict(mapping.items())
- self.assertEqual(mapping, excepted_dict)
- self.assertEqual(mapping, mapping)
self.assertGreater(len(mapping), 0) # Sized
- self.assertEqual(len(mapping), len(excepted_dict)) # Iterable
+ self.assertEqual(len(mapping), len(list(mapping))) # Iterable
if sys.version_info >= (3,):
key, item = next(iter(mapping.items()))
else:
key, item = mapping.items()[0]
self.assertIn(key, mapping) # Container
self.assertEqual(mapping.get(key), item)
- with self.assertRaises(TypeError):
- mapping.get()
- # TODO(jieluo): Fix python and cpp extension diff.
- if api_implementation.Type() == 'python':
- self.assertRaises(TypeError, mapping.get, [])
- else:
- self.assertEqual(None, mapping.get([]))
# keys(), iterkeys() &co
item = (next(iter(mapping.keys())), next(iter(mapping.values())))
self.assertEqual(item, next(iter(mapping.items())))
@@ -582,18 +497,6 @@ class GeneratedDescriptorTest(unittest.TestCase):
CheckItems(mapping.keys(), mapping.iterkeys())
CheckItems(mapping.values(), mapping.itervalues())
CheckItems(mapping.items(), mapping.iteritems())
- excepted_dict[key] = 'change value'
- self.assertNotEqual(mapping, excepted_dict)
- del excepted_dict[key]
- excepted_dict['new_key'] = 'new'
- self.assertNotEqual(mapping, excepted_dict)
- self.assertRaises(KeyError, mapping.__getitem__, 'key_error')
- self.assertRaises(KeyError, mapping.__getitem__, len(mapping) + 1)
- # TODO(jieluo): Add __repr__ support for DescriptorMapping.
- if api_implementation.Type() == 'python':
- self.assertEqual(len(str(dict(mapping.items()))), len(str(mapping)))
- else:
- self.assertEqual(str(mapping)[0], '<')
def testDescriptor(self):
message_descriptor = unittest_pb2.TestAllTypes.DESCRIPTOR
@@ -603,26 +506,13 @@ class GeneratedDescriptorTest(unittest.TestCase):
field_descriptor = message_descriptor.fields_by_camelcase_name[
'optionalInt32']
self.CheckFieldDescriptor(field_descriptor)
- enum_descriptor = unittest_pb2.DESCRIPTOR.enum_types_by_name[
- 'ForeignEnum']
- self.assertEqual(None, enum_descriptor.containing_type)
- # Test extension range
- self.assertEqual(
- unittest_pb2.TestAllExtensions.DESCRIPTOR.extension_ranges,
- [(1, 536870912)])
- self.assertEqual(
- unittest_pb2.TestMultipleExtensionRanges.DESCRIPTOR.extension_ranges,
- [(42, 43), (4143, 4244), (65536, 536870912)])
def testCppDescriptorContainer(self):
- containing_file = unittest_pb2.DESCRIPTOR
- self.CheckDescriptorSequence(containing_file.dependencies)
- self.CheckDescriptorMapping(containing_file.message_types_by_name)
- self.CheckDescriptorMapping(containing_file.enum_types_by_name)
- self.CheckDescriptorMapping(containing_file.services_by_name)
- self.CheckDescriptorMapping(containing_file.extensions_by_name)
- self.CheckDescriptorMapping(
- unittest_pb2.TestNestedExtension.DESCRIPTOR.extensions_by_name)
+ # Check that the collection is still valid even if the parent disappeared.
+ enum = unittest_pb2.TestAllTypes.DESCRIPTOR.enum_types_by_name['NestedEnum']
+ values = enum.values
+ del enum
+ self.assertEqual('FOO', values[0].name)
def testCppDescriptorContainer_Iterator(self):
# Same test with the iterator
@@ -636,18 +526,6 @@ class GeneratedDescriptorTest(unittest.TestCase):
self.assertEqual(service_descriptor.name, 'TestService')
self.assertEqual(service_descriptor.methods[0].name, 'Foo')
self.assertIs(service_descriptor.file, unittest_pb2.DESCRIPTOR)
- self.assertEqual(service_descriptor.index, 0)
- self.CheckDescriptorMapping(service_descriptor.methods_by_name)
-
- def testOneofDescriptor(self):
- message_descriptor = unittest_pb2.TestAllTypes.DESCRIPTOR
- oneof_descriptor = message_descriptor.oneofs_by_name['oneof_field']
- self.assertFalse(oneof_descriptor.has_options)
- self.assertEqual(message_descriptor, oneof_descriptor.containing_type)
- self.assertEqual('oneof_field', oneof_descriptor.name)
- self.assertEqual('protobuf_unittest.TestAllTypes.oneof_field',
- oneof_descriptor.full_name)
- self.assertEqual(0, oneof_descriptor.index)
class DescriptorCopyToProtoTest(unittest.TestCase):
@@ -742,19 +620,6 @@ 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(
@@ -798,64 +663,49 @@ class DescriptorCopyToProtoTest(unittest.TestCase):
descriptor_pb2.DescriptorProto,
TEST_MESSAGE_WITH_SEVERAL_EXTENSIONS_ASCII)
- def testCopyToProto_FileDescriptor(self):
- UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII = ("""
- name: 'google/protobuf/unittest_import.proto'
- package: 'protobuf_unittest_import'
- dependency: 'google/protobuf/unittest_import_public.proto'
- message_type: <
- name: 'ImportMessage'
- field: <
- name: 'd'
- number: 1
- label: 1 # Optional
- type: 5 # TYPE_INT32
- >
- >
- """ +
- """enum_type: <
- name: 'ImportEnum'
- value: <
- name: 'IMPORT_FOO'
- number: 7
- >
- value: <
- name: 'IMPORT_BAR'
- number: 8
- >
- value: <
- name: 'IMPORT_BAZ'
- number: 9
- >
- >
- enum_type: <
- name: 'ImportEnumForMap'
- value: <
- name: 'UNKNOWN'
- number: 0
- >
- value: <
- name: 'FOO'
- number: 1
- >
- value: <
- name: 'BAR'
- number: 2
- >
- >
- options: <
- java_package: 'com.google.protobuf.test'
- optimize_for: 1 # SPEED
- """ +
- """
- cc_enable_arenas: true
- >
- public_dependency: 0
- """)
- self._InternalTestCopyToProto(
- unittest_import_pb2.DESCRIPTOR,
- descriptor_pb2.FileDescriptorProto,
- UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII)
+ # Disable this test so we can make changes to the proto file.
+ # TODO(xiaofeng): Enable this test after cl/55530659 is submitted.
+ #
+ # def testCopyToProto_FileDescriptor(self):
+ # UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII = ("""
+ # name: 'google/protobuf/unittest_import.proto'
+ # package: 'protobuf_unittest_import'
+ # dependency: 'google/protobuf/unittest_import_public.proto'
+ # message_type: <
+ # name: 'ImportMessage'
+ # field: <
+ # name: 'd'
+ # number: 1
+ # label: 1 # Optional
+ # type: 5 # TYPE_INT32
+ # >
+ # >
+ # """ +
+ # """enum_type: <
+ # name: 'ImportEnum'
+ # value: <
+ # name: 'IMPORT_FOO'
+ # number: 7
+ # >
+ # value: <
+ # name: 'IMPORT_BAR'
+ # number: 8
+ # >
+ # value: <
+ # name: 'IMPORT_BAZ'
+ # number: 9
+ # >
+ # >
+ # options: <
+ # java_package: 'com.google.protobuf.test'
+ # optimize_for: 1 # SPEED
+ # >
+ # public_dependency: 0
+ # """)
+ # self._InternalTestCopyToProto(
+ # unittest_import_pb2.DESCRIPTOR,
+ # descriptor_pb2.FileDescriptorProto,
+ # UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII)
def testCopyToProto_ServiceDescriptor(self):
TEST_SERVICE_ASCII = """
@@ -871,47 +721,12 @@ class DescriptorCopyToProtoTest(unittest.TestCase):
output_type: '.protobuf_unittest.BarResponse'
>
"""
- self._InternalTestCopyToProto(
- unittest_pb2.TestService.DESCRIPTOR,
- descriptor_pb2.ServiceDescriptorProto,
- TEST_SERVICE_ASCII)
-
- @unittest.skipIf(
- api_implementation.Type() == 'python',
- 'It is not implemented in python.')
- # TODO(jieluo): Add support for pure python or remove in c extension.
- def testCopyToProto_MethodDescriptor(self):
- expected_ascii = """
- name: 'Foo'
- input_type: '.protobuf_unittest.FooRequest'
- output_type: '.protobuf_unittest.FooResponse'
- """
- method_descriptor = unittest_pb2.TestService.DESCRIPTOR.FindMethodByName(
- 'Foo')
- self._InternalTestCopyToProto(
- method_descriptor,
- descriptor_pb2.MethodDescriptorProto,
- expected_ascii)
-
- @unittest.skipIf(
- api_implementation.Type() == 'python',
- 'Pure python does not raise error.')
- # TODO(jieluo): Fix pure python to check with the proto type.
- def testCopyToProto_TypeError(self):
- file_proto = descriptor_pb2.FileDescriptorProto()
- self.assertRaises(TypeError,
- unittest_pb2.TestEmptyMessage.DESCRIPTOR.CopyToProto,
- file_proto)
- self.assertRaises(TypeError,
- unittest_pb2.ForeignEnum.DESCRIPTOR.CopyToProto,
- file_proto)
- self.assertRaises(TypeError,
- unittest_pb2.TestService.DESCRIPTOR.CopyToProto,
- file_proto)
- proto = descriptor_pb2.DescriptorProto()
- self.assertRaises(TypeError,
- unittest_import_pb2.DESCRIPTOR.CopyToProto,
- proto)
+ # TODO(rocking): enable this test after the proto descriptor change is
+ # checked in.
+ #self._InternalTestCopyToProto(
+ # unittest_pb2.TestService.DESCRIPTOR,
+ # descriptor_pb2.ServiceDescriptorProto,
+ # TEST_SERVICE_ASCII)
class MakeDescriptorTest(unittest.TestCase):
@@ -959,9 +774,6 @@ class MakeDescriptorTest(unittest.TestCase):
result.nested_types[0].enum_types[0])
self.assertFalse(result.has_options)
self.assertFalse(result.fields[0].has_options)
- if api_implementation.Type() == 'cpp':
- with self.assertRaises(AttributeError):
- result.fields[0].has_options = False
def testMakeDescriptorWithUnsignedIntField(self):
file_descriptor_proto = descriptor_pb2.FileDescriptorProto()
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/encoder.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/encoder.py
index 0d1f49dd9c..ebec42e530 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/encoder.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/encoder.py
@@ -372,7 +372,7 @@ def MapSizer(field_descriptor, is_message_map):
def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
- def EncodeVarint(write, value, unused_deterministic=None):
+ def EncodeVarint(write, value, unused_deterministic):
bits = value & 0x7f
value >>= 7
while value:
@@ -388,7 +388,7 @@ def _SignedVarintEncoder():
"""Return an encoder for a basic signed varint value (does not include
tag)."""
- def EncodeSignedVarint(write, value, unused_deterministic=None):
+ def EncodeSignedVarint(write, value, unused_deterministic):
if value < 0:
value += (1 << 64)
bits = value & 0x7f
@@ -418,8 +418,7 @@ def _VarintBytes(value):
def TagBytes(field_number, wire_type):
"""Encode the given tag and return the bytes. Only called at startup."""
- return six.binary_type(
- _VarintBytes(wire_format.PackTag(field_number, wire_type)))
+ return _VarintBytes(wire_format.PackTag(field_number, wire_type))
# --------------------------------------------------------------------
# As with sizers (see above), we have a number of common encoder
@@ -524,14 +523,14 @@ def _StructPackEncoder(wire_type, format):
return EncodePackedField
elif is_repeated:
tag_bytes = TagBytes(field_number, wire_type)
- def EncodeRepeatedField(write, value, unused_deterministic=None):
+ def EncodeRepeatedField(write, value, unused_deterministic):
for element in value:
write(tag_bytes)
write(local_struct_pack(format, element))
return EncodeRepeatedField
else:
tag_bytes = TagBytes(field_number, wire_type)
- def EncodeField(write, value, unused_deterministic=None):
+ def EncodeField(write, value, unused_deterministic):
write(tag_bytes)
return write(local_struct_pack(format, value))
return EncodeField
@@ -595,7 +594,7 @@ def _FloatingPointEncoder(wire_type, format):
return EncodePackedField
elif is_repeated:
tag_bytes = TagBytes(field_number, wire_type)
- def EncodeRepeatedField(write, value, unused_deterministic=None):
+ def EncodeRepeatedField(write, value, unused_deterministic):
for element in value:
write(tag_bytes)
try:
@@ -605,7 +604,7 @@ def _FloatingPointEncoder(wire_type, format):
return EncodeRepeatedField
else:
tag_bytes = TagBytes(field_number, wire_type)
- def EncodeField(write, value, unused_deterministic=None):
+ def EncodeField(write, value, unused_deterministic):
write(tag_bytes)
try:
write(local_struct_pack(format, value))
@@ -662,7 +661,7 @@ def BoolEncoder(field_number, is_repeated, is_packed):
return EncodePackedField
elif is_repeated:
tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_VARINT)
- def EncodeRepeatedField(write, value, unused_deterministic=None):
+ def EncodeRepeatedField(write, value, unused_deterministic):
for element in value:
write(tag_bytes)
if element:
@@ -672,7 +671,7 @@ def BoolEncoder(field_number, is_repeated, is_packed):
return EncodeRepeatedField
else:
tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_VARINT)
- def EncodeField(write, value, unused_deterministic=None):
+ def EncodeField(write, value, unused_deterministic):
write(tag_bytes)
if value:
return write(true_byte)
@@ -820,7 +819,7 @@ def MapEncoder(field_descriptor):
encode_message = MessageEncoder(field_descriptor.number, False, False)
def EncodeField(write, value, deterministic):
- value_keys = sorted(value.keys()) if deterministic else value
+ value_keys = sorted(value.keys()) if deterministic else value.keys()
for key in value_keys:
entry_msg = message_type._concrete_class(key=key, value=value[key])
encode_message(write, entry_msg, deterministic)
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/enum_type_wrapper.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/enum_type_wrapper.py
index 1cffe35295..1cffe35295 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/enum_type_wrapper.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/enum_type_wrapper.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/factory_test1.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/factory_test1.proto
index d2fbbeecf1..d2fbbeecf1 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/factory_test1.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/factory_test1.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/factory_test2.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/factory_test2.proto
index 5fcbc5ac9f..5fcbc5ac9f 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/factory_test2.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/factory_test2.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/file_options_test.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/file_options_test.proto
index 4eceeb07f4..4eceeb07f4 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/file_options_test.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/file_options_test.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/generator_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/generator_test.py
index 7f13f9da3d..7f13f9da3d 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/generator_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/generator_test.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/__init__.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/__init__.py
index 5121dd0ec5..5121dd0ec5 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/__init__.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/__init__.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/inner.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/inner.proto
index 2887c1230e..2887c1230e 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/inner.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/inner.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/outer.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/outer.proto
index a27fb5c8f4..a27fb5c8f4 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/import_test_package/outer.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/import_test_package/outer.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/json_format_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/json_format_test.py
index d891dce12d..077b64dbab 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/json_format_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/json_format_test.py
@@ -50,7 +50,6 @@ from google.protobuf import struct_pb2
from google.protobuf import timestamp_pb2
from google.protobuf import wrappers_pb2
from google.protobuf import unittest_mset_pb2
-from google.protobuf import unittest_pb2
from google.protobuf.internal import well_known_types
from google.protobuf import json_format
from google.protobuf.util import json_format_proto3_pb2
@@ -160,16 +159,6 @@ class JsonFormatTest(JsonFormatBase):
json_format.Parse(text, parsed_message)
self.assertEqual(message, parsed_message)
- def testUnknownEnumToJsonAndBack(self):
- text = '{\n "enumValue": 999\n}'
- message = json_format_proto3_pb2.TestMessage()
- message.enum_value = 999
- self.assertEqual(json_format.MessageToJson(message),
- text)
- parsed_message = json_format_proto3_pb2.TestMessage()
- json_format.Parse(text, parsed_message)
- self.assertEqual(message, parsed_message)
-
def testExtensionToJsonAndBack(self):
message = unittest_mset_pb2.TestMessageSetContainer()
ext1 = unittest_mset_pb2.TestMessageSetExtension1.message_set_extension
@@ -183,10 +172,6 @@ class JsonFormatTest(JsonFormatBase):
json_format.Parse(message_text, parsed_message)
self.assertEqual(message, parsed_message)
- def testExtensionErrors(self):
- self.CheckError('{"[extensionField]": {}}',
- 'Message type proto3.TestMessage does not have extensions')
-
def testExtensionToDictAndBack(self):
message = unittest_mset_pb2.TestMessageSetContainer()
ext1 = unittest_mset_pb2.TestMessageSetExtension1.message_set_extension
@@ -309,18 +294,7 @@ class JsonFormatTest(JsonFormatBase):
self.assertEqual(message.int32_value, 1)
def testMapFields(self):
- message = json_format_proto3_pb2.TestNestedMap()
- self.assertEqual(
- json.loads(json_format.MessageToJson(message, True)),
- json.loads('{'
- '"boolMap": {},'
- '"int32Map": {},'
- '"int64Map": {},'
- '"uint32Map": {},'
- '"uint64Map": {},'
- '"stringMap": {},'
- '"mapMap": {}'
- '}'))
+ message = json_format_proto3_pb2.TestMap()
message.bool_map[True] = 1
message.bool_map[False] = 2
message.int32_map[1] = 2
@@ -333,19 +307,17 @@ class JsonFormatTest(JsonFormatBase):
message.uint64_map[2] = 3
message.string_map['1'] = 2
message.string_map['null'] = 3
- message.map_map['1'].bool_map[True] = 3
self.assertEqual(
- json.loads(json_format.MessageToJson(message, False)),
+ json.loads(json_format.MessageToJson(message, True)),
json.loads('{'
'"boolMap": {"false": 2, "true": 1},'
'"int32Map": {"1": 2, "2": 3},'
'"int64Map": {"1": 2, "2": 3},'
'"uint32Map": {"1": 2, "2": 3},'
'"uint64Map": {"1": 2, "2": 3},'
- '"stringMap": {"1": 2, "null": 3},'
- '"mapMap": {"1": {"boolMap": {"true": 3}}}'
+ '"stringMap": {"1": 2, "null": 3}'
'}'))
- parsed_message = json_format_proto3_pb2.TestNestedMap()
+ parsed_message = json_format_proto3_pb2.TestMap()
self.CheckParseBack(message, parsed_message)
def testOneofFields(self):
@@ -731,9 +703,6 @@ class JsonFormatTest(JsonFormatBase):
json_format.Parse,
'{"repeatedInt32Value":[1, null]}',
parsed_message)
- self.CheckError('{"repeatedMessageValue":[null]}',
- 'Failed to parse repeatedMessageValue field: null is not'
- ' allowed to be used as an element in a repeated field.')
def testNanFloat(self):
message = json_format_proto3_pb2.TestMessage()
@@ -758,16 +727,6 @@ class JsonFormatTest(JsonFormatBase):
'{"enumValue": "baz"}',
'Failed to parse enumValue field: Invalid enum value baz '
'for enum type proto3.EnumType.')
- # Proto3 accepts numeric unknown enums.
- text = '{"enumValue": 12345}'
- json_format.Parse(text, message)
- # Proto2 does not accept unknown enums.
- message = unittest_pb2.TestAllTypes()
- self.assertRaisesRegexp(
- json_format.ParseError,
- 'Failed to parse optionalNestedEnum field: Invalid enum value 12345 '
- 'for enum type protobuf_unittest.TestAllTypes.NestedEnum.',
- json_format.Parse, '{"optionalNestedEnum": 12345}', message)
def testParseBadIdentifer(self):
self.CheckError('{int32Value: 1}',
@@ -840,11 +799,6 @@ class JsonFormatTest(JsonFormatBase):
self.CheckError('{"bytesValue": "AQI*"}',
'Failed to parse bytesValue field: Incorrect padding.')
- def testInvalidRepeated(self):
- self.CheckError('{"repeatedInt32Value": 12345}',
- (r'Failed to parse repeatedInt32Value field: repeated field'
- r' repeatedInt32Value must be in \[\] which is 12345.'))
-
def testInvalidMap(self):
message = json_format_proto3_pb2.TestMap()
text = '{"int32Map": {"null": 2, "2": 3}}'
@@ -870,12 +824,6 @@ class JsonFormatTest(JsonFormatBase):
json_format.ParseError,
'Failed to load JSON: duplicate key a',
json_format.Parse, text, message)
- text = r'{"stringMap": 0}'
- self.assertRaisesRegexp(
- json_format.ParseError,
- 'Failed to parse stringMap field: Map field string_map must be '
- 'in a dict which is 0.',
- json_format.Parse, text, message)
def testInvalidTimestamp(self):
message = json_format_proto3_pb2.TestTimestamp()
@@ -963,12 +911,6 @@ class JsonFormatTest(JsonFormatBase):
json_format.MessageToJson(message))
self.assertEqual('{\n "int32_value": 12345\n}',
json_format.MessageToJson(message, False, True))
- # When including_default_value_fields is True.
- message = json_format_proto3_pb2.TestTimestamp()
- self.assertEqual('{\n "repeatedValue": []\n}',
- json_format.MessageToJson(message, True, False))
- self.assertEqual('{\n "repeated_value": []\n}',
- json_format.MessageToJson(message, True, True))
# Parsers accept both original proto field names and lowerCamelCase names.
message = json_format_proto3_pb2.TestMessage()
@@ -983,18 +925,6 @@ class JsonFormatTest(JsonFormatBase):
self.assertEqual('{\n"int32Value": 12345\n}',
json_format.MessageToJson(message, indent=0))
- def testFormatEnumsAsInts(self):
- message = json_format_proto3_pb2.TestMessage()
- message.enum_value = json_format_proto3_pb2.BAR
- message.repeated_enum_value.append(json_format_proto3_pb2.FOO)
- message.repeated_enum_value.append(json_format_proto3_pb2.BAR)
- self.assertEqual(json.loads('{\n'
- ' "enumValue": 1,\n'
- ' "repeatedEnumValue": [0, 1]\n'
- '}\n'),
- json.loads(json_format.MessageToJson(
- message, use_integers_for_enums=True)))
-
def testParseDict(self):
expected = 12345
js_dict = {'int32Value': expected}
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/message_factory_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/message_factory_test.py
index 6df52ed280..4caa244344 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/message_factory_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/message_factory_test.py
@@ -40,7 +40,6 @@ except ImportError:
import unittest
from google.protobuf import descriptor_pb2
-from google.protobuf.internal import api_implementation
from google.protobuf.internal import factory_test1_pb2
from google.protobuf.internal import factory_test2_pb2
from google.protobuf import descriptor_database
@@ -107,17 +106,8 @@ class MessageFactoryTest(unittest.TestCase):
def testGetMessages(self):
# performed twice because multiple calls with the same input must be allowed
for _ in range(2):
- # GetMessage should work regardless of the order the FileDescriptorProto
- # are provided. In particular, the function should succeed when the files
- # are not in the topological order of dependencies.
-
- # Assuming factory_test2_fd depends on factory_test1_fd.
- self.assertIn(self.factory_test1_fd.name,
- self.factory_test2_fd.dependency)
- # Get messages should work when a file comes before its dependencies:
- # factory_test2_fd comes before factory_test1_fd.
- messages = message_factory.GetMessages([self.factory_test2_fd,
- self.factory_test1_fd])
+ messages = message_factory.GetMessages([self.factory_test1_fd,
+ self.factory_test2_fd])
self.assertTrue(
set(['google.protobuf.python.internal.Factory2Message',
'google.protobuf.python.internal.Factory1Message'],
@@ -140,21 +130,6 @@ class MessageFactoryTest(unittest.TestCase):
msg1.Extensions[ext2] = 'test2'
self.assertEqual('test1', msg1.Extensions[ext1])
self.assertEqual('test2', msg1.Extensions[ext2])
- self.assertEqual(None,
- msg1.Extensions._FindExtensionByNumber(12321))
- if api_implementation.Type() == 'cpp':
- # TODO(jieluo): Fix len to return the correct value.
- # self.assertEqual(2, len(msg1.Extensions))
- self.assertEqual(len(msg1.Extensions), len(msg1.Extensions))
- self.assertRaises(TypeError,
- msg1.Extensions._FindExtensionByName, 0)
- self.assertRaises(TypeError,
- msg1.Extensions._FindExtensionByNumber, '')
- else:
- self.assertEqual(None,
- msg1.Extensions._FindExtensionByName(0))
- self.assertEqual(None,
- msg1.Extensions._FindExtensionByNumber(''))
def testDuplicateExtensionNumber(self):
pool = descriptor_pool.DescriptorPool()
@@ -208,14 +183,7 @@ class MessageFactoryTest(unittest.TestCase):
with self.assertRaises(Exception) as cm:
factory.GetMessages([f.name])
- self.assertIn(str(cm.exception),
- ['Extensions '
- '"google.protobuf.python.internal.Duplicate.extension_field" and'
- ' "google.protobuf.python.internal.Extension.extension_field"'
- ' both try to extend message type'
- ' "google.protobuf.python.internal.Container"'
- ' with field number 2.',
- 'Double registration of Extensions'])
+ self.assertIsInstance(cm.exception, (AssertionError, ValueError))
if __name__ == '__main__':
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/message_listener.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/message_listener.py
index 0fc255a774..0fc255a774 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/message_listener.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/message_listener.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/message_set_extensions.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/message_set_extensions.proto
index 14e5f19375..14e5f19375 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/message_set_extensions.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/message_set_extensions.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/message_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/message_test.py
index 61a56a678c..29a515b2a3 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/message_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/message_test.py
@@ -51,18 +51,12 @@ import operator
import pickle
import six
import sys
-import warnings
try:
- import unittest2 as unittest # PY26
+ import unittest2 as unittest #PY26
except ImportError:
import unittest
-try:
- cmp # Python 2
-except NameError:
- cmp = lambda x, y: (x > y) - (x < y) # Python 3
-from google.protobuf import map_proto2_unittest_pb2
from google.protobuf import map_unittest_pb2
from google.protobuf import unittest_pb2
from google.protobuf import unittest_proto3_arena_pb2
@@ -71,7 +65,6 @@ from google.protobuf import descriptor_pool
from google.protobuf import message_factory
from google.protobuf import text_format
from google.protobuf.internal import api_implementation
-from google.protobuf.internal import encoder
from google.protobuf.internal import packed_field_test_pb2
from google.protobuf.internal import test_util
from google.protobuf.internal import testing_refleaks
@@ -99,7 +92,7 @@ def IsNegInf(val):
BaseTestCase = testing_refleaks.BaseTestCase
-@_parameterized.named_parameters(
+@_parameterized.NamedParameters(
('_proto2', unittest_pb2),
('_proto3', unittest_proto3_arena_pb2))
class MessageTest(BaseTestCase):
@@ -143,27 +136,6 @@ class MessageTest(BaseTestCase):
golden_copy = copy.deepcopy(golden_message)
self.assertEqual(golden_data, golden_copy.SerializeToString())
- def testParseErrors(self, message_module):
- msg = message_module.TestAllTypes()
- self.assertRaises(TypeError, msg.FromString, 0)
- self.assertRaises(Exception, msg.FromString, '0')
- # TODO(jieluo): Fix cpp extension to raise error instead of warning.
- # b/27494216
- end_tag = encoder.TagBytes(1, 4)
- if api_implementation.Type() == 'python':
- with self.assertRaises(message.DecodeError) as context:
- msg.FromString(end_tag)
- self.assertEqual('Unexpected end-group tag.', str(context.exception))
- else:
- with warnings.catch_warnings(record=True) as w:
- # Cause all warnings to always be triggered.
- warnings.simplefilter('always')
- msg.FromString(end_tag)
- assert len(w) == 1
- assert issubclass(w[-1].category, RuntimeWarning)
- self.assertEqual('Unexpected end-group tag: Not all data was converted',
- str(w[-1].message))
-
def testDeterminismParameters(self, message_module):
# This message is always deterministically serialized, even if determinism
# is disabled, so we can use it to verify that all the determinism
@@ -633,13 +605,6 @@ class MessageTest(BaseTestCase):
self.assertIsInstance(m.repeated_nested_message,
collections.MutableSequence)
- def testRepeatedFieldsNotHashable(self, message_module):
- m = message_module.TestAllTypes()
- with self.assertRaises(TypeError):
- hash(m.repeated_int32)
- with self.assertRaises(TypeError):
- hash(m.repeated_nested_message)
-
def testRepeatedFieldInsideNestedMessage(self, message_module):
m = message_module.NestedTestAllTypes()
m.payload.repeated_int32.extend([])
@@ -657,7 +622,6 @@ class MessageTest(BaseTestCase):
def testOneofGetCaseNonexistingField(self, message_module):
m = message_module.TestAllTypes()
self.assertRaises(ValueError, m.WhichOneof, 'no_such_oneof_field')
- self.assertRaises(Exception, m.WhichOneof, 0)
def testOneofDefaultValues(self, message_module):
m = message_module.TestAllTypes()
@@ -1033,8 +997,6 @@ class MessageTest(BaseTestCase):
m = message_module.TestAllTypes()
with self.assertRaises(IndexError) as _:
m.repeated_nested_message.pop()
- with self.assertRaises(TypeError) as _:
- m.repeated_nested_message.pop('0')
for i in range(5):
n = m.repeated_nested_message.add()
n.bb = i
@@ -1043,39 +1005,6 @@ class MessageTest(BaseTestCase):
self.assertEqual(2, m.repeated_nested_message.pop(1).bb)
self.assertEqual([1, 3], [n.bb for n in m.repeated_nested_message])
- def testRepeatedCompareWithSelf(self, message_module):
- m = message_module.TestAllTypes()
- for i in range(5):
- m.repeated_int32.insert(i, i)
- n = m.repeated_nested_message.add()
- n.bb = i
- self.assertSequenceEqual(m.repeated_int32, m.repeated_int32)
- self.assertEqual(m.repeated_nested_message, m.repeated_nested_message)
-
- def testReleasedNestedMessages(self, message_module):
- """A case that lead to a segfault when a message detached from its parent
- container has itself a child container.
- """
- m = message_module.NestedTestAllTypes()
- m = m.repeated_child.add()
- m = m.child
- m = m.repeated_child.add()
- self.assertEqual(m.payload.optional_int32, 0)
-
- def testSetRepeatedComposite(self, message_module):
- m = message_module.TestAllTypes()
- with self.assertRaises(AttributeError):
- m.repeated_int32 = []
- m.repeated_int32.append(1)
- if api_implementation.Type() == 'cpp':
- # For test coverage: cpp has a different path if composite
- # field is in cache
- with self.assertRaises(TypeError):
- m.repeated_int32 = []
- else:
- with self.assertRaises(AttributeError):
- m.repeated_int32 = []
-
# Class to test proto2-only features (required, extensions, etc.)
class Proto2Test(BaseTestCase):
@@ -1128,46 +1057,18 @@ class Proto2Test(BaseTestCase):
self.assertEqual(False, message.optional_bool)
self.assertEqual(0, message.optional_nested_message.bb)
+ # TODO(tibell): The C++ implementations actually allows assignment
+ # of unknown enum values to *scalar* fields (but not repeated
+ # fields). Once checked enum fields becomes the default in the
+ # Python implementation, the C++ implementation should follow suit.
def testAssignInvalidEnum(self):
- """Assigning an invalid enum number is not allowed in proto2."""
+ """It should not be possible to assign an invalid enum number to an
+ enum field."""
m = unittest_pb2.TestAllTypes()
- # Proto2 can not assign unknown enum.
with self.assertRaises(ValueError) as _:
m.optional_nested_enum = 1234567
self.assertRaises(ValueError, m.repeated_nested_enum.append, 1234567)
- # Assignment is a different code path than append for the C++ impl.
- m.repeated_nested_enum.append(2)
- m.repeated_nested_enum[0] = 2
- with self.assertRaises(ValueError):
- m.repeated_nested_enum[0] = 123456
-
- # Unknown enum value can be parsed but is ignored.
- m2 = unittest_proto3_arena_pb2.TestAllTypes()
- m2.optional_nested_enum = 1234567
- m2.repeated_nested_enum.append(7654321)
- serialized = m2.SerializeToString()
-
- m3 = unittest_pb2.TestAllTypes()
- m3.ParseFromString(serialized)
- self.assertFalse(m3.HasField('optional_nested_enum'))
- # 1 is the default value for optional_nested_enum.
- self.assertEqual(1, m3.optional_nested_enum)
- self.assertEqual(0, len(m3.repeated_nested_enum))
- m2.Clear()
- m2.ParseFromString(m3.SerializeToString())
- self.assertEqual(1234567, m2.optional_nested_enum)
- self.assertEqual(7654321, m2.repeated_nested_enum[0])
-
- def testUnknownEnumMap(self):
- m = map_proto2_unittest_pb2.TestEnumMap()
- m.known_map_field[123] = 0
- with self.assertRaises(ValueError):
- m.unknown_map_field[1] = 123
-
- def testExtensionsErrors(self):
- msg = unittest_pb2.TestAllTypes()
- self.assertRaises(AttributeError, getattr, msg, 'Extensions')
def testGoldenExtensions(self):
golden_data = test_util.GoldenFileData('golden_message')
@@ -1392,7 +1293,6 @@ class Proto3Test(BaseTestCase):
"""Assigning an unknown enum value is allowed and preserves the value."""
m = unittest_proto3_arena_pb2.TestAllTypes()
- # Proto3 can assign unknown enums.
m.optional_nested_enum = 1234567
self.assertEqual(1234567, m.optional_nested_enum)
m.repeated_nested_enum.append(22334455)
@@ -1407,10 +1307,18 @@ class Proto3Test(BaseTestCase):
self.assertEqual(1234567, m2.optional_nested_enum)
self.assertEqual(7654321, m2.repeated_nested_enum[0])
+ # ParseFromString in Proto2 should accept unknown enums too.
+ m3 = unittest_pb2.TestAllTypes()
+ m3.ParseFromString(serialized)
+ m2.Clear()
+ m2.ParseFromString(m3.SerializeToString())
+ self.assertEqual(1234567, m2.optional_nested_enum)
+ self.assertEqual(7654321, m2.repeated_nested_enum[0])
+
# Map isn't really a proto3-only feature. But there is no proto2 equivalent
# of google/protobuf/map_unittest.proto right now, so it's not easy to
# test both with the same test like we do for the other proto2/proto3 tests.
- # (google/protobuf/map_proto2_unittest.proto is very different in the set
+ # (google/protobuf/map_protobuf_unittest.proto is very different in the set
# of messages and fields it contains).
def testScalarMapDefaults(self):
msg = map_unittest_pb2.TestMap()
@@ -1471,17 +1379,12 @@ class Proto3Test(BaseTestCase):
msg.map_int32_int32[5] = 15
self.assertEqual(15, msg.map_int32_int32.get(5))
- self.assertEqual(15, msg.map_int32_int32.get(5))
- with self.assertRaises(TypeError):
- msg.map_int32_int32.get('')
self.assertIsNone(msg.map_int32_foreign_message.get(5))
self.assertEqual(10, msg.map_int32_foreign_message.get(5, 10))
submsg = msg.map_int32_foreign_message[5]
self.assertIs(submsg, msg.map_int32_foreign_message.get(5))
- with self.assertRaises(TypeError):
- msg.map_int32_foreign_message.get('')
def testScalarMap(self):
msg = map_unittest_pb2.TestMap()
@@ -1493,13 +1396,8 @@ class Proto3Test(BaseTestCase):
msg.map_int64_int64[-2**33] = -2**34
msg.map_uint32_uint32[123] = 456
msg.map_uint64_uint64[2**33] = 2**34
- msg.map_int32_float[2] = 1.2
- msg.map_int32_double[1] = 3.3
msg.map_string_string['abc'] = '123'
- msg.map_bool_bool[True] = True
msg.map_int32_enum[888] = 2
- # Unknown numeric enum is supported in proto3.
- msg.map_int32_enum[123] = 456
self.assertEqual([], msg.FindInitializationErrors())
@@ -1533,24 +1431,8 @@ class Proto3Test(BaseTestCase):
self.assertEqual(-2**34, msg2.map_int64_int64[-2**33])
self.assertEqual(456, msg2.map_uint32_uint32[123])
self.assertEqual(2**34, msg2.map_uint64_uint64[2**33])
- self.assertAlmostEqual(1.2, msg.map_int32_float[2])
- self.assertEqual(3.3, msg.map_int32_double[1])
self.assertEqual('123', msg2.map_string_string['abc'])
- self.assertEqual(True, msg2.map_bool_bool[True])
self.assertEqual(2, msg2.map_int32_enum[888])
- self.assertEqual(456, msg2.map_int32_enum[123])
- # TODO(jieluo): Add cpp extension support.
- if api_implementation.Type() == 'python':
- self.assertEqual('{-123: -456}',
- str(msg2.map_int32_int32))
-
- def testMapEntryAlwaysSerialized(self):
- msg = map_unittest_pb2.TestMap()
- msg.map_int32_int32[0] = 0
- msg.map_string_string[''] = ''
- self.assertEqual(msg.ByteSize(), 12)
- self.assertEqual(b'\n\x04\x08\x00\x10\x00r\x04\n\x00\x12\x00',
- msg.SerializeToString())
def testStringUnicodeConversionInMap(self):
msg = map_unittest_pb2.TestMap()
@@ -1603,11 +1485,6 @@ class Proto3Test(BaseTestCase):
self.assertIn(123, msg2.map_int32_foreign_message)
self.assertIn(-456, msg2.map_int32_foreign_message)
self.assertEqual(2, len(msg2.map_int32_foreign_message))
- # TODO(jieluo): Fix text format for message map.
- # TODO(jieluo): Add cpp extension support.
- if api_implementation.Type() == 'python':
- self.assertEqual(15,
- len(str(msg2.map_int32_foreign_message)))
def testNestedMessageMapItemDelete(self):
msg = map_unittest_pb2.TestMap()
@@ -1691,35 +1568,6 @@ class Proto3Test(BaseTestCase):
del msg2.map_int32_foreign_message[222]
self.assertFalse(222 in msg2.map_int32_foreign_message)
- with self.assertRaises(TypeError):
- del msg2.map_int32_foreign_message['']
-
- def testMapMergeFrom(self):
- msg = map_unittest_pb2.TestMap()
- msg.map_int32_int32[12] = 34
- msg.map_int32_int32[56] = 78
- msg.map_int64_int64[22] = 33
- msg.map_int32_foreign_message[111].c = 5
- msg.map_int32_foreign_message[222].c = 10
-
- msg2 = map_unittest_pb2.TestMap()
- msg2.map_int32_int32[12] = 55
- msg2.map_int64_int64[88] = 99
- msg2.map_int32_foreign_message[222].c = 15
- msg2.map_int32_foreign_message[222].d = 20
-
- msg2.map_int32_int32.MergeFrom(msg.map_int32_int32)
- self.assertEqual(34, msg2.map_int32_int32[12])
- self.assertEqual(78, msg2.map_int32_int32[56])
-
- msg2.map_int64_int64.MergeFrom(msg.map_int64_int64)
- self.assertEqual(33, msg2.map_int64_int64[22])
- self.assertEqual(99, msg2.map_int64_int64[88])
-
- msg2.map_int32_foreign_message.MergeFrom(msg.map_int32_foreign_message)
- self.assertEqual(5, msg2.map_int32_foreign_message[111].c)
- self.assertEqual(10, msg2.map_int32_foreign_message[222].c)
- self.assertFalse(msg2.map_int32_foreign_message[222].HasField('d'))
def testMergeFromBadType(self):
msg = map_unittest_pb2.TestMap()
@@ -1854,54 +1702,6 @@ class Proto3Test(BaseTestCase):
matching_dict = {2: 4, 3: 6, 4: 8}
self.assertMapIterEquals(msg.map_int32_int32.items(), matching_dict)
- def testPython2Map(self):
- if sys.version_info < (3,):
- msg = map_unittest_pb2.TestMap()
- msg.map_int32_int32[2] = 4
- msg.map_int32_int32[3] = 6
- msg.map_int32_int32[4] = 8
- msg.map_int32_int32[5] = 10
- map_int32 = msg.map_int32_int32
- self.assertEqual(4, len(map_int32))
- msg2 = map_unittest_pb2.TestMap()
- msg2.ParseFromString(msg.SerializeToString())
-
- def CheckItems(seq, iterator):
- self.assertEqual(next(iterator), seq[0])
- self.assertEqual(list(iterator), seq[1:])
-
- CheckItems(map_int32.items(), map_int32.iteritems())
- CheckItems(map_int32.keys(), map_int32.iterkeys())
- CheckItems(map_int32.values(), map_int32.itervalues())
-
- self.assertEqual(6, map_int32.get(3))
- self.assertEqual(None, map_int32.get(999))
- self.assertEqual(6, map_int32.pop(3))
- self.assertEqual(0, map_int32.pop(3))
- self.assertEqual(3, len(map_int32))
- key, value = map_int32.popitem()
- self.assertEqual(2 * key, value)
- self.assertEqual(2, len(map_int32))
- map_int32.clear()
- self.assertEqual(0, len(map_int32))
-
- with self.assertRaises(KeyError):
- map_int32.popitem()
-
- self.assertEqual(0, map_int32.setdefault(2))
- self.assertEqual(1, len(map_int32))
-
- map_int32.update(msg2.map_int32_int32)
- self.assertEqual(4, len(map_int32))
-
- with self.assertRaises(TypeError):
- map_int32.update(msg2.map_int32_int32,
- msg2.map_int32_int32)
- with self.assertRaises(TypeError):
- map_int32.update(0)
- with self.assertRaises(TypeError):
- map_int32.update(value=12)
-
def testMapItems(self):
# Map items used to have strange behaviors when use c extension. Because
# [] may reorder the map and invalidate any exsting iterators.
@@ -2032,9 +1832,6 @@ class Proto3Test(BaseTestCase):
del msg.map_int32_int32[4]
self.assertEqual(0, len(msg.map_int32_int32))
- with self.assertRaises(KeyError):
- del msg.map_int32_all_types[32]
-
def testMapsAreMapping(self):
msg = map_unittest_pb2.TestMap()
self.assertIsInstance(msg.map_int32_int32, collections.Mapping)
@@ -2043,14 +1840,6 @@ class Proto3Test(BaseTestCase):
self.assertIsInstance(msg.map_int32_foreign_message,
collections.MutableMapping)
- def testMapsCompare(self):
- msg = map_unittest_pb2.TestMap()
- msg.map_int32_int32[-123] = -456
- self.assertEqual(msg.map_int32_int32, msg.map_int32_int32)
- self.assertEqual(msg.map_int32_foreign_message,
- msg.map_int32_foreign_message)
- self.assertNotEqual(msg.map_int32_int32, 0)
-
def testMapFindInitializationErrorsSmokeTest(self):
msg = map_unittest_pb2.TestMap()
msg.map_string_string['abc'] = '123'
@@ -2138,9 +1927,8 @@ class PackedFieldTest(BaseTestCase):
self.assertEqual(golden_data, message.SerializeToString())
-@unittest.skipIf(api_implementation.Type() != 'cpp' or
- sys.version_info < (2, 7),
- 'explicit tests of the C++ implementation for PY27 and above')
+@unittest.skipIf(api_implementation.Type() != 'cpp',
+ 'explicit tests of the C++ implementation')
class OversizeProtosTest(BaseTestCase):
@classmethod
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/missing_enum_values.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/missing_enum_values.proto
index 1850be5bb7..1850be5bb7 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/missing_enum_values.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/missing_enum_values.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/more_extensions.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/more_extensions.proto
index 78f1467361..78f1467361 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/more_extensions.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/more_extensions.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/more_extensions_dynamic.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/more_extensions_dynamic.proto
index 98fcbcb663..98fcbcb663 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/more_extensions_dynamic.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/more_extensions_dynamic.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/more_messages.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/more_messages.proto
index 2c6ab9efdf..2c6ab9efdf 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/more_messages.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/more_messages.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/packed_field_test.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/packed_field_test.proto
index 0dfdc10a87..0dfdc10a87 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/packed_field_test.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/packed_field_test.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/proto_builder_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/proto_builder_test.py
index 36dfbfded8..36dfbfded8 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/proto_builder_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/proto_builder_test.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/python_message.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/python_message.py
index 975e3b4d52..c363d84324 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/python_message.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/python_message.py
@@ -1010,16 +1010,11 @@ def _AddByteSizeMethod(message_descriptor, cls):
return self._cached_byte_size
size = 0
- descriptor = self.DESCRIPTOR
- if descriptor.GetOptions().map_entry:
- # Fields of map entry should always be serialized.
- size = descriptor.fields_by_name['key']._sizer(self.key)
- size += descriptor.fields_by_name['value']._sizer(self.value)
- else:
- for field_descriptor, field_value in self.ListFields():
- size += field_descriptor._sizer(field_value)
- for tag_bytes, value_bytes in self._unknown_fields:
- size += len(tag_bytes) + len(value_bytes)
+ for field_descriptor, field_value in self.ListFields():
+ size += field_descriptor._sizer(field_value)
+
+ for tag_bytes, value_bytes in self._unknown_fields:
+ size += len(tag_bytes) + len(value_bytes)
self._cached_byte_size = size
self._cached_byte_size_dirty = False
@@ -1058,20 +1053,11 @@ def _AddSerializePartialToStringMethod(message_descriptor, cls):
api_implementation.IsPythonDefaultSerializationDeterministic())
else:
deterministic = bool(deterministic)
-
- descriptor = self.DESCRIPTOR
- if descriptor.GetOptions().map_entry:
- # Fields of map entry should always be serialized.
- descriptor.fields_by_name['key']._encoder(
- write_bytes, self.key, deterministic)
- descriptor.fields_by_name['value']._encoder(
- write_bytes, self.value, deterministic)
- else:
- for field_descriptor, field_value in self.ListFields():
- field_descriptor._encoder(write_bytes, field_value, deterministic)
- for tag_bytes, value_bytes in self._unknown_fields:
- write_bytes(tag_bytes)
- write_bytes(value_bytes)
+ for field_descriptor, field_value in self.ListFields():
+ field_descriptor._encoder(write_bytes, field_value, deterministic)
+ for tag_bytes, value_bytes in self._unknown_fields:
+ write_bytes(tag_bytes)
+ write_bytes(value_bytes)
cls._InternalSerialize = InternalSerialize
@@ -1109,8 +1095,7 @@ def _AddMergeFromStringMethod(message_descriptor, cls):
new_pos = local_SkipField(buffer, new_pos, end, tag_bytes)
if new_pos == -1:
return pos
- if (not is_proto3 or
- api_implementation.GetPythonProto3PreserveUnknownsDefault()):
+ if not is_proto3:
if not unknown_field_list:
unknown_field_list = self._unknown_fields = []
unknown_field_list.append(
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/python_protobuf.cc b/third_party/protobuf/3.4.0/python/google/protobuf/internal/python_protobuf.cc
index f90cc4387e..f90cc4387e 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/python_protobuf.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/python_protobuf.cc
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/reflection_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/reflection_test.py
index 0306ff4625..55b0d72e1e 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/reflection_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/reflection_test.py
@@ -620,14 +620,6 @@ class ReflectionTest(BaseTestCase):
self.assertRaises(TypeError, setattr, proto, 'optional_int32', 'foo')
self.assertRaises(TypeError, setattr, proto, 'optional_string', 10)
self.assertRaises(TypeError, setattr, proto, 'optional_bytes', 10)
- self.assertRaises(TypeError, setattr, proto, 'optional_bool', 'foo')
- self.assertRaises(TypeError, setattr, proto, 'optional_float', 'foo')
- self.assertRaises(TypeError, setattr, proto, 'optional_double', 'foo')
- # TODO(jieluo): Fix type checking difference for python and c extension
- if api_implementation.Type() == 'python':
- self.assertRaises(TypeError, setattr, proto, 'optional_bool', 1.1)
- else:
- proto.optional_bool = 1.1
def assertIntegerTypes(self, integer_fn):
"""Verifies setting of scalar integers.
@@ -694,10 +686,8 @@ class ReflectionTest(BaseTestCase):
self.assertEqual(expected_min, getattr(pb, field_name))
setattr(pb, field_name, expected_max)
self.assertEqual(expected_max, getattr(pb, field_name))
- self.assertRaises((ValueError, TypeError), setattr, pb, field_name,
- expected_min - 1)
- self.assertRaises((ValueError, TypeError), setattr, pb, field_name,
- expected_max + 1)
+ self.assertRaises(ValueError, setattr, pb, field_name, expected_min - 1)
+ self.assertRaises(ValueError, setattr, pb, field_name, expected_max + 1)
TestMinAndMaxIntegers('optional_int32', -(1 << 31), (1 << 31) - 1)
TestMinAndMaxIntegers('optional_uint32', 0, 0xffffffff)
@@ -706,7 +696,7 @@ class ReflectionTest(BaseTestCase):
# A bit of white-box testing since -1 is an int and not a long in C++ and
# so goes down a different path.
pb = unittest_pb2.TestAllTypes()
- with self.assertRaises((ValueError, TypeError)):
+ with self.assertRaises(ValueError):
pb.optional_uint64 = integer_fn(-(1 << 63))
pb = unittest_pb2.TestAllTypes()
@@ -730,12 +720,6 @@ class ReflectionTest(BaseTestCase):
proto.repeated_int32[0] = 23
self.assertRaises(IndexError, proto.repeated_int32.__setitem__, 500, 23)
self.assertRaises(TypeError, proto.repeated_int32.__setitem__, 0, 'abc')
- self.assertRaises(TypeError, proto.repeated_int32.__setitem__, 0, [])
- self.assertRaises(TypeError, proto.repeated_int32.__setitem__,
- 'index', 23)
-
- proto.repeated_string.append('2')
- self.assertRaises(TypeError, proto.repeated_string.__setitem__, 0, 10)
# Repeated enums tests.
#proto.repeated_nested_enum.append(0)
@@ -1023,14 +1007,6 @@ class ReflectionTest(BaseTestCase):
self.assertEqual(4, len(proto.repeated_nested_message))
self.assertEqual(n1, proto.repeated_nested_message[2])
self.assertEqual(n2, proto.repeated_nested_message[3])
- self.assertRaises(TypeError,
- proto.repeated_nested_message.extend, n1)
- self.assertRaises(TypeError,
- proto.repeated_nested_message.extend, [0])
- wrong_message_type = unittest_pb2.TestAllTypes()
- self.assertRaises(TypeError,
- proto.repeated_nested_message.extend,
- [wrong_message_type])
# Test clearing.
proto.ClearField('repeated_nested_message')
@@ -1042,8 +1018,6 @@ class ReflectionTest(BaseTestCase):
self.assertEqual(1, len(proto.repeated_nested_message))
self.assertEqual(23, proto.repeated_nested_message[0].bb)
self.assertRaises(TypeError, proto.repeated_nested_message.add, 23)
- with self.assertRaises(Exception):
- proto.repeated_nested_message[0] = 23
def testRepeatedCompositeRemove(self):
proto = unittest_pb2.TestAllTypes()
@@ -1668,11 +1642,8 @@ class ReflectionTest(BaseTestCase):
proto.SerializeToString()
proto.SerializePartialToString()
- def assertNotInitialized(self, proto, error_size=None):
- errors = []
+ def assertNotInitialized(self, proto):
self.assertFalse(proto.IsInitialized())
- self.assertFalse(proto.IsInitialized(errors))
- self.assertEqual(error_size, len(errors))
self.assertRaises(message.EncodeError, proto.SerializeToString)
# "Partial" serialization doesn't care if message is uninitialized.
proto.SerializePartialToString()
@@ -1686,7 +1657,7 @@ class ReflectionTest(BaseTestCase):
# The case of uninitialized required fields.
proto = unittest_pb2.TestRequired()
- self.assertNotInitialized(proto, 3)
+ self.assertNotInitialized(proto)
proto.a = proto.b = proto.c = 2
self.assertInitialized(proto)
@@ -1694,14 +1665,14 @@ class ReflectionTest(BaseTestCase):
proto = unittest_pb2.TestRequiredForeign()
self.assertInitialized(proto)
proto.optional_message.a = 1
- self.assertNotInitialized(proto, 2)
+ self.assertNotInitialized(proto)
proto.optional_message.b = 0
proto.optional_message.c = 0
self.assertInitialized(proto)
# Uninitialized repeated submessage.
message1 = proto.repeated_message.add()
- self.assertNotInitialized(proto, 3)
+ self.assertNotInitialized(proto)
message1.a = message1.b = message1.c = 0
self.assertInitialized(proto)
@@ -1710,11 +1681,11 @@ class ReflectionTest(BaseTestCase):
extension = unittest_pb2.TestRequired.multi
message1 = proto.Extensions[extension].add()
message2 = proto.Extensions[extension].add()
- self.assertNotInitialized(proto, 6)
+ self.assertNotInitialized(proto)
message1.a = 1
message1.b = 1
message1.c = 1
- self.assertNotInitialized(proto, 3)
+ self.assertNotInitialized(proto)
message2.a = 2
message2.b = 2
message2.c = 2
@@ -1724,7 +1695,7 @@ class ReflectionTest(BaseTestCase):
proto = unittest_pb2.TestAllExtensions()
extension = unittest_pb2.TestRequired.single
proto.Extensions[extension].a = 1
- self.assertNotInitialized(proto, 2)
+ self.assertNotInitialized(proto)
proto.Extensions[extension].b = 2
proto.Extensions[extension].c = 3
self.assertInitialized(proto)
@@ -2183,8 +2154,6 @@ class ByteSizeTest(BaseTestCase):
foreign_message_1 = self.proto.repeated_nested_message.add()
foreign_message_1.bb = 9
self.assertEqual(2 + 1 + 2 + 1 + 1 + 1, self.Size())
- repeated_nested_message = copy.deepcopy(
- self.proto.repeated_nested_message)
# 2 bytes tag plus 1 byte length plus 1 byte bb tag 1 byte int.
del self.proto.repeated_nested_message[0]
@@ -2205,16 +2174,6 @@ class ByteSizeTest(BaseTestCase):
del self.proto.repeated_nested_message[0]
self.assertEqual(0, self.Size())
- self.assertEqual(2, len(repeated_nested_message))
- del repeated_nested_message[0:1]
- # TODO(jieluo): Fix cpp extension bug when delete repeated message.
- if api_implementation.Type() == 'python':
- self.assertEqual(1, len(repeated_nested_message))
- del repeated_nested_message[-1]
- # TODO(jieluo): Fix cpp extension bug when delete repeated message.
- if api_implementation.Type() == 'python':
- self.assertEqual(0, len(repeated_nested_message))
-
def testRepeatedGroups(self):
# 2-byte START_GROUP plus 2-byte END_GROUP.
group_0 = self.proto.repeatedgroup.add()
@@ -2231,10 +2190,6 @@ class ByteSizeTest(BaseTestCase):
proto.Extensions[extension] = 23
# 1 byte for tag, 1 byte for value.
self.assertEqual(2, proto.ByteSize())
- field = unittest_pb2.TestAllTypes.DESCRIPTOR.fields_by_name[
- 'optional_int32']
- with self.assertRaises(KeyError):
- proto.Extensions[field] = 23
def testCacheInvalidationForNonrepeatedScalar(self):
# Test non-extension.
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/service_reflection_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/service_reflection_test.py
index 77239f4462..62900b1d15 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/service_reflection_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/service_reflection_test.py
@@ -82,10 +82,6 @@ class FooUnitTest(unittest.TestCase):
service_descriptor = unittest_pb2.TestService.GetDescriptor()
srvc.CallMethod(service_descriptor.methods[1], rpc_controller,
unittest_pb2.BarRequest(), MyCallback)
- self.assertTrue(srvc.GetRequestClass(service_descriptor.methods[1]) is
- unittest_pb2.BarRequest)
- self.assertTrue(srvc.GetResponseClass(service_descriptor.methods[1]) is
- unittest_pb2.BarResponse)
self.assertEqual('Method Bar not implemented.',
rpc_controller.failure_message)
self.assertEqual(None, self.callback_response)
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/symbol_database_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/symbol_database_test.py
index af42681ae2..af42681ae2 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/symbol_database_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/symbol_database_test.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/test_bad_identifiers.proto b/third_party/protobuf/3.4.0/python/google/protobuf/internal/test_bad_identifiers.proto
index c4860ea88a..c4860ea88a 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/test_bad_identifiers.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/test_bad_identifiers.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/test_util.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/test_util.py
index a6e34ef56d..269d0e2d4f 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/test_util.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/test_util.py
@@ -39,15 +39,11 @@ __author__ = 'robinson@google.com (Will Robinson)'
import numbers
import operator
import os.path
+import sys
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_pb2
-
-try:
- long # Python 2
-except NameError:
- long = int # Python 3
-
+from google.protobuf import descriptor_pb2
# Tests whether the given TestAllTypes message is proto2 or not.
# This is used to gate several fields/features that only exist
@@ -55,7 +51,6 @@ except NameError:
def IsProto2(message):
return message.DESCRIPTOR.syntax == "proto2"
-
def SetAllNonLazyFields(message):
"""Sets every non-lazy field in the message to a unique value.
@@ -133,37 +128,22 @@ def SetAllNonLazyFields(message):
message.repeated_string_piece.append(u'224')
message.repeated_cord.append(u'225')
- # Add a second one of each field and set value by index.
- message.repeated_int32.append(0)
- message.repeated_int64.append(0)
- message.repeated_uint32.append(0)
- message.repeated_uint64.append(0)
- message.repeated_sint32.append(0)
- message.repeated_sint64.append(0)
- message.repeated_fixed32.append(0)
- message.repeated_fixed64.append(0)
- message.repeated_sfixed32.append(0)
- message.repeated_sfixed64.append(0)
- message.repeated_float.append(0)
- message.repeated_double.append(0)
- message.repeated_bool.append(True)
- message.repeated_string.append(u'0')
- message.repeated_bytes.append(b'0')
- message.repeated_int32[1] = 301
- message.repeated_int64[1] = 302
- message.repeated_uint32[1] = 303
- message.repeated_uint64[1] = 304
- message.repeated_sint32[1] = 305
- message.repeated_sint64[1] = 306
- message.repeated_fixed32[1] = 307
- message.repeated_fixed64[1] = 308
- message.repeated_sfixed32[1] = 309
- message.repeated_sfixed64[1] = 310
- message.repeated_float[1] = 311
- message.repeated_double[1] = 312
- message.repeated_bool[1] = False
- message.repeated_string[1] = u'315'
- message.repeated_bytes[1] = b'316'
+ # Add a second one of each field.
+ message.repeated_int32.append(301)
+ message.repeated_int64.append(302)
+ message.repeated_uint32.append(303)
+ message.repeated_uint64.append(304)
+ message.repeated_sint32.append(305)
+ message.repeated_sint64.append(306)
+ message.repeated_fixed32.append(307)
+ message.repeated_fixed64.append(308)
+ message.repeated_sfixed32.append(309)
+ message.repeated_sfixed64.append(310)
+ message.repeated_float.append(311)
+ message.repeated_double.append(312)
+ message.repeated_bool.append(False)
+ message.repeated_string.append(u'315')
+ message.repeated_bytes.append(b'316')
if IsProto2(message):
message.repeatedgroup.add().a = 317
@@ -172,8 +152,7 @@ def SetAllNonLazyFields(message):
message.repeated_import_message.add().d = 320
message.repeated_lazy_message.add().bb = 327
- message.repeated_nested_enum.append(unittest_pb2.TestAllTypes.BAR)
- message.repeated_nested_enum[1] = unittest_pb2.TestAllTypes.BAZ
+ message.repeated_nested_enum.append(unittest_pb2.TestAllTypes.BAZ)
message.repeated_foreign_enum.append(unittest_pb2.FOREIGN_BAZ)
if IsProto2(message):
message.repeated_import_enum.append(unittest_import_pb2.IMPORT_BAZ)
@@ -728,8 +707,8 @@ class NonStandardInteger(numbers.Integral):
NonStandardInteger is the minimal legal specification for a custom Integral.
As such, it does not support 0 < x < 5 and it is not hashable.
- Note: This is added here instead of relying on numpy or a similar library
- with custom integers to limit dependencies.
+ Note: This is added here instead of relying on numpy or a similar library with
+ custom integers to limit dependencies.
"""
def __init__(self, val, error_string_on_conversion=None):
@@ -866,3 +845,4 @@ class NonStandardInteger(numbers.Integral):
def __repr__(self):
return 'NonStandardInteger(%s)' % self.val
+
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/testing_refleaks.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/testing_refleaks.py
index 8ce06519bc..8ce06519bc 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/testing_refleaks.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/testing_refleaks.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/text_encoding_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/text_encoding_test.py
index c7d182c444..c7d182c444 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/text_encoding_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/text_encoding_test.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/text_format_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/text_format_test.py
index 237a2d50d1..424b29ccb5 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/text_format_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/text_format_test.py
@@ -1,5 +1,4 @@
#! /usr/bin/env python
-# -*- coding: utf-8 -*-
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
@@ -36,7 +35,6 @@
__author__ = 'kenton@google.com (Kenton Varda)'
-import math
import re
import six
import string
@@ -48,7 +46,6 @@ except ImportError:
from google.protobuf.internal import _parameterized
-from google.protobuf import any_pb2
from google.protobuf import any_test_pb2
from google.protobuf import map_unittest_pb2
from google.protobuf import unittest_mset_pb2
@@ -56,8 +53,8 @@ from google.protobuf import unittest_pb2
from google.protobuf import unittest_proto3_arena_pb2
from google.protobuf.internal import api_implementation
from google.protobuf.internal import any_test_pb2 as test_extend_any
-from google.protobuf.internal import message_set_extensions_pb2
from google.protobuf.internal import test_util
+from google.protobuf.internal import message_set_extensions_pb2
from google.protobuf import descriptor_pool
from google.protobuf import text_format
@@ -100,7 +97,7 @@ class TextFormatBase(unittest.TestCase):
return text
-@_parameterized.parameters((unittest_pb2), (unittest_proto3_arena_pb2))
+@_parameterized.Parameters((unittest_pb2), (unittest_proto3_arena_pb2))
class TextFormatTest(TextFormatBase):
def testPrintExotic(self, message_module):
@@ -300,33 +297,6 @@ class TextFormatTest(TextFormatBase):
if message_module is unittest_pb2:
test_util.ExpectAllFieldsSet(self, message)
- def testParseAndMergeUtf8(self, message_module):
- message = message_module.TestAllTypes()
- test_util.SetAllFields(message)
- ascii_text = text_format.MessageToString(message)
- ascii_text = ascii_text.encode('utf-8')
-
- parsed_message = message_module.TestAllTypes()
- text_format.Parse(ascii_text, parsed_message)
- self.assertEqual(message, parsed_message)
- if message_module is unittest_pb2:
- test_util.ExpectAllFieldsSet(self, message)
-
- parsed_message.Clear()
- text_format.Merge(ascii_text, parsed_message)
- self.assertEqual(message, parsed_message)
- if message_module is unittest_pb2:
- test_util.ExpectAllFieldsSet(self, message)
-
- if six.PY2:
- msg2 = message_module.TestAllTypes()
- text = (u'optional_string: "café"')
- text_format.Merge(text, msg2)
- self.assertEqual(msg2.optional_string, u'café')
- msg2.Clear()
- text_format.Parse(text, msg2)
- self.assertEqual(msg2.optional_string, u'café')
-
def testParseExotic(self, message_module):
message = message_module.TestAllTypes()
text = ('repeated_int64: -9223372036854775808\n'
@@ -370,7 +340,6 @@ class TextFormatTest(TextFormatBase):
def testParseRepeatedScalarShortFormat(self, message_module):
message = message_module.TestAllTypes()
text = ('repeated_int64: [100, 200];\n'
- 'repeated_int64: []\n'
'repeated_int64: 300,\n'
'repeated_string: ["one", "two"];\n')
text_format.Parse(text, message)
@@ -402,10 +371,7 @@ class TextFormatTest(TextFormatBase):
def testParseInvalidUtf8(self, message_module):
message = message_module.TestAllTypes()
text = 'repeated_string: "\\xc3\\xc3"'
- with self.assertRaises(text_format.ParseError) as e:
- text_format.Parse(text, message)
- self.assertEqual(e.exception.GetLine(), 1)
- self.assertEqual(e.exception.GetColumn(), 28)
+ self.assertRaises(text_format.ParseError, text_format.Parse, text, message)
def testParseSingleWord(self, message_module):
message = message_module.TestAllTypes()
@@ -429,6 +395,13 @@ class TextFormatTest(TextFormatBase):
r'has no value named BARR.'), text_format.Parse,
text, message)
+ message = message_module.TestAllTypes()
+ text = 'optional_nested_enum: 100'
+ six.assertRaisesRegex(self, text_format.ParseError,
+ (r'1:23 : Enum type "\w+.TestAllTypes.NestedEnum" '
+ r'has no value with number 100.'), text_format.Parse,
+ text, message)
+
def testParseBadIntValue(self, message_module):
message = message_module.TestAllTypes()
text = 'optional_int32: bork'
@@ -526,68 +499,20 @@ class OnlyWorksWithProto2RightNowTests(TextFormatBase):
def testPrintInIndexOrder(self):
message = unittest_pb2.TestFieldOrderings()
- # Fields are listed in index order instead of field number.
- message.my_string = 'str'
+ message.my_string = '115'
message.my_int = 101
message.my_float = 111
message.optional_nested_message.oo = 0
message.optional_nested_message.bb = 1
- message.Extensions[unittest_pb2.my_extension_string] = 'ext_str0'
- # Extensions are listed based on the order of extension number.
- # Extension number 12.
- message.Extensions[unittest_pb2.TestExtensionOrderings2.
- test_ext_orderings2].my_string = 'ext_str2'
- # Extension number 13.
- message.Extensions[unittest_pb2.TestExtensionOrderings1.
- test_ext_orderings1].my_string = 'ext_str1'
- # Extension number 14.
- message.Extensions[
- unittest_pb2.TestExtensionOrderings2.TestExtensionOrderings3.
- test_ext_orderings3].my_string = 'ext_str3'
-
- # Print in index order.
self.CompareToGoldenText(
- self.RemoveRedundantZeros(
- text_format.MessageToString(message, use_index_order=True)),
- 'my_string: "str"\n'
- 'my_int: 101\n'
- 'my_float: 111\n'
- 'optional_nested_message {\n'
- ' oo: 0\n'
- ' bb: 1\n'
- '}\n'
- '[protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] {\n'
- ' my_string: "ext_str2"\n'
- '}\n'
- '[protobuf_unittest.TestExtensionOrderings1.test_ext_orderings1] {\n'
- ' my_string: "ext_str1"\n'
- '}\n'
- '[protobuf_unittest.TestExtensionOrderings2.TestExtensionOrderings3'
- '.test_ext_orderings3] {\n'
- ' my_string: "ext_str3"\n'
- '}\n'
- '[protobuf_unittest.my_extension_string]: "ext_str0"\n')
- # By default, print in field number order.
+ self.RemoveRedundantZeros(text_format.MessageToString(
+ message, use_index_order=True)),
+ 'my_string: \"115\"\nmy_int: 101\nmy_float: 111\n'
+ 'optional_nested_message {\n oo: 0\n bb: 1\n}\n')
self.CompareToGoldenText(
self.RemoveRedundantZeros(text_format.MessageToString(message)),
- 'my_int: 101\n'
- 'my_string: "str"\n'
- '[protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] {\n'
- ' my_string: "ext_str2"\n'
- '}\n'
- '[protobuf_unittest.TestExtensionOrderings1.test_ext_orderings1] {\n'
- ' my_string: "ext_str1"\n'
- '}\n'
- '[protobuf_unittest.TestExtensionOrderings2.TestExtensionOrderings3'
- '.test_ext_orderings3] {\n'
- ' my_string: "ext_str3"\n'
- '}\n'
- '[protobuf_unittest.my_extension_string]: "ext_str0"\n'
- 'my_float: 111\n'
- 'optional_nested_message {\n'
- ' bb: 1\n'
- ' oo: 0\n'
- '}\n')
+ 'my_int: 101\nmy_string: \"115\"\nmy_float: 111\n'
+ 'optional_nested_message {\n bb: 1\n oo: 0\n}\n')
def testMergeLinesGolden(self):
opened = self.ReadGolden('text_format_unittest_data_oneof_implemented.txt')
@@ -859,14 +784,13 @@ class Proto2Tests(TextFormatBase):
' bin: "\xe0"'
' [nested_unknown_ext]: {\n'
' i: 23\n'
- ' x: x\n'
' test: "test_string"\n'
' floaty_float: -0.315\n'
' num: -inf\n'
' multiline_str: "abc"\n'
' "def"\n'
' "xyz."\n'
- ' [nested_unknown_ext.ext]: <\n'
+ ' [nested_unknown_ext]: <\n'
' i: 23\n'
' i: 24\n'
' pointfloat: .3\n'
@@ -878,10 +802,6 @@ 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'
@@ -948,6 +868,7 @@ 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,
@@ -959,7 +880,7 @@ class Proto2Tests(TextFormatBase):
message,
allow_unknown_extension=True)
- # Parse known extension correctly.
+ # Parse known extension correcty.
message = unittest_mset_pb2.TestMessageSetContainer()
text = ('message_set {\n'
' [protobuf_unittest.TestMessageSetExtension1] {\n'
@@ -975,14 +896,6 @@ class Proto2Tests(TextFormatBase):
self.assertEqual(23, message.message_set.Extensions[ext1].i)
self.assertEqual('foo', message.message_set.Extensions[ext2].str)
- def testParseBadIdentifier(self):
- message = unittest_pb2.TestAllTypes()
- text = ('optional_nested_message { "bb": 1 }')
- with self.assertRaises(text_format.ParseError) as e:
- text_format.Parse(text, message)
- self.assertEqual(str(e.exception),
- '1:27 : Expected identifier or number, got "bb".')
-
def testParseBadExtension(self):
message = unittest_pb2.TestAllExtensions()
text = '[unknown_extension]: 8\n'
@@ -994,14 +907,6 @@ class Proto2Tests(TextFormatBase):
'1:2 : Message type "protobuf_unittest.TestAllTypes" does not have '
'extensions.'), text_format.Parse, text, message)
- def testParseNumericUnknownEnum(self):
- message = unittest_pb2.TestAllTypes()
- text = 'optional_nested_enum: 100'
- six.assertRaisesRegex(self, text_format.ParseError,
- (r'1:23 : Enum type "\w+.TestAllTypes.NestedEnum" '
- r'has no value with number 100.'), text_format.Parse,
- text, message)
-
def testMergeDuplicateExtensionScalars(self):
message = unittest_pb2.TestAllExtensions()
text = ('[protobuf_unittest.optional_int32_extension]: 42 '
@@ -1020,26 +925,15 @@ class Proto2Tests(TextFormatBase):
'"protobuf_unittest.optional_int32_extension" extensions.'),
text_format.Parse, text, message)
- def testParseDuplicateMessages(self):
+ def testParseDuplicateNestedMessageScalars(self):
message = unittest_pb2.TestAllTypes()
text = ('optional_nested_message { bb: 1 } '
'optional_nested_message { bb: 2 }')
six.assertRaisesRegex(self, text_format.ParseError, (
- '1:59 : Message type "protobuf_unittest.TestAllTypes" '
- 'should not have multiple "optional_nested_message" fields.'),
- text_format.Parse, text,
+ '1:65 : Message type "protobuf_unittest.TestAllTypes.NestedMessage" '
+ 'should not have multiple "bb" fields.'), text_format.Parse, text,
message)
- def testParseDuplicateExtensionMessages(self):
- message = unittest_pb2.TestAllExtensions()
- text = ('[protobuf_unittest.optional_nested_message_extension]: {} '
- '[protobuf_unittest.optional_nested_message_extension]: {}')
- six.assertRaisesRegex(self, text_format.ParseError, (
- '1:114 : Message type "protobuf_unittest.TestAllExtensions" '
- 'should not have multiple '
- '"protobuf_unittest.optional_nested_message_extension" extensions.'),
- text_format.Parse, text, message)
-
def testParseDuplicateScalars(self):
message = unittest_pb2.TestAllTypes()
text = ('optional_int32: 42 ' 'optional_int32: 67')
@@ -1126,14 +1020,6 @@ class Proto3Tests(unittest.TestCase):
' }\n'
'}\n')
- def testTopAnyMessage(self):
- packed_msg = unittest_pb2.OneString()
- msg = any_pb2.Any()
- msg.Pack(packed_msg)
- text = text_format.MessageToString(msg)
- other_msg = text_format.Parse(text, any_pb2.Any())
- self.assertEqual(msg, other_msg)
-
def testPrintMessageExpandAnyRepeated(self):
packed_message = unittest_pb2.OneString()
message = any_test_pb2.TestAny()
@@ -1209,14 +1095,6 @@ class Proto3Tests(unittest.TestCase):
' < data: "string" > '
'>')
- def testUnknownEnums(self):
- message = unittest_proto3_arena_pb2.TestAllTypes()
- message2 = unittest_proto3_arena_pb2.TestAllTypes()
- message.optional_nested_enum = 999
- text_string = text_format.MessageToString(message)
- text_format.Parse(text_string, message2)
- self.assertEqual(999, message2.optional_nested_enum)
-
def testMergeExpandedAny(self):
message = any_test_pb2.TestAny()
text = ('any_value {\n'
@@ -1302,15 +1180,6 @@ class Proto3Tests(unittest.TestCase):
message.any_value.Unpack(packed_message)
self.assertEqual('string', packed_message.data)
- def testMergeMissingAnyEndToken(self):
- message = any_test_pb2.TestAny()
- text = ('any_value {\n'
- ' [type.googleapis.com/protobuf_unittest.OneString] {\n'
- ' data: "string"\n')
- with self.assertRaises(text_format.ParseError) as e:
- text_format.Merge(text, message)
- self.assertEqual(str(e.exception), '3:11 : Expected "}".')
-
class TokenizerTest(unittest.TestCase):
@@ -1322,7 +1191,7 @@ class TokenizerTest(unittest.TestCase):
'ID9: 22 ID10: -111111111111111111 ID11: -22\n'
'ID12: 2222222222222222222 ID13: 1.23456f ID14: 1.2e+2f '
'false_bool: 0 true_BOOL:t \n true_bool1: 1 false_BOOL1:f '
- 'False_bool: False True_bool: True X:iNf Y:-inF Z:nAN')
+ 'False_bool: False True_bool: True')
tokenizer = text_format.Tokenizer(text.splitlines())
methods = [(tokenizer.ConsumeIdentifier, 'identifier1'), ':',
(tokenizer.ConsumeString, 'string1'),
@@ -1370,13 +1239,7 @@ class TokenizerTest(unittest.TestCase):
(tokenizer.ConsumeIdentifier, 'False_bool'), ':',
(tokenizer.ConsumeBool, False),
(tokenizer.ConsumeIdentifier, 'True_bool'), ':',
- (tokenizer.ConsumeBool, True),
- (tokenizer.ConsumeIdentifier, 'X'), ':',
- (tokenizer.ConsumeFloat, float('inf')),
- (tokenizer.ConsumeIdentifier, 'Y'), ':',
- (tokenizer.ConsumeFloat, float('-inf')),
- (tokenizer.ConsumeIdentifier, 'Z'), ':',
- (tokenizer.ConsumeFloat, float('nan'))]
+ (tokenizer.ConsumeBool, True)]
i = 0
while not tokenizer.AtEnd():
@@ -1385,8 +1248,6 @@ class TokenizerTest(unittest.TestCase):
token = tokenizer.token
self.assertEqual(token, m)
tokenizer.NextToken()
- elif isinstance(m[1], float) and math.isnan(m[1]):
- self.assertTrue(math.isnan(m[0]()))
else:
self.assertEqual(m[1], m[0]())
i += 1
@@ -1405,15 +1266,10 @@ class TokenizerTest(unittest.TestCase):
self.assertEqual(int64_max + 1, tokenizer.ConsumeInteger())
self.assertTrue(tokenizer.AtEnd())
- text = '-0 0 0 1.2'
+ text = '-0 0'
tokenizer = text_format.Tokenizer(text.splitlines())
self.assertEqual(0, tokenizer.ConsumeInteger())
self.assertEqual(0, tokenizer.ConsumeInteger())
- self.assertEqual(True, tokenizer.TryConsumeInteger())
- self.assertEqual(False, tokenizer.TryConsumeInteger())
- with self.assertRaises(text_format.ParseError):
- tokenizer.ConsumeInteger()
- self.assertEqual(1.2, tokenizer.ConsumeFloat())
self.assertTrue(tokenizer.AtEnd())
def testConsumeIntegers(self):
@@ -1558,7 +1414,7 @@ class TokenizerTest(unittest.TestCase):
# Tests for pretty printer functionality.
-@_parameterized.parameters((unittest_pb2), (unittest_proto3_arena_pb2))
+@_parameterized.Parameters((unittest_pb2), (unittest_proto3_arena_pb2))
class PrettyPrinterTest(TextFormatBase):
def testPrettyPrintNoMatch(self, message_module):
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/type_checkers.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/type_checkers.py
index 4a76cd4ef6..4a76cd4ef6 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/type_checkers.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/type_checkers.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/unknown_fields_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/unknown_fields_test.py
index 8b7de2e79c..d614eaa874 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/unknown_fields_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/unknown_fields_test.py
@@ -54,13 +54,10 @@ from google.protobuf.internal import type_checkers
BaseTestCase = testing_refleaks.BaseTestCase
-# CheckUnknownField() cannot be used by the C++ implementation because
-# some protect members are called. It is not a behavior difference
-# for python and C++ implementation.
-def SkipCheckUnknownFieldIfCppImplementation(func):
+def SkipIfCppImplementation(func):
return unittest.skipIf(
api_implementation.Type() == 'cpp' and api_implementation.Version() == 2,
- 'Addtional test for pure python involved protect members')(func)
+ 'C++ implementation does not expose unknown fields to Python')(func)
class UnknownFieldsTest(BaseTestCase):
@@ -80,23 +77,11 @@ class UnknownFieldsTest(BaseTestCase):
# stdout.
self.assertTrue(data == self.all_fields_data)
- def expectSerializeProto3(self, preserve):
+ def testSerializeProto3(self):
+ # Verify that proto3 doesn't preserve unknown fields.
message = unittest_proto3_arena_pb2.TestEmptyMessage()
message.ParseFromString(self.all_fields_data)
- if preserve:
- self.assertEqual(self.all_fields_data, message.SerializeToString())
- else:
- self.assertEqual(0, len(message.SerializeToString()))
-
- def testSerializeProto3(self):
- # Verify that proto3 unknown fields behavior.
- default_preserve = (api_implementation
- .GetPythonProto3PreserveUnknownsDefault())
- self.expectSerializeProto3(default_preserve)
- api_implementation.SetPythonProto3PreserveUnknownsDefault(
- not default_preserve)
- self.expectSerializeProto3(not default_preserve)
- api_implementation.SetPythonProto3PreserveUnknownsDefault(default_preserve)
+ self.assertEqual(0, len(message.SerializeToString()))
def testByteSize(self):
self.assertEqual(self.all_fields.ByteSize(), self.empty_message.ByteSize())
@@ -169,13 +154,12 @@ class UnknownFieldsAccessorsTest(BaseTestCase):
self.empty_message = unittest_pb2.TestEmptyMessage()
self.empty_message.ParseFromString(self.all_fields_data)
- # CheckUnknownField() is an additional Pure Python check which checks
- # a detail of unknown fields. It cannot be used by the C++
- # implementation because some protect members are called.
- # The test is added for historical reasons. It is not necessary as
- # serialized string is checked.
+ # GetUnknownField() checks a detail of the Python implementation, which stores
+ # unknown fields as serialized strings. It cannot be used by the C++
+ # implementation: it's enough to check that the message is correctly
+ # serialized.
- def CheckUnknownField(self, name, expected_value):
+ def GetUnknownField(self, name):
field_descriptor = self.descriptor.fields_by_name[name]
wire_type = type_checkers.FIELD_TYPE_TO_WIRE_TYPE[field_descriptor.type]
field_tag = encoder.TagBytes(field_descriptor.number, wire_type)
@@ -184,35 +168,42 @@ class UnknownFieldsAccessorsTest(BaseTestCase):
if tag_bytes == field_tag:
decoder = unittest_pb2.TestAllTypes._decoders_by_tag[tag_bytes][0]
decoder(value, 0, len(value), self.all_fields, result_dict)
- self.assertEqual(expected_value, result_dict[field_descriptor])
-
- @SkipCheckUnknownFieldIfCppImplementation
- def testCheckUnknownFieldValue(self):
- # Test enum.
- self.CheckUnknownField('optional_nested_enum',
- self.all_fields.optional_nested_enum)
- # Test repeated enum.
- self.CheckUnknownField('repeated_nested_enum',
- self.all_fields.repeated_nested_enum)
-
- # Test varint.
- self.CheckUnknownField('optional_int32',
- self.all_fields.optional_int32)
- # Test fixed32.
- self.CheckUnknownField('optional_fixed32',
- self.all_fields.optional_fixed32)
-
- # Test fixed64.
- self.CheckUnknownField('optional_fixed64',
- self.all_fields.optional_fixed64)
-
- # Test lengthd elimited.
- self.CheckUnknownField('optional_string',
- self.all_fields.optional_string)
-
- # Test group.
- self.CheckUnknownField('optionalgroup',
- self.all_fields.optionalgroup)
+ return result_dict[field_descriptor]
+
+ @SkipIfCppImplementation
+ def testEnum(self):
+ value = self.GetUnknownField('optional_nested_enum')
+ self.assertEqual(self.all_fields.optional_nested_enum, value)
+
+ @SkipIfCppImplementation
+ def testRepeatedEnum(self):
+ value = self.GetUnknownField('repeated_nested_enum')
+ self.assertEqual(self.all_fields.repeated_nested_enum, value)
+
+ @SkipIfCppImplementation
+ def testVarint(self):
+ value = self.GetUnknownField('optional_int32')
+ self.assertEqual(self.all_fields.optional_int32, value)
+
+ @SkipIfCppImplementation
+ def testFixed32(self):
+ value = self.GetUnknownField('optional_fixed32')
+ self.assertEqual(self.all_fields.optional_fixed32, value)
+
+ @SkipIfCppImplementation
+ def testFixed64(self):
+ value = self.GetUnknownField('optional_fixed64')
+ self.assertEqual(self.all_fields.optional_fixed64, value)
+
+ @SkipIfCppImplementation
+ def testLengthDelimited(self):
+ value = self.GetUnknownField('optional_string')
+ self.assertEqual(self.all_fields.optional_string, value)
+
+ @SkipIfCppImplementation
+ def testGroup(self):
+ value = self.GetUnknownField('optionalgroup')
+ self.assertEqual(self.all_fields.optionalgroup, value)
def testCopyFrom(self):
message = unittest_pb2.TestEmptyMessage()
@@ -272,13 +263,12 @@ class UnknownEnumValuesTest(BaseTestCase):
self.missing_message = missing_enum_values_pb2.TestMissingEnumValues()
self.missing_message.ParseFromString(self.message_data)
- # CheckUnknownField() is an additional Pure Python check which checks
- # a detail of unknown fields. It cannot be used by the C++
- # implementation because some protect members are called.
- # The test is added for historical reasons. It is not necessary as
- # serialized string is checked.
+ # GetUnknownField() checks a detail of the Python implementation, which stores
+ # unknown fields as serialized strings. It cannot be used by the C++
+ # implementation: it's enough to check that the message is correctly
+ # serialized.
- def CheckUnknownField(self, name, expected_value):
+ def GetUnknownField(self, name):
field_descriptor = self.descriptor.fields_by_name[name]
wire_type = type_checkers.FIELD_TYPE_TO_WIRE_TYPE[field_descriptor.type]
field_tag = encoder.TagBytes(field_descriptor.number, wire_type)
@@ -288,7 +278,7 @@ class UnknownEnumValuesTest(BaseTestCase):
decoder = missing_enum_values_pb2.TestEnumValues._decoders_by_tag[
tag_bytes][0]
decoder(value, 0, len(value), self.message, result_dict)
- self.assertEqual(expected_value, result_dict[field_descriptor])
+ return result_dict[field_descriptor]
def testUnknownParseMismatchEnumValue(self):
just_string = missing_enum_values_pb2.JustString()
@@ -304,27 +294,38 @@ class UnknownEnumValuesTest(BaseTestCase):
self.assertEqual(missing.optional_nested_enum, 0)
def testUnknownEnumValue(self):
- self.assertFalse(self.missing_message.HasField('optional_nested_enum'))
- self.assertEqual(self.missing_message.optional_nested_enum, 2)
- # Clear does not do anything.
- serialized = self.missing_message.SerializeToString()
+ if api_implementation.Type() == 'cpp':
+ # The CPP implementation of protos (wrongly) allows unknown enum values
+ # for proto2.
+ self.assertTrue(self.missing_message.HasField('optional_nested_enum'))
+ self.assertEqual(self.message.optional_nested_enum,
+ self.missing_message.optional_nested_enum)
+ else:
+ # On the other hand, the Python implementation considers unknown values
+ # as unknown fields. This is the correct behavior.
+ self.assertFalse(self.missing_message.HasField('optional_nested_enum'))
+ value = self.GetUnknownField('optional_nested_enum')
+ self.assertEqual(self.message.optional_nested_enum, value)
self.missing_message.ClearField('optional_nested_enum')
- self.assertEqual(self.missing_message.SerializeToString(), serialized)
+ self.assertFalse(self.missing_message.HasField('optional_nested_enum'))
def testUnknownRepeatedEnumValue(self):
- self.assertEqual([], self.missing_message.repeated_nested_enum)
+ if api_implementation.Type() == 'cpp':
+ # For repeated enums, both implementations agree.
+ self.assertEqual([], self.missing_message.repeated_nested_enum)
+ else:
+ self.assertEqual([], self.missing_message.repeated_nested_enum)
+ value = self.GetUnknownField('repeated_nested_enum')
+ self.assertEqual(self.message.repeated_nested_enum, value)
def testUnknownPackedEnumValue(self):
- self.assertEqual([], self.missing_message.packed_nested_enum)
-
- @SkipCheckUnknownFieldIfCppImplementation
- def testCheckUnknownFieldValueForEnum(self):
- self.CheckUnknownField('optional_nested_enum',
- self.message.optional_nested_enum)
- self.CheckUnknownField('repeated_nested_enum',
- self.message.repeated_nested_enum)
- self.CheckUnknownField('packed_nested_enum',
- self.message.packed_nested_enum)
+ if api_implementation.Type() == 'cpp':
+ # For repeated enums, both implementations agree.
+ self.assertEqual([], self.missing_message.packed_nested_enum)
+ else:
+ self.assertEqual([], self.missing_message.packed_nested_enum)
+ value = self.GetUnknownField('packed_nested_enum')
+ self.assertEqual(self.message.packed_nested_enum, value)
def testRoundTrip(self):
new_message = missing_enum_values_pb2.TestEnumValues()
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/well_known_types.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/well_known_types.py
index 37a65cfab1..d0c7ffda54 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/well_known_types.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/well_known_types.py
@@ -40,7 +40,6 @@ This files defines well known classes which need extra maintenance including:
__author__ = 'jieluo@google.com (Jie Luo)'
-import collections
from datetime import datetime
from datetime import timedelta
import six
@@ -68,14 +67,13 @@ class ParseError(Error):
class Any(object):
"""Class for Any Message type."""
- def Pack(self, msg, type_url_prefix='type.googleapis.com/',
- deterministic=None):
+ def Pack(self, msg, type_url_prefix='type.googleapis.com/'):
"""Packs the specified message into current Any message."""
if len(type_url_prefix) < 1 or type_url_prefix[-1] != '/':
self.type_url = '%s/%s' % (type_url_prefix, msg.DESCRIPTOR.full_name)
else:
self.type_url = '%s%s' % (type_url_prefix, msg.DESCRIPTOR.full_name)
- self.value = msg.SerializeToString(deterministic=deterministic)
+ self.value = msg.SerializeToString()
def Unpack(self, msg):
"""Unpacks the current Any message into specified message."""
@@ -375,9 +373,6 @@ def _CheckDurationValid(seconds, nanos):
raise Error(
'Duration is not valid: Nanos {0} must be in range '
'[-999999999, 999999999].'.format(nanos))
- if (nanos < 0 and seconds > 0) or (nanos > 0 and seconds < 0):
- raise Error(
- 'Duration is not valid: Sign mismatch.')
def _RoundTowardZero(value, divider):
@@ -478,7 +473,7 @@ def _IsValidPath(message_descriptor, path):
parts = path.split('.')
last = parts.pop()
for name in parts:
- field = message_descriptor.fields_by_name.get(name)
+ field = message_descriptor.fields_by_name[name]
if (field is None or
field.label == FieldDescriptor.LABEL_REPEATED or
field.type != FieldDescriptor.TYPE_MESSAGE):
@@ -652,10 +647,9 @@ def _MergeMessage(
raise ValueError('Error: Field {0} in message {1} is not a singular '
'message field and cannot have sub-fields.'.format(
name, source_descriptor.full_name))
- if source.HasField(name):
- _MergeMessage(
- child, getattr(source, name), getattr(destination, name),
- replace_message, replace_repeated)
+ _MergeMessage(
+ child, getattr(source, name), getattr(destination, name),
+ replace_message, replace_repeated)
continue
if field.label == FieldDescriptor.LABEL_REPEATED:
if replace_repeated:
@@ -704,12 +698,6 @@ def _SetStructValue(struct_value, value):
struct_value.string_value = value
elif isinstance(value, _INT_OR_FLOAT):
struct_value.number_value = value
- elif isinstance(value, dict):
- struct_value.struct_value.Clear()
- struct_value.struct_value.update(value)
- elif isinstance(value, list):
- struct_value.list_value.Clear()
- struct_value.list_value.extend(value)
else:
raise ValueError('Unexpected type')
@@ -740,49 +728,18 @@ class Struct(object):
def __getitem__(self, key):
return _GetStructValue(self.fields[key])
- def __contains__(self, item):
- return item in self.fields
-
def __setitem__(self, key, value):
_SetStructValue(self.fields[key], value)
- def __delitem__(self, key):
- del self.fields[key]
-
- def __len__(self):
- return len(self.fields)
-
- def __iter__(self):
- return iter(self.fields)
-
- def keys(self): # pylint: disable=invalid-name
- return self.fields.keys()
-
- def values(self): # pylint: disable=invalid-name
- return [self[key] for key in self]
-
- def items(self): # pylint: disable=invalid-name
- return [(key, self[key]) for key in self]
-
def get_or_create_list(self, key):
"""Returns a list for this key, creating if it didn't exist already."""
- if not self.fields[key].HasField('list_value'):
- # Clear will mark list_value modified which will indeed create a list.
- self.fields[key].list_value.Clear()
return self.fields[key].list_value
def get_or_create_struct(self, key):
"""Returns a struct for this key, creating if it didn't exist already."""
- if not self.fields[key].HasField('struct_value'):
- # Clear will mark struct_value modified which will indeed create a struct.
- self.fields[key].struct_value.Clear()
return self.fields[key].struct_value
- def update(self, dictionary): # pylint: disable=invalid-name
- for key, value in dictionary.items():
- _SetStructValue(self.fields[key], value)
-
-collections.MutableMapping.register(Struct)
+ # TODO(haberman): allow constructing/merging from dict.
class ListValue(object):
@@ -805,28 +762,17 @@ class ListValue(object):
def __setitem__(self, index, value):
_SetStructValue(self.values.__getitem__(index), value)
- def __delitem__(self, key):
- del self.values[key]
-
def items(self):
for i in range(len(self)):
yield self[i]
def add_struct(self):
"""Appends and returns a struct value as the next value in the list."""
- struct_value = self.values.add().struct_value
- # Clear will mark struct_value modified which will indeed create a struct.
- struct_value.Clear()
- return struct_value
+ return self.values.add().struct_value
def add_list(self):
"""Appends and returns a list value as the next value in the list."""
- list_value = self.values.add().list_value
- # Clear will mark list_value modified which will indeed create a list.
- list_value.Clear()
- return list_value
-
-collections.MutableSequence.register(ListValue)
+ return self.values.add().list_value
WKTBASES = {
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/well_known_types_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/well_known_types_test.py
index 965940b261..123a537cb0 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/well_known_types_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/well_known_types_test.py
@@ -34,7 +34,6 @@
__author__ = 'jieluo@google.com (Jie Luo)'
-import collections
from datetime import datetime
try:
@@ -101,15 +100,11 @@ class TimeUtilTest(TimeUtilTestBase):
message.FromJsonString('1970-01-01T00:00:00.1Z')
self.assertEqual(0, message.seconds)
self.assertEqual(100000000, message.nanos)
- # Parsing accepts offsets.
+ # Parsing accpets offsets.
message.FromJsonString('1970-01-01T00:00:00-08:00')
self.assertEqual(8 * 3600, message.seconds)
self.assertEqual(0, message.nanos)
- # It is not easy to check with current time. For test coverage only.
- message.GetCurrentTime()
- self.assertNotEqual(8 * 3600, message.seconds)
-
def testDurationSerializeAndParse(self):
message = duration_pb2.Duration()
# Generated output should contain 3, 6, or 9 fractional digits.
@@ -273,17 +268,6 @@ class TimeUtilTest(TimeUtilTestBase):
def testInvalidTimestamp(self):
message = timestamp_pb2.Timestamp()
self.assertRaisesRegexp(
- well_known_types.ParseError,
- 'Failed to parse timestamp: missing valid timezone offset.',
- message.FromJsonString,
- '')
- self.assertRaisesRegexp(
- well_known_types.ParseError,
- 'Failed to parse timestamp: invalid trailing data '
- '1970-01-01T00:00:01Ztrail.',
- message.FromJsonString,
- '1970-01-01T00:00:01Ztrail')
- self.assertRaisesRegexp(
ValueError,
'time data \'10000-01-01T00:00:00\' does not match'
' format \'%Y-%m-%dT%H:%M:%S\'',
@@ -338,19 +322,6 @@ class TimeUtilTest(TimeUtilTestBase):
r'Duration is not valid\: Seconds -315576000001 must be in range'
r' \[-315576000000\, 315576000000\].',
message.ToJsonString)
- message.seconds = 0
- message.nanos = 999999999 + 1
- self.assertRaisesRegexp(
- well_known_types.Error,
- r'Duration is not valid\: Nanos 1000000000 must be in range'
- r' \[-999999999\, 999999999\].',
- message.ToJsonString)
- message.seconds = -1
- message.nanos = 1
- self.assertRaisesRegexp(
- well_known_types.Error,
- r'Duration is not valid\: Sign mismatch.',
- message.ToJsonString)
class FieldMaskTest(unittest.TestCase):
@@ -392,37 +363,10 @@ class FieldMaskTest(unittest.TestCase):
self.assertTrue(mask.IsValidForDescriptor(msg_descriptor))
for field in msg_descriptor.fields:
self.assertTrue(field.name in mask.paths)
-
- def testIsValidForDescriptor(self):
- msg_descriptor = unittest_pb2.TestAllTypes.DESCRIPTOR
- # Empty mask
- mask = field_mask_pb2.FieldMask()
- self.assertTrue(mask.IsValidForDescriptor(msg_descriptor))
- # All fields from descriptor
- mask.AllFieldsFromDescriptor(msg_descriptor)
- self.assertTrue(mask.IsValidForDescriptor(msg_descriptor))
- # Child under optional message
mask.paths.append('optional_nested_message.bb')
self.assertTrue(mask.IsValidForDescriptor(msg_descriptor))
- # Repeated field is only allowed in the last position of path
mask.paths.append('repeated_nested_message.bb')
self.assertFalse(mask.IsValidForDescriptor(msg_descriptor))
- # Invalid top level field
- mask = field_mask_pb2.FieldMask()
- mask.paths.append('xxx')
- self.assertFalse(mask.IsValidForDescriptor(msg_descriptor))
- # Invalid field in root
- mask = field_mask_pb2.FieldMask()
- mask.paths.append('xxx.zzz')
- self.assertFalse(mask.IsValidForDescriptor(msg_descriptor))
- # Invalid field in internal node
- mask = field_mask_pb2.FieldMask()
- mask.paths.append('optional_nested_message.xxx.zzz')
- self.assertFalse(mask.IsValidForDescriptor(msg_descriptor))
- # Invalid field in leaf
- mask = field_mask_pb2.FieldMask()
- mask.paths.append('optional_nested_message.xxx')
- self.assertFalse(mask.IsValidForDescriptor(msg_descriptor))
def testCanonicalFrom(self):
mask = field_mask_pb2.FieldMask()
@@ -478,9 +422,6 @@ class FieldMaskTest(unittest.TestCase):
mask2.FromJsonString('foo.bar,bar')
out_mask.Union(mask1, mask2)
self.assertEqual('bar,foo.bar,quz', out_mask.ToJsonString())
- src = unittest_pb2.TestAllTypes()
- with self.assertRaises(ValueError):
- out_mask.Union(src, mask2)
def testIntersect(self):
mask1 = field_mask_pb2.FieldMask()
@@ -605,29 +546,6 @@ class FieldMaskTest(unittest.TestCase):
self.assertEqual(1, len(nested_dst.payload.repeated_int32))
self.assertEqual(1234, nested_dst.payload.repeated_int32[0])
- # Test Merge oneof field.
- new_msg = unittest_pb2.TestOneof2()
- dst = unittest_pb2.TestOneof2()
- dst.foo_message.qux_int = 1
- mask = field_mask_pb2.FieldMask()
- mask.FromJsonString('fooMessage,fooLazyMessage.quxInt')
- mask.MergeMessage(new_msg, dst)
- self.assertTrue(dst.HasField('foo_message'))
- self.assertFalse(dst.HasField('foo_lazy_message'))
-
- def testMergeErrors(self):
- src = unittest_pb2.TestAllTypes()
- dst = unittest_pb2.TestAllTypes()
- mask = field_mask_pb2.FieldMask()
- test_util.SetAllFields(src)
- mask.FromJsonString('optionalInt32.field')
- with self.assertRaises(ValueError) as e:
- mask.MergeMessage(src, dst)
- self.assertEqual('Error: Field optional_int32 in message '
- 'protobuf_unittest.TestAllTypes is not a singular '
- 'message field and cannot have sub-fields.',
- str(e.exception))
-
def testSnakeCaseToCamelCase(self):
self.assertEqual('fooBar',
well_known_types._SnakeCaseToCamelCase('foo_bar'))
@@ -684,8 +602,6 @@ class StructTest(unittest.TestCase):
def testStruct(self):
struct = struct_pb2.Struct()
- self.assertIsInstance(struct, collections.Mapping)
- self.assertEqual(0, len(struct))
struct_class = struct.__class__
struct['key1'] = 5
@@ -693,13 +609,9 @@ class StructTest(unittest.TestCase):
struct['key3'] = True
struct.get_or_create_struct('key4')['subkey'] = 11.0
struct_list = struct.get_or_create_list('key5')
- self.assertIsInstance(struct_list, collections.Sequence)
struct_list.extend([6, 'seven', True, False, None])
struct_list.add_struct()['subkey2'] = 9
- struct['key6'] = {'subkey': {}}
- struct['key7'] = [2, False]
- self.assertEqual(7, len(struct))
self.assertTrue(isinstance(struct, well_known_types.Struct))
self.assertEqual(5, struct['key1'])
self.assertEqual('abc', struct['key2'])
@@ -709,28 +621,13 @@ class StructTest(unittest.TestCase):
inner_struct['subkey2'] = 9
self.assertEqual([6, 'seven', True, False, None, inner_struct],
list(struct['key5'].items()))
- self.assertEqual({}, dict(struct['key6']['subkey'].fields))
- self.assertEqual([2, False], list(struct['key7'].items()))
serialized = struct.SerializeToString()
+
struct2 = struct_pb2.Struct()
struct2.ParseFromString(serialized)
self.assertEqual(struct, struct2)
- for key, value in struct.items():
- self.assertIn(key, struct)
- self.assertIn(key, struct2)
- self.assertEqual(value, struct2[key])
-
- self.assertEqual(7, len(struct.keys()))
- self.assertEqual(7, len(struct.values()))
- for key in struct.keys():
- self.assertIn(key, struct)
- self.assertIn(key, struct2)
- self.assertEqual(struct[key], struct2[key])
-
- item = (next(iter(struct.keys())), next(iter(struct.values())))
- self.assertEqual(item, next(iter(struct.items())))
self.assertTrue(isinstance(struct2, well_known_types.Struct))
self.assertEqual(5, struct2['key1'])
@@ -754,17 +651,6 @@ class StructTest(unittest.TestCase):
struct_list.add_list().extend([1, 'two', True, False, None])
self.assertEqual([1, 'two', True, False, None],
list(struct_list[6].items()))
- struct_list.extend([{'nested_struct': 30}, ['nested_list', 99], {}, []])
- self.assertEqual(11, len(struct_list.values))
- self.assertEqual(30, struct_list[7]['nested_struct'])
- self.assertEqual('nested_list', struct_list[8][0])
- self.assertEqual(99, struct_list[8][1])
- self.assertEqual({}, dict(struct_list[9].fields))
- self.assertEqual([], list(struct_list[10].items()))
- struct_list[0] = {'replace': 'set'}
- struct_list[1] = ['replace', 'set']
- self.assertEqual('set', struct_list[0]['replace'])
- self.assertEqual(['replace', 'set'], list(struct_list[1].items()))
text_serialized = str(struct)
struct3 = struct_pb2.Struct()
@@ -774,77 +660,6 @@ class StructTest(unittest.TestCase):
struct.get_or_create_struct('key3')['replace'] = 12
self.assertEqual(12, struct['key3']['replace'])
- # Tests empty list.
- struct.get_or_create_list('empty_list')
- empty_list = struct['empty_list']
- self.assertEqual([], list(empty_list.items()))
- list2 = struct_pb2.ListValue()
- list2.add_list()
- empty_list = list2[0]
- self.assertEqual([], list(empty_list.items()))
-
- # Tests empty struct.
- struct.get_or_create_struct('empty_struct')
- empty_struct = struct['empty_struct']
- self.assertEqual({}, dict(empty_struct.fields))
- list2.add_struct()
- empty_struct = list2[1]
- self.assertEqual({}, dict(empty_struct.fields))
-
- self.assertEqual(9, len(struct))
- del struct['key3']
- del struct['key4']
- self.assertEqual(7, len(struct))
- self.assertEqual(6, len(struct['key5']))
- del struct['key5'][1]
- self.assertEqual(5, len(struct['key5']))
- self.assertEqual([6, True, False, None, inner_struct],
- list(struct['key5'].items()))
-
- def testMergeFrom(self):
- struct = struct_pb2.Struct()
- struct_class = struct.__class__
-
- dictionary = {
- 'key1': 5,
- 'key2': 'abc',
- 'key3': True,
- 'key4': {'subkey': 11.0},
- 'key5': [6, 'seven', True, False, None, {'subkey2': 9}],
- 'key6': [['nested_list', True]],
- 'empty_struct': {},
- 'empty_list': []
- }
- struct.update(dictionary)
- self.assertEqual(5, struct['key1'])
- self.assertEqual('abc', struct['key2'])
- self.assertIs(True, struct['key3'])
- self.assertEqual(11, struct['key4']['subkey'])
- inner_struct = struct_class()
- inner_struct['subkey2'] = 9
- self.assertEqual([6, 'seven', True, False, None, inner_struct],
- list(struct['key5'].items()))
- self.assertEqual(2, len(struct['key6'][0].values))
- self.assertEqual('nested_list', struct['key6'][0][0])
- self.assertEqual(True, struct['key6'][0][1])
- empty_list = struct['empty_list']
- self.assertEqual([], list(empty_list.items()))
- empty_struct = struct['empty_struct']
- self.assertEqual({}, dict(empty_struct.fields))
-
- # According to documentation: "When parsing from the wire or when merging,
- # if there are duplicate map keys the last key seen is used".
- duplicate = {
- 'key4': {'replace': 20},
- 'key5': [[False, 5]]
- }
- struct.update(duplicate)
- self.assertEqual(1, len(struct['key4'].fields))
- self.assertEqual(20, struct['key4']['replace'])
- self.assertEqual(1, len(struct['key5'].values))
- self.assertEqual(False, struct['key5'][0][0])
- self.assertEqual(5, struct['key5'][0][1])
-
class AnyTest(unittest.TestCase):
@@ -908,20 +723,6 @@ class AnyTest(unittest.TestCase):
self.assertTrue(msg.Unpack(unpacked_message))
self.assertEqual(submessage, unpacked_message)
- def testPackDeterministic(self):
- submessage = any_test_pb2.TestAny()
- for i in range(10):
- submessage.map_value[str(i)] = i * 2
- msg = any_pb2.Any()
- msg.Pack(submessage, deterministic=True)
- serialized = msg.SerializeToString(deterministic=True)
- golden = (b'\n4type.googleapis.com/google.protobuf.internal.TestAny\x12F'
- b'\x1a\x05\n\x010\x10\x00\x1a\x05\n\x011\x10\x02\x1a\x05\n\x01'
- b'2\x10\x04\x1a\x05\n\x013\x10\x06\x1a\x05\n\x014\x10\x08\x1a'
- b'\x05\n\x015\x10\n\x1a\x05\n\x016\x10\x0c\x1a\x05\n\x017\x10'
- b'\x0e\x1a\x05\n\x018\x10\x10\x1a\x05\n\x019\x10\x12')
- self.assertEqual(golden, serialized)
-
if __name__ == '__main__':
unittest.main()
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/wire_format.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/wire_format.py
index 883f525585..883f525585 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/wire_format.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/wire_format.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/wire_format_test.py b/third_party/protobuf/3.4.0/python/google/protobuf/internal/wire_format_test.py
index da120f3361..da120f3361 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/wire_format_test.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/internal/wire_format_test.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/json_format.py b/third_party/protobuf/3.4.0/python/google/protobuf/json_format.py
index 8d338d3e00..801eed60e4 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/json_format.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/json_format.py
@@ -42,28 +42,21 @@ Simple usage example:
__author__ = 'jieluo@google.com (Jie Luo)'
-# pylint: disable=g-statement-before-imports,g-import-not-at-top
try:
from collections import OrderedDict
except ImportError:
- from ordereddict import OrderedDict # PY26
-# pylint: enable=g-statement-before-imports,g-import-not-at-top
-
+ from ordereddict import OrderedDict #PY26
import base64
import json
import math
-
-from operator import methodcaller
-
import re
-import sys
-
import six
+import sys
+from operator import methodcaller
from google.protobuf import descriptor
from google.protobuf import symbol_database
-
_TIMESTAMPFOMAT = '%Y-%m-%dT%H:%M:%S'
_INT_TYPES = frozenset([descriptor.FieldDescriptor.CPPTYPE_INT32,
descriptor.FieldDescriptor.CPPTYPE_UINT32,
@@ -100,8 +93,7 @@ def MessageToJson(message,
including_default_value_fields=False,
preserving_proto_field_name=False,
indent=2,
- sort_keys=False,
- use_integers_for_enums=False):
+ sort_keys=False):
"""Converts protobuf message to JSON format.
Args:
@@ -116,21 +108,18 @@ def MessageToJson(message,
indent: The JSON object will be pretty-printed with this indent level.
An indent level of 0 or negative will only insert newlines.
sort_keys: If True, then the output will be sorted by field names.
- use_integers_for_enums: If true, print integers instead of enum names.
Returns:
A string containing the JSON formatted protocol buffer message.
"""
printer = _Printer(including_default_value_fields,
- preserving_proto_field_name,
- use_integers_for_enums)
+ preserving_proto_field_name)
return printer.ToJsonString(message, indent, sort_keys)
def MessageToDict(message,
including_default_value_fields=False,
- preserving_proto_field_name=False,
- use_integers_for_enums=False):
+ preserving_proto_field_name=False):
"""Converts protobuf message to a dictionary.
When the dictionary is encoded to JSON, it conforms to proto3 JSON spec.
@@ -144,14 +133,12 @@ def MessageToDict(message,
preserving_proto_field_name: If True, use the original proto field
names as defined in the .proto file. If False, convert the field
names to lowerCamelCase.
- use_integers_for_enums: If true, print integers instead of enum names.
Returns:
A dict representation of the protocol buffer message.
"""
printer = _Printer(including_default_value_fields,
- preserving_proto_field_name,
- use_integers_for_enums)
+ preserving_proto_field_name)
# pylint: disable=protected-access
return printer._MessageToJsonObject(message)
@@ -167,11 +154,9 @@ class _Printer(object):
def __init__(self,
including_default_value_fields=False,
- preserving_proto_field_name=False,
- use_integers_for_enums=False):
+ preserving_proto_field_name=False):
self.including_default_value_fields = including_default_value_fields
self.preserving_proto_field_name = preserving_proto_field_name
- self.use_integers_for_enums = use_integers_for_enums
def ToJsonString(self, message, indent, sort_keys):
js = self._MessageToJsonObject(message)
@@ -262,14 +247,10 @@ class _Printer(object):
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
return self._MessageToJsonObject(value)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
- if self.use_integers_for_enums:
- return value
enum_value = field.enum_type.values_by_number.get(value, None)
if enum_value is not None:
return enum_value.name
else:
- if field.file.syntax == 'proto3':
- return value
raise SerializeToJsonError('Enum field contains an integer value '
'which can not mapped to an enum value.')
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING:
@@ -694,9 +675,6 @@ def _ConvertScalarFieldValue(value, field, require_str=False):
raise ParseError('Invalid enum value {0} for enum type {1}.'.format(
value, field.enum_type.full_name))
if enum_value is None:
- if field.file.syntax == 'proto3':
- # Proto3 accepts unknown enums.
- return number
raise ParseError('Invalid enum value {0} for enum type {1}.'.format(
value, field.enum_type.full_name))
return enum_value.number
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/message.py b/third_party/protobuf/3.4.0/python/google/protobuf/message.py
index eeb0d5763f..eeb0d5763f 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/message.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/message.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/message_factory.py b/third_party/protobuf/3.4.0/python/google/protobuf/message_factory.py
index e4fb065e26..1574028015 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/message_factory.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/message_factory.py
@@ -130,22 +130,13 @@ def GetMessages(file_protos):
"""Builds a dictionary of all the messages available in a set of files.
Args:
- file_protos: Iterable of FileDescriptorProto to build messages out of.
+ file_protos: A sequence of file protos to build messages out of.
Returns:
A dictionary mapping proto names to the message classes. This will include
any dependent messages as well as any messages defined in the same file as
a specified message.
"""
- # The cpp implementation of the protocol buffer library requires to add the
- # message in topological order of the dependency graph.
- file_by_name = {file_proto.name: file_proto for file_proto in file_protos}
- def _AddFile(file_proto):
- for dependency in file_proto.dependency:
- if dependency in file_by_name:
- # Remove from elements to be visited, in order to cut cycles.
- _AddFile(file_by_name.pop(dependency))
+ for file_proto in file_protos:
_FACTORY.pool.Add(file_proto)
- while file_by_name:
- _AddFile(file_by_name.popitem()[1])
return _FACTORY.GetMessages([file_proto.name for file_proto in file_protos])
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/proto_builder.py b/third_party/protobuf/3.4.0/python/google/protobuf/proto_builder.py
index 736caed385..736caed385 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/proto_builder.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/proto_builder.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/README b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/README
index 6d61cb45bf..6d61cb45bf 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/README
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/README
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/__init__.py b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/__init__.py
index 5585614122..5585614122 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/__init__.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/__init__.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/cpp_message.py b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/cpp_message.py
index fc8eb32d79..fc8eb32d79 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/cpp_message.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/cpp_message.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor.cc
index 8af0cb1289..9634ea05ff 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor.cc
@@ -107,6 +107,10 @@ bool _CalledFromGeneratedFile(int stacklevel) {
return false;
}
}
+ if (frame->f_globals != frame->f_locals) {
+ // Not at global module scope
+ return false;
+ }
if (frame->f_code->co_filename == NULL) {
return false;
@@ -119,10 +123,6 @@ bool _CalledFromGeneratedFile(int stacklevel) {
PyErr_Clear();
return false;
}
- if ((filename_size < 3) || (strcmp(&filename[filename_size - 3], ".py") != 0)) {
- // Cython's stack does not have .py file name and is not at global module scope.
- return true;
- }
if (filename_size < 7) {
// filename is too short.
return false;
@@ -131,11 +131,6 @@ bool _CalledFromGeneratedFile(int stacklevel) {
// Filename is not ending with _pb2.
return false;
}
-
- if (frame->f_globals != frame->f_locals) {
- // Not at global module scope
- return false;
- }
#endif
return true;
}
@@ -193,36 +188,39 @@ const FileDescriptor* GetFileDescriptor(const MethodDescriptor* descriptor) {
// Always returns a new reference.
template<class DescriptorClass>
static PyObject* GetOrBuildOptions(const DescriptorClass *descriptor) {
- // Options are cached in the pool that owns the descriptor.
- // First search in the cache.
- PyDescriptorPool* caching_pool = GetDescriptorPool_FromPool(
+ // Options (and their extensions) are completely resolved in the proto file
+ // containing the descriptor.
+ PyDescriptorPool* pool = GetDescriptorPool_FromPool(
GetFileDescriptor(descriptor)->pool());
+
hash_map<const void*, PyObject*>* descriptor_options =
- caching_pool->descriptor_options;
+ pool->descriptor_options;
+ // First search in the cache.
if (descriptor_options->find(descriptor) != descriptor_options->end()) {
PyObject *value = (*descriptor_options)[descriptor];
Py_INCREF(value);
return value;
}
- // Similar to the C++ implementation, we return an Options object from the
- // default (generated) factory, so that client code know that they can use
- // extensions from generated files:
- // d.GetOptions().Extensions[some_pb2.extension]
- //
- // The consequence is that extensions not defined in the default pool won't
- // be available. If needed, we could add an optional 'message_factory'
- // parameter to the GetOptions() function.
- PyMessageFactory* message_factory =
- GetDefaultDescriptorPool()->py_message_factory;
-
// Build the Options object: get its Python class, and make a copy of the C++
// read-only instance.
const Message& options(descriptor->options());
const Descriptor *message_type = options.GetDescriptor();
- CMessageClass* message_class = message_factory::GetOrCreateMessageClass(
+ PyMessageFactory* message_factory = pool->py_message_factory;
+ CMessageClass* message_class = message_factory::GetMessageClass(
message_factory, message_type);
if (message_class == NULL) {
+ // The Options message was not found in the current DescriptorPool.
+ // This means that the pool cannot contain any extensions to the Options
+ // message either, so falling back to the basic pool we can only increase
+ // the chances of successfully parsing the options.
+ PyErr_Clear();
+ pool = GetDefaultDescriptorPool();
+ message_factory = pool->py_message_factory;
+ message_class = message_factory::GetMessageClass(
+ message_factory, message_type);
+ }
+ if (message_class == NULL) {
PyErr_Format(PyExc_TypeError, "Could not retrieve class for Options: %s",
message_type->full_name().c_str());
return NULL;
@@ -250,8 +248,7 @@ static PyObject* GetOrBuildOptions(const DescriptorClass *descriptor) {
options.SerializeToString(&serialized);
io::CodedInputStream input(
reinterpret_cast<const uint8*>(serialized.c_str()), serialized.size());
- input.SetExtensionRegistry(message_factory->pool->pool,
- message_factory->message_factory);
+ input.SetExtensionRegistry(pool->pool, message_factory->message_factory);
bool success = cmsg->message->MergePartialFromCodedStream(&input);
if (!success) {
PyErr_Format(PyExc_ValueError, "Error parsing Options message");
@@ -567,11 +564,6 @@ static int SetOptions(PyBaseDescriptor *self, PyObject *value,
return CheckCalledFromGeneratedFile("_options");
}
-static int SetSerializedOptions(PyBaseDescriptor *self, PyObject *value,
- void *closure) {
- return CheckCalledFromGeneratedFile("_serialized_options");
-}
-
static PyObject* CopyToProto(PyBaseDescriptor *self, PyObject *target) {
return CopyToPythonProto<DescriptorProto>(_GetDescriptor(self), target);
}
@@ -631,8 +623,6 @@ static PyGetSetDef Getters[] = {
{ "is_extendable", (getter)IsExtendable, (setter)NULL},
{ "has_options", (getter)GetHasOptions, (setter)SetHasOptions, "Has Options"},
{ "_options", (getter)NULL, (setter)SetOptions, "Options"},
- { "_serialized_options", (getter)NULL, (setter)SetSerializedOptions,
- "Serialized Options"},
{ "syntax", (getter)GetSyntax, (setter)NULL, "Syntax"},
{NULL}
};
@@ -795,7 +785,7 @@ static PyObject* GetDefaultValue(PyBaseDescriptor *self, void *closure) {
break;
}
case FieldDescriptor::CPPTYPE_STRING: {
- const string& value = _GetDescriptor(self)->default_value_string();
+ string value = _GetDescriptor(self)->default_value_string();
result = ToStringObject(_GetDescriptor(self), value);
break;
}
@@ -907,10 +897,6 @@ static int SetOptions(PyBaseDescriptor *self, PyObject *value,
return CheckCalledFromGeneratedFile("_options");
}
-static int SetSerializedOptions(PyBaseDescriptor *self, PyObject *value,
- void *closure) {
- return CheckCalledFromGeneratedFile("_serialized_options");
-}
static PyGetSetDef Getters[] = {
{ "full_name", (getter)GetFullName, NULL, "Full name"},
@@ -940,8 +926,6 @@ static PyGetSetDef Getters[] = {
"Containing oneof"},
{ "has_options", (getter)GetHasOptions, (setter)SetHasOptions, "Has Options"},
{ "_options", (getter)NULL, (setter)SetOptions, "Options"},
- { "_serialized_options", (getter)NULL, (setter)SetSerializedOptions,
- "Serialized Options"},
{NULL}
};
@@ -1071,11 +1055,6 @@ static int SetOptions(PyBaseDescriptor *self, PyObject *value,
return CheckCalledFromGeneratedFile("_options");
}
-static int SetSerializedOptions(PyBaseDescriptor *self, PyObject *value,
- void *closure) {
- return CheckCalledFromGeneratedFile("_serialized_options");
-}
-
static PyObject* CopyToProto(PyBaseDescriptor *self, PyObject *target) {
return CopyToPythonProto<EnumDescriptorProto>(_GetDescriptor(self), target);
}
@@ -1100,8 +1079,6 @@ static PyGetSetDef Getters[] = {
"Containing type"},
{ "has_options", (getter)GetHasOptions, (setter)SetHasOptions, "Has Options"},
{ "_options", (getter)NULL, (setter)SetOptions, "Options"},
- { "_serialized_options", (getter)NULL, (setter)SetSerializedOptions,
- "Serialized Options"},
{NULL}
};
@@ -1202,10 +1179,6 @@ static int SetOptions(PyBaseDescriptor *self, PyObject *value,
return CheckCalledFromGeneratedFile("_options");
}
-static int SetSerializedOptions(PyBaseDescriptor *self, PyObject *value,
- void *closure) {
- return CheckCalledFromGeneratedFile("_serialized_options");
-}
static PyGetSetDef Getters[] = {
{ "name", (getter)GetName, NULL, "name"},
@@ -1215,8 +1188,6 @@ static PyGetSetDef Getters[] = {
{ "has_options", (getter)GetHasOptions, (setter)SetHasOptions, "Has Options"},
{ "_options", (getter)NULL, (setter)SetOptions, "Options"},
- { "_serialized_options", (getter)NULL, (setter)SetSerializedOptions,
- "Serialized Options"},
{NULL}
};
@@ -1359,11 +1330,6 @@ static int SetOptions(PyFileDescriptor *self, PyObject *value,
return CheckCalledFromGeneratedFile("_options");
}
-static int SetSerializedOptions(PyFileDescriptor *self, PyObject *value,
- void *closure) {
- return CheckCalledFromGeneratedFile("_serialized_options");
-}
-
static PyObject* GetSyntax(PyFileDescriptor *self, void *closure) {
return PyString_InternFromString(
FileDescriptor::SyntaxName(_GetDescriptor(self)->syntax()));
@@ -1389,8 +1355,6 @@ static PyGetSetDef Getters[] = {
{ "has_options", (getter)GetHasOptions, (setter)SetHasOptions, "Has Options"},
{ "_options", (getter)NULL, (setter)SetOptions, "Options"},
- { "_serialized_options", (getter)NULL, (setter)SetSerializedOptions,
- "Serialized Options"},
{ "syntax", (getter)GetSyntax, (setter)NULL, "Syntax"},
{NULL}
};
@@ -1536,11 +1500,6 @@ static int SetOptions(PyBaseDescriptor *self, PyObject *value,
return CheckCalledFromGeneratedFile("_options");
}
-static int SetSerializedOptions(PyBaseDescriptor *self, PyObject *value,
- void *closure) {
- return CheckCalledFromGeneratedFile("_serialized_options");
-}
-
static PyGetSetDef Getters[] = {
{ "name", (getter)GetName, NULL, "Name"},
{ "full_name", (getter)GetFullName, NULL, "Full name"},
@@ -1549,8 +1508,6 @@ static PyGetSetDef Getters[] = {
{ "containing_type", (getter)GetContainingType, NULL, "Containing type"},
{ "has_options", (getter)GetHasOptions, (setter)SetHasOptions, "Has Options"},
{ "_options", (getter)NULL, (setter)SetOptions, "Options"},
- { "_serialized_options", (getter)NULL, (setter)SetSerializedOptions,
- "Serialized Options"},
{ "fields", (getter)GetFields, NULL, "Fields"},
{NULL}
};
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor.h
index f081df842d..f081df842d 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor.h
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_containers.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_containers.cc
index bc007f7efa..d0aae9c9b3 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_containers.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_containers.cc
@@ -957,55 +957,55 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->field_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindFieldByName(name);
}
-static const void* GetByCamelcaseName(PyContainer* self,
+static ItemDescriptor GetByCamelcaseName(PyContainer* self,
const string& name) {
return GetDescriptor(self)->FindFieldByCamelcaseName(name);
}
-static const void* GetByNumber(PyContainer* self, int number) {
+static ItemDescriptor GetByNumber(PyContainer* self, int number) {
return GetDescriptor(self)->FindFieldByNumber(number);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->field(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyFieldDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyFieldDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static const string& GetItemCamelcaseName(const void* item) {
- return static_cast<ItemDescriptor>(item)->camelcase_name();
+static const string& GetItemCamelcaseName(ItemDescriptor item) {
+ return item->camelcase_name();
}
-static int GetItemNumber(const void* item) {
- return static_cast<ItemDescriptor>(item)->number();
+static int GetItemNumber(ItemDescriptor item) {
+ return item->number();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageFields",
- Count,
- GetByIndex,
- GetByName,
- GetByCamelcaseName,
- GetByNumber,
- NewObjectFromItem,
- GetItemName,
- GetItemCamelcaseName,
- GetItemNumber,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)GetByCamelcaseName,
+ (GetByNumberMethod)GetByNumber,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)GetItemCamelcaseName,
+ (GetItemNumberMethod)GetItemNumber,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace fields
@@ -1035,38 +1035,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->nested_type_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindNestedTypeByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->nested_type(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyMessageDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyMessageDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageNestedTypes",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace nested_types
@@ -1087,38 +1087,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->enum_type_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindEnumTypeByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->enum_type(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyEnumDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyEnumDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageNestedEnums",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace enums
@@ -1150,11 +1150,11 @@ static int Count(PyContainer* self) {
return count;
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindEnumValueByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor 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,27 +1173,26 @@ static const void* GetByIndex(PyContainer* self, int index) {
return enum_type->value(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyEnumValueDescriptor_FromDescriptor(
- static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyEnumValueDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
static DescriptorContainerDef ContainerDef = {
"MessageEnumValues",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- NULL,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)NULL,
};
} // namespace enumvalues
@@ -1210,38 +1209,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->extension_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindExtensionByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->extension(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyFieldDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyFieldDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageExtensions",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace extensions
@@ -1262,38 +1261,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->oneof_decl_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindOneofByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->oneof_decl(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyOneofDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyOneofDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageOneofs",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace oneofs
@@ -1324,47 +1323,46 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->value_count();
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->value(index);
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindValueByName(name);
}
-static const void* GetByNumber(PyContainer* self, int number) {
+static ItemDescriptor GetByNumber(PyContainer* self, int number) {
return GetDescriptor(self)->FindValueByNumber(number);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyEnumValueDescriptor_FromDescriptor(
- static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyEnumValueDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemNumber(const void* item) {
- return static_cast<ItemDescriptor>(item)->number();
+static int GetItemNumber(ItemDescriptor item) {
+ return item->number();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"EnumValues",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- GetByNumber,
- NewObjectFromItem,
- GetItemName,
- NULL,
- GetItemNumber,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)GetByNumber,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)GetItemNumber,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace enumvalues
@@ -1399,30 +1397,30 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->field_count();
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->field(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyFieldDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyFieldDescriptor_FromDescriptor(item);
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index_in_oneof();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index_in_oneof();
}
static DescriptorContainerDef ContainerDef = {
"OneofFields",
- Count,
- GetByIndex,
- NULL,
- NULL,
- NULL,
- NewObjectFromItem,
- NULL,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)NULL,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)NULL,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace fields
@@ -1449,38 +1447,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->method_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindMethodByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->method(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyMethodDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyMethodDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"ServiceMethods",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace methods
@@ -1511,38 +1509,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->message_type_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindMessageTypeByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->message_type(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyMessageDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyMessageDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"FileMessages",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace messages
@@ -1559,38 +1557,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->enum_type_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindEnumTypeByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->enum_type(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyEnumDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyEnumDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"FileEnums",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace enums
@@ -1607,38 +1605,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->extension_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindExtensionByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->extension(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyFieldDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyFieldDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"FileExtensions",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace extensions
@@ -1655,38 +1653,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->service_count();
}
-static const void* GetByName(PyContainer* self, const string& name) {
+static ItemDescriptor GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindServiceByName(name);
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->service(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyServiceDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyServiceDescriptor_FromDescriptor(item);
}
-static const string& GetItemName(const void* item) {
- return static_cast<ItemDescriptor>(item)->name();
+static const string& GetItemName(ItemDescriptor item) {
+ return item->name();
}
-static int GetItemIndex(const void* item) {
- return static_cast<ItemDescriptor>(item)->index();
+static int GetItemIndex(ItemDescriptor item) {
+ return item->index();
}
static DescriptorContainerDef ContainerDef = {
"FileServices",
- Count,
- GetByIndex,
- GetByName,
- NULL,
- NULL,
- NewObjectFromItem,
- GetItemName,
- NULL,
- NULL,
- GetItemIndex,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)GetItemIndex,
};
} // namespace services
@@ -1703,26 +1701,26 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->dependency_count();
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->dependency(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyFileDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyFileDescriptor_FromDescriptor(item);
}
static DescriptorContainerDef ContainerDef = {
"FileDependencies",
- Count,
- GetByIndex,
- NULL,
- NULL,
- NULL,
- NewObjectFromItem,
- NULL,
- NULL,
- NULL,
- NULL,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)NULL,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)NULL,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)NULL,
};
} // namespace dependencies
@@ -1739,26 +1737,26 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->public_dependency_count();
}
-static const void* GetByIndex(PyContainer* self, int index) {
+static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->public_dependency(index);
}
-static PyObject* NewObjectFromItem(const void* item) {
- return PyFileDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
+static PyObject* NewObjectFromItem(ItemDescriptor item) {
+ return PyFileDescriptor_FromDescriptor(item);
}
static DescriptorContainerDef ContainerDef = {
"FilePublicDependencies",
- Count,
- GetByIndex,
- NULL,
- NULL,
- NULL,
- NewObjectFromItem,
- NULL,
- NULL,
- NULL,
- NULL,
+ (CountMethod)Count,
+ (GetByIndexMethod)GetByIndex,
+ (GetByNameMethod)NULL,
+ (GetByCamelcaseNameMethod)NULL,
+ (GetByNumberMethod)NULL,
+ (NewObjectFromItemMethod)NewObjectFromItem,
+ (GetItemNameMethod)NULL,
+ (GetItemCamelcaseNameMethod)NULL,
+ (GetItemNumberMethod)NULL,
+ (GetItemIndexMethod)NULL,
};
} // namespace public_dependencies
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_containers.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_containers.h
index 83de07b68c..83de07b68c 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_containers.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_containers.h
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_database.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_database.cc
index daa40cc720..daa40cc720 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_database.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_database.cc
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_database.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_database.h
index fc71c4bcb0..fc71c4bcb0 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_database.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_database.h
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_pool.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_pool.cc
index 95882aeb35..16f4d49d25 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_pool.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_pool.cc
@@ -149,8 +149,7 @@ static PyObject* New(PyTypeObject* type,
PyDescriptorPool_NewWithDatabase(database));
}
-static void Dealloc(PyObject* pself) {
- PyDescriptorPool* self = reinterpret_cast<PyDescriptorPool*>(pself);
+static void Dealloc(PyDescriptorPool* self) {
descriptor_pool_map.erase(self->pool);
Py_CLEAR(self->py_message_factory);
for (hash_map<const void*, PyObject*>::iterator it =
@@ -164,7 +163,7 @@ static void Dealloc(PyObject* pself) {
Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
}
-static PyObject* FindMessageByName(PyObject* self, PyObject* arg) {
+PyObject* FindMessageByName(PyDescriptorPool* self, PyObject* arg) {
Py_ssize_t name_size;
char* name;
if (PyString_AsStringAndSize(arg, &name, &name_size) < 0) {
@@ -172,8 +171,7 @@ static PyObject* FindMessageByName(PyObject* self, PyObject* arg) {
}
const Descriptor* message_descriptor =
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindMessageTypeByName(
- string(name, name_size));
+ self->pool->FindMessageTypeByName(string(name, name_size));
if (message_descriptor == NULL) {
PyErr_Format(PyExc_KeyError, "Couldn't find message %.200s", name);
@@ -186,7 +184,7 @@ static PyObject* FindMessageByName(PyObject* self, PyObject* arg) {
-static PyObject* FindFileByName(PyObject* self, PyObject* arg) {
+PyObject* FindFileByName(PyDescriptorPool* self, PyObject* arg) {
Py_ssize_t name_size;
char* name;
if (PyString_AsStringAndSize(arg, &name, &name_size) < 0) {
@@ -194,8 +192,7 @@ static PyObject* FindFileByName(PyObject* self, PyObject* arg) {
}
const FileDescriptor* file_descriptor =
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindFileByName(
- string(name, name_size));
+ self->pool->FindFileByName(string(name, name_size));
if (file_descriptor == NULL) {
PyErr_Format(PyExc_KeyError, "Couldn't find file %.200s", name);
return NULL;
@@ -221,10 +218,6 @@ PyObject* FindFieldByName(PyDescriptorPool* self, PyObject* arg) {
return PyFieldDescriptor_FromDescriptor(field_descriptor);
}
-static PyObject* FindFieldByNameMethod(PyObject* self, PyObject* arg) {
- return FindFieldByName(reinterpret_cast<PyDescriptorPool*>(self), arg);
-}
-
PyObject* FindExtensionByName(PyDescriptorPool* self, PyObject* arg) {
Py_ssize_t name_size;
char* name;
@@ -242,10 +235,6 @@ PyObject* FindExtensionByName(PyDescriptorPool* self, PyObject* arg) {
return PyFieldDescriptor_FromDescriptor(field_descriptor);
}
-static PyObject* FindExtensionByNameMethod(PyObject* self, PyObject* arg) {
- return FindExtensionByName(reinterpret_cast<PyDescriptorPool*>(self), arg);
-}
-
PyObject* FindEnumTypeByName(PyDescriptorPool* self, PyObject* arg) {
Py_ssize_t name_size;
char* name;
@@ -263,10 +252,6 @@ PyObject* FindEnumTypeByName(PyDescriptorPool* self, PyObject* arg) {
return PyEnumDescriptor_FromDescriptor(enum_descriptor);
}
-static PyObject* FindEnumTypeByNameMethod(PyObject* self, PyObject* arg) {
- return FindEnumTypeByName(reinterpret_cast<PyDescriptorPool*>(self), arg);
-}
-
PyObject* FindOneofByName(PyDescriptorPool* self, PyObject* arg) {
Py_ssize_t name_size;
char* name;
@@ -284,11 +269,7 @@ PyObject* FindOneofByName(PyDescriptorPool* self, PyObject* arg) {
return PyOneofDescriptor_FromDescriptor(oneof_descriptor);
}
-static PyObject* FindOneofByNameMethod(PyObject* self, PyObject* arg) {
- return FindOneofByName(reinterpret_cast<PyDescriptorPool*>(self), arg);
-}
-
-static PyObject* FindServiceByName(PyObject* self, PyObject* arg) {
+PyObject* FindServiceByName(PyDescriptorPool* self, PyObject* arg) {
Py_ssize_t name_size;
char* name;
if (PyString_AsStringAndSize(arg, &name, &name_size) < 0) {
@@ -296,8 +277,7 @@ static PyObject* FindServiceByName(PyObject* self, PyObject* arg) {
}
const ServiceDescriptor* service_descriptor =
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindServiceByName(
- string(name, name_size));
+ self->pool->FindServiceByName(string(name, name_size));
if (service_descriptor == NULL) {
PyErr_Format(PyExc_KeyError, "Couldn't find service %.200s", name);
return NULL;
@@ -306,7 +286,7 @@ static PyObject* FindServiceByName(PyObject* self, PyObject* arg) {
return PyServiceDescriptor_FromDescriptor(service_descriptor);
}
-static PyObject* FindMethodByName(PyObject* self, PyObject* arg) {
+PyObject* FindMethodByName(PyDescriptorPool* self, PyObject* arg) {
Py_ssize_t name_size;
char* name;
if (PyString_AsStringAndSize(arg, &name, &name_size) < 0) {
@@ -314,8 +294,7 @@ static PyObject* FindMethodByName(PyObject* self, PyObject* arg) {
}
const MethodDescriptor* method_descriptor =
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindMethodByName(
- string(name, name_size));
+ self->pool->FindMethodByName(string(name, name_size));
if (method_descriptor == NULL) {
PyErr_Format(PyExc_KeyError, "Couldn't find method %.200s", name);
return NULL;
@@ -324,7 +303,7 @@ static PyObject* FindMethodByName(PyObject* self, PyObject* arg) {
return PyMethodDescriptor_FromDescriptor(method_descriptor);
}
-static PyObject* FindFileContainingSymbol(PyObject* self, PyObject* arg) {
+PyObject* FindFileContainingSymbol(PyDescriptorPool* self, PyObject* arg) {
Py_ssize_t name_size;
char* name;
if (PyString_AsStringAndSize(arg, &name, &name_size) < 0) {
@@ -332,8 +311,7 @@ static PyObject* FindFileContainingSymbol(PyObject* self, PyObject* arg) {
}
const FileDescriptor* file_descriptor =
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindFileContainingSymbol(
- string(name, name_size));
+ self->pool->FindFileContainingSymbol(string(name, name_size));
if (file_descriptor == NULL) {
PyErr_Format(PyExc_KeyError, "Couldn't find symbol %.200s", name);
return NULL;
@@ -342,7 +320,7 @@ static PyObject* FindFileContainingSymbol(PyObject* self, PyObject* arg) {
return PyFileDescriptor_FromDescriptor(file_descriptor);
}
-static PyObject* FindExtensionByNumber(PyObject* self, PyObject* args) {
+PyObject* FindExtensionByNumber(PyDescriptorPool* self, PyObject* args) {
PyObject* message_descriptor;
int number;
if (!PyArg_ParseTuple(args, "Oi", &message_descriptor, &number)) {
@@ -355,8 +333,7 @@ static PyObject* FindExtensionByNumber(PyObject* self, PyObject* args) {
}
const FieldDescriptor* extension_descriptor =
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindExtensionByNumber(
- descriptor, number);
+ self->pool->FindExtensionByNumber(descriptor, number);
if (extension_descriptor == NULL) {
PyErr_Format(PyExc_KeyError, "Couldn't find extension %d", number);
return NULL;
@@ -365,15 +342,14 @@ static PyObject* FindExtensionByNumber(PyObject* self, PyObject* args) {
return PyFieldDescriptor_FromDescriptor(extension_descriptor);
}
-static PyObject* FindAllExtensions(PyObject* self, PyObject* arg) {
+PyObject* FindAllExtensions(PyDescriptorPool* self, PyObject* arg) {
const Descriptor* descriptor = PyMessageDescriptor_AsDescriptor(arg);
if (descriptor == NULL) {
return NULL;
}
std::vector<const FieldDescriptor*> extensions;
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindAllExtensions(
- descriptor, &extensions);
+ self->pool->FindAllExtensions(descriptor, &extensions);
ScopedPyObjectPtr result(PyList_New(extensions.size()));
if (result == NULL) {
@@ -398,15 +374,14 @@ static PyObject* FindAllExtensions(PyObject* self, PyObject* arg) {
// call a function that will just be a no-op?
// TODO(amauryfa): Need to investigate further.
-static PyObject* AddFileDescriptor(PyObject* self, PyObject* descriptor) {
+PyObject* AddFileDescriptor(PyDescriptorPool* self, PyObject* descriptor) {
const FileDescriptor* file_descriptor =
PyFileDescriptor_AsDescriptor(descriptor);
if (!file_descriptor) {
return NULL;
}
if (file_descriptor !=
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindFileByName(
- file_descriptor->name())) {
+ self->pool->FindFileByName(file_descriptor->name())) {
PyErr_Format(PyExc_ValueError,
"The file descriptor %s does not belong to this pool",
file_descriptor->name().c_str());
@@ -415,15 +390,14 @@ static PyObject* AddFileDescriptor(PyObject* self, PyObject* descriptor) {
Py_RETURN_NONE;
}
-static PyObject* AddDescriptor(PyObject* self, PyObject* descriptor) {
+PyObject* AddDescriptor(PyDescriptorPool* self, PyObject* descriptor) {
const Descriptor* message_descriptor =
PyMessageDescriptor_AsDescriptor(descriptor);
if (!message_descriptor) {
return NULL;
}
if (message_descriptor !=
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindMessageTypeByName(
- message_descriptor->full_name())) {
+ self->pool->FindMessageTypeByName(message_descriptor->full_name())) {
PyErr_Format(PyExc_ValueError,
"The message descriptor %s does not belong to this pool",
message_descriptor->full_name().c_str());
@@ -432,15 +406,14 @@ static PyObject* AddDescriptor(PyObject* self, PyObject* descriptor) {
Py_RETURN_NONE;
}
-static PyObject* AddEnumDescriptor(PyObject* self, PyObject* descriptor) {
+PyObject* AddEnumDescriptor(PyDescriptorPool* self, PyObject* descriptor) {
const EnumDescriptor* enum_descriptor =
PyEnumDescriptor_AsDescriptor(descriptor);
if (!enum_descriptor) {
return NULL;
}
if (enum_descriptor !=
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindEnumTypeByName(
- enum_descriptor->full_name())) {
+ self->pool->FindEnumTypeByName(enum_descriptor->full_name())) {
PyErr_Format(PyExc_ValueError,
"The enum descriptor %s does not belong to this pool",
enum_descriptor->full_name().c_str());
@@ -449,15 +422,14 @@ static PyObject* AddEnumDescriptor(PyObject* self, PyObject* descriptor) {
Py_RETURN_NONE;
}
-static PyObject* AddExtensionDescriptor(PyObject* self, PyObject* descriptor) {
+PyObject* AddExtensionDescriptor(PyDescriptorPool* self, PyObject* descriptor) {
const FieldDescriptor* extension_descriptor =
PyFieldDescriptor_AsDescriptor(descriptor);
if (!extension_descriptor) {
return NULL;
}
if (extension_descriptor !=
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindExtensionByName(
- extension_descriptor->full_name())) {
+ self->pool->FindExtensionByName(extension_descriptor->full_name())) {
PyErr_Format(PyExc_ValueError,
"The extension descriptor %s does not belong to this pool",
extension_descriptor->full_name().c_str());
@@ -466,15 +438,14 @@ static PyObject* AddExtensionDescriptor(PyObject* self, PyObject* descriptor) {
Py_RETURN_NONE;
}
-static PyObject* AddServiceDescriptor(PyObject* self, PyObject* descriptor) {
+PyObject* AddServiceDescriptor(PyDescriptorPool* self, PyObject* descriptor) {
const ServiceDescriptor* service_descriptor =
PyServiceDescriptor_AsDescriptor(descriptor);
if (!service_descriptor) {
return NULL;
}
if (service_descriptor !=
- reinterpret_cast<PyDescriptorPool*>(self)->pool->FindServiceByName(
- service_descriptor->full_name())) {
+ self->pool->FindServiceByName(service_descriptor->full_name())) {
PyErr_Format(PyExc_ValueError,
"The service descriptor %s does not belong to this pool",
service_descriptor->full_name().c_str());
@@ -510,8 +481,7 @@ class BuildFileErrorCollector : public DescriptorPool::ErrorCollector {
bool had_errors;
};
-static PyObject* AddSerializedFile(PyObject* pself, PyObject* serialized_pb) {
- PyDescriptorPool* self = reinterpret_cast<PyDescriptorPool*>(pself);
+PyObject* AddSerializedFile(PyDescriptorPool* self, PyObject* serialized_pb) {
char* message_type;
Py_ssize_t message_len;
@@ -559,7 +529,7 @@ static PyObject* AddSerializedFile(PyObject* pself, PyObject* serialized_pb) {
descriptor, serialized_pb);
}
-static PyObject* Add(PyObject* self, PyObject* file_descriptor_proto) {
+PyObject* Add(PyDescriptorPool* self, PyObject* file_descriptor_proto) {
ScopedPyObjectPtr serialized_pb(
PyObject_CallMethod(file_descriptor_proto, "SerializeToString", NULL));
if (serialized_pb == NULL) {
@@ -569,46 +539,46 @@ static PyObject* Add(PyObject* self, PyObject* file_descriptor_proto) {
}
static PyMethodDef Methods[] = {
- { "Add", Add, METH_O,
+ { "Add", (PyCFunction)Add, METH_O,
"Adds the FileDescriptorProto and its types to this pool." },
- { "AddSerializedFile", AddSerializedFile, METH_O,
+ { "AddSerializedFile", (PyCFunction)AddSerializedFile, METH_O,
"Adds a serialized FileDescriptorProto to this pool." },
// TODO(amauryfa): Understand why the Python implementation differs from
// this one, ask users to use another API and deprecate these functions.
- { "AddFileDescriptor", AddFileDescriptor, METH_O,
+ { "AddFileDescriptor", (PyCFunction)AddFileDescriptor, METH_O,
"No-op. Add() must have been called before." },
- { "AddDescriptor", AddDescriptor, METH_O,
+ { "AddDescriptor", (PyCFunction)AddDescriptor, METH_O,
"No-op. Add() must have been called before." },
- { "AddEnumDescriptor", AddEnumDescriptor, METH_O,
+ { "AddEnumDescriptor", (PyCFunction)AddEnumDescriptor, METH_O,
"No-op. Add() must have been called before." },
- { "AddExtensionDescriptor", AddExtensionDescriptor, METH_O,
+ { "AddExtensionDescriptor", (PyCFunction)AddExtensionDescriptor, METH_O,
"No-op. Add() must have been called before." },
- { "AddServiceDescriptor", AddServiceDescriptor, METH_O,
+ { "AddServiceDescriptor", (PyCFunction)AddServiceDescriptor, METH_O,
"No-op. Add() must have been called before." },
- { "FindFileByName", FindFileByName, METH_O,
+ { "FindFileByName", (PyCFunction)FindFileByName, METH_O,
"Searches for a file descriptor by its .proto name." },
- { "FindMessageTypeByName", FindMessageByName, METH_O,
+ { "FindMessageTypeByName", (PyCFunction)FindMessageByName, METH_O,
"Searches for a message descriptor by full name." },
- { "FindFieldByName", FindFieldByNameMethod, METH_O,
+ { "FindFieldByName", (PyCFunction)FindFieldByName, METH_O,
"Searches for a field descriptor by full name." },
- { "FindExtensionByName", FindExtensionByNameMethod, METH_O,
+ { "FindExtensionByName", (PyCFunction)FindExtensionByName, METH_O,
"Searches for extension descriptor by full name." },
- { "FindEnumTypeByName", FindEnumTypeByNameMethod, METH_O,
+ { "FindEnumTypeByName", (PyCFunction)FindEnumTypeByName, METH_O,
"Searches for enum type descriptor by full name." },
- { "FindOneofByName", FindOneofByNameMethod, METH_O,
+ { "FindOneofByName", (PyCFunction)FindOneofByName, METH_O,
"Searches for oneof descriptor by full name." },
- { "FindServiceByName", FindServiceByName, METH_O,
+ { "FindServiceByName", (PyCFunction)FindServiceByName, METH_O,
"Searches for service descriptor by full name." },
- { "FindMethodByName", FindMethodByName, METH_O,
+ { "FindMethodByName", (PyCFunction)FindMethodByName, METH_O,
"Searches for method descriptor by full name." },
- { "FindFileContainingSymbol", FindFileContainingSymbol, METH_O,
+ { "FindFileContainingSymbol", (PyCFunction)FindFileContainingSymbol, METH_O,
"Gets the FileDescriptor containing the specified symbol." },
- { "FindExtensionByNumber", FindExtensionByNumber, METH_VARARGS,
+ { "FindExtensionByNumber", (PyCFunction)FindExtensionByNumber, METH_VARARGS,
"Gets the extension descriptor for the given number." },
- { "FindAllExtensions", FindAllExtensions, METH_O,
+ { "FindAllExtensions", (PyCFunction)FindAllExtensions, METH_O,
"Gets all known extensions of the given message descriptor." },
{NULL}
};
@@ -620,7 +590,7 @@ PyTypeObject PyDescriptorPool_Type = {
FULL_MODULE_NAME ".DescriptorPool", // tp_name
sizeof(PyDescriptorPool), // tp_basicsize
0, // tp_itemsize
- cdescriptor_pool::Dealloc, // tp_dealloc
+ (destructor)cdescriptor_pool::Dealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_pool.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_pool.h
index 53ee53dc5e..53ee53dc5e 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/descriptor_pool.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/descriptor_pool.h
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/extension_dict.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/extension_dict.cc
index 018b5c2c49..43ee5d15f4 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/extension_dict.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/extension_dict.cc
@@ -32,7 +32,6 @@
// Author: tibell@google.com (Johan Tibell)
#include <google/protobuf/pyext/extension_dict.h>
-#include <memory>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -46,6 +45,7 @@
#include <google/protobuf/pyext/repeated_composite_container.h>
#include <google/protobuf/pyext/repeated_scalar_container.h>
#include <google/protobuf/pyext/scoped_pyobject_ptr.h>
+#include <google/protobuf/stubs/shared_ptr.h>
#if PY_MAJOR_VERSION >= 3
#if PY_VERSION_HEX < 0x03030000
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/extension_dict.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/extension_dict.h
index 0de2c4ee85..65b878625a 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/extension_dict.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/extension_dict.h
@@ -37,8 +37,9 @@
#include <Python.h>
#include <memory>
-
-#include <google/protobuf/pyext/message.h>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
namespace google {
namespace protobuf {
@@ -46,8 +47,16 @@ namespace protobuf {
class Message;
class FieldDescriptor;
+#ifdef _SHARED_PTR_H
+using std::shared_ptr;
+#else
+using internal::shared_ptr;
+#endif
+
namespace python {
+struct CMessage;
+
typedef struct ExtensionDict {
PyObject_HEAD;
@@ -55,7 +64,7 @@ typedef struct ExtensionDict {
// proto tree. Every Python container class holds a
// reference to it in order to keep it alive as long as there's a
// Python object that references any part of the tree.
- CMessage::OwnerRef owner;
+ shared_ptr<Message> owner;
// Weak reference to parent message. Used to make sure
// the parent is writable when an extension field is modified.
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/map_container.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/map_container.cc
index 6d7ee285b2..43be0701bb 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/map_container.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/map_container.cc
@@ -33,6 +33,9 @@
#include <google/protobuf/pyext/map_container.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -73,7 +76,7 @@ class MapReflectionFriend {
struct MapIterator {
PyObject_HEAD;
- std::unique_ptr<::google::protobuf::MapIterator> iter;
+ google::protobuf::scoped_ptr< ::google::protobuf::MapIterator> iter;
// A pointer back to the container, so we can notice changes to the version.
// We own a ref on this.
@@ -91,7 +94,7 @@ struct MapIterator {
// as this iterator does. This is solely for the benefit of the MapIterator
// destructor -- we should never actually access the iterator in this state
// except to delete it.
- CMessage::OwnerRef owner;
+ shared_ptr<Message> owner;
// The version of the map when we took the iterator to it.
//
@@ -336,24 +339,6 @@ PyObject* GetEntryClass(PyObject* _self) {
return reinterpret_cast<PyObject*>(message_class);
}
-PyObject* MergeFrom(PyObject* _self, PyObject* arg) {
- MapContainer* self = GetMap(_self);
- MapContainer* other_map = GetMap(arg);
- Message* message = self->GetMutableMessage();
- const Message* other_message = other_map->message;
- const Reflection* reflection = message->GetReflection();
- const Reflection* other_reflection = other_message->GetReflection();
- int count = other_reflection->FieldSize(
- *other_message, other_map->parent_field_descriptor);
- for (int i = 0 ; i < count; i ++) {
- reflection->AddMessage(message, self->parent_field_descriptor)->MergeFrom(
- other_reflection->GetRepeatedMessage(
- *other_message, other_map->parent_field_descriptor, i));
- }
- self->version++;
- Py_RETURN_NONE;
-}
-
PyObject* MapReflectionFriend::Contains(PyObject* _self, PyObject* key) {
MapContainer* self = GetMap(_self);
@@ -550,8 +535,6 @@ static PyMethodDef ScalarMapMethods[] = {
"Gets the value for the given key if present, or otherwise a default" },
{ "GetEntryClass", (PyCFunction)GetEntryClass, METH_NOARGS,
"Return the class used to build Entries of (key, value) pairs." },
- { "MergeFrom", (PyCFunction)MergeFrom, METH_O,
- "Merges a map into the current map." },
/*
{ "__deepcopy__", (PyCFunction)DeepCopy, METH_VARARGS,
"Makes a deep copy of the class." },
@@ -737,17 +720,14 @@ int MapReflectionFriend::MessageMapSetItem(PyObject* _self, PyObject* key,
map_key, &value);
ScopedPyObjectPtr key(PyLong_FromVoidPtr(value.MutableMessageValue()));
- PyObject* cmsg_value = PyDict_GetItem(self->message_dict, key.get());
- if (cmsg_value) {
- // Need to keep CMessage stay alive if it is still referenced after
- // deletion. Makes a new message and swaps values into CMessage
- // instead of just removing.
- CMessage* cmsg = reinterpret_cast<CMessage*>(cmsg_value);
- Message* msg = cmsg->message;
- cmsg->owner.reset(msg->New());
- cmsg->message = cmsg->owner.get();
- cmsg->parent = NULL;
- msg->GetReflection()->Swap(msg, cmsg->message);
+ // PyDict_DelItem will have key error if the key is not in the map. We do
+ // not want to call PyErr_Clear() which may clear other errors. Thus
+ // PyDict_Contains() check is called before delete.
+ int contains = PyDict_Contains(self->message_dict, key.get());
+ if (contains < 0) {
+ return -1;
+ }
+ if (contains) {
if (PyDict_DelItem(self->message_dict, key.get()) < 0) {
return -1;
}
@@ -827,8 +807,6 @@ static PyMethodDef MessageMapMethods[] = {
"Alias for getitem, useful to make explicit that the map is mutated." },
{ "GetEntryClass", (PyCFunction)GetEntryClass, METH_NOARGS,
"Return the class used to build Entries of (key, value) pairs." },
- { "MergeFrom", (PyCFunction)MergeFrom, METH_O,
- "Merges a map into the current map." },
/*
{ "__deepcopy__", (PyCFunction)DeepCopy, METH_VARARGS,
"Makes a deep copy of the class." },
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/map_container.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/map_container.h
index 111fafbf3f..615657b03b 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/map_container.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/map_container.h
@@ -34,18 +34,27 @@
#include <Python.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
-#include <google/protobuf/pyext/message.h>
namespace google {
namespace protobuf {
class Message;
+#ifdef _SHARED_PTR_H
+using std::shared_ptr;
+#else
+using internal::shared_ptr;
+#endif
+
namespace python {
+struct CMessage;
struct CMessageClass;
// This struct is used directly for ScalarMap, and is the base class of
@@ -57,7 +66,7 @@ struct MapContainer {
// proto tree. Every Python MapContainer holds a
// reference to it in order to keep it alive as long as there's a
// Python object that references any part of the tree.
- CMessage::OwnerRef owner;
+ shared_ptr<Message> owner;
// Pointer to the C++ Message that contains this container. The
// MapContainer does not own this pointer.
@@ -90,7 +99,9 @@ struct MapContainer {
int Release();
// Set the owner field of self and any children of self.
- void SetOwner(const CMessage::OwnerRef& new_owner) { owner = new_owner; }
+ void SetOwner(const shared_ptr<Message>& new_owner) {
+ owner = new_owner;
+ }
};
struct MessageMapContainer : public MapContainer {
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message.cc
index 5893533adf..702c5d03d8 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message.cc
@@ -35,6 +35,9 @@
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
#include <structmember.h> // A Python header file.
@@ -64,6 +67,7 @@
#include <google/protobuf/pyext/message_factory.h>
#include <google/protobuf/pyext/safe_numerics.h>
#include <google/protobuf/pyext/scoped_pyobject_ptr.h>
+#include <google/protobuf/stubs/strutil.h>
#if PY_MAJOR_VERSION >= 3
#define PyInt_AsLong PyLong_AsLong
@@ -98,17 +102,6 @@ namespace message_meta {
static int InsertEmptyWeakref(PyTypeObject* base);
-namespace {
-// Copied oveer from internal 'google/protobuf/stubs/strutil.h'.
-inline void UpperString(string * s) {
- string::iterator end = s->end();
- for (string::iterator i = s->begin(); i != end; ++i) {
- // toupper() changes based on locale. We don't want this!
- if ('a' <= *i && *i <= 'z') *i += 'A' - 'a';
- }
-}
-}
-
// Add the number of a field descriptor to the containing message class.
// Equivalent to:
// _cls.<field>_FIELD_NUMBER = <number>
@@ -602,7 +595,7 @@ void OutOfRangeError(PyObject* arg) {
template<class RangeType, class ValueType>
bool VerifyIntegerCastAndRange(PyObject* arg, ValueType value) {
- if (GOOGLE_PREDICT_FALSE(value == -1 && PyErr_Occurred())) {
+ 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.
@@ -610,11 +603,11 @@ bool VerifyIntegerCastAndRange(PyObject* arg, ValueType value) {
OutOfRangeError(arg);
} // Otherwise propagate existing error.
return false;
- }
- if (GOOGLE_PREDICT_FALSE(!IsValidNumericCast<RangeType>(value))) {
- OutOfRangeError(arg);
- return false;
- }
+ }
+ if GOOGLE_PREDICT_FALSE(!IsValidNumericCast<RangeType>(value)) {
+ OutOfRangeError(arg);
+ return false;
+ }
return true;
}
@@ -623,25 +616,25 @@ 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))) {
+ 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))) {
- FormatTypeError(arg, "int, long");
- return false;
- }
+ if GOOGLE_PREDICT_FALSE(!PyIndex_Check(arg)) {
+ FormatTypeError(arg, "int, long");
+ return false;
+ }
// Now we have an integral number so we can safely use PyLong_ functions.
// We need to treat the signed and unsigned cases differently in case arg is
@@ -655,10 +648,10 @@ 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 == nullptr)) {
+ if GOOGLE_PREDICT_FALSE(casted == NULL) {
// Propagate existing error.
return false;
- }
+ }
ulong_result = PyLong_AsUnsignedLongLong(casted);
Py_DECREF(casted);
}
@@ -680,10 +673,10 @@ 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 == nullptr)) {
+ if GOOGLE_PREDICT_FALSE(casted == NULL) {
// Propagate existing error.
return false;
- }
+ }
long_result = PyLong_AsLongLong(casted);
Py_DECREF(casted);
}
@@ -706,10 +699,10 @@ template bool CheckAndGetInteger<uint64>(PyObject*, uint64*);
bool CheckAndGetDouble(PyObject* arg, double* value) {
*value = PyFloat_AsDouble(arg);
- if (GOOGLE_PREDICT_FALSE(*value == -1 && PyErr_Occurred())) {
+ if GOOGLE_PREDICT_FALSE(*value == -1 && PyErr_Occurred()) {
FormatTypeError(arg, "int, long, float");
return false;
- }
+ }
return true;
}
@@ -827,8 +820,7 @@ bool CheckAndSetString(
return true;
}
-PyObject* ToStringObject(const FieldDescriptor* descriptor,
- const string& value) {
+PyObject* ToStringObject(const FieldDescriptor* descriptor, string value) {
if (descriptor->type() != FieldDescriptor::TYPE_STRING) {
return PyBytes_FromStringAndSize(value.c_str(), value.length());
}
@@ -1176,7 +1168,7 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) {
continue;
}
if (descriptor->is_map()) {
- ScopedPyObjectPtr map(GetAttr(reinterpret_cast<PyObject*>(self), name));
+ ScopedPyObjectPtr map(GetAttr(self, name));
const FieldDescriptor* value_descriptor =
descriptor->message_type()->FindFieldByName("value");
if (value_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
@@ -1204,8 +1196,7 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) {
}
}
} else if (descriptor->label() == FieldDescriptor::LABEL_REPEATED) {
- ScopedPyObjectPtr container(
- GetAttr(reinterpret_cast<PyObject*>(self), name));
+ ScopedPyObjectPtr container(GetAttr(self, name));
if (container == NULL) {
return -1;
}
@@ -1272,8 +1263,7 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) {
}
}
} else if (descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
- ScopedPyObjectPtr message(
- GetAttr(reinterpret_cast<PyObject*>(self), name));
+ ScopedPyObjectPtr message(GetAttr(self, name));
if (message == NULL) {
return -1;
}
@@ -1298,8 +1288,8 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) {
return -1;
}
}
- if (SetAttr(reinterpret_cast<PyObject*>(self), name,
- (new_val.get() == NULL) ? value : new_val.get()) < 0) {
+ if (SetAttr(self, name, (new_val.get() == NULL) ? value : new_val.get()) <
+ 0) {
return -1;
}
}
@@ -1316,8 +1306,6 @@ CMessage* NewEmptyMessage(CMessageClass* type) {
return NULL;
}
- // Use "placement new" syntax to initialize the C++ object.
- new (&self->owner) CMessage::OwnerRef(NULL);
self->message = NULL;
self->parent = NULL;
self->parent_field_descriptor = NULL;
@@ -1414,7 +1402,7 @@ static void Dealloc(CMessage* self) {
Py_CLEAR(self->extensions);
Py_CLEAR(self->composite_fields);
- self->owner.~ThreadUnsafeSharedPtr<Message>();
+ self->owner.reset();
Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
}
@@ -1555,7 +1543,20 @@ PyObject* HasField(CMessage* self, PyObject* arg) {
if (message->GetReflection()->HasField(*message, field_descriptor)) {
Py_RETURN_TRUE;
}
-
+ if (!message->GetReflection()->SupportsUnknownEnumValues() &&
+ field_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) {
+ // Special case: Python HasField() differs in semantics from C++
+ // slightly: we return HasField('enum_field') == true if there is
+ // an unknown enum value present. To implement this we have to
+ // look in the UnknownFieldSet.
+ const UnknownFieldSet& unknown_field_set =
+ message->GetReflection()->GetUnknownFields(*message);
+ for (int i = 0; i < unknown_field_set.field_count(); ++i) {
+ if (unknown_field_set.field(i).number() == field_descriptor->number()) {
+ Py_RETURN_TRUE;
+ }
+ }
+ }
Py_RETURN_FALSE;
}
@@ -1616,10 +1617,9 @@ PyObject* HasExtension(CMessage* self, PyObject* extension) {
// * Clear the weak references from the released container to the
// parent.
-class SetOwnerVisitor : public ChildVisitor {
- public:
+struct SetOwnerVisitor : public ChildVisitor {
// new_owner must outlive this object.
- explicit SetOwnerVisitor(const CMessage::OwnerRef& new_owner)
+ explicit SetOwnerVisitor(const shared_ptr<Message>& new_owner)
: new_owner_(new_owner) {}
int VisitRepeatedCompositeContainer(RepeatedCompositeContainer* container) {
@@ -1643,11 +1643,11 @@ class SetOwnerVisitor : public ChildVisitor {
}
private:
- const CMessage::OwnerRef& new_owner_;
+ const shared_ptr<Message>& new_owner_;
};
// Change the owner of this CMessage and all its children, recursively.
-int SetOwner(CMessage* self, const CMessage::OwnerRef& new_owner) {
+int SetOwner(CMessage* self, const shared_ptr<Message>& new_owner) {
self->owner = new_owner;
if (ForEachCompositeField(self, SetOwnerVisitor(new_owner)) == -1)
return -1;
@@ -1680,7 +1680,7 @@ int ReleaseSubMessage(CMessage* self,
const FieldDescriptor* field_descriptor,
CMessage* child_cmessage) {
// Release the Message
- CMessage::OwnerRef released_message(ReleaseMessage(
+ shared_ptr<Message> released_message(ReleaseMessage(
self, child_cmessage->message->GetDescriptor(), field_descriptor));
child_cmessage->message = released_message.get();
child_cmessage->owner.swap(released_message);
@@ -1735,6 +1735,12 @@ PyObject* ClearFieldByDescriptor(
AssureWritable(self);
Message* message = self->message;
message->GetReflection()->ClearField(message, field_descriptor);
+ if (field_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_ENUM &&
+ !message->GetReflection()->SupportsUnknownEnumValues()) {
+ UnknownFieldSet* unknown_field_set =
+ message->GetReflection()->MutableUnknownFields(message);
+ unknown_field_set->DeleteByNumber(field_descriptor->number());
+ }
Py_RETURN_NONE;
}
@@ -2059,11 +2065,6 @@ static PyObject* MergeFromString(CMessage* self, PyObject* arg) {
input.SetExtensionRegistry(factory->pool->pool, factory->message_factory);
bool success = self->message->MergePartialFromCodedStream(&input);
if (success) {
- if (!input.ConsumedEntireMessage()) {
- // TODO(jieluo): Raise error and return NULL instead.
- // b/27494216
- PyErr_Warn(NULL, "Unexpected end-group tag: Not all data was converted");
- }
return PyInt_FromLong(input.CurrentPosition());
} else {
PyErr_Format(DecodeError_class, "Error parsing message");
@@ -2205,8 +2206,7 @@ static PyObject* ListFields(CMessage* self) {
return NULL;
}
- PyObject* field_value =
- GetAttr(reinterpret_cast<PyObject*>(self), py_field_name.get());
+ PyObject* field_value = GetAttr(self, py_field_name.get());
if (field_value == NULL) {
PyErr_SetObject(PyExc_ValueError, py_field_name.get());
return NULL;
@@ -2330,16 +2330,32 @@ PyObject* InternalGetScalar(const Message* message,
break;
}
case FieldDescriptor::CPPTYPE_STRING: {
- string scratch;
- const string& value =
- reflection->GetStringReference(*message, field_descriptor, &scratch);
+ string value = reflection->GetString(*message, field_descriptor);
result = ToStringObject(field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_ENUM: {
- const EnumValueDescriptor* enum_value =
- message->GetReflection()->GetEnum(*message, field_descriptor);
- result = PyInt_FromLong(enum_value->number());
+ if (!message->GetReflection()->SupportsUnknownEnumValues() &&
+ !message->GetReflection()->HasField(*message, field_descriptor)) {
+ // Look for the value in the unknown fields.
+ const UnknownFieldSet& unknown_field_set =
+ message->GetReflection()->GetUnknownFields(*message);
+ for (int i = 0; i < unknown_field_set.field_count(); ++i) {
+ if (unknown_field_set.field(i).number() ==
+ field_descriptor->number() &&
+ unknown_field_set.field(i).type() ==
+ google::protobuf::UnknownField::TYPE_VARINT) {
+ result = PyInt_FromLong(unknown_field_set.field(i).varint());
+ break;
+ }
+ }
+ }
+
+ if (result == NULL) {
+ const EnumValueDescriptor* enum_value =
+ message->GetReflection()->GetEnum(*message, field_descriptor);
+ result = PyInt_FromLong(enum_value->number());
+ }
break;
}
default:
@@ -2704,8 +2720,7 @@ static bool SetCompositeField(
return PyDict_SetItem(self->composite_fields, name, value) == 0;
}
-PyObject* GetAttr(PyObject* pself, PyObject* name) {
- CMessage* self = reinterpret_cast<CMessage*>(pself);
+PyObject* GetAttr(CMessage* self, PyObject* name) {
PyObject* value = self->composite_fields ?
PyDict_GetItem(self->composite_fields, name) : NULL;
if (value != NULL) {
@@ -2783,8 +2798,7 @@ PyObject* GetAttr(PyObject* pself, PyObject* name) {
return InternalGetScalar(self->message, field_descriptor);
}
-int SetAttr(PyObject* pself, PyObject* name, PyObject* value) {
- CMessage* self = reinterpret_cast<CMessage*>(pself);
+int SetAttr(CMessage* self, PyObject* name, PyObject* value) {
if (self->composite_fields && PyDict_Contains(self->composite_fields, name)) {
PyErr_SetString(PyExc_TypeError, "Can't set composite field");
return -1;
@@ -2836,8 +2850,8 @@ PyTypeObject CMessage_Type = {
PyObject_HashNotImplemented, // tp_hash
0, // tp_call
(reprfunc)cmessage::ToStr, // tp_str
- cmessage::GetAttr, // tp_getattro
- cmessage::SetAttr, // tp_setattro
+ (getattrofunc)cmessage::GetAttr, // tp_getattro
+ (setattrofunc)cmessage::SetAttr, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, // tp_flags
"A ProtocolMessage", // tp_doc
@@ -3063,4 +3077,5 @@ bool InitProto2MessageModule(PyObject *m) {
} // namespace python
} // namespace protobuf
+
} // namespace google
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message.h
index 72bcfa83d9..ce80497e6b 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message.h
@@ -37,11 +37,11 @@
#include <Python.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/pyext/thread_unsafe_shared_ptr.h>
-
namespace google {
namespace protobuf {
@@ -52,6 +52,13 @@ class Descriptor;
class DescriptorPool;
class MessageFactory;
+#ifdef _SHARED_PTR_H
+using std::shared_ptr;
+using std::string;
+#else
+using internal::shared_ptr;
+#endif
+
namespace python {
struct ExtensionDict;
@@ -64,9 +71,7 @@ typedef struct CMessage {
// proto tree. Every Python CMessage holds a reference to it in
// order to keep it alive as long as there's a Python object that
// references any part of the tree.
-
- typedef ThreadUnsafeSharedPtr<Message> OwnerRef;
- OwnerRef owner;
+ shared_ptr<Message> owner;
// Weak reference to a parent CMessage object. This is NULL for any top-level
// message and is set for any child message (i.e. a child submessage or a
@@ -235,22 +240,22 @@ 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 'self', which is interpreted as a
-// CMessage. Returns the attribute value on success, or null on failure.
+// Retrieves an attribute named 'name' from CMessage 'self'. Returns
+// the attribute value on success, or NULL on failure.
//
// Returns a new reference.
-PyObject* GetAttr(PyObject* self, PyObject* name);
+PyObject* GetAttr(CMessage* self, PyObject* name);
-// 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);
+// 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);
PyObject* FindInitializationErrors(CMessage* self);
// Set the owner field of self and any children of self, recursively.
// Used when self is being released and thus has a new owner (the
// released Message.)
-int SetOwner(CMessage* self, const CMessage::OwnerRef& new_owner);
+int SetOwner(CMessage* self, const shared_ptr<Message>& new_owner);
int AssureWritable(CMessage* self);
@@ -331,8 +336,7 @@ bool CheckAndSetString(
const Reflection* reflection,
bool append,
int index);
-PyObject* ToStringObject(const FieldDescriptor* descriptor,
- const string& value);
+PyObject* ToStringObject(const FieldDescriptor* descriptor, string value);
// Check if the passed field descriptor belongs to the given message.
// If not, return false and set a Python exception (a KeyError)
@@ -343,15 +347,6 @@ extern PyObject* PickleError_class;
bool InitProto2MessageModule(PyObject *m);
-#if LANG_CXX11
-// These are referenced by repeated_scalar_container, and must
-// be explicitly instantiated.
-extern template bool CheckAndGetInteger<int32>(PyObject*, int32*);
-extern template bool CheckAndGetInteger<int64>(PyObject*, int64*);
-extern template bool CheckAndGetInteger<uint32>(PyObject*, uint32*);
-extern template bool CheckAndGetInteger<uint64>(PyObject*, uint64*);
-#endif
-
} // namespace python
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_factory.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_factory.cc
index bacc76a69f..571bae2be4 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_factory.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_factory.cc
@@ -100,9 +100,7 @@ PyObject* New(PyTypeObject* type, PyObject* args, PyObject* kwargs) {
NewMessageFactory(type, reinterpret_cast<PyDescriptorPool*>(pool)));
}
-static void Dealloc(PyObject* pself) {
- PyMessageFactory* self = reinterpret_cast<PyMessageFactory*>(pself);
-
+static void Dealloc(PyMessageFactory* self) {
// TODO(amauryfa): When the MessageFactory is not created from the
// DescriptorPool this reference should be owned, not borrowed.
// Py_CLEAR(self->pool);
@@ -113,7 +111,7 @@ static void Dealloc(PyObject* pself) {
}
delete self->classes_by_descriptor;
delete self->message_factory;
- Py_TYPE(self)->tp_free(pself);
+ Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
}
// Add a message class to our database.
@@ -233,7 +231,7 @@ PyTypeObject PyMessageFactory_Type = {
".MessageFactory", // tp_name
sizeof(PyMessageFactory), // tp_basicsize
0, // tp_itemsize
- message_factory::Dealloc, // tp_dealloc
+ (destructor)message_factory::Dealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_factory.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_factory.h
index 36092f7e40..36092f7e40 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_factory.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_factory.h
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_module.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_module.cc
index 7c4df47f45..d90d9de35a 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/message_module.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/message_module.cc
@@ -28,33 +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.
-#include <Python.h>
-
#include <google/protobuf/pyext/message.h>
-#include <google/protobuf/message_lite.h>
-
-static PyObject* GetPythonProto3PreserveUnknownsDefault(
- PyObject* /*m*/, PyObject* /*args*/) {
- if (google::protobuf::internal::GetProto3PreserveUnknownsDefault()) {
- Py_RETURN_TRUE;
- } else {
- Py_RETURN_FALSE;
- }
-}
-
-static PyObject* SetPythonProto3PreserveUnknownsDefault(
- PyObject* /*m*/, PyObject* arg) {
- if (!arg || !PyBool_Check(arg)) {
- PyErr_SetString(
- PyExc_TypeError,
- "Argument to SetPythonProto3PreserveUnknownsDefault must be boolean");
- return NULL;
- }
- google::protobuf::internal::SetProto3PreserveUnknownsDefault(PyObject_IsTrue(arg));
- Py_RETURN_NONE;
-}
-
static const char module_docstring[] =
"python-proto2 is a module that can be used to enhance proto2 Python API\n"
"performance.\n"
@@ -66,14 +41,6 @@ static PyMethodDef ModuleMethods[] = {
{"SetAllowOversizeProtos",
(PyCFunction)google::protobuf::python::cmessage::SetAllowOversizeProtos,
METH_O, "Enable/disable oversize proto parsing."},
- // DO NOT USE: For migration and testing only.
- {"GetPythonProto3PreserveUnknownsDefault",
- (PyCFunction)GetPythonProto3PreserveUnknownsDefault,
- METH_NOARGS, "Get Proto3 preserve unknowns default."},
- // DO NOT USE: For migration and testing only.
- {"SetPythonProto3PreserveUnknownsDefault",
- (PyCFunction)SetPythonProto3PreserveUnknownsDefault,
- METH_O, "Enable/disable proto3 unknowns preservation."},
{ NULL, NULL}
};
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/proto2_api_test.proto b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/proto2_api_test.proto
index 18aecfb7d6..18aecfb7d6 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/proto2_api_test.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/proto2_api_test.proto
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/python.proto b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/python.proto
index 2e50df7401..cce645d71a 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/python.proto
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/python.proto
@@ -58,11 +58,11 @@ message ForeignMessage {
repeated int32 d = 2;
}
-message TestAllExtensions { // extension begin
+message TestAllExtensions {
extensions 1 to max;
-} // extension end
+}
-extend TestAllExtensions { // extension begin
+extend TestAllExtensions {
optional TestAllTypes.NestedMessage optional_nested_message_extension = 1;
repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 2;
-} // extension end
+}
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_composite_container.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_composite_container.cc
index 5874d5de8b..5ad71db598 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_composite_container.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_composite_container.cc
@@ -34,6 +34,9 @@
#include <google/protobuf/pyext/repeated_composite_container.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -78,10 +81,7 @@ namespace repeated_composite_container {
// ---------------------------------------------------------------------
// len()
-static Py_ssize_t Length(PyObject* pself) {
- RepeatedCompositeContainer* self =
- reinterpret_cast<RepeatedCompositeContainer*>(pself);
-
+static Py_ssize_t Length(RepeatedCompositeContainer* self) {
Message* message = self->message;
if (message != NULL) {
return message->GetReflection()->FieldSize(*message,
@@ -102,7 +102,7 @@ static int UpdateChildMessages(RepeatedCompositeContainer* self) {
// A MergeFrom on a parent message could have caused extra messages to be
// added in the underlying protobuf so add them to our list. They can never
// be removed in such a way so there's no need to worry about that.
- Py_ssize_t message_length = Length(reinterpret_cast<PyObject*>(self));
+ Py_ssize_t message_length = Length(self);
Py_ssize_t child_length = PyList_GET_SIZE(self->child_messages);
Message* message = self->message;
const Reflection* reflection = message->GetReflection();
@@ -191,10 +191,6 @@ PyObject* Add(RepeatedCompositeContainer* self,
return AddToAttached(self, args, kwargs);
}
-static PyObject* AddMethod(PyObject* self, PyObject* args, PyObject* kwargs) {
- return Add(reinterpret_cast<RepeatedCompositeContainer*>(self), args, kwargs);
-}
-
// ---------------------------------------------------------------------
// extend()
@@ -230,10 +226,6 @@ PyObject* Extend(RepeatedCompositeContainer* self, PyObject* value) {
Py_RETURN_NONE;
}
-static PyObject* ExtendMethod(PyObject* self, PyObject* value) {
- return Extend(reinterpret_cast<RepeatedCompositeContainer*>(self), value);
-}
-
PyObject* MergeFrom(RepeatedCompositeContainer* self, PyObject* other) {
if (UpdateChildMessages(self) < 0) {
return NULL;
@@ -241,10 +233,6 @@ PyObject* MergeFrom(RepeatedCompositeContainer* self, PyObject* other) {
return Extend(self, other);
}
-static PyObject* MergeFromMethod(PyObject* self, PyObject* other) {
- return MergeFrom(reinterpret_cast<RepeatedCompositeContainer*>(self), other);
-}
-
PyObject* Subscript(RepeatedCompositeContainer* self, PyObject* slice) {
if (UpdateChildMessages(self) < 0) {
return NULL;
@@ -254,10 +242,6 @@ PyObject* Subscript(RepeatedCompositeContainer* self, PyObject* slice) {
return PyObject_GetItem(self->child_messages, slice);
}
-static PyObject* SubscriptMethod(PyObject* self, PyObject* slice) {
- return Subscript(reinterpret_cast<RepeatedCompositeContainer*>(self), slice);
-}
-
int AssignSubscript(RepeatedCompositeContainer* self,
PyObject* slice,
PyObject* value) {
@@ -281,7 +265,7 @@ int AssignSubscript(RepeatedCompositeContainer* self,
Py_ssize_t from;
Py_ssize_t to;
Py_ssize_t step;
- Py_ssize_t length = Length(reinterpret_cast<PyObject*>(self));
+ Py_ssize_t length = Length(self);
Py_ssize_t slicelength;
if (PySlice_Check(slice)) {
#if PY_MAJOR_VERSION >= 3
@@ -306,16 +290,7 @@ int AssignSubscript(RepeatedCompositeContainer* self,
return 0;
}
-static int AssignSubscriptMethod(PyObject* self, PyObject* slice,
- PyObject* value) {
- return AssignSubscript(reinterpret_cast<RepeatedCompositeContainer*>(self),
- slice, value);
-}
-
-static PyObject* Remove(PyObject* pself, PyObject* value) {
- RepeatedCompositeContainer* self =
- reinterpret_cast<RepeatedCompositeContainer*>(pself);
-
+static PyObject* Remove(RepeatedCompositeContainer* self, PyObject* value) {
if (UpdateChildMessages(self) < 0) {
return NULL;
}
@@ -330,10 +305,9 @@ static PyObject* Remove(PyObject* pself, PyObject* value) {
Py_RETURN_NONE;
}
-static PyObject* RichCompare(PyObject* pself, PyObject* other, int opid) {
- RepeatedCompositeContainer* self =
- reinterpret_cast<RepeatedCompositeContainer*>(pself);
-
+static PyObject* RichCompare(RepeatedCompositeContainer* self,
+ PyObject* other,
+ int opid) {
if (UpdateChildMessages(self) < 0) {
return NULL;
}
@@ -366,13 +340,12 @@ static PyObject* RichCompare(PyObject* pself, PyObject* other, int opid) {
}
}
-static PyObject* ToStr(PyObject* pself) {
+static PyObject* ToStr(RepeatedCompositeContainer* self) {
ScopedPyObjectPtr full_slice(PySlice_New(NULL, NULL, NULL));
if (full_slice == NULL) {
return NULL;
}
- ScopedPyObjectPtr list(Subscript(
- reinterpret_cast<RepeatedCompositeContainer*>(pself), full_slice.get()));
+ ScopedPyObjectPtr list(Subscript(self, full_slice.get()));
if (list == NULL) {
return NULL;
}
@@ -386,7 +359,7 @@ static void ReorderAttached(RepeatedCompositeContainer* self) {
Message* message = self->message;
const Reflection* reflection = message->GetReflection();
const FieldDescriptor* descriptor = self->parent_field_descriptor;
- const Py_ssize_t length = Length(reinterpret_cast<PyObject*>(self));
+ const Py_ssize_t length = Length(self);
// Since Python protobuf objects are never arena-allocated, adding and
// removing message pointers to the underlying array is just updating
@@ -417,10 +390,9 @@ static int SortPythonMessages(RepeatedCompositeContainer* self,
return 0;
}
-static PyObject* Sort(PyObject* pself, PyObject* args, PyObject* kwds) {
- RepeatedCompositeContainer* self =
- reinterpret_cast<RepeatedCompositeContainer*>(pself);
-
+static PyObject* Sort(RepeatedCompositeContainer* self,
+ PyObject* args,
+ PyObject* kwds) {
// Support the old sort_function argument for backwards
// compatibility.
if (kwds != NULL) {
@@ -444,14 +416,11 @@ static PyObject* Sort(PyObject* pself, PyObject* args, PyObject* kwds) {
// ---------------------------------------------------------------------
-static PyObject* Item(PyObject* pself, Py_ssize_t index) {
- RepeatedCompositeContainer* self =
- reinterpret_cast<RepeatedCompositeContainer*>(pself);
-
+static PyObject* Item(RepeatedCompositeContainer* self, Py_ssize_t index) {
if (UpdateChildMessages(self) < 0) {
return NULL;
}
- Py_ssize_t length = Length(pself);
+ Py_ssize_t length = Length(self);
if (index < 0) {
index = length + index;
}
@@ -463,17 +432,17 @@ static PyObject* Item(PyObject* pself, Py_ssize_t index) {
return item;
}
-static PyObject* Pop(PyObject* pself, PyObject* args) {
- RepeatedCompositeContainer* self =
- reinterpret_cast<RepeatedCompositeContainer*>(pself);
-
+static PyObject* Pop(RepeatedCompositeContainer* self,
+ PyObject* args) {
Py_ssize_t index = -1;
if (!PyArg_ParseTuple(args, "|n", &index)) {
return NULL;
}
- PyObject* item = Item(pself, index);
+ PyObject* item = Item(self, index);
if (item == NULL) {
- PyErr_Format(PyExc_IndexError, "list index (%zd) out of range", index);
+ PyErr_Format(PyExc_IndexError,
+ "list index (%zd) out of range",
+ index);
return NULL;
}
ScopedPyObjectPtr py_index(PyLong_FromSsize_t(index));
@@ -491,7 +460,7 @@ void ReleaseLastTo(CMessage* parent,
GOOGLE_CHECK_NOTNULL(field);
GOOGLE_CHECK_NOTNULL(target);
- CMessage::OwnerRef released_message(
+ shared_ptr<Message> released_message(
parent->message->GetReflection()->ReleaseLast(parent->message, field));
// TODO(tibell): Deal with proto1.
@@ -534,10 +503,7 @@ int Release(RepeatedCompositeContainer* self) {
return 0;
}
-PyObject* DeepCopy(PyObject* pself, PyObject* arg) {
- RepeatedCompositeContainer* self =
- reinterpret_cast<RepeatedCompositeContainer*>(pself);
-
+PyObject* DeepCopy(RepeatedCompositeContainer* self, PyObject* arg) {
ScopedPyObjectPtr cloneObj(
PyType_GenericAlloc(&RepeatedCompositeContainer_Type, 0));
if (cloneObj == NULL) {
@@ -564,7 +530,7 @@ PyObject* DeepCopy(PyObject* pself, PyObject* arg) {
}
int SetOwner(RepeatedCompositeContainer* self,
- const CMessage::OwnerRef& new_owner) {
+ const shared_ptr<Message>& new_owner) {
GOOGLE_CHECK_ATTACHED(self);
self->owner = new_owner;
@@ -605,46 +571,43 @@ PyObject *NewContainer(
return reinterpret_cast<PyObject*>(self);
}
-static void Dealloc(PyObject* pself) {
- RepeatedCompositeContainer* self =
- reinterpret_cast<RepeatedCompositeContainer*>(pself);
-
+static void Dealloc(RepeatedCompositeContainer* self) {
Py_CLEAR(self->child_messages);
Py_CLEAR(self->child_message_class);
// TODO(tibell): Do we need to call delete on these objects to make
// sure their destructors are called?
self->owner.reset();
- Py_TYPE(self)->tp_free(pself);
+ Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
}
static PySequenceMethods SqMethods = {
- Length, /* sq_length */
- 0, /* sq_concat */
- 0, /* sq_repeat */
- Item /* sq_item */
+ (lenfunc)Length, /* sq_length */
+ 0, /* sq_concat */
+ 0, /* sq_repeat */
+ (ssizeargfunc)Item /* sq_item */
};
static PyMappingMethods MpMethods = {
- Length, /* mp_length */
- SubscriptMethod, /* mp_subscript */
- AssignSubscriptMethod, /* mp_ass_subscript */
+ (lenfunc)Length, /* mp_length */
+ (binaryfunc)Subscript, /* mp_subscript */
+ (objobjargproc)AssignSubscript,/* mp_ass_subscript */
};
static PyMethodDef Methods[] = {
- { "__deepcopy__", DeepCopy, METH_VARARGS,
+ { "__deepcopy__", (PyCFunction)DeepCopy, METH_VARARGS,
"Makes a deep copy of the class." },
- { "add", (PyCFunction)AddMethod, METH_VARARGS | METH_KEYWORDS,
+ { "add", (PyCFunction) Add, METH_VARARGS | METH_KEYWORDS,
"Adds an object to the repeated container." },
- { "extend", ExtendMethod, METH_O,
+ { "extend", (PyCFunction) Extend, METH_O,
"Adds objects to the repeated container." },
- { "pop", Pop, METH_VARARGS,
+ { "pop", (PyCFunction)Pop, METH_VARARGS,
"Removes an object from the repeated container and returns it." },
- { "remove", Remove, METH_O,
+ { "remove", (PyCFunction) Remove, METH_O,
"Removes an object from the repeated container." },
- { "sort", (PyCFunction)Sort, METH_VARARGS | METH_KEYWORDS,
+ { "sort", (PyCFunction) Sort, METH_VARARGS | METH_KEYWORDS,
"Sorts the repeated container." },
- { "MergeFrom", MergeFromMethod, METH_O,
+ { "MergeFrom", (PyCFunction) MergeFrom, METH_O,
"Adds objects to the repeated container." },
{ NULL, NULL }
};
@@ -656,12 +619,12 @@ PyTypeObject RepeatedCompositeContainer_Type = {
FULL_MODULE_NAME ".RepeatedCompositeContainer", // tp_name
sizeof(RepeatedCompositeContainer), // tp_basicsize
0, // tp_itemsize
- repeated_composite_container::Dealloc, // tp_dealloc
+ (destructor)repeated_composite_container::Dealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_compare
- repeated_composite_container::ToStr, // tp_repr
+ (reprfunc)repeated_composite_container::ToStr, // tp_repr
0, // tp_as_number
&repeated_composite_container::SqMethods, // tp_as_sequence
&repeated_composite_container::MpMethods, // tp_as_mapping
@@ -675,7 +638,7 @@ PyTypeObject RepeatedCompositeContainer_Type = {
"A Repeated scalar container", // tp_doc
0, // tp_traverse
0, // tp_clear
- repeated_composite_container::RichCompare, // tp_richcompare
+ (richcmpfunc)repeated_composite_container::RichCompare, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_composite_container.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_composite_container.h
index e5e946aaf0..a7b56b61b3 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_composite_container.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_composite_container.h
@@ -37,19 +37,27 @@
#include <Python.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
-#include <google/protobuf/pyext/message.h>
-
namespace google {
namespace protobuf {
class FieldDescriptor;
class Message;
+#ifdef _SHARED_PTR_H
+using std::shared_ptr;
+#else
+using internal::shared_ptr;
+#endif
+
namespace python {
+struct CMessage;
struct CMessageClass;
// A RepeatedCompositeContainer can be in one of two states: attached
@@ -69,7 +77,7 @@ typedef struct RepeatedCompositeContainer {
// proto tree. Every Python RepeatedCompositeContainer holds a
// reference to it in order to keep it alive as long as there's a
// Python object that references any part of the tree.
- CMessage::OwnerRef owner;
+ shared_ptr<Message> owner;
// Weak reference to parent object. May be NULL. Used to make sure
// the parent is writable before modifying the
@@ -140,6 +148,11 @@ int AssignSubscript(RepeatedCompositeContainer* self,
PyObject* slice,
PyObject* value);
+// Releases the messages in the container to the given message.
+//
+// Returns 0 on success, -1 on failure.
+int ReleaseToMessage(RepeatedCompositeContainer* self, Message* new_message);
+
// Releases the messages in the container to a new message.
//
// Returns 0 on success, -1 on failure.
@@ -147,7 +160,7 @@ int Release(RepeatedCompositeContainer* self);
// Returns 0 on success, -1 on failure.
int SetOwner(RepeatedCompositeContainer* self,
- const CMessage::OwnerRef& new_owner);
+ const shared_ptr<Message>& new_owner);
// Removes the last element of the repeated message field 'field' on
// the Message 'parent', and transfers the ownership of the released
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_scalar_container.cc b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_scalar_container.cc
index de3b6e1465..549988009c 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_scalar_container.cc
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_scalar_container.cc
@@ -34,6 +34,9 @@
#include <google/protobuf/pyext/repeated_scalar_container.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
@@ -74,18 +77,15 @@ static int InternalAssignRepeatedField(
return 0;
}
-static Py_ssize_t Len(PyObject* pself) {
- RepeatedScalarContainer* self =
- reinterpret_cast<RepeatedScalarContainer*>(pself);
+static Py_ssize_t Len(RepeatedScalarContainer* self) {
Message* message = self->message;
return message->GetReflection()->FieldSize(*message,
self->parent_field_descriptor);
}
-static int AssignItem(PyObject* pself, Py_ssize_t index, PyObject* arg) {
- RepeatedScalarContainer* self =
- reinterpret_cast<RepeatedScalarContainer*>(pself);
-
+static int AssignItem(RepeatedScalarContainer* self,
+ Py_ssize_t index,
+ PyObject* arg) {
cmessage::AssureWritable(self->parent);
Message* message = self->message;
const FieldDescriptor* field_descriptor = self->parent_field_descriptor;
@@ -188,10 +188,7 @@ static int AssignItem(PyObject* pself, Py_ssize_t index, PyObject* arg) {
return 0;
}
-static PyObject* Item(PyObject* pself, Py_ssize_t index) {
- RepeatedScalarContainer* self =
- reinterpret_cast<RepeatedScalarContainer*>(pself);
-
+static PyObject* Item(RepeatedScalarContainer* self, Py_ssize_t index) {
Message* message = self->message;
const FieldDescriptor* field_descriptor = self->parent_field_descriptor;
const Reflection* reflection = message->GetReflection();
@@ -259,12 +256,27 @@ static PyObject* Item(PyObject* pself, Py_ssize_t index) {
break;
}
case FieldDescriptor::CPPTYPE_STRING: {
- string scratch;
- const string& value = reflection->GetRepeatedStringReference(
- *message, field_descriptor, index, &scratch);
+ string value = reflection->GetRepeatedString(
+ *message, field_descriptor, index);
result = ToStringObject(field_descriptor, value);
break;
}
+ case FieldDescriptor::CPPTYPE_MESSAGE: {
+ PyObject* py_cmsg = PyObject_CallObject(reinterpret_cast<PyObject*>(
+ &CMessage_Type), NULL);
+ if (py_cmsg == NULL) {
+ return NULL;
+ }
+ CMessage* cmsg = reinterpret_cast<CMessage*>(py_cmsg);
+ const Message& msg = reflection->GetRepeatedMessage(
+ *message, field_descriptor, index);
+ cmsg->owner = self->owner;
+ cmsg->parent = self->parent;
+ cmsg->message = const_cast<Message*>(&msg);
+ cmsg->read_only = false;
+ result = reinterpret_cast<PyObject*>(py_cmsg);
+ break;
+ }
default:
PyErr_Format(
PyExc_SystemError,
@@ -275,7 +287,7 @@ static PyObject* Item(PyObject* pself, Py_ssize_t index) {
return result;
}
-static PyObject* Subscript(PyObject* pself, PyObject* slice) {
+static PyObject* Subscript(RepeatedScalarContainer* self, PyObject* slice) {
Py_ssize_t from;
Py_ssize_t to;
Py_ssize_t step;
@@ -290,13 +302,14 @@ static PyObject* Subscript(PyObject* pself, PyObject* slice) {
if (PyLong_Check(slice)) {
from = to = PyLong_AsLong(slice);
} else if (PySlice_Check(slice)) {
- length = Len(pself);
+ length = Len(self);
#if PY_MAJOR_VERSION >= 3
if (PySlice_GetIndicesEx(slice,
length, &from, &to, &step, &slicelength) == -1) {
#else
if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
length, &from, &to, &step, &slicelength) == -1) {
+
#endif
return NULL;
}
@@ -307,7 +320,7 @@ static PyObject* Subscript(PyObject* pself, PyObject* slice) {
}
if (!return_list) {
- return Item(pself, from);
+ return Item(self, from);
}
PyObject* list = PyList_New(0);
@@ -322,7 +335,7 @@ static PyObject* Subscript(PyObject* pself, PyObject* slice) {
if (index < 0 || index >= length) {
break;
}
- ScopedPyObjectPtr s(Item(pself, index));
+ ScopedPyObjectPtr s(Item(self, index));
PyList_Append(list, s.get());
}
} else {
@@ -333,7 +346,7 @@ static PyObject* Subscript(PyObject* pself, PyObject* slice) {
if (index < 0 || index >= length) {
break;
}
- ScopedPyObjectPtr s(Item(pself, index));
+ ScopedPyObjectPtr s(Item(self, index));
PyList_Append(list, s.get());
}
}
@@ -420,14 +433,9 @@ PyObject* Append(RepeatedScalarContainer* self, PyObject* item) {
Py_RETURN_NONE;
}
-static PyObject* AppendMethod(PyObject* self, PyObject* item) {
- return Append(reinterpret_cast<RepeatedScalarContainer*>(self), item);
-}
-
-static int AssSubscript(PyObject* pself, PyObject* slice, PyObject* value) {
- RepeatedScalarContainer* self =
- reinterpret_cast<RepeatedScalarContainer*>(pself);
-
+static int AssSubscript(RepeatedScalarContainer* self,
+ PyObject* slice,
+ PyObject* value) {
Py_ssize_t from;
Py_ssize_t to;
Py_ssize_t step;
@@ -443,7 +451,7 @@ static int AssSubscript(PyObject* pself, PyObject* slice, PyObject* value) {
#if PY_MAJOR_VERSION < 3
if (PyInt_Check(slice)) {
from = to = PyInt_AsLong(slice);
- } else // NOLINT
+ } else
#endif
if (PyLong_Check(slice)) {
from = to = PyLong_AsLong(slice);
@@ -471,14 +479,14 @@ static int AssSubscript(PyObject* pself, PyObject* slice, PyObject* value) {
}
if (!create_list) {
- return AssignItem(pself, from, value);
+ return AssignItem(self, from, value);
}
ScopedPyObjectPtr full_slice(PySlice_New(NULL, NULL, NULL));
if (full_slice == NULL) {
return -1;
}
- ScopedPyObjectPtr new_list(Subscript(pself, full_slice.get()));
+ ScopedPyObjectPtr new_list(Subscript(self, full_slice.get()));
if (new_list == NULL) {
return -1;
}
@@ -517,17 +525,14 @@ PyObject* Extend(RepeatedScalarContainer* self, PyObject* value) {
Py_RETURN_NONE;
}
-static PyObject* Insert(PyObject* pself, PyObject* args) {
- RepeatedScalarContainer* self =
- reinterpret_cast<RepeatedScalarContainer*>(pself);
-
+static PyObject* Insert(RepeatedScalarContainer* self, PyObject* args) {
Py_ssize_t index;
PyObject* value;
if (!PyArg_ParseTuple(args, "lO", &index, &value)) {
return NULL;
}
ScopedPyObjectPtr full_slice(PySlice_New(NULL, NULL, NULL));
- ScopedPyObjectPtr new_list(Subscript(pself, full_slice.get()));
+ ScopedPyObjectPtr new_list(Subscript(self, full_slice.get()));
if (PyList_Insert(new_list.get(), index, value) < 0) {
return NULL;
}
@@ -538,10 +543,10 @@ static PyObject* Insert(PyObject* pself, PyObject* args) {
Py_RETURN_NONE;
}
-static PyObject* Remove(PyObject* pself, PyObject* value) {
+static PyObject* Remove(RepeatedScalarContainer* self, PyObject* value) {
Py_ssize_t match_index = -1;
- for (Py_ssize_t i = 0; i < Len(pself); ++i) {
- ScopedPyObjectPtr elem(Item(pself, i));
+ for (Py_ssize_t i = 0; i < Len(self); ++i) {
+ ScopedPyObjectPtr elem(Item(self, i));
if (PyObject_RichCompareBool(elem.get(), value, Py_EQ)) {
match_index = i;
break;
@@ -551,17 +556,15 @@ static PyObject* Remove(PyObject* pself, PyObject* value) {
PyErr_SetString(PyExc_ValueError, "remove(x): x not in container");
return NULL;
}
- if (AssignItem(pself, match_index, NULL) < 0) {
+ if (AssignItem(self, match_index, NULL) < 0) {
return NULL;
}
Py_RETURN_NONE;
}
-static PyObject* ExtendMethod(PyObject* self, PyObject* value) {
- return Extend(reinterpret_cast<RepeatedScalarContainer*>(self), value);
-}
-
-static PyObject* RichCompare(PyObject* pself, PyObject* other, int opid) {
+static PyObject* RichCompare(RepeatedScalarContainer* self,
+ PyObject* other,
+ int opid) {
if (opid != Py_EQ && opid != Py_NE) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
@@ -578,25 +581,28 @@ static PyObject* RichCompare(PyObject* pself, PyObject* other, int opid) {
ScopedPyObjectPtr other_list_deleter;
if (PyObject_TypeCheck(other, &RepeatedScalarContainer_Type)) {
- other_list_deleter.reset(Subscript(other, full_slice.get()));
+ other_list_deleter.reset(Subscript(
+ reinterpret_cast<RepeatedScalarContainer*>(other), full_slice.get()));
other = other_list_deleter.get();
}
- ScopedPyObjectPtr list(Subscript(pself, full_slice.get()));
+ ScopedPyObjectPtr list(Subscript(self, full_slice.get()));
if (list == NULL) {
return NULL;
}
return PyObject_RichCompare(list.get(), other, opid);
}
-PyObject* Reduce(PyObject* unused_self, PyObject* unused_other) {
+PyObject* Reduce(RepeatedScalarContainer* unused_self) {
PyErr_Format(
PickleError_class,
"can't pickle repeated message fields, convert to list first");
return NULL;
}
-static PyObject* Sort(PyObject* pself, PyObject* args, PyObject* kwds) {
+static PyObject* Sort(RepeatedScalarContainer* self,
+ PyObject* args,
+ PyObject* kwds) {
// Support the old sort_function argument for backwards
// compatibility.
if (kwds != NULL) {
@@ -615,7 +621,7 @@ static PyObject* Sort(PyObject* pself, PyObject* args, PyObject* kwds) {
if (full_slice == NULL) {
return NULL;
}
- ScopedPyObjectPtr list(Subscript(pself, full_slice.get()));
+ ScopedPyObjectPtr list(Subscript(self, full_slice.get()));
if (list == NULL) {
return NULL;
}
@@ -627,36 +633,38 @@ static PyObject* Sort(PyObject* pself, PyObject* args, PyObject* kwds) {
if (res == NULL) {
return NULL;
}
- int ret = InternalAssignRepeatedField(
- reinterpret_cast<RepeatedScalarContainer*>(pself), list.get());
+ int ret = InternalAssignRepeatedField(self, list.get());
if (ret < 0) {
return NULL;
}
Py_RETURN_NONE;
}
-static PyObject* Pop(PyObject* pself, PyObject* args) {
+static PyObject* Pop(RepeatedScalarContainer* self,
+ PyObject* args) {
Py_ssize_t index = -1;
if (!PyArg_ParseTuple(args, "|n", &index)) {
return NULL;
}
- PyObject* item = Item(pself, index);
+ PyObject* item = Item(self, index);
if (item == NULL) {
- PyErr_Format(PyExc_IndexError, "list index (%zd) out of range", index);
+ PyErr_Format(PyExc_IndexError,
+ "list index (%zd) out of range",
+ index);
return NULL;
}
- if (AssignItem(pself, index, NULL) < 0) {
+ if (AssignItem(self, index, NULL) < 0) {
return NULL;
}
return item;
}
-static PyObject* ToStr(PyObject* pself) {
+static PyObject* ToStr(RepeatedScalarContainer* self) {
ScopedPyObjectPtr full_slice(PySlice_New(NULL, NULL, NULL));
if (full_slice == NULL) {
return NULL;
}
- ScopedPyObjectPtr list(Subscript(pself, full_slice.get()));
+ ScopedPyObjectPtr list(Subscript(self, full_slice.get()));
if (list == NULL) {
return NULL;
}
@@ -695,8 +703,7 @@ static int InitializeAndCopyToParentContainer(
if (full_slice == NULL) {
return -1;
}
- ScopedPyObjectPtr values(
- Subscript(reinterpret_cast<PyObject*>(from), full_slice.get()));
+ ScopedPyObjectPtr values(Subscript(from, full_slice.get()));
if (values == NULL) {
return -1;
}
@@ -715,10 +722,7 @@ int Release(RepeatedScalarContainer* self) {
return InitializeAndCopyToParentContainer(self, self);
}
-PyObject* DeepCopy(PyObject* pself, PyObject* arg) {
- RepeatedScalarContainer* self =
- reinterpret_cast<RepeatedScalarContainer*>(pself);
-
+PyObject* DeepCopy(RepeatedScalarContainer* self, PyObject* arg) {
RepeatedScalarContainer* clone = reinterpret_cast<RepeatedScalarContainer*>(
PyType_GenericAlloc(&RepeatedScalarContainer_Type, 0));
if (clone == NULL) {
@@ -732,47 +736,45 @@ PyObject* DeepCopy(PyObject* pself, PyObject* arg) {
return reinterpret_cast<PyObject*>(clone);
}
-static void Dealloc(PyObject* pself) {
- RepeatedScalarContainer* self =
- reinterpret_cast<RepeatedScalarContainer*>(pself);
+static void Dealloc(RepeatedScalarContainer* self) {
self->owner.reset();
- Py_TYPE(self)->tp_free(pself);
+ Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
}
void SetOwner(RepeatedScalarContainer* self,
- const CMessage::OwnerRef& new_owner) {
+ const shared_ptr<Message>& new_owner) {
self->owner = new_owner;
}
static PySequenceMethods SqMethods = {
- Len, /* sq_length */
- 0, /* sq_concat */
- 0, /* sq_repeat */
- Item, /* sq_item */
- 0, /* sq_slice */
- AssignItem /* sq_ass_item */
+ (lenfunc)Len, /* sq_length */
+ 0, /* sq_concat */
+ 0, /* sq_repeat */
+ (ssizeargfunc)Item, /* sq_item */
+ 0, /* sq_slice */
+ (ssizeobjargproc)AssignItem /* sq_ass_item */
};
static PyMappingMethods MpMethods = {
- Len, /* mp_length */
- Subscript, /* mp_subscript */
- AssSubscript, /* mp_ass_subscript */
+ (lenfunc)Len, /* mp_length */
+ (binaryfunc)Subscript, /* mp_subscript */
+ (objobjargproc)AssSubscript, /* mp_ass_subscript */
};
static PyMethodDef Methods[] = {
- { "__deepcopy__", DeepCopy, METH_VARARGS,
+ { "__deepcopy__", (PyCFunction)DeepCopy, METH_VARARGS,
"Makes a deep copy of the class." },
- { "__reduce__", Reduce, METH_NOARGS,
+ { "__reduce__", (PyCFunction)Reduce, METH_NOARGS,
"Outputs picklable representation of the repeated field." },
- { "append", AppendMethod, METH_O,
+ { "append", (PyCFunction)Append, METH_O,
"Appends an object to the repeated container." },
- { "extend", ExtendMethod, METH_O,
+ { "extend", (PyCFunction)Extend, METH_O,
+ "Appends objects to the repeated container." },
+ { "insert", (PyCFunction)Insert, METH_VARARGS,
"Appends objects to the repeated container." },
- { "insert", Insert, METH_VARARGS,
- "Inserts an object at the specified position in the container." },
- { "pop", Pop, METH_VARARGS,
+ { "pop", (PyCFunction)Pop, METH_VARARGS,
"Removes an object from the repeated container and returns it." },
- { "remove", Remove, METH_O,
+ { "remove", (PyCFunction)Remove, METH_O,
"Removes an object from the repeated container." },
{ "sort", (PyCFunction)Sort, METH_VARARGS | METH_KEYWORDS,
"Sorts the repeated container."},
@@ -786,12 +788,12 @@ PyTypeObject RepeatedScalarContainer_Type = {
FULL_MODULE_NAME ".RepeatedScalarContainer", // tp_name
sizeof(RepeatedScalarContainer), // tp_basicsize
0, // tp_itemsize
- repeated_scalar_container::Dealloc, // tp_dealloc
+ (destructor)repeated_scalar_container::Dealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_compare
- repeated_scalar_container::ToStr, // tp_repr
+ (reprfunc)repeated_scalar_container::ToStr, // tp_repr
0, // tp_as_number
&repeated_scalar_container::SqMethods, // tp_as_sequence
&repeated_scalar_container::MpMethods, // tp_as_mapping
@@ -805,7 +807,7 @@ PyTypeObject RepeatedScalarContainer_Type = {
"A Repeated scalar container", // tp_doc
0, // tp_traverse
0, // tp_clear
- repeated_scalar_container::RichCompare, // tp_richcompare
+ (richcmpfunc)repeated_scalar_container::RichCompare, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_scalar_container.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_scalar_container.h
index 559dec980b..555e621c9b 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/repeated_scalar_container.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/repeated_scalar_container.h
@@ -37,14 +37,27 @@
#include <Python.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/descriptor.h>
-#include <google/protobuf/pyext/message.h>
namespace google {
namespace protobuf {
+
+class Message;
+
+#ifdef _SHARED_PTR_H
+using std::shared_ptr;
+#else
+using internal::shared_ptr;
+#endif
+
namespace python {
+struct CMessage;
+
typedef struct RepeatedScalarContainer {
PyObject_HEAD;
@@ -52,7 +65,7 @@ typedef struct RepeatedScalarContainer {
// proto tree. Every Python RepeatedScalarContainer holds a
// reference to it in order to keep it alive as long as there's a
// Python object that references any part of the tree.
- CMessage::OwnerRef owner;
+ shared_ptr<Message> owner;
// Pointer to the C++ Message that contains this container. The
// RepeatedScalarContainer does not own this pointer.
@@ -99,7 +112,7 @@ PyObject* Extend(RepeatedScalarContainer* self, PyObject* value);
// Set the owner field of self and any children of self.
void SetOwner(RepeatedScalarContainer* self,
- const CMessage::OwnerRef& new_owner);
+ const shared_ptr<Message>& new_owner);
} // namespace repeated_scalar_container
} // namespace python
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/safe_numerics.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/safe_numerics.h
index 639ba2c8e3..639ba2c8e3 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/safe_numerics.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/safe_numerics.h
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/scoped_pyobject_ptr.h b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/scoped_pyobject_ptr.h
index a2afa7f19d..a2afa7f19d 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/scoped_pyobject_ptr.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/pyext/scoped_pyobject_ptr.h
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/python_protobuf.h b/third_party/protobuf/3.4.0/python/google/protobuf/python_protobuf.h
index beb6e4604a..beb6e4604a 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/python_protobuf.h
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/python_protobuf.h
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/reflection.py b/third_party/protobuf/3.4.0/python/google/protobuf/reflection.py
index f4ce8caf9b..f4ce8caf9b 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/reflection.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/reflection.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/service.py b/third_party/protobuf/3.4.0/python/google/protobuf/service.py
index 9e00de7042..9e00de7042 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/service.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/service.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/service_reflection.py b/third_party/protobuf/3.4.0/python/google/protobuf/service_reflection.py
index 1c3636afe0..1c3636afe0 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/service_reflection.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/service_reflection.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/symbol_database.py b/third_party/protobuf/3.4.0/python/google/protobuf/symbol_database.py
index 5ad869f49a..5ad869f49a 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/symbol_database.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/symbol_database.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/text_encoding.py b/third_party/protobuf/3.4.0/python/google/protobuf/text_encoding.py
index 9899563825..9899563825 100644
--- a/third_party/protobuf/3.6.0/python/google/protobuf/text_encoding.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/text_encoding.py
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/text_format.py b/third_party/protobuf/3.4.0/python/google/protobuf/text_format.py
index 2cbd21bc25..aaca78ad07 100644..100755
--- a/third_party/protobuf/3.6.0/python/google/protobuf/text_format.py
+++ b/third_party/protobuf/3.4.0/python/google/protobuf/text_format.py
@@ -141,11 +141,9 @@ def MessageToString(message,
as_one_line: Don't introduce newlines between fields.
pointy_brackets: If True, use angle brackets instead of curly braces for
nesting.
- use_index_order: If True, fields of a proto message will be printed using
- the order defined in source code instead of the field number, extensions
- will be printed at the end of the message and their relative order is
- determined by the extension number. By default, use the field number
- order.
+ use_index_order: If True, print fields of a proto message using the order
+ defined in source code instead of the field number. By default, use the
+ field number order.
float_format: If set, use this to specify floating point number formatting
(per the "Format Specification Mini-Language"); otherwise, str() is used.
use_field_number: If True, print field numbers instead of names.
@@ -338,12 +336,11 @@ class _Printer(object):
return
fields = message.ListFields()
if self.use_index_order:
- fields.sort(
- key=lambda x: x[0].number if x[0].is_extension else x[0].index)
+ fields.sort(key=lambda x: x[0].index)
for field, value in fields:
if _IsMapEntry(field):
for key in sorted(value):
- # This is slow for maps with submessage entries because it copies the
+ # This is slow for maps with submessage entires because it copies the
# entire tree. Unfortunately this would take significant refactoring
# of this file to work around.
#
@@ -488,10 +485,7 @@ def Parse(text,
ParseError: On text parsing problems.
"""
if not isinstance(text, str):
- if six.PY3:
- text = text.decode('utf-8')
- else:
- text = text.encode('utf-8')
+ text = text.decode('utf-8')
return ParseLines(text.split('\n'),
message,
allow_unknown_extension,
@@ -523,11 +517,6 @@ def Merge(text,
Raises:
ParseError: On text parsing problems.
"""
- if not isinstance(text, str):
- if six.PY3:
- text = text.decode('utf-8')
- else:
- text = text.encode('utf-8')
return MergeLines(
text.split('\n'),
message,
@@ -648,30 +637,6 @@ class _Parser(object):
ParseError: In case of text parsing problems.
"""
message_descriptor = message.DESCRIPTOR
- if (message_descriptor.full_name == _ANY_FULL_TYPE_NAME and
- tokenizer.TryConsume('[')):
- type_url_prefix, packed_type_name = self._ConsumeAnyTypeUrl(tokenizer)
- tokenizer.Consume(']')
- tokenizer.TryConsume(':')
- if tokenizer.TryConsume('<'):
- expanded_any_end_token = '>'
- else:
- tokenizer.Consume('{')
- expanded_any_end_token = '}'
- expanded_any_sub_message = _BuildMessageFromTypeName(packed_type_name,
- self.descriptor_pool)
- if not expanded_any_sub_message:
- raise ParseError('Type %s not found in descriptor pool' %
- packed_type_name)
- while not tokenizer.TryConsume(expanded_any_end_token):
- if tokenizer.AtEnd():
- raise tokenizer.ParseErrorPreviousToken('Expected "%s".' %
- (expanded_any_end_token,))
- self._MergeField(tokenizer, expanded_any_sub_message)
- message.Pack(expanded_any_sub_message,
- type_url_prefix=type_url_prefix)
- return
-
if tokenizer.TryConsume('['):
name = [tokenizer.ConsumeIdentifier()]
while tokenizer.TryConsume('.'):
@@ -752,12 +717,11 @@ class _Parser(object):
if (field.label == descriptor.FieldDescriptor.LABEL_REPEATED and
tokenizer.TryConsume('[')):
# Short repeated format, e.g. "foo: [1, 2, 3]"
- if not tokenizer.TryConsume(']'):
- while True:
- merger(tokenizer, message, field)
- if tokenizer.TryConsume(']'):
- break
- tokenizer.Consume(',')
+ while True:
+ merger(tokenizer, message, field)
+ if tokenizer.TryConsume(']'):
+ break
+ tokenizer.Consume(',')
else:
merger(tokenizer, message, field)
@@ -805,7 +769,33 @@ class _Parser(object):
tokenizer.Consume('{')
end_token = '}'
- if field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
+ if (field.message_type.full_name == _ANY_FULL_TYPE_NAME and
+ tokenizer.TryConsume('[')):
+ type_url_prefix, packed_type_name = self._ConsumeAnyTypeUrl(tokenizer)
+ tokenizer.Consume(']')
+ tokenizer.TryConsume(':')
+ if tokenizer.TryConsume('<'):
+ expanded_any_end_token = '>'
+ else:
+ tokenizer.Consume('{')
+ expanded_any_end_token = '}'
+ expanded_any_sub_message = _BuildMessageFromTypeName(packed_type_name,
+ self.descriptor_pool)
+ if not expanded_any_sub_message:
+ raise ParseError('Type %s not found in descriptor pool' %
+ packed_type_name)
+ while not tokenizer.TryConsume(expanded_any_end_token):
+ if tokenizer.AtEnd():
+ raise tokenizer.ParseErrorPreviousToken('Expected "%s".' %
+ (expanded_any_end_token,))
+ self._MergeField(tokenizer, expanded_any_sub_message)
+ if field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
+ any_message = getattr(message, field.name).add()
+ else:
+ any_message = getattr(message, field.name)
+ any_message.Pack(expanded_any_sub_message,
+ type_url_prefix=type_url_prefix)
+ elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
if field.is_extension:
sub_message = message.Extensions[field].add()
elif is_map_entry:
@@ -814,20 +804,8 @@ class _Parser(object):
sub_message = getattr(message, field.name).add()
else:
if field.is_extension:
- if (not self._allow_multiple_scalars and
- message.HasExtension(field)):
- raise tokenizer.ParseErrorPreviousToken(
- 'Message type "%s" should not have multiple "%s" extensions.' %
- (message.DESCRIPTOR.full_name, field.full_name))
sub_message = message.Extensions[field]
else:
- # Also apply _allow_multiple_scalars to message field.
- # TODO(jieluo): Change to _allow_singular_overwrites.
- if (not self._allow_multiple_scalars and
- message.HasField(field.name)):
- raise tokenizer.ParseErrorPreviousToken(
- 'Message type "%s" should not have multiple "%s" fields.' %
- (message.DESCRIPTOR.full_name, field.name))
sub_message = getattr(message, field.name)
sub_message.SetInParent()
@@ -952,7 +930,7 @@ def _SkipField(tokenizer):
tokenizer.ConsumeIdentifier()
tokenizer.Consume(']')
else:
- tokenizer.ConsumeIdentifierOrNumber()
+ tokenizer.ConsumeIdentifier()
_SkipFieldContents(tokenizer)
@@ -1581,11 +1559,6 @@ def ParseEnum(field, value):
(enum_descriptor.full_name, value))
else:
# Numeric value.
- if hasattr(field.file, 'syntax'):
- # Attribute is checked for compatibility.
- if field.file.syntax == 'proto3':
- # Proto3 accept numeric unknown enums.
- return number
enum_value = enum_descriptor.values_by_number.get(number, None)
if enum_value is None:
raise ValueError('Enum type "%s" has no value with number %d.' %
diff --git a/third_party/protobuf/3.6.0/python/mox.py b/third_party/protobuf/3.4.0/python/mox.py
index 43db02191f..257468e52d 100644..100755
--- a/third_party/protobuf/3.6.0/python/mox.py
+++ b/third_party/protobuf/3.4.0/python/mox.py
@@ -778,7 +778,7 @@ class Comparator:
rhs: any python object
"""
- raise NotImplementedError('method must be implemented by a subclass.')
+ raise NotImplementedError, 'method must be implemented by a subclass.'
def __eq__(self, rhs):
return self.equals(rhs)
diff --git a/third_party/protobuf/3.6.0/python/release.sh b/third_party/protobuf/3.4.0/python/release.sh
index a71cc7f52b..e7b1a4aafc 100644..100755
--- a/third_party/protobuf/3.6.0/python/release.sh
+++ b/third_party/protobuf/3.4.0/python/release.sh
@@ -19,7 +19,7 @@ function run_install_test() {
chmod +x test-venv/bin/protoc
source test-venv/bin/activate
- pip install -i ${PYPI} protobuf==${VERSION} --no-cache-dir
+ pip install -i ${PYPI} protobuf==${VERSION}
deactivate
rm -fr test-venv
}
@@ -47,7 +47,6 @@ DEV=$2
# Make sure all files are world-readable.
find python -type d -exec chmod a+r,a+x {} +
find python -type f -exec chmod a+r {} +
-umask 0022
# Check that the supplied version number matches what's inside the source code.
SOURCE_VERSION=`get_source_version`
@@ -80,17 +79,16 @@ python setup.py build
python setup.py test
# Deploy source package to testing PyPI
-python setup.py sdist upload -r https://test.pypi.org/legacy/
+python setup.py sdist upload -r https://testpypi.python.org/pypi
# Test locally with different python versions.
-run_install_test ${TESTING_VERSION} python2.7 https://test.pypi.org/simple
-run_install_test ${TESTING_VERSION} python3.4 https://test.pypi.org/simple
+run_install_test ${TESTING_VERSION} python2.7 https://testpypi.python.org/simple
+run_install_test ${TESTING_VERSION} python3.4 https://testpypi.python.org/simple
# Deploy egg/wheel packages to testing PyPI and test again.
-python setup.py bdist_egg bdist_wheel upload -r https://test.pypi.org/legacy/
-
-run_install_test ${TESTING_VERSION} python2.7 https://test.pypi.org/simple
-run_install_test ${TESTING_VERSION} python3.4 https://test.pypi.org/simple
+python setup.py bdist_egg bdist_wheel upload -r https://testpypi.python.org/pypi
+run_install_test ${TESTING_VERSION} python2.7 https://testpypi.python.org/simple
+run_install_test ${TESTING_VERSION} python3.4 https://testpypi.python.org/simple
echo "All install tests have passed using testing PyPI."
diff --git a/third_party/protobuf/3.6.0/python/release/wheel/Dockerfile b/third_party/protobuf/3.4.0/python/release/wheel/Dockerfile
index f38ec2f584..f38ec2f584 100644
--- a/third_party/protobuf/3.6.0/python/release/wheel/Dockerfile
+++ b/third_party/protobuf/3.4.0/python/release/wheel/Dockerfile
diff --git a/third_party/protobuf/3.6.0/python/release/wheel/README.md b/third_party/protobuf/3.4.0/python/release/wheel/README.md
index edda2cd701..edda2cd701 100644
--- a/third_party/protobuf/3.6.0/python/release/wheel/README.md
+++ b/third_party/protobuf/3.4.0/python/release/wheel/README.md
diff --git a/third_party/protobuf/3.6.0/python/release/wheel/build_wheel_manylinux.sh b/third_party/protobuf/3.4.0/python/release/wheel/build_wheel_manylinux.sh
index 39fd8c1273..39fd8c1273 100644..100755
--- a/third_party/protobuf/3.6.0/python/release/wheel/build_wheel_manylinux.sh
+++ b/third_party/protobuf/3.4.0/python/release/wheel/build_wheel_manylinux.sh
diff --git a/third_party/protobuf/3.6.0/python/release/wheel/protobuf_optimized_pip.sh b/third_party/protobuf/3.4.0/python/release/wheel/protobuf_optimized_pip.sh
index 98306f4c2f..469661aa89 100644..100755
--- a/third_party/protobuf/3.6.0/python/release/wheel/protobuf_optimized_pip.sh
+++ b/third_party/protobuf/3.4.0/python/release/wheel/protobuf_optimized_pip.sh
@@ -6,7 +6,7 @@ set -ex
# Print usage and fail.
function usage() {
- echo "Usage: protobuf_optimized_pip.sh PROTOBUF_VERSION" >&2
+ echo "Usage: protobuf_optimized_pip.sh PROTOBUF_VERSION PYPI_USERNAME PYPI_PASSWORD" >&2
exit 1 # Causes caller to exit because we use -e.
}
@@ -25,7 +25,7 @@ if [ $0 != ./protobuf_optimized_pip.sh ]; then
exit 1
fi
-if [ $# -lt 1 ]; then
+if [ $# -lt 3 ]; then
usage
exit 1
fi
@@ -47,9 +47,6 @@ cd $DIR/protobuf-${PROTOBUF_VERSION}
sed -i '/AC_PROG_OBJC/d' configure.ac
sed -i 's/conformance\/Makefile//g' configure.ac
-# Use the /usr/bin/autoconf and related tools to pick the correct aclocal macros
-export PATH="/usr/bin:$PATH"
-
# Build protoc
./autogen.sh
CXXFLAGS="-fPIC -g -O2" ./configure
@@ -63,4 +60,7 @@ do
build_wheel $PYTHON_VERSION
done
-/opt/python/cp27-cp27mu/bin/twine upload wheelhouse/*
+/opt/python/cp27-cp27mu/bin/twine upload wheelhouse/* <<!
+$PYPI_USERNAME
+$PYPI_PASSWORD
+!
diff --git a/third_party/protobuf/3.6.0/python/setup.cfg b/third_party/protobuf/3.4.0/python/setup.cfg
index 2a9acf13da..2a9acf13da 100644
--- a/third_party/protobuf/3.6.0/python/setup.cfg
+++ b/third_party/protobuf/3.4.0/python/setup.cfg
diff --git a/third_party/protobuf/3.6.0/python/setup.py b/third_party/protobuf/3.4.0/python/setup.py
index a9df075e7b..70b7de5c2e 100644..100755
--- a/third_party/protobuf/3.6.0/python/setup.py
+++ b/third_party/protobuf/3.4.0/python/setup.py
@@ -78,7 +78,6 @@ def generate_proto(source, require = True):
def GenerateUnittestProtos():
generate_proto("../src/google/protobuf/any_test.proto", False)
- generate_proto("../src/google/protobuf/map_proto2_unittest.proto", False)
generate_proto("../src/google/protobuf/map_unittest.proto", False)
generate_proto("../src/google/protobuf/test_messages_proto3.proto", False)
generate_proto("../src/google/protobuf/test_messages_proto2.proto", False)
@@ -107,7 +106,6 @@ def GenerateUnittestProtos():
generate_proto("google/protobuf/internal/more_extensions.proto", False)
generate_proto("google/protobuf/internal/more_extensions_dynamic.proto", False)
generate_proto("google/protobuf/internal/more_messages.proto", False)
- generate_proto("google/protobuf/internal/no_package.proto", False)
generate_proto("google/protobuf/internal/packed_field_test.proto", False)
generate_proto("google/protobuf/internal/test_bad_identifiers.proto", False)
generate_proto("google/protobuf/pyext/python.proto", False)
@@ -120,7 +118,9 @@ class clean(_clean):
for filename in filenames:
filepath = os.path.join(dirpath, filename)
if filepath.endswith("_pb2.py") or filepath.endswith(".pyc") or \
- filepath.endswith(".so") or filepath.endswith(".o"):
+ filepath.endswith(".so") or filepath.endswith(".o") or \
+ filepath.endswith('google/protobuf/compiler/__init__.py') or \
+ filepath.endswith('google/protobuf/util/__init__.py'):
os.remove(filepath)
# _clean is an old-style class, so super() doesn't work.
_clean.run(self)
@@ -142,6 +142,12 @@ class build_py(_build_py):
generate_proto("../src/google/protobuf/wrappers.proto")
GenerateUnittestProtos()
+ # Make sure google.protobuf/** are valid packages.
+ for path in ['', 'internal/', 'compiler/', 'pyext/', 'util/']:
+ try:
+ open('google/protobuf/%s__init__.py' % path, 'a').close()
+ except EnvironmentError:
+ pass
# _build_py is an old-style class, so super() doesn't work.
_build_py.run(self)
@@ -171,6 +177,9 @@ if __name__ == '__main__':
# extension. Note that those libraries have to be compiled with
# -fPIC for this to work.
compile_static_ext = get_option_from_sys_argv('--compile_static_extension')
+ extra_compile_args = ['-Wno-write-strings',
+ '-Wno-invalid-offsetof',
+ '-Wno-sign-compare']
libraries = ['protobuf']
extra_objects = None
if compile_static_ext:
@@ -179,33 +188,14 @@ if __name__ == '__main__':
'../src/.libs/libprotobuf-lite.a']
test_conformance.target = 'test_python_cpp'
- extra_compile_args = []
-
- if sys.platform != 'win32':
- extra_compile_args.append('-Wno-write-strings')
- extra_compile_args.append('-Wno-invalid-offsetof')
- extra_compile_args.append('-Wno-sign-compare')
-
- # https://github.com/Theano/Theano/issues/4926
- if sys.platform == 'win32':
- extra_compile_args.append('-D_hypot=hypot')
-
- # https://github.com/tpaviot/pythonocc-core/issues/48
- if sys.platform == 'win32' and '64 bit' in sys.version:
- extra_compile_args.append('-DMS_WIN64')
-
- # MSVS default is dymanic
- if (sys.platform == 'win32'):
- extra_compile_args.append('/MT')
-
if "clang" in os.popen('$CC --version 2> /dev/null').read():
extra_compile_args.append('-Wno-shorten-64-to-32')
v, _, _ = platform.mac_ver()
if v:
- extra_compile_args.append('-std=c++11')
- elif os.getenv('KOKORO_BUILD_NUMBER') or os.getenv('KOKORO_BUILD_ID'):
- extra_compile_args.append('-std=c++11')
+ v = float('.'.join(v.split('.')[:2]))
+ if v >= 10.12:
+ extra_compile_args.append('-std=c++11')
if warnings_as_errors in sys.argv:
extra_compile_args.append('-Werror')
@@ -225,7 +215,7 @@ if __name__ == '__main__':
Extension(
"google.protobuf.internal._api_implementation",
glob.glob('google/protobuf/internal/api_implementation.cc'),
- extra_compile_args=extra_compile_args + ['-DPYTHON_PROTO2_CPP_IMPL_V2'],
+ extra_compile_args=['-DPYTHON_PROTO2_CPP_IMPL_V2'],
),
])
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
@@ -249,6 +239,7 @@ if __name__ == '__main__':
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 2",
+ "Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
diff --git a/third_party/protobuf/3.6.0/python/stubout.py b/third_party/protobuf/3.4.0/python/stubout.py
index aee4f2da20..aee4f2da20 100644..100755
--- a/third_party/protobuf/3.6.0/python/stubout.py
+++ b/third_party/protobuf/3.4.0/python/stubout.py
diff --git a/third_party/protobuf/3.6.0/python/tox.ini b/third_party/protobuf/3.4.0/python/tox.ini
index 38a81b4fea..baa96dba0b 100644
--- a/third_party/protobuf/3.6.0/python/tox.ini
+++ b/third_party/protobuf/3.4.0/python/tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
- py{27,33,34,35,36}-{cpp,python}
+ py{26,27,33,34}-{cpp,python}
[testenv]
usedevelop=true
diff --git a/third_party/protobuf/3.6.0/ruby/.gitignore b/third_party/protobuf/3.4.0/ruby/.gitignore
index bd8745dd85..bd8745dd85 100644
--- a/third_party/protobuf/3.6.0/ruby/.gitignore
+++ b/third_party/protobuf/3.4.0/ruby/.gitignore
diff --git a/third_party/protobuf/3.6.0/ruby/Gemfile b/third_party/protobuf/3.4.0/ruby/Gemfile
index fa75df1563..fa75df1563 100644
--- a/third_party/protobuf/3.6.0/ruby/Gemfile
+++ b/third_party/protobuf/3.4.0/ruby/Gemfile
diff --git a/third_party/protobuf/3.6.0/ruby/README.md b/third_party/protobuf/3.4.0/ruby/README.md
index 78e86015d7..f28e05a72b 100644
--- a/third_party/protobuf/3.6.0/ruby/README.md
+++ b/third_party/protobuf/3.4.0/ruby/README.md
@@ -16,6 +16,10 @@ 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/third_party/protobuf/3.6.0/ruby/Rakefile b/third_party/protobuf/3.4.0/ruby/Rakefile
index 013bc99a40..a329a777b4 100644
--- a/third_party/protobuf/3.6.0/ruby/Rakefile
+++ b/third_party/protobuf/3.4.0/ruby/Rakefile
@@ -52,12 +52,6 @@ if RUBY_PLATFORM == "java"
end
else
Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
- unless RUBY_PLATFORM =~ /darwin/
- # TODO: also set "no_native to true" for mac if possible. As is,
- # "no_native" can only be set if the RUBY_PLATFORM doing
- # cross-compilation is contained in the "ext.cross_platform" array.
- ext.no_native = true
- end
ext.ext_dir = "ext/google/protobuf_c"
ext.lib_dir = "lib/google"
ext.cross_compile = true
@@ -70,13 +64,13 @@ else
task 'gem:windows' do
require 'rake_compiler_dock'
- RakeCompilerDock.sh "bundle && IN_DOCKER=true rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0"
+ RakeCompilerDock.sh "bundle && IN_DOCKER=true rake cross native gem RUBY_CC_VERSION=2.4.0:2.3.0:2.2.2:2.1.5:2.0.0"
end
if RUBY_PLATFORM =~ /darwin/
task 'gem:native' do
system "rake genproto"
- system "rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0"
+ system "rake cross native gem RUBY_CC_VERSION=2.4.0:2.3.0:2.2.2:2.1.5:2.0.0"
end
else
task 'gem:native' => [:genproto, 'gem:windows']
@@ -87,7 +81,6 @@ end
# Proto for tests.
genproto_output << "tests/generated_code.rb"
genproto_output << "tests/test_import.rb"
-genproto_output << "tests/test_ruby_package.rb"
file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/generated_code.proto"
end
@@ -96,10 +89,6 @@ file "tests/test_import.rb" => "tests/test_import.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/test_import.proto"
end
-file "tests/test_ruby_package.rb" => "tests/test_ruby_package.proto" do |file_task|
- sh "../src/protoc --ruby_out=. tests/test_ruby_package.proto"
-end
-
task :genproto => genproto_output
task :clean do
@@ -110,13 +99,7 @@ Gem::PackageTask.new(spec) do |pkg|
end
Rake::TestTask.new(:test => :build) do |t|
- t.test_files = FileList["tests/*.rb"].exclude("tests/gc_test.rb")
-end
-
-# gc_test needs to be split out to ensure the generated file hasn't been
-# imported by other tests.
-Rake::TestTask.new(:gc_test => :build) do |t|
- t.test_files = FileList["tests/gc_test.rb"]
+ t.test_files = FileList["tests/*.rb"]
end
task :build => [:clean, :compile, :genproto]
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/README.md b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/README.md
index eb341228cf..eb341228cf 100644
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/README.md
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/README.md
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/Rakefile b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/Rakefile
index 19a4ba1280..19a4ba1280 100644
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/Rakefile
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/Rakefile
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/test.sh b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/test.sh
index 996dc020c2..996dc020c2 100644..100755
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/test.sh
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/test.sh
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/basic.rb b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/basic.rb
index 05fe0278b1..f81e456c3f 100644
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/basic.rb
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/basic.rb
@@ -600,7 +600,7 @@ module BasicTest
assert_raise RangeError do
m["z"] = :Z
end
- assert_raise RangeError do
+ assert_raise TypeError do
m["z"] = "z"
end
end
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/generated_code.proto b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/generated_code.proto
index 62fd83ed89..62fd83ed89 100644
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/generated_code.proto
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/generated_code.proto
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb
index b92b0462d1..b92b0462d1 100644
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb
index 25727b7b28..25727b7b28 100644
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/stress.rb b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/stress.rb
index 082d5e22df..082d5e22df 100644
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/stress.rb
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/stress.rb
diff --git a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/test_import.proto b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/test_import.proto
index 230484ee57..230484ee57 100644
--- a/third_party/protobuf/3.6.0/ruby/compatibility_tests/v3.0.0/tests/test_import.proto
+++ b/third_party/protobuf/3.4.0/ruby/compatibility_tests/v3.0.0/tests/test_import.proto
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/defs.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/defs.c
index d9d2ebac2d..845c02257f 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/defs.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/defs.c
@@ -76,7 +76,7 @@ static upb_enumdef* check_enum_notfrozen(const upb_enumdef* def) {
// -----------------------------------------------------------------------------
#define DEFINE_CLASS(name, string_name) \
- VALUE c ## name = Qnil; \
+ VALUE c ## name; \
const rb_data_type_t _ ## name ## _type = { \
string_name, \
{ name ## _mark, name ## _free, NULL }, \
@@ -126,11 +126,11 @@ void DescriptorPool_register(VALUE module) {
rb_define_method(klass, "lookup", DescriptorPool_lookup, 1);
rb_define_singleton_method(klass, "generated_pool",
DescriptorPool_generated_pool, 0);
- rb_gc_register_address(&cDescriptorPool);
cDescriptorPool = klass;
+ rb_gc_register_address(&cDescriptorPool);
- rb_gc_register_address(&generated_pool);
generated_pool = rb_class_new_instance(0, NULL, klass);
+ rb_gc_register_address(&generated_pool);
}
static void add_descriptor_to_pool(DescriptorPool* self,
@@ -228,6 +228,7 @@ DEFINE_CLASS(Descriptor, "Google::Protobuf::Descriptor");
void Descriptor_mark(void* _self) {
Descriptor* self = _self;
rb_gc_mark(self->klass);
+ rb_gc_mark(self->typeclass_references);
}
void Descriptor_free(void* _self) {
@@ -282,6 +283,7 @@ VALUE Descriptor_alloc(VALUE klass) {
self->pb_serialize_handlers = NULL;
self->json_serialize_handlers = NULL;
self->json_serialize_handlers_preserve = NULL;
+ self->typeclass_references = rb_ary_new();
return ret;
}
@@ -299,8 +301,8 @@ void Descriptor_register(VALUE module) {
rb_define_method(klass, "name", Descriptor_name, 0);
rb_define_method(klass, "name=", Descriptor_name_set, 1);
rb_include_module(klass, rb_mEnumerable);
- rb_gc_register_address(&cDescriptor);
cDescriptor = klass;
+ rb_gc_register_address(&cDescriptor);
}
/*
@@ -518,8 +520,8 @@ void FieldDescriptor_register(VALUE module) {
rb_define_method(klass, "subtype", FieldDescriptor_subtype, 0);
rb_define_method(klass, "get", FieldDescriptor_get, 1);
rb_define_method(klass, "set", FieldDescriptor_set, 2);
- rb_gc_register_address(&cFieldDescriptor);
cFieldDescriptor = klass;
+ rb_gc_register_address(&cFieldDescriptor);
}
/*
@@ -916,8 +918,8 @@ void OneofDescriptor_register(VALUE module) {
rb_define_method(klass, "add_field", OneofDescriptor_add_field, 1);
rb_define_method(klass, "each", OneofDescriptor_each, 0);
rb_include_module(klass, rb_mEnumerable);
- rb_gc_register_address(&cOneofDescriptor);
cOneofDescriptor = klass;
+ rb_gc_register_address(&cOneofDescriptor);
}
/*
@@ -1037,8 +1039,8 @@ void EnumDescriptor_register(VALUE module) {
rb_define_method(klass, "each", EnumDescriptor_each, 0);
rb_define_method(klass, "enummodule", EnumDescriptor_enummodule, 0);
rb_include_module(klass, rb_mEnumerable);
- rb_gc_register_address(&cEnumDescriptor);
cEnumDescriptor = klass;
+ rb_gc_register_address(&cEnumDescriptor);
}
/*
@@ -1202,8 +1204,8 @@ void MessageBuilderContext_register(VALUE module) {
rb_define_method(klass, "repeated", MessageBuilderContext_repeated, -1);
rb_define_method(klass, "map", MessageBuilderContext_map, -1);
rb_define_method(klass, "oneof", MessageBuilderContext_oneof, 1);
- rb_gc_register_address(&cMessageBuilderContext);
cMessageBuilderContext = klass;
+ rb_gc_register_address(&cMessageBuilderContext);
}
/*
@@ -1491,8 +1493,8 @@ void OneofBuilderContext_register(VALUE module) {
rb_define_method(klass, "initialize",
OneofBuilderContext_initialize, 2);
rb_define_method(klass, "optional", OneofBuilderContext_optional, -1);
- rb_gc_register_address(&cOneofBuilderContext);
cOneofBuilderContext = klass;
+ rb_gc_register_address(&cOneofBuilderContext);
}
/*
@@ -1569,8 +1571,8 @@ void EnumBuilderContext_register(VALUE module) {
rb_define_method(klass, "initialize",
EnumBuilderContext_initialize, 1);
rb_define_method(klass, "value", EnumBuilderContext_value, 2);
- rb_gc_register_address(&cEnumBuilderContext);
cEnumBuilderContext = klass;
+ rb_gc_register_address(&cEnumBuilderContext);
}
/*
@@ -1633,7 +1635,7 @@ VALUE Builder_alloc(VALUE klass) {
Builder* self = ALLOC(Builder);
VALUE ret = TypedData_Wrap_Struct(
klass, &_Builder_type, self);
- self->pending_list = Qnil;
+ self->pending_list = rb_ary_new();
self->defs = NULL;
return ret;
}
@@ -1643,22 +1645,9 @@ void Builder_register(VALUE module) {
rb_define_alloc_func(klass, Builder_alloc);
rb_define_method(klass, "add_message", Builder_add_message, 1);
rb_define_method(klass, "add_enum", Builder_add_enum, 1);
- rb_define_method(klass, "initialize", Builder_initialize, 0);
rb_define_method(klass, "finalize_to_pool", Builder_finalize_to_pool, 1);
- rb_gc_register_address(&cBuilder);
cBuilder = klass;
-}
-
-/*
- * call-seq:
- * Builder.new(d) => builder
- *
- * Create a new message builder.
- */
-VALUE Builder_initialize(VALUE _self) {
- DEFINE_SELF(Builder, self, _self);
- self->pending_list = rb_ary_new();
- return Qnil;
+ rb_gc_register_address(&cBuilder);
}
/*
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/encode_decode.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/encode_decode.c
index 12080d034a..6ce6d0837e 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/encode_decode.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/encode_decode.c
@@ -44,56 +44,6 @@ VALUE noleak_rb_str_cat(VALUE rb_str, const char *str, long len) {
return rb_str;
}
-// The code below also comes from upb's prototype Ruby binding, developed by
-// haberman@.
-
-/* stringsink *****************************************************************/
-
-static void *stringsink_start(void *_sink, const void *hd, size_t size_hint) {
- stringsink *sink = _sink;
- sink->len = 0;
- return sink;
-}
-
-static size_t stringsink_string(void *_sink, const void *hd, const char *ptr,
- size_t len, const upb_bufhandle *handle) {
- stringsink *sink = _sink;
- size_t new_size = sink->size;
-
- UPB_UNUSED(hd);
- UPB_UNUSED(handle);
-
- while (sink->len + len > new_size) {
- new_size *= 2;
- }
-
- if (new_size != sink->size) {
- sink->ptr = realloc(sink->ptr, new_size);
- sink->size = new_size;
- }
-
- memcpy(sink->ptr + sink->len, ptr, len);
- sink->len += len;
-
- return len;
-}
-
-void stringsink_init(stringsink *sink) {
- upb_byteshandler_init(&sink->handler);
- upb_byteshandler_setstartstr(&sink->handler, stringsink_start, NULL);
- upb_byteshandler_setstring(&sink->handler, stringsink_string, NULL);
-
- upb_bytessink_reset(&sink->sink, &sink->handler, sink);
-
- sink->size = 32;
- sink->ptr = malloc(sink->size);
- sink->len = 0;
-}
-
-void stringsink_uninit(stringsink *sink) {
- free(sink->ptr);
-}
-
// -----------------------------------------------------------------------------
// Parsing.
// -----------------------------------------------------------------------------
@@ -330,6 +280,11 @@ rb_data_type_t MapParseFrame_type = {
{ MapParseFrame_mark, MapParseFrame_free, NULL },
};
+// Array of Ruby objects wrapping map_parse_frame_t.
+// We don't allow multiple concurrent decodes, so we assume that this global
+// variable is specific to the "current" decode.
+VALUE map_parse_frames;
+
static map_parse_frame_t* map_push_frame(VALUE map,
const map_handlerdata_t* handlerdata) {
map_parse_frame_t* frame = ALLOC(map_parse_frame_t);
@@ -338,12 +293,16 @@ static map_parse_frame_t* map_push_frame(VALUE map,
native_slot_init(handlerdata->key_field_type, &frame->key_storage);
native_slot_init(handlerdata->value_field_type, &frame->value_storage);
- Map_set_frame(map,
+ rb_ary_push(map_parse_frames,
TypedData_Wrap_Struct(rb_cObject, &MapParseFrame_type, frame));
return frame;
}
+static void map_pop_frame() {
+ rb_ary_pop(map_parse_frames);
+}
+
// Handler to begin a map entry: allocates a temporary frame. This is the
// 'startsubmsg' handler on the msgdef that contains the map field.
static void *startmapentry_handler(void *closure, const void *hd) {
@@ -377,7 +336,7 @@ static bool endmap_handler(void *closure, const void *hd, upb_status* s) {
&frame->value_storage);
Map_index_set(frame->map, key, value);
- Map_set_frame(frame->map, Qnil);
+ map_pop_frame();
return true;
}
@@ -663,20 +622,6 @@ static void add_handlers_for_oneof_field(upb_handlers *h,
upb_handlerattr_uninit(&attr);
}
-static bool unknown_field_handler(void* closure, const void* hd,
- const char* buf, size_t size) {
- UPB_UNUSED(hd);
-
- MessageHeader* msg = (MessageHeader*)closure;
- if (msg->unknown_fields == NULL) {
- msg->unknown_fields = malloc(sizeof(stringsink));
- stringsink_init(msg->unknown_fields);
- }
-
- stringsink_string(msg->unknown_fields, NULL, buf, size, NULL);
-
- return true;
-}
static void add_handlers_for_message(const void *closure, upb_handlers *h) {
const upb_msgdef* msgdef = upb_handlers_msgdef(h);
@@ -698,9 +643,6 @@ static void add_handlers_for_message(const void *closure, upb_handlers *h) {
desc->layout = create_layout(desc->msgdef);
}
- upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER;
- upb_handlers_setunknown(h, unknown_field_handler, &attr);
-
for (upb_msg_field_begin(&i, desc->msgdef);
!upb_msg_field_done(&i);
upb_msg_field_next(&i)) {
@@ -833,6 +775,10 @@ VALUE Message_decode(VALUE klass, VALUE data) {
msg_rb = rb_class_new_instance(0, NULL, msgklass);
TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
+ // We generally expect this to be clear already, but clear it in case parsing
+ // previously got interrupted somehow.
+ rb_ary_clear(map_parse_frames);
+
{
const upb_pbdecodermethod* method = msgdef_decodermethod(desc);
const upb_handlers* h = upb_pbdecodermethod_desthandlers(method);
@@ -877,6 +823,10 @@ VALUE Message_decode_json(VALUE klass, VALUE data) {
msg_rb = rb_class_new_instance(0, NULL, msgklass);
TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
+ // We generally expect this to be clear already, but clear it in case parsing
+ // previously got interrupted somehow.
+ rb_ary_clear(map_parse_frames);
+
{
const upb_json_parsermethod* method = msgdef_jsonparsermethod(desc);
stackenv se;
@@ -898,6 +848,65 @@ VALUE Message_decode_json(VALUE klass, VALUE data) {
// -----------------------------------------------------------------------------
// Serializing.
// -----------------------------------------------------------------------------
+//
+// The code below also comes from upb's prototype Ruby binding, developed by
+// haberman@.
+
+/* stringsink *****************************************************************/
+
+// This should probably be factored into a common upb component.
+
+typedef struct {
+ upb_byteshandler handler;
+ upb_bytessink sink;
+ char *ptr;
+ size_t len, size;
+} stringsink;
+
+static void *stringsink_start(void *_sink, const void *hd, size_t size_hint) {
+ stringsink *sink = _sink;
+ sink->len = 0;
+ return sink;
+}
+
+static size_t stringsink_string(void *_sink, const void *hd, const char *ptr,
+ size_t len, const upb_bufhandle *handle) {
+ stringsink *sink = _sink;
+ size_t new_size = sink->size;
+
+ UPB_UNUSED(hd);
+ UPB_UNUSED(handle);
+
+ while (sink->len + len > new_size) {
+ new_size *= 2;
+ }
+
+ if (new_size != sink->size) {
+ sink->ptr = realloc(sink->ptr, new_size);
+ sink->size = new_size;
+ }
+
+ memcpy(sink->ptr + sink->len, ptr, len);
+ sink->len += len;
+
+ return len;
+}
+
+void stringsink_init(stringsink *sink) {
+ upb_byteshandler_init(&sink->handler);
+ upb_byteshandler_setstartstr(&sink->handler, stringsink_start, NULL);
+ upb_byteshandler_setstring(&sink->handler, stringsink_string, NULL);
+
+ upb_bytessink_reset(&sink->sink, &sink->handler, sink);
+
+ sink->size = 32;
+ sink->ptr = malloc(sink->size);
+ sink->len = 0;
+}
+
+void stringsink_uninit(stringsink *sink) {
+ free(sink->ptr);
+}
/* msgvisitor *****************************************************************/
@@ -1179,11 +1188,6 @@ static void putmsg(VALUE msg_rb, const Descriptor* desc,
}
}
- stringsink* unknown = msg->unknown_fields;
- if (unknown != NULL) {
- upb_sink_putunknown(sink, unknown->ptr, unknown->len);
- }
-
upb_sink_endmsg(sink, &status);
}
@@ -1305,91 +1309,3 @@ VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass) {
}
}
-static void discard_unknown(VALUE msg_rb, const Descriptor* desc) {
- MessageHeader* msg;
- upb_msg_field_iter it;
-
- TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
-
- stringsink* unknown = msg->unknown_fields;
- if (unknown != NULL) {
- stringsink_uninit(unknown);
- msg->unknown_fields = NULL;
- }
-
- for (upb_msg_field_begin(&it, desc->msgdef);
- !upb_msg_field_done(&it);
- upb_msg_field_next(&it)) {
- upb_fielddef *f = upb_msg_iter_field(&it);
- uint32_t offset =
- desc->layout->fields[upb_fielddef_index(f)].offset +
- sizeof(MessageHeader);
-
- if (upb_fielddef_containingoneof(f)) {
- uint32_t oneof_case_offset =
- desc->layout->fields[upb_fielddef_index(f)].case_offset +
- sizeof(MessageHeader);
- // For a oneof, check that this field is actually present -- skip all the
- // below if not.
- if (DEREF(msg, oneof_case_offset, uint32_t) !=
- upb_fielddef_number(f)) {
- continue;
- }
- // Otherwise, fall through to the appropriate singular-field handler
- // below.
- }
-
- if (!upb_fielddef_issubmsg(f)) {
- continue;
- }
-
- if (is_map_field(f)) {
- if (!upb_fielddef_issubmsg(map_field_value(f))) continue;
- VALUE map = DEREF(msg, offset, VALUE);
- if (map == Qnil) continue;
- Map_iter map_it;
- for (Map_begin(map, &map_it); !Map_done(&map_it); Map_next(&map_it)) {
- VALUE submsg = Map_iter_value(&map_it);
- VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned);
- const Descriptor* subdesc = ruby_to_Descriptor(descriptor);
- discard_unknown(submsg, subdesc);
- }
- } else if (upb_fielddef_isseq(f)) {
- VALUE ary = DEREF(msg, offset, VALUE);
- if (ary == Qnil) continue;
- int size = NUM2INT(RepeatedField_length(ary));
- for (int i = 0; i < size; i++) {
- void* memory = RepeatedField_index_native(ary, i);
- VALUE submsg = *((VALUE *)memory);
- VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned);
- const Descriptor* subdesc = ruby_to_Descriptor(descriptor);
- discard_unknown(submsg, subdesc);
- }
- } else {
- VALUE submsg = DEREF(msg, offset, VALUE);
- if (submsg == Qnil) continue;
- VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned);
- const Descriptor* subdesc = ruby_to_Descriptor(descriptor);
- discard_unknown(submsg, subdesc);
- }
- }
-}
-
-/*
- * call-seq:
- * Google::Protobuf.discard_unknown(msg)
- *
- * Discard unknown fields in the given message object and recursively discard
- * unknown fields in submessages.
- */
-VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb) {
- VALUE klass = CLASS_OF(msg_rb);
- VALUE descriptor = rb_ivar_get(klass, descriptor_instancevar_interned);
- Descriptor* desc = ruby_to_Descriptor(descriptor);
- if (klass == cRepeatedField || klass == cMap) {
- rb_raise(rb_eArgError, "Expected proto msg for discard unknown.");
- } else {
- discard_unknown(msg_rb, desc);
- }
- return Qnil;
-}
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/extconf.rb b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/extconf.rb
index 0886e60708..0886e60708 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/extconf.rb
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/extconf.rb
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/map.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/map.c
index 8c2f6424c3..4be54c39d1 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/map.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/map.c
@@ -146,7 +146,6 @@ void Map_mark(void* _self) {
Map* self = _self;
rb_gc_mark(self->value_type_class);
- rb_gc_mark(self->parse_frame);
if (self->value_type == UPB_TYPE_STRING ||
self->value_type == UPB_TYPE_BYTES ||
@@ -175,12 +174,6 @@ VALUE Map_alloc(VALUE klass) {
return TypedData_Wrap_Struct(klass, &Map_type, self);
}
-VALUE Map_set_frame(VALUE map, VALUE val) {
- Map* self = ruby_to_Map(map);
- self->parse_frame = val;
- return val;
-}
-
static bool needs_typeclass(upb_fieldtype_t type) {
switch (type) {
case UPB_TYPE_MESSAGE:
@@ -234,7 +227,6 @@ VALUE Map_init(int argc, VALUE* argv, VALUE _self) {
self->key_type = ruby_to_fieldtype(argv[0]);
self->value_type = ruby_to_fieldtype(argv[1]);
- self->parse_frame = Qnil;
// Check that the key type is an allowed type.
switch (self->key_type) {
@@ -825,8 +817,8 @@ VALUE Map_iter_value(Map_iter* iter) {
void Map_register(VALUE module) {
VALUE klass = rb_define_class_under(module, "Map", rb_cObject);
rb_define_alloc_func(klass, Map_alloc);
- rb_gc_register_address(&cMap);
cMap = klass;
+ rb_gc_register_address(&cMap);
rb_define_method(klass, "initialize", Map_init, -1);
rb_define_method(klass, "each", Map_each, 0);
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/message.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/message.c
index 63a61baffe..299111404d 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/message.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/message.c
@@ -44,11 +44,6 @@ void Message_mark(void* _self) {
}
void Message_free(void* self) {
- stringsink* unknown = ((MessageHeader *)self)->unknown_fields;
- if (unknown != NULL) {
- stringsink_uninit(unknown);
- free(unknown);
- }
xfree(self);
}
@@ -72,8 +67,6 @@ VALUE Message_alloc(VALUE klass) {
msg->descriptor = desc;
rb_ivar_set(ret, descriptor_instancevar_interned, descriptor);
- msg->unknown_fields = NULL;
-
layout_init(desc->layout, Message_data(msg));
return ret;
@@ -224,32 +217,20 @@ VALUE Message_respond_to_missing(int argc, VALUE* argv, VALUE _self) {
return Qtrue;
}
-VALUE create_submsg_from_hash(const upb_fielddef *f, VALUE hash) {
- const upb_def *d = upb_fielddef_subdef(f);
- assert(d != NULL);
-
- VALUE descriptor = get_def_obj(d);
- VALUE msgclass = rb_funcall(descriptor, rb_intern("msgclass"), 0, NULL);
-
- VALUE args[1] = { hash };
- return rb_class_new_instance(1, args, msgclass);
-}
-
int Message_initialize_kwarg(VALUE key, VALUE val, VALUE _self) {
MessageHeader* self;
- char *name;
+ VALUE method_str;
+ char* name;
const upb_fielddef* f;
TypedData_Get_Struct(_self, MessageHeader, &Message_type, self);
- if (TYPE(key) == T_STRING) {
- name = RSTRING_PTR(key);
- } else if (TYPE(key) == T_SYMBOL) {
- name = RSTRING_PTR(rb_id2str(SYM2ID(key)));
- } else {
+ if (!SYMBOL_P(key)) {
rb_raise(rb_eArgError,
- "Expected string or symbols as hash keys when initializing proto from hash.");
+ "Expected symbols as hash keys in initialization map.");
}
+ method_str = rb_id2str(SYM2ID(key));
+ name = RSTRING_PTR(method_str);
f = upb_msgdef_ntofz(self->descriptor->msgdef, name);
if (f == NULL) {
rb_raise(rb_eArgError,
@@ -274,18 +255,9 @@ int Message_initialize_kwarg(VALUE key, VALUE val, VALUE _self) {
}
ary = layout_get(self->descriptor->layout, Message_data(self), f);
for (int i = 0; i < RARRAY_LEN(val); i++) {
- VALUE entry = rb_ary_entry(val, i);
- if (TYPE(entry) == T_HASH && upb_fielddef_issubmsg(f)) {
- entry = create_submsg_from_hash(f, entry);
- }
-
- RepeatedField_push(ary, entry);
+ RepeatedField_push(ary, rb_ary_entry(val, i));
}
} else {
- if (TYPE(val) == T_HASH && upb_fielddef_issubmsg(f)) {
- val = create_submsg_from_hash(f, val);
- }
-
layout_set(self->descriptor->layout, Message_data(self), f, val);
}
return 0;
@@ -447,13 +419,6 @@ VALUE Message_to_h(VALUE _self) {
msg_value = Map_to_h(msg_value);
} else if (upb_fielddef_label(field) == UPB_LABEL_REPEATED) {
msg_value = RepeatedField_to_ary(msg_value);
-
- if (upb_fielddef_type(field) == UPB_TYPE_MESSAGE) {
- for (int i = 0; i < RARRAY_LEN(msg_value); i++) {
- VALUE elem = rb_ary_entry(msg_value, i);
- rb_ary_store(msg_value, i, Message_to_h(elem));
- }
- }
} else if (msg_value != Qnil &&
upb_fielddef_type(field) == UPB_TYPE_MESSAGE) {
msg_value = Message_to_h(msg_value);
@@ -540,9 +505,9 @@ VALUE build_class_from_descriptor(Descriptor* desc) {
get_def_obj(desc->msgdef));
rb_define_alloc_func(klass, Message_alloc);
rb_require("google/protobuf/message_exts");
- rb_include_module(klass, rb_eval_string("::Google::Protobuf::MessageExts"));
+ rb_include_module(klass, rb_eval_string("Google::Protobuf::MessageExts"));
rb_extend_object(
- klass, rb_eval_string("::Google::Protobuf::MessageExts::ClassMethods"));
+ klass, rb_eval_string("Google::Protobuf::MessageExts::ClassMethods"));
rb_define_method(klass, "method_missing",
Message_method_missing, -1);
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/protobuf.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/protobuf.c
index db69642692..9896366760 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/protobuf.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/protobuf.c
@@ -103,8 +103,6 @@ void Init_protobuf_c() {
cError = rb_const_get(protobuf, rb_intern("Error"));
cParseError = rb_const_get(protobuf, rb_intern("ParseError"));
- rb_define_singleton_method(protobuf, "discard_unknown",
- Google_Protobuf_discard_unknown, 1);
rb_define_singleton_method(protobuf, "deep_copy",
Google_Protobuf_deep_copy, 1);
@@ -112,6 +110,8 @@ void Init_protobuf_c() {
kRubyStringASCIIEncoding = rb_usascii_encoding();
kRubyString8bitEncoding = rb_ascii8bit_encoding();
- rb_gc_register_address(&upb_def_to_ruby_obj_map);
upb_def_to_ruby_obj_map = rb_hash_new();
+ rb_gc_register_address(&upb_def_to_ruby_obj_map);
+ map_parse_frames = rb_ary_new();
+ rb_gc_register_address(&map_parse_frames);
}
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/protobuf.h b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/protobuf.h
index 5266aa8d22..520e9d9b84 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/protobuf.h
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/protobuf.h
@@ -116,6 +116,10 @@ struct Descriptor {
const upb_handlers* pb_serialize_handlers;
const upb_handlers* json_serialize_handlers;
const upb_handlers* json_serialize_handlers_preserve;
+ // Handlers hold type class references for sub-message fields directly in some
+ // cases. We need to keep these rooted because they might otherwise be
+ // collected.
+ VALUE typeclass_references;
};
struct FieldDescriptor {
@@ -162,6 +166,8 @@ extern VALUE cBuilder;
extern VALUE cError;
extern VALUE cParseError;
+extern VALUE map_parse_frames;
+
// We forward-declare all of the Ruby method implementations here because we
// sometimes call the methods directly across .c files, rather than going
// through Ruby's method dispatching (e.g. during message parse). It's cleaner
@@ -276,7 +282,6 @@ void Builder_free(void* _self);
VALUE Builder_alloc(VALUE klass);
void Builder_register(VALUE module);
Builder* ruby_to_Builder(VALUE value);
-VALUE Builder_initialize(VALUE _self);
VALUE Builder_add_message(VALUE _self, VALUE name);
VALUE Builder_add_enum(VALUE _self, VALUE name);
VALUE Builder_finalize_to_pool(VALUE _self, VALUE pool_rb);
@@ -392,7 +397,6 @@ typedef struct {
upb_fieldtype_t key_type;
upb_fieldtype_t value_type;
VALUE value_type_class;
- VALUE parse_frame;
upb_strtable table;
} Map;
@@ -401,7 +405,6 @@ void Map_free(void* self);
VALUE Map_alloc(VALUE klass);
VALUE Map_init(int argc, VALUE* argv, VALUE self);
void Map_register(VALUE module);
-VALUE Map_set_frame(VALUE self, VALUE val);
extern const rb_data_type_t Map_type;
extern VALUE cMap;
@@ -475,20 +478,8 @@ VALUE layout_inspect(MessageLayout* layout, void* storage);
// Message class creation.
// -----------------------------------------------------------------------------
-// This should probably be factored into a common upb component.
-
-typedef struct {
- upb_byteshandler handler;
- upb_bytessink sink;
- char *ptr;
- size_t len, size;
-} stringsink;
-
-void stringsink_uninit(stringsink *sink);
-
struct MessageHeader {
- Descriptor* descriptor; // kept alive by self.class.descriptor reference.
- stringsink* unknown_fields; // store unknown fields in decoding.
+ Descriptor* descriptor; // kept alive by self.class.descriptor reference.
// Data comes after this.
};
@@ -515,7 +506,6 @@ VALUE Message_encode(VALUE klass, VALUE msg_rb);
VALUE Message_decode_json(VALUE klass, VALUE data);
VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass);
-VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb);
VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj);
VALUE build_module_from_enumdesc(EnumDescriptor* enumdef);
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/repeated_field.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/repeated_field.c
index c6620ee611..1c651c192d 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/repeated_field.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/repeated_field.c
@@ -626,8 +626,8 @@ void RepeatedField_register(VALUE module) {
VALUE klass = rb_define_class_under(
module, "RepeatedField", rb_cObject);
rb_define_alloc_func(klass, RepeatedField_alloc);
- rb_gc_register_address(&cRepeatedField);
cRepeatedField = klass;
+ rb_gc_register_address(&cRepeatedField);
rb_define_method(klass, "initialize",
RepeatedField_init, -1);
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/storage.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/storage.c
index 1437c0b52a..3ff2bda6bb 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/storage.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/storage.c
@@ -176,15 +176,6 @@ void native_slot_set_value_and_case(upb_fieldtype_t type, VALUE type_class,
break;
}
case UPB_TYPE_STRING:
- if (CLASS_OF(value) == rb_cSymbol) {
- value = rb_funcall(value, rb_intern("to_s"), 0, NULL);
- } else if (CLASS_OF(value) != rb_cString) {
- rb_raise(rb_eTypeError, "Invalid argument for string field.");
- }
-
- DEREF(memory, VALUE) = native_slot_encode_and_freeze_string(type, value);
- break;
-
case UPB_TYPE_BYTES: {
if (CLASS_OF(value) != rb_cString) {
rb_raise(rb_eTypeError, "Invalid argument for string field.");
@@ -206,9 +197,7 @@ void native_slot_set_value_and_case(upb_fieldtype_t type, VALUE type_class,
}
case UPB_TYPE_ENUM: {
int32_t int_val = 0;
- if (TYPE(value) == T_STRING) {
- value = rb_funcall(value, rb_intern("to_sym"), 0, NULL);
- } else if (!is_ruby_num(value) && TYPE(value) != T_SYMBOL) {
+ if (!is_ruby_num(value) && TYPE(value) != T_SYMBOL) {
rb_raise(rb_eTypeError,
"Expected number or symbol type for enum field.");
}
@@ -606,20 +595,12 @@ 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) {
- if (self->field_type_class !=
- Descriptor_msgclass(get_def_obj(upb_fielddef_subdef(field)))) {
- rb_raise(rb_eTypeError,
- "Repeated field array has wrong message class");
- }
- }
-
-
- if (self->field_type == UPB_TYPE_ENUM) {
+ if (self->field_type == UPB_TYPE_MESSAGE ||
+ self->field_type == UPB_TYPE_ENUM) {
if (self->field_type_class !=
- EnumDescriptor_enummodule(get_def_obj(upb_fielddef_subdef(field)))) {
+ get_def_obj(upb_fielddef_subdef(field))) {
rb_raise(rb_eTypeError,
- "Repeated field array has wrong enum class");
+ "Repeated field array has wrong message/enum class");
}
}
}
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/upb.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/upb.c
index c02a5ce4a4..90d1f0cda8 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/upb.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/upb.c
@@ -2,585 +2,6 @@
#include "upb.h"
-/* Maps descriptor type -> upb field type. */
-static const uint8_t upb_desctype_to_fieldtype[] = {
- UPB_WIRE_TYPE_END_GROUP, /* ENDGROUP */
- UPB_TYPE_DOUBLE, /* DOUBLE */
- UPB_TYPE_FLOAT, /* FLOAT */
- UPB_TYPE_INT64, /* INT64 */
- UPB_TYPE_UINT64, /* UINT64 */
- UPB_TYPE_INT32, /* INT32 */
- UPB_TYPE_UINT64, /* FIXED64 */
- UPB_TYPE_UINT32, /* FIXED32 */
- UPB_TYPE_BOOL, /* BOOL */
- UPB_TYPE_STRING, /* STRING */
- UPB_TYPE_MESSAGE, /* GROUP */
- UPB_TYPE_MESSAGE, /* MESSAGE */
- UPB_TYPE_BYTES, /* BYTES */
- UPB_TYPE_UINT32, /* UINT32 */
- UPB_TYPE_ENUM, /* ENUM */
- UPB_TYPE_INT32, /* SFIXED32 */
- UPB_TYPE_INT64, /* SFIXED64 */
- UPB_TYPE_INT32, /* SINT32 */
- UPB_TYPE_INT64, /* SINT64 */
-};
-
-/* Data pertaining to the parse. */
-typedef struct {
- upb_env *env;
- /* Current decoding pointer. Points to the beginning of a field until we
- * have finished decoding the whole field. */
- const char *ptr;
-} upb_decstate;
-
-/* Data pertaining to a single message frame. */
-typedef struct {
- const char *limit;
- int32_t group_number; /* 0 if we are not parsing a group. */
-
- /* These members are unset for an unknown group frame. */
- char *msg;
- const upb_msglayout_msginit_v1 *m;
-} upb_decframe;
-
-#define CHK(x) if (!(x)) { return false; }
-
-static bool upb_skip_unknowngroup(upb_decstate *d, int field_number,
- const char *limit);
-static bool upb_decode_message(upb_decstate *d, const char *limit,
- int group_number, char *msg,
- const upb_msglayout_msginit_v1 *l);
-
-static bool upb_decode_varint(const char **ptr, const char *limit,
- uint64_t *val) {
- uint8_t byte;
- int bitpos = 0;
- const char *p = *ptr;
- *val = 0;
-
- do {
- CHK(bitpos < 70 && p < limit);
- byte = *p;
- *val |= (uint64_t)(byte & 0x7F) << bitpos;
- p++;
- bitpos += 7;
- } while (byte & 0x80);
-
- *ptr = p;
- return true;
-}
-
-static bool upb_decode_varint32(const char **ptr, const char *limit,
- uint32_t *val) {
- uint64_t u64;
- CHK(upb_decode_varint(ptr, limit, &u64) && u64 <= UINT32_MAX);
- *val = u64;
- return true;
-}
-
-static bool upb_decode_64bit(const char **ptr, const char *limit,
- uint64_t *val) {
- CHK(limit - *ptr >= 8);
- memcpy(val, *ptr, 8);
- *ptr += 8;
- return true;
-}
-
-static bool upb_decode_32bit(const char **ptr, const char *limit,
- uint32_t *val) {
- CHK(limit - *ptr >= 4);
- memcpy(val, *ptr, 4);
- *ptr += 4;
- return true;
-}
-
-static bool upb_decode_tag(const char **ptr, const char *limit,
- int *field_number, int *wire_type) {
- uint32_t tag = 0;
- CHK(upb_decode_varint32(ptr, limit, &tag));
- *field_number = tag >> 3;
- *wire_type = tag & 7;
- return true;
-}
-
-static int32_t upb_zzdecode_32(uint32_t n) {
- return (n >> 1) ^ -(int32_t)(n & 1);
-}
-
-static int64_t upb_zzdecode_64(uint64_t n) {
- return (n >> 1) ^ -(int64_t)(n & 1);
-}
-
-static bool upb_decode_string(const char **ptr, const char *limit,
- upb_stringview *val) {
- uint32_t len;
-
- CHK(upb_decode_varint32(ptr, limit, &len) &&
- len < INT32_MAX &&
- limit - *ptr >= (int32_t)len);
-
- *val = upb_stringview_make(*ptr, len);
- *ptr += len;
- return true;
-}
-
-static void upb_set32(void *msg, size_t ofs, uint32_t val) {
- memcpy((char*)msg + ofs, &val, sizeof(val));
-}
-
-static bool upb_append_unknown(upb_decstate *d, upb_decframe *frame,
- const char *start) {
- UPB_UNUSED(d);
- UPB_UNUSED(frame);
- UPB_UNUSED(start);
- return true;
-}
-
-static bool upb_skip_unknownfielddata(upb_decstate *d, upb_decframe *frame,
- int field_number, int wire_type) {
- switch (wire_type) {
- case UPB_WIRE_TYPE_VARINT: {
- uint64_t val;
- return upb_decode_varint(&d->ptr, frame->limit, &val);
- }
- case UPB_WIRE_TYPE_32BIT: {
- uint32_t val;
- return upb_decode_32bit(&d->ptr, frame->limit, &val);
- }
- case UPB_WIRE_TYPE_64BIT: {
- uint64_t val;
- return upb_decode_64bit(&d->ptr, frame->limit, &val);
- }
- case UPB_WIRE_TYPE_DELIMITED: {
- upb_stringview val;
- return upb_decode_string(&d->ptr, frame->limit, &val);
- }
- case UPB_WIRE_TYPE_START_GROUP:
- return upb_skip_unknowngroup(d, field_number, frame->limit);
- case UPB_WIRE_TYPE_END_GROUP:
- CHK(field_number == frame->group_number);
- frame->limit = d->ptr;
- return true;
- }
- return false;
-}
-
-static bool upb_array_grow(upb_array *arr, size_t elements) {
- size_t needed = arr->len + elements;
- size_t new_size = UPB_MAX(arr->size, 8);
- size_t new_bytes;
- size_t old_bytes;
- void *new_data;
-
- while (new_size < needed) {
- new_size *= 2;
- }
-
- old_bytes = arr->len * arr->element_size;
- new_bytes = new_size * arr->element_size;
- new_data = upb_realloc(arr->alloc, arr->data, old_bytes, new_bytes);
- CHK(new_data);
-
- arr->data = new_data;
- arr->size = new_size;
- return true;
-}
-
-static void *upb_array_reserve(upb_array *arr, size_t elements) {
- if (arr->size - arr->len < elements) {
- CHK(upb_array_grow(arr, elements));
- }
- return (char*)arr->data + (arr->len * arr->element_size);
-}
-
-static void *upb_array_add(upb_array *arr, size_t elements) {
- void *ret = upb_array_reserve(arr, elements);
- arr->len += elements;
- return ret;
-}
-
-static upb_array *upb_getarr(upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- UPB_ASSERT(field->label == UPB_LABEL_REPEATED);
- return *(upb_array**)&frame->msg[field->offset];
-}
-
-static upb_array *upb_getorcreatearr(upb_decstate *d,
- upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- upb_array *arr = upb_getarr(frame, field);
-
- if (!arr) {
- arr = upb_env_malloc(d->env, sizeof(*arr));
- if (!arr) {
- return NULL;
- }
- upb_array_init(arr, upb_desctype_to_fieldtype[field->type],
- upb_arena_alloc(upb_env_arena(d->env)));
- *(upb_array**)&frame->msg[field->offset] = arr;
- }
-
- return arr;
-}
-
-static void upb_sethasbit(upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- UPB_ASSERT(field->hasbit != UPB_NO_HASBIT);
- frame->msg[field->hasbit / 8] |= (1 << (field->hasbit % 8));
-}
-
-static void upb_setoneofcase(upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- UPB_ASSERT(field->oneof_index != UPB_NOT_IN_ONEOF);
- upb_set32(frame->msg, frame->m->oneofs[field->oneof_index].case_offset,
- field->number);
-}
-
-static char *upb_decode_prepareslot(upb_decstate *d,
- upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- char *field_mem = frame->msg + field->offset;
- upb_array *arr;
-
- if (field->label == UPB_LABEL_REPEATED) {
- arr = upb_getorcreatearr(d, frame, field);
- field_mem = upb_array_reserve(arr, 1);
- }
-
- return field_mem;
-}
-
-static void upb_decode_setpresent(upb_decframe *frame,
- const upb_msglayout_fieldinit_v1 *field) {
- if (field->label == UPB_LABEL_REPEATED) {
- upb_array *arr = upb_getarr(frame, field);
- UPB_ASSERT(arr->len < arr->size);
- arr->len++;
- } else if (field->oneof_index != UPB_NOT_IN_ONEOF) {
- upb_setoneofcase(frame, field);
- } else if (field->hasbit != UPB_NO_HASBIT) {
- upb_sethasbit(frame, field);
- }
-}
-
-static bool upb_decode_submsg(upb_decstate *d,
- upb_decframe *frame,
- const char *limit,
- const upb_msglayout_fieldinit_v1 *field,
- int group_number) {
- char *submsg = *(void**)&frame->msg[field->offset];
- const upb_msglayout_msginit_v1 *subm;
-
- UPB_ASSERT(field->submsg_index != UPB_NO_SUBMSG);
- subm = frame->m->submsgs[field->submsg_index];
- UPB_ASSERT(subm);
-
- if (!submsg) {
- submsg = upb_env_malloc(d->env, upb_msg_sizeof((upb_msglayout *)subm));
- CHK(submsg);
- submsg = upb_msg_init(
- submsg, (upb_msglayout*)subm, upb_arena_alloc(upb_env_arena(d->env)));
- *(void**)&frame->msg[field->offset] = submsg;
- }
-
- upb_decode_message(d, limit, group_number, submsg, subm);
-
- return true;
-}
-
-static bool upb_decode_varintfield(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field) {
- uint64_t val;
- void *field_mem;
-
- field_mem = upb_decode_prepareslot(d, frame, field);
- CHK(field_mem);
- CHK(upb_decode_varint(&d->ptr, frame->limit, &val));
-
- switch ((upb_descriptortype_t)field->type) {
- case UPB_DESCRIPTOR_TYPE_INT64:
- case UPB_DESCRIPTOR_TYPE_UINT64:
- memcpy(field_mem, &val, sizeof(val));
- break;
- case UPB_DESCRIPTOR_TYPE_INT32:
- case UPB_DESCRIPTOR_TYPE_UINT32:
- case UPB_DESCRIPTOR_TYPE_ENUM: {
- uint32_t val32 = val;
- memcpy(field_mem, &val32, sizeof(val32));
- break;
- }
- case UPB_DESCRIPTOR_TYPE_BOOL: {
- bool valbool = val != 0;
- memcpy(field_mem, &valbool, sizeof(valbool));
- break;
- }
- case UPB_DESCRIPTOR_TYPE_SINT32: {
- int32_t decoded = upb_zzdecode_32(val);
- memcpy(field_mem, &decoded, sizeof(decoded));
- break;
- }
- case UPB_DESCRIPTOR_TYPE_SINT64: {
- int64_t decoded = upb_zzdecode_64(val);
- memcpy(field_mem, &decoded, sizeof(decoded));
- break;
- }
- default:
- return upb_append_unknown(d, frame, field_start);
- }
-
- upb_decode_setpresent(frame, field);
- return true;
-}
-
-static bool upb_decode_64bitfield(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field) {
- void *field_mem;
- uint64_t val;
-
- field_mem = upb_decode_prepareslot(d, frame, field);
- CHK(field_mem);
- CHK(upb_decode_64bit(&d->ptr, frame->limit, &val));
-
- switch ((upb_descriptortype_t)field->type) {
- case UPB_DESCRIPTOR_TYPE_DOUBLE:
- case UPB_DESCRIPTOR_TYPE_FIXED64:
- case UPB_DESCRIPTOR_TYPE_SFIXED64:
- memcpy(field_mem, &val, sizeof(val));
- break;
- default:
- return upb_append_unknown(d, frame, field_start);
- }
-
- upb_decode_setpresent(frame, field);
- return true;
-}
-
-static bool upb_decode_32bitfield(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field) {
- void *field_mem;
- uint32_t val;
-
- field_mem = upb_decode_prepareslot(d, frame, field);
- CHK(field_mem);
- CHK(upb_decode_32bit(&d->ptr, frame->limit, &val));
-
- switch ((upb_descriptortype_t)field->type) {
- case UPB_DESCRIPTOR_TYPE_FLOAT:
- case UPB_DESCRIPTOR_TYPE_FIXED32:
- case UPB_DESCRIPTOR_TYPE_SFIXED32:
- memcpy(field_mem, &val, sizeof(val));
- break;
- default:
- return upb_append_unknown(d, frame, field_start);
- }
-
- upb_decode_setpresent(frame, field);
- return true;
-}
-
-static bool upb_decode_fixedpacked(upb_array *arr, upb_stringview data,
- int elem_size) {
- int elements = data.size / elem_size;
- void *field_mem;
-
- CHK((size_t)(elements * elem_size) == data.size);
- field_mem = upb_array_add(arr, elements);
- CHK(field_mem);
- memcpy(field_mem, data.data, data.size);
- return true;
-}
-
-static bool upb_decode_toarray(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field,
- upb_stringview val) {
- upb_array *arr = upb_getorcreatearr(d, frame, field);
-
-#define VARINT_CASE(ctype, decode) { \
- const char *ptr = val.data; \
- const char *limit = ptr + val.size; \
- while (ptr < limit) { \
- uint64_t val; \
- void *field_mem; \
- ctype decoded; \
- CHK(upb_decode_varint(&ptr, limit, &val)); \
- decoded = (decode)(val); \
- field_mem = upb_array_add(arr, 1); \
- CHK(field_mem); \
- memcpy(field_mem, &decoded, sizeof(ctype)); \
- } \
- return true; \
-}
-
- switch ((upb_descriptortype_t)field->type) {
- case UPB_DESCRIPTOR_TYPE_STRING:
- case UPB_DESCRIPTOR_TYPE_BYTES: {
- void *field_mem = upb_array_add(arr, 1);
- CHK(field_mem);
- memcpy(field_mem, &val, sizeof(val));
- return true;
- }
- case UPB_DESCRIPTOR_TYPE_FLOAT:
- case UPB_DESCRIPTOR_TYPE_FIXED32:
- case UPB_DESCRIPTOR_TYPE_SFIXED32:
- return upb_decode_fixedpacked(arr, val, sizeof(int32_t));
- case UPB_DESCRIPTOR_TYPE_DOUBLE:
- case UPB_DESCRIPTOR_TYPE_FIXED64:
- case UPB_DESCRIPTOR_TYPE_SFIXED64:
- return upb_decode_fixedpacked(arr, val, sizeof(int64_t));
- case UPB_DESCRIPTOR_TYPE_INT32:
- case UPB_DESCRIPTOR_TYPE_UINT32:
- case UPB_DESCRIPTOR_TYPE_ENUM:
- /* TODO: proto2 enum field that isn't in the enum. */
- VARINT_CASE(uint32_t, uint32_t);
- case UPB_DESCRIPTOR_TYPE_INT64:
- case UPB_DESCRIPTOR_TYPE_UINT64:
- VARINT_CASE(uint64_t, uint64_t);
- case UPB_DESCRIPTOR_TYPE_BOOL:
- VARINT_CASE(bool, bool);
- case UPB_DESCRIPTOR_TYPE_SINT32:
- VARINT_CASE(int32_t, upb_zzdecode_32);
- case UPB_DESCRIPTOR_TYPE_SINT64:
- VARINT_CASE(int64_t, upb_zzdecode_64);
- case UPB_DESCRIPTOR_TYPE_MESSAGE:
- CHK(val.size <= (size_t)(frame->limit - val.data));
- return upb_decode_submsg(d, frame, val.data + val.size, field, 0);
- case UPB_DESCRIPTOR_TYPE_GROUP:
- return upb_append_unknown(d, frame, field_start);
- }
-#undef VARINT_CASE
- UPB_UNREACHABLE();
-}
-
-static bool upb_decode_delimitedfield(upb_decstate *d, upb_decframe *frame,
- const char *field_start,
- const upb_msglayout_fieldinit_v1 *field) {
- upb_stringview val;
-
- CHK(upb_decode_string(&d->ptr, frame->limit, &val));
-
- if (field->label == UPB_LABEL_REPEATED) {
- return upb_decode_toarray(d, frame, field_start, field, val);
- } else {
- switch ((upb_descriptortype_t)field->type) {
- case UPB_DESCRIPTOR_TYPE_STRING:
- case UPB_DESCRIPTOR_TYPE_BYTES: {
- void *field_mem = upb_decode_prepareslot(d, frame, field);
- CHK(field_mem);
- memcpy(field_mem, &val, sizeof(val));
- break;
- }
- case UPB_DESCRIPTOR_TYPE_MESSAGE:
- CHK(val.size <= (size_t)(frame->limit - val.data));
- CHK(upb_decode_submsg(d, frame, val.data + val.size, field, 0));
- break;
- default:
- /* TODO(haberman): should we accept the last element of a packed? */
- return upb_append_unknown(d, frame, field_start);
- }
- upb_decode_setpresent(frame, field);
- return true;
- }
-}
-
-static const upb_msglayout_fieldinit_v1 *upb_find_field(
- const upb_msglayout_msginit_v1 *l, uint32_t field_number) {
- /* Lots of optimization opportunities here. */
- int i;
- for (i = 0; i < l->field_count; i++) {
- if (l->fields[i].number == field_number) {
- return &l->fields[i];
- }
- }
-
- return NULL; /* Unknown field. */
-}
-
-static bool upb_decode_field(upb_decstate *d, upb_decframe *frame) {
- int field_number;
- int wire_type;
- const char *field_start = d->ptr;
- const upb_msglayout_fieldinit_v1 *field;
-
- CHK(upb_decode_tag(&d->ptr, frame->limit, &field_number, &wire_type));
- field = upb_find_field(frame->m, field_number);
-
- if (field) {
- switch (wire_type) {
- case UPB_WIRE_TYPE_VARINT:
- return upb_decode_varintfield(d, frame, field_start, field);
- case UPB_WIRE_TYPE_32BIT:
- return upb_decode_32bitfield(d, frame, field_start, field);
- case UPB_WIRE_TYPE_64BIT:
- return upb_decode_64bitfield(d, frame, field_start, field);
- case UPB_WIRE_TYPE_DELIMITED:
- return upb_decode_delimitedfield(d, frame, field_start, field);
- case UPB_WIRE_TYPE_START_GROUP:
- CHK(field->type == UPB_DESCRIPTOR_TYPE_GROUP);
- return upb_decode_submsg(d, frame, frame->limit, field, field_number);
- case UPB_WIRE_TYPE_END_GROUP:
- CHK(frame->group_number == field_number)
- frame->limit = d->ptr;
- return true;
- default:
- return false;
- }
- } else {
- CHK(field_number != 0);
- return upb_skip_unknownfielddata(d, frame, field_number, wire_type);
- }
-}
-
-static bool upb_skip_unknowngroup(upb_decstate *d, int field_number,
- const char *limit) {
- upb_decframe frame;
- frame.msg = NULL;
- frame.m = NULL;
- frame.group_number = field_number;
- frame.limit = limit;
-
- while (d->ptr < frame.limit) {
- int wire_type;
- int field_number;
-
- CHK(upb_decode_tag(&d->ptr, frame.limit, &field_number, &wire_type));
- CHK(upb_skip_unknownfielddata(d, &frame, field_number, wire_type));
- }
-
- return true;
-}
-
-static bool upb_decode_message(upb_decstate *d, const char *limit,
- int group_number, char *msg,
- const upb_msglayout_msginit_v1 *l) {
- upb_decframe frame;
- frame.group_number = group_number;
- frame.limit = limit;
- frame.msg = msg;
- frame.m = l;
-
- while (d->ptr < frame.limit) {
- CHK(upb_decode_field(d, &frame));
- }
-
- return true;
-}
-
-bool upb_decode(upb_stringview buf, void *msg,
- const upb_msglayout_msginit_v1 *l, upb_env *env) {
- upb_decstate state;
- state.ptr = buf.data;
- state.env = env;
-
- return upb_decode_message(&state, buf.data + buf.size, 0, msg, l);
-}
-
-#undef CHK
-
-
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
@@ -905,7 +326,6 @@ static bool assign_msg_indices(upb_msgdef *m, upb_status *s) {
v = upb_value_bool(true);
upb_inttable_insert(&t, UPB_STARTMSG_SELECTOR, v);
upb_inttable_insert(&t, UPB_ENDMSG_SELECTOR, v);
- upb_inttable_insert(&t, UPB_UNKNOWN_SELECTOR, v);
for(upb_msg_field_begin(&j, m);
!upb_msg_field_done(&j);
upb_msg_field_next(&j)) {
@@ -2888,9 +2308,6 @@ bool upb_symtab_addfile(upb_symtab *s, upb_filedef *file, upb_status *status) {
bool ret;
n = upb_filedef_defcount(file);
- if (n == 0) {
- return true;
- }
defs = upb_gmalloc(sizeof(*defs) * n);
if (defs == NULL) {
@@ -2939,397 +2356,6 @@ bool upb_symtab_done(const upb_symtab_iter *iter) {
const upb_def *upb_symtab_iter_def(const upb_symtab_iter *iter) {
return upb_value_getptr(upb_strtable_iter_value(&iter->iter));
}
-/* We encode backwards, to avoid pre-computing lengths (one-pass encode). */
-
-
-#define UPB_PB_VARINT_MAX_LEN 10
-#define CHK(x) do { if (!(x)) { return false; } } while(0)
-
-/* Maps descriptor type -> upb field type. */
-static const uint8_t upb_desctype_to_fieldtype2[] = {
- UPB_WIRE_TYPE_END_GROUP, /* ENDGROUP */
- UPB_TYPE_DOUBLE, /* DOUBLE */
- UPB_TYPE_FLOAT, /* FLOAT */
- UPB_TYPE_INT64, /* INT64 */
- UPB_TYPE_UINT64, /* UINT64 */
- UPB_TYPE_INT32, /* INT32 */
- UPB_TYPE_UINT64, /* FIXED64 */
- UPB_TYPE_UINT32, /* FIXED32 */
- UPB_TYPE_BOOL, /* BOOL */
- UPB_TYPE_STRING, /* STRING */
- UPB_TYPE_MESSAGE, /* GROUP */
- UPB_TYPE_MESSAGE, /* MESSAGE */
- UPB_TYPE_BYTES, /* BYTES */
- UPB_TYPE_UINT32, /* UINT32 */
- UPB_TYPE_ENUM, /* ENUM */
- UPB_TYPE_INT32, /* SFIXED32 */
- UPB_TYPE_INT64, /* SFIXED64 */
- UPB_TYPE_INT32, /* SINT32 */
- UPB_TYPE_INT64, /* SINT64 */
-};
-
-static size_t upb_encode_varint(uint64_t val, char *buf) {
- size_t i;
- if (val < 128) { buf[0] = val; return 1; }
- i = 0;
- while (val) {
- uint8_t byte = val & 0x7fU;
- val >>= 7;
- if (val) byte |= 0x80U;
- buf[i++] = byte;
- }
- return i;
-}
-
-static uint32_t upb_zzencode_32(int32_t n) { return (n << 1) ^ (n >> 31); }
-static uint64_t upb_zzencode_64(int64_t n) { return (n << 1) ^ (n >> 63); }
-
-typedef struct {
- upb_env *env;
- char *buf, *ptr, *limit;
-} upb_encstate;
-
-static size_t upb_roundup_pow2(size_t bytes) {
- size_t ret = 128;
- while (ret < bytes) {
- ret *= 2;
- }
- return ret;
-}
-
-static bool upb_encode_growbuffer(upb_encstate *e, size_t bytes) {
- size_t old_size = e->limit - e->buf;
- size_t new_size = upb_roundup_pow2(bytes + (e->limit - e->ptr));
- char *new_buf = upb_env_realloc(e->env, e->buf, old_size, new_size);
- CHK(new_buf);
-
- /* We want previous data at the end, realloc() put it at the beginning. */
- memmove(e->limit - old_size, e->buf, old_size);
-
- e->ptr = new_buf + new_size - (e->limit - e->ptr);
- e->limit = new_buf + new_size;
- e->buf = new_buf;
- return true;
-}
-
-/* Call to ensure that at least "bytes" bytes are available for writing at
- * e->ptr. Returns false if the bytes could not be allocated. */
-static bool upb_encode_reserve(upb_encstate *e, size_t bytes) {
- CHK(UPB_LIKELY((size_t)(e->ptr - e->buf) >= bytes) ||
- upb_encode_growbuffer(e, bytes));
-
- e->ptr -= bytes;
- return true;
-}
-
-/* Writes the given bytes to the buffer, handling reserve/advance. */
-static bool upb_put_bytes(upb_encstate *e, const void *data, size_t len) {
- CHK(upb_encode_reserve(e, len));
- memcpy(e->ptr, data, len);
- return true;
-}
-
-static bool upb_put_fixed64(upb_encstate *e, uint64_t val) {
- /* TODO(haberman): byte-swap for big endian. */
- return upb_put_bytes(e, &val, sizeof(uint64_t));
-}
-
-static bool upb_put_fixed32(upb_encstate *e, uint32_t val) {
- /* TODO(haberman): byte-swap for big endian. */
- return upb_put_bytes(e, &val, sizeof(uint32_t));
-}
-
-static bool upb_put_varint(upb_encstate *e, uint64_t val) {
- size_t len;
- char *start;
- CHK(upb_encode_reserve(e, UPB_PB_VARINT_MAX_LEN));
- len = upb_encode_varint(val, e->ptr);
- start = e->ptr + UPB_PB_VARINT_MAX_LEN - len;
- memmove(start, e->ptr, len);
- e->ptr = start;
- return true;
-}
-
-static bool upb_put_double(upb_encstate *e, double d) {
- uint64_t u64;
- UPB_ASSERT(sizeof(double) == sizeof(uint64_t));
- memcpy(&u64, &d, sizeof(uint64_t));
- return upb_put_fixed64(e, u64);
-}
-
-static bool upb_put_float(upb_encstate *e, float d) {
- uint32_t u32;
- UPB_ASSERT(sizeof(float) == sizeof(uint32_t));
- memcpy(&u32, &d, sizeof(uint32_t));
- return upb_put_fixed32(e, u32);
-}
-
-static uint32_t upb_readcase(const char *msg, const upb_msglayout_msginit_v1 *m,
- int oneof_index) {
- uint32_t ret;
- memcpy(&ret, msg + m->oneofs[oneof_index].case_offset, sizeof(ret));
- return ret;
-}
-
-static bool upb_readhasbit(const char *msg,
- const upb_msglayout_fieldinit_v1 *f) {
- UPB_ASSERT(f->hasbit != UPB_NO_HASBIT);
- return msg[f->hasbit / 8] & (1 << (f->hasbit % 8));
-}
-
-static bool upb_put_tag(upb_encstate *e, int field_number, int wire_type) {
- return upb_put_varint(e, (field_number << 3) | wire_type);
-}
-
-static bool upb_put_fixedarray(upb_encstate *e, const upb_array *arr,
- size_t size) {
- size_t bytes = arr->len * size;
- return upb_put_bytes(e, arr->data, bytes) && upb_put_varint(e, bytes);
-}
-
-bool upb_encode_message(upb_encstate *e, const char *msg,
- const upb_msglayout_msginit_v1 *m,
- size_t *size);
-
-static bool upb_encode_array(upb_encstate *e, const char *field_mem,
- const upb_msglayout_msginit_v1 *m,
- const upb_msglayout_fieldinit_v1 *f) {
- const upb_array *arr = *(const upb_array**)field_mem;
-
- if (arr == NULL || arr->len == 0) {
- return true;
- }
-
- UPB_ASSERT(arr->type == upb_desctype_to_fieldtype2[f->type]);
-
-#define VARINT_CASE(ctype, encode) { \
- ctype *start = arr->data; \
- ctype *ptr = start + arr->len; \
- size_t pre_len = e->limit - e->ptr; \
- do { \
- ptr--; \
- CHK(upb_put_varint(e, encode)); \
- } while (ptr != start); \
- CHK(upb_put_varint(e, e->limit - e->ptr - pre_len)); \
-} \
-break; \
-do { ; } while(0)
-
- switch (f->type) {
- case UPB_DESCRIPTOR_TYPE_DOUBLE:
- CHK(upb_put_fixedarray(e, arr, sizeof(double)));
- break;
- case UPB_DESCRIPTOR_TYPE_FLOAT:
- CHK(upb_put_fixedarray(e, arr, sizeof(float)));
- break;
- case UPB_DESCRIPTOR_TYPE_SFIXED64:
- case UPB_DESCRIPTOR_TYPE_FIXED64:
- CHK(upb_put_fixedarray(e, arr, sizeof(uint64_t)));
- break;
- case UPB_DESCRIPTOR_TYPE_FIXED32:
- case UPB_DESCRIPTOR_TYPE_SFIXED32:
- CHK(upb_put_fixedarray(e, arr, sizeof(uint32_t)));
- break;
- case UPB_DESCRIPTOR_TYPE_INT64:
- case UPB_DESCRIPTOR_TYPE_UINT64:
- VARINT_CASE(uint64_t, *ptr);
- case UPB_DESCRIPTOR_TYPE_UINT32:
- case UPB_DESCRIPTOR_TYPE_INT32:
- case UPB_DESCRIPTOR_TYPE_ENUM:
- VARINT_CASE(uint32_t, *ptr);
- case UPB_DESCRIPTOR_TYPE_BOOL:
- VARINT_CASE(bool, *ptr);
- case UPB_DESCRIPTOR_TYPE_SINT32:
- VARINT_CASE(int32_t, upb_zzencode_32(*ptr));
- case UPB_DESCRIPTOR_TYPE_SINT64:
- VARINT_CASE(int64_t, upb_zzencode_64(*ptr));
- case UPB_DESCRIPTOR_TYPE_STRING:
- case UPB_DESCRIPTOR_TYPE_BYTES: {
- upb_stringview *start = arr->data;
- upb_stringview *ptr = start + arr->len;
- do {
- ptr--;
- CHK(upb_put_bytes(e, ptr->data, ptr->size) &&
- upb_put_varint(e, ptr->size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
- } while (ptr != start);
- return true;
- }
- case UPB_DESCRIPTOR_TYPE_GROUP: {
- void **start = arr->data;
- void **ptr = start + arr->len;
- const upb_msglayout_msginit_v1 *subm = m->submsgs[f->submsg_index];
- do {
- size_t size;
- ptr--;
- CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP) &&
- upb_encode_message(e, *ptr, subm, &size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP));
- } while (ptr != start);
- return true;
- }
- case UPB_DESCRIPTOR_TYPE_MESSAGE: {
- void **start = arr->data;
- void **ptr = start + arr->len;
- const upb_msglayout_msginit_v1 *subm = m->submsgs[f->submsg_index];
- do {
- size_t size;
- ptr--;
- CHK(upb_encode_message(e, *ptr, subm, &size) &&
- upb_put_varint(e, size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
- } while (ptr != start);
- return true;
- }
- }
-#undef VARINT_CASE
-
- /* We encode all primitive arrays as packed, regardless of what was specified
- * in the .proto file. Could special case 1-sized arrays. */
- CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
- return true;
-}
-
-static bool upb_encode_scalarfield(upb_encstate *e, const char *field_mem,
- const upb_msglayout_msginit_v1 *m,
- const upb_msglayout_fieldinit_v1 *f,
- bool is_proto3) {
- bool skip_zero_value = is_proto3 && f->oneof_index == UPB_NOT_IN_ONEOF;
-
-#define CASE(ctype, type, wire_type, encodeval) do { \
- ctype val = *(ctype*)field_mem; \
- if (skip_zero_value && val == 0) { \
- return true; \
- } \
- return upb_put_ ## type(e, encodeval) && \
- upb_put_tag(e, f->number, wire_type); \
-} while(0)
-
- switch (f->type) {
- case UPB_DESCRIPTOR_TYPE_DOUBLE:
- CASE(double, double, UPB_WIRE_TYPE_64BIT, val);
- case UPB_DESCRIPTOR_TYPE_FLOAT:
- CASE(float, float, UPB_WIRE_TYPE_32BIT, val);
- case UPB_DESCRIPTOR_TYPE_INT64:
- case UPB_DESCRIPTOR_TYPE_UINT64:
- CASE(uint64_t, varint, UPB_WIRE_TYPE_VARINT, val);
- case UPB_DESCRIPTOR_TYPE_UINT32:
- case UPB_DESCRIPTOR_TYPE_INT32:
- case UPB_DESCRIPTOR_TYPE_ENUM:
- CASE(uint32_t, varint, UPB_WIRE_TYPE_VARINT, val);
- case UPB_DESCRIPTOR_TYPE_SFIXED64:
- case UPB_DESCRIPTOR_TYPE_FIXED64:
- CASE(uint64_t, fixed64, UPB_WIRE_TYPE_64BIT, val);
- case UPB_DESCRIPTOR_TYPE_FIXED32:
- case UPB_DESCRIPTOR_TYPE_SFIXED32:
- CASE(uint32_t, fixed32, UPB_WIRE_TYPE_32BIT, val);
- case UPB_DESCRIPTOR_TYPE_BOOL:
- CASE(bool, varint, UPB_WIRE_TYPE_VARINT, val);
- case UPB_DESCRIPTOR_TYPE_SINT32:
- CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_32(val));
- case UPB_DESCRIPTOR_TYPE_SINT64:
- CASE(int64_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_64(val));
- case UPB_DESCRIPTOR_TYPE_STRING:
- case UPB_DESCRIPTOR_TYPE_BYTES: {
- upb_stringview view = *(upb_stringview*)field_mem;
- if (skip_zero_value && view.size == 0) {
- return true;
- }
- return upb_put_bytes(e, view.data, view.size) &&
- upb_put_varint(e, view.size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED);
- }
- case UPB_DESCRIPTOR_TYPE_GROUP: {
- size_t size;
- void *submsg = *(void**)field_mem;
- const upb_msglayout_msginit_v1 *subm = m->submsgs[f->submsg_index];
- if (skip_zero_value && submsg == NULL) {
- return true;
- }
- return upb_put_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP) &&
- upb_encode_message(e, submsg, subm, &size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP);
- }
- case UPB_DESCRIPTOR_TYPE_MESSAGE: {
- size_t size;
- void *submsg = *(void**)field_mem;
- const upb_msglayout_msginit_v1 *subm = m->submsgs[f->submsg_index];
- if (skip_zero_value && submsg == NULL) {
- return true;
- }
- return upb_encode_message(e, submsg, subm, &size) &&
- upb_put_varint(e, size) &&
- upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED);
- }
- }
-#undef CASE
- UPB_UNREACHABLE();
-}
-
-bool upb_encode_hasscalarfield(const char *msg,
- const upb_msglayout_msginit_v1 *m,
- const upb_msglayout_fieldinit_v1 *f) {
- if (f->oneof_index != UPB_NOT_IN_ONEOF) {
- return upb_readcase(msg, m, f->oneof_index) == f->number;
- } else if (m->is_proto2) {
- return upb_readhasbit(msg, f);
- } else {
- /* For proto3, we'll test for the field being empty later. */
- return true;
- }
-}
-
-bool upb_encode_message(upb_encstate* e, const char *msg,
- const upb_msglayout_msginit_v1 *m,
- size_t *size) {
- int i;
- char *buf_end = e->ptr;
-
- if (msg == NULL) {
- return true;
- }
-
- for (i = m->field_count - 1; i >= 0; i--) {
- const upb_msglayout_fieldinit_v1 *f = &m->fields[i];
-
- if (f->label == UPB_LABEL_REPEATED) {
- CHK(upb_encode_array(e, msg + f->offset, m, f));
- } else {
- if (upb_encode_hasscalarfield(msg, m, f)) {
- CHK(upb_encode_scalarfield(e, msg + f->offset, m, f, !m->is_proto2));
- }
- }
- }
-
- *size = buf_end - e->ptr;
- return true;
-}
-
-char *upb_encode(const void *msg, const upb_msglayout_msginit_v1 *m,
- upb_env *env, size_t *size) {
- upb_encstate e;
- e.env = env;
- e.buf = NULL;
- e.limit = NULL;
- e.ptr = NULL;
-
- if (!upb_encode_message(&e, msg, m, size)) {
- *size = 0;
- return NULL;
- }
-
- *size = e.limit - e.ptr;
-
- if (*size == 0) {
- static char ch;
- return &ch;
- } else {
- UPB_ASSERT(e.ptr);
- return e.ptr;
- }
-}
-
-#undef CHK
/*
** TODO(haberman): it's unclear whether a lot of the consistency checks should
** UPB_ASSERT() or return false.
@@ -3701,12 +2727,6 @@ SETTER(endseq, upb_endfield_handlerfunc*, UPB_HANDLER_ENDSEQ)
#undef SETTER
-bool upb_handlers_setunknown(upb_handlers *h, upb_unknown_handlerfunc *func,
- upb_handlerattr *attr) {
- return doset(h, UPB_UNKNOWN_SELECTOR, NULL, UPB_HANDLER_INT32,
- (upb_func *)func, attr);
-}
-
bool upb_handlers_setstartmsg(upb_handlers *h, upb_startmsg_handlerfunc *func,
upb_handlerattr *attr) {
return doset(h, UPB_STARTMSG_SELECTOR, NULL, UPB_HANDLER_INT32,
@@ -4056,8 +3076,7 @@ bool upb_fieldtype_mapkeyok(upb_fieldtype_t type) {
void *upb_array_pack(const upb_array *arr, void *p, size_t *ofs, size_t size);
void *upb_map_pack(const upb_map *map, void *p, size_t *ofs, size_t size);
-#define PTR_AT(msg, ofs, type) (type*)((char*)msg + ofs)
-#define VOIDPTR_AT(msg, ofs) PTR_AT(msg, ofs, void)
+#define CHARPTR_AT(msg, ofs) ((char*)msg + ofs)
#define ENCODE_MAX_NESTING 64
#define CHECK_TRUE(x) if (!(x)) { return false; }
@@ -4099,20 +3118,12 @@ static size_t upb_msgval_sizeof(upb_fieldtype_t type) {
case UPB_TYPE_MESSAGE:
return sizeof(void*);
case UPB_TYPE_STRING:
- return sizeof(upb_stringview);
+ return sizeof(char*) + sizeof(size_t);
}
UPB_UNREACHABLE();
}
-static uint8_t upb_msg_fieldsize(const upb_msglayout_fieldinit_v1 *field) {
- if (field->label == UPB_LABEL_REPEATED) {
- return sizeof(void*);
- } else {
- return upb_msgval_sizeof(field->type);
- }
-}
-
-static uint8_t upb_msg_fielddefsize(const upb_fielddef *f) {
+static uint8_t upb_msg_fieldsize(const upb_fielddef *f) {
if (upb_fielddef_isseq(f)) {
return sizeof(void*);
} else {
@@ -4156,6 +3167,7 @@ static upb_ctype_t upb_fieldtotabtype(upb_fieldtype_t type) {
}
static upb_msgval upb_msgval_fromdefault(const upb_fielddef *f) {
+ /* TODO(haberman): improve/optimize this (maybe use upb_msgval in fielddef) */
switch (upb_fielddef_type(f)) {
case UPB_TYPE_FLOAT:
return upb_msgval_float(upb_fielddef_defaultfloat(f));
@@ -4167,7 +3179,7 @@ static upb_msgval upb_msgval_fromdefault(const upb_fielddef *f) {
case UPB_TYPE_BYTES: {
size_t len;
const char *ptr = upb_fielddef_defaultstr(f, &len);
- return upb_msgval_makestr(ptr, len);
+ return upb_msgval_str(ptr, len);
}
case UPB_TYPE_MESSAGE:
return upb_msgval_msg(NULL);
@@ -4190,44 +3202,63 @@ static upb_msgval upb_msgval_fromdefault(const upb_fielddef *f) {
/** upb_msglayout *************************************************************/
struct upb_msglayout {
- struct upb_msglayout_msginit_v1 data;
+ upb_msgfactory *factory;
+ const upb_msgdef *msgdef;
+ size_t size;
+ size_t extdict_offset;
+ void *default_msg;
+ uint32_t *field_offsets;
+ uint32_t *case_offsets;
+ uint32_t *hasbits;
+ bool has_extdict;
+ uint8_t align;
};
+static void upb_msg_checkfield(const upb_msglayout *l, const upb_fielddef *f) {
+ UPB_ASSERT(l->msgdef == upb_fielddef_containingtype(f));
+}
+
static void upb_msglayout_free(upb_msglayout *l) {
- upb_gfree(l->data.default_msg);
+ upb_gfree(l->default_msg);
upb_gfree(l);
}
+const upb_msgdef *upb_msglayout_msgdef(const upb_msglayout *l) {
+ return l->msgdef;
+}
+
static size_t upb_msglayout_place(upb_msglayout *l, size_t size) {
size_t ret;
- l->data.size = align_up(l->data.size, size);
- ret = l->data.size;
- l->data.size += size;
+ l->size = align_up(l->size, size);
+ l->align = align_up(l->align, size);
+ ret = l->size;
+ l->size += size;
return ret;
}
static uint32_t upb_msglayout_offset(const upb_msglayout *l,
const upb_fielddef *f) {
- return l->data.fields[upb_fielddef_index(f)].offset;
+ return l->field_offsets[upb_fielddef_index(f)];
}
static uint32_t upb_msglayout_hasbit(const upb_msglayout *l,
const upb_fielddef *f) {
- return l->data.fields[upb_fielddef_index(f)].hasbit;
+ return l->hasbits[upb_fielddef_index(f)];
}
-static bool upb_msglayout_initdefault(upb_msglayout *l, const upb_msgdef *m) {
+static bool upb_msglayout_initdefault(upb_msglayout *l) {
+ const upb_msgdef *m = l->msgdef;
upb_msg_field_iter it;
- if (upb_msgdef_syntax(m) == UPB_SYNTAX_PROTO2 && l->data.size) {
+ if (upb_msgdef_syntax(m) == UPB_SYNTAX_PROTO2 && l->size) {
/* Allocate default message and set default values in it. */
- l->data.default_msg = upb_gmalloc(l->data.size);
- if (!l->data.default_msg) {
+ l->default_msg = upb_gmalloc(l->size);
+ if (!l->default_msg) {
return false;
}
- memset(l->data.default_msg, 0, l->data.size);
+ memset(l->default_msg, 0, l->size);
for (upb_msg_field_begin(&it, m); !upb_msg_field_done(&it);
upb_msg_field_next(&it)) {
@@ -4237,14 +3268,10 @@ static bool upb_msglayout_initdefault(upb_msglayout *l, const upb_msgdef *m) {
continue;
}
- /* TODO(haberman): handle strings. */
if (!upb_fielddef_isstring(f) &&
!upb_fielddef_issubmsg(f) &&
!upb_fielddef_isseq(f)) {
- upb_msg_set(l->data.default_msg,
- upb_fielddef_index(f),
- upb_msgval_fromdefault(f),
- l);
+ upb_msg_set(l->default_msg, f, upb_msgval_fromdefault(f), l);
}
}
}
@@ -4257,46 +3284,22 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) {
upb_msg_oneof_iter oit;
upb_msglayout *l;
size_t hasbit;
- size_t submsg_count = 0;
- const upb_msglayout_msginit_v1 **submsgs;
- upb_msglayout_fieldinit_v1 *fields;
- upb_msglayout_oneofinit_v1 *oneofs;
+ size_t array_size = upb_msgdef_numfields(m) + upb_msgdef_numoneofs(m);
- for (upb_msg_field_begin(&it, m);
- !upb_msg_field_done(&it);
- upb_msg_field_next(&it)) {
- const upb_fielddef* f = upb_msg_iter_field(&it);
- if (upb_fielddef_issubmsg(f)) {
- submsg_count++;
- }
+ if (upb_msgdef_syntax(m) == UPB_SYNTAX_PROTO2) {
+ array_size += upb_msgdef_numfields(m); /* hasbits. */
}
- l = upb_gmalloc(sizeof(*l));
+ l = upb_gmalloc(sizeof(*l) + (sizeof(uint32_t) * array_size));
if (!l) return NULL;
memset(l, 0, sizeof(*l));
- fields = upb_gmalloc(upb_msgdef_numfields(m) * sizeof(*fields));
- submsgs = upb_gmalloc(submsg_count * sizeof(*submsgs));
- oneofs = upb_gmalloc(upb_msgdef_numoneofs(m) * sizeof(*oneofs));
-
- if ((!fields && upb_msgdef_numfields(m)) ||
- (!submsgs && submsg_count) ||
- (!oneofs && upb_msgdef_numoneofs(m))) {
- /* OOM. */
- upb_gfree(l);
- upb_gfree(fields);
- upb_gfree(submsgs);
- upb_gfree(oneofs);
- return NULL;
- }
-
- l->data.field_count = upb_msgdef_numfields(m);
- l->data.oneof_count = upb_msgdef_numoneofs(m);
- l->data.fields = fields;
- l->data.submsgs = submsgs;
- l->data.oneofs = oneofs;
- l->data.is_proto2 = (upb_msgdef_syntax(m) == UPB_SYNTAX_PROTO2);
+ l->msgdef = m;
+ l->align = 1;
+ l->field_offsets = (uint32_t*)CHARPTR_AT(l, sizeof(*l));
+ l->case_offsets = l->field_offsets + upb_msgdef_numfields(m);
+ l->hasbits = l->case_offsets + upb_msgdef_numoneofs(m);
/* Allocate data offsets in three stages:
*
@@ -4307,75 +3310,74 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) {
* OPT: There is a lot of room for optimization here to minimize the size.
*/
- /* Allocate hasbits and set basic field attributes. */
- for (upb_msg_field_begin(&it, m), hasbit = 0;
+ /* Allocate hasbits. Start at sizeof(void*) for upb_alloc*. */
+ for (upb_msg_field_begin(&it, m), hasbit = sizeof(void*) * 8;
!upb_msg_field_done(&it);
upb_msg_field_next(&it)) {
const upb_fielddef* f = upb_msg_iter_field(&it);
- upb_msglayout_fieldinit_v1 *field = &fields[upb_fielddef_index(f)];
-
- field->number = upb_fielddef_number(f);
- field->type = upb_fielddef_type(f);
- field->label = upb_fielddef_label(f);
-
- if (upb_fielddef_containingoneof(f)) {
- field->oneof_index = upb_oneofdef_index(upb_fielddef_containingoneof(f));
- } else {
- field->oneof_index = UPB_NOT_IN_ONEOF;
- }
if (upb_fielddef_haspresence(f) && !upb_fielddef_containingoneof(f)) {
- field->hasbit = hasbit++;
+ l->hasbits[upb_fielddef_index(f)] = hasbit++;
}
}
/* Account for space used by hasbits. */
- l->data.size = div_round_up(hasbit, 8);
+ l->size = div_round_up(hasbit, 8);
/* Allocate non-oneof fields. */
for (upb_msg_field_begin(&it, m); !upb_msg_field_done(&it);
upb_msg_field_next(&it)) {
const upb_fielddef* f = upb_msg_iter_field(&it);
- size_t field_size = upb_msg_fielddefsize(f);
+ size_t field_size = upb_msg_fieldsize(f);
size_t index = upb_fielddef_index(f);
+
if (upb_fielddef_containingoneof(f)) {
/* Oneofs are handled separately below. */
continue;
}
- fields[index].offset = upb_msglayout_place(l, field_size);
+ l->field_offsets[index] = upb_msglayout_place(l, field_size);
}
/* Allocate oneof fields. Each oneof field consists of a uint32 for the case
* and space for the actual data. */
for (upb_msg_oneof_begin(&oit, m); !upb_msg_oneof_done(&oit);
upb_msg_oneof_next(&oit)) {
- const upb_oneofdef* o = upb_msg_iter_oneof(&oit);
+ const upb_oneofdef* oneof = upb_msg_iter_oneof(&oit);
upb_oneof_iter fit;
-
size_t case_size = sizeof(uint32_t); /* Could potentially optimize this. */
- upb_msglayout_oneofinit_v1 *oneof = &oneofs[upb_oneofdef_index(o)];
size_t field_size = 0;
+ size_t case_offset;
+ size_t val_offset;
/* Calculate field size: the max of all field sizes. */
- for (upb_oneof_begin(&fit, o);
+ for (upb_oneof_begin(&fit, oneof);
!upb_oneof_done(&fit);
upb_oneof_next(&fit)) {
const upb_fielddef* f = upb_oneof_iter_field(&fit);
- field_size = UPB_MAX(field_size, upb_msg_fielddefsize(f));
+ field_size = UPB_MAX(field_size, upb_msg_fieldsize(f));
}
/* Align and allocate case offset. */
- oneof->case_offset = upb_msglayout_place(l, case_size);
- oneof->data_offset = upb_msglayout_place(l, field_size);
+ case_offset = upb_msglayout_place(l, case_size);
+ val_offset = upb_msglayout_place(l, field_size);
+
+ l->case_offsets[upb_oneofdef_index(oneof)] = case_offset;
+
+ /* Assign all fields in the oneof this same offset. */
+ for (upb_oneof_begin(&fit, oneof); !upb_oneof_done(&fit);
+ upb_oneof_next(&fit)) {
+ const upb_fielddef* f = upb_oneof_iter_field(&fit);
+ l->field_offsets[upb_fielddef_index(f)] = val_offset;
+ }
}
/* Size of the entire structure should be a multiple of its greatest
- * alignment. TODO: track overall alignment for real? */
- l->data.size = align_up(l->data.size, 8);
+ * alignment. */
+ l->size = align_up(l->size, l->align);
- if (upb_msglayout_initdefault(l, m)) {
+ if (upb_msglayout_initdefault(l)) {
return l;
} else {
upb_msglayout_free(l);
@@ -4383,6 +3385,10 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) {
}
}
+upb_msgfactory *upb_msglayout_factory(const upb_msglayout *layout) {
+ return layout->factory;
+}
+
/** upb_msgfactory ************************************************************/
@@ -4439,6 +3445,7 @@ const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f,
upb_msglayout *l = upb_msglayout_new(m);
upb_inttable_insertptr(&mutable_f->layouts, m, upb_value_ptr(l));
UPB_ASSERT(l);
+ l->factory = f;
return l;
}
}
@@ -4447,15 +3454,16 @@ const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f,
void *upb_msg_startstr(void *msg, const void *hd, size_t size_hint) {
uint32_t ofs = (uintptr_t)hd;
- upb_alloc *alloc = upb_msg_alloc(msg);
+ /* We pass NULL here because we know we can get away with it. */
+ upb_alloc *alloc = upb_msg_alloc(msg, NULL);
upb_msgval val;
UPB_UNUSED(size_hint);
val = upb_msgval_read(msg, ofs, upb_msgval_sizeof(UPB_TYPE_STRING));
- upb_free(alloc, (void*)val.str.data);
- val.str.data = NULL;
- val.str.size = 0;
+ upb_free(alloc, (void*)val.str.ptr);
+ val.str.ptr = NULL;
+ val.str.len = 0;
upb_msgval_write(msg, ofs, val, upb_msgval_sizeof(UPB_TYPE_STRING));
return msg;
@@ -4464,22 +3472,23 @@ void *upb_msg_startstr(void *msg, const void *hd, size_t size_hint) {
size_t upb_msg_str(void *msg, const void *hd, const char *ptr, size_t size,
const upb_bufhandle *handle) {
uint32_t ofs = (uintptr_t)hd;
- upb_alloc *alloc = upb_msg_alloc(msg);
+ /* We pass NULL here because we know we can get away with it. */
+ upb_alloc *alloc = upb_msg_alloc(msg, NULL);
upb_msgval val;
size_t newsize;
UPB_UNUSED(handle);
val = upb_msgval_read(msg, ofs, upb_msgval_sizeof(UPB_TYPE_STRING));
- newsize = val.str.size + size;
- val.str.data = upb_realloc(alloc, (void*)val.str.data, val.str.size, newsize);
+ newsize = val.str.len + size;
+ val.str.ptr = upb_realloc(alloc, (void*)val.str.ptr, val.str.len, newsize);
- if (!val.str.data) {
+ if (!val.str.ptr) {
return false;
}
- memcpy((char*)val.str.data + val.str.size, ptr, size);
- val.str.size = newsize;
+ memcpy((char*)val.str.ptr + val.str.len, ptr, size);
+ val.str.len = newsize;
upb_msgval_write(msg, ofs, val, upb_msgval_sizeof(UPB_TYPE_STRING));
return size;
}
@@ -4544,14 +3553,13 @@ static upb_selector_t getsel2(const upb_fielddef *f, upb_handlertype_t type) {
static bool upb_visitor_hasfield(const upb_msg *msg, const upb_fielddef *f,
const upb_msglayout *layout) {
- int field_index = upb_fielddef_index(f);
if (upb_fielddef_isseq(f)) {
- return upb_msgval_getarr(upb_msg_get(msg, field_index, layout)) != NULL;
+ return upb_msgval_getarr(upb_msg_get(msg, f, layout)) != NULL;
} else if (upb_msgdef_syntax(upb_fielddef_containingtype(f)) ==
UPB_SYNTAX_PROTO2) {
- return upb_msg_has(msg, field_index, layout);
+ return upb_msg_has(msg, f, layout);
} else {
- upb_msgval val = upb_msg_get(msg, field_index, layout);
+ upb_msgval val = upb_msg_get(msg, f, layout);
switch (upb_fielddef_type(f)) {
case UPB_TYPE_FLOAT:
return upb_msgval_getfloat(val) != 0;
@@ -4570,7 +3578,7 @@ static bool upb_visitor_hasfield(const upb_msg *msg, const upb_fielddef *f,
return upb_msgval_getuint64(val) != 0;
case UPB_TYPE_STRING:
case UPB_TYPE_BYTES:
- return upb_msgval_getstr(val).size > 0;
+ return upb_msgval_getstr(val) && upb_msgval_getstrlen(val) > 0;
case UPB_TYPE_MESSAGE:
return upb_msgval_getmsg(val) != NULL;
}
@@ -4581,7 +3589,7 @@ static bool upb_visitor_hasfield(const upb_msg *msg, const upb_fielddef *f,
static bool upb_visitor_visitmsg2(const upb_msg *msg,
const upb_msglayout *layout, upb_sink *sink,
int depth) {
- const upb_msgdef *md = upb_handlers_msgdef(sink->handlers);
+ const upb_msgdef *md = upb_msglayout_msgdef(layout);
upb_msg_field_iter i;
upb_status status;
@@ -4603,7 +3611,7 @@ static bool upb_visitor_visitmsg2(const upb_msg *msg,
continue;
}
- val = upb_msg_get(msg, upb_fielddef_index(f), layout);
+ val = upb_msg_get(msg, f, layout);
if (upb_fielddef_isseq(f)) {
const upb_array *arr = upb_msgval_getarr(val);
@@ -4672,160 +3680,194 @@ bool upb_visitor_visitmsg(upb_visitor *visitor, const upb_msg *msg) {
/* If we always read/write as a consistent type to each address, this shouldn't
* violate aliasing.
*/
-#define DEREF(msg, ofs, type) *PTR_AT(msg, ofs, type)
+#define DEREF(msg, ofs, type) *(type*)CHARPTR_AT(msg, ofs)
-/* Internal members of a upb_msg. We can change this without breaking binary
- * compatibility. We put these before the user's data. The user's upb_msg*
- * points after the upb_msg_internal. */
+static upb_inttable *upb_msg_trygetextdict(const upb_msg *msg,
+ const upb_msglayout *l) {
+ return l->has_extdict ? DEREF(msg, l->extdict_offset, upb_inttable*) : NULL;
+}
-/* Used when a message is not extendable. */
-typedef struct {
- /* TODO(haberman): add unknown fields. */
- upb_alloc *alloc;
-} upb_msg_internal;
+static upb_inttable *upb_msg_getextdict(upb_msg *msg,
+ const upb_msglayout *l,
+ upb_alloc *a) {
+ upb_inttable *ext_dict;
+ UPB_ASSERT(l->has_extdict);
-/* Used when a message is extendable. */
-typedef struct {
- upb_inttable *extdict;
- upb_msg_internal base;
-} upb_msg_internal_withext;
+ ext_dict = upb_msg_trygetextdict(msg, l);
-static int upb_msg_internalsize(const upb_msglayout *l) {
- return sizeof(upb_msg_internal) - l->data.extendable * sizeof(void*);
-}
+ if (!ext_dict) {
+ ext_dict = upb_malloc(a, sizeof(upb_inttable));
-static upb_msg_internal *upb_msg_getinternal(upb_msg *msg) {
- return VOIDPTR_AT(msg, -sizeof(upb_msg_internal));
-}
+ if (!ext_dict) {
+ return NULL;
+ }
-static const upb_msg_internal *upb_msg_getinternal_const(const upb_msg *msg) {
- return VOIDPTR_AT(msg, -sizeof(upb_msg_internal));
-}
+ /* Use an 8-byte type to ensure all bytes are copied. */
+ if (!upb_inttable_init2(ext_dict, UPB_CTYPE_INT64, a)) {
+ upb_free(a, ext_dict);
+ return NULL;
+ }
-static upb_msg_internal_withext *upb_msg_getinternalwithext(
- upb_msg *msg, const upb_msglayout *l) {
- UPB_ASSERT(l->data.extendable);
- return VOIDPTR_AT(msg, -sizeof(upb_msg_internal_withext));
-}
+ DEREF(msg, l->extdict_offset, upb_inttable*) = ext_dict;
+ }
-static const upb_msglayout_fieldinit_v1 *upb_msg_checkfield(
- int field_index, const upb_msglayout *l) {
- UPB_ASSERT(field_index >= 0 && field_index < l->data.field_count);
- return &l->data.fields[field_index];
+ return ext_dict;
}
-static bool upb_msg_inoneof(const upb_msglayout_fieldinit_v1 *field) {
- return field->oneof_index != UPB_NOT_IN_ONEOF;
+static uint32_t upb_msg_getoneofint(const upb_msg *msg,
+ const upb_oneofdef *o,
+ const upb_msglayout *l) {
+ size_t oneof_ofs = l->case_offsets[upb_oneofdef_index(o)];
+ return DEREF(msg, oneof_ofs, uint8_t);
}
-static uint32_t *upb_msg_oneofcase(const upb_msg *msg, int field_index,
- const upb_msglayout *l) {
- const upb_msglayout_fieldinit_v1 *field = upb_msg_checkfield(field_index, l);
- UPB_ASSERT(upb_msg_inoneof(field));
- return PTR_AT(msg, l->data.oneofs[field->oneof_index].case_offset, uint32_t);
+static void upb_msg_setoneofcase(const upb_msg *msg,
+ const upb_oneofdef *o,
+ const upb_msglayout *l,
+ uint32_t val) {
+ size_t oneof_ofs = l->case_offsets[upb_oneofdef_index(o)];
+ DEREF(msg, oneof_ofs, uint8_t) = val;
}
-size_t upb_msg_sizeof(const upb_msglayout *l) {
- return l->data.size + upb_msg_internalsize(l);
+
+static bool upb_msg_oneofis(const upb_msg *msg, const upb_msglayout *l,
+ const upb_oneofdef *o, const upb_fielddef *f) {
+ return upb_msg_getoneofint(msg, o, l) == upb_fielddef_number(f);
}
-upb_msg *upb_msg_init(void *mem, const upb_msglayout *l, upb_alloc *a) {
- upb_msg *msg = VOIDPTR_AT(mem, upb_msg_internalsize(l));
+size_t upb_msg_sizeof(const upb_msglayout *l) { return l->size; }
- /* Initialize normal members. */
- if (l->data.default_msg) {
- memcpy(msg, l->data.default_msg, l->data.size);
+void upb_msg_init(upb_msg *msg, const upb_msglayout *l, upb_alloc *a) {
+ if (l->default_msg) {
+ memcpy(msg, l->default_msg, l->size);
} else {
- memset(msg, 0, l->data.size);
+ memset(msg, 0, l->size);
}
- /* Initialize internal members. */
- upb_msg_getinternal(msg)->alloc = a;
-
- if (l->data.extendable) {
- upb_msg_getinternalwithext(msg, l)->extdict = NULL;
- }
-
- return msg;
+ /* Set arena pointer. */
+ memcpy(msg, &a, sizeof(a));
}
-void *upb_msg_uninit(upb_msg *msg, const upb_msglayout *l) {
- if (l->data.extendable) {
- upb_inttable *ext_dict = upb_msg_getinternalwithext(msg, l)->extdict;
- if (ext_dict) {
- upb_inttable_uninit2(ext_dict, upb_msg_alloc(msg));
- upb_free(upb_msg_alloc(msg), ext_dict);
- }
+void upb_msg_uninit(upb_msg *msg, const upb_msglayout *l) {
+ upb_inttable *ext_dict = upb_msg_trygetextdict(msg, l);
+ if (ext_dict) {
+ upb_inttable_uninit2(ext_dict, upb_msg_alloc(msg, l));
}
-
- return VOIDPTR_AT(msg, -upb_msg_internalsize(l));
}
upb_msg *upb_msg_new(const upb_msglayout *l, upb_alloc *a) {
- void *mem = upb_malloc(a, upb_msg_sizeof(l));
- return mem ? upb_msg_init(mem, l, a) : NULL;
+ upb_msg *msg = upb_malloc(a, upb_msg_sizeof(l));
+
+ if (msg) {
+ upb_msg_init(msg, l, a);
+ }
+
+ return msg;
}
void upb_msg_free(upb_msg *msg, const upb_msglayout *l) {
- upb_free(upb_msg_alloc(msg), upb_msg_uninit(msg, l));
+ upb_msg_uninit(msg, l);
+ upb_free(upb_msg_alloc(msg, l), msg);
}
-upb_alloc *upb_msg_alloc(const upb_msg *msg) {
- return upb_msg_getinternal_const(msg)->alloc;
+upb_alloc *upb_msg_alloc(const upb_msg *msg, const upb_msglayout *l) {
+ upb_alloc *alloc;
+ UPB_UNUSED(l);
+ memcpy(&alloc, msg, sizeof(alloc));
+ return alloc;
}
bool upb_msg_has(const upb_msg *msg,
- int field_index,
+ const upb_fielddef *f,
const upb_msglayout *l) {
- const upb_msglayout_fieldinit_v1 *field = upb_msg_checkfield(field_index, l);
-
- UPB_ASSERT(l->data.is_proto2);
+ const upb_oneofdef *o;
+ upb_msg_checkfield(l, f);
+ UPB_ASSERT(upb_fielddef_haspresence(f));
- if (upb_msg_inoneof(field)) {
+ if (upb_fielddef_isextension(f)) {
+ /* Extensions are set when they are present in the extension dict. */
+ upb_inttable *ext_dict = upb_msg_trygetextdict(msg, l);
+ upb_value v;
+ return ext_dict != NULL &&
+ upb_inttable_lookup32(ext_dict, upb_fielddef_number(f), &v);
+ } else if ((o = upb_fielddef_containingoneof(f)) != NULL) {
/* Oneofs are set when the oneof number is set to this field. */
- return *upb_msg_oneofcase(msg, field_index, l) == field->number;
+ return upb_msg_getoneofint(msg, o, l) == upb_fielddef_number(f);
} else {
/* Other fields are set when their hasbit is set. */
- uint32_t hasbit = l->data.fields[field_index].hasbit;
+ uint32_t hasbit = l->hasbits[upb_fielddef_index(f)];
return DEREF(msg, hasbit / 8, char) | (1 << (hasbit % 8));
}
}
-upb_msgval upb_msg_get(const upb_msg *msg, int field_index,
+upb_msgval upb_msg_get(const upb_msg *msg, const upb_fielddef *f,
const upb_msglayout *l) {
- const upb_msglayout_fieldinit_v1 *field = upb_msg_checkfield(field_index, l);
- int size = upb_msg_fieldsize(field);
+ upb_msg_checkfield(l, f);
- if (upb_msg_inoneof(field)) {
- if (*upb_msg_oneofcase(msg, field_index, l) == field->number) {
- size_t ofs = l->data.oneofs[field->oneof_index].data_offset;
- return upb_msgval_read(msg, ofs, size);
+ if (upb_fielddef_isextension(f)) {
+ upb_inttable *ext_dict = upb_msg_trygetextdict(msg, l);
+ upb_value val;
+ if (upb_inttable_lookup32(ext_dict, upb_fielddef_number(f), &val)) {
+ return upb_msgval_fromval(val);
} else {
- /* Return default. */
- return upb_msgval_read(l->data.default_msg, field->offset, size);
+ return upb_msgval_fromdefault(f);
}
} else {
- return upb_msgval_read(msg, field->offset, size);
+ size_t ofs = l->field_offsets[upb_fielddef_index(f)];
+ const upb_oneofdef *o = upb_fielddef_containingoneof(f);
+ upb_msgval ret;
+
+ if (o && !upb_msg_oneofis(msg, l, o, f)) {
+ /* Oneof defaults can't come from the message because the memory is reused
+ * by all types in the oneof. */
+ return upb_msgval_fromdefault(f);
+ }
+
+ ret = upb_msgval_read(msg, ofs, upb_msg_fieldsize(f));
+ return ret;
}
}
-void upb_msg_set(upb_msg *msg, int field_index, upb_msgval val,
+bool upb_msg_set(upb_msg *msg,
+ const upb_fielddef *f,
+ upb_msgval val,
const upb_msglayout *l) {
- const upb_msglayout_fieldinit_v1 *field = upb_msg_checkfield(field_index, l);
- int size = upb_msg_fieldsize(field);
-
- if (upb_msg_inoneof(field)) {
- size_t ofs = l->data.oneofs[field->oneof_index].data_offset;
- *upb_msg_oneofcase(msg, field_index, l) = field->number;
- upb_msgval_write(msg, ofs, val, size);
+ upb_alloc *a = upb_msg_alloc(msg, l);
+ upb_msg_checkfield(l, f);
+
+ if (upb_fielddef_isextension(f)) {
+ /* TODO(haberman): introduce table API that can do this in one call. */
+ upb_inttable *ext = upb_msg_getextdict(msg, l, a);
+ upb_value val2 = upb_toval(val);
+ if (!upb_inttable_replace(ext, upb_fielddef_number(f), val2) &&
+ !upb_inttable_insert2(ext, upb_fielddef_number(f), val2, a)) {
+ return false;
+ }
} else {
- upb_msgval_write(msg, field->offset, val, size);
+ size_t ofs = l->field_offsets[upb_fielddef_index(f)];
+ const upb_oneofdef *o = upb_fielddef_containingoneof(f);
+
+ if (o) {
+ upb_msg_setoneofcase(msg, o, l, upb_fielddef_number(f));
+ }
+
+ upb_msgval_write(msg, ofs, val, upb_msg_fieldsize(f));
}
+ return true;
}
/** upb_array *****************************************************************/
+struct upb_array {
+ upb_fieldtype_t type;
+ uint8_t element_size;
+ void *data; /* Each element is element_size. */
+ size_t len; /* Measured in elements. */
+ size_t size; /* Measured in elements. */
+ upb_alloc *alloc;
+};
+
#define DEREF_ARR(arr, i, type) ((type*)arr->data)[i]
size_t upb_array_sizeof(upb_fieldtype_t type) {
@@ -4920,8 +3962,8 @@ static void upb_map_tokey(upb_fieldtype_t type, upb_msgval *key,
switch (type) {
case UPB_TYPE_STRING:
/* Point to string data of the input key. */
- *out_key = key->str.data;
- *out_len = key->str.size;
+ *out_key = key->str.ptr;
+ *out_len = key->str.len;
return;
case UPB_TYPE_BOOL:
case UPB_TYPE_INT32:
@@ -4946,7 +3988,7 @@ static upb_msgval upb_map_fromkey(upb_fieldtype_t type, const char *key,
size_t len) {
switch (type) {
case UPB_TYPE_STRING:
- return upb_msgval_makestr(key, len);
+ return upb_msgval_str(key, len);
case UPB_TYPE_BOOL:
case UPB_TYPE_INT32:
case UPB_TYPE_UINT32:
@@ -7406,138 +6448,138 @@ static upb_inttable reftables[268];
#endif
static const upb_msgdef msgs[22] = {
- UPB_MSGDEF_INIT("google.protobuf.DescriptorProto", 41, 8, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[0], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[0]), false, UPB_SYNTAX_PROTO2, &reftables[0], &reftables[1]),
- UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ExtensionRange", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[11], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[16]), false, UPB_SYNTAX_PROTO2, &reftables[2], &reftables[3]),
- UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ReservedRange", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[14], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[20]), false, UPB_SYNTAX_PROTO2, &reftables[4], &reftables[5]),
- UPB_MSGDEF_INIT("google.protobuf.EnumDescriptorProto", 12, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[17], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[24]), false, UPB_SYNTAX_PROTO2, &reftables[6], &reftables[7]),
- UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 9, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[0], &arrays[21], 4, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[28]), false, UPB_SYNTAX_PROTO2, &reftables[8], &reftables[9]),
- UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 9, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[25], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[32]), false, UPB_SYNTAX_PROTO2, &reftables[10], &reftables[11]),
- UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[2], &arrays[29], 2, 1), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[36]), false, UPB_SYNTAX_PROTO2, &reftables[12], &reftables[13]),
- UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 24, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[31], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[40]), false, UPB_SYNTAX_PROTO2, &reftables[14], &reftables[15]),
- UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 13, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[4], &arrays[42], 11, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[56]), false, UPB_SYNTAX_PROTO2, &reftables[16], &reftables[17]),
- UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 43, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[53], 13, 12), UPB_STRTABLE_INIT(12, 15, UPB_CTYPE_PTR, 4, &strentries[72]), false, UPB_SYNTAX_PROTO2, &reftables[18], &reftables[19]),
- UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 7, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[66], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[88]), false, UPB_SYNTAX_PROTO2, &reftables[20], &reftables[21]),
- UPB_MSGDEF_INIT("google.protobuf.FileOptions", 38, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 42, 17), UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]),
- UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 11, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[110], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]),
- UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 16, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[118], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]),
- UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 8, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[125], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]),
- UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[126], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]),
- UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 12, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[128], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]),
- UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 8, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[132], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]),
- UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 7, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[133], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]),
- UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 20, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[135], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]),
- UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 19, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[142], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]),
- UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 7, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[151], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]),
+ UPB_MSGDEF_INIT("google.protobuf.DescriptorProto", 40, 8, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[0], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[0]), false, UPB_SYNTAX_PROTO2, &reftables[0], &reftables[1]),
+ UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ExtensionRange", 4, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[11], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[16]), false, UPB_SYNTAX_PROTO2, &reftables[2], &reftables[3]),
+ UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ReservedRange", 4, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[14], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[20]), false, UPB_SYNTAX_PROTO2, &reftables[4], &reftables[5]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[17], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[24]), false, UPB_SYNTAX_PROTO2, &reftables[6], &reftables[7]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[0], &arrays[21], 4, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[28]), false, UPB_SYNTAX_PROTO2, &reftables[8], &reftables[9]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 8, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[25], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[32]), false, UPB_SYNTAX_PROTO2, &reftables[10], &reftables[11]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 7, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[2], &arrays[29], 2, 1), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[36]), false, UPB_SYNTAX_PROTO2, &reftables[12], &reftables[13]),
+ UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 23, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[31], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[40]), false, UPB_SYNTAX_PROTO2, &reftables[14], &reftables[15]),
+ UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 12, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[4], &arrays[42], 11, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[56]), false, UPB_SYNTAX_PROTO2, &reftables[16], &reftables[17]),
+ UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 42, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[53], 13, 12), UPB_STRTABLE_INIT(12, 15, UPB_CTYPE_PTR, 4, &strentries[72]), false, UPB_SYNTAX_PROTO2, &reftables[18], &reftables[19]),
+ UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[66], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[88]), false, UPB_SYNTAX_PROTO2, &reftables[20], &reftables[21]),
+ UPB_MSGDEF_INIT("google.protobuf.FileOptions", 37, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 42, 17), UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]),
+ UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 10, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[110], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]),
+ UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 15, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[118], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]),
+ UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[125], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]),
+ UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[126], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]),
+ UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[128], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]),
+ UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[132], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]),
+ UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[133], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]),
+ UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 19, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[135], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]),
+ UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[142], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]),
+ UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[151], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]),
};
static const upb_fielddef fields[107] = {
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "aggregate_value", 8, &msgs[20], NULL, 16, 6, {0},&reftables[44], &reftables[45]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "allow_alias", 2, &msgs[4], NULL, 7, 1, {0},&reftables[46], &reftables[47]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_enable_arenas", 31, &msgs[11], NULL, 24, 12, {0},&reftables[48], &reftables[49]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_generic_services", 16, &msgs[11], NULL, 18, 6, {0},&reftables[50], &reftables[51]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "client_streaming", 5, &msgs[13], NULL, 14, 4, {0},&reftables[52], &reftables[53]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "csharp_namespace", 37, &msgs[11], NULL, 28, 14, {0},&reftables[54], &reftables[55]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "ctype", 1, &msgs[8], (const upb_def*)(&enums[2]), 7, 1, {0},&reftables[56], &reftables[57]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "default_value", 7, &msgs[7], NULL, 17, 7, {0},&reftables[58], &reftables[59]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "dependency", 3, &msgs[9], NULL, 31, 8, {0},&reftables[60], &reftables[61]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 9, 3, {0},&reftables[62], &reftables[63]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 7, 1, {0},&reftables[64], &reftables[65]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 9, 3, {0},&reftables[66], &reftables[67]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 23, &msgs[11], NULL, 22, 10, {0},&reftables[68], &reftables[69]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 7, 1, {0},&reftables[70], &reftables[71]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 8, 2, {0},&reftables[72], &reftables[73]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 7, 1, {0},&reftables[74], &reftables[75]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, false, "double_value", 6, &msgs[20], NULL, 12, 4, {0},&reftables[76], &reftables[77]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[2], NULL, 4, 1, {0},&reftables[78], &reftables[79]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[1], NULL, 4, 1, {0},&reftables[80], &reftables[81]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 14, 1, {0},&reftables[82], &reftables[83]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 19, 2, {0},&reftables[84], &reftables[85]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "extendee", 2, &msgs[7], NULL, 8, 2, {0},&reftables[86], &reftables[87]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 6, &msgs[0], (const upb_def*)(&msgs[7]), 25, 4, {0},&reftables[88], &reftables[89]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 7, &msgs[9], (const upb_def*)(&msgs[7]), 20, 3, {0},&reftables[90], &reftables[91]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension_range", 5, &msgs[0], (const upb_def*)(&msgs[1]), 22, 3, {0},&reftables[92], &reftables[93]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "field", 2, &msgs[0], (const upb_def*)(&msgs[7]), 13, 0, {0},&reftables[94], &reftables[95]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "file", 1, &msgs[10], (const upb_def*)(&msgs[9]), 6, 0, {0},&reftables[96], &reftables[97]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "go_package", 11, &msgs[11], NULL, 15, 5, {0},&reftables[98], &reftables[99]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "identifier_value", 3, &msgs[20], NULL, 7, 1, {0},&reftables[100], &reftables[101]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "input_type", 2, &msgs[13], NULL, 8, 2, {0},&reftables[102], &reftables[103]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, false, false, "is_extension", 2, &msgs[21], NULL, 6, 1, {0},&reftables[104], &reftables[105]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generate_equals_and_hash", 20, &msgs[11], NULL, 21, 9, {0},&reftables[106], &reftables[107]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generic_services", 17, &msgs[11], NULL, 19, 7, {0},&reftables[108], &reftables[109]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_multiple_files", 10, &msgs[11], NULL, 14, 4, {0},&reftables[110], &reftables[111]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_outer_classname", 8, &msgs[11], NULL, 10, 2, {0},&reftables[112], &reftables[113]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_package", 1, &msgs[11], NULL, 7, 1, {0},&reftables[114], &reftables[115]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_string_check_utf8", 27, &msgs[11], NULL, 23, 11, {0},&reftables[116], &reftables[117]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "javanano_use_deprecated_package", 38, &msgs[11], NULL, 31, 15, {0},&reftables[118], &reftables[119]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "json_name", 10, &msgs[7], NULL, 21, 9, {0},&reftables[120], &reftables[121]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "jstype", 6, &msgs[8], (const upb_def*)(&enums[3]), 11, 5, {0},&reftables[122], &reftables[123]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "label", 4, &msgs[7], (const upb_def*)(&enums[0]), 12, 4, {0},&reftables[124], &reftables[125]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "lazy", 5, &msgs[8], NULL, 10, 4, {0},&reftables[126], &reftables[127]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "leading_comments", 3, &msgs[19], NULL, 9, 2, {0},&reftables[128], &reftables[129]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "leading_detached_comments", 6, &msgs[19], NULL, 17, 4, {0},&reftables[130], &reftables[131]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "location", 1, &msgs[18], (const upb_def*)(&msgs[19]), 6, 0, {0},&reftables[132], &reftables[133]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "map_entry", 7, &msgs[12], NULL, 10, 4, {0},&reftables[134], &reftables[135]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "message_set_wire_format", 1, &msgs[12], NULL, 7, 1, {0},&reftables[136], &reftables[137]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "message_type", 4, &msgs[9], (const upb_def*)(&msgs[0]), 11, 0, {0},&reftables[138], &reftables[139]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "method", 2, &msgs[16], (const upb_def*)(&msgs[13]), 7, 0, {0},&reftables[140], &reftables[141]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 6, 0, {0},&reftables[142], &reftables[143]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 5, 1, {0},&reftables[144], &reftables[145]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 23, 6, {0},&reftables[146], &reftables[147]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 9, 2, {0},&reftables[148], &reftables[149]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 9, 2, {0},&reftables[150], &reftables[151]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 3, 0, {0},&reftables[152], &reftables[153]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 5, 1, {0},&reftables[154], &reftables[155]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 5, 1, {0},&reftables[156], &reftables[157]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 33, 8, {0},&reftables[158], &reftables[159]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, false, "name_part", 1, &msgs[21], NULL, 3, 0, {0},&reftables[160], &reftables[161]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, false, "negative_int_value", 5, &msgs[20], NULL, 11, 3, {0},&reftables[162], &reftables[163]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "nested_type", 3, &msgs[0], (const upb_def*)(&msgs[0]), 16, 1, {0},&reftables[164], &reftables[165]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "no_standard_descriptor_accessor", 2, &msgs[12], NULL, 8, 2, {0},&reftables[166], &reftables[167]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 11, 3, {0},&reftables[168], &reftables[169]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 8, 2, {0},&reftables[170], &reftables[171]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "objc_class_prefix", 36, &msgs[11], NULL, 25, 13, {0},&reftables[172], &reftables[173]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "oneof_decl", 8, &msgs[0], (const upb_def*)(&msgs[15]), 29, 6, {0},&reftables[174], &reftables[175]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "oneof_index", 9, &msgs[7], NULL, 20, 8, {0},&reftables[176], &reftables[177]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "optimize_for", 9, &msgs[11], (const upb_def*)(&enums[4]), 13, 3, {0},&reftables[178], &reftables[179]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 26, 5, {0},&reftables[180], &reftables[181]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 21, 4, {0},&reftables[182], &reftables[183]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 4, 0, {0},&reftables[184], &reftables[185]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 4, 0, {0},&reftables[186], &reftables[187]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 8, 1, {0},&reftables[188], &reftables[189]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 8, 1, {0},&reftables[190], &reftables[191]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 4, 0, {0},&reftables[192], &reftables[193]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "output_type", 3, &msgs[13], NULL, 11, 3, {0},&reftables[194], &reftables[195]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "package", 2, &msgs[9], NULL, 26, 7, {0},&reftables[196], &reftables[197]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "packed", 2, &msgs[8], NULL, 8, 2, {0},&reftables[198], &reftables[199]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "path", 1, &msgs[19], NULL, 5, 0, {0},&reftables[200], &reftables[201]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_class_prefix", 40, &msgs[11], NULL, 32, 16, {0},&reftables[202], &reftables[203]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_namespace", 41, &msgs[11], NULL, 35, 17, {0},&reftables[204], &reftables[205]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 10, 2, {0},&reftables[206], &reftables[207]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 36, 9, {0},&reftables[208], &reftables[209]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 20, 8, {0},&reftables[210], &reftables[211]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 38, 9, {0},&reftables[212], &reftables[213]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 32, 7, {0},&reftables[214], &reftables[215]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 15, 5, {0},&reftables[216], &reftables[217]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 17, 2, {0},&reftables[218], &reftables[219]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 22, 5, {0},&reftables[220], &reftables[221]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 8, 1, {0},&reftables[222], &reftables[223]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 3, 0, {0},&reftables[224], &reftables[225]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 3, 0, {0},&reftables[226], &reftables[227]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 13, 5, {0},&reftables[228], &reftables[229]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 40, 11, {0},&reftables[230], &reftables[231]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 12, 3, {0},&reftables[232], &reftables[233]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 13, 5, {0},&reftables[234], &reftables[235]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 14, 6, {0},&reftables[236], &reftables[237]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[238], &reftables[239]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[240], &reftables[241]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[242], &reftables[243]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[244], &reftables[245]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[246], &reftables[247]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[248], &reftables[249]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[250], &reftables[251]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 7, 0, {0},&reftables[252], &reftables[253]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 12, 6, {0},&reftables[254], &reftables[255]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 39, 10, {0},&reftables[256], &reftables[257]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "aggregate_value", 8, &msgs[20], NULL, 15, 6, {0},&reftables[44], &reftables[45]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "allow_alias", 2, &msgs[4], NULL, 6, 1, {0},&reftables[46], &reftables[47]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_enable_arenas", 31, &msgs[11], NULL, 23, 12, {0},&reftables[48], &reftables[49]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_generic_services", 16, &msgs[11], NULL, 17, 6, {0},&reftables[50], &reftables[51]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "client_streaming", 5, &msgs[13], NULL, 13, 4, {0},&reftables[52], &reftables[53]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "csharp_namespace", 37, &msgs[11], NULL, 27, 14, {0},&reftables[54], &reftables[55]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "ctype", 1, &msgs[8], (const upb_def*)(&enums[2]), 6, 1, {0},&reftables[56], &reftables[57]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "default_value", 7, &msgs[7], NULL, 16, 7, {0},&reftables[58], &reftables[59]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "dependency", 3, &msgs[9], NULL, 30, 8, {0},&reftables[60], &reftables[61]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 8, 3, {0},&reftables[62], &reftables[63]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 6, 1, {0},&reftables[64], &reftables[65]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 8, 3, {0},&reftables[66], &reftables[67]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 23, &msgs[11], NULL, 21, 10, {0},&reftables[68], &reftables[69]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 6, 1, {0},&reftables[70], &reftables[71]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 7, 2, {0},&reftables[72], &reftables[73]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 6, 1, {0},&reftables[74], &reftables[75]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, false, "double_value", 6, &msgs[20], NULL, 11, 4, {0},&reftables[76], &reftables[77]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[2], NULL, 3, 1, {0},&reftables[78], &reftables[79]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[1], NULL, 3, 1, {0},&reftables[80], &reftables[81]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 13, 1, {0},&reftables[82], &reftables[83]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 18, 2, {0},&reftables[84], &reftables[85]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "extendee", 2, &msgs[7], NULL, 7, 2, {0},&reftables[86], &reftables[87]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 6, &msgs[0], (const upb_def*)(&msgs[7]), 24, 4, {0},&reftables[88], &reftables[89]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 7, &msgs[9], (const upb_def*)(&msgs[7]), 19, 3, {0},&reftables[90], &reftables[91]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension_range", 5, &msgs[0], (const upb_def*)(&msgs[1]), 21, 3, {0},&reftables[92], &reftables[93]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "field", 2, &msgs[0], (const upb_def*)(&msgs[7]), 12, 0, {0},&reftables[94], &reftables[95]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "file", 1, &msgs[10], (const upb_def*)(&msgs[9]), 5, 0, {0},&reftables[96], &reftables[97]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "go_package", 11, &msgs[11], NULL, 14, 5, {0},&reftables[98], &reftables[99]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "identifier_value", 3, &msgs[20], NULL, 6, 1, {0},&reftables[100], &reftables[101]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "input_type", 2, &msgs[13], NULL, 7, 2, {0},&reftables[102], &reftables[103]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, false, false, "is_extension", 2, &msgs[21], NULL, 5, 1, {0},&reftables[104], &reftables[105]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generate_equals_and_hash", 20, &msgs[11], NULL, 20, 9, {0},&reftables[106], &reftables[107]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generic_services", 17, &msgs[11], NULL, 18, 7, {0},&reftables[108], &reftables[109]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_multiple_files", 10, &msgs[11], NULL, 13, 4, {0},&reftables[110], &reftables[111]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_outer_classname", 8, &msgs[11], NULL, 9, 2, {0},&reftables[112], &reftables[113]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_package", 1, &msgs[11], NULL, 6, 1, {0},&reftables[114], &reftables[115]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_string_check_utf8", 27, &msgs[11], NULL, 22, 11, {0},&reftables[116], &reftables[117]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "javanano_use_deprecated_package", 38, &msgs[11], NULL, 30, 15, {0},&reftables[118], &reftables[119]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "json_name", 10, &msgs[7], NULL, 20, 9, {0},&reftables[120], &reftables[121]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "jstype", 6, &msgs[8], (const upb_def*)(&enums[3]), 10, 5, {0},&reftables[122], &reftables[123]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "label", 4, &msgs[7], (const upb_def*)(&enums[0]), 11, 4, {0},&reftables[124], &reftables[125]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "lazy", 5, &msgs[8], NULL, 9, 4, {0},&reftables[126], &reftables[127]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "leading_comments", 3, &msgs[19], NULL, 8, 2, {0},&reftables[128], &reftables[129]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "leading_detached_comments", 6, &msgs[19], NULL, 16, 4, {0},&reftables[130], &reftables[131]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "location", 1, &msgs[18], (const upb_def*)(&msgs[19]), 5, 0, {0},&reftables[132], &reftables[133]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "map_entry", 7, &msgs[12], NULL, 9, 4, {0},&reftables[134], &reftables[135]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "message_set_wire_format", 1, &msgs[12], NULL, 6, 1, {0},&reftables[136], &reftables[137]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "message_type", 4, &msgs[9], (const upb_def*)(&msgs[0]), 10, 0, {0},&reftables[138], &reftables[139]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "method", 2, &msgs[16], (const upb_def*)(&msgs[13]), 6, 0, {0},&reftables[140], &reftables[141]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 5, 0, {0},&reftables[142], &reftables[143]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 4, 1, {0},&reftables[144], &reftables[145]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 22, 6, {0},&reftables[146], &reftables[147]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 8, 2, {0},&reftables[148], &reftables[149]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 8, 2, {0},&reftables[150], &reftables[151]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 2, 0, {0},&reftables[152], &reftables[153]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 4, 1, {0},&reftables[154], &reftables[155]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 4, 1, {0},&reftables[156], &reftables[157]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 32, 8, {0},&reftables[158], &reftables[159]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, false, "name_part", 1, &msgs[21], NULL, 2, 0, {0},&reftables[160], &reftables[161]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, false, "negative_int_value", 5, &msgs[20], NULL, 10, 3, {0},&reftables[162], &reftables[163]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "nested_type", 3, &msgs[0], (const upb_def*)(&msgs[0]), 15, 1, {0},&reftables[164], &reftables[165]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "no_standard_descriptor_accessor", 2, &msgs[12], NULL, 7, 2, {0},&reftables[166], &reftables[167]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 10, 3, {0},&reftables[168], &reftables[169]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 7, 2, {0},&reftables[170], &reftables[171]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "objc_class_prefix", 36, &msgs[11], NULL, 24, 13, {0},&reftables[172], &reftables[173]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "oneof_decl", 8, &msgs[0], (const upb_def*)(&msgs[15]), 28, 6, {0},&reftables[174], &reftables[175]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "oneof_index", 9, &msgs[7], NULL, 19, 8, {0},&reftables[176], &reftables[177]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "optimize_for", 9, &msgs[11], (const upb_def*)(&enums[4]), 12, 3, {0},&reftables[178], &reftables[179]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 25, 5, {0},&reftables[180], &reftables[181]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 20, 4, {0},&reftables[182], &reftables[183]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 3, 0, {0},&reftables[184], &reftables[185]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 3, 0, {0},&reftables[186], &reftables[187]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 7, 1, {0},&reftables[188], &reftables[189]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 7, 1, {0},&reftables[190], &reftables[191]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 3, 0, {0},&reftables[192], &reftables[193]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "output_type", 3, &msgs[13], NULL, 10, 3, {0},&reftables[194], &reftables[195]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "package", 2, &msgs[9], NULL, 25, 7, {0},&reftables[196], &reftables[197]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "packed", 2, &msgs[8], NULL, 7, 2, {0},&reftables[198], &reftables[199]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "path", 1, &msgs[19], NULL, 4, 0, {0},&reftables[200], &reftables[201]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_class_prefix", 40, &msgs[11], NULL, 31, 16, {0},&reftables[202], &reftables[203]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_namespace", 41, &msgs[11], NULL, 34, 17, {0},&reftables[204], &reftables[205]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 9, 2, {0},&reftables[206], &reftables[207]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 35, 9, {0},&reftables[208], &reftables[209]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 19, 8, {0},&reftables[210], &reftables[211]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 37, 9, {0},&reftables[212], &reftables[213]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 31, 7, {0},&reftables[214], &reftables[215]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 14, 5, {0},&reftables[216], &reftables[217]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 16, 2, {0},&reftables[218], &reftables[219]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 21, 5, {0},&reftables[220], &reftables[221]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 7, 1, {0},&reftables[222], &reftables[223]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 2, 0, {0},&reftables[224], &reftables[225]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 2, 0, {0},&reftables[226], &reftables[227]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 12, 5, {0},&reftables[228], &reftables[229]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 39, 11, {0},&reftables[230], &reftables[231]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 11, 3, {0},&reftables[232], &reftables[233]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 12, 5, {0},&reftables[234], &reftables[235]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 13, 6, {0},&reftables[236], &reftables[237]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[238], &reftables[239]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[240], &reftables[241]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[242], &reftables[243]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[244], &reftables[245]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[246], &reftables[247]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[248], &reftables[249]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[250], &reftables[251]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 6, 0, {0},&reftables[252], &reftables[253]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 11, 6, {0},&reftables[254], &reftables[255]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 38, 10, {0},&reftables[256], &reftables[257]),
};
static const upb_enumdef enums[5] = {
@@ -8356,7 +7398,6 @@ typedef struct {
struct upb_descreader {
upb_sink sink;
upb_inttable files;
- upb_strtable files_by_name;
upb_filedef *file; /* The last file in files. */
upb_descreader_frame stack[UPB_MAX_MESSAGE_NESTING];
int stack_len;
@@ -8523,7 +7564,6 @@ static size_t file_onname(void *closure, const void *hd, const char *buf,
UPB_UNUSED(handle);
name = upb_gstrndup(buf, n);
- upb_strtable_insert(&r->files_by_name, name, upb_value_ptr(r->file));
/* XXX: see comment at the top of the file. */
ok = upb_filedef_setname(r->file, name, NULL);
upb_gfree(name);
@@ -8547,18 +7587,6 @@ static size_t file_onpackage(void *closure, const void *hd, const char *buf,
return n;
}
-static void *file_startphpnamespace(void *closure, const void *hd,
- size_t size_hint) {
- upb_descreader *r = closure;
- bool ok;
- UPB_UNUSED(hd);
- UPB_UNUSED(size_hint);
-
- ok = upb_filedef_setphpnamespace(r->file, "", NULL);
- UPB_ASSERT(ok);
- return closure;
-}
-
static size_t file_onphpnamespace(void *closure, const void *hd,
const char *buf, size_t n,
const upb_bufhandle *handle) {
@@ -8637,18 +7665,6 @@ static void *file_startext(void *closure, const void *hd) {
return r;
}
-static size_t file_ondep(void *closure, const void *hd, const char *buf,
- size_t n, const upb_bufhandle *handle) {
- upb_descreader *r = closure;
- upb_value val;
- if (upb_strtable_lookup2(&r->files_by_name, buf, n, &val)) {
- upb_filedef_adddep(r->file, upb_value_getptr(val));
- }
- UPB_UNUSED(hd);
- UPB_UNUSED(handle);
- return n;
-}
-
/** Handlers for google.protobuf.EnumValueDescriptorProto. *********************/
static bool enumval_startmsg(void *closure, const void *hd) {
@@ -9093,8 +8109,6 @@ static void reghandlers(const void *closure, upb_handlers *h) {
&file_startenum, NULL);
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, extension),
&file_startext, NULL);
- upb_handlers_setstring(h, F(FileDescriptorProto, dependency),
- &file_ondep, NULL);
} else if (upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)) {
upb_handlers_setstartmsg(h, &enumval_startmsg, NULL);
upb_handlers_setendmsg(h, &enumval_endmsg, NULL);
@@ -9133,8 +8147,6 @@ static void reghandlers(const void *closure, upb_handlers *h) {
} else if (upbdefs_google_protobuf_FileOptions_is(m)) {
upb_handlers_setstring(h, F(FileOptions, php_class_prefix),
&file_onphpprefix, NULL);
- upb_handlers_setstartstr(h, F(FileOptions, php_namespace),
- &file_startphpnamespace, NULL);
upb_handlers_setstring(h, F(FileOptions, php_namespace),
&file_onphpnamespace, NULL);
}
@@ -9154,7 +8166,6 @@ void descreader_cleanup(void *_r) {
upb_gfree(r->name);
upb_inttable_uninit(&r->files);
- upb_strtable_uninit(&r->files_by_name);
upb_inttable_uninit(&r->oneofs);
upb_gfree(r->default_string);
while (r->stack_len > 0) {
@@ -9173,7 +8184,6 @@ upb_descreader *upb_descreader_create(upb_env *e, const upb_handlers *h) {
}
upb_inttable_init(&r->files, UPB_CTYPE_PTR);
- upb_strtable_init(&r->files_by_name, UPB_CTYPE_PTR);
upb_inttable_init(&r->oneofs, UPB_CTYPE_PTR);
upb_sink_reset(upb_descreader_input(r), h, r);
r->stack_len = 0;
@@ -9473,7 +8483,7 @@ static void put32(compiler *c, uint32_t v) {
*c->pc++ = v;
}
-static void putop(compiler *c, int op, ...) {
+static void putop(compiler *c, opcode op, ...) {
va_list ap;
va_start(ap, op);
@@ -10756,6 +9766,7 @@ have_tag:
return upb_pbdecoder_suspend(d);
}
+ /* TODO: deliver to unknown field callback. */
switch (wire_type) {
case UPB_WIRE_TYPE_32BIT:
CHECK_RETURN(skip(d, 4));
@@ -10793,8 +9804,6 @@ have_tag:
}
if (d->top->groupnum >= 0) {
- /* TODO: More code needed for handling unknown groups. */
- upb_sink_putunknown(&d->top->sink, d->checkpoint, d->ptr - d->checkpoint);
return DECODE_OK;
}
@@ -11650,12 +10659,6 @@ static void *encode_startdelimfield(void *c, const void *hd) {
return ok ? c : UPB_BREAK;
}
-static bool encode_unknown(void *c, const void *hd, const char *buf,
- size_t len) {
- UPB_UNUSED(hd);
- return encode_bytes(c, buf, len) && commit(c);
-}
-
static bool encode_enddelimfield(void *c, const void *hd) {
UPB_UNUSED(hd);
return end_delim(c);
@@ -11718,7 +10721,6 @@ static void newhandlers_callback(const void *closure, upb_handlers *h) {
upb_handlers_setstartmsg(h, startmsg, NULL);
upb_handlers_setendmsg(h, endmsg, NULL);
- upb_handlers_setunknown(h, encode_unknown, NULL);
m = upb_handlers_msgdef(h);
for(upb_msg_field_begin(&i, m);
@@ -12928,21 +11930,15 @@ static bool end_number(upb_json_parser *p, const char *ptr) {
return parse_number(p, false);
}
-/* |buf| is NULL-terminated. |buf| itself will never include quotes;
- * |is_quoted| tells us whether this text originally appeared inside quotes. */
static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
- bool is_quoted) {
- size_t len = strlen(buf);
- const char *bufend = buf + len;
+ const char *bufend, bool is_quoted) {
+ size_t len = bufend - buf;
char *end;
upb_fieldtype_t type = upb_fielddef_type(p->top->f);
double val;
double dummy;
- double inf = 1.0 / 0.0; /* C89 does not have an INFINITY macro. */
-
- errno = 0;
- if (len == 0 || buf[0] == ' ') {
+ if (buf[0] == ' ') {
return false;
}
@@ -13001,15 +11997,15 @@ static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
}
if (type != UPB_TYPE_DOUBLE && type != UPB_TYPE_FLOAT && is_quoted) {
- /* Quoted numbers for integer types are not allowed to be in double form. */
+ /* Quoted numbers shouldn't support double forms for integer types. */
return false;
}
if (len == strlen("Infinity") && strcmp(buf, "Infinity") == 0) {
/* C89 does not have an INFINITY macro. */
- val = inf;
+ val = 1.0 / 0.0;
} else if (len == strlen("-Infinity") && strcmp(buf, "-Infinity") == 0) {
- val = -inf;
+ val = -1.0 / 0.0;
} else {
val = strtod(buf, &end);
if (errno == ERANGE || end != bufend) {
@@ -13018,29 +12014,28 @@ static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
}
switch (type) {
-#define CASE(capitaltype, smalltype, ctype, min, max) \
+#define CASE(capitaltype, smalltype, min, max) \
case UPB_TYPE_ ## capitaltype: { \
if (modf(val, &dummy) != 0 || val > max || val < min) { \
return false; \
} else { \
- upb_sink_put ## smalltype(&p->top->sink, parser_getsel(p), \
- (ctype)val); \
+ upb_sink_put ## smalltype(&p->top->sink, parser_getsel(p), val); \
return true; \
} \
break; \
}
case UPB_TYPE_ENUM:
- CASE(INT32, int32, int32_t, INT32_MIN, INT32_MAX);
- CASE(INT64, int64, int64_t, INT64_MIN, INT64_MAX);
- CASE(UINT32, uint32, uint32_t, 0, UINT32_MAX);
- CASE(UINT64, uint64, uint64_t, 0, UINT64_MAX);
+ CASE(INT32, int32, INT32_MIN, INT32_MAX);
+ CASE(INT64, int64, INT64_MIN, INT64_MAX);
+ CASE(UINT32, uint32, 0, UINT32_MAX);
+ CASE(UINT64, uint64, 0, UINT64_MAX);
#undef CASE
case UPB_TYPE_DOUBLE:
upb_sink_putdouble(&p->top->sink, parser_getsel(p), val);
return true;
case UPB_TYPE_FLOAT:
- if ((val > FLT_MAX || val < -FLT_MAX) && val != inf && val != -inf) {
+ if (false /*val > FLT_MAX || val < -FLT_MAX*/) {
return false;
} else {
upb_sink_putfloat(&p->top->sink, parser_getsel(p), val);
@@ -13054,6 +12049,7 @@ static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
static bool parse_number(upb_json_parser *p, bool is_quoted) {
size_t len;
const char *buf;
+ const char *bufend;
/* strtol() and friends unfortunately do not support specifying the length of
* the input string, so we need to force a copy into a NULL-terminated buffer. */
@@ -13062,8 +12058,10 @@ static bool parse_number(upb_json_parser *p, bool is_quoted) {
}
buf = accumulate_getptr(p, &len);
+ bufend = buf + len - 1; /* One for NULL. */
+ errno = 0;
- if (parse_number_from_buffer(p, buf, is_quoted)) {
+ if (parse_number_from_buffer(p, buf, bufend, is_quoted)) {
multipart_end(p);
return true;
} else {
@@ -13523,11 +12521,11 @@ static void end_object(upb_json_parser *p) {
* final state once, when the closing '"' is seen. */
-#line 1310 "upb/json/parser.rl"
+#line 1306 "upb/json/parser.rl"
-#line 1222 "upb/json/parser.c"
+#line 1218 "upb/json/parser.c"
static const char _json_actions[] = {
0, 1, 0, 1, 2, 1, 3, 1,
5, 1, 6, 1, 7, 1, 8, 1,
@@ -13676,7 +12674,7 @@ static const int json_en_value_machine = 27;
static const int json_en_main = 1;
-#line 1313 "upb/json/parser.rl"
+#line 1309 "upb/json/parser.rl"
size_t parse(void *closure, const void *hd, const char *buf, size_t size,
const upb_bufhandle *handle) {
@@ -13698,7 +12696,7 @@ size_t parse(void *closure, const void *hd, const char *buf, size_t size,
capture_resume(parser, buf);
-#line 1393 "upb/json/parser.c"
+#line 1389 "upb/json/parser.c"
{
int _klen;
unsigned int _trans;
@@ -13773,118 +12771,118 @@ _match:
switch ( *_acts++ )
{
case 0:
-#line 1225 "upb/json/parser.rl"
+#line 1221 "upb/json/parser.rl"
{ p--; {cs = stack[--top]; goto _again;} }
break;
case 1:
-#line 1226 "upb/json/parser.rl"
+#line 1222 "upb/json/parser.rl"
{ p--; {stack[top++] = cs; cs = 10; goto _again;} }
break;
case 2:
-#line 1230 "upb/json/parser.rl"
+#line 1226 "upb/json/parser.rl"
{ start_text(parser, p); }
break;
case 3:
-#line 1231 "upb/json/parser.rl"
+#line 1227 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_text(parser, p)); }
break;
case 4:
-#line 1237 "upb/json/parser.rl"
+#line 1233 "upb/json/parser.rl"
{ start_hex(parser); }
break;
case 5:
-#line 1238 "upb/json/parser.rl"
+#line 1234 "upb/json/parser.rl"
{ hexdigit(parser, p); }
break;
case 6:
-#line 1239 "upb/json/parser.rl"
+#line 1235 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_hex(parser)); }
break;
case 7:
-#line 1245 "upb/json/parser.rl"
+#line 1241 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(escape(parser, p)); }
break;
case 8:
-#line 1251 "upb/json/parser.rl"
+#line 1247 "upb/json/parser.rl"
{ p--; {cs = stack[--top]; goto _again;} }
break;
case 9:
-#line 1254 "upb/json/parser.rl"
+#line 1250 "upb/json/parser.rl"
{ {stack[top++] = cs; cs = 19; goto _again;} }
break;
case 10:
-#line 1256 "upb/json/parser.rl"
+#line 1252 "upb/json/parser.rl"
{ p--; {stack[top++] = cs; cs = 27; goto _again;} }
break;
case 11:
-#line 1261 "upb/json/parser.rl"
+#line 1257 "upb/json/parser.rl"
{ start_member(parser); }
break;
case 12:
-#line 1262 "upb/json/parser.rl"
+#line 1258 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_membername(parser)); }
break;
case 13:
-#line 1265 "upb/json/parser.rl"
+#line 1261 "upb/json/parser.rl"
{ end_member(parser); }
break;
case 14:
-#line 1271 "upb/json/parser.rl"
+#line 1267 "upb/json/parser.rl"
{ start_object(parser); }
break;
case 15:
-#line 1274 "upb/json/parser.rl"
+#line 1270 "upb/json/parser.rl"
{ end_object(parser); }
break;
case 16:
-#line 1280 "upb/json/parser.rl"
+#line 1276 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(start_array(parser)); }
break;
case 17:
-#line 1284 "upb/json/parser.rl"
+#line 1280 "upb/json/parser.rl"
{ end_array(parser); }
break;
case 18:
-#line 1289 "upb/json/parser.rl"
+#line 1285 "upb/json/parser.rl"
{ start_number(parser, p); }
break;
case 19:
-#line 1290 "upb/json/parser.rl"
+#line 1286 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_number(parser, p)); }
break;
case 20:
-#line 1292 "upb/json/parser.rl"
+#line 1288 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(start_stringval(parser)); }
break;
case 21:
-#line 1293 "upb/json/parser.rl"
+#line 1289 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(end_stringval(parser)); }
break;
case 22:
-#line 1295 "upb/json/parser.rl"
+#line 1291 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(parser_putbool(parser, true)); }
break;
case 23:
-#line 1297 "upb/json/parser.rl"
+#line 1293 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(parser_putbool(parser, false)); }
break;
case 24:
-#line 1299 "upb/json/parser.rl"
+#line 1295 "upb/json/parser.rl"
{ /* null value */ }
break;
case 25:
-#line 1301 "upb/json/parser.rl"
+#line 1297 "upb/json/parser.rl"
{ CHECK_RETURN_TOP(start_subobject(parser)); }
break;
case 26:
-#line 1302 "upb/json/parser.rl"
+#line 1298 "upb/json/parser.rl"
{ end_subobject(parser); }
break;
case 27:
-#line 1307 "upb/json/parser.rl"
+#line 1303 "upb/json/parser.rl"
{ p--; {cs = stack[--top]; goto _again;} }
break;
-#line 1579 "upb/json/parser.c"
+#line 1575 "upb/json/parser.c"
}
}
@@ -13897,7 +12895,7 @@ _again:
_out: {}
}
-#line 1334 "upb/json/parser.rl"
+#line 1330 "upb/json/parser.rl"
if (p != pe) {
upb_status_seterrf(&parser->status, "Parse error at '%.*s'\n", pe - p, p);
@@ -13938,13 +12936,13 @@ static void json_parser_reset(upb_json_parser *p) {
/* Emit Ragel initialization of the parser. */
-#line 1633 "upb/json/parser.c"
+#line 1629 "upb/json/parser.c"
{
cs = json_start;
top = 0;
}
-#line 1374 "upb/json/parser.rl"
+#line 1370 "upb/json/parser.rl"
p->current_state = cs;
p->parser_top = top;
accumulate_clear(p);
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/upb.h b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/upb.h
index a263db30af..3edee0d18f 100644
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/upb.h
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/upb.h
@@ -1,46 +1,4 @@
// Amalgamated source file
-
-// php.h intentionally defined NDEBUG. We have to define this macro in order to
-// be used together with php.h
-#ifndef NDEBUG
-#define NDEBUG
-#endif
-
-/*
-** upb_decode: parsing into a upb_msg using a upb_msglayout.
-*/
-
-#ifndef UPB_DECODE_H_
-#define UPB_DECODE_H_
-
-/*
-** upb::Message is a representation for protobuf messages.
-**
-** However it differs from other common representations like
-** google::protobuf::Message in one key way: it does not prescribe any
-** ownership between messages and submessages, and it relies on the
-** client to delete each message/submessage/array/map at the appropriate
-** time.
-**
-** A client can access a upb::Message without knowing anything about
-** ownership semantics, but to create or mutate a message a user needs
-** to implement the memory management themselves.
-**
-** Currently all messages, arrays, and maps store a upb_alloc* internally.
-** Mutating operations use this when they require dynamically-allocated
-** memory. We could potentially eliminate this size overhead later by
-** letting the user flip a bit on the factory that prevents this from
-** being stored. The user would then need to use separate functions where
-** the upb_alloc* is passed explicitly. However for handlers to populate
-** such structures, they would need a place to store this upb_alloc* during
-** parsing; upb_handlers don't currently have a good way to accommodate this.
-**
-** TODO: UTF-8 checking?
-**/
-
-#ifndef UPB_MSG_H_
-#define UPB_MSG_H_
-
/*
** Defs are upb's internal representation of the constructs that can appear
** in a .proto file:
@@ -142,9 +100,6 @@ template <int N> class InlinedEnvironment;
#define UPB_INLINE static
#endif
-/* Hints to the compiler about likely/unlikely branches. */
-#define UPB_LIKELY(x) __builtin_expect((x),1)
-
/* Define UPB_BIG_ENDIAN manually if you're on big endian and your compiler
* doesn't provide these preprocessor symbols. */
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
@@ -406,16 +361,6 @@ class PointerBase2 : public PointerBase<T, Base> {
#endif
-/* A list of types as they are encoded on-the-wire. */
-typedef enum {
- UPB_WIRE_TYPE_VARINT = 0,
- UPB_WIRE_TYPE_64BIT = 1,
- UPB_WIRE_TYPE_DELIMITED = 2,
- UPB_WIRE_TYPE_START_GROUP = 3,
- UPB_WIRE_TYPE_END_GROUP = 4,
- UPB_WIRE_TYPE_32BIT = 5
-} upb_wiretype_t;
-
/* upb::ErrorSpace ************************************************************/
@@ -744,7 +689,7 @@ void upb_env_uninit(upb_env *e);
void upb_env_initonly(upb_env *e);
-UPB_INLINE upb_arena *upb_env_arena(upb_env *e) { return (upb_arena*)e; }
+upb_arena *upb_env_arena(upb_env *e);
bool upb_env_ok(const upb_env *e);
void upb_env_seterrorfunc(upb_env *e, upb_error_func *func, void *ud);
@@ -2002,9 +1947,6 @@ typedef enum {
UPB_SYNTAX_PROTO3 = 3
} upb_syntax_t;
-/* Maps descriptor type -> upb field type. */
-extern const uint8_t upb_desctype_to_fieldtype[];
-
/* Maximum field number allowed for FieldDefs. This is an inherent limit of the
* protobuf wire format. */
#define UPB_MAX_FIELDNUMBER ((1 << 29) - 1)
@@ -3909,6 +3851,196 @@ inline bool FileDef::AddDependency(const FileDef* file) {
#endif /* UPB_DEF_H_ */
/*
+** This file contains definitions of structs that should be considered private
+** and NOT stable across versions of upb.
+**
+** The only reason they are declared here and not in .c files is to allow upb
+** and the application (if desired) to embed statically-initialized instances
+** of structures like defs.
+**
+** If you include this file, all guarantees of ABI compatibility go out the
+** window! Any code that includes this file needs to recompile against the
+** exact same version of upb that they are linking against.
+**
+** You also need to recompile if you change the value of the UPB_DEBUG_REFS
+** flag.
+*/
+
+
+#ifndef UPB_STATICINIT_H_
+#define UPB_STATICINIT_H_
+
+#ifdef __cplusplus
+/* Because of how we do our typedefs, this header can't be included from C++. */
+#error This file cannot be included from C++
+#endif
+
+/* upb_refcounted *************************************************************/
+
+
+/* upb_def ********************************************************************/
+
+struct upb_def {
+ upb_refcounted base;
+
+ const char *fullname;
+ const upb_filedef* file;
+ char type; /* A upb_deftype_t (char to save space) */
+
+ /* Used as a flag during the def's mutable stage. Must be false unless
+ * it is currently being used by a function on the stack. This allows
+ * us to easily determine which defs were passed into the function's
+ * current invocation. */
+ bool came_from_user;
+};
+
+#define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \
+ { UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false }
+
+
+/* upb_fielddef ***************************************************************/
+
+struct upb_fielddef {
+ upb_def base;
+
+ union {
+ int64_t sint;
+ uint64_t uint;
+ double dbl;
+ float flt;
+ void *bytes;
+ } defaultval;
+ union {
+ const upb_msgdef *def; /* If !msg_is_symbolic. */
+ char *name; /* If msg_is_symbolic. */
+ } msg;
+ union {
+ const upb_def *def; /* If !subdef_is_symbolic. */
+ char *name; /* If subdef_is_symbolic. */
+ } sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */
+ bool subdef_is_symbolic;
+ bool msg_is_symbolic;
+ const upb_oneofdef *oneof;
+ bool default_is_string;
+ bool type_is_set_; /* False until type is explicitly set. */
+ bool is_extension_;
+ bool lazy_;
+ bool packed_;
+ upb_intfmt_t intfmt;
+ bool tagdelim;
+ upb_fieldtype_t type_;
+ upb_label_t label_;
+ uint32_t number_;
+ uint32_t selector_base; /* Used to index into a upb::Handlers table. */
+ uint32_t index_;
+};
+
+extern const struct upb_refcounted_vtbl upb_fielddef_vtbl;
+
+#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \
+ packed, name, num, msgdef, subdef, selector_base, \
+ index, defaultval, refs, ref2s) \
+ { \
+ UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \
+ defaultval, {msgdef}, {subdef}, NULL, false, false, \
+ type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \
+ lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \
+ }
+
+
+/* upb_msgdef *****************************************************************/
+
+struct upb_msgdef {
+ upb_def base;
+
+ size_t selector_count;
+ uint32_t submsg_field_count;
+
+ /* Tables for looking up fields by number and name. */
+ upb_inttable itof; /* int to field */
+ upb_strtable ntof; /* name to field/oneof */
+
+ /* Is this a map-entry message? */
+ bool map_entry;
+
+ /* Whether this message has proto2 or proto3 semantics. */
+ upb_syntax_t syntax;
+
+ /* TODO(haberman): proper extension ranges (there can be multiple). */
+};
+
+extern const struct upb_refcounted_vtbl upb_msgdef_vtbl;
+
+/* TODO: also support static initialization of the oneofs table. This will be
+ * needed if we compile in descriptors that contain oneofs. */
+#define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \
+ map_entry, syntax, refs, ref2s) \
+ { \
+ UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \
+ selector_count, submsg_field_count, itof, ntof, map_entry, syntax \
+ }
+
+
+/* upb_enumdef ****************************************************************/
+
+struct upb_enumdef {
+ upb_def base;
+
+ upb_strtable ntoi;
+ upb_inttable iton;
+ int32_t defaultval;
+};
+
+extern const struct upb_refcounted_vtbl upb_enumdef_vtbl;
+
+#define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \
+ { UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \
+ iton, defaultval }
+
+
+/* upb_oneofdef ***************************************************************/
+
+struct upb_oneofdef {
+ upb_refcounted base;
+
+ uint32_t index; /* Index within oneofs. */
+ const char *name;
+ upb_strtable ntof;
+ upb_inttable itof;
+ const upb_msgdef *parent;
+};
+
+extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl;
+
+#define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \
+ { UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof }
+
+
+/* upb_symtab *****************************************************************/
+
+struct upb_symtab {
+ upb_refcounted base;
+
+ upb_strtable symtab;
+};
+
+struct upb_filedef {
+ upb_refcounted base;
+
+ const char *name;
+ const char *package;
+ const char *phpprefix;
+ const char *phpnamespace;
+ upb_syntax_t syntax;
+
+ upb_inttable defs;
+ upb_inttable deps;
+};
+
+extern const struct upb_refcounted_vtbl upb_filedef_vtbl;
+
+#endif /* UPB_STATICINIT_H_ */
+/*
** upb::Handlers (upb_handlers)
**
** A upb_handlers is like a virtual table for a upb_msgdef. Each field of the
@@ -4012,8 +4144,7 @@ UPB_END_EXTERN_C
/* Static selectors for upb::Handlers. */
#define UPB_STARTMSG_SELECTOR 0
#define UPB_ENDMSG_SELECTOR 1
-#define UPB_UNKNOWN_SELECTOR 2
-#define UPB_STATIC_SELECTOR_COUNT 3
+#define UPB_STATIC_SELECTOR_COUNT 2
/* Static selectors for upb::BytesHandler. */
#define UPB_STARTSTR_SELECTOR 0
@@ -4542,8 +4673,6 @@ UPB_BEGIN_EXTERN_C
/* Native C API. */
/* Handler function typedefs. */
-typedef bool upb_unknown_handlerfunc(void *c, const void *hd, const char *buf,
- size_t n);
typedef bool upb_startmsg_handlerfunc(void *c, const void*);
typedef bool upb_endmsg_handlerfunc(void *c, const void *, upb_status *status);
typedef void* upb_startfield_handlerfunc(void *c, const void *hd);
@@ -4597,8 +4726,6 @@ const upb_status *upb_handlers_status(upb_handlers *h);
void upb_handlers_clearerr(upb_handlers *h);
const upb_msgdef *upb_handlers_msgdef(const upb_handlers *h);
bool upb_handlers_addcleanup(upb_handlers *h, void *p, upb_handlerfree *hfree);
-bool upb_handlers_setunknown(upb_handlers *h, upb_unknown_handlerfunc *func,
- upb_handlerattr *attr);
bool upb_handlers_setstartmsg(upb_handlers *h, upb_startmsg_handlerfunc *func,
upb_handlerattr *attr);
@@ -6168,18 +6295,6 @@ UPB_INLINE size_t upb_sink_putstring(upb_sink *s, upb_selector_t sel,
return handler(s->closure, hd, buf, n, handle);
}
-UPB_INLINE bool upb_sink_putunknown(upb_sink *s, const char *buf, size_t n) {
- typedef upb_unknown_handlerfunc func;
- func *handler;
- const void *hd;
- if (!s->handlers) return true;
- handler = (func *)upb_handlers_gethandler(s->handlers, UPB_UNKNOWN_SELECTOR);
-
- if (!handler) return n;
- hd = upb_handlers_gethandlerdata(s->handlers, UPB_UNKNOWN_SELECTOR);
- return handler(s->closure, hd, buf, n);
-}
-
UPB_INLINE bool upb_sink_startmsg(upb_sink *s) {
typedef upb_startmsg_handlerfunc func;
func *startmsg;
@@ -6384,6 +6499,34 @@ inline bool BufferSource::PutBuffer(const char *buf, size_t len,
#endif
#endif
+/*
+** upb::Message is a representation for protobuf messages.
+**
+** However it differs from other common representations like
+** google::protobuf::Message in one key way: it does not prescribe any
+** ownership between messages and submessages, and it relies on the
+** client to delete each message/submessage/array/map at the appropriate
+** time.
+**
+** A client can access a upb::Message without knowing anything about
+** ownership semantics, but to create or mutate a message a user needs
+** to implement the memory management themselves.
+**
+** Currently all messages, arrays, and maps store a upb_alloc* internally.
+** Mutating operations use this when they require dynamically-allocated
+** memory. We could potentially eliminate this size overhead later by
+** letting the user flip a bit on the factory that prevents this from
+** being stored. The user would then need to use separate functions where
+** the upb_alloc* is passed explicitly. However for handlers to populate
+** such structures, they would need a place to store this upb_alloc* during
+** parsing; upb_handlers don't currently have a good way to accommodate this.
+**
+** TODO: UTF-8 checking?
+**/
+
+#ifndef UPB_MSG_H_
+#define UPB_MSG_H_
+
#ifdef __cplusplus
@@ -6420,6 +6563,21 @@ typedef void upb_msg;
* instances of this from a upb_msgfactory, and the factory always owns the
* msglayout. */
+/* Gets the factory for this layout */
+upb_msgfactory *upb_msglayout_factory(const upb_msglayout *l);
+
+/* Get the msglayout for a submessage. This requires that this field is a
+ * submessage, ie. upb_fielddef_issubmsg(upb_msglayout_msgdef(l)) == true.
+ *
+ * Since map entry messages don't have layouts, if upb_fielddef_ismap(f) == true
+ * then this function will return the layout for the map's value. It requires
+ * that the value type of the map field is a submessage. */
+const upb_msglayout *upb_msglayout_sublayout(const upb_msglayout *l,
+ const upb_fielddef *f);
+
+/* Returns the msgdef for this msglayout. */
+const upb_msgdef *upb_msglayout_msgdef(const upb_msglayout *l);
+
/** upb_visitor ***************************************************************/
@@ -6465,23 +6623,6 @@ const upb_visitorplan *upb_msgfactory_getvisitorplan(upb_msgfactory *f,
const upb_handlers *h);
-/** upb_stringview ************************************************************/
-
-typedef struct {
- const char *data;
- size_t size;
-} upb_stringview;
-
-UPB_INLINE upb_stringview upb_stringview_make(const char *data, size_t size) {
- upb_stringview ret;
- ret.data = data;
- ret.size = size;
- return ret;
-}
-
-#define UPB_STRINGVIEW_INIT(ptr, len) {ptr, len}
-
-
/** upb_msgval ****************************************************************/
/* A union representing all possible protobuf values. Used for generic get/set
@@ -6499,7 +6640,10 @@ typedef union {
const upb_msg* msg;
const upb_array* arr;
const void* ptr;
- upb_stringview str;
+ struct {
+ const char *ptr;
+ size_t len;
+ } str;
} upb_msgval;
#define ACCESSORS(name, membername, ctype) \
@@ -6526,12 +6670,22 @@ ACCESSORS(map, map, const upb_map*)
ACCESSORS(msg, msg, const upb_msg*)
ACCESSORS(ptr, ptr, const void*)
ACCESSORS(arr, arr, const upb_array*)
-ACCESSORS(str, str, upb_stringview)
#undef ACCESSORS
-UPB_INLINE upb_msgval upb_msgval_makestr(const char *data, size_t size) {
- return upb_msgval_str(upb_stringview_make(data, size));
+UPB_INLINE upb_msgval upb_msgval_str(const char *ptr, size_t len) {
+ upb_msgval ret;
+ ret.str.ptr = ptr;
+ ret.str.len = len;
+ return ret;
+}
+
+UPB_INLINE const char* upb_msgval_getstr(upb_msgval val) {
+ return val.str.ptr;
+}
+
+UPB_INLINE size_t upb_msgval_getstrlen(upb_msgval val) {
+ return val.str.len;
}
@@ -6556,29 +6710,19 @@ size_t upb_msg_sizeof(const upb_msglayout *l);
* upb_msg_uninit() must be called to release internally-allocated memory
* unless the allocator is an arena that does not require freeing.
*
- * Please note that upb_msg_init() may return a value that is different than
- * |msg|, so you must assign the return value and not cast your memory block
- * to upb_msg* directly!
- *
* Please note that upb_msg_uninit() does *not* free any submessages, maps,
* or arrays referred to by this message's fields. You must free them manually
- * yourself.
- *
- * upb_msg_uninit returns the original memory block, which may be useful if
- * you dynamically allocated it (though upb_msg_new() would normally be more
- * appropriate in this case). */
-upb_msg *upb_msg_init(void *msg, const upb_msglayout *l, upb_alloc *a);
-void *upb_msg_uninit(upb_msg *msg, const upb_msglayout *l);
+ * yourself. */
+void upb_msg_init(upb_msg *msg, const upb_msglayout *l, upb_alloc *a);
+void upb_msg_uninit(upb_msg *msg, const upb_msglayout *l);
/* Like upb_msg_init() / upb_msg_uninit(), except the message's memory is
* allocated / freed from the given upb_alloc. */
upb_msg *upb_msg_new(const upb_msglayout *l, upb_alloc *a);
void upb_msg_free(upb_msg *msg, const upb_msglayout *l);
-/* Returns the upb_alloc for the given message.
- * TODO(haberman): get rid of this? Not sure we want to be storing this
- * for every message. */
-upb_alloc *upb_msg_alloc(const upb_msg *msg);
+/* Returns the upb_alloc for the given message. */
+upb_alloc *upb_msg_alloc(const upb_msg *msg, const upb_msglayout *l);
/* Packs the tree of messages rooted at "msg" into a single hunk of memory,
* allocated from the given allocator. */
@@ -6598,14 +6742,25 @@ void *upb_msg_pack(const upb_msg *msg, const upb_msglayout *l,
* arenas).
*/
upb_msgval upb_msg_get(const upb_msg *msg,
- int field_index,
+ const upb_fielddef *f,
const upb_msglayout *l);
/* May only be called for fields where upb_fielddef_haspresence(f) == true. */
bool upb_msg_has(const upb_msg *msg,
- int field_index,
+ const upb_fielddef *f,
const upb_msglayout *l);
+/* Returns NULL if no field in the oneof is set. */
+const upb_fielddef *upb_msg_getoneofcase(const upb_msg *msg,
+ const upb_oneofdef *o,
+ const upb_msglayout *l);
+
+/* Returns true if any field in the oneof is set. */
+bool upb_msg_hasoneof(const upb_msg *msg,
+ const upb_oneofdef *o,
+ const upb_msglayout *l);
+
+
/* Mutable message API. May only be called by the owner of the message who
* knows its ownership scheme and how to keep it consistent. */
@@ -6613,8 +6768,8 @@ bool upb_msg_has(const upb_msg *msg,
* management: if you overwrite a pointer to a msg/array/map/string without
* cleaning it up (or using an arena) it will leak.
*/
-void upb_msg_set(upb_msg *msg,
- int field_index,
+bool upb_msg_set(upb_msg *msg,
+ const upb_fielddef *f,
upb_msgval val,
const upb_msglayout *l);
@@ -6625,7 +6780,12 @@ void upb_msg_set(upb_msg *msg,
* arrays/maps/strings/msgs that this field may have pointed to.
*/
bool upb_msg_clearfield(upb_msg *msg,
- int field_index,
+ const upb_fielddef *f,
+ const upb_msglayout *l);
+
+/* Clears all fields in the oneof such that none of them are set. */
+bool upb_msg_clearoneof(upb_msg *msg,
+ const upb_oneofdef *o,
const upb_msglayout *l);
/* TODO(haberman): copyfrom()/mergefrom()? */
@@ -6738,980 +6898,9 @@ bool upb_msg_getscalarhandlerdata(const upb_handlers *h,
size_t *offset,
int32_t *hasbit);
-
-/** Interfaces for generated code *********************************************/
-
-#define UPB_NOT_IN_ONEOF UINT16_MAX
-#define UPB_NO_HASBIT UINT16_MAX
-#define UPB_NO_SUBMSG UINT16_MAX
-
-typedef struct {
- uint32_t number;
- uint32_t offset; /* If in a oneof, offset of default in default_msg below. */
- uint16_t hasbit; /* UPB_NO_HASBIT if no hasbit. */
- uint16_t oneof_index; /* UPB_NOT_IN_ONEOF if not in a oneof. */
- uint16_t submsg_index; /* UPB_NO_SUBMSG if no submsg. */
- uint8_t descriptortype;
- uint8_t label;
-} upb_msglayout_fieldinit_v1;
-
-typedef struct {
- uint32_t data_offset;
- uint32_t case_offset;
-} upb_msglayout_oneofinit_v1;
-
-typedef struct upb_msglayout_msginit_v1 {
- const struct upb_msglayout_msginit_v1 *const* submsgs;
- const upb_msglayout_fieldinit_v1 *fields;
- const upb_msglayout_oneofinit_v1 *oneofs;
- void *default_msg;
- /* Must be aligned to sizeof(void*). Doesn't include internal members like
- * unknown fields, extension dict, pointer to msglayout, etc. */
- uint32_t size;
- uint16_t field_count;
- uint16_t oneof_count;
- bool extendable;
- bool is_proto2;
-} upb_msglayout_msginit_v1;
-
-#define UPB_ALIGN_UP_TO(val, align) ((val + (align - 1)) & -align)
-#define UPB_ALIGNED_SIZEOF(type) UPB_ALIGN_UP_TO(sizeof(type), sizeof(void*))
-
-/* Initialize/uninitialize a msglayout from a msginit. If upb uses v1
- * internally, this will not allocate any memory. Should only be used by
- * generated code. */
-upb_msglayout *upb_msglayout_frominit_v1(
- const upb_msglayout_msginit_v1 *init, upb_alloc *a);
-void upb_msglayout_uninit_v1(upb_msglayout *layout, upb_alloc *a);
-
UPB_END_EXTERN_C
#endif /* UPB_MSG_H_ */
-
-UPB_BEGIN_EXTERN_C
-
-bool upb_decode(upb_stringview buf, void *msg,
- const upb_msglayout_msginit_v1 *l, upb_env *env);
-
-UPB_END_EXTERN_C
-
-#endif /* UPB_DECODE_H_ */
-/*
-** upb_encode: parsing into a upb_msg using a upb_msglayout.
-*/
-
-#ifndef UPB_ENCODE_H_
-#define UPB_ENCODE_H_
-
-
-UPB_BEGIN_EXTERN_C
-
-char *upb_encode(const void *msg, const upb_msglayout_msginit_v1 *l,
- upb_env *env, size_t *size);
-
-UPB_END_EXTERN_C
-
-#endif /* UPB_ENCODE_H_ */
-/* This file was generated by upbc (the upb compiler) from the input
- * file:
- *
- * google/protobuf/descriptor.proto
- *
- * Do not edit -- your changes will be discarded when the file is
- * regenerated. */
-
-#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
-#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
-
-
-UPB_BEGIN_EXTERN_C
-
-struct google_protobuf_FileDescriptorSet;
-typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
-struct google_protobuf_FileDescriptorProto;
-typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
-struct google_protobuf_DescriptorProto;
-typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
-struct google_protobuf_DescriptorProto_ExtensionRange;
-typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
-struct google_protobuf_DescriptorProto_ReservedRange;
-typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
-struct google_protobuf_ExtensionRangeOptions;
-typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
-struct google_protobuf_FieldDescriptorProto;
-typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
-struct google_protobuf_OneofDescriptorProto;
-typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
-struct google_protobuf_EnumDescriptorProto;
-typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
-struct google_protobuf_EnumDescriptorProto_EnumReservedRange;
-typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
-struct google_protobuf_EnumValueDescriptorProto;
-typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
-struct google_protobuf_ServiceDescriptorProto;
-typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
-struct google_protobuf_MethodDescriptorProto;
-typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
-struct google_protobuf_FileOptions;
-typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
-struct google_protobuf_MessageOptions;
-typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
-struct google_protobuf_FieldOptions;
-typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
-struct google_protobuf_OneofOptions;
-typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
-struct google_protobuf_EnumOptions;
-typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
-struct google_protobuf_EnumValueOptions;
-typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
-struct google_protobuf_ServiceOptions;
-typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
-struct google_protobuf_MethodOptions;
-typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
-struct google_protobuf_UninterpretedOption;
-typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
-struct google_protobuf_UninterpretedOption_NamePart;
-typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
-struct google_protobuf_SourceCodeInfo;
-typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
-struct google_protobuf_SourceCodeInfo_Location;
-typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
-struct google_protobuf_GeneratedCodeInfo;
-typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
-struct google_protobuf_GeneratedCodeInfo_Annotation;
-typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
-/* Enums */
-
-typedef enum {
- google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
- google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
- google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
-} google_protobuf_FieldDescriptorProto_Label;
-
-typedef enum {
- google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
- google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
- google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
- google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
- google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
- google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
- google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
- google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
- google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
- google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
- google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
- google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
- google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
- google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
- google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
- google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
- google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
- google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
-} google_protobuf_FieldDescriptorProto_Type;
-
-typedef enum {
- google_protobuf_FieldOptions_STRING = 0,
- google_protobuf_FieldOptions_CORD = 1,
- google_protobuf_FieldOptions_STRING_PIECE = 2
-} google_protobuf_FieldOptions_CType;
-
-typedef enum {
- google_protobuf_FieldOptions_JS_NORMAL = 0,
- google_protobuf_FieldOptions_JS_STRING = 1,
- google_protobuf_FieldOptions_JS_NUMBER = 2
-} google_protobuf_FieldOptions_JSType;
-
-typedef enum {
- google_protobuf_FileOptions_SPEED = 1,
- google_protobuf_FileOptions_CODE_SIZE = 2,
- google_protobuf_FileOptions_LITE_RUNTIME = 3
-} google_protobuf_FileOptions_OptimizeMode;
-
-typedef enum {
- google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
- google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
- google_protobuf_MethodOptions_IDEMPOTENT = 2
-} google_protobuf_MethodOptions_IdempotencyLevel;
-
-/* google_protobuf_FileDescriptorSet */
-extern const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorSet_msginit;
-google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_env *env);
-google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_FileDescriptorSet_serialize(google_protobuf_FileDescriptorSet *msg, upb_env *env, size_t *len);
-void google_protobuf_FileDescriptorSet_free(google_protobuf_FileDescriptorSet *msg, upb_env *env);
-
-/* getters. */
-const upb_array* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg);
-
-/* setters. */
-void google_protobuf_FileDescriptorSet_set_file(google_protobuf_FileDescriptorSet *msg, upb_array* value);
-
-
-/* google_protobuf_FileDescriptorProto */
-extern const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorProto_msginit;
-google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_env *env);
-google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_FileDescriptorProto_serialize(google_protobuf_FileDescriptorProto *msg, upb_env *env, size_t *len);
-void google_protobuf_FileDescriptorProto_free(google_protobuf_FileDescriptorProto *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg);
-upb_stringview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg);
-const upb_array* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg);
-const upb_array* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg);
-const upb_array* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg);
-const upb_array* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg);
-const upb_array* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg);
-const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg);
-const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg);
-const upb_array* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg);
-const upb_array* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg);
-upb_stringview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg);
-
-/* setters. */
-void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_stringview value);
-void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_stringview value);
-void google_protobuf_FileDescriptorProto_set_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value);
-void google_protobuf_FileDescriptorProto_set_message_type(google_protobuf_FileDescriptorProto *msg, upb_array* value);
-void google_protobuf_FileDescriptorProto_set_enum_type(google_protobuf_FileDescriptorProto *msg, upb_array* value);
-void google_protobuf_FileDescriptorProto_set_service(google_protobuf_FileDescriptorProto *msg, upb_array* value);
-void google_protobuf_FileDescriptorProto_set_extension(google_protobuf_FileDescriptorProto *msg, upb_array* value);
-void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value);
-void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value);
-void google_protobuf_FileDescriptorProto_set_public_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value);
-void google_protobuf_FileDescriptorProto_set_weak_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value);
-void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_stringview value);
-
-
-/* google_protobuf_DescriptorProto */
-extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_msginit;
-google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_env *env);
-google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_DescriptorProto_serialize(google_protobuf_DescriptorProto *msg, upb_env *env, size_t *len);
-void google_protobuf_DescriptorProto_free(google_protobuf_DescriptorProto *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg);
-const upb_array* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg);
-const upb_array* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg);
-const upb_array* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg);
-const upb_array* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg);
-const upb_array* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg);
-const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg);
-const upb_array* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg);
-const upb_array* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg);
-const upb_array* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg);
-
-/* setters. */
-void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_stringview value);
-void google_protobuf_DescriptorProto_set_field(google_protobuf_DescriptorProto *msg, upb_array* value);
-void google_protobuf_DescriptorProto_set_nested_type(google_protobuf_DescriptorProto *msg, upb_array* value);
-void google_protobuf_DescriptorProto_set_enum_type(google_protobuf_DescriptorProto *msg, upb_array* value);
-void google_protobuf_DescriptorProto_set_extension_range(google_protobuf_DescriptorProto *msg, upb_array* value);
-void google_protobuf_DescriptorProto_set_extension(google_protobuf_DescriptorProto *msg, upb_array* value);
-void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value);
-void google_protobuf_DescriptorProto_set_oneof_decl(google_protobuf_DescriptorProto *msg, upb_array* value);
-void google_protobuf_DescriptorProto_set_reserved_range(google_protobuf_DescriptorProto *msg, upb_array* value);
-void google_protobuf_DescriptorProto_set_reserved_name(google_protobuf_DescriptorProto *msg, upb_array* value);
-
-
-/* google_protobuf_DescriptorProto_ExtensionRange */
-extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ExtensionRange_msginit;
-google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_env *env);
-google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_DescriptorProto_ExtensionRange_serialize(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env, size_t *len);
-void google_protobuf_DescriptorProto_ExtensionRange_free(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env);
-
-/* getters. */
-int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg);
-int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg);
-const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg);
-
-/* setters. */
-void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value);
-void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value);
-void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value);
-
-
-/* google_protobuf_DescriptorProto_ReservedRange */
-extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ReservedRange_msginit;
-google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_env *env);
-google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_DescriptorProto_ReservedRange_serialize(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env, size_t *len);
-void google_protobuf_DescriptorProto_ReservedRange_free(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env);
-
-/* getters. */
-int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg);
-int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg);
-
-/* setters. */
-void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value);
-void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value);
-
-
-/* google_protobuf_ExtensionRangeOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_ExtensionRangeOptions_msginit;
-google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_env *env);
-google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_ExtensionRangeOptions_serialize(google_protobuf_ExtensionRangeOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_ExtensionRangeOptions_free(google_protobuf_ExtensionRangeOptions *msg, upb_env *env);
-
-/* getters. */
-const upb_array* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg);
-
-/* setters. */
-void google_protobuf_ExtensionRangeOptions_set_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_array* value);
-
-
-/* google_protobuf_FieldDescriptorProto */
-extern const upb_msglayout_msginit_v1 google_protobuf_FieldDescriptorProto_msginit;
-google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_env *env);
-google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_FieldDescriptorProto_serialize(google_protobuf_FieldDescriptorProto *msg, upb_env *env, size_t *len);
-void google_protobuf_FieldDescriptorProto_free(google_protobuf_FieldDescriptorProto *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg);
-upb_stringview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg);
-int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg);
-google_protobuf_FieldDescriptorProto_Label google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg);
-google_protobuf_FieldDescriptorProto_Type google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg);
-upb_stringview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg);
-upb_stringview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg);
-const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg);
-int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg);
-upb_stringview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg);
-
-/* setters. */
-void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value);
-void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_stringview value);
-void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value);
-void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Label value);
-void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Type value);
-void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value);
-void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_stringview value);
-void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value);
-void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value);
-void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value);
-
-
-/* google_protobuf_OneofDescriptorProto */
-extern const upb_msglayout_msginit_v1 google_protobuf_OneofDescriptorProto_msginit;
-google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_env *env);
-google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_OneofDescriptorProto_serialize(google_protobuf_OneofDescriptorProto *msg, upb_env *env, size_t *len);
-void google_protobuf_OneofDescriptorProto_free(google_protobuf_OneofDescriptorProto *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg);
-const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg);
-
-/* setters. */
-void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_stringview value);
-void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value);
-
-
-/* google_protobuf_EnumDescriptorProto */
-extern const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_msginit;
-google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_env *env);
-google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_EnumDescriptorProto_serialize(google_protobuf_EnumDescriptorProto *msg, upb_env *env, size_t *len);
-void google_protobuf_EnumDescriptorProto_free(google_protobuf_EnumDescriptorProto *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg);
-const upb_array* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg);
-const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg);
-const upb_array* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg);
-const upb_array* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg);
-
-/* setters. */
-void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_stringview value);
-void google_protobuf_EnumDescriptorProto_set_value(google_protobuf_EnumDescriptorProto *msg, upb_array* value);
-void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value);
-void google_protobuf_EnumDescriptorProto_set_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_array* value);
-void google_protobuf_EnumDescriptorProto_set_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_array* value);
-
-
-/* google_protobuf_EnumDescriptorProto_EnumReservedRange */
-extern const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit;
-google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_env *env);
-google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env, size_t *len);
-void google_protobuf_EnumDescriptorProto_EnumReservedRange_free(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env);
-
-/* getters. */
-int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg);
-int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg);
-
-/* setters. */
-void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value);
-void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value);
-
-
-/* google_protobuf_EnumValueDescriptorProto */
-extern const upb_msglayout_msginit_v1 google_protobuf_EnumValueDescriptorProto_msginit;
-google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_env *env);
-google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_EnumValueDescriptorProto_serialize(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env, size_t *len);
-void google_protobuf_EnumValueDescriptorProto_free(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg);
-int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg);
-const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg);
-
-/* setters. */
-void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_stringview value);
-void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value);
-void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value);
-
-
-/* google_protobuf_ServiceDescriptorProto */
-extern const upb_msglayout_msginit_v1 google_protobuf_ServiceDescriptorProto_msginit;
-google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_env *env);
-google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_ServiceDescriptorProto_serialize(google_protobuf_ServiceDescriptorProto *msg, upb_env *env, size_t *len);
-void google_protobuf_ServiceDescriptorProto_free(google_protobuf_ServiceDescriptorProto *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg);
-const upb_array* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg);
-const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg);
-
-/* setters. */
-void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_stringview value);
-void google_protobuf_ServiceDescriptorProto_set_method(google_protobuf_ServiceDescriptorProto *msg, upb_array* value);
-void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value);
-
-
-/* google_protobuf_MethodDescriptorProto */
-extern const upb_msglayout_msginit_v1 google_protobuf_MethodDescriptorProto_msginit;
-google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_env *env);
-google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_MethodDescriptorProto_serialize(google_protobuf_MethodDescriptorProto *msg, upb_env *env, size_t *len);
-void google_protobuf_MethodDescriptorProto_free(google_protobuf_MethodDescriptorProto *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg);
-upb_stringview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg);
-upb_stringview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg);
-const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg);
-bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg);
-bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg);
-
-/* setters. */
-void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_stringview value);
-void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value);
-void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value);
-void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value);
-void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value);
-void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value);
-
-
-/* google_protobuf_FileOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_FileOptions_msginit;
-google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_env *env);
-google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_FileOptions_serialize(google_protobuf_FileOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_FileOptions_free(google_protobuf_FileOptions *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg);
-upb_stringview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg);
-google_protobuf_FileOptions_OptimizeMode google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg);
-upb_stringview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg);
-upb_stringview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg);
-upb_stringview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg);
-upb_stringview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg);
-upb_stringview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg);
-upb_stringview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg);
-bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg);
-const upb_array* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg);
-
-/* setters. */
-void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_stringview value);
-void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_stringview value);
-void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, google_protobuf_FileOptions_OptimizeMode value);
-void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_stringview value);
-void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value);
-void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_stringview value);
-void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_stringview value);
-void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value);
-void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_stringview value);
-void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value);
-void google_protobuf_FileOptions_set_uninterpreted_option(google_protobuf_FileOptions *msg, upb_array* value);
-
-
-/* google_protobuf_MessageOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_MessageOptions_msginit;
-google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_env *env);
-google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_MessageOptions_serialize(google_protobuf_MessageOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_MessageOptions_free(google_protobuf_MessageOptions *msg, upb_env *env);
-
-/* getters. */
-bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg);
-bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg);
-bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg);
-bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg);
-const upb_array* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg);
-
-/* setters. */
-void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value);
-void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value);
-void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value);
-void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value);
-void google_protobuf_MessageOptions_set_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_array* value);
-
-
-/* google_protobuf_FieldOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_FieldOptions_msginit;
-google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_env *env);
-google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_FieldOptions_serialize(google_protobuf_FieldOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_FieldOptions_free(google_protobuf_FieldOptions *msg, upb_env *env);
-
-/* getters. */
-google_protobuf_FieldOptions_CType google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg);
-bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg);
-bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg);
-bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg);
-google_protobuf_FieldOptions_JSType google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg);
-bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg);
-const upb_array* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg);
-
-/* setters. */
-void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_CType value);
-void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value);
-void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value);
-void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value);
-void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_JSType value);
-void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value);
-void google_protobuf_FieldOptions_set_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_array* value);
-
-
-/* google_protobuf_OneofOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_OneofOptions_msginit;
-google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_env *env);
-google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_OneofOptions_serialize(google_protobuf_OneofOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_OneofOptions_free(google_protobuf_OneofOptions *msg, upb_env *env);
-
-/* getters. */
-const upb_array* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg);
-
-/* setters. */
-void google_protobuf_OneofOptions_set_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_array* value);
-
-
-/* google_protobuf_EnumOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_EnumOptions_msginit;
-google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_env *env);
-google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_EnumOptions_serialize(google_protobuf_EnumOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_EnumOptions_free(google_protobuf_EnumOptions *msg, upb_env *env);
-
-/* getters. */
-bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg);
-bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg);
-const upb_array* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg);
-
-/* setters. */
-void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value);
-void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value);
-void google_protobuf_EnumOptions_set_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_array* value);
-
-
-/* google_protobuf_EnumValueOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_EnumValueOptions_msginit;
-google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_env *env);
-google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_EnumValueOptions_serialize(google_protobuf_EnumValueOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_EnumValueOptions_free(google_protobuf_EnumValueOptions *msg, upb_env *env);
-
-/* getters. */
-bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg);
-const upb_array* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg);
-
-/* setters. */
-void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value);
-void google_protobuf_EnumValueOptions_set_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_array* value);
-
-
-/* google_protobuf_ServiceOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_ServiceOptions_msginit;
-google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_env *env);
-google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_ServiceOptions_serialize(google_protobuf_ServiceOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_ServiceOptions_free(google_protobuf_ServiceOptions *msg, upb_env *env);
-
-/* getters. */
-bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg);
-const upb_array* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg);
-
-/* setters. */
-void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value);
-void google_protobuf_ServiceOptions_set_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_array* value);
-
-
-/* google_protobuf_MethodOptions */
-extern const upb_msglayout_msginit_v1 google_protobuf_MethodOptions_msginit;
-google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_env *env);
-google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_MethodOptions_serialize(google_protobuf_MethodOptions *msg, upb_env *env, size_t *len);
-void google_protobuf_MethodOptions_free(google_protobuf_MethodOptions *msg, upb_env *env);
-
-/* getters. */
-bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg);
-google_protobuf_MethodOptions_IdempotencyLevel google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg);
-const upb_array* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg);
-
-/* setters. */
-void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value);
-void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, google_protobuf_MethodOptions_IdempotencyLevel value);
-void google_protobuf_MethodOptions_set_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_array* value);
-
-
-/* google_protobuf_UninterpretedOption */
-extern const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_msginit;
-google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_env *env);
-google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_UninterpretedOption_serialize(google_protobuf_UninterpretedOption *msg, upb_env *env, size_t *len);
-void google_protobuf_UninterpretedOption_free(google_protobuf_UninterpretedOption *msg, upb_env *env);
-
-/* getters. */
-const upb_array* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg);
-upb_stringview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg);
-uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg);
-int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg);
-double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg);
-upb_stringview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg);
-upb_stringview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg);
-
-/* setters. */
-void google_protobuf_UninterpretedOption_set_name(google_protobuf_UninterpretedOption *msg, upb_array* value);
-void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_stringview value);
-void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value);
-void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value);
-void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value);
-void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_stringview value);
-void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_stringview value);
-
-
-/* google_protobuf_UninterpretedOption_NamePart */
-extern const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_NamePart_msginit;
-google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_env *env);
-google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_UninterpretedOption_NamePart_serialize(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env, size_t *len);
-void google_protobuf_UninterpretedOption_NamePart_free(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env);
-
-/* getters. */
-upb_stringview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg);
-bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg);
-
-/* setters. */
-void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_stringview value);
-void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value);
-
-
-/* google_protobuf_SourceCodeInfo */
-extern const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_msginit;
-google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_env *env);
-google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_SourceCodeInfo_serialize(google_protobuf_SourceCodeInfo *msg, upb_env *env, size_t *len);
-void google_protobuf_SourceCodeInfo_free(google_protobuf_SourceCodeInfo *msg, upb_env *env);
-
-/* getters. */
-const upb_array* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg);
-
-/* setters. */
-void google_protobuf_SourceCodeInfo_set_location(google_protobuf_SourceCodeInfo *msg, upb_array* value);
-
-
-/* google_protobuf_SourceCodeInfo_Location */
-extern const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_Location_msginit;
-google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_env *env);
-google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_SourceCodeInfo_Location_serialize(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env, size_t *len);
-void google_protobuf_SourceCodeInfo_Location_free(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env);
-
-/* getters. */
-const upb_array* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg);
-const upb_array* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg);
-upb_stringview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg);
-upb_stringview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg);
-const upb_array* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg);
-
-/* setters. */
-void google_protobuf_SourceCodeInfo_Location_set_path(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value);
-void google_protobuf_SourceCodeInfo_Location_set_span(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value);
-void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value);
-void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value);
-void google_protobuf_SourceCodeInfo_Location_set_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value);
-
-
-/* google_protobuf_GeneratedCodeInfo */
-extern const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_msginit;
-google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_env *env);
-google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_GeneratedCodeInfo_serialize(google_protobuf_GeneratedCodeInfo *msg, upb_env *env, size_t *len);
-void google_protobuf_GeneratedCodeInfo_free(google_protobuf_GeneratedCodeInfo *msg, upb_env *env);
-
-/* getters. */
-const upb_array* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg);
-
-/* setters. */
-void google_protobuf_GeneratedCodeInfo_set_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_array* value);
-
-
-/* google_protobuf_GeneratedCodeInfo_Annotation */
-extern const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_Annotation_msginit;
-google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_env *env);
-google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_stringview buf, upb_env *env);
-char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env, size_t *len);
-void google_protobuf_GeneratedCodeInfo_Annotation_free(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env);
-
-/* getters. */
-const upb_array* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg);
-upb_stringview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg);
-int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg);
-int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg);
-
-/* setters. */
-void google_protobuf_GeneratedCodeInfo_Annotation_set_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_array* value);
-void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_stringview value);
-void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value);
-void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value);
-
-
-UPB_END_EXTERN_C
-
-#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
-/*
-** structs.int.h: structures definitions that are internal to upb.
-*/
-
-#ifndef UPB_STRUCTS_H_
-#define UPB_STRUCTS_H_
-
-struct upb_array {
- upb_fieldtype_t type;
- uint8_t element_size;
- void *data; /* Each element is element_size. */
- size_t len; /* Measured in elements. */
- size_t size; /* Measured in elements. */
- upb_alloc *alloc;
-};
-
-#endif /* UPB_STRUCTS_H_ */
-
-/*
-** This file contains definitions of structs that should be considered private
-** and NOT stable across versions of upb.
-**
-** The only reason they are declared here and not in .c files is to allow upb
-** and the application (if desired) to embed statically-initialized instances
-** of structures like defs.
-**
-** If you include this file, all guarantees of ABI compatibility go out the
-** window! Any code that includes this file needs to recompile against the
-** exact same version of upb that they are linking against.
-**
-** You also need to recompile if you change the value of the UPB_DEBUG_REFS
-** flag.
-*/
-
-
-#ifndef UPB_STATICINIT_H_
-#define UPB_STATICINIT_H_
-
-#ifdef __cplusplus
-/* Because of how we do our typedefs, this header can't be included from C++. */
-#error This file cannot be included from C++
-#endif
-
-/* upb_refcounted *************************************************************/
-
-
-/* upb_def ********************************************************************/
-
-struct upb_def {
- upb_refcounted base;
-
- const char *fullname;
- const upb_filedef* file;
- char type; /* A upb_deftype_t (char to save space) */
-
- /* Used as a flag during the def's mutable stage. Must be false unless
- * it is currently being used by a function on the stack. This allows
- * us to easily determine which defs were passed into the function's
- * current invocation. */
- bool came_from_user;
-};
-
-#define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \
- { UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false }
-
-
-/* upb_fielddef ***************************************************************/
-
-struct upb_fielddef {
- upb_def base;
-
- union {
- int64_t sint;
- uint64_t uint;
- double dbl;
- float flt;
- void *bytes;
- } defaultval;
- union {
- const upb_msgdef *def; /* If !msg_is_symbolic. */
- char *name; /* If msg_is_symbolic. */
- } msg;
- union {
- const upb_def *def; /* If !subdef_is_symbolic. */
- char *name; /* If subdef_is_symbolic. */
- } sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */
- bool subdef_is_symbolic;
- bool msg_is_symbolic;
- const upb_oneofdef *oneof;
- bool default_is_string;
- bool type_is_set_; /* False until type is explicitly set. */
- bool is_extension_;
- bool lazy_;
- bool packed_;
- upb_intfmt_t intfmt;
- bool tagdelim;
- upb_fieldtype_t type_;
- upb_label_t label_;
- uint32_t number_;
- uint32_t selector_base; /* Used to index into a upb::Handlers table. */
- uint32_t index_;
-};
-
-extern const struct upb_refcounted_vtbl upb_fielddef_vtbl;
-
-#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \
- packed, name, num, msgdef, subdef, selector_base, \
- index, defaultval, refs, ref2s) \
- { \
- UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \
- defaultval, {msgdef}, {subdef}, NULL, false, false, \
- type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \
- lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \
- }
-
-
-/* upb_msgdef *****************************************************************/
-
-struct upb_msgdef {
- upb_def base;
-
- size_t selector_count;
- uint32_t submsg_field_count;
-
- /* Tables for looking up fields by number and name. */
- upb_inttable itof; /* int to field */
- upb_strtable ntof; /* name to field/oneof */
-
- /* Is this a map-entry message? */
- bool map_entry;
-
- /* Whether this message has proto2 or proto3 semantics. */
- upb_syntax_t syntax;
-
- /* TODO(haberman): proper extension ranges (there can be multiple). */
-};
-
-extern const struct upb_refcounted_vtbl upb_msgdef_vtbl;
-
-/* TODO: also support static initialization of the oneofs table. This will be
- * needed if we compile in descriptors that contain oneofs. */
-#define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \
- map_entry, syntax, refs, ref2s) \
- { \
- UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \
- selector_count, submsg_field_count, itof, ntof, map_entry, syntax \
- }
-
-
-/* upb_enumdef ****************************************************************/
-
-struct upb_enumdef {
- upb_def base;
-
- upb_strtable ntoi;
- upb_inttable iton;
- int32_t defaultval;
-};
-
-extern const struct upb_refcounted_vtbl upb_enumdef_vtbl;
-
-#define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \
- { UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \
- iton, defaultval }
-
-
-/* upb_oneofdef ***************************************************************/
-
-struct upb_oneofdef {
- upb_refcounted base;
-
- uint32_t index; /* Index within oneofs. */
- const char *name;
- upb_strtable ntof;
- upb_inttable itof;
- const upb_msgdef *parent;
-};
-
-extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl;
-
-#define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \
- { UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof }
-
-
-/* upb_symtab *****************************************************************/
-
-struct upb_symtab {
- upb_refcounted base;
-
- upb_strtable symtab;
-};
-
-struct upb_filedef {
- upb_refcounted base;
-
- const char *name;
- const char *package;
- const char *phpprefix;
- const char *phpnamespace;
- upb_syntax_t syntax;
-
- upb_inttable defs;
- upb_inttable deps;
-};
-
-extern const struct upb_refcounted_vtbl upb_filedef_vtbl;
-
-#endif /* UPB_STATICINIT_H_ */
/*
** upb::descriptor::Reader (upb_descreader)
**
@@ -7814,6 +7003,53 @@ inline FileDef* Reader::file(size_t i) const {
UPB_BEGIN_EXTERN_C
+/* Enums */
+
+typedef enum {
+ google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
+ google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
+ google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
+} google_protobuf_FieldDescriptorProto_Label;
+
+typedef enum {
+ google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
+ google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
+ google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
+ google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
+ google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
+ google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
+ google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
+ google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
+ google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
+ google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
+ google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
+ google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
+ google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
+ google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
+ google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
+ google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
+ google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
+ google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
+} google_protobuf_FieldDescriptorProto_Type;
+
+typedef enum {
+ google_protobuf_FieldOptions_STRING = 0,
+ google_protobuf_FieldOptions_CORD = 1,
+ google_protobuf_FieldOptions_STRING_PIECE = 2
+} google_protobuf_FieldOptions_CType;
+
+typedef enum {
+ google_protobuf_FieldOptions_JS_NORMAL = 0,
+ google_protobuf_FieldOptions_JS_STRING = 1,
+ google_protobuf_FieldOptions_JS_NUMBER = 2
+} google_protobuf_FieldOptions_JSType;
+
+typedef enum {
+ google_protobuf_FileOptions_SPEED = 1,
+ google_protobuf_FileOptions_CODE_SIZE = 2,
+ google_protobuf_FileOptions_LITE_RUNTIME = 3
+} google_protobuf_FileOptions_OptimizeMode;
+
/* MessageDefs: call these functions to get a ref to a msgdef. */
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(const void *owner);
@@ -9054,9 +8290,21 @@ UPB_INLINE void upb_pbdecoder_unpackdispatch(uint64_t dispatch, uint64_t *ofs,
extern "C" {
#endif
+/* A list of types as they are encoded on-the-wire. */
+typedef enum {
+ UPB_WIRE_TYPE_VARINT = 0,
+ UPB_WIRE_TYPE_64BIT = 1,
+ UPB_WIRE_TYPE_DELIMITED = 2,
+ UPB_WIRE_TYPE_START_GROUP = 3,
+ UPB_WIRE_TYPE_END_GROUP = 4,
+ UPB_WIRE_TYPE_32BIT = 5
+} upb_wiretype_t;
+
#define UPB_MAX_WIRE_TYPE 5
-/* The maximum number of bytes that it takes to encode a 64-bit varint. */
+/* The maximum number of bytes that it takes to encode a 64-bit varint.
+ * Note that with a better encoding this could be 9 (TODO: write up a
+ * wiki document about this). */
#define UPB_PB_VARINT_MAX_LEN 10
/* Array of the "native" (ie. non-packed-repeated) wire type for the given a
diff --git a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/wrap_memcpy.c b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/wrap_memcpy.c
index 394a52f9f6..394a52f9f6 100644
--- a/third_party/protobuf/3.6.0/ruby/ext/google/protobuf_c/wrap_memcpy.c
+++ b/third_party/protobuf/3.4.0/ruby/ext/google/protobuf_c/wrap_memcpy.c
diff --git a/third_party/protobuf/3.6.0/ruby/google-protobuf.gemspec b/third_party/protobuf/3.4.0/ruby/google-protobuf.gemspec
index cc7625d46e..12338c04df 100644
--- a/third_party/protobuf/3.6.0/ruby/google-protobuf.gemspec
+++ b/third_party/protobuf/3.4.0/ruby/google-protobuf.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "google-protobuf"
- s.version = "3.6.0"
+ s.version = "3.4.0"
s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers"
s.description = "Protocol Buffers are Google's data interchange format."
diff --git a/third_party/protobuf/3.6.0/ruby/lib/google/protobuf.rb b/third_party/protobuf/3.4.0/ruby/lib/google/protobuf.rb
index 4a805e88cc..9b8d8231e2 100644
--- a/third_party/protobuf/3.6.0/ruby/lib/google/protobuf.rb
+++ b/third_party/protobuf/3.4.0/ruby/lib/google/protobuf.rb
@@ -60,8 +60,8 @@ module Google
msg.to_proto
end
- def self.encode_json(msg, options = {})
- msg.to_json(options)
+ def self.encode_json(msg)
+ msg.to_json
end
def self.decode(klass, proto)
diff --git a/third_party/protobuf/3.6.0/ruby/lib/google/protobuf/message_exts.rb b/third_party/protobuf/3.4.0/ruby/lib/google/protobuf/message_exts.rb
index f432f89fed..e10266ba2f 100644
--- a/third_party/protobuf/3.6.0/ruby/lib/google/protobuf/message_exts.rb
+++ b/third_party/protobuf/3.4.0/ruby/lib/google/protobuf/message_exts.rb
@@ -40,8 +40,8 @@ module Google
module ClassMethods
end
- def to_json(options = {})
- self.class.encode_json(self, options)
+ def to_json
+ self.class.encode_json(self)
end
def to_proto
diff --git a/third_party/protobuf/3.6.0/ruby/lib/google/protobuf/repeated_field.rb b/third_party/protobuf/3.4.0/ruby/lib/google/protobuf/repeated_field.rb
index 2dae1e65aa..11d6c2eb8c 100644
--- a/third_party/protobuf/3.6.0/ruby/lib/google/protobuf/repeated_field.rb
+++ b/third_party/protobuf/3.4.0/ruby/lib/google/protobuf/repeated_field.rb
@@ -150,12 +150,12 @@ module Google
end
- %w(delete delete_at shift slice! unshift).each do |method_name|
+ %w(delete delete_at delete_if shift slice! unshift).each do |method_name|
define_array_wrapper_method(method_name)
end
- %w(collect! compact! delete_if fill flatten! insert reverse!
+ %w(collect! compact! fill flatten! insert reverse!
rotate! select! shuffle! sort! sort_by! uniq!).each do |method_name|
define_array_wrapper_with_result_method(method_name)
end
diff --git a/third_party/protobuf/3.6.0/ruby/lib/google/protobuf/well_known_types.rb b/third_party/protobuf/3.4.0/ruby/lib/google/protobuf/well_known_types.rb
index 921ddbc06f..921ddbc06f 100644
--- a/third_party/protobuf/3.6.0/ruby/lib/google/protobuf/well_known_types.rb
+++ b/third_party/protobuf/3.4.0/ruby/lib/google/protobuf/well_known_types.rb
diff --git a/third_party/protobuf/3.6.0/ruby/pom.xml b/third_party/protobuf/3.4.0/ruby/pom.xml
index adf6ff207d..adf6ff207d 100644
--- a/third_party/protobuf/3.6.0/ruby/pom.xml
+++ b/third_party/protobuf/3.4.0/ruby/pom.xml
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java
index 5addae58da..5addae58da 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java
index dd9179b030..dd9179b030 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java
index 0345cb991b..0345cb991b 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java
index 929d869990..929d869990 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java
index e4cac34581..e4cac34581 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java
index 4df832d0cf..4df832d0cf 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java
index f3c488bc98..f3c488bc98 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java
index 3adaa2a8bd..3adaa2a8bd 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java
index 07558fbcf0..733ccfbc7d 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java
@@ -82,8 +82,8 @@ public class RubyMessage extends RubyObject {
hash.visitAll(new RubyHash.Visitor() {
@Override
public void visit(IRubyObject key, IRubyObject value) {
- if (!(key instanceof RubySymbol) && !(key instanceof RubyString))
- throw runtime.newTypeError("Expected string or symbols as hash keys in initialization map.");
+ if (!(key instanceof RubySymbol))
+ throw runtime.newTypeError("Expected symbols as hash keys in initialization map.");
final Descriptors.FieldDescriptor fieldDescriptor = findField(context, key);
if (Utils.isMapEntry(fieldDescriptor)) {
@@ -103,15 +103,9 @@ public class RubyMessage extends RubyObject {
if (oneof != null) {
oneofCases.put(oneof, fieldDescriptor);
}
-
- if (value instanceof RubyHash && fieldDescriptor.getType() == Descriptors.FieldDescriptor.Type.MESSAGE) {
- RubyDescriptor descriptor = (RubyDescriptor) getDescriptorForField(context, fieldDescriptor);
- RubyClass typeClass = (RubyClass) descriptor.msgclass(context);
- value = (IRubyObject) typeClass.newInstance(context, value, Block.NULL_BLOCK);
- }
-
fields.put(fieldDescriptor, value);
}
+
}
});
}
@@ -373,19 +367,7 @@ public class RubyMessage extends RubyObject {
for (Descriptors.FieldDescriptor fdef : this.descriptor.getFields()) {
IRubyObject value = getField(context, fdef);
if (!value.isNil()) {
- if (fdef.isRepeated() && !fdef.isMapField()) {
- if (fdef.getType() != Descriptors.FieldDescriptor.Type.MESSAGE) {
- value = Helpers.invoke(context, value, "to_a");
- } else {
- RubyArray ary = value.convertToArray();
- for (int i = 0; i < ary.size(); i++) {
- IRubyObject submsg = Helpers.invoke(context, ary.eltInternal(i), "to_h");
- ary.eltInternalSet(i, submsg);
- }
-
- value = ary.to_ary();
- }
- } else if (value.respondsTo("to_h")) {
+ if (value.respondsTo("to_h")) {
value = Helpers.invoke(context, value, "to_h");
} else if (value.respondsTo("to_a")) {
value = Helpers.invoke(context, value, "to_a");
@@ -536,12 +518,19 @@ public class RubyMessage extends RubyObject {
val = value.isTrue();
break;
case BYTES:
- Utils.validateStringEncoding(context, fieldDescriptor.getType(), value);
- val = ByteString.copyFrom(((RubyString) value).getBytes());
- break;
case STRING:
Utils.validateStringEncoding(context, fieldDescriptor.getType(), value);
- val = ((RubyString) value).asJavaString();
+ RubyString str = (RubyString) value;
+ switch (fieldDescriptor.getType()) {
+ case BYTES:
+ val = ByteString.copyFrom(str.getBytes());
+ break;
+ case STRING:
+ val = str.asJavaString();
+ break;
+ default:
+ break;
+ }
break;
case MESSAGE:
RubyClass typeClass = (RubyClass) ((RubyDescriptor) getDescriptorForField(context, fieldDescriptor)).msgclass(context);
@@ -554,7 +543,7 @@ public class RubyMessage extends RubyObject {
if (Utils.isRubyNum(value)) {
val = enumDescriptor.findValueByNumberCreatingIfUnknown(RubyNumeric.num2int(value));
- } else if (value instanceof RubySymbol || value instanceof RubyString) {
+ } else if (value instanceof RubySymbol) {
val = enumDescriptor.findValueByName(value.asJavaString());
} else {
throw runtime.newTypeError("Expected number or symbol type for enum field.");
@@ -752,20 +741,8 @@ public class RubyMessage extends RubyObject {
Descriptors.FieldDescriptor fieldDescriptor, IRubyObject value) {
RubyArray arr = value.convertToArray();
RubyRepeatedField repeatedField = repeatedFieldForFieldDescriptor(context, fieldDescriptor);
-
- RubyClass typeClass = null;
- if (fieldDescriptor.getType() == Descriptors.FieldDescriptor.Type.MESSAGE) {
- RubyDescriptor descriptor = (RubyDescriptor) getDescriptorForField(context, fieldDescriptor);
- typeClass = (RubyClass) descriptor.msgclass(context);
- }
-
for (int i = 0; i < arr.size(); i++) {
- IRubyObject row = arr.eltInternal(i);
- if (row instanceof RubyHash && typeClass != null) {
- row = (IRubyObject) typeClass.newInstance(context, row, Block.NULL_BLOCK);
- }
-
- repeatedField.push(context, row);
+ repeatedField.push(context, arr.eltInternal(i));
}
return repeatedField;
}
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java
index a619b803cc..a619b803cc 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java
index c9b99e0489..c9b99e0489 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java
index cc4ab66284..cc4ab66284 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java
index 2cf210d26f..2cf210d26f 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java
index ae2907a985..ae2907a985 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/SentinelOuterClass.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/SentinelOuterClass.java
index 54f2c729a2..54f2c729a2 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/SentinelOuterClass.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/SentinelOuterClass.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/Utils.java b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/Utils.java
index f199feb962..f199feb962 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/com/google/protobuf/jruby/Utils.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/com/google/protobuf/jruby/Utils.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/java/google/ProtobufJavaService.java b/third_party/protobuf/3.4.0/ruby/src/main/java/google/ProtobufJavaService.java
index bffb492a9e..bffb492a9e 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/java/google/ProtobufJavaService.java
+++ b/third_party/protobuf/3.4.0/ruby/src/main/java/google/ProtobufJavaService.java
diff --git a/third_party/protobuf/3.6.0/ruby/src/main/sentinel.proto b/third_party/protobuf/3.4.0/ruby/src/main/sentinel.proto
index 722041ba07..722041ba07 100644
--- a/third_party/protobuf/3.6.0/ruby/src/main/sentinel.proto
+++ b/third_party/protobuf/3.4.0/ruby/src/main/sentinel.proto
diff --git a/third_party/protobuf/3.6.0/ruby/tests/basic.rb b/third_party/protobuf/3.4.0/ruby/tests/basic.rb
index ad34d53d91..020effb056 100644
--- a/third_party/protobuf/3.6.0/ruby/tests/basic.rb
+++ b/third_party/protobuf/3.4.0/ruby/tests/basic.rb
@@ -51,17 +51,6 @@ module BasicTest
optional :foo, :int32, 1
end
- add_message "TestEmbeddedMessageParent" do
- optional :child_msg, :message, 1, "TestEmbeddedMessageChild"
- optional :number, :int32, 2
-
- repeated :repeated_msg, :message, 3, "TestEmbeddedMessageChild"
- repeated :repeated_number, :int32, 4
- end
- add_message "TestEmbeddedMessageChild" do
- optional :sub_child, :message, 1, "TestMessage"
- end
-
add_message "Recursive1" do
optional :foo, :message, 1, "Recursive2"
end
@@ -107,25 +96,13 @@ module BasicTest
optional :d, :enum, 4, "TestEnum"
end
end
-
- add_message "repro.Outer" do
- map :items, :int32, :message, 1, "repro.Inner"
- end
-
- add_message "repro.Inner" do
- end
end
-
- Outer = pool.lookup("repro.Outer").msgclass
- Inner = pool.lookup("repro.Inner").msgclass
Foo = pool.lookup("Foo").msgclass
Bar = pool.lookup("Bar").msgclass
Baz = pool.lookup("Baz").msgclass
TestMessage = pool.lookup("TestMessage").msgclass
TestMessage2 = pool.lookup("TestMessage2").msgclass
- TestEmbeddedMessageParent = pool.lookup("TestEmbeddedMessageParent").msgclass
- TestEmbeddedMessageChild = pool.lookup("TestEmbeddedMessageChild").msgclass
Recursive1 = pool.lookup("Recursive1").msgclass
Recursive2 = pool.lookup("Recursive2").msgclass
TestEnum = pool.lookup("TestEnum").enummodule
@@ -174,18 +151,12 @@ module BasicTest
m.optional_double = 0.5
m.optional_string = "hello"
assert m.optional_string == "hello"
- m.optional_string = :hello
- assert m.optional_string == "hello"
m.optional_bytes = "world".encode!('ASCII-8BIT')
assert m.optional_bytes == "world"
m.optional_msg = TestMessage2.new(:foo => 42)
assert m.optional_msg == TestMessage2.new(:foo => 42)
m.optional_msg = nil
assert m.optional_msg == nil
- m.optional_enum = :C
- assert m.optional_enum == :C
- m.optional_enum = 'C'
- assert m.optional_enum == :C
end
def test_ctor_args
@@ -202,34 +173,6 @@ module BasicTest
assert m.repeated_string[2] == "world"
end
- def test_ctor_string_symbol_args
- m = TestMessage.new(:optional_enum => 'C', :repeated_enum => ['A', 'B'])
- assert_equal :C, m.optional_enum
- assert_equal [:A, :B], m.repeated_enum
-
- m = TestMessage.new(:optional_string => :foo, :repeated_string => [:foo, :bar])
- assert_equal 'foo', m.optional_string
- assert_equal ['foo', 'bar'], m.repeated_string
- end
-
- def test_embeddedmsg_hash_init
- m = TestEmbeddedMessageParent.new(:child_msg => {sub_child: {optional_int32: 1}},
- :number => 2,
- :repeated_msg => [{sub_child: {optional_int32: 3}}],
- :repeated_number => [10, 20, 30])
-
- assert_equal 2, m.number
- assert_equal [10, 20, 30], m.repeated_number
-
- assert_not_nil m.child_msg
- assert_not_nil m.child_msg.sub_child
- assert_equal m.child_msg.sub_child.optional_int32, 1
-
- assert_not_nil m.repeated_msg
- assert_equal 1, m.repeated_msg.length
- assert_equal 3, m.repeated_msg.first.sub_child.optional_int32
- end
-
def test_inspect
m = TestMessage.new(:optional_int32 => -42,
:optional_enum => :A,
@@ -661,7 +604,7 @@ module BasicTest
assert_raise RangeError do
m["z"] = :Z
end
- assert_raise RangeError do
+ assert_raise TypeError do
m["z"] = "z"
end
end
@@ -732,21 +675,6 @@ module BasicTest
m.map_string_int32['aaa'] = 3
end
- def test_concurrent_decoding
- o = Outer.new
- o.items[0] = Inner.new
- raw = Outer.encode(o)
-
- thds = 2.times.map do
- Thread.new do
- 100000.times do
- assert_equal o, Outer.decode(raw)
- end
- end
- end
- thds.map(&:join)
- end
-
def test_map_encode_decode
m = MapMessage.new(
:map_string_int32 => {"a" => 1, "b" => 2},
@@ -974,7 +902,7 @@ module BasicTest
end
def test_to_h
- m = TestMessage.new(:optional_bool => true, :optional_double => -10.100001, :optional_string => 'foo', :repeated_string => ['bar1', 'bar2'], :repeated_msg => [TestMessage2.new(:foo => 100)])
+ m = TestMessage.new(:optional_bool => true, :optional_double => -10.100001, :optional_string => 'foo', :repeated_string => ['bar1', 'bar2'])
expected_result = {
:optional_bool=>true,
:optional_bytes=>"",
@@ -994,7 +922,7 @@ module BasicTest
:repeated_float=>[],
:repeated_int32=>[],
:repeated_int64=>[],
- :repeated_msg=>[{:foo => 100}],
+ :repeated_msg=>[],
:repeated_string=>["bar1", "bar2"],
:repeated_uint32=>[],
:repeated_uint64=>[]
diff --git a/third_party/protobuf/3.6.0/ruby/tests/generated_code.proto b/third_party/protobuf/3.4.0/ruby/tests/generated_code.proto
index 3b934bd691..62fd83ed89 100644
--- a/third_party/protobuf/3.6.0/ruby/tests/generated_code.proto
+++ b/third_party/protobuf/3.4.0/ruby/tests/generated_code.proto
@@ -57,9 +57,6 @@ message TestMessage {
}
NestedMessage nested_message = 80;
-
- // Reserved for non-existing field test.
- // int32 non_exist = 89;
}
enum TestEnum {
@@ -68,13 +65,3 @@ enum TestEnum {
B = 2;
C = 3;
}
-
-message TestUnknown {
- TestUnknown optional_unknown = 11;
- repeated TestUnknown repeated_unknown = 31;
- oneof my_oneof {
- TestUnknown oneof_unknown = 51;
- }
- map<string, TestUnknown> map_unknown = 67;
- int32 unknown_field = 89;
-}
diff --git a/third_party/protobuf/3.6.0/ruby/tests/generated_code_test.rb b/third_party/protobuf/3.4.0/ruby/tests/generated_code_test.rb
index 431d681bb3..b92b0462d1 100644
--- a/third_party/protobuf/3.6.0/ruby/tests/generated_code_test.rb
+++ b/third_party/protobuf/3.4.0/ruby/tests/generated_code_test.rb
@@ -5,7 +5,6 @@ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
require 'generated_code_pb'
require 'test_import_pb'
-require 'test_ruby_package_pb'
require 'test/unit'
class GeneratedCodeTest < Test::Unit::TestCase
@@ -16,6 +15,5 @@ class GeneratedCodeTest < Test::Unit::TestCase
# aspect of the extension (basic.rb is for that).
m = A::B::C::TestMessage.new()
m2 = FooBar::TestImportedMessage.new()
- m3 = A::B::TestRubyPackageMessage.new()
end
end
diff --git a/third_party/protobuf/3.6.0/ruby/tests/repeated_field_test.rb b/third_party/protobuf/3.4.0/ruby/tests/repeated_field_test.rb
index 61ac4afd07..25727b7b28 100644
--- a/third_party/protobuf/3.6.0/ruby/tests/repeated_field_test.rb
+++ b/third_party/protobuf/3.4.0/ruby/tests/repeated_field_test.rb
@@ -126,12 +126,6 @@ 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)
@@ -369,15 +363,6 @@ class RepeatedFieldTest < Test::Unit::TestCase
end
end
- def test_delete_if
- m = TestMessage.new
- reference_arr = %w(foo bar baz)
- m.repeated_string += reference_arr.clone
- check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
- arr.delete_if { |v| v == "bar" }
- end
- end
-
def test_fill
m = TestMessage.new
reference_arr = %w(foo bar baz)
diff --git a/third_party/protobuf/3.6.0/ruby/tests/stress.rb b/third_party/protobuf/3.4.0/ruby/tests/stress.rb
index 082d5e22df..082d5e22df 100644
--- a/third_party/protobuf/3.6.0/ruby/tests/stress.rb
+++ b/third_party/protobuf/3.4.0/ruby/tests/stress.rb
diff --git a/third_party/protobuf/3.6.0/ruby/tests/test_import.proto b/third_party/protobuf/3.4.0/ruby/tests/test_import.proto
index 230484ee57..230484ee57 100644
--- a/third_party/protobuf/3.6.0/ruby/tests/test_import.proto
+++ b/third_party/protobuf/3.4.0/ruby/tests/test_import.proto
diff --git a/third_party/protobuf/3.6.0/ruby/tests/well_known_types_test.rb b/third_party/protobuf/3.4.0/ruby/tests/well_known_types_test.rb
index bd24c32884..bd24c32884 100644
--- a/third_party/protobuf/3.6.0/ruby/tests/well_known_types_test.rb
+++ b/third_party/protobuf/3.4.0/ruby/tests/well_known_types_test.rb
diff --git a/third_party/protobuf/3.6.0/ruby/travis-test.sh b/third_party/protobuf/3.4.0/ruby/travis-test.sh
index cbe7cd983c..52ea81b616 100644..100755
--- a/third_party/protobuf/3.6.0/ruby/travis-test.sh
+++ b/third_party/protobuf/3.4.0/ruby/travis-test.sh
@@ -20,7 +20,6 @@ test_version() {
git clean -f && \
gem install bundler && bundle && \
rake test &&
- rake gc_test &&
cd ../conformance && make test_ruby &&
cd ../ruby/compatibility_tests/v3.0.0 && ./test.sh"
fi
diff --git a/third_party/protobuf/3.6.0/six.BUILD b/third_party/protobuf/3.4.0/six.BUILD
index fb0b3604cd..fb0b3604cd 100644
--- a/third_party/protobuf/3.6.0/six.BUILD
+++ b/third_party/protobuf/3.4.0/six.BUILD
diff --git a/third_party/protobuf/3.6.0/src/Makefile.am b/third_party/protobuf/3.4.0/src/Makefile.am
index fb247300d4..1999213c78 100644
--- a/third_party/protobuf/3.6.0/src/Makefile.am
+++ b/third_party/protobuf/3.4.0/src/Makefile.am
@@ -64,6 +64,21 @@ MAINTAINERCLEANFILES = \
Makefile.in
nobase_include_HEADERS = \
+ google/protobuf/stubs/atomic_sequence_num.h \
+ google/protobuf/stubs/atomicops.h \
+ google/protobuf/stubs/atomicops_internals_power.h \
+ google/protobuf/stubs/atomicops_internals_ppc_gcc.h \
+ google/protobuf/stubs/atomicops_internals_arm64_gcc.h \
+ google/protobuf/stubs/atomicops_internals_arm_gcc.h \
+ google/protobuf/stubs/atomicops_internals_arm_qnx.h \
+ google/protobuf/stubs/atomicops_internals_atomicword_compat.h \
+ google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h \
+ google/protobuf/stubs/atomicops_internals_generic_gcc.h \
+ google/protobuf/stubs/atomicops_internals_mips_gcc.h \
+ google/protobuf/stubs/atomicops_internals_solaris.h \
+ google/protobuf/stubs/atomicops_internals_tsan.h \
+ google/protobuf/stubs/atomicops_internals_x86_gcc.h \
+ google/protobuf/stubs/atomicops_internals_x86_msvc.h \
google/protobuf/stubs/callback.h \
google/protobuf/stubs/bytestream.h \
google/protobuf/stubs/casts.h \
@@ -76,11 +91,14 @@ nobase_include_HEADERS = \
google/protobuf/stubs/once.h \
google/protobuf/stubs/platform_macros.h \
google/protobuf/stubs/port.h \
+ google/protobuf/stubs/scoped_ptr.h \
+ google/protobuf/stubs/shared_ptr.h \
google/protobuf/stubs/singleton.h \
google/protobuf/stubs/status.h \
google/protobuf/stubs/stl_util.h \
google/protobuf/stubs/stringpiece.h \
google/protobuf/stubs/template_util.h \
+ google/protobuf/stubs/type_traits.h \
google/protobuf/any.pb.h \
google/protobuf/api.pb.h \
google/protobuf/any.h \
@@ -101,8 +119,6 @@ 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/inlined_string_field.h \
google/protobuf/map_entry.h \
google/protobuf/map_entry_lite.h \
google/protobuf/map_field.h \
@@ -147,6 +163,7 @@ nobase_include_HEADERS = \
google/protobuf/compiler/csharp/csharp_names.h \
google/protobuf/compiler/java/java_generator.h \
google/protobuf/compiler/java/java_names.h \
+ google/protobuf/compiler/javanano/javanano_generator.h \
google/protobuf/compiler/js/js_generator.h \
google/protobuf/compiler/js/well_known_types_embed.h \
google/protobuf/compiler/objectivec/objectivec_generator.h \
@@ -166,12 +183,14 @@ nobase_include_HEADERS = \
lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la
libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS)
-libprotobuf_lite_la_LDFLAGS = -version-info 16:0:0 -export-dynamic -no-undefined
+libprotobuf_lite_la_LDFLAGS = -version-info 14:0:0 -export-dynamic -no-undefined
if HAVE_LD_VERSION_SCRIPT
libprotobuf_lite_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf-lite.map
EXTRA_libprotobuf_lite_la_DEPENDENCIES = libprotobuf-lite.map
endif
libprotobuf_lite_la_SOURCES = \
+ google/protobuf/stubs/atomicops_internals_x86_gcc.cc \
+ google/protobuf/stubs/atomicops_internals_x86_msvc.cc \
google/protobuf/stubs/bytestream.cc \
google/protobuf/stubs/bytestream.h \
google/protobuf/stubs/common.cc \
@@ -182,6 +201,8 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/stubs/io_win32.h \
google/protobuf/stubs/map_util.h \
google/protobuf/stubs/mathutil.h \
+ google/protobuf/stubs/once.cc \
+ google/protobuf/stubs/shared_ptr.h \
google/protobuf/stubs/status.cc \
google/protobuf/stubs/status.h \
google/protobuf/stubs/status_macros.h \
@@ -202,7 +223,6 @@ 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 \
@@ -212,7 +232,7 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/io/zero_copy_stream_impl_lite.cc
libprotobuf_la_LIBADD = $(PTHREAD_LIBS)
-libprotobuf_la_LDFLAGS = -version-info 16:0:0 -export-dynamic -no-undefined
+libprotobuf_la_LDFLAGS = -version-info 14:0:0 -export-dynamic -no-undefined
if HAVE_LD_VERSION_SCRIPT
libprotobuf_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf.map
EXTRA_libprotobuf_la_DEPENDENCIES = libprotobuf.map
@@ -303,7 +323,7 @@ libprotobuf_la_SOURCES = \
nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES)
libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la
-libprotoc_la_LDFLAGS = -version-info 16:0:0 -export-dynamic -no-undefined
+libprotoc_la_LDFLAGS = -version-info 14:0:0 -export-dynamic -no-undefined
if HAVE_LD_VERSION_SCRIPT
libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map
EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map
@@ -336,10 +356,7 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/cpp/cpp_message.h \
google/protobuf/compiler/cpp/cpp_message_field.cc \
google/protobuf/compiler/cpp/cpp_message_field.h \
- google/protobuf/compiler/cpp/cpp_message_layout_helper.h \
google/protobuf/compiler/cpp/cpp_options.h \
- google/protobuf/compiler/cpp/cpp_padding_optimizer.cc \
- google/protobuf/compiler/cpp/cpp_padding_optimizer.h \
google/protobuf/compiler/cpp/cpp_primitive_field.cc \
google/protobuf/compiler/cpp/cpp_primitive_field.h \
google/protobuf/compiler/cpp/cpp_service.cc \
@@ -408,6 +425,29 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/java/java_doc_comment.h \
google/protobuf/compiler/js/js_generator.cc \
google/protobuf/compiler/js/well_known_types_embed.cc \
+ google/protobuf/compiler/javanano/javanano_enum.cc \
+ google/protobuf/compiler/javanano/javanano_enum.h \
+ google/protobuf/compiler/javanano/javanano_enum_field.cc \
+ google/protobuf/compiler/javanano/javanano_enum_field.h \
+ google/protobuf/compiler/javanano/javanano_extension.cc \
+ google/protobuf/compiler/javanano/javanano_extension.h \
+ google/protobuf/compiler/javanano/javanano_field.cc \
+ google/protobuf/compiler/javanano/javanano_field.h \
+ google/protobuf/compiler/javanano/javanano_file.cc \
+ google/protobuf/compiler/javanano/javanano_file.h \
+ google/protobuf/compiler/javanano/javanano_generator.cc \
+ google/protobuf/compiler/javanano/javanano_generator.h \
+ google/protobuf/compiler/javanano/javanano_helpers.cc \
+ google/protobuf/compiler/javanano/javanano_helpers.h \
+ google/protobuf/compiler/javanano/javanano_map_field.cc \
+ google/protobuf/compiler/javanano/javanano_map_field.h \
+ google/protobuf/compiler/javanano/javanano_message.cc \
+ google/protobuf/compiler/javanano/javanano_message.h \
+ google/protobuf/compiler/javanano/javanano_message_field.cc \
+ google/protobuf/compiler/javanano/javanano_message_field.h \
+ google/protobuf/compiler/javanano/javanano_params.h \
+ google/protobuf/compiler/javanano/javanano_primitive_field.cc \
+ google/protobuf/compiler/javanano/javanano_primitive_field.h \
google/protobuf/compiler/objectivec/objectivec_enum.cc \
google/protobuf/compiler/objectivec/objectivec_enum.h \
google/protobuf/compiler/objectivec/objectivec_enum_field.cc \
@@ -483,7 +523,6 @@ js_well_known_types_sources = \
google/protobuf/compiler/js/well_known_types/timestamp.js
# We have to cd to $(srcdir) so that out-of-tree builds work properly.
google/protobuf/compiler/js/well_known_types_embed.cc: js_embed$(EXEEXT) $(js_well_known_types_sources)
- mkdir -p `dirname $@` && \
oldpwd=`pwd` && cd $(srcdir) && \
$$oldpwd/js_embed$(EXEEXT) $(js_well_known_types_sources) > $$oldpwd/$@
@@ -522,8 +561,8 @@ protoc_inputs = \
google/protobuf/unittest_preserve_unknown_enum.proto \
google/protobuf/unittest.proto \
google/protobuf/unittest_proto3_arena.proto \
- google/protobuf/unittest_proto3_arena_lite.proto \
- google/protobuf/unittest_proto3_lite.proto \
+ google/protobuf/unittest_proto3_arena_lite.proto \
+ google/protobuf/unittest_proto3_lite.proto \
google/protobuf/unittest_well_known_types.proto \
google/protobuf/util/internal/testdata/anys.proto \
google/protobuf/util/internal/testdata/books.proto \
@@ -544,9 +583,6 @@ EXTRA_DIST = \
$(protoc_inputs) \
$(js_well_known_types_sources) \
solaris/libstdc++.la \
- google/protobuf/unittest_proto3.proto \
- google/protobuf/test_messages_proto3.proto \
- google/protobuf/test_messages_proto2.proto \
google/protobuf/io/gzip_stream.h \
google/protobuf/io/gzip_stream_unittest.sh \
google/protobuf/testdata/golden_message \
@@ -678,6 +714,8 @@ protoc_outputs = \
google/protobuf/util/message_differencer_unittest.pb.cc \
google/protobuf/util/message_differencer_unittest.pb.h
+BUILT_SOURCES = $(protoc_outputs) google/protobuf/compiler/js/well_known_types_embed.cc
+
if USE_EXTERNAL_PROTOC
unittest_proto_middleman: $(protoc_inputs)
@@ -705,25 +743,20 @@ COMMON_TEST_SOURCES = \
google/protobuf/map_test_util_impl.h \
google/protobuf/test_util.cc \
google/protobuf/test_util.h \
- google/protobuf/test_util.inc \
google/protobuf/testing/googletest.cc \
google/protobuf/testing/googletest.h \
google/protobuf/testing/file.cc \
google/protobuf/testing/file.h
-GOOGLETEST_BUILD_DIR=../third_party/googletest/googletest
-GOOGLEMOCK_BUILD_DIR=../third_party/googletest/googlemock
-GOOGLETEST_SRC_DIR=$(srcdir)/../third_party/googletest/googletest
-GOOGLEMOCK_SRC_DIR=$(srcdir)/../third_party/googletest/googlemock
check_PROGRAMS = protoc protobuf-test protobuf-lazy-descriptor-test \
protobuf-lite-test test_plugin protobuf-lite-arena-test \
no-warning-test $(GZCHECKPROGRAMS)
protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
- $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
- $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
- $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
-protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \
- -I$(GOOGLEMOCK_SRC_DIR)/include
+ ../gmock/gtest/lib/libgtest.la \
+ ../gmock/lib/libgmock.la \
+ ../gmock/lib/libgmock_main.la
+protobuf_test_CPPFLAGS = -I$(srcdir)/../gmock/gtest/include \
+ -I$(srcdir)/../gmock/include
# Disable optimization for tests unless the user explicitly asked for it,
# since test_util.cc takes forever to compile with optimization (with GCC).
# See configure.ac for more info.
@@ -733,6 +766,7 @@ protobuf_test_SOURCES = \
google/protobuf/stubs/common_unittest.cc \
google/protobuf/stubs/int128_unittest.cc \
google/protobuf/stubs/io_win32_unittest.cc \
+ google/protobuf/stubs/once_unittest.cc \
google/protobuf/stubs/statusor_test.cc \
google/protobuf/stubs/status_test.cc \
google/protobuf/stubs/stringpiece_unittest.cc \
@@ -741,6 +775,7 @@ protobuf_test_SOURCES = \
google/protobuf/stubs/strutil_unittest.cc \
google/protobuf/stubs/template_util_unittest.cc \
google/protobuf/stubs/time_test.cc \
+ google/protobuf/stubs/type_traits_unittest.cc \
google/protobuf/any_test.cc \
google/protobuf/arenastring_unittest.cc \
google/protobuf/arena_unittest.cc \
@@ -753,11 +788,10 @@ protobuf_test_SOURCES = \
google/protobuf/map_field_test.cc \
google/protobuf/map_test.cc \
google/protobuf/message_unittest.cc \
- google/protobuf/message_unittest.inc \
google/protobuf/no_field_presence_test.cc \
google/protobuf/preserve_unknown_enum_test.cc \
- google/protobuf/proto3_arena_lite_unittest.cc \
google/protobuf/proto3_arena_unittest.cc \
+ google/protobuf/proto3_arena_lite_unittest.cc \
google/protobuf/proto3_lite_unittest.cc \
google/protobuf/reflection_ops_unittest.cc \
google/protobuf/repeated_field_reflection_unittest.cc \
@@ -770,8 +804,6 @@ protobuf_test_SOURCES = \
google/protobuf/io/printer_unittest.cc \
google/protobuf/io/tokenizer_unittest.cc \
google/protobuf/io/zero_copy_stream_unittest.cc \
- google/protobuf/compiler/annotation_test_util.h \
- google/protobuf/compiler/annotation_test_util.cc \
google/protobuf/compiler/command_line_interface_unittest.cc \
google/protobuf/compiler/importer_unittest.cc \
google/protobuf/compiler/mock_code_generator.cc \
@@ -781,7 +813,6 @@ protobuf_test_SOURCES = \
google/protobuf/compiler/cpp/cpp_move_unittest.cc \
google/protobuf/compiler/cpp/cpp_unittest.h \
google/protobuf/compiler/cpp/cpp_unittest.cc \
- google/protobuf/compiler/cpp/cpp_unittest.inc \
google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \
google/protobuf/compiler/cpp/metadata_test.cc \
google/protobuf/compiler/java/java_plugin_unittest.cc \
@@ -805,24 +836,24 @@ protobuf_test_SOURCES = \
google/protobuf/util/time_util_test.cc \
google/protobuf/util/type_resolver_util_test.cc \
$(COMMON_TEST_SOURCES)
+
+
nodist_protobuf_test_SOURCES = $(protoc_outputs)
-$(am_protobuf_test_OBJECTS): unittest_proto_middleman
# Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined.
protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
libprotoc.la \
- $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
- $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
- $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
-protobuf_lazy_descriptor_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \
- -I$(GOOGLETEST_SRC_DIR)/include \
+ ../gmock/gtest/lib/libgtest.la \
+ ../gmock/lib/libgmock.la \
+ ../gmock/lib/libgmock_main.la
+protobuf_lazy_descriptor_test_CPPFLAGS = -I$(srcdir)/../gmock/include \
+ -I$(srcdir)/../gmock/gtest/include \
-DPROTOBUF_TEST_NO_DESCRIPTORS
protobuf_lazy_descriptor_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
protobuf_lazy_descriptor_test_SOURCES = \
google/protobuf/compiler/cpp/cpp_unittest.cc \
$(COMMON_TEST_SOURCES)
nodist_protobuf_lazy_descriptor_test_SOURCES = $(protoc_outputs)
-$(am_protobuf_lazy_descriptor_test_OBJECTS): unittest_proto_middleman
COMMON_LITE_TEST_SOURCES = \
google/protobuf/arena_test_util.cc \
@@ -836,39 +867,37 @@ COMMON_LITE_TEST_SOURCES = \
# depend on gtest because our internal version of gtest depend on proto
# full runtime and we want to make sure this test builds without full
# runtime.
-protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \
- $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
- $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
- $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
-protobuf_lite_test_CPPFLAGS= -I$(GOOGLEMOCK_SRC_DIR)/include \
- -I$(GOOGLETEST_SRC_DIR)/include
+protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \
+ ../gmock/gtest/lib/libgtest.la \
+ ../gmock/lib/libgmock.la \
+ ../gmock/lib/libgmock_main.la
+protobuf_lite_test_CPPFLAGS= -I$(srcdir)/../gmock/include \
+ -I$(srcdir)/../gmock/gtest/include
protobuf_lite_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
protobuf_lite_test_SOURCES = \
google/protobuf/lite_unittest.cc \
$(COMMON_LITE_TEST_SOURCES)
nodist_protobuf_lite_test_SOURCES = $(protoc_lite_outputs)
-$(am_protobuf_lite_test_OBJECTS): unittest_proto_middleman
# lite_arena_unittest depends on gtest because teboring@ found that without
# gtest when building the test internally our memory sanitizer doesn't detect
# memory leaks (don't know why).
protobuf_lite_arena_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \
- $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
- $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
- $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
-protobuf_lite_arena_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \
- -I$(GOOGLETEST_SRC_DIR)/include
+ ../gmock/gtest/lib/libgtest.la \
+ ../gmock/lib/libgmock.la \
+ ../gmock/lib/libgmock_main.la
+protobuf_lite_arena_test_CPPFLAGS = -I$(srcdir)/../gmock/include \
+ -I$(srcdir)/../gmock/gtest/include
protobuf_lite_arena_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
protobuf_lite_arena_test_SOURCES = \
google/protobuf/lite_arena_unittest.cc \
$(COMMON_LITE_TEST_SOURCES)
nodist_protobuf_lite_arena_test_SOURCES = $(protoc_lite_outputs)
-$(am_protobuf_lite_arena_test_OBJECTS): unittest_proto_middleman
# Test plugin binary.
test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
- $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la
-test_plugin_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include
+ ../gmock/gtest/lib/libgtest.la
+test_plugin_CPPFLAGS = -I$(srcdir)/../gmock/gtest/include
test_plugin_SOURCES = \
google/protobuf/compiler/mock_code_generator.cc \
google/protobuf/testing/file.cc \
@@ -889,7 +918,9 @@ endif
no_warning_test.cc:
echo "// Generated from Makefile.am" > no_warning_test.cc
for FILE in $(nobase_include_HEADERS); do \
- echo "#include <$${FILE}>" >> no_warning_test.cc; \
+ if ! echo $${FILE} | grep "atomicops"; then \
+ echo "#include <$${FILE}>" >> no_warning_test.cc; \
+ fi \
done
echo "int main(int, char**) { return 0; }" >> no_warning_test.cc
diff --git a/third_party/protobuf/3.4.0/src/README.md b/third_party/protobuf/3.4.0/src/README.md
new file mode 100644
index 0000000000..c9362ee228
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/README.md
@@ -0,0 +1,212 @@
+Protocol Buffers - Google's data interchange format
+===================================================
+
+[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf) [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf)
+
+Copyright 2008 Google Inc.
+
+https://developers.google.com/protocol-buffers/
+
+C++ Installation - Unix
+-----------------------
+
+To build protobuf from source, the following tools are needed:
+
+ * autoconf
+ * automake
+ * libtool
+ * curl (used to download gmock)
+ * make
+ * g++
+ * unzip
+
+On Ubuntu, you can install them with:
+
+ $ sudo apt-get install autoconf automake libtool curl make g++ unzip
+
+On other platforms, please use the corresponding package managing tool to
+install them before proceeding.
+
+If you get the source from github, you need to generate the configure script
+first:
+
+ $ ./autogen.sh
+
+This will download gmock source (which is used for C++ Protocol Buffer
+unit-tests) to the current directory and run automake, autoconf, etc.
+to generate the configure script and various template makefiles.
+
+You can skip this step if you are using a release package (which already
+contains gmock and the configure script).
+
+To build and install the C++ Protocol Buffer runtime and the Protocol
+Buffer compiler (protoc) execute the following:
+
+ $ ./configure
+ $ make
+ $ make check
+ $ sudo make install
+ $ sudo ldconfig # refresh shared library cache.
+
+If "make check" fails, you can still install, but it is likely that
+some features of this library will not work correctly on your system.
+Proceed at your own risk.
+
+For advanced usage information on configure and make, please refer to the
+autoconf documentation:
+
+ http://www.gnu.org/software/autoconf/manual/autoconf.html#Running-configure-Scripts
+
+**Hint on install location**
+
+ By default, the package will be installed to /usr/local. However,
+ on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH.
+ You can add it, but it may be easier to just install to /usr
+ instead. To do this, invoke configure as follows:
+
+ ./configure --prefix=/usr
+
+ If you already built the package with a different prefix, make sure
+ to run "make clean" before building again.
+
+**Compiling dependent packages**
+
+ To compile a package that uses Protocol Buffers, you need to pass
+ various flags to your compiler and linker. As of version 2.2.0,
+ Protocol Buffers integrates with pkg-config to manage this. If you
+ have pkg-config installed, then you can invoke it to get a list of
+ flags like so:
+
+ pkg-config --cflags protobuf # print compiler flags
+ pkg-config --libs protobuf # print linker flags
+ pkg-config --cflags --libs protobuf # print both
+
+ For example:
+
+ c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf`
+
+ Note that packages written prior to the 2.2.0 release of Protocol
+ Buffers may not yet integrate with pkg-config to get flags, and may
+ not pass the correct set of flags to correctly link against
+ libprotobuf. If the package in question uses autoconf, you can
+ often fix the problem by invoking its configure script like:
+
+ configure CXXFLAGS="$(pkg-config --cflags protobuf)" \
+ LIBS="$(pkg-config --libs protobuf)"
+
+ This will force it to use the correct flags.
+
+ If you are writing an autoconf-based package that uses Protocol
+ Buffers, you should probably use the PKG_CHECK_MODULES macro in your
+ configure script like:
+
+ PKG_CHECK_MODULES([protobuf], [protobuf])
+
+ See the pkg-config man page for more info.
+
+ If you only want protobuf-lite, substitute "protobuf-lite" in place
+ of "protobuf" in these examples.
+
+**Note for Mac users**
+
+ For a Mac system, Unix tools are not available by default. You will first need
+ to install Xcode from the Mac AppStore and then run the following command from
+ a terminal:
+
+ $ sudo xcode-select --install
+
+ To install Unix tools, you can install "port" following the instructions at
+ https://www.macports.org . This will reside in /opt/local/bin/port for most
+ Mac installations.
+
+ $ sudo /opt/local/bin/port install autoconf automake libtool
+
+ Then follow the Unix instructions above.
+
+**Note for cross-compiling**
+
+ The makefiles normally invoke the protoc executable that they just
+ built in order to build tests. When cross-compiling, the protoc
+ executable may not be executable on the host machine. In this case,
+ you must build a copy of protoc for the host machine first, then use
+ the --with-protoc option to tell configure to use it instead. For
+ example:
+
+ ./configure --with-protoc=protoc
+
+ This will use the installed protoc (found in your $PATH) instead of
+ trying to execute the one built during the build process. You can
+ also use an executable that hasn't been installed. For example, if
+ you built the protobuf package for your host machine in ../host,
+ you might do:
+
+ ./configure --with-protoc=../host/src/protoc
+
+ Either way, you must make sure that the protoc executable you use
+ has the same version as the protobuf source code you are trying to
+ use it with.
+
+**Note for Solaris users**
+
+ Solaris 10 x86 has a bug that will make linking fail, complaining
+ about libstdc++.la being invalid. We have included a work-around
+ in this package. To use the work-around, run configure as follows:
+
+ ./configure LDFLAGS=-L$PWD/src/solaris
+
+ See src/solaris/libstdc++.la for more info on this bug.
+
+**Note for HP C++ Tru64 users**
+
+ To compile invoke configure as follows:
+
+ ./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM"
+
+ Also, you will need to use gmake instead of make.
+
+**Note for AIX users**
+
+ Compile using the IBM xlC C++ compiler as follows:
+
+ ./configure CXX=xlC
+
+ Also, you will need to use GNU `make` (`gmake`) instead of AIX `make`.
+
+C++ Installation - Windows
+--------------------------
+
+If you only need the protoc binary, you can download it from the release
+page:
+
+ https://github.com/google/protobuf/releases
+
+In the downloads section, download the zip file protoc-$VERSION-win32.zip.
+It contains the protoc binary as well as public proto files of protobuf
+library.
+
+To build from source using Microsoft Visual C++, see [cmake/README.md](../cmake/README.md).
+
+To build from source using Cygwin or MinGW, follow the Unix installation
+instructions, above.
+
+Binary Compatibility Warning
+----------------------------
+
+Due to the nature of C++, it is unlikely that any two versions of the
+Protocol Buffers C++ runtime libraries will have compatible ABIs.
+That is, if you linked an executable against an older version of
+libprotobuf, it is unlikely to work with a newer version without
+re-compiling. This problem, when it occurs, will normally be detected
+immediately on startup of your app. Still, you may want to consider
+using static linkage. You can configure this package to install
+static libraries only using:
+
+ ./configure --disable-shared
+
+Usage
+-----
+
+The complete documentation for Protocol Buffers is available via the
+web at:
+
+ https://developers.google.com/protocol-buffers/
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/any.cc b/third_party/protobuf/3.4.0/src/google/protobuf/any.cc
index b94529e685..83edba5788 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/any.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/any.cc
@@ -32,7 +32,6 @@
#include <google/protobuf/generated_message_util.h>
-
namespace google {
namespace protobuf {
namespace internal {
@@ -85,23 +84,15 @@ bool AnyMetadata::InternalIs(const Descriptor* descriptor) const {
return full_name == descriptor->full_name();
}
-bool ParseAnyTypeUrl(const string& type_url, string* url_prefix,
- string* full_type_name) {
+bool ParseAnyTypeUrl(const string& type_url, string* full_type_name) {
size_t pos = type_url.find_last_of("/");
if (pos == string::npos || pos + 1 == type_url.size()) {
return false;
}
- if (url_prefix) {
- *url_prefix = type_url.substr(0, pos + 1);
- }
*full_type_name = type_url.substr(pos + 1);
return true;
}
-bool ParseAnyTypeUrl(const string& type_url, string* full_type_name) {
- return ParseAnyTypeUrl(type_url, NULL, full_type_name);
-}
-
bool GetAnyFieldDescriptors(const Message& message,
const FieldDescriptor** type_url_field,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/any.h b/third_party/protobuf/3.4.0/src/google/protobuf/any.h
index a34e5f8eca..c2c27ec333 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/any.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/any.h
@@ -92,19 +92,8 @@ extern const char kTypeGoogleProdComPrefix[]; // "type.googleprod.com/".
// "type.googleapis.com/rpc.QueryOrigin" will return "rpc.QueryOrigin" in
// *full_type_name. Returns false if the type_url does not have a "/"
// in the type url separating the full type name.
-//
-// NOTE: this function is available publicly as:
-// google::protobuf::Any() // static method on the generated message type.
bool ParseAnyTypeUrl(const string& type_url, string* full_type_name);
-// Get the proto type name and prefix from Any::type_url value. For example,
-// passing "type.googleapis.com/rpc.QueryOrigin" will return
-// "type.googleapis.com/" in *url_prefix and "rpc.QueryOrigin" in
-// *full_type_name. Returns false if the type_url does not have a "/" in the
-// type url separating the full type name.
-bool ParseAnyTypeUrl(const string& type_url, string* url_prefix,
- string* full_type_name);
-
// See if message is of type google.protobuf.Any, if so, return the descriptors
// for "type_url" and "value" fields.
bool GetAnyFieldDescriptors(const Message& message,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/any.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/any.pb.cc
index 9d632efeef..7d53821256 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/any.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/any.pb.cc
@@ -1,92 +1,108 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/any.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/any.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
class AnyDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Any>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Any>
+ _instance;
} _Any_default_instance_;
-} // namespace protobuf
-} // namespace google
+
namespace protobuf_google_2fprotobuf_2fany_2eproto {
-static void InitDefaultsAny() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::_Any_default_instance_;
- new (ptr) ::google::protobuf::Any();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Any::InitAsDefaultInstance();
-}
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Any =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsAny}, {}};
-
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_Any.base);
-}
+namespace {
::google::protobuf::Metadata file_level_metadata[1];
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+} // namespace
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, type_url_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, type_url_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, value_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::Any)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(Any)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Any_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Any_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/any.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/any.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _Any_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Any_default_instance_);}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\031google/protobuf/any.proto\022\017google.prot"
"obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002"
" \001(\014Bo\n\023com.google.protobufB\010AnyProtoP\001Z"
@@ -99,10 +115,11 @@ void AddDescriptorsImpl() {
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/any.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -110,14 +127,12 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fany_2eproto
-namespace google {
-namespace protobuf {
+
// ===================================================================
-void Any::InitAsDefaultInstance() {
-}
void Any::PackFrom(const ::google::protobuf::Message& message) {
_any_metadata_.PackFrom(message);
}
@@ -130,11 +145,6 @@ void Any::PackFrom(const ::google::protobuf::Message& message,
bool Any::UnpackTo(::google::protobuf::Message* message) const {
return _any_metadata_.UnpackTo(message);
}
-bool Any::ParseAnyTypeUrl(const string& type_url,
- string* full_type_name) {
- return ::google::protobuf::internal::ParseAnyTypeUrl(type_url,
- full_type_name);
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Any::kTypeUrlFieldNumber;
@@ -143,14 +153,16 @@ const int Any::kValueFieldNumber;
Any::Any()
: ::google::protobuf::Message(), _internal_metadata_(NULL), _any_metadata_(&type_url_, &value_) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fany_2eproto::scc_info_Any.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fany_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Any)
}
Any::Any(const Any& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
+ _cached_size_(0),
_any_metadata_(&type_url_, &value_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -167,6 +179,7 @@ Any::Any(const Any& from)
void Any::SharedCtor() {
type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ _cached_size_ = 0;
}
Any::~Any() {
@@ -180,18 +193,27 @@ void Any::SharedDtor() {
}
void Any::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Any::descriptor() {
- ::protobuf_google_2fprotobuf_2fany_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fany_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Any& Any::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fany_2eproto::scc_info_Any.base);
+ protobuf_google_2fprotobuf_2fany_2eproto::InitDefaults();
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)
@@ -210,7 +232,7 @@ bool Any::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Any)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -348,7 +370,9 @@ size_t Any::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -408,27 +432,130 @@ void Any::Swap(Any* other) {
}
void Any::InternalSwap(Any* other) {
using std::swap;
- type_url_.Swap(&other->type_url_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- value_.Swap(&other->value_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ type_url_.Swap(&other->type_url_);
+ value_.Swap(&other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Any::GetMetadata() const {
protobuf_google_2fprotobuf_2fany_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Any
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Any* Arena::CreateMaybeMessage< ::google::protobuf::Any >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::Any >(arena);
+// string type_url = 1;
+void Any::clear_type_url() {
+ type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& Any::type_url() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Any.type_url)
+ return type_url_.GetNoArena();
+}
+void Any::set_type_url(const ::std::string& value) {
+
+ type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
+}
+#if LANG_CXX11
+void Any::set_type_url(::std::string&& value) {
+
+ type_url_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.type_url)
+}
+#endif
+void Any::set_type_url(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Any.type_url)
+}
+void Any::set_type_url(const char* value, size_t size) {
+
+ type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url)
+}
+::std::string* Any::mutable_type_url() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url)
+ return type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Any::release_type_url() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url)
+
+ return type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Any::set_allocated_type_url(::std::string* type_url) {
+ if (type_url != NULL) {
+
+ } else {
+
+ }
+ type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
}
+
+// bytes value = 2;
+void Any::clear_value() {
+ value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& Any::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Any.value)
+ return value_.GetNoArena();
+}
+void Any::set_value(const ::std::string& value) {
+
+ value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Any.value)
+}
+#if LANG_CXX11
+void Any::set_value(::std::string&& value) {
+
+ value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.value)
+}
+#endif
+void Any::set_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Any.value)
+}
+void Any::set_value(const void* value, size_t size) {
+
+ value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value)
+}
+::std::string* Any::mutable_value() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value)
+ return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Any::release_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Any.value)
+
+ return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Any::set_allocated_value(::std::string* value) {
+ if (value != NULL) {
+
+ } else {
+
+ }
+ value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/any.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/any.pb.h
index 8a4c7f97e6..5ffda74117 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/any.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/any.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/any.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fany_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fany_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,7 +24,6 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
@@ -32,34 +31,31 @@
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/any.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fany_2eproto LIBPROTOBUF_EXPORT
+namespace google {
+namespace protobuf {
+class Any;
+class AnyDefaultTypeInternal;
+LIBPROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_;
+} // namespace protobuf
+} // namespace google
+
+namespace google {
+namespace protobuf {
namespace protobuf_google_2fprotobuf_2fany_2eproto {
-// Internal implementation detail -- do not use these members.
+// Internal implementation detail -- do not call these.
struct LIBPROTOBUF_EXPORT TableStruct {
static const ::google::protobuf::internal::ParseTableField entries[];
static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[1];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
+ static void InitDefaultsImpl();
};
void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
} // namespace protobuf_google_2fprotobuf_2fany_2eproto
-namespace google {
-namespace protobuf {
-class Any;
-class AnyDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Any* Arena::CreateMaybeMessage<::google::protobuf::Any>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
// ===================================================================
@@ -74,30 +70,14 @@ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_in
CopyFrom(from);
return *this;
}
- #if LANG_CXX11
- Any(Any&& from) noexcept
- : Any() {
- *this = ::std::move(from);
- }
-
- inline Any& operator=(Any&& from) noexcept {
- if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
- if (this != &from) InternalSwap(&from);
- } else {
- CopyFrom(from);
- }
- return *this;
- }
- #endif
static const ::google::protobuf::Descriptor* descriptor();
static const Any& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Any* internal_default_instance() {
return reinterpret_cast<const Any*>(
&_Any_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
// implements Any -----------------------------------------------
@@ -109,8 +89,6 @@ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_in
template<typename T> bool Is() const {
return _any_metadata_.Is<T>();
}
- static bool ParseAnyTypeUrl(const string& type_url,
- string* full_type_name);
void Swap(Any* other);
friend void swap(Any& a, Any& b) {
@@ -119,33 +97,28 @@ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_in
// implements Message ----------------------------------------------
- inline Any* New() const final {
- return CreateMaybeMessage<Any>(NULL);
- }
+ inline Any* New() const PROTOBUF_FINAL { return New(NULL); }
- Any* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Any>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Any* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Any& from);
void MergeFrom(const Any& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Any* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -156,7 +129,7 @@ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_in
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -196,15 +169,16 @@ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_in
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::ArenaStringPtr type_url_;
::google::protobuf::internal::ArenaStringPtr value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::internal::AnyMetadata _any_metadata_;
- friend struct ::protobuf_google_2fprotobuf_2fany_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fany_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -320,12 +294,14 @@ inline void Any::set_allocated_value(::std::string* value) {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fany_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/any.proto b/third_party/protobuf/3.4.0/src/google/protobuf/any.proto
new file mode 100644
index 0000000000..c748667623
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/any.proto
@@ -0,0 +1,149 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option go_package = "github.com/golang/protobuf/ptypes/any";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "AnyProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+
+// `Any` contains an arbitrary serialized protocol buffer message along with a
+// URL that describes the type of the serialized message.
+//
+// Protobuf library provides support to pack/unpack Any values in the form
+// of utility functions or additional generated methods of the Any type.
+//
+// Example 1: Pack and unpack a message in C++.
+//
+// Foo foo = ...;
+// Any any;
+// any.PackFrom(foo);
+// ...
+// if (any.UnpackTo(&foo)) {
+// ...
+// }
+//
+// Example 2: Pack and unpack a message in Java.
+//
+// Foo foo = ...;
+// Any any = Any.pack(foo);
+// ...
+// if (any.is(Foo.class)) {
+// foo = any.unpack(Foo.class);
+// }
+//
+// Example 3: Pack and unpack a message in Python.
+//
+// foo = Foo(...)
+// any = Any()
+// any.Pack(foo)
+// ...
+// if any.Is(Foo.DESCRIPTOR):
+// any.Unpack(foo)
+// ...
+//
+// Example 4: Pack and unpack a message in Go
+//
+// foo := &pb.Foo{...}
+// any, err := ptypes.MarshalAny(foo)
+// ...
+// foo := &pb.Foo{}
+// if err := ptypes.UnmarshalAny(any, foo); err != nil {
+// ...
+// }
+//
+// The pack methods provided by protobuf library will by default use
+// 'type.googleapis.com/full.type.name' as the type URL and the unpack
+// methods only use the fully qualified type name after the last '/'
+// in the type URL, for example "foo.bar.com/x/y.z" will yield type
+// name "y.z".
+//
+//
+// JSON
+// ====
+// The JSON representation of an `Any` value uses the regular
+// representation of the deserialized, embedded message, with an
+// additional field `@type` which contains the type URL. Example:
+//
+// package google.profile;
+// message Person {
+// string first_name = 1;
+// string last_name = 2;
+// }
+//
+// {
+// "@type": "type.googleapis.com/google.profile.Person",
+// "firstName": <string>,
+// "lastName": <string>
+// }
+//
+// If the embedded message type is well-known and has a custom JSON
+// representation, that representation will be embedded adding a field
+// `value` which holds the custom JSON in addition to the `@type`
+// field. Example (for message [google.protobuf.Duration][]):
+//
+// {
+// "@type": "type.googleapis.com/google.protobuf.Duration",
+// "value": "1.212s"
+// }
+//
+message Any {
+ // A URL/resource name whose content describes the type of the
+ // serialized protocol buffer message.
+ //
+ // For URLs which use the scheme `http`, `https`, or no scheme, the
+ // following restrictions and interpretations apply:
+ //
+ // * 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
+ // URL, or have them precompiled into a binary to avoid any
+ // lookup. Therefore, binary compatibility needs to be preserved
+ // on changes to types. (Use versioned type names to manage
+ // breaking changes.)
+ //
+ // Schemes other than `http`, `https` (or the empty scheme) might be
+ // used with implementation specific semantics.
+ //
+ string type_url = 1;
+
+ // Must be a valid serialized protocol buffer of the above specified type.
+ bytes value = 2;
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/any_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/any_test.cc
index 1bfaa63d87..1bfaa63d87 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/any_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/any_test.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/any_test.proto b/third_party/protobuf/3.4.0/src/google/protobuf/any_test.proto
index 0c5b30ba3e..0c5b30ba3e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/any_test.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/any_test.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/api.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/api.pb.cc
index e0a249d041..96a5074dcf 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/api.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/api.pb.cc
@@ -1,175 +1,156 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/api.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/api.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
-namespace protobuf_google_2fprotobuf_2fapi_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fapi_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_Mixin;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fapi_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_Method;
-} // namespace protobuf_google_2fprotobuf_2fapi_2eproto
-namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_SourceContext;
-} // namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto
-namespace protobuf_google_2fprotobuf_2ftype_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2ftype_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_Option;
-} // namespace protobuf_google_2fprotobuf_2ftype_2eproto
namespace google {
namespace protobuf {
class ApiDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Api>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Api>
+ _instance;
} _Api_default_instance_;
class MethodDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Method>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Method>
+ _instance;
} _Method_default_instance_;
class MixinDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Mixin>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Mixin>
+ _instance;
} _Mixin_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2fapi_2eproto {
-static void InitDefaultsApi() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_Api_default_instance_;
- new (ptr) ::google::protobuf::Api();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Api::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<4> scc_info_Api =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 4, InitDefaultsApi}, {
- &protobuf_google_2fprotobuf_2fapi_2eproto::scc_info_Method.base,
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base,
- &protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::scc_info_SourceContext.base,
- &protobuf_google_2fprotobuf_2fapi_2eproto::scc_info_Mixin.base,}};
-
-static void InitDefaultsMethod() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::_Method_default_instance_;
- new (ptr) ::google::protobuf::Method();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Method::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2fapi_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_Method =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsMethod}, {
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base,}};
-static void InitDefaultsMixin() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
+namespace {
- {
- void* ptr = &::google::protobuf::_Mixin_default_instance_;
- new (ptr) ::google::protobuf::Mixin();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Mixin::InitAsDefaultInstance();
-}
+::google::protobuf::Metadata file_level_metadata[3];
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Mixin =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsMixin}, {}};
+} // namespace
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_Api.base);
- ::google::protobuf::internal::InitSCC(&scc_info_Method.base);
- ::google::protobuf::internal::InitSCC(&scc_info_Mixin.base);
-}
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
-::google::protobuf::Metadata file_level_metadata[3];
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, methods_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, version_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, source_context_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, mixins_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, syntax_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, methods_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, version_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, source_context_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, mixins_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, syntax_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, request_type_url_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, request_streaming_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, response_type_url_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, response_streaming_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, syntax_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, request_type_url_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, request_streaming_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, response_type_url_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, response_streaming_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, syntax_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Mixin, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Mixin, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Mixin, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Mixin, root_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Mixin, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Mixin, root_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::Api)},
- { 12, -1, sizeof(::google::protobuf::Method)},
- { 24, -1, sizeof(::google::protobuf::Mixin)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(Api)},
+ { 12, -1, sizeof(Method)},
+ { 24, -1, sizeof(Mixin)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Api_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Method_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Mixin_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Api_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Method_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Mixin_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/api.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/api.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 3);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults();
+ ::google::protobuf::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
+ _Api_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Api_default_instance_);_Method_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Method_default_instance_);_Mixin_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Mixin_default_instance_);_Api_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>(
+ ::google::protobuf::SourceContext::internal_default_instance());
+}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\031google/protobuf/api.proto\022\017google.prot"
"obuf\032$google/protobuf/source_context.pro"
"to\032\032google/protobuf/type.proto\"\201\002\n\003Api\022\014"
@@ -194,13 +175,14 @@ void AddDescriptorsImpl() {
descriptor, 750);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/api.proto", &protobuf_RegisterTypes);
- ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors();
- ::protobuf_google_2fprotobuf_2ftype_2eproto::AddDescriptors();
+ ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors();
+ ::google::protobuf::protobuf_google_2fprotobuf_2ftype_2eproto::AddDescriptors();
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -208,25 +190,12 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fapi_2eproto
-namespace google {
-namespace protobuf {
+
// ===================================================================
-void Api::InitAsDefaultInstance() {
- ::google::protobuf::_Api_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>(
- ::google::protobuf::SourceContext::internal_default_instance());
-}
-void Api::clear_options() {
- options_.Clear();
-}
-void Api::clear_source_context() {
- if (GetArenaNoVirtual() == NULL && source_context_ != NULL) {
- delete source_context_;
- }
- source_context_ = NULL;
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Api::kNameFieldNumber;
const int Api::kMethodsFieldNumber;
@@ -239,8 +208,9 @@ const int Api::kSyntaxFieldNumber;
Api::Api()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fapi_2eproto::scc_info_Api.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Api)
}
@@ -249,7 +219,8 @@ Api::Api(const Api& from)
_internal_metadata_(NULL),
methods_(from.methods_),
options_(from.options_),
- mixins_(from.mixins_) {
+ mixins_(from.mixins_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
@@ -274,6 +245,7 @@ void Api::SharedCtor() {
::memset(&source_context_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_));
+ _cached_size_ = 0;
}
Api::~Api() {
@@ -288,18 +260,27 @@ void Api::SharedDtor() {
}
void Api::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Api::descriptor() {
- ::protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Api& Api::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fapi_2eproto::scc_info_Api.base);
+ protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults();
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)
@@ -326,7 +307,7 @@ bool Api::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Api)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -350,7 +331,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_methods()));
} else {
goto handle_unusual;
@@ -362,7 +343,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_options()));
} else {
goto handle_unusual;
@@ -390,7 +371,7 @@ bool Api::MergePartialFromCodedStream(
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_source_context()));
} else {
goto handle_unusual;
@@ -402,7 +383,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_mixins()));
} else {
goto handle_unusual;
@@ -465,18 +446,14 @@ 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;
@@ -492,16 +469,14 @@ void Api::SerializeWithCachedSizes(
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 5, this->_internal_source_context(), output);
+ 5, *this->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;
@@ -539,7 +514,7 @@ void Api::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->methods_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
2, this->methods(static_cast<int>(i)), deterministic, target);
}
@@ -547,7 +522,7 @@ void Api::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
3, this->options(static_cast<int>(i)), deterministic, target);
}
@@ -565,15 +540,15 @@ void Api::SerializeWithCachedSizes(
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 5, this->_internal_source_context(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 5, *this->source_context_, deterministic, target);
}
// repeated .google.protobuf.Mixin mixins = 6;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->mixins_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
6, this->mixins(static_cast<int>(i)), deterministic, target);
}
@@ -606,7 +581,7 @@ size_t Api::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->methods(static_cast<int>(i)));
}
}
@@ -617,7 +592,7 @@ size_t Api::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(static_cast<int>(i)));
}
}
@@ -628,7 +603,7 @@ size_t Api::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->mixins(static_cast<int>(i)));
}
}
@@ -650,8 +625,8 @@ size_t Api::ByteSizeLong() const {
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *source_context_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->source_context_);
}
// .google.protobuf.Syntax syntax = 7;
@@ -661,7 +636,9 @@ size_t Api::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -730,31 +707,279 @@ void Api::Swap(Api* other) {
}
void Api::InternalSwap(Api* other) {
using std::swap;
- CastToBase(&methods_)->InternalSwap(CastToBase(&other->methods_));
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
- CastToBase(&mixins_)->InternalSwap(CastToBase(&other->mixins_));
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- version_.Swap(&other->version_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ methods_.InternalSwap(&other->methods_);
+ options_.InternalSwap(&other->options_);
+ mixins_.InternalSwap(&other->mixins_);
+ name_.Swap(&other->name_);
+ version_.Swap(&other->version_);
swap(source_context_, other->source_context_);
swap(syntax_, other->syntax_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Api::GetMetadata() const {
protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Api
-// ===================================================================
+// string name = 1;
+void Api::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& Api::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.name)
+ return name_.GetNoArena();
+}
+void Api::set_name(const ::std::string& value) {
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Api.name)
+}
+#if LANG_CXX11
+void Api::set_name(::std::string&& value) {
+
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.name)
+}
+#endif
+void Api::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Api.name)
+}
+void Api::set_name(const char* value, size_t size) {
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.name)
+}
+::std::string* Api::mutable_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Api::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Api.name)
+
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Api::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
+}
-void Method::InitAsDefaultInstance() {
+// repeated .google.protobuf.Method methods = 2;
+int Api::methods_size() const {
+ return methods_.size();
}
-void Method::clear_options() {
+void Api::clear_methods() {
+ methods_.Clear();
+}
+const ::google::protobuf::Method& Api::methods(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.methods)
+ return methods_.Get(index);
+}
+::google::protobuf::Method* Api::mutable_methods(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods)
+ return methods_.Mutable(index);
+}
+::google::protobuf::Method* Api::add_methods() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.methods)
+ return methods_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >*
+Api::mutable_methods() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods)
+ return &methods_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >&
+Api::methods() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Api.methods)
+ return methods_;
+}
+
+// repeated .google.protobuf.Option options = 3;
+int Api::options_size() const {
+ return options_.size();
+}
+void Api::clear_options() {
options_.Clear();
}
+const ::google::protobuf::Option& Api::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.options)
+ return options_.Get(index);
+}
+::google::protobuf::Option* Api::mutable_options(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options)
+ return options_.Mutable(index);
+}
+::google::protobuf::Option* Api::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.options)
+ return options_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
+Api::mutable_options() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options)
+ return &options_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
+Api::options() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Api.options)
+ return options_;
+}
+
+// string version = 4;
+void Api::clear_version() {
+ version_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& Api::version() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.version)
+ return version_.GetNoArena();
+}
+void Api::set_version(const ::std::string& value) {
+
+ version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Api.version)
+}
+#if LANG_CXX11
+void Api::set_version(::std::string&& value) {
+
+ version_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.version)
+}
+#endif
+void Api::set_version(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Api.version)
+}
+void Api::set_version(const char* value, size_t size) {
+
+ version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.version)
+}
+::std::string* Api::mutable_version() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version)
+ return version_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Api::release_version() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Api.version)
+
+ return version_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Api::set_allocated_version(::std::string* version) {
+ if (version != NULL) {
+
+ } else {
+
+ }
+ version_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), version);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
+}
+
+// .google.protobuf.SourceContext source_context = 5;
+bool Api::has_source_context() const {
+ return this != internal_default_instance() && source_context_ != NULL;
+}
+void Api::clear_source_context() {
+ if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_;
+ source_context_ = NULL;
+}
+const ::google::protobuf::SourceContext& Api::source_context() const {
+ const ::google::protobuf::SourceContext* p = source_context_;
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>(
+ &::google::protobuf::_SourceContext_default_instance_);
+}
+::google::protobuf::SourceContext* Api::mutable_source_context() {
+
+ if (source_context_ == NULL) {
+ source_context_ = new ::google::protobuf::SourceContext;
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context)
+ return source_context_;
+}
+::google::protobuf::SourceContext* Api::release_source_context() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context)
+
+ ::google::protobuf::SourceContext* temp = source_context_;
+ source_context_ = NULL;
+ return temp;
+}
+void Api::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
+ delete source_context_;
+ source_context_ = source_context;
+ if (source_context) {
+
+ } else {
+
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context)
+}
+
+// repeated .google.protobuf.Mixin mixins = 6;
+int Api::mixins_size() const {
+ return mixins_.size();
+}
+void Api::clear_mixins() {
+ mixins_.Clear();
+}
+const ::google::protobuf::Mixin& Api::mixins(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins)
+ return mixins_.Get(index);
+}
+::google::protobuf::Mixin* Api::mutable_mixins(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins)
+ return mixins_.Mutable(index);
+}
+::google::protobuf::Mixin* Api::add_mixins() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins)
+ return mixins_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >*
+Api::mutable_mixins() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins)
+ return &mixins_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >&
+Api::mixins() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Api.mixins)
+ return mixins_;
+}
+
+// .google.protobuf.Syntax syntax = 7;
+void Api::clear_syntax() {
+ syntax_ = 0;
+}
+::google::protobuf::Syntax Api::syntax() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax)
+ return static_cast< ::google::protobuf::Syntax >(syntax_);
+}
+void Api::set_syntax(::google::protobuf::Syntax value) {
+
+ syntax_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Method::kNameFieldNumber;
const int Method::kRequestTypeUrlFieldNumber;
@@ -767,15 +992,17 @@ const int Method::kSyntaxFieldNumber;
Method::Method()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fapi_2eproto::scc_info_Method.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Method)
}
Method::Method(const Method& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- options_(from.options_) {
+ options_(from.options_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
@@ -802,6 +1029,7 @@ void Method::SharedCtor() {
::memset(&request_streaming_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_));
+ _cached_size_ = 0;
}
Method::~Method() {
@@ -816,18 +1044,27 @@ void Method::SharedDtor() {
}
void Method::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Method::descriptor() {
- ::protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Method& Method::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fapi_2eproto::scc_info_Method.base);
+ protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults();
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)
@@ -851,7 +1088,7 @@ bool Method::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Method)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -935,7 +1172,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_options()));
} else {
goto handle_unusual;
@@ -1028,9 +1265,7 @@ 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;
@@ -1100,7 +1335,7 @@ void Method::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
6, this->options(static_cast<int>(i)), deterministic, target);
}
@@ -1133,7 +1368,7 @@ size_t Method::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(static_cast<int>(i)));
}
}
@@ -1176,7 +1411,9 @@ size_t Method::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1250,29 +1487,260 @@ void Method::Swap(Method* other) {
}
void Method::InternalSwap(Method* other) {
using std::swap;
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- request_type_url_.Swap(&other->request_type_url_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- response_type_url_.Swap(&other->response_type_url_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ options_.InternalSwap(&other->options_);
+ name_.Swap(&other->name_);
+ request_type_url_.Swap(&other->request_type_url_);
+ response_type_url_.Swap(&other->response_type_url_);
swap(request_streaming_, other->request_streaming_);
swap(response_streaming_, other->response_streaming_);
swap(syntax_, other->syntax_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Method::GetMetadata() const {
protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Method
-// ===================================================================
+// string name = 1;
+void Method::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& Method::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.name)
+ return name_.GetNoArena();
+}
+void Method::set_name(const ::std::string& value) {
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.name)
+}
+#if LANG_CXX11
+void Method::set_name(::std::string&& value) {
+
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.name)
+}
+#endif
+void Method::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Method.name)
+}
+void Method::set_name(const char* value, size_t size) {
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.name)
+}
+::std::string* Method::mutable_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Method::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Method.name)
+
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Method::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
+}
+
+// string request_type_url = 2;
+void Method::clear_request_type_url() {
+ request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& Method::request_type_url() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url)
+ return request_type_url_.GetNoArena();
+}
+void Method::set_request_type_url(const ::std::string& value) {
+
+ request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url)
+}
+#if LANG_CXX11
+void Method::set_request_type_url(::std::string&& value) {
+
+ request_type_url_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.request_type_url)
+}
+#endif
+void Method::set_request_type_url(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Method.request_type_url)
+}
+void Method::set_request_type_url(const char* value, size_t size) {
+
+ request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.request_type_url)
+}
+::std::string* Method::mutable_request_type_url() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url)
+ return request_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Method::release_request_type_url() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url)
+
+ return request_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Method::set_allocated_request_type_url(::std::string* request_type_url) {
+ if (request_type_url != NULL) {
+
+ } else {
+
+ }
+ request_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), request_type_url);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
+}
+
+// bool request_streaming = 3;
+void Method::clear_request_streaming() {
+ request_streaming_ = false;
+}
+bool Method::request_streaming() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming)
+ return request_streaming_;
+}
+void Method::set_request_streaming(bool value) {
+
+ request_streaming_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming)
+}
+
+// string response_type_url = 4;
+void Method::clear_response_type_url() {
+ response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& Method::response_type_url() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url)
+ return response_type_url_.GetNoArena();
+}
+void Method::set_response_type_url(const ::std::string& value) {
+
+ response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url)
+}
+#if LANG_CXX11
+void Method::set_response_type_url(::std::string&& value) {
+
+ response_type_url_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.response_type_url)
+}
+#endif
+void Method::set_response_type_url(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Method.response_type_url)
+}
+void Method::set_response_type_url(const char* value, size_t size) {
+
+ response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.response_type_url)
+}
+::std::string* Method::mutable_response_type_url() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url)
+ return response_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Method::release_response_type_url() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url)
+
+ return response_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Method::set_allocated_response_type_url(::std::string* response_type_url) {
+ if (response_type_url != NULL) {
+
+ } else {
+
+ }
+ response_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), response_type_url);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
+}
-void Mixin::InitAsDefaultInstance() {
+// bool response_streaming = 5;
+void Method::clear_response_streaming() {
+ response_streaming_ = false;
+}
+bool Method::response_streaming() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming)
+ return response_streaming_;
+}
+void Method::set_response_streaming(bool value) {
+
+ response_streaming_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming)
+}
+
+// repeated .google.protobuf.Option options = 6;
+int Method::options_size() const {
+ return options_.size();
+}
+void Method::clear_options() {
+ options_.Clear();
+}
+const ::google::protobuf::Option& Method::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.options)
+ return options_.Get(index);
+}
+::google::protobuf::Option* Method::mutable_options(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options)
+ return options_.Mutable(index);
+}
+::google::protobuf::Option* Method::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Method.options)
+ return options_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
+Method::mutable_options() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options)
+ return &options_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
+Method::options() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Method.options)
+ return options_;
}
+
+// .google.protobuf.Syntax syntax = 7;
+void Method::clear_syntax() {
+ syntax_ = 0;
+}
+::google::protobuf::Syntax Method::syntax() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax)
+ return static_cast< ::google::protobuf::Syntax >(syntax_);
+}
+void Method::set_syntax(::google::protobuf::Syntax value) {
+
+ syntax_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Mixin::kNameFieldNumber;
const int Mixin::kRootFieldNumber;
@@ -1280,14 +1748,16 @@ const int Mixin::kRootFieldNumber;
Mixin::Mixin()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fapi_2eproto::scc_info_Mixin.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Mixin)
}
Mixin::Mixin(const Mixin& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
@@ -1303,6 +1773,7 @@ Mixin::Mixin(const Mixin& from)
void Mixin::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
root_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ _cached_size_ = 0;
}
Mixin::~Mixin() {
@@ -1316,18 +1787,27 @@ void Mixin::SharedDtor() {
}
void Mixin::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Mixin::descriptor() {
- ::protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Mixin& Mixin::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fapi_2eproto::scc_info_Mixin.base);
+ protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults();
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)
@@ -1346,7 +1826,7 @@ bool Mixin::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Mixin)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1496,7 +1976,9 @@ size_t Mixin::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1556,33 +2038,130 @@ void Mixin::Swap(Mixin* other) {
}
void Mixin::InternalSwap(Mixin* other) {
using std::swap;
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- root_.Swap(&other->root_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.Swap(&other->name_);
+ root_.Swap(&other->root_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Mixin::GetMetadata() const {
protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Mixin
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Api* Arena::CreateMaybeMessage< ::google::protobuf::Api >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::Api >(arena);
+// string name = 1;
+void Mixin::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& Mixin::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Mixin.name)
+ return name_.GetNoArena();
+}
+void Mixin::set_name(const ::std::string& value) {
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Mixin.name)
+}
+#if LANG_CXX11
+void Mixin::set_name(::std::string&& value) {
+
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.name)
+}
+#endif
+void Mixin::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.name)
+}
+void Mixin::set_name(const char* value, size_t size) {
+
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.name)
+}
+::std::string* Mixin::mutable_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Mixin::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Mixin.name)
+
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Mixin::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
+}
+
+// string root = 2;
+void Mixin::clear_root() {
+ root_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Method* Arena::CreateMaybeMessage< ::google::protobuf::Method >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::Method >(arena);
+const ::std::string& Mixin::root() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Mixin.root)
+ return root_.GetNoArena();
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Mixin* Arena::CreateMaybeMessage< ::google::protobuf::Mixin >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::Mixin >(arena);
+void Mixin::set_root(const ::std::string& value) {
+
+ root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Mixin.root)
}
+#if LANG_CXX11
+void Mixin::set_root(::std::string&& value) {
+
+ root_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.root)
+}
+#endif
+void Mixin::set_root(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.root)
+}
+void Mixin::set_root(const char* value, size_t size) {
+
+ root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.root)
+}
+::std::string* Mixin::mutable_root() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.root)
+ return root_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Mixin::release_root() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Mixin.root)
+
+ return root_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Mixin::set_allocated_root(::std::string* root) {
+ if (root != NULL) {
+
+ } else {
+
+ }
+ root_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), root);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/api.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/api.pb.h
index 0f90f411c4..bed136dbf0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/api.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/api.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/api.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fapi_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fapi_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,7 +24,6 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
@@ -33,20 +32,6 @@
#include <google/protobuf/source_context.pb.h>
#include <google/protobuf/type.pb.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fapi_2eproto LIBPROTOBUF_EXPORT
-
-namespace protobuf_google_2fprotobuf_2fapi_2eproto {
-// Internal implementation detail -- do not use these members.
-struct LIBPROTOBUF_EXPORT TableStruct {
- static const ::google::protobuf::internal::ParseTableField entries[];
- static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[3];
- static const ::google::protobuf::internal::FieldMetadata field_metadata[];
- static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
-};
-void LIBPROTOBUF_EXPORT AddDescriptors();
-} // namespace protobuf_google_2fprotobuf_2fapi_2eproto
namespace google {
namespace protobuf {
class Api;
@@ -60,15 +45,24 @@ class MixinDefaultTypeInternal;
LIBPROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_;
} // namespace protobuf
} // namespace google
+
namespace google {
namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Api* Arena::CreateMaybeMessage<::google::protobuf::Api>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Method* Arena::CreateMaybeMessage<::google::protobuf::Method>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Mixin* Arena::CreateMaybeMessage<::google::protobuf::Mixin>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
+
+namespace protobuf_google_2fprotobuf_2fapi_2eproto {
+// Internal implementation detail -- do not call these.
+struct LIBPROTOBUF_EXPORT TableStruct {
+ static const ::google::protobuf::internal::ParseTableField entries[];
+ static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
+ static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+ static const ::google::protobuf::internal::SerializationTable serialization_table[];
+ static void InitDefaultsImpl();
+};
+void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
+} // namespace protobuf_google_2fprotobuf_2fapi_2eproto
// ===================================================================
@@ -101,12 +95,11 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
static const ::google::protobuf::Descriptor* descriptor();
static const Api& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Api* internal_default_instance() {
return reinterpret_cast<const Api*>(
&_Api_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void Swap(Api* other);
@@ -116,33 +109,28 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
// implements Message ----------------------------------------------
- inline Api* New() const final {
- return CreateMaybeMessage<Api>(NULL);
- }
+ inline Api* New() const PROTOBUF_FINAL { return New(NULL); }
- Api* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Api>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Api* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Api& from);
void MergeFrom(const Api& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Api* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -153,7 +141,7 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -163,11 +151,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;
@@ -175,11 +163,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;
@@ -187,11 +175,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;
@@ -227,12 +215,9 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
bool has_source_context() const;
void clear_source_context();
static const int kSourceContextFieldNumber = 5;
- private:
- const ::google::protobuf::SourceContext& _internal_source_context() const;
- public:
const ::google::protobuf::SourceContext& source_context() const;
- ::google::protobuf::SourceContext* release_source_context();
::google::protobuf::SourceContext* mutable_source_context();
+ ::google::protobuf::SourceContext* release_source_context();
void set_allocated_source_context(::google::protobuf::SourceContext* source_context);
// .google.protobuf.Syntax syntax = 7;
@@ -252,8 +237,8 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
::google::protobuf::internal::ArenaStringPtr version_;
::google::protobuf::SourceContext* source_context_;
int syntax_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -286,12 +271,11 @@ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc
static const ::google::protobuf::Descriptor* descriptor();
static const Method& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Method* internal_default_instance() {
return reinterpret_cast<const Method*>(
&_Method_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
1;
void Swap(Method* other);
@@ -301,33 +285,28 @@ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc
// implements Message ----------------------------------------------
- inline Method* New() const final {
- return CreateMaybeMessage<Method>(NULL);
- }
+ inline Method* New() const PROTOBUF_FINAL { return New(NULL); }
- Method* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Method>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Method* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Method& from);
void MergeFrom(const Method& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Method* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -338,7 +317,7 @@ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -348,11 +327,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;
@@ -427,8 +406,8 @@ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc
bool request_streaming_;
bool response_streaming_;
int syntax_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -461,12 +440,11 @@ class LIBPROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_
static const ::google::protobuf::Descriptor* descriptor();
static const Mixin& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Mixin* internal_default_instance() {
return reinterpret_cast<const Mixin*>(
&_Mixin_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
2;
void Swap(Mixin* other);
@@ -476,33 +454,28 @@ class LIBPROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Mixin* New() const final {
- return CreateMaybeMessage<Mixin>(NULL);
- }
+ inline Mixin* New() const PROTOBUF_FINAL { return New(NULL); }
- Mixin* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Mixin>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Mixin* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Mixin& from);
void MergeFrom(const Mixin& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Mixin* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -513,7 +486,7 @@ class LIBPROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -553,14 +526,15 @@ class LIBPROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::internal::ArenaStringPtr root_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -627,23 +601,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)
@@ -654,23 +628,26 @@ Api::methods() const {
inline int Api::options_size() const {
return options_.size();
}
-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::RepeatedPtrField< ::google::protobuf::Option >*
-Api::mutable_options() {
- // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options)
- return &options_;
+inline void Api::clear_options() {
+ options_.Clear();
}
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::RepeatedPtrField< ::google::protobuf::Option >&
Api::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.options)
@@ -734,8 +711,9 @@ inline void Api::set_allocated_version(::std::string* version) {
inline bool Api::has_source_context() const {
return this != internal_default_instance() && source_context_ != NULL;
}
-inline const ::google::protobuf::SourceContext& Api::_internal_source_context() const {
- return *source_context_;
+inline void Api::clear_source_context() {
+ if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_;
+ source_context_ = NULL;
}
inline const ::google::protobuf::SourceContext& Api::source_context() const {
const ::google::protobuf::SourceContext* p = source_context_;
@@ -743,38 +721,29 @@ inline const ::google::protobuf::SourceContext& Api::source_context() const {
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>(
&::google::protobuf::_SourceContext_default_instance_);
}
-inline ::google::protobuf::SourceContext* Api::release_source_context() {
- // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context)
-
- ::google::protobuf::SourceContext* temp = source_context_;
- source_context_ = NULL;
- return temp;
-}
inline ::google::protobuf::SourceContext* Api::mutable_source_context() {
if (source_context_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::SourceContext>(GetArenaNoVirtual());
- source_context_ = p;
+ source_context_ = new ::google::protobuf::SourceContext;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context)
return source_context_;
}
+inline ::google::protobuf::SourceContext* Api::release_source_context() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context)
+
+ ::google::protobuf::SourceContext* temp = source_context_;
+ source_context_ = NULL;
+ return temp;
+}
inline void Api::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete reinterpret_cast< ::google::protobuf::MessageLite*>(source_context_);
- }
+ delete source_context_;
+ source_context_ = source_context;
if (source_context) {
- ::google::protobuf::Arena* submessage_arena = NULL;
- if (message_arena != submessage_arena) {
- source_context = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, source_context, submessage_arena);
- }
} else {
}
- source_context_ = source_context;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context)
}
@@ -785,23 +754,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)
@@ -1017,23 +986,26 @@ inline void Method::set_response_streaming(bool value) {
inline int Method::options_size() const {
return options_.size();
}
-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::RepeatedPtrField< ::google::protobuf::Option >*
-Method::mutable_options() {
- // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options)
- return &options_;
+inline void Method::clear_options() {
+ options_.Clear();
}
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::RepeatedPtrField< ::google::protobuf::Option >&
Method::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Method.options)
@@ -1167,6 +1139,7 @@ inline void Mixin::set_allocated_root(::std::string* root) {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// -------------------------------------------------------------------
// -------------------------------------------------------------------
@@ -1174,9 +1147,10 @@ inline void Mixin::set_allocated_root(::std::string* root) {
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fapi_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/api.proto b/third_party/protobuf/3.4.0/src/google/protobuf/api.proto
new file mode 100644
index 0000000000..f37ee2fa46
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/api.proto
@@ -0,0 +1,210 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+import "google/protobuf/source_context.proto";
+import "google/protobuf/type.proto";
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "ApiProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+option go_package = "google.golang.org/genproto/protobuf/api;api";
+
+// Api is a light-weight descriptor for an API Interface.
+//
+// Interfaces are also described as "protocol buffer services" in some contexts,
+// such as by the "service" keyword in a .proto file, but they are different
+// from API Services, which represent a concrete implementation of an interface
+// as opposed to simply a description of methods and bindings. They are also
+// sometimes simply referred to as "APIs" in other contexts, such as the name of
+// this message itself. See https://cloud.google.com/apis/design/glossary for
+// detailed terminology.
+message Api {
+
+ // The fully qualified name of this interface, including package name
+ // followed by the interface's simple name.
+ string name = 1;
+
+ // The methods of this interface, in unspecified order.
+ repeated Method methods = 2;
+
+ // Any metadata attached to the interface.
+ repeated Option options = 3;
+
+ // A version string for this interface. If specified, must have the form
+ // `major-version.minor-version`, as in `1.10`. If the minor version is
+ // omitted, it defaults to zero. If the entire version field is empty, the
+ // major version is derived from the package name, as outlined below. If the
+ // field is not empty, the version in the package name will be verified to be
+ // consistent with what is provided here.
+ //
+ // The versioning schema uses [semantic
+ // versioning](http://semver.org) where the major version number
+ // indicates a breaking change and the minor version an additive,
+ // non-breaking change. Both version numbers are signals to users
+ // what to expect from different versions, and should be carefully
+ // chosen based on the product plan.
+ //
+ // The major version is also reflected in the package name of the
+ // interface, which must end in `v<major-version>`, as in
+ // `google.feature.v1`. For major versions 0 and 1, the suffix can
+ // be omitted. Zero major versions must only be used for
+ // experimental, non-GA interfaces.
+ //
+ //
+ string version = 4;
+
+ // Source context for the protocol buffer service represented by this
+ // message.
+ SourceContext source_context = 5;
+
+ // Included interfaces. See [Mixin][].
+ repeated Mixin mixins = 6;
+
+ // The source syntax of the service.
+ Syntax syntax = 7;
+}
+
+// Method represents a method of an API interface.
+message Method {
+
+ // The simple name of this method.
+ string name = 1;
+
+ // A URL of the input message type.
+ string request_type_url = 2;
+
+ // If true, the request is streamed.
+ bool request_streaming = 3;
+
+ // The URL of the output message type.
+ string response_type_url = 4;
+
+ // If true, the response is streamed.
+ bool response_streaming = 5;
+
+ // Any metadata attached to the method.
+ repeated Option options = 6;
+
+ // The source syntax of this method.
+ Syntax syntax = 7;
+}
+
+// Declares an API Interface to be included in this interface. The including
+// interface must redeclare all the methods from the included interface, but
+// documentation and options are inherited as follows:
+//
+// - If after comment and whitespace stripping, the documentation
+// string of the redeclared method is empty, it will be inherited
+// from the original method.
+//
+// - Each annotation belonging to the service config (http,
+// visibility) which is not set in the redeclared method will be
+// inherited.
+//
+// - If an http annotation is inherited, the path pattern will be
+// modified as follows. Any version prefix will be replaced by the
+// version of the including interface plus the [root][] path if
+// specified.
+//
+// Example of a simple mixin:
+//
+// package google.acl.v1;
+// service AccessControl {
+// // Get the underlying ACL object.
+// rpc GetAcl(GetAclRequest) returns (Acl) {
+// option (google.api.http).get = "/v1/{resource=**}:getAcl";
+// }
+// }
+//
+// package google.storage.v2;
+// service Storage {
+// rpc GetAcl(GetAclRequest) returns (Acl);
+//
+// // Get a data record.
+// rpc GetData(GetDataRequest) returns (Data) {
+// option (google.api.http).get = "/v2/{resource=**}";
+// }
+// }
+//
+// Example of a mixin configuration:
+//
+// apis:
+// - name: google.storage.v2.Storage
+// mixins:
+// - name: google.acl.v1.AccessControl
+//
+// The mixin construct implies that all methods in `AccessControl` are
+// also declared with same name and request/response types in
+// `Storage`. A documentation generator or annotation processor will
+// see the effective `Storage.GetAcl` method after inherting
+// documentation and annotations as follows:
+//
+// service Storage {
+// // Get the underlying ACL object.
+// rpc GetAcl(GetAclRequest) returns (Acl) {
+// option (google.api.http).get = "/v2/{resource=**}:getAcl";
+// }
+// ...
+// }
+//
+// Note how the version in the path pattern changed from `v1` to `v2`.
+//
+// If the `root` field in the mixin is specified, it should be a
+// relative path under which inherited HTTP paths are placed. Example:
+//
+// apis:
+// - name: google.storage.v2.Storage
+// mixins:
+// - name: google.acl.v1.AccessControl
+// root: acls
+//
+// This implies the following inherited HTTP annotation:
+//
+// service Storage {
+// // Get the underlying ACL object.
+// rpc GetAcl(GetAclRequest) returns (Acl) {
+// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
+// }
+// ...
+// }
+message Mixin {
+ // The fully qualified name of the interface which is included.
+ string name = 1;
+
+ // If non-empty specifies a path under which inherited HTTP paths
+ // are rooted.
+ string root = 2;
+}
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/arena.cc b/third_party/protobuf/3.4.0/src/google/protobuf/arena.cc
new file mode 100755
index 0000000000..fe38f5ddd7
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arena.cc
@@ -0,0 +1,357 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <google/protobuf/arena.h>
+
+#include <algorithm>
+#include <limits>
+
+
+#ifdef ADDRESS_SANITIZER
+#include <sanitizer/asan_interface.h>
+#endif // ADDRESS_SANITIZER
+
+namespace google {
+static const size_t kMinCleanupListElements = 8;
+static const size_t kMaxCleanupListElements = 64; // 1kB on 64-bit.
+
+namespace protobuf {
+namespace internal {
+
+
+google::protobuf::internal::SequenceNumber ArenaImpl::lifecycle_id_generator_;
+#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
+ArenaImpl::ThreadCache& ArenaImpl::thread_cache() {
+ static internal::ThreadLocalStorage<ThreadCache>* thread_cache_ =
+ new internal::ThreadLocalStorage<ThreadCache>();
+ return *thread_cache_->Get();
+}
+#elif defined(PROTOBUF_USE_DLLS)
+ArenaImpl::ThreadCache& ArenaImpl::thread_cache() {
+ static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_ = { -1, NULL };
+ return thread_cache_;
+}
+#else
+GOOGLE_THREAD_LOCAL ArenaImpl::ThreadCache ArenaImpl::thread_cache_ = {-1, NULL};
+#endif
+
+void ArenaImpl::Init() {
+ lifecycle_id_ = lifecycle_id_generator_.GetNext();
+ blocks_ = 0;
+ hint_ = 0;
+ space_allocated_ = 0;
+ owns_first_block_ = true;
+
+ if (options_.initial_block != NULL && options_.initial_block_size > 0) {
+ GOOGLE_CHECK_GE(options_.initial_block_size, sizeof(Block))
+ << ": Initial block size too small for header.";
+
+ // Add first unowned block to list.
+ Block* first_block = reinterpret_cast<Block*>(options_.initial_block);
+ first_block->size = options_.initial_block_size;
+ first_block->pos = kHeaderSize;
+ first_block->next = NULL;
+ first_block->cleanup = NULL;
+ // Thread which calls Init() owns the first block. This allows the
+ // single-threaded case to allocate on the first block without taking any
+ // locks.
+ first_block->owner = &thread_cache();
+ AddBlockInternal(first_block);
+ CacheBlock(first_block);
+ owns_first_block_ = false;
+ }
+}
+
+ArenaImpl::~ArenaImpl() { ResetInternal(); }
+
+uint64 ArenaImpl::Reset() {
+ // Invalidate any ThreadCaches pointing to any blocks we just destroyed.
+ lifecycle_id_ = lifecycle_id_generator_.GetNext();
+ return ResetInternal();
+}
+
+uint64 ArenaImpl::ResetInternal() {
+ Block* head =
+ reinterpret_cast<Block*>(google::protobuf::internal::NoBarrier_Load(&blocks_));
+ CleanupList(head);
+ uint64 space_allocated = FreeBlocks(head);
+
+ return space_allocated;
+}
+
+ArenaImpl::Block* ArenaImpl::NewBlock(void* me, Block* my_last_block,
+ size_t min_bytes, size_t start_block_size,
+ size_t max_block_size) {
+ size_t size;
+ if (my_last_block != NULL) {
+ // Double the current block size, up to a limit.
+ size = std::min(2 * my_last_block->size, max_block_size);
+ } else {
+ size = 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);
+
+ Block* b = reinterpret_cast<Block*>(options_.block_alloc(size));
+ b->pos = kHeaderSize;
+ b->size = size;
+ b->owner = me;
+ b->cleanup = 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
+ AddBlock(b);
+ return b;
+}
+
+void ArenaImpl::AddBlock(Block* b) {
+ MutexLock l(&blocks_lock_);
+ AddBlockInternal(b);
+}
+
+void ArenaImpl::AddBlockInternal(Block* b) {
+ b->next = reinterpret_cast<Block*>(google::protobuf::internal::NoBarrier_Load(&blocks_));
+ google::protobuf::internal::Release_Store(&blocks_, reinterpret_cast<google::protobuf::internal::AtomicWord>(b));
+ space_allocated_ += b->size;
+}
+
+ArenaImpl::Block* ArenaImpl::ExpandCleanupList(Block* b) {
+ size_t size = b->cleanup ? b->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->cleanup;
+ list->size = size;
+ list->len = 0;
+ b->cleanup = list;
+ return b;
+}
+
+inline GOOGLE_ATTRIBUTE_ALWAYS_INLINE void ArenaImpl::AddCleanupInBlock(
+ Block* b, void* elem, void (*cleanup)(void*)) {
+ if (b->cleanup == NULL || b->cleanup->len == b->cleanup->size) {
+ b = ExpandCleanupList(b);
+ }
+
+ CleanupNode* node = &b->cleanup->nodes[b->cleanup->len++];
+
+ node->elem = elem;
+ node->cleanup = cleanup;
+}
+
+void ArenaImpl::AddCleanup(void* elem, void (*cleanup)(void*)) {
+ return AddCleanupInBlock(GetBlock(0), elem, cleanup);
+}
+
+void* ArenaImpl::AllocateAligned(size_t n) {
+ GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned.
+
+ return AllocFromBlock(GetBlock(n), n);
+}
+
+void* ArenaImpl::AllocateAlignedAndAddCleanup(size_t n,
+ void (*cleanup)(void*)) {
+ GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned.
+
+ Block* b = GetBlock(n);
+ void* mem = AllocFromBlock(b, n);
+ AddCleanupInBlock(b, mem, cleanup);
+ return mem;
+}
+
+inline GOOGLE_ATTRIBUTE_ALWAYS_INLINE ArenaImpl::Block* ArenaImpl::GetBlock(size_t n) {
+ Block* my_block = NULL;
+
+ // 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;
+ }
+ }
+
+ // 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;
+ }
+ }
+ return GetBlockSlow(tc, my_block, n);
+}
+
+inline GOOGLE_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;
+#ifdef ADDRESS_SANITIZER
+ ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<char*>(b) + p, n);
+#endif // ADDRESS_SANITIZER
+ return reinterpret_cast<char*>(b) + p;
+}
+
+ArenaImpl::Block* ArenaImpl::GetBlockSlow(void* me, Block* my_full_block,
+ size_t n) {
+ Block* b = FindBlock(me); // Find block owned by me.
+ if (b == NULL || b->avail() < n) {
+ b = NewBlock(me, b, n, options_.start_block_size, options_.max_block_size);
+
+ // Try to steal the cleanup list from my_full_block. It's too full for this
+ // allocation, but it might have space left in its cleanup list and there's
+ // no reason to waste that memory.
+ if (my_full_block) {
+ GOOGLE_DCHECK_EQ(my_full_block->owner, me);
+ GOOGLE_DCHECK(b->cleanup == NULL);
+ b->cleanup = my_full_block->cleanup;
+ my_full_block->cleanup = NULL;
+ }
+ }
+ CacheBlock(b);
+ return b;
+}
+
+uint64 ArenaImpl::SpaceAllocated() const {
+ MutexLock l(&blocks_lock_);
+ return space_allocated_;
+}
+
+uint64 ArenaImpl::SpaceUsed() const {
+ uint64 space_used = 0;
+ Block* b = reinterpret_cast<Block*>(google::protobuf::internal::NoBarrier_Load(&blocks_));
+ while (b != NULL) {
+ space_used += (b->pos - kHeaderSize);
+ b = b->next;
+ }
+ return space_used;
+}
+
+uint64 ArenaImpl::FreeBlocks(Block* head) {
+ uint64 space_allocated = 0;
+ Block* first_block = NULL;
+ Block* b = head;
+
+ while (b != NULL) {
+ space_allocated += (b->size);
+ Block* next = b->next;
+ if (next != NULL) {
+#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);
+#endif // ADDRESS_SANITIZER
+ options_.block_dealloc(b, b->size);
+ } else {
+ if (owns_first_block_) {
+#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);
+#endif // ADDRESS_SANITIZER
+ options_.block_dealloc(b, b->size);
+ } else {
+ // User passed in the first block, skip free'ing the memory.
+ first_block = b;
+ }
+ }
+ b = next;
+ }
+ blocks_ = 0;
+ hint_ = 0;
+ space_allocated_ = 0;
+ if (!owns_first_block_) {
+ // Make the first block that was passed in through ArenaOptions
+ // available for reuse.
+ first_block->pos = kHeaderSize;
+ first_block->cleanup = NULL;
+ // Thread which calls Reset() owns the first block. This allows the
+ // single-threaded case to allocate on the first block without taking any
+ // locks.
+ first_block->owner = &thread_cache();
+ AddBlockInternal(first_block);
+ CacheBlock(first_block);
+ }
+ return space_allocated;
+}
+
+void ArenaImpl::CleanupList(Block* head) {
+ // Have to do this in a first pass, because some of the destructors might
+ // refer to memory in other blocks.
+ for (Block* b = head; b; b = b->next) {
+ CleanupChunk* list = b->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;
+ }
+ b->cleanup = NULL;
+ }
+}
+
+ArenaImpl::Block* ArenaImpl::FindBlock(void* me) {
+ // TODO(sanjay): We might want to keep a separate list with one
+ // entry per thread.
+ Block* b = reinterpret_cast<Block*>(google::protobuf::internal::Acquire_Load(&blocks_));
+ while (b != NULL && b->owner != me) {
+ b = b->next;
+ }
+ return b;
+}
+
+} // namespace internal
+
+void Arena::OnArenaAllocation(const std::type_info* allocated_type,
+ size_t n) const {
+ if (on_arena_allocation_ != NULL) {
+ on_arena_allocation_(allocated_type, n, hooks_cookie_);
+ }
+}
+
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arena.h b/third_party/protobuf/3.4.0/src/google/protobuf/arena.h
index 9928c8e663..f8a947059f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arena.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arena.h
@@ -37,7 +37,10 @@
#ifdef max
#undef max // Visual Studio defines this macro
#endif
-#if defined(_MSC_VER) && !defined(_LIBCPP_STD_VER) && !_HAS_EXCEPTIONS
+#if LANG_CXX11
+#include <google/protobuf/stubs/type_traits.h>
+#endif
+#if defined(_MSC_VER) && !_HAS_EXCEPTIONS
// Work around bugs in MSVC <typeinfo> header when _HAS_EXCEPTIONS=0.
#include <exception>
#include <typeinfo>
@@ -49,49 +52,25 @@ using type_info = ::type_info;
#endif
#include <google/protobuf/arena_impl.h>
-#include <google/protobuf/stubs/port.h>
-#include <type_traits>
namespace google {
namespace protobuf {
-struct ArenaOptions; // defined below
-
-} // namespace protobuf
-
-namespace quality_webanswers {
-
-void TempPrivateWorkAround(::google::protobuf::ArenaOptions* arena_options);
-
-} // namespace quality_webanswers
-
-namespace protobuf {
-
-class Arena; // defined below
-class Message; // defined in message.h
-class MessageLite;
-
-namespace arena_metrics {
-
-void EnableArenaMetrics(::google::protobuf::ArenaOptions* options);
-
-} // namespace arena_metrics
+class Arena; // defined below
+class Message; // message.h
namespace internal {
+class ArenaString; // arenastring.h
+class LazyField; // lazy_field.h
-struct ArenaStringPtr; // defined in arenastring.h
-class LazyField; // defined in lazy_field.h
-
-template <typename Type>
-class GenericTypeHandler; // defined in repeated_field.h
+template<typename Type>
+class GenericTypeHandler; // repeated_field.h
// Templated cleanup methods.
-template <typename T>
-void arena_destruct_object(void* object) {
+template<typename T> void arena_destruct_object(void* object) {
reinterpret_cast<T*>(object)->~T();
}
-template <typename T>
-void arena_delete_object(void* object) {
+template<typename T> void arena_delete_object(void* object) {
delete reinterpret_cast<T*>(object);
}
inline void arena_free(void* object, size_t size) {
@@ -137,20 +116,6 @@ 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.
@@ -170,17 +135,25 @@ struct ArenaOptions {
// intentionally want to avoid monitoring an allocation. (i.e. internal
// allocations for managing the arena)
void (*on_arena_allocation)(const std::type_info* allocated_type,
- uint64 alloc_size, void* cookie);
+ 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;
+ static const size_t kDefaultMaxBlockSize = 8192;
};
// Support for non-RTTI environments. (The metrics hooks API uses type
@@ -249,22 +222,20 @@ class LIBPROTOBUF_EXPORT Arena {
Init(options);
}
- // Block overhead. Use this as a guide for how much to over-allocate the
- // initial block if you want an allocation of size N to fit inside it.
- //
- // 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::kBlockHeaderSize +
- internal::ArenaImpl::kSerialArenaSize;
-
// Default constructor with sensible default options, tuned for average
// use-cases.
Arena() : impl_(ArenaOptions()) { Init(ArenaOptions()); }
~Arena() {
- if (hooks_cookie_) {
- CallDestructorHooks();
+ uint64 space_allocated = SpaceAllocated();
+ // Call the reset hook
+ if (on_arena_reset_ != NULL) {
+ on_arena_reset_(this, hooks_cookie_, space_allocated);
+ }
+
+ // Call the destruction hook
+ if (on_arena_destruction_ != NULL) {
+ on_arena_destruction_(this, hooks_cookie_, space_allocated);
}
}
@@ -290,16 +261,54 @@ class LIBPROTOBUF_EXPORT Arena {
//
// This function also accepts any type T that satisfies the arena message
// allocation protocol, documented above.
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMessage(
- Arena* arena, Args&&... args) {
+ template <typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static T* CreateMessage(::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>();
+ }
+ }
+
+ // One-argument form of CreateMessage. This is useful for constructing objects
+ // that implement the arena message construction protocol described above but
+ // take additional constructor arguments.
+ template <typename T, typename Arg> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static T* CreateMessage(::google::protobuf::Arena* arena, const Arg& arg) {
+#if LANG_CXX11
static_assert(
InternalHelper<T>::is_arena_constructable::value,
"CreateMessage can only construct types that are ArenaConstructable");
- // We must delegate to CreateMaybeMessage() and NOT CreateMessageInternal()
- // because protobuf generated classes specialize CreateMaybeMessage() and we
- // need to use that specialization for code size reasons.
- return Arena::CreateMaybeMessage<T>(arena, std::forward<Args>(args)...);
+#endif
+ if (arena == NULL) {
+ return new T(NULL, arg);
+ } else {
+ return arena->CreateMessageInternal<T>(arg);
+ }
+ }
+
+ // Two-argument form of CreateMessage. This is useful for constructing objects
+ // that implement the arena message construction protocol described above but
+ // take additional constructor arguments.
+ template <typename T, typename Arg1, typename Arg2> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static T* CreateMessage(::google::protobuf::Arena* arena,
+ const Arg1& arg1,
+ const Arg2& arg2) {
+#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(NULL, arg1, arg2);
+ } else {
+ return arena->CreateMessageInternal<T>(arg1, arg2);
+ }
}
// API to create any objects on the arena. Note that only the object will
@@ -317,11 +326,143 @@ class LIBPROTOBUF_EXPORT Arena {
// (unless the destructor is trivial). Hence, from T's point of view, it is as
// if the object were allocated on the heap (except that the underlying memory
// is obtained from the arena).
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* Create(Arena* arena,
- Args&&... args) {
- return CreateNoMessage<T>(arena, is_arena_constructable<T>(),
- std::forward<Args>(args)...);
+#if LANG_CXX11
+ template <typename T, typename... Args> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static T* Create(::google::protobuf::Arena* arena, Args&&... args) {
+ if (arena == NULL) {
+ return new T(std::forward<Args>(args)...);
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
+ std::forward<Args>(args)...);
+ }
+ }
+#endif
+ template <typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static T* Create(::google::protobuf::Arena* arena) {
+ if (arena == NULL) {
+ return new T();
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value);
+ }
+ }
+
+ // Version of the above with one constructor argument for the created object.
+ template <typename T, typename Arg> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static T* Create(::google::protobuf::Arena* arena, const Arg& arg) {
+ if (arena == NULL) {
+ return new T(arg);
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
+ arg);
+ }
+ }
+
+ // Version of the above with two constructor arguments for the created object.
+ template <typename T, typename Arg1, typename Arg2> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static T* Create(::google::protobuf::Arena* arena, const Arg1& arg1, const Arg2& arg2) {
+ if (arena == NULL) {
+ return new T(arg1, arg2);
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
+ arg1, arg2);
+ }
+ }
+
+ // Version of the above with three constructor arguments for the created
+ // object.
+ template <typename T, typename Arg1, typename Arg2, typename Arg3>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena,
+ const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3) {
+ if (arena == NULL) {
+ return new T(arg1, arg2, arg3);
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
+ arg1, arg2, arg3);
+ }
+ }
+
+ // Version of the above with four constructor arguments for the created
+ // object.
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena,
+ const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3, const Arg4& arg4) {
+ if (arena == NULL) {
+ return new T(arg1, arg2, arg3, arg4);
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
+ arg1, arg2, arg3, arg4);
+ }
+ }
+
+ // Version of the above with five constructor arguments for the created
+ // object.
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4, typename Arg5>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena,
+ const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3, const Arg4& arg4,
+ const Arg5& arg5) {
+ if (arena == NULL) {
+ return new T(arg1, arg2, arg3, arg4, arg5);
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
+ arg1, arg2, arg3, arg4, arg5);
+ }
+ }
+
+ // Version of the above with six constructor arguments for the created
+ // object.
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4, typename Arg5, typename Arg6>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena,
+ const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3, const Arg4& arg4,
+ const Arg5& arg5, const Arg6& arg6) {
+ if (arena == NULL) {
+ return new T(arg1, arg2, arg3, arg4, arg5, arg6);
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
+ arg1, arg2, arg3, arg4, arg5, arg6);
+ }
+ }
+
+ // Version of the above with seven constructor arguments for the created
+ // object.
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4, typename Arg5, typename Arg6, typename Arg7>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena,
+ const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3, const Arg4& arg4,
+ const Arg5& arg5, const Arg6& arg6,
+ const Arg7& arg7) {
+ if (arena == NULL) {
+ return new T(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
+ arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ }
+ }
+
+ // Version of the above with eight constructor arguments for the created
+ // object.
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4, typename Arg5, typename Arg6, typename Arg7,
+ typename Arg8>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena,
+ const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3, const Arg4& arg4,
+ const Arg5& arg5, const Arg6& arg6,
+ const Arg7& arg7, const Arg8& arg8) {
+ if (arena == NULL) {
+ return new T(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+ } else {
+ return arena->CreateInternal<T>(
+ google::protobuf::internal::has_trivial_destructor<T>::value,
+ arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+ }
}
// Create an array of object type T on the arena *without* invoking the
@@ -330,14 +471,10 @@ class LIBPROTOBUF_EXPORT Arena {
// To ensure safe uses, this function checks at compile time
// (when compiled as C++11) that T is trivially default-constructible and
// trivially destructible.
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateArray(
- Arena* arena, size_t num_elements) {
- static_assert(std::is_pod<T>::value,
- "CreateArray requires a trivially constructible type");
- static_assert(std::is_trivially_destructible<T>::value,
- "CreateArray requires a trivially destructible type");
- GOOGLE_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
+ template <typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static T* CreateArray(::google::protobuf::Arena* arena, size_t num_elements) {
+ GOOGLE_CHECK_LE(num_elements,
+ std::numeric_limits<size_t>::max() / sizeof(T))
<< "Requested size is too large to fit into size_t.";
if (arena == NULL) {
return static_cast<T*>(::operator new[](num_elements * sizeof(T)));
@@ -359,7 +496,6 @@ 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());
}
@@ -369,19 +505,20 @@ class LIBPROTOBUF_EXPORT Arena {
// Any objects allocated on this arena are unusable after this call. It also
// returns the total space used by the arena which is the sums of the sizes
// of the allocated blocks. This method is not thread-safe.
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE uint64 Reset() {
+ GOOGLE_ATTRIBUTE_NOINLINE uint64 Reset() {
+ uint64 space_allocated = SpaceAllocated();
// Call the reset hook
if (on_arena_reset_ != NULL) {
- on_arena_reset_(this, hooks_cookie_, impl_.SpaceAllocated());
+ on_arena_reset_(this, hooks_cookie_, space_allocated);
}
return impl_.Reset();
}
// Adds |object| to a list of heap-allocated objects to be freed with |delete|
// when the arena is destroyed or reset.
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void Own(T* object) {
- OwnInternal(object, std::is_convertible<T*, Message*>());
+ template <typename T> GOOGLE_ATTRIBUTE_NOINLINE
+ void Own(T* object) {
+ OwnInternal(object, google::protobuf::internal::is_convertible<T*, ::google::protobuf::Message*>());
}
// Adds |object| to a list of objects whose destructors will be manually
@@ -389,8 +526,8 @@ class LIBPROTOBUF_EXPORT Arena {
// that it does not free the underlying memory with |delete|; hence, it is
// normally only used for objects that are placement-newed into
// arena-allocated memory.
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void OwnDestructor(T* object) {
+ template <typename T> GOOGLE_ATTRIBUTE_NOINLINE
+ void OwnDestructor(T* object) {
if (object != NULL) {
impl_.AddCleanup(object, &internal::arena_destruct_object<T>);
}
@@ -400,8 +537,8 @@ class LIBPROTOBUF_EXPORT Arena {
// will be manually called when the arena is destroyed or reset. This differs
// from OwnDestructor() in that any member function may be specified, not only
// the class destructor.
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void OwnCustomDestructor(
- void* object, void (*destruct)(void*)) {
+ GOOGLE_ATTRIBUTE_NOINLINE void OwnCustomDestructor(void* object,
+ void (*destruct)(void*)) {
impl_.AddCleanup(object, destruct);
}
@@ -409,9 +546,8 @@ class LIBPROTOBUF_EXPORT Arena {
// message, or NULL otherwise. This differs from value->GetArena() in that the
// latter is a virtual call, while this method is a templated call that
// resolves at compile-time.
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static Arena* GetArena(
- const T* value) {
+ template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ static ::google::protobuf::Arena* GetArena(const T* value) {
return GetArenaInternal(value, is_arena_constructable<T>());
}
@@ -422,93 +558,60 @@ class LIBPROTOBUF_EXPORT Arena {
template <typename U>
static double DestructorSkippable(...);
- typedef std::integral_constant<
+ typedef google::protobuf::internal::integral_constant<
bool, sizeof(DestructorSkippable<T>(static_cast<const T*>(0))) ==
sizeof(char) ||
- std::is_trivially_destructible<T>::value>
+ google::protobuf::internal::has_trivial_destructor<T>::value>
is_destructor_skippable;
- template <typename U>
+ template<typename U>
static char ArenaConstructable(
const typename U::InternalArenaConstructable_*);
- template <typename U>
+ template<typename U>
static double ArenaConstructable(...);
- typedef std::integral_constant<bool, sizeof(ArenaConstructable<T>(
- static_cast<const T*>(0))) ==
- sizeof(char)>
+ typedef google::protobuf::internal::integral_constant<bool, sizeof(ArenaConstructable<T>(
+ static_cast<const T*>(0))) ==
+ sizeof(char)>
is_arena_constructable;
+#if LANG_CXX11
template <typename... Args>
static T* Construct(void* ptr, Args&&... args) {
return new (ptr) T(std::forward<Args>(args)...);
}
+#else
+ template <typename Arg1>
+ static T* Construct(void* ptr, const Arg1& arg1) {
+ return new (ptr) T(arg1);
+ }
+ template <typename Arg1, typename Arg2>
+ static T* Construct(void* ptr, const Arg1& arg1, const Arg2& arg2) {
+ return new (ptr) T(arg1, arg2);
+ }
+ template <typename Arg1, typename Arg2, typename Arg3>
+ static T* Construct(void* ptr, const Arg1& arg1,
+ const Arg2& arg2, const Arg3& arg3) {
+ return new (ptr) T(arg1, arg2, arg3);
+ }
+#endif // LANG_CXX11
static Arena* GetArena(const T* p) { return p->GetArenaNoVirtual(); }
friend class Arena;
};
- // Helper typetraits that indicates support for arenas in a type T at compile
+ // Helper typetrait that indicates support for arenas in a type T at compile
// time. This is public only to allow construction of higher-level templated
- // utilities.
- //
- // is_arena_constructable<T>::value is true if the message type T has arena
- // support enabled, and false otherwise.
- //
- // is_destructor_skippable<T>::value is true if the message type T has told
- // the arena that it is safe to skip the destructor, and false otherwise.
+ // utilities. is_arena_constructable<T>::value is true if the message type T
+ // has arena support enabled, and false otherwise.
//
// This is inside Arena because only Arena has the friend relationships
// necessary to see the underlying generated code traits.
template <typename T>
struct is_arena_constructable : InternalHelper<T>::is_arena_constructable {};
- template <typename T>
- struct is_destructor_skippable : InternalHelper<T>::is_destructor_skippable {
- };
private:
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMessageInternal(
- Arena* arena, Args&&... args) {
- static_assert(
- InternalHelper<T>::is_arena_constructable::value,
- "CreateMessage can only construct types that are ArenaConstructable");
- if (arena == NULL) {
- return new T(nullptr, std::forward<Args>(args)...);
- } else {
- return arena->DoCreateMessage<T>(std::forward<Args>(args)...);
- }
- }
-
- // This specialization for no arguments is necessary, because its behavior is
- // slightly different. When the arena pointer is nullptr, it calls T()
- // instead of T(nullptr).
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMessageInternal(
- Arena* arena) {
- static_assert(
- InternalHelper<T>::is_arena_constructable::value,
- "CreateMessage can only construct types that are ArenaConstructable");
- if (arena == NULL) {
- return new T();
- } else {
- return arena->DoCreateMessage<T>();
- }
- }
-
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateInternal(
- Arena* arena, Args&&... args) {
- if (arena == NULL) {
- return new T(std::forward<Args>(args)...);
- } else {
- return arena->DoCreate<T>(std::is_trivially_destructible<T>::value,
- std::forward<Args>(args)...);
- }
- }
-
- 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 {
if (GOOGLE_PREDICT_FALSE(hooks_cookie_ != NULL)) {
@@ -519,9 +622,8 @@ class LIBPROTOBUF_EXPORT Arena {
// Allocate and also optionally call on_arena_allocation callback with the
// allocated type info when the hooks are in place in ArenaOptions and
// the cookie is not null.
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void* AllocateInternal(
- bool skip_explicit_ownership) {
+ template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ void* AllocateInternal(bool skip_explicit_ownership) {
const size_t n = internal::AlignUpTo8(sizeof(T));
AllocHook(RTTI_TYPE_ID(T), n);
// Monitor allocation if needed.
@@ -538,49 +640,29 @@ class LIBPROTOBUF_EXPORT Arena {
// as it can cause confusing API usages, and end up having double free in
// user code. These are used only internally from LazyField and Repeated
// fields, since they are designed to work in all mode combinations.
- template <typename Msg, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static Msg* DoCreateMaybeMessage(
- Arena* arena, std::true_type, Args&&... args) {
- return CreateMessageInternal<Msg>(arena, std::forward<Args>(args)...);
- }
-
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* DoCreateMaybeMessage(
- Arena* arena, std::false_type, Args&&... args) {
- return CreateInternal<T>(arena, std::forward<Args>(args)...);
- }
-
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMaybeMessage(
- Arena* arena, Args&&... args) {
- return DoCreateMaybeMessage<T>(arena, is_arena_constructable<T>(),
- std::forward<Args>(args)...);
+ template <typename Msg>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static Msg* CreateMaybeMessage(Arena* arena,
+ google::protobuf::internal::true_type) {
+ return CreateMessage<Msg>(arena);
}
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateNoMessage(
- Arena* arena, std::true_type, Args&&... args) {
- // User is constructing with Create() despite the fact that T supports arena
- // construction. In this case we have to delegate to CreateInternal(), and
- // we can't use any CreateMaybeMessage() specialization that may be defined.
- return CreateInternal<T>(arena, std::forward<Args>(args)...);
+ template <typename T>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* CreateMaybeMessage(Arena* arena,
+ google::protobuf::internal::false_type) {
+ return Create<T>(arena);
}
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateNoMessage(
- Arena* arena, std::false_type, Args&&... args) {
- // User is constructing with Create() and the type does not support arena
- // construction. In this case we can delegate to CreateMaybeMessage() and
- // use any specialization that may be available for that.
- return CreateMaybeMessage<T>(arena, std::forward<Args>(args)...);
+ template <typename T>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* CreateMaybeMessage(Arena* arena) {
+ return CreateMaybeMessage<T>(arena, is_arena_constructable<T>());
}
// Just allocate the required size for the given type assuming the
// type has a trivial constructor.
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateInternalRawArray(
- size_t num_elements) {
- GOOGLE_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
+ template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ T* CreateInternalRawArray(size_t num_elements) {
+ GOOGLE_CHECK_LE(num_elements,
+ std::numeric_limits<size_t>::max() / sizeof(T))
<< "Requested size is too large to fit into size_t.";
const size_t n = internal::AlignUpTo8(sizeof(T) * num_elements);
// Monitor allocation if needed.
@@ -588,17 +670,125 @@ class LIBPROTOBUF_EXPORT Arena {
return static_cast<T*>(impl_.AllocateAligned(n));
}
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* DoCreate(
- bool skip_explicit_ownership, Args&&... args) {
+#if LANG_CXX11
+ template <typename T, typename... Args> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ T* CreateInternal(bool skip_explicit_ownership, Args&&... args) {
return new (AllocateInternal<T>(skip_explicit_ownership))
T(std::forward<Args>(args)...);
}
- template <typename T, typename... Args>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* DoCreateMessage(Args&&... args) {
+#else
+ template <typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ T* CreateInternal(bool skip_explicit_ownership) {
+ return new (AllocateInternal<T>(skip_explicit_ownership)) T();
+ }
+
+ template <typename T, typename Arg> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ T* CreateInternal(bool skip_explicit_ownership, const Arg& arg) {
+ return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg);
+ }
+
+ template <typename T, typename Arg1, typename Arg2>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership,
+ const Arg1& arg1,
+ const Arg2& arg2) {
+ return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership,
+ const Arg1& arg1,
+ const Arg2& arg2,
+ const Arg3& arg3) {
+ return new (AllocateInternal<T>(skip_explicit_ownership))
+ T(arg1, arg2, arg3);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership,
+ const Arg1& arg1,
+ const Arg2& arg2,
+ const Arg3& arg3,
+ const Arg4& arg4) {
+ return new (AllocateInternal<T>(skip_explicit_ownership))
+ T(arg1, arg2, arg3, arg4);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4, typename Arg5>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership,
+ const Arg1& arg1,
+ const Arg2& arg2,
+ const Arg3& arg3,
+ const Arg4& arg4,
+ const Arg5& arg5) {
+ return new (AllocateInternal<T>(skip_explicit_ownership))
+ T(arg1, arg2, arg3, arg4, arg5);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4, typename Arg5, typename Arg6>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership,
+ const Arg1& arg1,
+ const Arg2& arg2,
+ const Arg3& arg3,
+ const Arg4& arg4,
+ const Arg5& arg5,
+ const Arg6& arg6) {
+ return new (AllocateInternal<T>(skip_explicit_ownership))
+ T(arg1, arg2, arg3, arg4, arg5, arg6);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4, typename Arg5, typename Arg6, typename Arg7>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership,
+ const Arg1& arg1,
+ const Arg2& arg2,
+ const Arg3& arg3,
+ const Arg4& arg4,
+ const Arg5& arg5,
+ const Arg6& arg6,
+ const Arg7& arg7) {
+ return new (AllocateInternal<T>(skip_explicit_ownership))
+ T(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4, typename Arg5, typename Arg6, typename Arg7,
+ typename Arg8>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership,
+ const Arg1& arg1,
+ const Arg2& arg2,
+ const Arg3& arg3,
+ const Arg4& arg4,
+ const Arg5& arg5,
+ const Arg6& arg6,
+ const Arg7& arg7,
+ const Arg8& arg8) {
+ return new (AllocateInternal<T>(skip_explicit_ownership))
+ T(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+ }
+#endif
+ template <typename T>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal() {
+ return InternalHelper<T>::Construct(
+ AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value),
+ this);
+ }
+
+ template <typename T, typename Arg>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal(const Arg& arg) {
return InternalHelper<T>::Construct(
AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value),
- this, std::forward<Args>(args)...);
+ this, arg);
+ }
+
+ template <typename T, typename Arg1, typename Arg2>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal(const Arg1& arg1,
+ const Arg2& arg2) {
+ return InternalHelper<T>::Construct(
+ AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value),
+ this, arg1, arg2);
}
// CreateInArenaStorage is used to implement map field. Without it,
@@ -614,22 +804,22 @@ class LIBPROTOBUF_EXPORT Arena {
}
template <typename T>
- static void CreateInArenaStorageInternal(T* ptr, Arena* arena,
- std::true_type) {
+ static void CreateInArenaStorageInternal(
+ T* ptr, Arena* arena, google::protobuf::internal::true_type) {
InternalHelper<T>::Construct(ptr, arena);
}
template <typename T>
- static void CreateInArenaStorageInternal(T* ptr, Arena* /* arena */,
- std::false_type) {
+ static void CreateInArenaStorageInternal(
+ T* ptr, Arena* /* arena */, google::protobuf::internal::false_type) {
new (ptr) T();
}
template <typename T>
- static void RegisterDestructorInternal(T* /* ptr */, Arena* /* arena */,
- std::true_type) {}
+ static void RegisterDestructorInternal(
+ T* /* ptr */, Arena* /* arena */, google::protobuf::internal::true_type) {}
template <typename T>
- static void RegisterDestructorInternal(T* ptr, Arena* arena,
- std::false_type) {
+ static void RegisterDestructorInternal(
+ T* ptr, Arena* arena, google::protobuf::internal::false_type) {
arena->OwnDestructor(ptr);
}
@@ -638,16 +828,15 @@ class LIBPROTOBUF_EXPORT Arena {
// is a subtype of ::google::protobuf::Message and 'false_type' otherwise. Collapsing
// all template instantiations to one for generic Message reduces code size,
// using the virtual destructor instead.
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void OwnInternal(T* object,
- std::true_type) {
+ template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ void OwnInternal(T* object, google::protobuf::internal::true_type) {
if (object != NULL) {
- impl_.AddCleanup(object, &internal::arena_delete_object<Message>);
+ impl_.AddCleanup(object,
+ &internal::arena_delete_object< ::google::protobuf::Message>);
}
}
- template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void OwnInternal(T* object,
- std::false_type) {
+ template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
+ void OwnInternal(T* object, google::protobuf::internal::false_type) {
if (object != NULL) {
impl_.AddCleanup(object, &internal::arena_delete_object<T>);
}
@@ -657,14 +846,14 @@ class LIBPROTOBUF_EXPORT Arena {
// InternalArenaConstructable_ tags can be associated with an arena, and such
// objects must implement a GetArenaNoVirtual() method.
template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static Arena* GetArenaInternal(
- const T* value, std::true_type) {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static ::google::protobuf::Arena* GetArenaInternal(
+ const T* value, google::protobuf::internal::true_type) {
return InternalHelper<T>::GetArena(value);
}
template <typename T>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static Arena* GetArenaInternal(
- const T* /* value */, std::false_type) {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static ::google::protobuf::Arena* GetArenaInternal(
+ const T* value, google::protobuf::internal::false_type) {
return NULL;
}
@@ -676,6 +865,7 @@ 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);
@@ -686,10 +876,9 @@ class LIBPROTOBUF_EXPORT Arena {
void* hooks_cookie_;
template <typename Type>
- friend class internal::GenericTypeHandler;
- friend struct internal::ArenaStringPtr; // For AllocateAligned.
- friend class internal::LazyField; // For CreateMaybeMessage.
- friend class MessageLite;
+ friend class ::google::protobuf::internal::GenericTypeHandler;
+ friend class internal::ArenaString; // For AllocateAligned.
+ friend class internal::LazyField; // For CreateMaybeMessage.
template <typename Key, typename T>
friend class Map;
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arena_impl.h b/third_party/protobuf/3.4.0/src/google/protobuf/arena_impl.h
index f648f16621..b7f0c7b6ad 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arena_impl.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arena_impl.h
@@ -33,17 +33,14 @@
#ifndef GOOGLE_PROTOBUF_ARENA_IMPL_H__
#define GOOGLE_PROTOBUF_ARENA_IMPL_H__
-#include <atomic>
#include <limits>
+#include <google/protobuf/stubs/atomic_sequence_num.h>
+#include <google/protobuf/stubs/atomicops.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
-
-#include <google/protobuf/stubs/port.h>
-
-#ifdef ADDRESS_SANITIZER
-#include <sanitizer/asan_interface.h>
-#endif // ADDRESS_SANITIZER
+#include <google/protobuf/stubs/mutex.h>
+#include <google/protobuf/stubs/type_traits.h>
namespace google {
@@ -83,14 +80,6 @@ class LIBPROTOBUF_EXPORT ArenaImpl {
template <typename O>
explicit ArenaImpl(const O& options) : options_(options) {
- if (options_.initial_block != NULL && options_.initial_block_size > 0) {
- GOOGLE_CHECK_GE(options_.initial_block_size, sizeof(Block))
- << ": Initial block size too small for header.";
- initial_block_ = reinterpret_cast<Block*>(options_.initial_block);
- } else {
- initial_block_ = NULL;
- }
-
Init();
}
@@ -113,10 +102,6 @@ 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 {
@@ -129,124 +114,41 @@ 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|.
};
- 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;
- }
-
- 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.
- 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_;
+ struct Block {
+ void* owner; // &ThreadCache of thread that owns this block.
+ Block* next; // Next block in arena (may have different owner)
+ CleanupChunk* cleanup; // Head of cleanup list (may point to another block,
+ // but it must have the same 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_ATTRIBUTE_ALWAYS_INLINE size_t avail() const { return size - pos; }
// data follows
};
struct ThreadCache {
-#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
- // 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_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;
- SerialArena* last_serial_arena;
+ Block* last_block_used_;
};
- static std::atomic<int64> lifecycle_id_generator_;
+
+ // 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;
+#if LANG_CXX11
+ static_assert(kHeaderSize % 8 == 0, "kHeaderSize must be a multiple of 8.");
+#endif
+ static google::protobuf::internal::SequenceNumber lifecycle_id_generator_;
#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
// Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custom thread
// local storage class we implemented.
@@ -265,53 +167,44 @@ 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();
+ uint64 FreeBlocks(Block* head);
+
+ void AddCleanupInBlock(Block* b, void* elem, void (*cleanup)(void*));
+ Block* ExpandCleanupList(Block* b);
// Delete or Destruct all objects owned by the arena.
- void CleanupList();
+ void CleanupList(Block* head);
+ uint64 ResetInternal();
- inline void CacheSerialArena(SerialArena* serial) {
- thread_cache().last_serial_arena = serial;
+ inline void CacheBlock(Block* block) {
+ thread_cache().last_block_used_ = block;
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.
-
- hint_.store(serial, std::memory_order_release);
+ google::protobuf::internal::Release_Store(&hint_, reinterpret_cast<google::protobuf::internal::AtomicWord>(block));
}
+ google::protobuf::internal::AtomicWord blocks_; // Head of linked list of all allocated blocks
+ google::protobuf::internal::AtomicWord hint_; // Fast thread-local block access
+ uint64 space_allocated_; // Sum of sizes of all allocated blocks.
+
+ bool owns_first_block_; // Indicates that arena owns the first block
+ mutable Mutex blocks_lock_;
+
+ void AddBlock(Block* b);
+ // Access must be synchronized, either by blocks_lock_ or by being called from
+ // Init()/Reset().
+ void AddBlockInternal(Block* b);
+ // Returns a block owned by this thread.
+ Block* GetBlock(size_t n);
+ Block* GetBlockSlow(void* me, Block* my_full_block, size_t n);
+ Block* FindBlock(void* me);
+ Block* NewBlock(void* me, Block* my_last_block, size_t min_bytes,
+ size_t start_block_size, size_t max_block_size);
+ static void* AllocFromBlock(Block* b, size_t n);
- std::atomic<SerialArena*>
- threads_; // Pointer to a linked list of SerialArena.
- std::atomic<SerialArena*> hint_; // Fast thread-local block access
- std::atomic<size_t> space_allocated_; // Total size of all allocated blocks.
-
- Block *initial_block_; // If non-NULL, points to the block that came from
- // user data.
-
- 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_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ArenaImpl);
- // All protos have pointers back to the arena hence Arena must have
- // pointer stability.
- ArenaImpl(ArenaImpl&&) = delete;
- ArenaImpl& operator=(ArenaImpl&&) = delete;
-
- public:
- // 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;
- static_assert(kBlockHeaderSize % 8 == 0,
- "kBlockHeaderSize must be a multiple of 8.");
- static_assert(kSerialArenaSize % 8 == 0,
- "kSerialArenaSize must be a multiple of 8.");
};
} // namespace internal
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arena_test_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/arena_test_util.cc
index df9c5bd6b4..df9c5bd6b4 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arena_test_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arena_test_util.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arena_test_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/arena_test_util.h
index df56ece8d4..8c9f7698c5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arena_test_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arena_test_util.h
@@ -50,7 +50,7 @@ void TestParseCorruptedString(const T& message) {
s[i] ^= c;
google::protobuf::Arena arena;
T* message =
- google::protobuf::Arena::CreateMessage<T>(use_arena ? &arena : nullptr);
+ google::protobuf::Arena::CreateMessage<T>(use_arena ? &arena : NULL);
if (message->ParseFromString(s)) {
++success_count;
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arena_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/arena_unittest.cc
index eaaffce25a..6172cade09 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arena_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arena_unittest.cc
@@ -33,8 +33,10 @@
#include <algorithm>
#include <cstring>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
-#include <type_traits>
#include <typeinfo>
#include <vector>
@@ -65,6 +67,7 @@ using protobuf_unittest::TestOneof2;
using protobuf_unittest::TestEmptyMessage;
namespace protobuf {
+namespace {
class Notifier {
public:
@@ -151,19 +154,9 @@ class MustBeConstructedWithOneThroughEight {
TEST(ArenaTest, ArenaConstructable) {
EXPECT_TRUE(Arena::is_arena_constructable<TestAllTypes>::type::value);
EXPECT_TRUE(Arena::is_arena_constructable<const TestAllTypes>::type::value);
- EXPECT_FALSE(Arena::is_arena_constructable<
- protobuf_unittest_no_arena::TestNoArenaMessage>::type::value);
EXPECT_FALSE(Arena::is_arena_constructable<Arena>::type::value);
}
-TEST(ArenaTest, DestructorSkippable) {
- EXPECT_TRUE(Arena::is_destructor_skippable<TestAllTypes>::type::value);
- EXPECT_TRUE(Arena::is_destructor_skippable<const TestAllTypes>::type::value);
- EXPECT_FALSE(Arena::is_destructor_skippable<
- protobuf_unittest_no_arena::TestNoArenaMessage>::type::value);
- EXPECT_FALSE(Arena::is_destructor_skippable<Arena>::type::value);
-}
-
TEST(ArenaTest, BasicCreate) {
Arena arena;
EXPECT_TRUE(Arena::Create<int32>(&arena) != NULL);
@@ -205,6 +198,7 @@ TEST(ArenaTest, CreateAndNonConstCopy) {
EXPECT_EQ("foo", *s_copy);
}
+#if LANG_CXX11
TEST(ArenaTest, CreateAndMove) {
Arena arena;
string s("foo");
@@ -213,6 +207,7 @@ TEST(ArenaTest, CreateAndMove) {
EXPECT_TRUE(s.empty()); // NOLINT
EXPECT_EQ("foo", *s_move);
}
+#endif
TEST(ArenaTest, CreateWithFourConstructorArguments) {
Arena arena;
@@ -248,6 +243,7 @@ TEST(ArenaTest, CreateWithEightConstructorArguments) {
ASSERT_EQ("8", new_object->eight_);
}
+#if LANG_CXX11
class PleaseMoveMe {
public:
explicit PleaseMoveMe(const string& value) : value_(value) {}
@@ -268,12 +264,13 @@ TEST(ArenaTest, CreateWithMoveArguments) {
EXPECT_TRUE(new_object);
ASSERT_EQ("1", new_object->value());
}
+#endif
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(96);
+ std::vector<char> arena_block(64);
ArenaOptions options;
options.initial_block = &arena_block[0];
options.initial_block_size = arena_block.size();
@@ -446,7 +443,7 @@ TEST(ArenaTest, ReflectionSwapFields) {
TestUtil::SetAllFields(arena1_message);
reflection->SwapFields(arena1_message, &message, fields);
EXPECT_EQ(&arena1, arena1_message->GetArena());
- EXPECT_EQ(nullptr, message.GetArena());
+ EXPECT_EQ(NULL, message.GetArena());
arena1_message->SerializeToString(&output);
EXPECT_EQ(0, output.size());
TestUtil::ExpectAllFieldsSet(message);
@@ -472,7 +469,7 @@ TEST(ArenaTest, ReleaseMessage) {
Arena arena;
TestAllTypes* arena_message = Arena::CreateMessage<TestAllTypes>(&arena);
arena_message->mutable_optional_nested_message()->set_bb(118);
- std::unique_ptr<TestAllTypes::NestedMessage> nested(
+ google::protobuf::scoped_ptr<TestAllTypes::NestedMessage> nested(
arena_message->release_optional_nested_message());
EXPECT_EQ(118, nested->bb());
@@ -493,7 +490,7 @@ TEST(ArenaTest, ReleaseString) {
Arena arena;
TestAllTypes* arena_message = Arena::CreateMessage<TestAllTypes>(&arena);
arena_message->set_optional_string("hello");
- std::unique_ptr<string> released_str(
+ google::protobuf::scoped_ptr<string> released_str(
arena_message->release_optional_string());
EXPECT_EQ("hello", *released_str);
@@ -604,6 +601,25 @@ TEST(ArenaTest, ReleaseFromArenaMessageUsingReflectionMakesCopy) {
}
#endif // !GOOGLE_PROTOBUF_NO_RTTI
+TEST(ArenaTest, UnsafeArenaReleaseDoesNotMakeCopy) {
+ Arena arena;
+ TestAllTypes* arena_message = Arena::CreateMessage<TestAllTypes>(&arena);
+ TestAllTypes::NestedMessage* nested_msg = NULL;
+ TestAllTypes::NestedMessage* orig_nested_msg = NULL;
+ string* nested_string = NULL;
+ string* orig_nested_string = NULL;
+ arena_message->mutable_optional_nested_message()->set_bb(42);
+ *arena_message->mutable_optional_string() = "Hello";
+ orig_nested_msg = arena_message->mutable_optional_nested_message();
+ orig_nested_string = arena_message->mutable_optional_string();
+ nested_msg = arena_message->unsafe_arena_release_optional_nested_message();
+ nested_string = arena_message->unsafe_arena_release_optional_string();
+
+ EXPECT_EQ(orig_nested_msg, nested_msg);
+ EXPECT_EQ(orig_nested_string, nested_string);
+ // Released pointers still on arena; no 'delete' calls needed here.
+}
+
TEST(ArenaTest, SetAllocatedAcrossArenas) {
Arena arena1;
TestAllTypes* arena1_message = Arena::CreateMessage<TestAllTypes>(&arena1);
@@ -883,18 +899,17 @@ TEST(ArenaTest, ReleaseLastRepeatedField) {
TEST(ArenaTest, UnsafeArenaReleaseAdd) {
// Use unsafe_arena_release() and unsafe_arena_set_allocated() to transfer an
// arena-allocated string from one message to another.
- const char kContent[] = "Test content";
-
Arena arena;
TestAllTypes* message1 = Arena::CreateMessage<TestAllTypes>(&arena);
TestAllTypes* message2 = Arena::CreateMessage<TestAllTypes>(&arena);
string* arena_string = Arena::Create<string>(&arena);
- *arena_string = kContent;
+ *arena_string = "Test content";
message1->unsafe_arena_set_allocated_optional_string(arena_string);
+ EXPECT_EQ(arena_string, message1->mutable_optional_string());
message2->unsafe_arena_set_allocated_optional_string(
message1->unsafe_arena_release_optional_string());
- EXPECT_EQ(kContent, message2->optional_string());
+ EXPECT_EQ(arena_string, message2->mutable_optional_string());
}
TEST(ArenaTest, UnsafeArenaAddAllocated) {
@@ -1284,12 +1299,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, 160);
+ ::google::protobuf::Arena::CreateArray<char>(&arena_3, 190);
EXPECT_EQ(256, arena_3.SpaceAllocated());
- EXPECT_EQ(Align8(160), arena_3.SpaceUsed());
+ EXPECT_EQ(Align8(190), arena_3.SpaceUsed());
::google::protobuf::Arena::CreateArray<char>(&arena_3, 70);
EXPECT_EQ(256 + 512, arena_3.SpaceAllocated());
- EXPECT_EQ(Align8(160) + Align8(70), arena_3.SpaceUsed());
+ EXPECT_EQ(Align8(190) + Align8(70), arena_3.SpaceUsed());
EXPECT_EQ(256 + 512, arena_3.Reset());
}
@@ -1332,13 +1347,6 @@ 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);
@@ -1397,20 +1405,13 @@ 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;
- ArenaOptionsTestFriend::Set(&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;
// Scope for defining the arena
{
@@ -1418,7 +1419,7 @@ TEST(ArenaTest, ArenaHooksSanity) {
EXPECT_EQ(1, ArenaHooksTestUtil::num_init);
EXPECT_EQ(0, ArenaHooksTestUtil::num_allocations);
::google::protobuf::Arena::Create<uint64>(&arena);
- if (std::is_trivially_destructible<uint64>::value) {
+ if (google::protobuf::internal::has_trivial_destructor<uint64>::value) {
EXPECT_EQ(1, ArenaHooksTestUtil::num_allocations);
} else {
EXPECT_EQ(2, ArenaHooksTestUtil::num_allocations);
@@ -1432,5 +1433,6 @@ TEST(ArenaTest, ArenaHooksSanity) {
}
+} // namespace
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arenastring.cc b/third_party/protobuf/3.4.0/src/google/protobuf/arenastring.cc
index 7f33a0c865..7f33a0c865 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arenastring.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arenastring.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arenastring.h b/third_party/protobuf/3.4.0/src/google/protobuf/arenastring.h
index 168fc972b8..63fd00e567 100644..100755
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arenastring.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arenastring.h
@@ -33,11 +33,12 @@
#include <string>
-#include <google/protobuf/arena.h>
+#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/fastmem.h>
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/arena.h>
+
+
// This is the implementation of arena string fields written for the open-source
// release. The ArenaStringPtr struct below is an internal implementation class
@@ -51,18 +52,6 @@ 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) {
@@ -73,12 +62,6 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
}
}
- inline void SetLite(const ::std::string* default_value,
- const ::std::string& value,
- ::google::protobuf::Arena* arena) {
- Set(default_value, value, arena);
- }
-
// Basic accessors.
inline const ::std::string& Get() const { return *ptr_; }
@@ -99,18 +82,10 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
if (ptr_ == default_value) {
return NULL;
}
- return ReleaseNonDefault(default_value, arena);
- }
-
- // Similar to Release, but ptr_ cannot be the default_value.
- inline ::std::string* ReleaseNonDefault(
- const ::std::string* default_value, ::google::protobuf::Arena* arena) {
- GOOGLE_DCHECK(!IsDefault(default_value));
::std::string* released = NULL;
if (arena != NULL) {
- // ptr_ is owned by the arena.
- released = new ::std::string;
- released->swap(*ptr_);
+ // ptr_ is owned by the arena -- we need to return a copy.
+ released = new ::std::string(*ptr_);
} else {
released = ptr_;
}
@@ -168,32 +143,9 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
// Swaps internal pointers. Arena-safety semantics: this is guarded by the
// logic in Swap()/UnsafeArenaSwap() at the message level, so this method is
// 'unsafe' if called directly.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Swap(ArenaStringPtr* other) {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE void Swap(ArenaStringPtr* other) {
std::swap(ptr_, other->ptr_);
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Swap(
- ArenaStringPtr* other, const ::std::string* default_value, Arena* arena) {
-#ifndef NDEBUG
- // For debug builds, we swap the contents of the string, rather than the
- // string instances themselves. This invalidates previously taken const
- // references that are (per our documentation) invalidated by calling Swap()
- // on the message.
- //
- // If both strings are the default_value, swapping is uninteresting.
- // Otherwise, we use ArenaStringPtr::Mutable() to access the string, to
- // ensure that we do not try to mutate default_value itself.
- if (IsDefault(default_value) && other->IsDefault(default_value)) {
- return;
- }
-
- ::std::string* this_ptr = Mutable(default_value, arena);
- ::std::string* other_ptr = other->Mutable(default_value, arena);
-
- this_ptr->swap(*other_ptr);
-#else
- std::swap(ptr_, other->ptr_);
-#endif
- }
// Frees storage (if not on an arena).
inline void Destroy(const ::std::string* default_value,
@@ -216,15 +168,6 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
}
}
- // Clears content, assuming that the current value is not the empty string
- // default.
- inline void ClearNonDefaultToEmpty() {
- ptr_->clear();
- }
- inline void ClearNonDefaultToEmptyNoArena() {
- ptr_->clear();
- }
-
// Clears content, but keeps allocated string if arena != NULL, to avoid the
// overhead of heap operations. After this returns, the content (as seen by
// the user) will always be equal to |default_value|.
@@ -292,19 +235,12 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
if (ptr_ == default_value) {
return NULL;
} else {
- return ReleaseNonDefaultNoArena(default_value);
+ ::std::string* released = ptr_;
+ ptr_ = const_cast< ::std::string* >(default_value);
+ return released;
}
}
- inline ::std::string* ReleaseNonDefaultNoArena(
- const ::std::string* default_value) {
- GOOGLE_DCHECK(!IsDefault(default_value));
- ::std::string* released = ptr_;
- ptr_ = const_cast< ::std::string* >(default_value);
- return released;
- }
-
-
inline void SetAllocatedNoArena(const ::std::string* default_value,
::std::string* value) {
if (ptr_ != default_value) {
@@ -352,27 +288,18 @@ 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_;
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
- void CreateInstance(::google::protobuf::Arena* arena,
- const ::std::string* initial_value) {
+ GOOGLE_ATTRIBUTE_NOINLINE void CreateInstance(::google::protobuf::Arena* arena,
+ const ::std::string* initial_value) {
GOOGLE_DCHECK(initial_value != NULL);
- // uses "new ::std::string" when arena is nullptr
- ptr_ = Arena::Create< ::std::string >(arena, *initial_value);
+ ptr_ = new ::std::string(*initial_value);
+ if (arena != NULL) {
+ arena->Own(ptr_);
+ }
}
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
- void CreateInstanceNoArena(const ::std::string* initial_value) {
+ GOOGLE_ATTRIBUTE_NOINLINE void CreateInstanceNoArena(const ::std::string* initial_value) {
GOOGLE_DCHECK(initial_value != NULL);
ptr_ = new ::std::string(*initial_value);
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arenastring_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/arenastring_unittest.cc
index adc44fe25c..c330b9031f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arenastring_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/arenastring_unittest.cc
@@ -35,6 +35,9 @@
#include <algorithm>
#include <cstdlib>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
@@ -46,6 +49,7 @@
namespace google {
+using google::protobuf::internal::ArenaString;
using google::protobuf::internal::ArenaStringPtr;
namespace protobuf {
@@ -106,33 +110,6 @@ TEST(ArenaStringPtrTest, ArenaStringPtrOnArena) {
field2.Destroy(&default_value, &arena);
}
-TEST(ArenaStringPtrTest, ArenaStringPtrOnArenaNoSSO) {
- google::protobuf::Arena arena;
- ArenaStringPtr field;
- ::std::string default_value = "default";
- field.UnsafeSetDefault(&default_value);
- EXPECT_EQ(string("default"), field.Get());
-
- // Avoid triggering the SSO optimization by setting the string to something
- // larger than the internal buffer.
- field.Set(&default_value, WrapString("Test long long long long value"),
- &arena);
- EXPECT_EQ(string("Test long long long long value"), field.Get());
- field.Set(&default_value, string(""), &arena);
- field.Destroy(&default_value, &arena);
-
- ArenaStringPtr field2;
- field2.UnsafeSetDefault(&default_value);
- ::std::string* mut = field2.Mutable(&default_value, &arena);
- EXPECT_EQ(mut, field2.Mutable(&default_value, &arena));
- EXPECT_EQ(mut, &field2.Get());
- EXPECT_NE(&default_value, mut);
- EXPECT_EQ(string("default"), *mut);
- *mut = "Test long long long long value"; // ensure string allocates storage
- EXPECT_EQ(string("Test long long long long value"), field2.Get());
- field2.Destroy(&default_value, &arena);
-}
-
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/code_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/code_generator.cc
index aaabd9142d..11d0f33432 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/code_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/code_generator.cc
@@ -34,9 +34,9 @@
#include <google/protobuf/compiler/code_generator.h>
+#include <google/protobuf/compiler/plugin.pb.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/compiler/plugin.pb.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/stubs/strutil.h>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/code_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/code_generator.h
index 4c2b3ee143..dd6a59d880 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/code_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/code_generator.h
@@ -51,7 +51,6 @@ class FileDescriptor;
namespace compiler {
class AccessInfoMap;
-
class Version;
// Defined in this file.
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface.cc
index 8380367fa8..5f8640419f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface.cc
@@ -58,6 +58,9 @@
#include <limits.h> //For PATH_MAX
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#ifdef __APPLE__
#include <mach-o/dyld.h>
@@ -66,6 +69,9 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/stringprintf.h>
+#include <google/protobuf/compiler/importer.h>
+#include <google/protobuf/compiler/code_generator.h>
+#include <google/protobuf/compiler/plugin.pb.h>
#include <google/protobuf/compiler/subprocess.h>
#include <google/protobuf/compiler/zip_writer.h>
#include <google/protobuf/compiler/plugin.pb.h>
@@ -77,11 +83,16 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/text_format.h>
+#include <google/protobuf/dynamic_message.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/stubs/io_win32.h>
+#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>
-#include <google/protobuf/stubs/io_win32.h>
namespace google {
@@ -97,7 +108,7 @@ namespace compiler {
#endif
namespace {
-#if defined(_WIN32)
+#if defined(_MSC_VER)
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
using google::protobuf::internal::win32::access;
@@ -168,7 +179,8 @@ bool VerifyDirectoryExists(const string& path) {
// directories listed in |filename|.
bool TryCreateParentDirectory(const string& prefix, const string& filename) {
// Recursively create parent directories to the output file.
- std::vector<string> parts = Split(filename, "/", true);
+ std::vector<string> parts =
+ Split(filename, "/", true);
string path_so_far = prefix;
for (int i = 0; i < parts.size() - 1; i++) {
path_so_far += parts[i];
@@ -220,9 +232,9 @@ bool IsInstalledProtoPath(const string& path) {
return access(file_path.c_str(), F_OK) != -1;
}
-// Add the paths where google/protobuf/descriptor.proto and other well-known
+// Add the paths where google/protobuf/descritor.proto and other well-known
// type protos are installed.
-void AddDefaultProtoPaths(std::vector<std::pair<string, string> >* paths) {
+void AddDefaultProtoPaths(vector<pair<string, string> >* paths) {
// TODO(xiaofeng): The code currently only checks relative paths of where
// the protoc binary is installed. We probably should make it handle more
// cases than that.
@@ -238,12 +250,12 @@ void AddDefaultProtoPaths(std::vector<std::pair<string, string> >* paths) {
path = path.substr(0, pos);
// Check the binary's directory.
if (IsInstalledProtoPath(path)) {
- paths->push_back(std::pair<string, string>("", path));
+ paths->push_back(pair<string, string>("", path));
return;
}
// Check if there is an include subdirectory.
if (IsInstalledProtoPath(path + "/include")) {
- paths->push_back(std::pair<string, string>("", path + "/include"));
+ paths->push_back(pair<string, string>("", path + "/include"));
return;
}
// Check if the upper level directory has an "include" subdirectory.
@@ -253,7 +265,7 @@ void AddDefaultProtoPaths(std::vector<std::pair<string, string> >* paths) {
}
path = path.substr(0, pos);
if (IsInstalledProtoPath(path + "/include")) {
- paths->push_back(std::pair<string, string>("", path + "/include"));
+ paths->push_back(pair<string, string>("", path + "/include"));
return;
}
}
@@ -436,7 +448,7 @@ class CommandLineInterface::MemoryOutputStream
bool append_mode_;
// StringOutputStream writing to data_.
- std::unique_ptr<io::StringOutputStream> inner_;
+ google::protobuf::scoped_ptr<io::StringOutputStream> inner_;
};
// -------------------------------------------------------------------
@@ -831,10 +843,10 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
std::vector<const FileDescriptor*> parsed_files;
// null unless descriptor_set_in_names_.empty()
- std::unique_ptr<DiskSourceTree> disk_source_tree;
- std::unique_ptr<ErrorPrinter> error_collector;
- std::unique_ptr<DescriptorPool> descriptor_pool;
- std::unique_ptr<DescriptorDatabase> descriptor_database;
+ google::protobuf::scoped_ptr<DiskSourceTree> disk_source_tree;
+ google::protobuf::scoped_ptr<ErrorPrinter> error_collector;
+ google::protobuf::scoped_ptr<DescriptorPool> descriptor_pool;
+ google::protobuf::scoped_ptr<DescriptorDatabase> descriptor_database;
if (descriptor_set_in_names_.empty()) {
disk_source_tree.reset(new DiskSourceTree());
if (!InitializeDiskSourceTree(disk_source_tree.get())) {
@@ -864,7 +876,6 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
return 1;
}
-
// We construct a separate GeneratorContext for each output location. Note
// that two code generators may output to the same location, in which case
// they should share a single GeneratorContext so that OpenForInsert() works.
@@ -1008,8 +1019,7 @@ bool CommandLineInterface::PopulateSimpleDescriptorDatabase(
bool parsed = file_descriptor_set.ParseFromFileDescriptor(fd);
if (close(fd) != 0) {
std::cerr << descriptor_set_in_names_[i] << ": close: "
- << strerror(errno)
- << std::endl;
+ << strerror(errno);
return false;
}
@@ -1162,21 +1172,6 @@ bool CommandLineInterface::MakeInputsBeProtoPathRelative(
return true;
}
-bool CommandLineInterface::ExpandArgumentFile(const string& file,
- std::vector<string>* arguments) {
- // The argument file is searched in the working directory only. We don't
- // use the proto import path here.
- std::ifstream file_stream(file.c_str());
- if (!file_stream.is_open()) {
- return false;
- }
- string argument;
- // We don't support any kind of shell expansion right now.
- while (std::getline(file_stream, argument)) {
- arguments->push_back(argument);
- }
- return true;
-}
CommandLineInterface::ParseArgumentStatus
CommandLineInterface::ParseArguments(int argc, const char* const argv[]) {
@@ -1184,19 +1179,11 @@ CommandLineInterface::ParseArguments(int argc, const char* const argv[]) {
std::vector<string> arguments;
for (int i = 1; i < argc; ++i) {
- if (argv[i][0] == '@') {
- if (!ExpandArgumentFile(argv[i] + 1, &arguments)) {
- std::cerr << "Failed to open argument file: " << (argv[i] + 1)
- << std::endl;
- return PARSE_ARGUMENT_FAIL;
- }
- continue;
- }
arguments.push_back(argv[i]);
}
// if no arguments are given, show help
- if (arguments.empty()) {
+ if(arguments.empty()) {
PrintHelpText();
return PARSE_ARGUMENT_DONE_AND_EXIT; // Exit without running compiler.
}
@@ -1391,7 +1378,8 @@ CommandLineInterface::InterpretArgument(const string& name,
// with colons. Let's accept that syntax too just to make things more
// intuitive.
std::vector<string> parts = Split(
- value, CommandLineInterface::kPathSeparator,
+ value,
+ CommandLineInterface::kPathSeparator,
true);
for (int i = 0; i < parts.size(); i++) {
@@ -1416,7 +1404,7 @@ CommandLineInterface::InterpretArgument(const string& name,
// Make sure disk path exists, warn otherwise.
if (access(disk_path.c_str(), F_OK) < 0) {
- // Try the original path; it may have just happened to have a '=' in it.
+ // Try the original path; it may have just happed to have a '=' in it.
if (access(parts[i].c_str(), F_OK) < 0) {
std::cerr << disk_path << ": warning: directory does not exist."
<< std::endl;
@@ -1442,7 +1430,8 @@ CommandLineInterface::InterpretArgument(const string& name,
}
direct_dependencies_explicitly_set_ = true;
- std::vector<string> direct = Split(value, ":", true);
+ std::vector<string> direct = Split(
+ value, ":", true);
GOOGLE_DCHECK(direct_dependencies_.empty());
direct_dependencies_.insert(direct.begin(), direct.end());
@@ -1475,8 +1464,9 @@ CommandLineInterface::InterpretArgument(const string& name,
}
descriptor_set_in_names_ = Split(
- value, CommandLineInterface::kPathSeparator,
- true);
+ value,
+ CommandLineInterface::kPathSeparator,
+ true);
} else if (name == "-o" || name == "--descriptor_set_out") {
if (!descriptor_set_out_name_.empty()) {
@@ -1622,6 +1612,7 @@ CommandLineInterface::InterpretArgument(const string& name,
}
mode_ = MODE_PRINT;
print_mode_ = PRINT_FREE_FIELDS;
+ } else if (name == "--profile_path") {
} else {
// Some other flag. Look it up in the generators list.
const GeneratorInfo* generator_info =
@@ -1758,20 +1749,6 @@ void CommandLineInterface::PrintHelpText() {
<< string(19 - iter->first.size(), ' ') // Spaces for alignment.
<< iter->second.help_text << std::endl;
}
- std::cerr <<
-" @<filename> Read options and filenames from file. If a\n"
-" relative file path is specified, the file\n"
-" will be searched in the working directory.\n"
-" The --proto_path option will not affect how\n"
-" this argument file is searched. Content of\n"
-" the file will be expanded in the position of\n"
-" @<filename> as in the argument list. Note\n"
-" that shell expansion is not applied to the\n"
-" content of the file (i.e., you cannot use\n"
-" quotes, wildcards, escapes, commands, etc.).\n"
-" Each line corresponds to a single argument,\n"
-" even if it contains spaces."
- << std::endl;
}
bool CommandLineInterface::GenerateOutput(
@@ -1900,12 +1877,10 @@ bool CommandLineInterface::GeneratePluginOutput(
string* error) {
CodeGeneratorRequest request;
CodeGeneratorResponse response;
- string processed_parameter = parameter;
-
// Build the request.
- if (!processed_parameter.empty()) {
- request.set_parameter(processed_parameter);
+ if (!parameter.empty()) {
+ request.set_parameter(parameter);
}
@@ -1942,18 +1917,17 @@ bool CommandLineInterface::GeneratePluginOutput(
// Write the files. We do this even if there was a generator error in order
// to match the behavior of a compiled-in generator.
- std::unique_ptr<io::ZeroCopyOutputStream> current_output;
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> current_output;
for (int i = 0; i < response.file_size(); i++) {
const CodeGeneratorResponse::File& output_file = response.file(i);
if (!output_file.insertion_point().empty()) {
- string filename = output_file.name();
// Open a file for insert.
// We reset current_output to NULL first so that the old file is closed
// before the new one is opened.
current_output.reset();
current_output.reset(generator_context->OpenForInsert(
- filename, output_file.insertion_point()));
+ output_file.name(), output_file.insertion_point()));
} else if (!output_file.name().empty()) {
// Starting a new file. Open it.
// We reset current_output to NULL first so that the old file is closed
@@ -1992,7 +1966,7 @@ bool CommandLineInterface::EncodeOrDecode(const DescriptorPool* pool) {
}
DynamicMessageFactory dynamic_factory(pool);
- std::unique_ptr<Message> message(dynamic_factory.GetPrototype(type)->New());
+ google::protobuf::scoped_ptr<Message> message(dynamic_factory.GetPrototype(type)->New());
if (mode_ == MODE_ENCODE) {
SetFdToTextMode(STDIN_FILENO);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface.h
index 7d3037a9f7..e65965754e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface.h
@@ -227,9 +227,6 @@ class LIBPROTOC_EXPORT CommandLineInterface {
// Parse all command-line arguments.
ParseArgumentStatus ParseArguments(int argc, const char* const argv[]);
- // Read an argument file and append the file's content to the list of
- // arguments. Return false if the file cannot be read.
- bool ExpandArgumentFile(const string& file, std::vector<string>* arguments);
// Parses a command-line argument into a name/value pair. Returns
// true if the next argument in the argv should be used as the value,
@@ -413,6 +410,11 @@ class LIBPROTOC_EXPORT CommandLineInterface {
// dependency file will be written. Otherwise, empty.
string dependency_out_name_;
+ // Path to a file that contains serialized AccessInfo which provides
+ // relative hotness of fields per message. This helps protoc to generate
+ // better code.
+ string profile_path_;
+
// True if --include_imports was given, meaning that we should
// write all transitive dependencies to the DescriptorSet. Otherwise, only
// the .proto files listed on the command-line are added.
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface_unittest.cc
index 41eb244a2d..73d3e4c9a6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -35,11 +35,13 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
-
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/stubs/stringprintf.h>
@@ -67,7 +69,7 @@ namespace google {
namespace protobuf {
namespace compiler {
-#if defined(_WIN32)
+#if defined(_MSC_VER)
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
using google::protobuf::internal::win32::access;
@@ -82,7 +84,6 @@ using google::protobuf::internal::win32::write;
// which case tcmalloc will print warnings that fail the plugin tests.
#if !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN
-
namespace {
bool FileExists(const string& path) {
@@ -341,7 +342,7 @@ void CommandLineInterfaceTest::RunWithArgs(std::vector<string> args) {
}
}
- std::unique_ptr<const char * []> argv(new const char* [args.size()]);
+ google::protobuf::scoped_array<const char * > argv(new const char* [args.size()]);
for (int i = 0; i < args.size(); i++) {
args[i] = StringReplace(args[i], "$tmpdir", temp_directory_, true);
@@ -1558,36 +1559,6 @@ TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFileForAbsolutePath) {
}
#endif // !_WIN32
-TEST_F(CommandLineInterfaceTest, TestArgumentFile) {
- // Test parsing multiple input files using an argument file.
-
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n"
- "message Foo {}\n");
- CreateTempFile("bar.proto",
- "syntax = \"proto2\";\n"
- "message Bar {}\n");
- CreateTempFile("arguments.txt",
- "--test_out=$tmpdir\n"
- "--plug_out=$tmpdir\n"
- "--proto_path=$tmpdir\n"
- "--direct_dependencies_violation_msg=%s is not imported\n"
- "foo.proto\n"
- "bar.proto");
-
- Run("protocol_compiler @$tmpdir/arguments.txt");
-
- ExpectNoErrors();
- ExpectGeneratedWithMultipleInputs("test_generator", "foo.proto,bar.proto",
- "foo.proto", "Foo");
- ExpectGeneratedWithMultipleInputs("test_generator", "foo.proto,bar.proto",
- "bar.proto", "Bar");
- ExpectGeneratedWithMultipleInputs("test_plugin", "foo.proto,bar.proto",
- "foo.proto", "Foo");
- ExpectGeneratedWithMultipleInputs("test_plugin", "foo.proto,bar.proto",
- "bar.proto", "Bar");
-}
-
// -------------------------------------------------------------------
@@ -2295,7 +2266,7 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
ADD_FAILURE() << "unexpected EncodeDecodeTestMode: " << GetParam();
}
- std::unique_ptr<const char * []> argv(new const char* [args.size()]);
+ google::protobuf::scoped_array<const char * > argv(new const char* [args.size()]);
for (int i = 0; i < args.size(); i++) {
argv[i] = args[i].c_str();
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
index 4e150fe3d6..f99159f5e9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
@@ -44,7 +44,6 @@
#include <map>
-#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/compiler/cpp/cpp_generator.h>
#include <google/protobuf/compiler/importer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
@@ -98,10 +97,9 @@ class MockGeneratorContext : public GeneratorContext {
File::GetContents(TestSourceDir() + "/" + physical_filename,
&actual_contents, true));
EXPECT_TRUE(actual_contents == *expected_contents)
- << physical_filename
- << " needs to be regenerated. Please run "
- "generate_descriptor_proto.sh. "
- "Then add this file to your CL.";
+ << physical_filename << " needs to be regenerated. Please run "
+ "generate_descriptor_proto.sh. Then add this file "
+ "to your CL.";
}
// implements GeneratorContext --------------------------------------
@@ -118,50 +116,37 @@ class MockGeneratorContext : public GeneratorContext {
std::map<string, string*> files_;
};
-const char kDescriptorParameter[] = "dllexport_decl=LIBPROTOBUF_EXPORT";
-const char kPluginParameter[] = "dllexport_decl=LIBPROTOC_EXPORT";
-const char kNormalParameter[] = "";
-
-const char* test_protos[][2] = {
- {"google/protobuf/descriptor", kDescriptorParameter},
- {"google/protobuf/compiler/plugin", kPluginParameter},
-};
-
-TEST(BootstrapTest, GeneratedFilesMatch) {
- // We need a mapping from the actual file to virtual and actual path
- // of the data to compare to.
- std::map<string, string> vpath_map;
- std::map<string, string> rpath_map;
- rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto2"] =
- "net/proto2/z_generated_example/test_messages_proto2";
- rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto3"] =
- "net/proto2/z_generated_example/test_messages_proto3";
- rpath_map["google/protobuf/proto2_weak"] =
- "net/proto2/z_generated_example/proto2_weak";
-
+TEST(BootstrapTest, GeneratedDescriptorMatches) {
+ MockErrorCollector error_collector;
DiskSourceTree source_tree;
source_tree.MapPath("", TestSourceDir());
-
- for (auto file_parameter : test_protos) {
- MockErrorCollector error_collector;
- Importer importer(&source_tree, &error_collector);
- const FileDescriptor* file =
- importer.Import(file_parameter[0] + string(".proto"));
- ASSERT_TRUE(file != nullptr)
- << "Can't import file " << file_parameter[0] + string(".proto") << "\n";
- EXPECT_EQ("", error_collector.text_);
- CppGenerator generator;
- MockGeneratorContext context;
- string error;
- ASSERT_TRUE(generator.Generate(file, file_parameter[1], &context, &error));
-
- string vpath =
- FindWithDefault(vpath_map, file_parameter[0], file_parameter[0]);
- string rpath =
- FindWithDefault(rpath_map, file_parameter[0], file_parameter[0]);
- context.ExpectFileMatches(vpath + ".pb.cc", rpath + ".pb.cc");
- context.ExpectFileMatches(vpath + ".pb.h", rpath + ".pb.h");
- }
+ Importer importer(&source_tree, &error_collector);
+ const FileDescriptor* proto_file =
+ importer.Import("google/protobuf/descriptor.proto");
+ const FileDescriptor* plugin_proto_file =
+ importer.Import("google/protobuf/compiler/plugin.proto");
+ EXPECT_EQ("", error_collector.text_);
+ ASSERT_TRUE(proto_file != NULL);
+ ASSERT_TRUE(plugin_proto_file != NULL);
+
+ CppGenerator generator;
+ MockGeneratorContext context;
+ string error;
+ string parameter = "dllexport_decl=LIBPROTOBUF_EXPORT";
+ ASSERT_TRUE(generator.Generate(proto_file, parameter,
+ &context, &error));
+ parameter = "dllexport_decl=LIBPROTOC_EXPORT";
+ ASSERT_TRUE(generator.Generate(plugin_proto_file, parameter,
+ &context, &error));
+
+ context.ExpectFileMatches("google/protobuf/descriptor.pb.h",
+ "google/protobuf/descriptor.pb.h");
+ context.ExpectFileMatches("google/protobuf/descriptor.pb.cc",
+ "google/protobuf/descriptor.pb.cc");
+ context.ExpectFileMatches("google/protobuf/compiler/plugin.pb.h",
+ "google/protobuf/compiler/plugin.pb.h");
+ context.ExpectFileMatches("google/protobuf/compiler/plugin.pb.cc",
+ "google/protobuf/compiler/plugin.pb.cc");
}
} // namespace
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum.cc
index 0d6a9e2443..3b4b97e654 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum.cc
@@ -179,7 +179,7 @@ void EnumGenerator::GenerateDefinition(io::Printer* printer) {
void EnumGenerator::
GenerateGetEnumDescriptorSpecializations(io::Printer* printer) {
printer->Print(
- "template <> struct is_proto_enum< $classname$> : ::std::true_type "
+ "template <> struct is_proto_enum< $classname$> : ::google::protobuf::internal::true_type "
"{};\n",
"classname", ClassName(descriptor_, true));
if (HasDescriptorMethods(descriptor_->file(), options_)) {
@@ -197,8 +197,6 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* printer) {
vars["nested_name"] = descriptor_->name();
vars["classname"] = classname_;
vars["constexpr"] = options_.proto_h ? "constexpr " : "";
- vars["{"] = "";
- vars["}"] = "";
printer->Print(vars, "typedef $classname$ $nested_name$;\n");
for (int j = 0; j < descriptor_->value_count(); j++) {
@@ -206,27 +204,22 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* printer) {
vars["deprecated_attr"] = descriptor_->value(j)->options().deprecated() ?
"GOOGLE_PROTOBUF_DEPRECATED_ATTR " : "";
printer->Print(vars,
- "$deprecated_attr$static $constexpr$const $nested_name$ ${$$tag$$}$ =\n"
+ "$deprecated_attr$static $constexpr$const $nested_name$ $tag$ =\n"
" $classname$_$tag$;\n");
- printer->Annotate("{", "}", descriptor_->value(j));
}
printer->Print(vars,
"static inline bool $nested_name$_IsValid(int value) {\n"
" return $classname$_IsValid(value);\n"
"}\n"
- "static const $nested_name$ ${$$nested_name$_MIN$}$ =\n"
- " $classname$_$nested_name$_MIN;\n");
- printer->Annotate("{", "}", descriptor_);
- printer->Print(vars,
- "static const $nested_name$ ${$$nested_name$_MAX$}$ =\n"
+ "static const $nested_name$ $nested_name$_MIN =\n"
+ " $classname$_$nested_name$_MIN;\n"
+ "static const $nested_name$ $nested_name$_MAX =\n"
" $classname$_$nested_name$_MAX;\n");
- printer->Annotate("{", "}", descriptor_);
if (generate_array_size_) {
printer->Print(vars,
- "static const int ${$$nested_name$_ARRAYSIZE$}$ =\n"
+ "static const int $nested_name$_ARRAYSIZE =\n"
" $classname$_$nested_name$_ARRAYSIZE;\n");
- printer->Annotate("{", "}", descriptor_);
}
if (HasDescriptorMethods(descriptor_->file(), options_)) {
@@ -249,10 +242,27 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* printer) {
}
}
-void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) {
+void EnumGenerator::GenerateDescriptorInitializer(io::Printer* printer) {
+ std::map<string, string> vars;
+ vars["index"] = SimpleItoa(descriptor_->index());
+ vars["index_in_metadata"] = SimpleItoa(index_in_metadata_);
+
+ if (descriptor_->containing_type() == NULL) {
+ printer->Print(vars,
+ "file_level_enum_descriptors[$index_in_metadata$] = "
+ "file->enum_type($index$);\n");
+ } else {
+ vars["parent"] = ClassName(descriptor_->containing_type(), false);
+ printer->Print(vars,
+ "file_level_enum_descriptors[$index_in_metadata$] = "
+ "$parent$_descriptor->enum_type($index$);\n");
+ }
+}
+
+void EnumGenerator::GenerateMethods(io::Printer* printer) {
std::map<string, string> vars;
vars["classname"] = classname_;
- vars["index_in_metadata"] = SimpleItoa(idx);
+ vars["index_in_metadata"] = SimpleItoa(index_in_metadata_);
vars["constexpr"] = options_.proto_h ? "constexpr " : "";
vars["file_namespace"] = FileLevelNamespace(descriptor_->file()->name());
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum.h
index 0d2488a99b..0b568c57b9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum.h
@@ -86,10 +86,13 @@ class EnumGenerator {
// Source file stuff.
+ // Generate code that initializes the global variable storing the enum's
+ // descriptor.
+ void GenerateDescriptorInitializer(io::Printer* printer);
+
// Generate non-inline methods related to the enum, such as IsValidValue().
- // Goes in the .cc file. EnumDescriptors are stored in an array, idx is
- // the index in this array that corresponds with this enum.
- void GenerateMethods(int idx, io::Printer* printer);
+ // Goes in the .cc file.
+ void GenerateMethods(io::Printer* printer);
private:
const EnumDescriptor* descriptor_;
@@ -98,6 +101,8 @@ class EnumGenerator {
// whether to generate the *_ARRAYSIZE constant.
const bool generate_array_size_;
+ int index_in_metadata_;
+
friend class FileGenerator;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
index 50c7b5f3f1..08a635fa97 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
@@ -82,18 +82,21 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
}
void EnumFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- printer->Print(variables_,
- "inline $type$ $classname$::$name$() const {\n"
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ printer->Print(variables,
+ "$inline$$type$ $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return static_cast< $type$ >($name$_);\n"
"}\n"
- "inline void $classname$::set_$name$($type$ value) {\n");
+ "$inline$void $classname$::set_$name$($type$ value) {\n");
if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) {
- printer->Print(variables_,
+ printer->Print(variables,
" assert($type$_IsValid(value));\n");
}
- printer->Print(variables_,
+ printer->Print(variables,
" $set_hasbit$\n"
" $name$_ = value;\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
@@ -190,33 +193,36 @@ EnumOneofFieldGenerator(const FieldDescriptor* descriptor,
EnumOneofFieldGenerator::~EnumOneofFieldGenerator() {}
void EnumOneofFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- printer->Print(variables_,
- "inline $type$ $classname$::$name$() const {\n"
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ printer->Print(variables,
+ "$inline$$type$ $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" if (has_$name$()) {\n"
- " return static_cast< $type$ >($field_member$);\n"
+ " return static_cast< $type$ >($oneof_prefix$$name$_);\n"
" }\n"
" return static_cast< $type$ >($default$);\n"
"}\n"
- "inline void $classname$::set_$name$($type$ value) {\n");
+ "$inline$void $classname$::set_$name$($type$ value) {\n");
if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) {
- printer->Print(variables_,
+ printer->Print(variables,
" assert($type$_IsValid(value));\n");
}
- printer->Print(variables_,
+ printer->Print(variables,
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" }\n"
- " $field_member$ = value;\n"
+ " $oneof_prefix$$name$_ = value;\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n");
}
void EnumOneofFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
- printer->Print(variables_, "$field_member$ = $default$;\n");
+ printer->Print(variables_, "$oneof_prefix$$name$_ = $default$;\n");
}
void EnumOneofFieldGenerator::
@@ -226,8 +232,9 @@ GenerateSwappingCode(io::Printer* printer) const {
void EnumOneofFieldGenerator::
GenerateConstructorCode(io::Printer* printer) const {
- printer->Print(variables_,
- "$ns$::_$classname$_default_instance_.$name$_ = $default$;\n");
+ printer->Print(
+ variables_,
+ "_$classname$_default_instance_.$name$_ = $default$;\n");
}
// ===================================================================
@@ -274,36 +281,39 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
}
void RepeatedEnumFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- printer->Print(variables_,
- "inline $type$ $classname$::$name$(int index) const {\n"
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ printer->Print(variables,
+ "$inline$$type$ $classname$::$name$(int index) const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return static_cast< $type$ >($name$_.Get(index));\n"
"}\n"
- "inline void $classname$::set_$name$(int index, $type$ value) {\n");
+ "$inline$void $classname$::set_$name$(int index, $type$ value) {\n");
if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) {
- printer->Print(variables_,
+ printer->Print(variables,
" assert($type$_IsValid(value));\n");
}
- printer->Print(variables_,
+ printer->Print(variables,
" $name$_.Set(index, value);\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
- "inline void $classname$::add_$name$($type$ value) {\n");
+ "$inline$void $classname$::add_$name$($type$ value) {\n");
if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) {
- printer->Print(variables_,
+ printer->Print(variables,
" assert($type$_IsValid(value));\n");
}
- printer->Print(variables_,
+ printer->Print(variables,
" $name$_.Add(value);\n"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
"}\n"
- "inline const ::google::protobuf::RepeatedField<int>&\n"
+ "$inline$const ::google::protobuf::RepeatedField<int>&\n"
"$classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_list:$full_name$)\n"
" return $name$_;\n"
"}\n"
- "inline ::google::protobuf::RepeatedField<int>*\n"
+ "$inline$::google::protobuf::RepeatedField<int>*\n"
"$classname$::mutable_$name$() {\n"
" // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
" return &$name$_;\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum_field.h
index d0e87b79c5..3ecd7ba871 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_enum_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_enum_field.h
@@ -52,7 +52,8 @@ class EnumFieldGenerator : public FieldGenerator {
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
@@ -78,7 +79,8 @@ class EnumOneofFieldGenerator : public EnumFieldGenerator {
~EnumOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
@@ -96,7 +98,8 @@ class RepeatedEnumFieldGenerator : public FieldGenerator {
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_extension.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_extension.cc
index c416ba1077..6b1673b259 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_extension.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_extension.cc
@@ -35,8 +35,8 @@
#include <google/protobuf/compiler/cpp/cpp_extension.h>
#include <map>
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/stubs/strutil.h>
@@ -120,6 +120,7 @@ void ExtensionGenerator::GenerateDeclaration(io::Printer* printer) {
" ::google::protobuf::internal::$type_traits$, $field_type$, $packed$ >\n"
" $name$;\n"
);
+
}
void ExtensionGenerator::GenerateDefinition(io::Printer* printer) {
@@ -166,6 +167,46 @@ void ExtensionGenerator::GenerateDefinition(io::Printer* printer) {
" $name$($constant_name$, $default$);\n");
}
+void ExtensionGenerator::GenerateRegistration(io::Printer* printer) {
+ std::map<string, string> vars;
+ vars["extendee" ] = ExtendeeClassName(descriptor_);
+ vars["number" ] = SimpleItoa(descriptor_->number());
+ vars["field_type" ] = SimpleItoa(static_cast<int>(descriptor_->type()));
+ vars["is_repeated"] = descriptor_->is_repeated() ? "true" : "false";
+ vars["is_packed" ] = (descriptor_->is_repeated() &&
+ descriptor_->options().packed())
+ ? "true" : "false";
+
+ switch (descriptor_->cpp_type()) {
+ case FieldDescriptor::CPPTYPE_ENUM:
+ printer->Print(
+ vars,
+ "::google::protobuf::internal::ExtensionSet::RegisterEnumExtension(\n"
+ " $extendee$::internal_default_instance(),\n"
+ " $number$, $field_type$, $is_repeated$, $is_packed$,\n");
+ printer->Print(
+ " &$type$_IsValid);\n",
+ "type", ClassName(descriptor_->enum_type(), true));
+ break;
+ case FieldDescriptor::CPPTYPE_MESSAGE:
+ printer->Print(
+ vars,
+ "::google::protobuf::internal::ExtensionSet::RegisterMessageExtension(\n"
+ " $extendee$::internal_default_instance(),\n"
+ " $number$, $field_type$, $is_repeated$, $is_packed$,\n");
+ printer->Print(" $type$::internal_default_instance());\n", "type",
+ ClassName(descriptor_->message_type(), true));
+ break;
+ default:
+ printer->Print(
+ vars,
+ "::google::protobuf::internal::ExtensionSet::RegisterExtension(\n"
+ " $extendee$::internal_default_instance(),\n"
+ " $number$, $field_type$, $is_repeated$, $is_packed$);\n");
+ break;
+ }
+}
+
} // namespace cpp
} // namespace compiler
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_extension.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_extension.h
index 30236d71ad..1c1caf1f90 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_extension.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_extension.h
@@ -67,6 +67,9 @@ class ExtensionGenerator {
// Source file stuff.
void GenerateDefinition(io::Printer* printer);
+ // Generate code to register the extension.
+ void GenerateRegistration(io::Printer* printer);
+
private:
const FieldDescriptor* descriptor_;
string type_traits_;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_field.cc
index 0de20f84ff..dce9617c59 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_field.cc
@@ -34,18 +34,21 @@
#include <google/protobuf/compiler/cpp/cpp_field.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/compiler/cpp/cpp_primitive_field.h>
#include <google/protobuf/compiler/cpp/cpp_string_field.h>
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/cpp/cpp_enum_field.h>
#include <google/protobuf/compiler/cpp/cpp_map_field.h>
#include <google/protobuf/compiler/cpp/cpp_message_field.h>
#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/strutil.h>
namespace google {
@@ -58,13 +61,17 @@ using internal::WireFormat;
void SetCommonFieldVariables(const FieldDescriptor* descriptor,
std::map<string, string>* variables,
const Options& options) {
- (*variables)["ns"] = Namespace(descriptor);
(*variables)["name"] = FieldName(descriptor);
(*variables)["index"] = SimpleItoa(descriptor->index());
(*variables)["number"] = SimpleItoa(descriptor->number());
(*variables)["classname"] = ClassName(FieldScope(descriptor), false);
(*variables)["declared_type"] = DeclaredTypeMethodName(descriptor->type());
- (*variables)["field_member"] = FieldName(descriptor) + "_";
+
+ // 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)["tag_size"] = SimpleItoa(
WireFormat::TagSize(descriptor->number(), descriptor->type()));
@@ -73,6 +80,8 @@ 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) + "();";
@@ -83,6 +92,10 @@ 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
@@ -94,8 +107,10 @@ 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)["field_member"] = StrCat(prefix, (*variables)["name"], "_");
+ (*variables)["non_null_ptr_to_name"] =
+ StrCat(prefix, (*variables)["name"], "_");
}
FieldGenerator::~FieldGenerator() {}
@@ -113,29 +128,26 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const {
}
FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor,
- const Options& options,
- SCCAnalyzer* scc_analyzer)
+ const Options& options)
: descriptor_(descriptor),
options_(options),
- field_generators_(descriptor->field_count()) {
+ field_generators_(
+ new google::protobuf::scoped_ptr<FieldGenerator>[descriptor->field_count()]) {
// Construct all the FieldGenerators.
for (int i = 0; i < descriptor->field_count(); i++) {
- field_generators_[i].reset(
- MakeGenerator(descriptor->field(i), options, scc_analyzer));
+ field_generators_[i].reset(MakeGenerator(descriptor->field(i), options));
}
}
FieldGenerator* FieldGeneratorMap::MakeGenerator(const FieldDescriptor* field,
- const Options& options,
- SCCAnalyzer* scc_analyzer) {
+ const Options& options) {
if (field->is_repeated()) {
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_MESSAGE:
if (field->is_map()) {
return new MapFieldGenerator(field, options);
} else {
- return new RepeatedMessageFieldGenerator(field, options,
- scc_analyzer);
+ return new RepeatedMessageFieldGenerator(field, options);
}
case FieldDescriptor::CPPTYPE_STRING:
switch (field->options().ctype()) {
@@ -151,7 +163,7 @@ FieldGenerator* FieldGeneratorMap::MakeGenerator(const FieldDescriptor* field,
} else if (field->containing_oneof()) {
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_MESSAGE:
- return new MessageOneofFieldGenerator(field, options, scc_analyzer);
+ return new MessageOneofFieldGenerator(field, options);
case FieldDescriptor::CPPTYPE_STRING:
switch (field->options().ctype()) {
default: // StringOneofFieldGenerator handles unknown ctypes.
@@ -166,7 +178,7 @@ FieldGenerator* FieldGeneratorMap::MakeGenerator(const FieldDescriptor* field,
} else {
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_MESSAGE:
- return new MessageFieldGenerator(field, options, scc_analyzer);
+ return new MessageFieldGenerator(field, options);
case FieldDescriptor::CPPTYPE_STRING:
switch (field->options().ctype()) {
default: // StringFieldGenerator handles unknown ctypes.
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_field.h
index 8cdbe88635..d9dd38505d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_field.h
@@ -37,11 +37,13 @@
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
-#include <google/protobuf/compiler/cpp/cpp_helpers.h>
-#include <google/protobuf/compiler/cpp/cpp_options.h>
#include <google/protobuf/descriptor.h>
+#include <google/protobuf/compiler/cpp/cpp_options.h>
namespace google {
namespace protobuf {
@@ -80,20 +82,46 @@ class FieldGenerator {
// implementation is empty.
virtual void GenerateStaticMembers(io::Printer* /*printer*/) const {}
+ // Generate prototypes for accessors that will manipulate imported
+ // messages inline. These are for .proto.h headers.
+ //
+ // In .proto.h mode, the headers of imports are not #included. However,
+ // functions that manipulate the imported message types need access to
+ // the class definition of the imported message, meaning that the headers
+ // must be #included. To get around this, functions that manipulate
+ // imported message objects are defined as dependent functions in a base
+ // template class. By making them dependent template functions, the
+ // function templates will not be instantiated until they are called, so
+ // we can defer to those translation units to #include the necessary
+ // generated headers.
+ //
+ // See:
+ // http://en.cppreference.com/w/cpp/language/class_template#Implicit_instantiation
+ //
+ // Most field types don't need this, so the default implementation is empty.
+ virtual void GenerateDependentAccessorDeclarations(
+ io::Printer* printer) const {}
+
// Generate prototypes for all of the accessor functions related to this
// field. These are placed inside the class definition.
virtual void GenerateAccessorDeclarations(io::Printer* printer) const = 0;
+ // Generate inline definitions of depenent accessor functions for this field.
+ // These are placed inside the header after all class definitions.
+ virtual void GenerateDependentInlineAccessorDefinitions(
+ io::Printer* printer) const {}
+
// Generate inline definitions of accessor functions for this field.
// These are placed inside the header after all class definitions.
+ // In non-.proto.h mode, this generates dependent accessor functions as well.
virtual void GenerateInlineAccessorDefinitions(
- io::Printer* printer) const = 0;
+ io::Printer* printer, bool is_inline) const = 0;
// Generate definitions of accessors that aren't inlined. These are
// placed somewhere in the .cc file.
// Most field types don't need this, so the default implementation is empty.
virtual void GenerateNonInlineAccessorDefinitions(
- io::Printer* /*printer*/) const {}
+ io::Printer* /*printer*/) const {}
// Generate lines of code (statements, not declarations) which clear the
// field. This is used to define the clear_$name$() method
@@ -156,10 +184,6 @@ 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)
@@ -179,11 +203,6 @@ class FieldGenerator {
// are placed in the message's ByteSize() method.
virtual void GenerateByteSize(io::Printer* printer) const = 0;
- // Any tags about field layout decisions (such as inlining) to embed in the
- // offset.
- virtual uint32 CalculateFieldTag() const { return 0; }
- virtual bool IsInlined() const { return false; }
-
protected:
const Options& options_;
@@ -194,8 +213,7 @@ class FieldGenerator {
// Convenience class which constructs FieldGenerators for a Descriptor.
class FieldGeneratorMap {
public:
- FieldGeneratorMap(const Descriptor* descriptor, const Options& options,
- SCCAnalyzer* scc_analyzer);
+ FieldGeneratorMap(const Descriptor* descriptor, const Options& options);
~FieldGeneratorMap();
const FieldGenerator& get(const FieldDescriptor* field) const;
@@ -203,11 +221,10 @@ class FieldGeneratorMap {
private:
const Descriptor* descriptor_;
const Options& options_;
- std::vector<std::unique_ptr<FieldGenerator>> field_generators_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<FieldGenerator> > field_generators_;
static FieldGenerator* MakeGenerator(const FieldDescriptor* field,
- const Options& options,
- SCCAnalyzer* scc_analyzer);
+ const Options& options);
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_file.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_file.cc
index 42525687d5..a066a6a7c7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -35,41 +35,90 @@
#include <google/protobuf/compiler/cpp/cpp_file.h>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <set>
#include <vector>
#include <google/protobuf/compiler/cpp/cpp_enum.h>
+#include <google/protobuf/compiler/cpp/cpp_service.h>
#include <google/protobuf/compiler/cpp/cpp_extension.h>
-#include <google/protobuf/compiler/cpp/cpp_field.h>
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/compiler/cpp/cpp_message.h>
-#include <google/protobuf/compiler/cpp/cpp_service.h>
-#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/compiler/cpp/cpp_field.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/stubs/strutil.h>
namespace google {
namespace protobuf {
namespace compiler {
namespace cpp {
+namespace {
+// The list of names that are defined as macros on some platforms. We need to
+// #undef them for the generated code to compile.
+const char* kMacroNames[] = {"major", "minor"};
+
+bool IsMacroName(const string& name) {
+ // Just do a linear search as the number of elements is very small.
+ for (int i = 0; i < GOOGLE_ARRAYSIZE(kMacroNames); ++i) {
+ if (name == kMacroNames[i]) return true;
+ }
+ return false;
+}
+
+void CollectMacroNames(const Descriptor* message, std::vector<string>* names) {
+ for (int i = 0; i < message->field_count(); ++i) {
+ const FieldDescriptor* field = message->field(i);
+ if (IsMacroName(field->name())) {
+ names->push_back(field->name());
+ }
+ }
+ for (int i = 0; i < message->nested_type_count(); ++i) {
+ CollectMacroNames(message->nested_type(i), names);
+ }
+}
+
+void CollectMacroNames(const FileDescriptor* file, std::vector<string>* names) {
+ // Only do this for protobuf's own types. There are some google3 protos using
+ // macros as field names and the generated code compiles after the macro
+ // expansion. Undefing these macros actually breaks such code.
+ if (file->name() != "google/protobuf/compiler/plugin.proto") {
+ return;
+ }
+ for (int i = 0; i < file->message_type_count(); ++i) {
+ CollectMacroNames(file->message_type(i), names);
+ }
+}
+
+
+} // namespace
+
+// ===================================================================
FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options)
: file_(file),
options_(options),
scc_analyzer_(options),
+ message_generators_owner_(
+ new google::protobuf::scoped_ptr<MessageGenerator>[file->message_type_count()]),
enum_generators_owner_(
- new std::unique_ptr<EnumGenerator>[file->enum_type_count()]),
+ new google::protobuf::scoped_ptr<EnumGenerator>[file->enum_type_count()]),
service_generators_owner_(
- new std::unique_ptr<ServiceGenerator>[file->service_count()]),
+ new google::protobuf::scoped_ptr<ServiceGenerator>[file->service_count()]),
extension_generators_owner_(
- new std::unique_ptr<ExtensionGenerator>[file->extension_count()]) {
- std::vector<const Descriptor*> msgs = FlattenMessagesInFile(file);
- for (int i = 0; i < msgs.size(); i++) {
- // Deleted in destructor
- MessageGenerator* msg_gen =
- new MessageGenerator(msgs[i], i, options, &scc_analyzer_);
- message_generators_.push_back(msg_gen);
- msg_gen->AddGenerators(&enum_generators_, &extension_generators_);
+ new google::protobuf::scoped_ptr<ExtensionGenerator>[file->extension_count()]) {
+
+ for (int i = 0; i < file->message_type_count(); i++) {
+ message_generators_owner_[i].reset(
+ new MessageGenerator(file->message_type(i), options, &scc_analyzer_));
+ message_generators_owner_[i]->Flatten(&message_generators_);
+ }
+
+ for (int i = 0; i < message_generators_.size(); i++) {
+ message_generators_[i]->AddGenerators(&enum_generators_,
+ &extension_generators_);
}
for (int i = 0; i < file->enum_type_count(); i++) {
@@ -77,6 +126,9 @@ FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options)
new EnumGenerator(file->enum_type(i), options));
enum_generators_.push_back(enum_generators_owner_[i].get());
}
+ for (int i = 0; i < enum_generators_.size(); i++) {
+ enum_generators_[i]->index_in_metadata_ = i;
+ }
for (int i = 0; i < file->service_count(); i++) {
service_generators_owner_[i].reset(
@@ -95,36 +147,14 @@ FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options)
extension_generators_.push_back(extension_generators_owner_[i].get());
}
-
package_parts_ = Split(file_->package(), ".", true);
}
-FileGenerator::~FileGenerator() {
- for (int i = 0; i < message_generators_.size(); i++) {
- delete message_generators_[i];
- }
-}
+FileGenerator::~FileGenerator() {}
void FileGenerator::GenerateMacroUndefs(io::Printer* printer) {
- // Only do this for protobuf's own types. There are some google3 protos using
- // macros as field names and the generated code compiles after the macro
- // expansion. Undefing these macros actually breaks such code.
- if (file_->name() != "google/protobuf/compiler/plugin.proto") {
- return;
- }
std::vector<string> names_to_undef;
- std::vector<const FieldDescriptor*> fields;
- ListAllFields(file_, &fields);
- for (int i = 0; i < fields.size(); i++) {
- const string& name = fields[i]->name();
- static const char* kMacroNames[] = {"major", "minor"};
- for (int i = 0; i < GOOGLE_ARRAYSIZE(kMacroNames); ++i) {
- if (name == kMacroNames[i]) {
- names_to_undef.push_back(name);
- break;
- }
- }
- }
+ CollectMacroNames(file_, &names_to_undef);
for (int i = 0; i < names_to_undef.size(); ++i) {
printer->Print(
"#ifdef $name$\n"
@@ -138,46 +168,45 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
printer->Print(
"// @@protoc_insertion_point(includes)\n");
- printer->Print("#define PROTOBUF_INTERNAL_EXPORT_$filename$ $export$\n",
- "filename", FileLevelNamespace(file_),
- "export", options_.dllexport_decl);
GenerateMacroUndefs(printer);
- GenerateGlobalStateFunctionDeclarations(printer);
-
GenerateForwardDeclarations(printer);
- {
- NamespaceOpener ns(Namespace(file_), printer);
+ // Open namespace.
+ GenerateNamespaceOpeners(printer);
- printer->Print("\n");
+ GenerateGlobalStateFunctionDeclarations(printer);
- GenerateEnumDefinitions(printer);
+ printer->Print("\n");
- printer->Print(kThickSeparator);
- printer->Print("\n");
+ GenerateEnumDefinitions(printer);
- GenerateMessageDefinitions(printer);
+ printer->Print(kThickSeparator);
+ printer->Print("\n");
- printer->Print("\n");
- printer->Print(kThickSeparator);
- printer->Print("\n");
+ GenerateMessageDefinitions(printer);
- GenerateServiceDefinitions(printer);
+ printer->Print("\n");
+ printer->Print(kThickSeparator);
+ printer->Print("\n");
- GenerateExtensionIdentifiers(printer);
+ GenerateServiceDefinitions(printer);
- printer->Print("\n");
- printer->Print(kThickSeparator);
- printer->Print("\n");
+ GenerateExtensionIdentifiers(printer);
- GenerateInlineFunctionDefinitions(printer);
+ printer->Print("\n");
+ printer->Print(kThickSeparator);
+ printer->Print("\n");
- printer->Print(
- "\n"
- "// @@protoc_insertion_point(namespace_scope)\n"
- "\n");
- }
+ GenerateInlineFunctionDefinitions(printer);
+
+ printer->Print(
+ "\n"
+ "// @@protoc_insertion_point(namespace_scope)\n"
+ "\n");
+
+ // Close up namespace.
+ GenerateNamespaceClosers(printer);
// We need to specialize some templates in the ::google::protobuf namespace:
GenerateProto2NamespaceEnumSpecializations(printer);
@@ -223,9 +252,8 @@ void FileGenerator::GeneratePBHeader(io::Printer* printer,
GenerateTopHeaderGuard(printer, filename_identifier);
if (options_.proto_h) {
- string target_basename = StripProto(file_->name());
printer->Print("#include \"$basename$.proto.h\" // IWYU pragma: export\n",
- "basename", target_basename);
+ "basename", StripProto(file_->name()));
} else {
GenerateLibraryIncludes(printer);
}
@@ -241,12 +269,15 @@ void FileGenerator::GeneratePBHeader(io::Printer* printer,
// TODO(gerbens) remove this.
printer->Print(
"// @@protoc_insertion_point(includes)\n");
- {
- NamespaceOpener ns(Namespace(file_), printer);
- printer->Print(
- "\n"
- "// @@protoc_insertion_point(namespace_scope)\n");
- }
+
+ // Open namespace.
+ GenerateNamespaceOpeners(printer);
+ printer->Print(
+ "\n"
+ "// @@protoc_insertion_point(namespace_scope)\n");
+ // Close up namespace.
+ GenerateNamespaceClosers(printer);
+
printer->Print(
"\n"
"// @@protoc_insertion_point(global_scope)\n"
@@ -256,21 +287,24 @@ void FileGenerator::GeneratePBHeader(io::Printer* printer,
GenerateBottomHeaderGuard(printer, filename_identifier);
}
-void FileGenerator::GenerateSourceIncludes(io::Printer* printer) {
- string target_basename = StripProto(file_->name());
+void FileGenerator::GenerateSource(io::Printer* printer) {
const bool use_system_include = IsWellKnownMessage(file_);
-
- string header = target_basename + (options_.proto_h ? ".proto.h" : ".pb.h");
+ string header =
+ StripProto(file_->name()) + (options_.proto_h ? ".proto.h" : ".pb.h");
printer->Print(
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"// source: $filename$\n"
"\n"
+ // The generated code calls accessors that might be deprecated. We don't
+ // want the compiler to warn in generated code.
+ "#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION\n"
"#include $left$$header$$right$\n"
"\n"
"#include <algorithm>\n" // for swap()
"\n"
"#include <google/protobuf/stubs/common.h>\n"
"#include <google/protobuf/stubs/port.h>\n"
+ "#include <google/protobuf/stubs/once.h>\n"
"#include <google/protobuf/io/coded_stream.h>\n"
"#include <google/protobuf/wire_format_lite_inl.h>\n",
"filename", file_->name(),
@@ -297,178 +331,110 @@ void FileGenerator::GenerateSourceIncludes(io::Printer* printer) {
for (int i = 0; i < file_->dependency_count(); i++) {
const FileDescriptor* dep = file_->dependency(i);
const char* extension = ".proto.h";
- string basename = StripProto(dep->name());
- string dependency = basename + extension;
+ string dependency = StripProto(dep->name()) + extension;
printer->Print(
"#include \"$dependency$\"\n",
"dependency", dependency);
}
}
- // TODO(gerbens) Remove this when all code in google is using the same
- // proto library. This is a temporary hack to force build errors if
- // the proto library is compiled with GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
- // and is also linking internal proto2. This is to prevent regressions while
- // we work cleaning up the code base. After this is completed and we have
- // one proto lib all code uses this should be removed.
- printer->Print(
- "// This is a temporary google only hack\n"
- "#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS\n"
- "#include \"third_party/protobuf/version.h\"\n"
- "#endif\n");
-
printer->Print(
"// @@protoc_insertion_point(includes)\n");
-}
-
-void FileGenerator::GenerateSourceDefaultInstance(int idx,
- io::Printer* printer) {
- printer->Print(
- "class $classname$DefaultTypeInternal {\n"
- " public:\n"
- " ::google::protobuf::internal::ExplicitlyConstructed<$classname$>\n"
- " _instance;\n",
- "classname", message_generators_[idx]->classname_);
- printer->Indent();
- message_generators_[idx]->GenerateExtraDefaultFields(printer);
- printer->Outdent();
- printer->Print("} _$classname$_default_instance_;\n", "classname",
- message_generators_[idx]->classname_);
-}
-namespace {
+ GenerateNamespaceOpeners(printer);
-// Generates weak symbol declarations for types that are to be considered weakly
-// referenced.
-void GenerateInternalForwardDeclarations(
- const std::vector<const FieldDescriptor*>& fields, const Options& options,
- SCCAnalyzer* scc_analyzer, io::Printer* printer) {
- // To ensure determinism and minimize the number of namespace statements,
- // we output the forward declarations sorted on namespace and type / function
- // name.
- std::set<std::pair<string, string> > messages;
- std::set<std::pair<string, string> > sccs;
- std::set<std::pair<string, string> > inits;
- for (int i = 0; i < fields.size(); ++i) {
- const FieldDescriptor* field = fields[i];
- const Descriptor* msg = field->message_type();
- if (msg == nullptr) continue;
- bool is_weak = IsImplicitWeakField(field, options, scc_analyzer);
- string flns = FileLevelNamespace(msg);
- auto scc = scc_analyzer->GetSCC(msg);
- string repr = ClassName(scc->GetRepresentative());
- string weak_attr;
- if (is_weak) {
- inits.insert(std::make_pair(flns, "AddDescriptors"));
- messages.insert(std::make_pair(Namespace(msg), ClassName(msg)));
- weak_attr = " __attribute__((weak))";
+ for (int i = 0; i < message_generators_.size(); i++) {
+ string parent;
+ if (IsMapEntryMessage(message_generators_[i]->descriptor_)) {
+ parent = ClassName(message_generators_[i]->descriptor_->containing_type(),
+ false) +
+ "::";
}
- string dllexport = "PROTOBUF_INTERNAL_EXPORT_" + FileLevelNamespace(msg);
- sccs.insert(std::make_pair(flns, "extern " + dllexport + weak_attr +
- " ::google::protobuf::internal::SCCInfo<" +
- SimpleItoa(scc->children.size()) +
- "> scc_info_" + repr + ";\n"));
- }
-
- printer->Print("\n");
- NamespaceOpener ns(printer);
- for (std::set<std::pair<string, string> >::const_iterator it =
- messages.begin();
- it != messages.end(); ++it) {
- ns.ChangeTo(it->first);
printer->Print(
- "extern __attribute__((weak)) $classname$DefaultTypeInternal "
- "_$classname$_default_instance_;\n",
- "classname", it->second);
- }
- for (std::set<std::pair<string, string> >::const_iterator it = inits.begin();
- it != inits.end(); ++it) {
- ns.ChangeTo(it->first);
- printer->Print("void $name$() __attribute__((weak));\n",
- "name", it->second);
- }
- for (const auto& p : sccs) {
- ns.ChangeTo(p.first);
- printer->Print(p.second.c_str());
+ "class $classname$DefaultTypeInternal {\n"
+ "public:\n"
+ " ::google::protobuf::internal::ExplicitlyConstructed<$parent$$classname$>\n"
+ " _instance;\n",
+ "parent", parent, "classname", message_generators_[i]->classname_);
+ printer->Indent();
+ message_generators_[i]->GenerateExtraDefaultFields(printer);
+ printer->Outdent();
+ printer->Print(
+ "} _$classname$_default_instance_;\n",
+ "classname", message_generators_[i]->classname_);
}
-}
-
-} // namespace
-void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) {
- GenerateSourceIncludes(printer);
-
- // Generate weak declarations. We do this for the whole strongly-connected
- // component (SCC), because we have a single InitDefaults* function for the
- // SCC.
- std::vector<const FieldDescriptor*> fields;
- for (const Descriptor* message :
- scc_analyzer_.GetSCC(message_generators_[idx]->descriptor_)
- ->descriptors) {
- ListAllFields(message, &fields);
+ for (int i = 0; i < enum_generators_.size(); i++) {
+ enum_generators_[i]->index_in_metadata_ = i;
}
- GenerateInternalForwardDeclarations(fields, options_, &scc_analyzer_,
- printer);
-
- if (IsSCCRepresentative(message_generators_[idx]->descriptor_)) {
- NamespaceOpener ns(FileLevelNamespace(file_), printer);
- GenerateInitForSCC(GetSCC(message_generators_[idx]->descriptor_), printer);
+ if (HasGenericServices(file_, options_)) {
+ for (int i = 0; i < service_generators_.size(); i++) {
+ service_generators_[i]->index_in_metadata_ = i;
+ }
}
- { // package namespace
- NamespaceOpener ns(Namespace(file_), printer);
+ printer->Print(
+ "\n"
+ "namespace $file_namespace$ {\n"
+ "\n",
+ "file_namespace", FileLevelNamespace(file_->name()));
- // Define default instances
- GenerateSourceDefaultInstance(idx, printer);
- if (options_.lite_implicit_weak_fields) {
- printer->Print("void $classname$_ReferenceStrong() {}\n", "classname",
- message_generators_[idx]->classname_);
- }
+ if (HasDescriptorMethods(file_, options_)) {
+ printer->Print(
+ "\n"
+ "namespace {\n"
+ "\n");
- // Generate classes.
- printer->Print("\n");
- message_generators_[idx]->GenerateClassMethods(printer);
+ if (!message_generators_.empty()) {
+ printer->Print("::google::protobuf::Metadata file_level_metadata[$size$];\n",
+ "size", SimpleItoa(message_generators_.size()));
+ }
+ if (!enum_generators_.empty()) {
+ printer->Print(
+ "const ::google::protobuf::EnumDescriptor* "
+ "file_level_enum_descriptors[$size$];\n",
+ "size", SimpleItoa(enum_generators_.size()));
+ }
+ if (HasGenericServices(file_, options_) && file_->service_count() > 0) {
+ printer->Print(
+ "const ::google::protobuf::ServiceDescriptor* "
+ "file_level_service_descriptors[$size$];\n",
+ "size", SimpleItoa(file_->service_count()));
+ }
printer->Print(
- "\n"
- "// @@protoc_insertion_point(namespace_scope)\n");
- } // end package namespace
+ "\n"
+ "} // namespace\n"
+ "\n");
+ }
- printer->Print(
- "namespace google {\nnamespace protobuf {\n");
- message_generators_[idx]->GenerateSourceInProto2Namespace(printer);
- printer->Print(
- "} // namespace protobuf\n} // namespace google\n");
+ // Define our externally-visible BuildDescriptors() function. (For the lite
+ // library, all this does is initialize default instances.)
+ GenerateBuildDescriptors(printer);
printer->Print(
"\n"
- "// @@protoc_insertion_point(global_scope)\n");
-}
-
-void FileGenerator::GenerateGlobalSource(io::Printer* printer) {
- GenerateSourceIncludes(printer);
-
- {
- NamespaceOpener ns(FileLevelNamespace(file_), printer);
- GenerateTables(printer);
-
- // Define the code to initialize reflection. This code uses a global
- // constructor to register reflection data with the runtime pre-main.
- if (HasDescriptorMethods(file_, options_)) {
- GenerateReflectionInitializationCode(printer);
- }
- }
-
- NamespaceOpener ns(Namespace(file_), printer);
+ "} // namespace $file_namespace$\n"
+ "\n",
+ "file_namespace", FileLevelNamespace(file_->name()));
// Generate enums.
for (int i = 0; i < enum_generators_.size(); i++) {
- enum_generators_[i]->GenerateMethods(i, printer);
+ enum_generators_[i]->GenerateMethods(printer);
}
- // Define extensions.
- for (int i = 0; i < extension_generators_.size(); i++) {
- extension_generators_[i]->GenerateDefinition(printer);
+ // Generate classes.
+ for (int i = 0; i < message_generators_.size(); i++) {
+ printer->Print("\n");
+ printer->Print(kThickSeparator);
+ printer->Print("\n");
+ message_generators_[i]->GenerateClassMethods(printer);
+
+ printer->Print("#if PROTOBUF_INLINE_NOT_IN_HEADERS\n");
+ // Generate class inline methods.
+ message_generators_[i]->GenerateInlineMethods(printer,
+ /* is_inline = */ false);
+ printer->Print("#endif // PROTOBUF_INLINE_NOT_IN_HEADERS\n");
}
if (HasGenericServices(file_, options_)) {
@@ -480,103 +446,17 @@ void FileGenerator::GenerateGlobalSource(io::Printer* printer) {
service_generators_[i]->GenerateImplementation(printer);
}
}
-}
-
-void FileGenerator::GenerateSource(io::Printer* printer) {
- GenerateSourceIncludes(printer);
- std::vector<const FieldDescriptor*> fields;
- ListAllFields(file_, &fields);
- GenerateInternalForwardDeclarations(fields, options_, &scc_analyzer_,
- printer);
-
- {
- NamespaceOpener ns(Namespace(file_), printer);
-
- // Define default instances
- for (int i = 0; i < message_generators_.size(); i++) {
- GenerateSourceDefaultInstance(i, printer);
- if (options_.lite_implicit_weak_fields) {
- printer->Print("void $classname$_ReferenceStrong() {}\n", "classname",
- message_generators_[i]->classname_);
- }
- }
- }
-
- {
- NamespaceOpener ns(FileLevelNamespace(file_), printer);
- GenerateTables(printer);
-
- // Now generate the InitDefaults for each SCC.
- for (int i = 0; i < message_generators_.size(); i++) {
- if (IsSCCRepresentative(message_generators_[i]->descriptor_)) {
- GenerateInitForSCC(GetSCC(message_generators_[i]->descriptor_),
- printer);
- }
- }
-
- printer->Print("void InitDefaults() {\n");
- for (int i = 0; i < message_generators_.size(); i++) {
- if (!IsSCCRepresentative(message_generators_[i]->descriptor_)) continue;
- string scc_name = ClassName(message_generators_[i]->descriptor_);
- printer->Print(
- " ::google::protobuf::internal::InitSCC(&scc_info_$scc_name$.base);\n",
- "scc_name", scc_name);
- }
- printer->Print("}\n\n");
-
- // Define the code to initialize reflection. This code uses a global
- // constructor to register reflection data with the runtime pre-main.
- if (HasDescriptorMethods(file_, options_)) {
- GenerateReflectionInitializationCode(printer);
- }
- }
-
-
- {
- NamespaceOpener ns(Namespace(file_), printer);
-
- // Actually implement the protos
-
- // Generate enums.
- for (int i = 0; i < enum_generators_.size(); i++) {
- enum_generators_[i]->GenerateMethods(i, printer);
- }
- // Generate classes.
- for (int i = 0; i < message_generators_.size(); i++) {
- printer->Print("\n");
- printer->Print(kThickSeparator);
- printer->Print("\n");
- message_generators_[i]->GenerateClassMethods(printer);
- }
-
- if (HasGenericServices(file_, options_)) {
- // Generate services.
- for (int i = 0; i < service_generators_.size(); i++) {
- if (i == 0) printer->Print("\n");
- printer->Print(kThickSeparator);
- printer->Print("\n");
- service_generators_[i]->GenerateImplementation(printer);
- }
- }
-
- // Define extensions.
- for (int i = 0; i < extension_generators_.size(); i++) {
- extension_generators_[i]->GenerateDefinition(printer);
- }
-
- printer->Print(
- "\n"
- "// @@protoc_insertion_point(namespace_scope)\n");
+ // Define extensions.
+ for (int i = 0; i < extension_generators_.size(); i++) {
+ extension_generators_[i]->GenerateDefinition(printer);
}
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");
+ "\n"
+ "// @@protoc_insertion_point(namespace_scope)\n");
+
+ GenerateNamespaceClosers(printer);
printer->Print(
"\n"
@@ -597,7 +477,7 @@ class FileGenerator::ForwardDeclarations {
ForwardDeclarations* AddOrGetNamespace(const string& ns_name) {
ForwardDeclarations*& ns = namespaces_[ns_name];
- if (ns == nullptr) {
+ if (ns == NULL) {
ns = new ForwardDeclarations;
}
return ns;
@@ -606,42 +486,7 @@ class FileGenerator::ForwardDeclarations {
std::map<string, const Descriptor*>& classes() { return classes_; }
std::map<string, const EnumDescriptor*>& enums() { return enums_; }
- 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 {
+ void Print(io::Printer* printer, const Options& options) const {
for (std::map<string, const EnumDescriptor *>::const_iterator
it = enums_.begin(),
end = enums_.end();
@@ -667,46 +512,33 @@ class FileGenerator::ForwardDeclarations {
options.dllexport_decl.empty() ? "" : options.dllexport_decl + " ",
"classname",
it->first);
- if (options.lite_implicit_weak_fields) {
- printer->Print("void $classname$_ReferenceStrong();\n",
- "classname", it->first);
- }
}
- }
-
- 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();
+ for (std::map<string, ForwardDeclarations *>::const_iterator
+ it = namespaces_.begin(),
+ end = namespaces_.end();
it != end; ++it) {
- const Descriptor* d = it->second;
- printer->Print(
- "template<> "
- "$dllexport_decl$"
- "$classname$* Arena::CreateMaybeMessage<$classname$>"
- "(Arena*);\n",
- "classname", QualifiedClassName(d), "dllexport_decl",
- options.dllexport_decl.empty() ? "" : options.dllexport_decl + " ");
+ printer->Print("namespace $nsname$ {\n",
+ "nsname", it->first);
+ it->second->Print(printer, options);
+ printer->Print("} // namespace $nsname$\n",
+ "nsname", it->first);
}
- 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_;
};
-void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
+void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) {
// AddDescriptors() is a file-level procedure which adds the encoded
// FileDescriptorProto for this .proto file to the global DescriptorPool for
// generated files (DescriptorPool::generated_pool()). It ordinarily runs at
- // static initialization time, but is not used at all in LITE_RUNTIME mode.
+ // static initialization time, but is not used at all in LITE_RUNTIME mode
+ // except when extensions are used. This procedure also constructs default
+ // instances and registers extensions.
//
// Its sibling, AssignDescriptors(), actually pulls the compiled
// FileDescriptor from the DescriptorPool and uses it to populate all of
@@ -715,91 +547,182 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
// anyone calls descriptor() or GetReflection() on one of the types defined
// in the file.
- if (!message_generators_.empty()) {
- printer->Print("::google::protobuf::Metadata file_level_metadata[$size$];\n", "size",
- SimpleItoa(message_generators_.size()));
+ // In optimize_for = LITE_RUNTIME mode, we don't generate AssignDescriptors()
+ // and we only use AddDescriptors() to allocate default instances.
+
+ // TODO(ckennelly): Gate this with the same options flag to enable
+ // table-driven parsing.
+
+ printer->Print("PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField\n"
+ " const TableStruct::entries[] "
+ "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
+ printer->Indent();
+
+ std::vector<size_t> entries;
+ size_t count = 0;
+ for (int i = 0; i < message_generators_.size(); i++) {
+ size_t value = message_generators_[i]->GenerateParseOffsets(printer);
+ entries.push_back(value);
+ count += value;
}
- if (!enum_generators_.empty()) {
- printer->Print(
- "const ::google::protobuf::EnumDescriptor* "
- "file_level_enum_descriptors[$size$];\n",
- "size", SimpleItoa(enum_generators_.size()));
+
+ // We need these arrays to exist, and MSVC does not like empty arrays.
+ if (count == 0) {
+ printer->Print("{0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},\n");
}
- if (HasGenericServices(file_, options_) && file_->service_count() > 0) {
- printer->Print(
- "const ::google::protobuf::ServiceDescriptor* "
- "file_level_service_descriptors[$size$];\n",
- "size", SimpleItoa(file_->service_count()));
+
+ printer->Outdent();
+ printer->Print(
+ "};\n"
+ "\n"
+ "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField\n"
+ " const TableStruct::aux[] "
+ "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
+ printer->Indent();
+
+ std::vector<size_t> aux_entries;
+ count = 0;
+ for (int i = 0; i < message_generators_.size(); i++) {
+ size_t value = message_generators_[i]->GenerateParseAuxTable(printer);
+ aux_entries.push_back(value);
+ count += value;
}
- if (!message_generators_.empty()) {
+ if (count == 0) {
+ printer->Print("::google::protobuf::internal::AuxillaryParseTableField(),\n");
+ }
+
+ printer->Outdent();
+ printer->Print(
+ "};\n"
+ "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const\n"
+ " TableStruct::schema[] "
+ "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
+ printer->Indent();
+
+ size_t offset = 0;
+ size_t aux_offset = 0;
+ for (int i = 0; i < message_generators_.size(); i++) {
+ message_generators_[i]->GenerateParseTable(printer, offset, aux_offset);
+ offset += entries[i];
+ aux_offset += aux_entries[i];
+ }
+
+ if (message_generators_.empty()) {
+ printer->Print("{ NULL, NULL, 0, -1, -1, -1, -1, NULL, false },\n");
+ }
+
+ printer->Outdent();
+ printer->Print(
+ "};\n"
+ "\n");
+
+ if (!message_generators_.empty() && options_.table_driven_serialization) {
printer->Print(
- "\n"
- "const ::google::protobuf::uint32 TableStruct::offsets[] "
- "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
+ "const ::google::protobuf::internal::FieldMetadata TableStruct::field_metadata[] "
+ "= {\n");
printer->Indent();
- std::vector<std::pair<size_t, size_t> > pairs;
- pairs.reserve(message_generators_.size());
+ std::vector<int> field_metadata_offsets;
+ int idx = 0;
for (int i = 0; i < message_generators_.size(); i++) {
- pairs.push_back(message_generators_[i]->GenerateOffsets(printer));
- }
- printer->Outdent();
- printer->Print(
- "};\n"
- "static const ::google::protobuf::internal::MigrationSchema schemas[] "
- "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
- printer->Indent();
- {
- int offset = 0;
- for (int i = 0; i < message_generators_.size(); i++) {
- message_generators_[i]->GenerateSchema(printer, offset,
- pairs[i].second);
- offset += pairs[i].first;
- }
+ field_metadata_offsets.push_back(idx);
+ idx += message_generators_[i]->GenerateFieldMetadata(printer);
}
+ field_metadata_offsets.push_back(idx);
printer->Outdent();
printer->Print(
"};\n"
- "\nstatic "
- "::google::protobuf::Message const * const file_default_instances[] = {\n");
+ "const ::google::protobuf::internal::SerializationTable "
+ "TableStruct::serialization_table[] = {\n");
printer->Indent();
+ // We rely on the order we layout the tables to match the order we
+ // calculate them with FlattenMessagesInFile, so we check here that
+ // these match exactly.
+ std::vector<const Descriptor*> calculated_order =
+ FlattenMessagesInFile(file_);
+ GOOGLE_CHECK_EQ(calculated_order.size(), message_generators_.size());
for (int i = 0; i < message_generators_.size(); i++) {
- const Descriptor* descriptor = message_generators_[i]->descriptor_;
+ GOOGLE_CHECK_EQ(calculated_order[i], message_generators_[i]->descriptor_);
printer->Print(
- "reinterpret_cast<const "
- "::google::protobuf::Message*>(&$ns$::_$classname$_default_instance_),\n",
- "classname", ClassName(descriptor), "ns", Namespace(descriptor));
+ "{$num_fields$, TableStruct::field_metadata + $index$},\n",
+ "classname", message_generators_[i]->classname_, "num_fields",
+ SimpleItoa(field_metadata_offsets[i + 1] - field_metadata_offsets[i]),
+ "index", SimpleItoa(field_metadata_offsets[i]));
}
printer->Outdent();
printer->Print(
"};\n"
"\n");
- } else {
- // we still need these symbols to exist
- printer->Print(
- // MSVC doesn't like empty arrays, so we add a dummy.
- "const ::google::protobuf::uint32 TableStruct::offsets[1] = {};\n"
- "static const ::google::protobuf::internal::MigrationSchema* schemas = NULL;\n"
- "static const ::google::protobuf::Message* const* "
- "file_default_instances = NULL;\n"
- "\n");
}
+ if (HasDescriptorMethods(file_, options_)) {
+ if (!message_generators_.empty()) {
+ printer->Print("const ::google::protobuf::uint32 TableStruct::offsets[] "
+ "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
+ printer->Indent();
+ std::vector<std::pair<size_t, size_t> > pairs;
+ for (int i = 0; i < message_generators_.size(); i++) {
+ pairs.push_back(message_generators_[i]->GenerateOffsets(printer));
+ }
+ printer->Outdent();
+ printer->Print(
+ "};\n"
+ "static const ::google::protobuf::internal::MigrationSchema schemas[] "
+ "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
+ printer->Indent();
+ {
+ int offset = 0;
+ for (int i = 0; i < message_generators_.size(); i++) {
+ message_generators_[i]->GenerateSchema(printer, offset,
+ pairs[i].second);
+ offset += pairs[i].first;
+ }
+ }
+ printer->Outdent();
+ printer->Print(
+ "};\n"
+ "\nstatic "
+ "::google::protobuf::Message const * const file_default_instances[] = {\n");
+ printer->Indent();
+ for (int i = 0; i < message_generators_.size(); i++) {
+ const Descriptor* descriptor = message_generators_[i]->descriptor_;
+ printer->Print(
+ "reinterpret_cast<const "
+ "::google::protobuf::Message*>(&_$classname$_default_instance_),\n",
+ "classname", ClassName(descriptor, false));
+ }
+ printer->Outdent();
+ printer->Print(
+ "};\n"
+ "\n");
+ } else {
+ // we still need these symbols to exist
+ printer->Print(
+ // MSVC doesn't like empty arrays, so we add a dummy.
+ "const ::google::protobuf::uint32 TableStruct::offsets[1] = {};\n"
+ "static const ::google::protobuf::internal::MigrationSchema* schemas = NULL;\n"
+ "static const ::google::protobuf::Message* const* "
+ "file_default_instances = NULL;\n");
+ }
- // ---------------------------------------------------------------
+ // ---------------------------------------------------------------
- // protobuf_AssignDescriptorsOnce(): The first time it is called, calls
- // AssignDescriptors(). All later times, waits for the first call to
- // complete and then returns.
+ // protobuf_AssignDescriptorsOnce(): The first time it is called, calls
+ // AssignDescriptors(). All later times, waits for the first call to
+ // complete and then returns.
+ string message_factory = "NULL";
printer->Print(
+ "namespace {\n"
+ "\n"
"void protobuf_AssignDescriptors() {\n"
// Make sure the file has found its way into the pool. If a descriptor
// is requested *during* static init then AddDescriptors() may not have
// been called yet, so we call it manually. Note that it's fine if
// AddDescriptors() is called multiple times.
" AddDescriptors();\n"
+ " ::google::protobuf::MessageFactory* factory = $factory$;\n"
" AssignDescriptors(\n"
" \"$filename$\", schemas, file_default_instances, "
- "TableStruct::offsets,\n"
+ "TableStruct::offsets, factory,\n"
" $metadata$, $enum_descriptors$, $service_descriptors$);\n",
"filename", file_->name(), "metadata",
!message_generators_.empty() ? "file_level_metadata" : "NULL",
@@ -808,13 +731,28 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
"service_descriptors",
HasGenericServices(file_, options_) && file_->service_count() > 0
? "file_level_service_descriptors"
- : "NULL");
+ : "NULL",
+ "factory", message_factory);
+ // TODO(gerbens) have the compiler include the schemas for map types
+ // so that this can go away, and we can potentially use table driven
+ // serialization for map types as well.
+ for (int i = 0; i < message_generators_.size(); i++) {
+ if (!IsMapEntryMessage(message_generators_[i]->descriptor_)) continue;
+ printer->Print(
+ "file_level_metadata[$index$].reflection = "
+ "$parent$::$classname$::CreateReflection(file_level_metadata[$index$]"
+ ".descriptor, _$classname$_default_instance_._instance.get_mutable());\n",
+ "index", SimpleItoa(i), "parent",
+ ClassName(message_generators_[i]->descriptor_->containing_type(),
+ false),
+ "classname", ClassName(message_generators_[i]->descriptor_, false));
+ }
printer->Print(
"}\n"
"\n"
"void protobuf_AssignDescriptorsOnce() {\n"
- " static ::google::protobuf::internal::once_flag once;\n"
- " ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);\n"
+ " static GOOGLE_PROTOBUF_DECLARE_ONCE(once);\n"
+ " ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);\n"
"}\n"
"\n",
"filename", file_->name(), "metadata",
@@ -824,14 +762,14 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
"service_descriptors",
HasGenericServices(file_, options_) && file_->service_count() > 0
? "file_level_service_descriptors"
- : "NULL");
+ : "NULL",
+ "factory", message_factory);
// Only here because of useless string reference that we don't want in
// protobuf_AssignDescriptorsOnce, because that is called from all the
// GetMetadata member methods.
printer->Print(
- "void protobuf_RegisterTypes(const ::std::string&) "
- "GOOGLE_PROTOBUF_ATTRIBUTE_COLD;\n"
+ "void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;\n"
"void protobuf_RegisterTypes(const ::std::string&) {\n"
" protobuf_AssignDescriptorsOnce();\n");
printer->Indent();
@@ -845,15 +783,63 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
printer->Outdent();
printer->Print(
- "}\n"
- "\n");
+ "}\n"
+ "\n"
+ "} // namespace\n");
+ }
- // Now generate the AddDescriptors() function.
- printer->Print(
- "void AddDescriptorsImpl() {\n"
- " InitDefaults();\n");
- printer->Indent();
+ // Now generate the InitDefaultsImpl() function.
+ printer->Print(
+ "void TableStruct::InitDefaultsImpl() {\n"
+ " GOOGLE_PROTOBUF_VERIFY_VERSION;\n\n"
+ // Force initialization of primitive values we depend on.
+ " ::google::protobuf::internal::InitProtobufDefaults();\n");
+ printer->Indent();
+
+ // Call the InitDefaults() methods for all of our dependencies, to make
+ // sure they get added first.
+ for (int i = 0; i < file_->dependency_count(); i++) {
+ const FileDescriptor* dependency = file_->dependency(i);
+ // Print the namespace prefix for the dependency.
+ string file_namespace = QualifiedFileLevelSymbol(
+ dependency->package(), FileLevelNamespace(dependency->name()));
+ // Call its AddDescriptors function.
+ printer->Print("$file_namespace$::InitDefaults();\n", "file_namespace",
+ file_namespace);
+ }
+
+ // Allocate and initialize default instances. This can't be done lazily
+ // since default instances are returned by simple accessors and are used with
+ // extensions. Speaking of which, we also register extensions at this time.
+ for (int i = 0; i < message_generators_.size(); i++) {
+ message_generators_[i]->GenerateDefaultInstanceAllocator(printer);
+ }
+ for (int i = 0; i < extension_generators_.size(); i++) {
+ extension_generators_[i]->GenerateRegistration(printer);
+ }
+ for (int i = 0; i < message_generators_.size(); i++) {
+ message_generators_[i]->GenerateDefaultInstanceInitializer(printer);
+ }
+ printer->Outdent();
+ printer->Print(
+ "}\n"
+ "\n"
+ "void InitDefaults() {\n"
+ " static GOOGLE_PROTOBUF_DECLARE_ONCE(once);\n"
+ " ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);\n"
+ "}\n");
+
+ // -----------------------------------------------------------------
+
+ // Now generate the AddDescriptors() function.
+ printer->Print(
+ "namespace {\n"
+ "void AddDescriptorsImpl() {\n"
+ " InitDefaults();\n");
+
+ printer->Indent();
+ if (HasDescriptorMethods(file_, options_)) {
// Embed the descriptor. We simply serialize the entire
// FileDescriptorProto
// and embed it as a string literal, which is parsed and built into real
@@ -864,11 +850,10 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
file_proto.SerializeToString(&file_data);
printer->Print("static const char descriptor[] "
- "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) "
- "= {\n");
+ "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
printer->Indent();
- if (file_data.size() > 65535) {
+ if (file_data.size() > 66535) {
// Workaround for MSVC: "Error C1091: compiler limit: string exceeds 65535
// bytes in length". Declare a static array of characters rather than use
// a string literal. Only write 25 bytes per line.
@@ -902,27 +887,31 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
"::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(\n"
" \"$filename$\", &protobuf_RegisterTypes);\n",
"filename", file_->name());
+ }
// Call the AddDescriptors() methods for all of our dependencies, to make
// sure they get added first.
for (int i = 0; i < file_->dependency_count(); i++) {
const FileDescriptor* dependency = file_->dependency(i);
// Print the namespace prefix for the dependency.
- string file_namespace = FileLevelNamespace(dependency);
+ string file_namespace = QualifiedFileLevelSymbol(
+ dependency->package(), FileLevelNamespace(dependency->name()));
// Call its AddDescriptors function.
- printer->Print("::$file_namespace$::AddDescriptors();\n", "file_namespace",
+ printer->Print("$file_namespace$::AddDescriptors();\n", "file_namespace",
file_namespace);
}
printer->Outdent();
printer->Print(
"}\n"
+ "} // anonymous namespace\n"
"\n"
"void AddDescriptors() {\n"
- " static ::google::protobuf::internal::once_flag once;\n"
- " ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);\n"
+ " static GOOGLE_PROTOBUF_DECLARE_ONCE(once);\n"
+ " ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);\n"
"}\n");
+ if (StaticInitializersForced(file_, options_)) {
printer->Print(
"// Force AddDescriptors() to be called at dynamic initialization "
"time.\n"
@@ -931,184 +920,31 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
" AddDescriptors();\n"
" }\n"
"} static_descriptor_initializer;\n");
-}
-
-void FileGenerator::GenerateInitForSCC(const SCC* scc, io::Printer* printer) {
- const string scc_name = ClassName(scc->GetRepresentative());
- // We use static and not anonymous namespace because symbol names are
- // substantially shorter.
- printer->Print(
- "static void InitDefaults$scc_name$() {\n"
- " GOOGLE_PROTOBUF_VERIFY_VERSION;\n\n"
- , // awkward comma due to macro
- "scc_name", scc_name);
-
- printer->Indent();
-
-
- // First construct all the necessary default instances.
- for (int i = 0; i < message_generators_.size(); i++) {
- if (scc_analyzer_.GetSCC(message_generators_[i]->descriptor_) != scc) {
- continue;
- }
- // TODO(gerbens) This requires this function to be friend. Remove
- // the need for this.
- message_generators_[i]->GenerateFieldDefaultInstances(printer);
- printer->Print(
- "{\n"
- " void* ptr = &$ns$::_$classname$_default_instance_;\n"
- " new (ptr) $ns$::$classname$();\n",
- "ns", Namespace(message_generators_[i]->descriptor_),
- "classname", ClassName(message_generators_[i]->descriptor_));
- if (!IsMapEntryMessage(message_generators_[i]->descriptor_)) {
- printer->Print(
- " ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);\n");
- }
- printer->Print("}\n");
}
+}
- // TODO(gerbens) make default instances be the same as normal instances.
- // Default instances differ from normal instances because they have cross
- // linked message fields.
- for (int i = 0; i < message_generators_.size(); i++) {
- if (scc_analyzer_.GetSCC(message_generators_[i]->descriptor_) != scc) {
- continue;
- }
- printer->Print("$classname$::InitAsDefaultInstance();\n", "classname",
- QualifiedClassName(message_generators_[i]->descriptor_));
- }
- printer->Outdent();
- printer->Print("}\n\n");
+void FileGenerator::GenerateNamespaceOpeners(io::Printer* printer) {
+ if (package_parts_.size() > 0) printer->Print("\n");
- printer->Print(
- "$dllexport_decl$::google::protobuf::internal::SCCInfo<$size$> "
- "scc_info_$scc_name$ =\n"
- " {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), "
- "$size$, InitDefaults$scc_name$}, {",
- "size", SimpleItoa(scc->children.size()), "scc_name",
- ClassName(scc->GetRepresentative()), "dllexport_decl",
- options_.dllexport_decl.empty() ? "" : options_.dllexport_decl + " ");
- for (const SCC* child : scc->children) {
- auto repr = child->GetRepresentative();
- printer->Print("\n &$ns$::scc_info_$child$.base,", "ns",
- FileLevelNamespace(repr), "child", ClassName(repr));
+ for (int i = 0; i < package_parts_.size(); i++) {
+ printer->Print("namespace $part$ {\n",
+ "part", package_parts_[i]);
}
- printer->Print("}};\n\n");
}
-void FileGenerator::GenerateTables(io::Printer* printer) {
- if (options_.table_driven_parsing) {
- // TODO(ckennelly): Gate this with the same options flag to enable
- // table-driven parsing.
- printer->Print(
- "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField\n"
- " const TableStruct::entries[] "
- "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
- printer->Indent();
-
- std::vector<size_t> entries;
- size_t count = 0;
- for (int i = 0; i < message_generators_.size(); i++) {
- size_t value = message_generators_[i]->GenerateParseOffsets(printer);
- entries.push_back(value);
- count += value;
- }
-
- // We need these arrays to exist, and MSVC does not like empty arrays.
- if (count == 0) {
- printer->Print("{0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},\n");
- }
-
- printer->Outdent();
- printer->Print(
- "};\n"
- "\n"
- "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField\n"
- " const TableStruct::aux[] "
- "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
- printer->Indent();
-
- std::vector<size_t> aux_entries;
- count = 0;
- for (int i = 0; i < message_generators_.size(); i++) {
- size_t value = message_generators_[i]->GenerateParseAuxTable(printer);
- aux_entries.push_back(value);
- count += value;
- }
-
- if (count == 0) {
- printer->Print("::google::protobuf::internal::AuxillaryParseTableField(),\n");
- }
-
- printer->Outdent();
- printer->Print(
- "};\n"
- "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const\n"
- " TableStruct::schema[] "
- "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n");
- printer->Indent();
-
- size_t offset = 0;
- size_t aux_offset = 0;
- for (int i = 0; i < message_generators_.size(); i++) {
- message_generators_[i]->GenerateParseTable(printer, offset, aux_offset);
- offset += entries[i];
- aux_offset += aux_entries[i];
- }
-
- if (message_generators_.empty()) {
- printer->Print("{ NULL, NULL, 0, -1, -1, false },\n");
- }
-
- printer->Outdent();
- printer->Print(
- "};\n"
- "\n");
- }
+void FileGenerator::GenerateNamespaceClosers(io::Printer* printer) {
+ if (package_parts_.size() > 0) printer->Print("\n");
- if (!message_generators_.empty() && options_.table_driven_serialization) {
- printer->Print(
- "const ::google::protobuf::internal::FieldMetadata TableStruct::field_metadata[] "
- "= {\n");
- printer->Indent();
- std::vector<int> field_metadata_offsets;
- int idx = 0;
- for (int i = 0; i < message_generators_.size(); i++) {
- field_metadata_offsets.push_back(idx);
- idx += message_generators_[i]->GenerateFieldMetadata(printer);
- }
- field_metadata_offsets.push_back(idx);
- printer->Outdent();
- printer->Print(
- "};\n"
- "const ::google::protobuf::internal::SerializationTable "
- "TableStruct::serialization_table[] = {\n");
- printer->Indent();
- // We rely on the order we layout the tables to match the order we
- // calculate them with FlattenMessagesInFile, so we check here that
- // these match exactly.
- std::vector<const Descriptor*> calculated_order =
- FlattenMessagesInFile(file_);
- GOOGLE_CHECK_EQ(calculated_order.size(), message_generators_.size());
- for (int i = 0; i < message_generators_.size(); i++) {
- GOOGLE_CHECK_EQ(calculated_order[i], message_generators_[i]->descriptor_);
- printer->Print(
- "{$num_fields$, TableStruct::field_metadata + $index$},\n",
- "classname", message_generators_[i]->classname_, "num_fields",
- SimpleItoa(field_metadata_offsets[i + 1] - field_metadata_offsets[i]),
- "index", SimpleItoa(field_metadata_offsets[i]));
- }
- printer->Outdent();
- printer->Print(
- "};\n"
- "\n");
+ for (int i = package_parts_.size() - 1; i >= 0; i--) {
+ printer->Print("} // namespace $part$\n",
+ "part", package_parts_[i]);
}
}
void FileGenerator::GenerateForwardDeclarations(io::Printer* printer) {
ForwardDeclarations decls;
FillForwardDeclarations(&decls);
- decls.PrintForwardDeclarations(printer, options_);
+ decls.Print(printer, options_);
}
void FileGenerator::FillForwardDeclarations(ForwardDeclarations* decls) {
@@ -1133,8 +969,8 @@ void FileGenerator::GenerateTopHeaderGuard(io::Printer* printer,
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"// source: $filename$\n"
"\n"
- "#ifndef PROTOBUF_INCLUDED_$filename_identifier$\n"
- "#define PROTOBUF_INCLUDED_$filename_identifier$\n"
+ "#ifndef PROTOBUF_$filename_identifier$__INCLUDED\n"
+ "#define PROTOBUF_$filename_identifier$__INCLUDED\n"
"\n"
"#include <string>\n",
"filename", file_->name(), "filename_identifier", filename_identifier);
@@ -1144,14 +980,11 @@ void FileGenerator::GenerateTopHeaderGuard(io::Printer* printer,
void FileGenerator::GenerateBottomHeaderGuard(
io::Printer* printer, const string& filename_identifier) {
printer->Print(
- "#endif // PROTOBUF_INCLUDED_$filename_identifier$\n",
+ "#endif // PROTOBUF_$filename_identifier$__INCLUDED\n",
"filename_identifier", filename_identifier);
}
void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) {
- if (UsingImplicitWeakFields(file_, options_)) {
- printer->Print("#include <google/protobuf/implicit_weak_message.h>\n");
- }
printer->Print(
"#include <google/protobuf/stubs/common.h>\n"
@@ -1181,9 +1014,7 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) {
"#include <google/protobuf/arena.h>\n"
"#include <google/protobuf/arenastring.h>\n"
"#include <google/protobuf/generated_message_table_driven.h>\n"
- "#include <google/protobuf/generated_message_util.h>\n"
- "#include <google/protobuf/inlined_string_field.h>\n");
-
+ "#include <google/protobuf/generated_message_util.h>\n");
if (HasDescriptorMethods(file_, options_)) {
printer->Print(
@@ -1270,12 +1101,11 @@ void FileGenerator::GenerateDependencyIncludes(io::Printer* printer) {
const bool use_system_include = IsWellKnownMessage(file_->dependency(i));
const string& name = file_->dependency(i)->name();
bool public_import = (public_import_names.count(name) != 0);
- string basename = StripProto(name);
printer->Print(
"#include $left$$dependency$.pb.h$right$$iwyu$\n",
- "dependency", basename,
+ "dependency", StripProto(name),
"iwyu", (public_import) ? " // IWYU pragma: export" : "",
"left", use_system_include ? "<" : "\"",
"right", use_system_include ? ">" : "\"");
@@ -1284,34 +1114,31 @@ void FileGenerator::GenerateDependencyIncludes(io::Printer* printer) {
void FileGenerator::GenerateGlobalStateFunctionDeclarations(
io::Printer* printer) {
-// Forward-declare the AddDescriptors, InitDefaults because these are called
-// by .pb.cc files depending on this file.
+ // Forward-declare the AddDescriptors, AssignDescriptors
+ // functions, so that we can declare them to be friends of each class.
printer->Print(
"\n"
"namespace $file_namespace$ {\n"
- "// Internal implementation detail -- do not use these members.\n"
+ "// Internal implementation detail -- do not call these.\n"
"struct $dllexport_decl$TableStruct {\n"
- // These tables describe how to serialize and parse messages. Used
- // for table driven code.
" static const ::google::protobuf::internal::ParseTableField entries[];\n"
" static const ::google::protobuf::internal::AuxillaryParseTableField aux[];\n"
- " static const ::google::protobuf::internal::ParseTable schema[$num$];\n"
+ " static const ::google::protobuf::internal::ParseTable schema[];\n"
+ " static const ::google::protobuf::uint32 offsets[];\n"
" static const ::google::protobuf::internal::FieldMetadata field_metadata[];\n"
" static const ::google::protobuf::internal::SerializationTable "
"serialization_table[];\n"
- " static const ::google::protobuf::uint32 offsets[];\n"
- "};\n",
- "file_namespace", FileLevelNamespace(file_), "dllexport_decl",
- options_.dllexport_decl.empty() ? "" : options_.dllexport_decl + " ",
- "num", SimpleItoa(std::max(size_t(1), message_generators_.size())));
- if (HasDescriptorMethods(file_, options_)) {
- printer->Print(
- "void $dllexport_decl$AddDescriptors();\n", "dllexport_decl",
- options_.dllexport_decl.empty() ? "" : options_.dllexport_decl + " ");
- }
- printer->Print(
+ // The following function(s) need to be able to access private members of
+ // the messages defined in the file. So we make them static members.
+ // This is the internal implementation of InitDefaults. It should only
+ // be called by InitDefaults which makes sure it will be called only once.
+ " static void InitDefaultsImpl();\n"
+ "};\n"
+ "void $dllexport_decl$AddDescriptors();\n"
+ "void $dllexport_decl$InitDefaults();\n"
"} // namespace $file_namespace$\n",
- "file_namespace", FileLevelNamespace(file_));
+ "file_namespace", FileLevelNamespace(file_->name()), "dllexport_decl",
+ options_.dllexport_decl.empty() ? "" : options_.dllexport_decl + " ");
}
void FileGenerator::GenerateMessageDefinitions(io::Printer* printer) {
@@ -1360,6 +1187,41 @@ void FileGenerator::GenerateExtensionIdentifiers(io::Printer* printer) {
}
void FileGenerator::GenerateInlineFunctionDefinitions(io::Printer* printer) {
+ // An aside about inline functions in .proto.h mode:
+ //
+ // The PROTOBUF_INLINE_NOT_IN_HEADERS symbol controls conditionally
+ // moving much of the inline functions to the .pb.cc file, which can be a
+ // significant performance benefit for compilation time, at the expense
+ // of non-inline function calls.
+ //
+ // However, in .proto.h mode, the definition of the internal dependent
+ // base class must remain in the header, and can never be out-lined. The
+ // dependent base class also needs access to has-bit manipuation
+ // functions, so the has-bit functions must be unconditionally inlined in
+ // proto_h mode.
+ //
+ // This gives us three flavors of functions:
+ //
+ // 1. Functions on the message not used by the internal dependent base
+ // class: in .proto.h mode, only some functions are defined on the
+ // message class; others are defined on the dependent base class.
+ // These are guarded and can be out-lined. These are generated by
+ // GenerateInlineMethods, and include has_* bit functions in
+ // non-proto_h mode.
+ //
+ // 2. Functions on the internal dependent base class: these functions
+ // are dependent on a template parameter, so they always need to
+ // remain in the header.
+ //
+ // 3. Functions on the message that are used by the dependent base: the
+ // dependent base class down casts itself to the message
+ // implementation class to access these functions (the has_* bit
+ // manipulation functions). Unlike #1, these functions must
+ // unconditionally remain in the header. These are emitted by
+ // GenerateDependentInlineMethods, even though they are not actually
+ // dependent.
+
+ printer->Print("#if !PROTOBUF_INLINE_NOT_IN_HEADERS\n");
// TODO(gerbens) remove pragmas when gcc is no longer used. Current version
// of gcc fires a bogus error when compiled with strict-aliasing.
printer->Print(
@@ -1373,18 +1235,22 @@ void FileGenerator::GenerateInlineFunctionDefinitions(io::Printer* printer) {
printer->Print(kThinSeparator);
printer->Print("\n");
}
- message_generators_[i]->GenerateInlineMethods(printer);
+ message_generators_[i]->GenerateInlineMethods(printer,
+ /* is_inline = */ true);
}
printer->Print(
"#ifdef __GNUC__\n"
" #pragma GCC diagnostic pop\n"
"#endif // __GNUC__\n");
+ printer->Print("#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS\n");
for (int i = 0; i < message_generators_.size(); i++) {
if (i > 0) {
printer->Print(kThinSeparator);
printer->Print("\n");
}
+ // Methods of the dependent base class must always be inline in the header.
+ message_generators_[i]->GenerateDependentInlineMethods(printer);
}
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_file.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_file.h
index 94da9a1456..e10fe2f3d0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_file.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_file.h
@@ -35,9 +35,10 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__
#define GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__
-#include <algorithm>
#include <memory>
-#include <set>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
#include <google/protobuf/stubs/common.h>
@@ -81,21 +82,16 @@ class FileGenerator {
const string& info_path);
void GenerateSource(io::Printer* printer);
- int NumMessages() const { return message_generators_.size(); }
- // Similar to GenerateSource but generates only one message
- void GenerateSourceForMessage(int idx, io::Printer* printer);
- void GenerateGlobalSource(io::Printer* printer);
-
private:
// Internal type used by GenerateForwardDeclarations (defined in file.cc).
class ForwardDeclarations;
- void GenerateSourceIncludes(io::Printer* printer);
- void GenerateSourceDefaultInstance(int idx, io::Printer* printer);
+ // Generate the BuildDescriptors() procedure, which builds all descriptors
+ // for types defined in the file.
+ void GenerateBuildDescriptors(io::Printer* printer);
- void GenerateInitForSCC(const SCC* scc, io::Printer* printer);
- void GenerateTables(io::Printer* printer);
- void GenerateReflectionInitializationCode(io::Printer* printer);
+ void GenerateNamespaceOpeners(io::Printer* printer);
+ void GenerateNamespaceClosers(io::Printer* printer);
// For other imports, generates their forward-declarations.
void GenerateForwardDeclarations(io::Printer* printer);
@@ -147,23 +143,11 @@ class FileGenerator {
// a breaking change so we prefer the #undef approach.
void GenerateMacroUndefs(io::Printer* printer);
- bool IsSCCRepresentative(const Descriptor* d) {
- return GetSCCRepresentative(d) == d;
- }
- const Descriptor* GetSCCRepresentative(const Descriptor* d) {
- return GetSCC(d)->GetRepresentative();
- }
- const SCC* GetSCC(const Descriptor* d) {
- return scc_analyzer_.GetSCC(d);
- }
-
-
const FileDescriptor* file_;
const Options options_;
SCCAnalyzer scc_analyzer_;
-
// Contains the post-order walk of all the messages (and child messages) in
// this file. If you need a pre-order walk just reverse iterate.
std::vector<MessageGenerator*> message_generators_;
@@ -171,12 +155,14 @@ class FileGenerator {
std::vector<ServiceGenerator*> service_generators_;
std::vector<ExtensionGenerator*> extension_generators_;
- // These members are just for owning (and thus proper deleting).
- // Nested (enum/extension)_generators are owned by child messages.
- std::unique_ptr<std::unique_ptr<EnumGenerator> []> enum_generators_owner_;
- std::unique_ptr<std::unique_ptr<ServiceGenerator> []>
+ // These members are just for owning (and thus proper deleting). Some of the
+ // message_ and enum_generators above are owned by child messages.
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> >
+ message_generators_owner_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<EnumGenerator> > enum_generators_owner_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<ServiceGenerator> >
service_generators_owner_;
- std::unique_ptr<std::unique_ptr<ExtensionGenerator> []>
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator> >
extension_generators_owner_;
// E.g. if the package is foo.bar, package_parts_ is {"foo", "bar"}.
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_generator.cc
index 20bb8a1a7e..68abd0ef55 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_generator.cc
@@ -36,15 +36,16 @@
#include <vector>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#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/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
-
+#include <google/protobuf/descriptor.pb.h>
namespace google {
namespace protobuf {
@@ -64,6 +65,12 @@ bool CppGenerator::Generate(const FileDescriptor* file,
// -----------------------------------------------------------------
// parse generator options
+ // TODO(kenton): If we ever have more options, we may want to create a
+ // class that encapsulates them which we can pass down to all the
+ // generator classes. Currently we pass dllexport_decl down to all of
+ // them via the constructors, but we don't want to have to add another
+ // constructor parameter for every option.
+
// If the dllexport_decl option is passed to the compiler, we need to write
// it in front of every symbol that should be exported if this .proto is
// compiled into a Windows DLL. E.g., if the user invokes the protocol
@@ -77,6 +84,7 @@ bool CppGenerator::Generate(const FileDescriptor* file,
// __declspec(dllimport) depending on what is being compiled.
//
Options file_options;
+
for (int i = 0; i < options.size(); i++) {
if (options[i].first == "dllexport_decl") {
file_options.dllexport_decl = options[i].second;
@@ -90,12 +98,6 @@ bool CppGenerator::Generate(const FileDescriptor* file,
file_options.annotation_guard_name = options[i].second;
} else if (options[i].first == "lite") {
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") {
@@ -106,25 +108,16 @@ bool CppGenerator::Generate(const FileDescriptor* file,
}
}
- // 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;
- }
-
// -----------------------------------------------------------------
string basename = StripProto(file->name());
-
FileGenerator file_generator(file, file_options);
// Generate header(s).
if (file_options.proto_h) {
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(basename + ".proto.h"));
GeneratedCodeInfo annotations;
io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
@@ -136,64 +129,36 @@ bool CppGenerator::Generate(const FileDescriptor* file,
file_generator.GenerateProtoHeader(
&printer, file_options.annotate_headers ? info_path : "");
if (file_options.annotate_headers) {
- std::unique_ptr<io::ZeroCopyOutputStream> info_output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> info_output(
generator_context->Open(info_path));
annotations.SerializeToZeroCopyStream(info_output.get());
}
}
+ basename.append(".pb");
{
- std::unique_ptr<io::ZeroCopyOutputStream> output(
- generator_context->Open(basename + ".pb.h"));
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
+ generator_context->Open(basename + ".h"));
GeneratedCodeInfo annotations;
io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
&annotations);
- string info_path = basename + ".pb.h.meta";
+ string info_path = basename + ".h.meta";
io::Printer printer(output.get(), '$', file_options.annotate_headers
? &annotation_collector
: NULL);
file_generator.GeneratePBHeader(
&printer, file_options.annotate_headers ? info_path : "");
if (file_options.annotate_headers) {
- std::unique_ptr<io::ZeroCopyOutputStream> info_output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> info_output(
generator_context->Open(info_path));
annotations.SerializeToZeroCopyStream(info_output.get());
}
}
- // Generate cc file(s).
- if (UsingImplicitWeakFields(file, file_options)) {
- {
- // This is the global .cc file, containing enum/services/tables/reflection
- std::unique_ptr<io::ZeroCopyOutputStream> output(
- generator_context->Open(basename + ".pb.cc"));
- io::Printer printer(output.get(), '$');
- file_generator.GenerateGlobalSource(&printer);
- }
-
- 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.
- std::unique_ptr<io::ZeroCopyOutputStream> output(
- generator_context->Open(basename + "." + SimpleItoa(i) + ".cc"));
- io::Printer printer(output.get(), '$');
- if (i < file_generator.NumMessages()) {
- file_generator.GenerateSourceForMessage(i, &printer);
- }
- }
- } else {
- std::unique_ptr<io::ZeroCopyOutputStream> output(
- generator_context->Open(basename + ".pb.cc"));
+ // Generate cc file.
+ {
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
+ generator_context->Open(basename + ".cc"));
io::Printer printer(output.get(), '$');
file_generator.GenerateSource(&printer);
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_generator.h
index 3d517cf4a5..3d517cf4a5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_generator.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_helpers.cc
index 163dac0aa0..0095979634 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_helpers.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_helpers.cc
@@ -32,17 +32,15 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
-#include <google/protobuf/stubs/hash.h>
#include <limits>
#include <map>
-#include <queue>
#include <vector>
+#include <google/protobuf/stubs/hash.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.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/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
@@ -74,7 +72,7 @@ const char* const kKeywordList[] = {
"constexpr", "const_cast", "continue", "decltype", "default", "delete", "do",
"double", "dynamic_cast", "else", "enum", "explicit", "export", "extern",
"false", "float", "for", "friend", "goto", "if", "inline", "int", "long",
- "mutable", "namespace", "new", "noexcept", "not", "not_eq", "nullptr",
+ "mutable", "namespace", "new", "noexcept", "not", "not_eq", "NULL",
"operator", "or", "or_eq", "private", "protected", "public", "register",
"reinterpret_cast", "return", "short", "signed", "sizeof", "static",
"static_assert", "static_cast", "struct", "switch", "template", "this",
@@ -107,30 +105,6 @@ bool HasExtension(const Descriptor* descriptor) {
return false;
}
-// Encode [0..63] as 'A'-'Z', 'a'-'z', '0'-'9', '_'
-char Base63Char(int value) {
- GOOGLE_CHECK_GE(value, 0);
- if (value < 26) return 'A' + value;
- value -= 26;
- if (value < 26) return 'a' + value;
- value -= 26;
- if (value < 10) return '0' + value;
- GOOGLE_CHECK_EQ(value, 10);
- return '_';
-}
-
-// Given a c identifier has 63 legal characters we can't implement base64
-// encoding. So we return the k least significant "digits" in base 63.
-template <typename I>
-string Base63(I n, int k) {
- string res;
- while (k-- > 0) {
- res += Base63Char(static_cast<int>(n % 63));
- n /= 63;
- }
- return res;
-}
-
} // namespace
string UnderscoresToCamelCase(const string& input, bool cap_next_letter) {
@@ -163,51 +137,36 @@ const char kThickSeparator[] =
const char kThinSeparator[] =
"// -------------------------------------------------------------------\n";
-bool CanInitializeByZeroing(const FieldDescriptor* field) {
- if (field->is_repeated() || field->is_extension()) return false;
- switch (field->cpp_type()) {
- case FieldDescriptor::CPPTYPE_ENUM:
- return field->default_value_enum()->number() == 0;
- case FieldDescriptor::CPPTYPE_INT32:
- return field->default_value_int32() == 0;
- case FieldDescriptor::CPPTYPE_INT64:
- return field->default_value_int64() == 0;
- case FieldDescriptor::CPPTYPE_UINT32:
- return field->default_value_uint32() == 0;
- case FieldDescriptor::CPPTYPE_UINT64:
- return field->default_value_uint64() == 0;
- case FieldDescriptor::CPPTYPE_FLOAT:
- return field->default_value_float() == 0;
- case FieldDescriptor::CPPTYPE_DOUBLE:
- return field->default_value_double() == 0;
- case FieldDescriptor::CPPTYPE_BOOL:
- return field->default_value_bool() == false;
- default:
- return false;
- }
-}
+string ClassName(const Descriptor* descriptor, bool qualified) {
-string ClassName(const Descriptor* descriptor) {
- const Descriptor* parent = descriptor->containing_type();
- string res;
- if (parent) res += ClassName(parent) + "_";
- res += descriptor->name();
- if (IsMapEntryMessage(descriptor)) res += "_DoNotUse";
- return res;
-}
+ // Find "outer", the descriptor of the top-level message in which
+ // "descriptor" is embedded.
+ const Descriptor* outer = descriptor;
+ while (outer->containing_type() != NULL) outer = outer->containing_type();
-string ClassName(const EnumDescriptor* enum_descriptor) {
- if (enum_descriptor->containing_type() == NULL) {
- return enum_descriptor->name();
+ const string& outer_name = outer->full_name();
+ string inner_name = descriptor->full_name().substr(outer_name.size());
+
+ if (qualified) {
+ return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name);
} else {
- return ClassName(enum_descriptor->containing_type()) + "_" +
- enum_descriptor->name();
+ return outer->name() + DotsToUnderscores(inner_name);
}
}
-string Namespace(const string& package) {
- if (package.empty()) return "";
- return "::" + DotsToColons(package);
+string ClassName(const EnumDescriptor* enum_descriptor, bool qualified) {
+ if (enum_descriptor->containing_type() == NULL) {
+ if (qualified) {
+ return "::" + DotsToColons(enum_descriptor->full_name());
+ } else {
+ return enum_descriptor->name();
+ }
+ } else {
+ string result = ClassName(enum_descriptor->containing_type(), qualified);
+ result += '_';
+ result += enum_descriptor->name();
+ return result;
+ }
}
string DefaultInstanceName(const Descriptor* descriptor) {
@@ -216,8 +175,8 @@ string DefaultInstanceName(const Descriptor* descriptor) {
ClassName(descriptor, false) + "_default_instance_";
}
-string ReferenceFunctionName(const Descriptor* descriptor) {
- return QualifiedClassName(descriptor) + "_ReferenceStrong";
+string DependentBaseClassTemplateName(const Descriptor* descriptor) {
+ return ClassName(descriptor, false) + "_InternalBase";
}
string SuperClassName(const Descriptor* descriptor, const Options& options) {
@@ -226,6 +185,14 @@ string SuperClassName(const Descriptor* descriptor, const Options& options) {
: "::google::protobuf::MessageLite";
}
+string DependentBaseDownCast() {
+ return "reinterpret_cast<T*>(this)->";
+}
+
+string DependentBaseConstDownCast() {
+ return "reinterpret_cast<const T*>(this)->";
+}
+
string FieldName(const FieldDescriptor* field) {
string result = field->name();
LowerString(&result);
@@ -243,30 +210,6 @@ string EnumValueName(const EnumValueDescriptor* enum_value) {
return result;
}
-int EstimateAlignmentSize(const FieldDescriptor* field) {
- if (field == NULL) return 0;
- if (field->is_repeated()) return 8;
- switch (field->cpp_type()) {
- case FieldDescriptor::CPPTYPE_BOOL:
- return 1;
-
- case FieldDescriptor::CPPTYPE_INT32:
- case FieldDescriptor::CPPTYPE_UINT32:
- case FieldDescriptor::CPPTYPE_ENUM:
- case FieldDescriptor::CPPTYPE_FLOAT:
- return 4;
-
- case FieldDescriptor::CPPTYPE_INT64:
- case FieldDescriptor::CPPTYPE_UINT64:
- case FieldDescriptor::CPPTYPE_DOUBLE:
- case FieldDescriptor::CPPTYPE_STRING:
- case FieldDescriptor::CPPTYPE_MESSAGE:
- return 8;
- }
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return -1; // Make compiler happy.
-}
-
string FieldConstantName(const FieldDescriptor *field) {
string field_name = UnderscoresToCamelCase(field->name(), true);
string result = "k" + field_name + "FieldNumber";
@@ -283,6 +226,60 @@ string FieldConstantName(const FieldDescriptor *field) {
return result;
}
+bool IsFieldDependent(const FieldDescriptor* field) {
+ if (field->containing_oneof() != NULL &&
+ field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) {
+ return true;
+ }
+ if (field->is_map()) {
+ const Descriptor* map_descriptor = field->message_type();
+ for (int i = 0; i < map_descriptor->field_count(); i++) {
+ if (IsFieldDependent(map_descriptor->field(i))) {
+ return true;
+ }
+ }
+ return false;
+ }
+ if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) {
+ return false;
+ }
+ if (field->containing_oneof() != NULL) {
+ // Oneof fields will always be dependent.
+ //
+ // This is a unique case for field codegen. Field generators are
+ // responsible for generating all the field-specific accessor
+ // functions, except for the clear_*() function; instead, field
+ // generators produce inline clearing code.
+ //
+ // For non-oneof fields, the Message class uses the inline clearing
+ // code to define the field's clear_*() function, as well as in the
+ // destructor. For oneof fields, the Message class generates a much
+ // more complicated clear_*() function, which clears only the oneof
+ // member that is set, in addition to clearing methods for each of the
+ // oneof members individually.
+ //
+ // Since oneofs do not have their own generator class, the Message code
+ // generation logic would be significantly complicated in order to
+ // split dependent and non-dependent manipulation logic based on
+ // whether the oneof truly needs to be dependent; so, for oneof fields,
+ // we just assume it (and its constituents) should be manipulated by a
+ // dependent base class function.
+ //
+ // This is less precise than how dependent message-typed fields are
+ // handled, but the cost is limited to only the generated code for the
+ // oneof field, which seems like an acceptable tradeoff.
+ return true;
+ }
+ if (field->file() == field->message_type()->file()) {
+ return false;
+ }
+ return true;
+}
+
+string DependentTypeName(const FieldDescriptor* field) {
+ return "InternalBase_" + field->name() + "_T";
+}
+
string FieldMessageTypeName(const FieldDescriptor* field) {
// Note: The Google-internal version of Protocol Buffers uses this function
// as a hook point for hacks to support legacy code.
@@ -487,6 +484,19 @@ string SafeFunctionName(const Descriptor* descriptor,
return function_name;
}
+bool StaticInitializersForced(const FileDescriptor* file,
+ const Options& options) {
+ if (HasDescriptorMethods(file, options) || file->extension_count() > 0) {
+ return true;
+ }
+ for (int i = 0; i < file->message_type_count(); ++i) {
+ if (HasExtension(file->message_type(i))) {
+ return true;
+ }
+ }
+ return false;
+}
+
static bool HasMapFields(const Descriptor* descriptor) {
for (int i = 0; i < descriptor->field_count(); ++i) {
@@ -662,11 +672,13 @@ void Flatten(const Descriptor* descriptor,
} // namespace
-void FlattenMessagesInFile(const FileDescriptor* file,
- std::vector<const Descriptor*>* result) {
+std::vector<const Descriptor*> FlattenMessagesInFile(
+ const FileDescriptor* file) {
+ std::vector<const Descriptor*> result;
for (int i = 0; i < file->message_type_count(); i++) {
- Flatten(file->message_type(i), result);
+ Flatten(file->message_type(i), &result);
}
+ return result;
}
bool HasWeakFields(const Descriptor* descriptor) {
@@ -677,31 +689,6 @@ bool HasWeakFields(const FileDescriptor* file) {
return false;
}
-bool UsingImplicitWeakFields(const FileDescriptor* file,
- const Options& options) {
- return options.lite_implicit_weak_fields &&
- GetOptimizeFor(file, options) == FileOptions::LITE_RUNTIME;
-}
-
-bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options,
- SCCAnalyzer* scc_analyzer) {
- return UsingImplicitWeakFields(field->file(), options) &&
- field->type() == FieldDescriptor::TYPE_MESSAGE &&
- !field->is_required() && !field->is_map() &&
- field->containing_oneof() == NULL &&
- !IsWellKnownMessage(field->message_type()->file()) &&
- // We do not support implicit weak fields between messages in the same
- // strongly-connected component.
- scc_analyzer->GetSCC(field->containing_type()) !=
- scc_analyzer->GetSCC(field->message_type());
-}
-
-struct CompareDescriptors {
- bool operator()(const Descriptor* a, const Descriptor* b) {
- return a->full_name() < b->full_name();
- }
-};
-
SCCAnalyzer::NodeData SCCAnalyzer::DFS(const Descriptor* descriptor) {
// Must not have visited already.
GOOGLE_DCHECK_EQ(cache_.count(descriptor), 0);
@@ -741,33 +728,10 @@ SCCAnalyzer::NodeData SCCAnalyzer::DFS(const Descriptor* descriptor) {
if (scc_desc == descriptor) break;
}
-
- // The order of descriptors is random and depends how this SCC was
- // discovered. In-order to ensure maximum stability we sort it by name.
- std::sort(scc->descriptors.begin(), scc->descriptors.end(),
- CompareDescriptors());
- AddChildren(scc);
}
return result;
}
-void SCCAnalyzer::AddChildren(SCC* scc) {
- std::set<const SCC*> seen;
- for (int i = 0; i < scc->descriptors.size(); i++) {
- const Descriptor* descriptor = scc->descriptors[i];
- for (int j = 0; j < descriptor->field_count(); j++) {
- const Descriptor* child_msg = descriptor->field(j)->message_type();
- if (child_msg) {
- const SCC* child = GetSCC(child_msg);
- if (child == scc) continue;
- if (seen.insert(child).second) {
- scc->children.push_back(child);
- }
- }
- }
- }
-}
-
MessageAnalysis SCCAnalyzer::GetSCCAnalysis(const SCC* scc) {
if (analysis_cache_.count(scc)) return analysis_cache_[scc];
MessageAnalysis result = MessageAnalysis();
@@ -820,47 +784,6 @@ MessageAnalysis SCCAnalyzer::GetSCCAnalysis(const SCC* scc) {
return analysis_cache_[scc] = result;
}
-void ListAllFields(const Descriptor* d,
- std::vector<const FieldDescriptor*>* fields) {
- // Collect sub messages
- for (int i = 0; i < d->nested_type_count(); i++) {
- ListAllFields(d->nested_type(i), fields);
- }
- // Collect message level extensions.
- for (int i = 0; i < d->extension_count(); i++) {
- fields->push_back(d->extension(i));
- }
- // Add types of fields necessary
- for (int i = 0; i < d->field_count(); i++) {
- fields->push_back(d->field(i));
- }
-}
-
-void ListAllFields(const FileDescriptor* d,
- std::vector<const FieldDescriptor*>* fields) {
- // Collect file level message.
- for (int i = 0; i < d->message_type_count(); i++) {
- ListAllFields(d->message_type(i), fields);
- }
- // Collect message level extensions.
- for (int i = 0; i < d->extension_count(); i++) {
- fields->push_back(d->extension(i));
- }
-}
-
-void ListAllTypesForServices(const FileDescriptor* fd,
- std::vector<const Descriptor*>* types) {
- for (int i = 0; i < fd->service_count(); i++) {
- const ServiceDescriptor* sd = fd->service(i);
- for (int j = 0; j < sd->method_count(); j++) {
- const MethodDescriptor* method = sd->method(j);
- types->push_back(method->input_type());
- types->push_back(method->output_type());
- }
- }
-}
-
-
} // namespace cpp
} // namespace compiler
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_helpers.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_helpers.h
index eac6512452..6ae68591b8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_helpers.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_helpers.h
@@ -38,14 +38,16 @@
#include <map>
#include <string>
#include <google/protobuf/compiler/cpp/cpp_options.h>
-#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/io/printer.h>
#include <google/protobuf/descriptor.h>
-#include <google/protobuf/stubs/strutil.h>
namespace google {
namespace protobuf {
+
+namespace io {
+class Printer;
+}
+
namespace compiler {
namespace cpp {
@@ -54,32 +56,6 @@ namespace cpp {
extern const char kThickSeparator[];
extern const char kThinSeparator[];
-
-// Name space of the proto file. This namespace is such that the string
-// "<namespace>::some_name" is the correct fully qualified namespace.
-// This means if the package is empty the namespace is "", and otherwise
-// the namespace is "::foo::bar::...::baz" without trailing semi-colons.
-string Namespace(const string& package);
-inline string Namespace(const FileDescriptor* d) {
- return Namespace(d->package());
-}
-template <typename Desc>
-string Namespace(const Desc* d) {
- return Namespace(d->file());
-}
-
-// Returns true if it's safe to reset "field" to zero.
-bool CanInitializeByZeroing(const FieldDescriptor* field);
-
-string ClassName(const Descriptor* descriptor);
-string ClassName(const EnumDescriptor* enum_descriptor);
-template <typename Desc>
-string QualifiedClassName(const Desc* d) {
- return Namespace(d) + "::" + ClassName(d);
-}
-
-// DEPRECATED just use ClassName or QualifiedClassName, a boolean is very
-// unreadable at the callsite.
// Returns the non-nested type name for the given type. If "qualified" is
// true, prefix the type with the full namespace. For example, if you had:
// package foo.bar;
@@ -88,25 +64,25 @@ string QualifiedClassName(const Desc* d) {
// ::foo::bar::Baz_Qux
// While the non-qualified version would be:
// Baz_Qux
-inline string ClassName(const Descriptor* descriptor, bool qualified) {
- return qualified ? QualifiedClassName(descriptor) : ClassName(descriptor);
-}
-
-inline string ClassName(const EnumDescriptor* descriptor, bool qualified) {
- return qualified ? QualifiedClassName(descriptor) : ClassName(descriptor);
-}
+string ClassName(const Descriptor* descriptor, bool qualified);
+string ClassName(const EnumDescriptor* enum_descriptor, bool qualified);
// Fully qualified name of the default_instance of this message.
string DefaultInstanceName(const Descriptor* descriptor);
-// Returns the name of a no-op function that we can call to introduce a linker
-// dependency on the given message type. This is used to implement implicit weak
-// fields.
-string ReferenceFunctionName(const Descriptor* descriptor);
+// Name of the CRTP class template (for use with proto_h).
+// This is a class name, like "ProtoName_InternalBase".
+string DependentBaseClassTemplateName(const Descriptor* descriptor);
-// Name of the base class: google::protobuf::Message or google::protobuf::MessageLite.
+// Name of the base class: either the dependent base class (for use with
+// proto_h) or google::protobuf::Message.
string SuperClassName(const Descriptor* descriptor, const Options& options);
+// Returns a string that down-casts from the dependent base class to the
+// derived class.
+string DependentBaseDownCast();
+string DependentBaseConstDownCast();
+
// Get the (unqualified) name that should be used for this field in C++ code.
// The name is coerced to lower-case to emulate proto1 behavior. People
// should be using lowercase-with-underscores style for proto field names
@@ -116,12 +92,6 @@ string FieldName(const FieldDescriptor* field);
// Get the sanitized name that should be used for the given enum in C++ code.
string EnumValueName(const EnumValueDescriptor* enum_value);
-// Returns an estimate of the compiler's alignment for the field. This
-// can't guarantee to be correct because the generated code could be compiled on
-// different systems with different alignment rules. The estimates below assume
-// 64-bit pointers.
-int EstimateAlignmentSize(const FieldDescriptor* field);
-
// Get the unqualified name that should be used for a field's field
// number constant.
string FieldConstantName(const FieldDescriptor *field);
@@ -133,6 +103,20 @@ inline const Descriptor* FieldScope(const FieldDescriptor* field) {
field->extension_scope() : field->containing_type();
}
+// Returns true if the given 'field_descriptor' has a message type that is
+// a dependency of the file where the field is defined (i.e., the field
+// type is defined in a different file than the message holding the field).
+//
+// This only applies to Message-typed fields. Enum-typed fields may refer
+// to an enum in a dependency; however, enums are specified and
+// forward-declared with an enum-base, so the definition is not required to
+// manipulate the field value.
+bool IsFieldDependent(const FieldDescriptor* field_descriptor);
+
+// Returns the name that should be used for forcing dependent lookup from a
+// dependent base class.
+string DependentTypeName(const FieldDescriptor* field);
+
// Returns the fully-qualified type name field->message_type(). Usually this
// is just ClassName(field->message_type(), true);
string FieldMessageTypeName(const FieldDescriptor* field);
@@ -166,12 +150,6 @@ string FilenameIdentifier(const string& filename);
// For each .proto file generates a unique namespace. In this namespace global
// definitions are put to prevent collisions.
string FileLevelNamespace(const string& filename);
-inline string FileLevelNamespace(const FileDescriptor* file) {
- return FileLevelNamespace(file->name());
-}
-inline string FileLevelNamespace(const Descriptor* d) {
- return FileLevelNamespace(d->file());
-}
// Return the qualified C++ name for a file level symbol.
string QualifiedFileLevelSymbol(const string& package, const string& name);
@@ -247,6 +225,10 @@ inline bool HasFastArraySerialization(const FileDescriptor* file,
return GetOptimizeFor(file, options) == FileOptions::SPEED;
}
+// Returns whether we have to generate code with static initializers.
+bool StaticInitializersForced(const FileDescriptor* file,
+ const Options& options);
+
inline bool IsMapEntryMessage(const Descriptor* descriptor) {
return descriptor->options().map_entry();
@@ -283,20 +265,6 @@ inline bool SupportsArenas(const FieldDescriptor* field) {
return SupportsArenas(field->file());
}
-inline bool IsCrossFileMessage(const FieldDescriptor* field) {
- return field->type() == FieldDescriptor::TYPE_MESSAGE &&
- field->message_type()->file() != field->file();
-}
-
-inline string MessageCreateFunction(const Descriptor* d) {
- return SupportsArenas(d) ? "CreateMessage" : "Create";
-}
-
-inline string MakeDefaultName(const FieldDescriptor* field) {
- return "_i_give_permission_to_break_this_code_default_" + FieldName(field) +
- "_";
-}
-
bool IsAnyMessage(const FileDescriptor* descriptor);
bool IsAnyMessage(const Descriptor* descriptor);
@@ -321,14 +289,8 @@ inline ::google::protobuf::FileOptions_OptimizeMode GetOptimizeFor(
}
// This orders the messages in a .pb.cc as it's outputted by file.cc
-void FlattenMessagesInFile(const FileDescriptor* file,
- std::vector<const Descriptor*>* result);
-inline std::vector<const Descriptor*> FlattenMessagesInFile(
- const FileDescriptor* file) {
- std::vector<const Descriptor*> result;
- FlattenMessagesInFile(file, &result);
- return result;
-}
+std::vector<const Descriptor*> FlattenMessagesInFile(
+ const FileDescriptor* file);
bool HasWeakFields(const Descriptor* desc);
bool HasWeakFields(const FileDescriptor* desc);
@@ -340,46 +302,8 @@ inline static bool ShouldIgnoreRequiredFieldCheck(const FieldDescriptor* field,
return false;
}
-class LIBPROTOC_EXPORT NamespaceOpener {
- public:
- explicit NamespaceOpener(io::Printer* printer) : printer_(printer) {}
- NamespaceOpener(const string& name, io::Printer* printer)
- : printer_(printer) {
- ChangeTo(name);
- }
- ~NamespaceOpener() { ChangeTo(""); }
-
- void ChangeTo(const string& name) {
- std::vector<string> new_stack_ =
- Split(name, "::", true);
- int len = std::min(name_stack_.size(), new_stack_.size());
- int common_idx = 0;
- while (common_idx < len) {
- if (name_stack_[common_idx] != new_stack_[common_idx]) break;
- common_idx++;
- }
- for (int i = name_stack_.size() - 1; i >= common_idx; i--) {
- printer_->Print("} // namespace $ns$\n", "ns", name_stack_[i]);
- }
- name_stack_.swap(new_stack_);
- for (int i = common_idx; i < name_stack_.size(); i++) {
- printer_->Print("namespace $ns$ {\n", "ns", name_stack_[i]);
- }
- }
-
- private:
- io::Printer* printer_;
- std::vector<string> name_stack_;
-};
-
-// Description of each strongly connected component. Note that the order
-// of both the descriptors in this SCC and the order of children is
-// deterministic.
struct SCC {
std::vector<const Descriptor*> descriptors;
- std::vector<const SCC*> children;
-
- const Descriptor* GetRepresentative() const { return descriptors[0]; }
};
struct MessageAnalysis {
@@ -433,26 +357,8 @@ class LIBPROTOC_EXPORT SCCAnalyzer {
// Tarjan's Strongly Connected Components algo
NodeData DFS(const Descriptor* descriptor);
-
- // Add the SCC's that are children of this SCC to its children.
- void AddChildren(SCC* scc);
};
-void ListAllFields(const Descriptor* d,
- std::vector<const FieldDescriptor*>* fields);
-void ListAllFields(const FileDescriptor* d,
- std::vector<const FieldDescriptor*>* fields);
-void ListAllTypesForServices(const FileDescriptor* fd,
- std::vector<const Descriptor*>* types);
-
-// Indicates whether we should use implicit weak fields for this file.
-bool UsingImplicitWeakFields(const FileDescriptor* file,
- const Options& options);
-
-// Indicates whether to treat this field as implicitly weak.
-bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options,
- SCCAnalyzer* scc_analyzer);
-
} // namespace cpp
} // namespace compiler
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_map_field.cc
index 0e485cacbc..da33d29b92 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_map_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_map_field.cc
@@ -104,7 +104,9 @@ void SetMessageVariables(const FieldDescriptor* descriptor,
MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor,
const Options& options)
- : FieldGenerator(options), descriptor_(descriptor) {
+ : FieldGenerator(options),
+ descriptor_(descriptor),
+ dependent_field_(options.proto_h && IsFieldDependent(descriptor)) {
SetMessageVariables(descriptor, &variables_, options);
}
@@ -112,13 +114,50 @@ MapFieldGenerator::~MapFieldGenerator() {}
void MapFieldGenerator::
GeneratePrivateMembers(io::Printer* printer) const {
+ if (HasDescriptorMethods(descriptor_->file(), options_)) {
+ printer->Print(
+ variables_,
+ "public:\n"
+ "class $map_classname$ : public "
+ "::google::protobuf::internal::MapEntry<$map_classname$, \n"
+ " $key_cpp$, $val_cpp$,\n"
+ " $key_wire_type$,\n"
+ " $val_wire_type$,\n"
+ " $default_enum_value$ > {\n"
+ "public:\n"
+ " typedef ::google::protobuf::internal::MapEntry<$map_classname$, \n"
+ " $key_cpp$, $val_cpp$,\n"
+ " $key_wire_type$,\n"
+ " $val_wire_type$,\n"
+ " $default_enum_value$ > SuperType;\n"
+ " $map_classname$();\n"
+ " $map_classname$(::google::protobuf::Arena* arena);\n"
+ " void MergeFrom(const ::google::protobuf::Message& other) PROTOBUF_FINAL;\n"
+ " void MergeFrom(const $map_classname$& other);\n"
+ " static const Message* internal_default_instance() { return "
+ "reinterpret_cast<const "
+ "Message*>(&_$map_classname$_default_instance_); }\n"
+ " ::google::protobuf::Metadata GetMetadata() const;\n"
+ "};\n");
+ } else {
+ printer->Print(variables_,
+ "public:\n"
+ "typedef ::google::protobuf::internal::MapEntryLite<\n"
+ " $key_cpp$, $val_cpp$,\n"
+ " $key_wire_type$,\n"
+ " $val_wire_type$,\n"
+ " $default_enum_value$ >\n"
+ " $map_classname$;\n");
+ }
printer->Print(variables_,
+ "private:\n"
"::google::protobuf::internal::MapField$lite$<\n"
" $map_classname$,\n"
" $key_cpp$, $val_cpp$,\n"
" $key_wire_type$,\n"
" $val_wire_type$,\n"
- " $default_enum_value$ > $name$_;\n");
+ " $default_enum_value$ > $name$_;\n"
+ "private:\n");
}
void MapFieldGenerator::
@@ -135,14 +174,17 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
}
void MapFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- printer->Print(variables_,
- "inline const ::google::protobuf::Map< $key_cpp$, $val_cpp$ >&\n"
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline" : "";
+ printer->Print(variables,
+ "$inline$ const ::google::protobuf::Map< $key_cpp$, $val_cpp$ >&\n"
"$classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_map:$full_name$)\n"
" return $name$_.GetMap();\n"
"}\n"
- "inline ::google::protobuf::Map< $key_cpp$, $val_cpp$ >*\n"
+ "$inline$ ::google::protobuf::Map< $key_cpp$, $val_cpp$ >*\n"
"$classname$::mutable_$name$() {\n"
" // @@protoc_insertion_point(field_mutable_map:$full_name$)\n"
" return $name$_.MutableMap();\n"
@@ -151,7 +193,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
void MapFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
- printer->Print(variables_, "$name$_.Clear();\n");
+ std::map<string, string> variables(variables_);
+ variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : "";
+ printer->Print(variables, "$this_message$$name$_.Clear();\n");
}
void MapFieldGenerator::
@@ -200,7 +244,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
key = "entry->key()";
value = "entry->value()";
printer->Print(variables_,
- "::std::unique_ptr<$map_classname$> entry($name$_.NewEntry());\n");
+ "::google::protobuf::scoped_ptr<$map_classname$> entry($name$_.NewEntry());\n");
printer->Print(variables_,
"{\n"
" ::std::string data;\n"
@@ -218,7 +262,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
printer->Print(variables_,
" unknown_fields_stream.WriteVarint32($tag$u);\n"
" unknown_fields_stream.WriteVarint32(\n"
- " static_cast< ::google::protobuf::uint32>(data.size()));\n"
+ " static_cast<google::protobuf::uint32>(data.size()));\n"
" unknown_fields_stream.WriteString(data);\n");
}
@@ -256,7 +300,7 @@ static void GenerateSerializationLoop(io::Printer* printer,
const string& ptr,
bool loop_via_iterators) {
printer->Print(variables,
- StrCat("::std::unique_ptr<$map_classname$> entry;\n",
+ StrCat("::google::protobuf::scoped_ptr<$map_classname$> entry;\n",
loop_header, " {\n").c_str());
printer->Indent();
@@ -363,7 +407,7 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes(
"\n"
"if ($deterministic$ &&\n"
" this->$name$().size() > 1) {\n"
- " ::std::unique_ptr<SortItem[]> items(\n"
+ " ::google::protobuf::scoped_array<SortItem> items(\n"
" new SortItem[this->$name$().size()]);\n"
" typedef ::google::protobuf::Map< $key_cpp$, $val_cpp$ >::size_type size_type;\n"
" size_type n = 0;\n"
@@ -400,7 +444,7 @@ GenerateByteSize(io::Printer* printer) const {
"total_size += $tag_size$ *\n"
" ::google::protobuf::internal::FromIntSize(this->$name$_size());\n"
"{\n"
- " ::std::unique_ptr<$map_classname$> entry;\n"
+ " ::google::protobuf::scoped_ptr<$map_classname$> entry;\n"
" for (::google::protobuf::Map< $key_cpp$, $val_cpp$ >::const_iterator\n"
" it = this->$name$().begin();\n"
" it != this->$name$().end(); ++it) {\n");
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_map_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_map_field.h
index 0d54f0ea47..02e6649766 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_map_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_map_field.h
@@ -49,7 +49,8 @@ class MapFieldGenerator : public FieldGenerator {
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
@@ -66,6 +67,7 @@ class MapFieldGenerator : public FieldGenerator {
io::Printer* printer, const std::map<string, string>& variables) const;
const FieldDescriptor* descriptor_;
+ const bool dependent_field_;
std::map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message.cc
index 8c2336af1b..63ebb3c50d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -38,6 +38,9 @@
#include <google/protobuf/stubs/hash.h>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <utility>
#include <vector>
@@ -45,10 +48,9 @@
#include <google/protobuf/compiler/cpp/cpp_extension.h>
#include <google/protobuf/compiler/cpp/cpp_field.h>
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
-#include <google/protobuf/compiler/cpp/cpp_padding_optimizer.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/map_entry_lite.h>
@@ -57,7 +59,6 @@
#include <google/protobuf/stubs/substitute.h>
-
namespace google {
namespace protobuf {
namespace compiler {
@@ -108,19 +109,119 @@ struct ExtensionRangeSorter {
}
};
-bool IsPOD(const FieldDescriptor* field) {
- if (field->is_repeated() || field->is_extension()) return false;
+// This returns an estimate of the compiler's alignment for the field. This
+// can't guarantee to be correct because the generated code could be compiled on
+// different systems with different alignment rules. The estimates below assume
+// 64-bit pointers.
+int EstimateAlignmentSize(const FieldDescriptor* field) {
+ if (field == NULL) return 0;
+ if (field->is_repeated()) return 8;
switch (field->cpp_type()) {
- case FieldDescriptor::CPPTYPE_ENUM:
+ case FieldDescriptor::CPPTYPE_BOOL:
+ return 1;
+
case FieldDescriptor::CPPTYPE_INT32:
- case FieldDescriptor::CPPTYPE_INT64:
case FieldDescriptor::CPPTYPE_UINT32:
- case FieldDescriptor::CPPTYPE_UINT64:
+ case FieldDescriptor::CPPTYPE_ENUM:
case FieldDescriptor::CPPTYPE_FLOAT:
+ return 4;
+
+ case FieldDescriptor::CPPTYPE_INT64:
+ case FieldDescriptor::CPPTYPE_UINT64:
case FieldDescriptor::CPPTYPE_DOUBLE:
- case FieldDescriptor::CPPTYPE_BOOL:
- return true;
case FieldDescriptor::CPPTYPE_STRING:
+ case FieldDescriptor::CPPTYPE_MESSAGE:
+ return 8;
+ }
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return -1; // Make compiler happy.
+}
+
+// FieldGroup is just a helper for OptimizePadding below. It holds a vector of
+// fields that are grouped together because they have compatible alignment, and
+// a preferred location in the final field ordering.
+class FieldGroup {
+ public:
+ FieldGroup()
+ : preferred_location_(0) {}
+
+ // A group with a single field.
+ FieldGroup(float preferred_location, const FieldDescriptor* field)
+ : preferred_location_(preferred_location),
+ fields_(1, field) {}
+
+ // Append the fields in 'other' to this group.
+ void Append(const FieldGroup& other) {
+ if (other.fields_.empty()) {
+ return;
+ }
+ // Preferred location is the average among all the fields, so we weight by
+ // the number of fields on each FieldGroup object.
+ preferred_location_ =
+ (preferred_location_ * fields_.size() +
+ (other.preferred_location_ * other.fields_.size())) /
+ (fields_.size() + other.fields_.size());
+ fields_.insert(fields_.end(), other.fields_.begin(), other.fields_.end());
+ }
+
+ void SetPreferredLocation(float location) { preferred_location_ = location; }
+ const std::vector<const FieldDescriptor*>& fields() const { return fields_; }
+
+ // FieldGroup objects sort by their preferred location.
+ bool operator<(const FieldGroup& other) const {
+ return preferred_location_ < other.preferred_location_;
+ }
+
+ private:
+ // "preferred_location_" is an estimate of where this group should go in the
+ // final list of fields. We compute this by taking the average index of each
+ // field in this group in the original ordering of fields. This is very
+ // approximate, but should put this group close to where its member fields
+ // originally went.
+ float preferred_location_;
+ std::vector<const FieldDescriptor*> fields_;
+ // We rely on the default copy constructor and operator= so this type can be
+ // used in a vector.
+};
+
+// Helper for the code that emits the Clear() method.
+bool CanInitializeByZeroing(const FieldDescriptor* field) {
+ if (field->is_repeated() || field->is_extension()) return false;
+ switch (field->cpp_type()) {
+ case internal::WireFormatLite::CPPTYPE_ENUM:
+ return field->default_value_enum()->number() == 0;
+ case internal::WireFormatLite::CPPTYPE_INT32:
+ return field->default_value_int32() == 0;
+ case internal::WireFormatLite::CPPTYPE_INT64:
+ return field->default_value_int64() == 0;
+ case internal::WireFormatLite::CPPTYPE_UINT32:
+ return field->default_value_uint32() == 0;
+ case internal::WireFormatLite::CPPTYPE_UINT64:
+ return field->default_value_uint64() == 0;
+ case internal::WireFormatLite::CPPTYPE_FLOAT:
+ return field->default_value_float() == 0;
+ case internal::WireFormatLite::CPPTYPE_DOUBLE:
+ return field->default_value_double() == 0;
+ case internal::WireFormatLite::CPPTYPE_BOOL:
+ return field->default_value_bool() == false;
+ default:
+ return false;
+ }
+}
+
+bool IsPOD(const FieldDescriptor* field) {
+ if (field->is_repeated() || field->is_extension()) return false;
+ switch (field->cpp_type()) {
+ case internal::WireFormatLite::CPPTYPE_ENUM:
+ case internal::WireFormatLite::CPPTYPE_INT32:
+ case internal::WireFormatLite::CPPTYPE_INT64:
+ case internal::WireFormatLite::CPPTYPE_UINT32:
+ case internal::WireFormatLite::CPPTYPE_UINT64:
+ case internal::WireFormatLite::CPPTYPE_FLOAT:
+ case internal::WireFormatLite::CPPTYPE_DOUBLE:
+ case internal::WireFormatLite::CPPTYPE_BOOL:
+ return true;
+ case internal::WireFormatLite::CPPTYPE_STRING:
return false;
default:
return false;
@@ -141,6 +242,133 @@ bool CanConstructByZeroing(const FieldDescriptor* field,
return ret;
}
+// Reorder 'fields' so that if the fields are output into a c++ class in the new
+// order, fields of similiar family (see below) are together and within each
+// family, alignment padding is minimized.
+//
+// We try to do this while keeping each field as close as possible to its field
+// number order so that we don't reduce cache locality much for function that
+// access each field in order. Originally, OptimizePadding used declaration
+// order for its decisions, but generated code minus the serializer/parsers uses
+// the output of OptimizePadding as well (stored in
+// MessageGenerator::optimized_order_). Since the serializers use field number
+// order, we use that as a tie-breaker.
+//
+// TODO(ckennelly): If/when we have profiles available for the compiler, use
+// those rather than respect declaration order.
+//
+// We classify each field into a particular "family" of fields, that we perform
+// the same operation on in our generated functions.
+//
+// REPEATED is placed first, as the C++ compiler automatically initializes
+// these fields in layout order.
+//
+// STRING is grouped next, as our Clear/SharedCtor/SharedDtor walks it and
+// calls ArenaStringPtr::Destroy on each.
+//
+//
+// MESSAGE is grouped next, as our Clear/SharedDtor code walks it and calls
+// delete on each. We initialize these fields with a NULL pointer (see
+// MessageFieldGenerator::GenerateConstructorCode), which allows them to be
+// memset.
+//
+// ZERO_INITIALIZABLE is memset in Clear/SharedCtor
+//
+// OTHER these fields are initialized one-by-one.
+void OptimizePadding(std::vector<const FieldDescriptor*>* fields,
+ const Options& options) {
+ // The sorted numeric order of Family determines the declaration order in the
+ // memory layout.
+ enum Family {
+ REPEATED = 0,
+ STRING = 1,
+ MESSAGE = 3,
+ ZERO_INITIALIZABLE = 4,
+ OTHER = 5,
+ kMaxFamily
+ };
+
+ // First divide fields into those that align to 1 byte, 4 bytes or 8 bytes.
+ std::vector<FieldGroup> aligned_to_1[kMaxFamily];
+ std::vector<FieldGroup> aligned_to_4[kMaxFamily];
+ std::vector<FieldGroup> aligned_to_8[kMaxFamily];
+ for (int i = 0; i < fields->size(); ++i) {
+ const FieldDescriptor* field = (*fields)[i];
+
+ Family f = OTHER;
+ if (field->is_repeated()) {
+ f = REPEATED;
+ } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) {
+ f = STRING;
+ } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
+ f = MESSAGE;
+
+ } else if (CanInitializeByZeroing(field)) {
+ f = ZERO_INITIALIZABLE;
+ }
+
+ const int j = field->number();
+ switch (EstimateAlignmentSize(field)) {
+ case 1: aligned_to_1[f].push_back(FieldGroup(j, field)); break;
+ case 4: aligned_to_4[f].push_back(FieldGroup(j, field)); break;
+ case 8: aligned_to_8[f].push_back(FieldGroup(j, field)); break;
+ default:
+ GOOGLE_LOG(FATAL) << "Unknown alignment size.";
+ }
+ }
+
+ // For each family, group fields to optimize padding.
+ for (int f = 0; f < kMaxFamily; f++) {
+ // Now group fields aligned to 1 byte into sets of 4, and treat those like a
+ // single field aligned to 4 bytes.
+ for (int i = 0; i < aligned_to_1[f].size(); i += 4) {
+ FieldGroup field_group;
+ for (int j = i; j < aligned_to_1[f].size() && j < i + 4; ++j) {
+ field_group.Append(aligned_to_1[f][j]);
+ }
+ aligned_to_4[f].push_back(field_group);
+ }
+ // Sort by preferred location to keep fields as close to their field number
+ // order as possible. Using stable_sort ensures that the output is
+ // consistent across runs.
+ std::stable_sort(aligned_to_4[f].begin(), aligned_to_4[f].end());
+
+ // Now group fields aligned to 4 bytes (or the 4-field groups created above)
+ // into pairs, and treat those like a single field aligned to 8 bytes.
+ for (int i = 0; i < aligned_to_4[f].size(); i += 2) {
+ FieldGroup field_group;
+ for (int j = i; j < aligned_to_4[f].size() && j < i + 2; ++j) {
+ field_group.Append(aligned_to_4[f][j]);
+ }
+ if (i == aligned_to_4[f].size() - 1) {
+ if (f == OTHER) {
+ // Move incomplete 4-byte block to the beginning. This is done to
+ // pair with the (possible) leftover blocks from the
+ // ZERO_INITIALIZABLE family.
+ field_group.SetPreferredLocation(-1);
+ } else {
+ // Move incomplete 4-byte block to the end.
+ field_group.SetPreferredLocation(fields->size() + 1);
+ }
+ }
+ aligned_to_8[f].push_back(field_group);
+ }
+ // Sort by preferred location.
+ std::stable_sort(aligned_to_8[f].begin(), aligned_to_8[f].end());
+ }
+
+ // Now pull out all the FieldDescriptors in order.
+ fields->clear();
+ for (int f = 0; f < kMaxFamily; ++f) {
+ for (int i = 0; i < aligned_to_8[f].size(); ++i) {
+ fields->insert(fields->end(),
+ aligned_to_8[f][i].fields().begin(),
+ aligned_to_8[f][i].fields().end());
+ }
+ }
+}
+
+
// Emits an if-statement with a condition that evaluates to true if |field| is
// considered non-default (will be sent over the wire), for message types
// without true field presence. Should only be called if
@@ -195,31 +423,25 @@ bool HasHasMethod(const FieldDescriptor* field) {
void CollectMapInfo(const Descriptor* descriptor,
std::map<string, string>* variables) {
GOOGLE_CHECK(IsMapEntryMessage(descriptor));
- std::map<string, string>& vars = *variables;
const FieldDescriptor* key = descriptor->FindFieldByName("key");
const FieldDescriptor* val = descriptor->FindFieldByName("value");
- vars["key_cpp"] = PrimitiveTypeName(key->cpp_type());
+ (*variables)["key"] = PrimitiveTypeName(key->cpp_type());
switch (val->cpp_type()) {
case FieldDescriptor::CPPTYPE_MESSAGE:
- vars["val_cpp"] = FieldMessageTypeName(val);
+ (*variables)["val"] = FieldMessageTypeName(val);
break;
case FieldDescriptor::CPPTYPE_ENUM:
- vars["val_cpp"] = ClassName(val->enum_type(), true);
+ (*variables)["val"] = ClassName(val->enum_type(), true);
break;
default:
- vars["val_cpp"] = PrimitiveTypeName(val->cpp_type());
- }
- vars["key_wire_type"] = "::google::protobuf::internal::WireFormatLite::TYPE_" +
- ToUpper(DeclaredTypeMethodName(key->type()));
- vars["val_wire_type"] = "::google::protobuf::internal::WireFormatLite::TYPE_" +
- ToUpper(DeclaredTypeMethodName(val->type()));
- if (descriptor->file()->syntax() != FileDescriptor::SYNTAX_PROTO3 &&
- val->type() == FieldDescriptor::TYPE_ENUM) {
- const EnumValueDescriptor* default_value = val->default_value_enum();
- vars["default_enum_value"] = Int32ToString(default_value->number());
- } else {
- vars["default_enum_value"] = "0";
- }
+ (*variables)["val"] = PrimitiveTypeName(val->cpp_type());
+ }
+ (*variables)["key_wire_type"] =
+ "::google::protobuf::internal::WireFormatLite::TYPE_" +
+ ToUpper(DeclaredTypeMethodName(key->type()));
+ (*variables)["val_wire_type"] =
+ "::google::protobuf::internal::WireFormatLite::TYPE_" +
+ ToUpper(DeclaredTypeMethodName(val->type()));
}
// Does the given field have a private (internal helper only) has_$name$()
@@ -304,148 +526,26 @@ void SetUnknkownFieldsVariable(const Descriptor* descriptor,
"_internal_metadata_.mutable_unknown_fields()";
}
-bool IsCrossFileMapField(const FieldDescriptor* field) {
- if (!field->is_map()) {
- return false;
- }
-
- const Descriptor* d = field->message_type();
- const FieldDescriptor* value = d->FindFieldByNumber(2);
-
- return IsCrossFileMessage(value);
-}
-
-bool IsCrossFileMaybeMap(const FieldDescriptor* field) {
- if (IsCrossFileMapField(field)) {
- return true;
- }
-
- 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
// ===================================================================
MessageGenerator::MessageGenerator(const Descriptor* descriptor,
- int index_in_file_messages,
const Options& options,
SCCAnalyzer* scc_analyzer)
: descriptor_(descriptor),
- index_in_file_messages_(index_in_file_messages),
classname_(ClassName(descriptor, false)),
options_(options),
- field_generators_(descriptor, options, scc_analyzer),
+ field_generators_(descriptor, options),
max_has_bit_index_(0),
+ nested_generators_(new google::protobuf::scoped_ptr<
+ MessageGenerator>[descriptor->nested_type_count()]),
enum_generators_(
- new std::unique_ptr<EnumGenerator>[descriptor->enum_type_count()]),
- extension_generators_(new std::unique_ptr<
+ new google::protobuf::scoped_ptr<EnumGenerator>[descriptor->enum_type_count()]),
+ extension_generators_(new google::protobuf::scoped_ptr<
ExtensionGenerator>[descriptor->extension_count()]),
+ use_dependent_base_(false),
num_weak_fields_(0),
- message_layout_helper_(new PaddingOptimizer()),
scc_analyzer_(scc_analyzer) {
// Compute optimized field order to be used for layout and initialization
// purposes.
@@ -457,8 +557,7 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor,
optimized_order_.push_back(field);
}
}
-
- message_layout_helper_->OptimizeLayout(&optimized_order_, options_);
+ OptimizePadding(&optimized_order_, options_);
if (HasFieldPresence(descriptor_->file())) {
// We use -1 as a sentinel.
@@ -474,6 +573,11 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor,
}
}
+ for (int i = 0; i < descriptor->nested_type_count(); i++) {
+ nested_generators_[i].reset(new MessageGenerator(descriptor->nested_type(i),
+ options, scc_analyzer));
+ }
+
for (int i = 0; i < descriptor->enum_type_count(); i++) {
enum_generators_[i].reset(
new EnumGenerator(descriptor->enum_type(i), options));
@@ -489,12 +593,16 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor,
if (descriptor->field(i)->is_required()) {
++num_required_fields_;
}
+ if (options.proto_h && IsFieldDependent(descriptor->field(i))) {
+ use_dependent_base_ = true;
+ }
+ }
+ if (options.proto_h && descriptor->oneof_decl_count() > 0) {
+ // Always make oneofs dependent.
+ use_dependent_base_ = true;
}
table_driven_ = TableDrivenParsingEnabled(descriptor_, options_);
-
- scc_name_ =
- ClassName(scc_analyzer_->GetSCC(descriptor_)->GetRepresentative(), false);
}
MessageGenerator::~MessageGenerator() {}
@@ -512,6 +620,14 @@ size_t MessageGenerator::HasBitsSize() const {
return sizeof_has_bits;
}
+void MessageGenerator::Flatten(std::vector<MessageGenerator*>* list) {
+ for (int i = 0; i < descriptor_->nested_type_count(); i++) {
+ nested_generators_[i]->Flatten(list);
+ }
+ index_in_file_messages_ = list->size();
+ list->push_back(this);
+}
+
void MessageGenerator::AddGenerators(
std::vector<EnumGenerator*>* enum_generators,
std::vector<ExtensionGenerator*>* extension_generators) {
@@ -529,6 +645,28 @@ void MessageGenerator::FillMessageForwardDeclarations(
}
void MessageGenerator::
+GenerateDependentFieldAccessorDeclarations(io::Printer* printer) {
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ const FieldDescriptor* field = descriptor_->field(i);
+
+ PrintFieldComment(printer, field);
+
+ std::map<string, string> vars;
+ SetCommonFieldVariables(field, &vars, options_);
+
+ if (use_dependent_base_ && IsFieldDependent(field)) {
+ // If the message is dependent, the inline clear_*() method will need
+ // to delete the message type, so it must be in the dependent base
+ // class. (See also GenerateFieldAccessorDeclarations.)
+ printer->Print(vars, "$deprecated_attr$void clear_$name$();\n");
+ }
+ // Generate type-specific accessor declarations.
+ field_generators_.get(field).GenerateDependentAccessorDeclarations(printer);
+ printer->Print("\n");
+ }
+}
+
+void MessageGenerator::
GenerateFieldAccessorDeclarations(io::Printer* printer) {
// optimized_fields_ does not contain fields where
// field->containing_oneof() != NULL
@@ -559,6 +697,21 @@ GenerateFieldAccessorDeclarations(io::Printer* printer) {
SetCommonFieldVariables(field, &vars, options_);
vars["constant_name"] = FieldConstantName(field);
+ bool dependent_field = use_dependent_base_ && IsFieldDependent(field);
+ if (dependent_field &&
+ field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
+ !field->is_map()) {
+ // If this field is dependent, the dependent base class determines
+ // the message type from the derived class (which is a template
+ // parameter). This typedef is for that:
+ printer->Print(
+ "private:\n"
+ "typedef $field_type$ $dependent_type$;\n"
+ "public:\n",
+ "field_type", FieldMessageTypeName(field),
+ "dependent_type", DependentTypeName(field));
+ }
+
if (field->is_repeated()) {
printer->Print(vars, "$deprecated_attr$int ${$$name$_size$}$() const;\n");
printer->Annotate("{", "}", field);
@@ -573,8 +726,12 @@ GenerateFieldAccessorDeclarations(io::Printer* printer) {
printer->Annotate("{", "}", field);
}
- printer->Print(vars, "$deprecated_attr$void ${$clear_$name$$}$();\n");
- printer->Annotate("{", "}", field);
+ if (!dependent_field) {
+ // If this field is dependent, then its clear_() method is in the
+ // depenent base class. (See also GenerateDependentAccessorDeclarations.)
+ printer->Print(vars, "$deprecated_attr$void ${$clear_$name$$}$();\n");
+ printer->Annotate("{", "}", field);
+ }
printer->Print(vars,
"$deprecated_attr$static const int $constant_name$ = "
"$number$;\n");
@@ -596,7 +753,6 @@ GenerateFieldAccessorDeclarations(io::Printer* printer) {
for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
printer->Print(
- "void clear_$oneof_name$();\n"
"$camel_oneof_name$Case $oneof_name$_case() const;\n",
"camel_oneof_name",
UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), true),
@@ -605,13 +761,70 @@ GenerateFieldAccessorDeclarations(io::Printer* printer) {
}
void MessageGenerator::
+GenerateDependentFieldAccessorDefinitions(io::Printer* printer) {
+ if (!use_dependent_base_) return;
+
+ printer->Print("// $classname$\n\n", "classname",
+ DependentBaseClassTemplateName(descriptor_));
+
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ const FieldDescriptor* field = descriptor_->field(i);
+
+ if (field->options().weak()) continue;
+
+ PrintFieldComment(printer, field);
+
+ // These functions are not really dependent: they are part of the
+ // (non-dependent) derived class. However, they need to live outside
+ // any #ifdef guards, so we treat them as if they were dependent.
+ //
+ // See the comment in FileGenerator::GenerateInlineFunctionDefinitions
+ // for a more complete explanation.
+ if (use_dependent_base_ && IsFieldDependent(field)) {
+ std::map<string, string> vars;
+ SetCommonFieldVariables(field, &vars, options_);
+ vars["inline"] = "inline ";
+ if (field->containing_oneof()) {
+ vars["field_name"] = UnderscoresToCamelCase(field->name(), true);
+ vars["oneof_name"] = field->containing_oneof()->name();
+ vars["oneof_index"] = SimpleItoa(field->containing_oneof()->index());
+ GenerateOneofMemberHasBits(field, vars, printer);
+ } else if (!field->is_repeated()) {
+ // There will be no header guard, so this always has to be inline.
+ GenerateSingularFieldHasBits(field, vars, printer);
+ }
+ // vars needed for clear_(), which is in the dependent base:
+ // (See also GenerateDependentFieldAccessorDeclarations.)
+ vars["tmpl"] = "template<class T>\n";
+ vars["dependent_classname"] =
+ DependentBaseClassTemplateName(descriptor_) + "<T>";
+ vars["this_message"] = DependentBaseDownCast();
+ vars["this_const_message"] = DependentBaseConstDownCast();
+ GenerateFieldClear(field, vars, printer);
+ }
+
+ // Generate type-specific accessors.
+ field_generators_.get(field)
+ .GenerateDependentInlineAccessorDefinitions(printer);
+
+ printer->Print("\n");
+ }
+
+ // Generate has_$name$() and clear_has_$name$() functions for oneofs
+ // Similar to other has-bits, these must always be in the header if we
+ // are using a dependent base class.
+ GenerateOneofHasBits(printer, true /* is_inline */);
+}
+
+void MessageGenerator::
GenerateSingularFieldHasBits(const FieldDescriptor* field,
std::map<string, string> vars,
io::Printer* printer) {
if (field->options().weak()) {
printer->Print(
vars,
- "inline bool $classname$::has_$name$() const {\n"
+ "$inline$"
+ "bool $classname$::has_$name$() const {\n"
" return _weak_field_map_.Has($number$);\n"
"}\n");
return;
@@ -626,13 +839,16 @@ GenerateSingularFieldHasBits(const FieldDescriptor* field,
vars["has_mask"] = StrCat(strings::Hex(1u << (has_bit_index % 32),
strings::ZERO_PAD_8));
printer->Print(vars,
- "inline bool $classname$::has_$name$() const {\n"
+ "$inline$"
+ "bool $classname$::has_$name$() const {\n"
" return (_has_bits_[$has_array_index$] & 0x$has_mask$u) != 0;\n"
"}\n"
- "inline void $classname$::set_has_$name$() {\n"
+ "$inline$"
+ "void $classname$::set_has_$name$() {\n"
" _has_bits_[$has_array_index$] |= 0x$has_mask$u;\n"
"}\n"
- "inline void $classname$::clear_has_$name$() {\n"
+ "$inline$"
+ "void $classname$::clear_has_$name$() {\n"
" _has_bits_[$has_array_index$] &= ~0x$has_mask$u;\n"
"}\n");
} else {
@@ -641,13 +857,15 @@ GenerateSingularFieldHasBits(const FieldDescriptor* field,
bool is_lazy = false;
if (is_lazy) {
printer->Print(vars,
- "inline bool $classname$::has_$name$() const {\n"
+ "$inline$"
+ "bool $classname$::has_$name$() const {\n"
" return !$name$_.IsCleared();\n"
"}\n");
} else {
printer->Print(
vars,
- "inline bool $classname$::has_$name$() const {\n"
+ "$inline$"
+ "bool $classname$::has_$name$() const {\n"
" return this != internal_default_instance() && $name$_ != NULL;\n"
"}\n");
}
@@ -656,7 +874,7 @@ GenerateSingularFieldHasBits(const FieldDescriptor* field,
}
void MessageGenerator::
-GenerateOneofHasBits(io::Printer* printer) {
+GenerateOneofHasBits(io::Printer* printer, bool is_inline) {
for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
std::map<string, string> vars;
vars["oneof_name"] = descriptor_->oneof_decl(i)->name();
@@ -664,12 +882,15 @@ GenerateOneofHasBits(io::Printer* printer) {
vars["cap_oneof_name"] =
ToUpper(descriptor_->oneof_decl(i)->name());
vars["classname"] = classname_;
+ vars["inline"] = (is_inline ? "inline " : "");
printer->Print(
vars,
- "inline bool $classname$::has_$oneof_name$() const {\n"
+ "$inline$"
+ "bool $classname$::has_$oneof_name$() const {\n"
" return $oneof_name$_case() != $cap_oneof_name$_NOT_SET;\n"
"}\n"
- "inline void $classname$::clear_has_$oneof_name$() {\n"
+ "$inline$"
+ "void $classname$::clear_has_$oneof_name$() {\n"
" _oneof_case_[$oneof_index$] = $cap_oneof_name$_NOT_SET;\n"
"}\n");
}
@@ -686,11 +907,13 @@ GenerateOneofMemberHasBits(const FieldDescriptor* field,
// method, so that generated code is slightly cleaner (vs. comparing
// _oneof_case_[index] against a constant everywhere).
printer->Print(vars,
- "inline bool $classname$::has_$name$() const {\n"
+ "$inline$"
+ "bool $classname$::has_$name$() const {\n"
" return $oneof_name$_case() == k$field_name$;\n"
"}\n");
printer->Print(vars,
- "inline void $classname$::set_has_$name$() {\n"
+ "$inline$"
+ "void $classname$::set_has_$name$() {\n"
" _oneof_case_[$oneof_index$] = k$field_name$;\n"
"}\n");
}
@@ -698,14 +921,14 @@ GenerateOneofMemberHasBits(const FieldDescriptor* field,
void MessageGenerator::
GenerateFieldClear(const FieldDescriptor* field,
const std::map<string, string>& vars,
- bool is_inline,
io::Printer* printer) {
- // Generate clear_$name$().
- if (is_inline) {
- printer->Print("inline ");
- }
+ // Generate clear_$name$() (See GenerateFieldAccessorDeclarations and
+ // GenerateDependentFieldAccessorDeclarations, $dependent_classname$ is
+ // set by the Generate*Definitions functions.)
printer->Print(vars,
- "void $classname$::clear_$name$() {\n");
+ "$tmpl$"
+ "$inline$"
+ "void $dependent_classname$::clear_$name$() {\n");
printer->Indent();
@@ -713,12 +936,12 @@ GenerateFieldClear(const FieldDescriptor* field,
// Clear this field only if it is the active field in this oneof,
// otherwise ignore
printer->Print(vars,
- "if (has_$name$()) {\n");
+ "if ($this_message$has_$name$()) {\n");
printer->Indent();
field_generators_.get(field)
.GenerateClearingCode(printer);
printer->Print(vars,
- "clear_has_$oneof_name$();\n");
+ "$this_message$clear_has_$oneof_name$();\n");
printer->Outdent();
printer->Print("}\n");
} else {
@@ -726,7 +949,8 @@ GenerateFieldClear(const FieldDescriptor* field,
.GenerateClearingCode(printer);
if (HasFieldPresence(descriptor_->file())) {
if (!field->is_repeated() && !field->options().weak()) {
- printer->Print(vars, "clear_has_$name$();\n");
+ printer->Print(vars,
+ "$this_message$clear_has_$name$();\n");
}
}
}
@@ -736,7 +960,7 @@ GenerateFieldClear(const FieldDescriptor* field,
}
void MessageGenerator::
-GenerateFieldAccessorDefinitions(io::Printer* printer) {
+GenerateFieldAccessorDefinitions(io::Printer* printer, bool is_inline) {
printer->Print("// $classname$\n\n", "classname", classname_);
for (int i = 0; i < descriptor_->field_count(); i++) {
@@ -746,77 +970,99 @@ GenerateFieldAccessorDefinitions(io::Printer* printer) {
std::map<string, string> vars;
SetCommonFieldVariables(field, &vars, options_);
+ vars["inline"] = is_inline ? "inline " : "";
+ if (use_dependent_base_ && IsFieldDependent(field)) {
+ vars["tmpl"] = "template<class T>\n";
+ vars["dependent_classname"] =
+ DependentBaseClassTemplateName(descriptor_) + "<T>";
+ vars["this_message"] = "reinterpret_cast<T*>(this)->";
+ vars["this_const_message"] = "reinterpret_cast<const T*>(this)->";
+ } else {
+ vars["tmpl"] = "";
+ vars["dependent_classname"] = vars["classname"];
+ vars["this_message"] = "";
+ vars["this_const_message"] = "";
+ }
// Generate has_$name$() or $name$_size().
if (field->is_repeated()) {
printer->Print(vars,
- "inline int $classname$::$name$_size() const {\n"
+ "$inline$"
+ "int $classname$::$name$_size() const {\n"
" return $name$_.size();\n"
"}\n");
} else if (field->containing_oneof()) {
vars["field_name"] = UnderscoresToCamelCase(field->name(), true);
vars["oneof_name"] = field->containing_oneof()->name();
vars["oneof_index"] = SimpleItoa(field->containing_oneof()->index());
- GenerateOneofMemberHasBits(field, vars, printer);
+ if (!use_dependent_base_ || !IsFieldDependent(field)) {
+ GenerateOneofMemberHasBits(field, vars, printer);
+ }
} else {
// Singular field.
- GenerateSingularFieldHasBits(field, vars, printer);
+ if (!use_dependent_base_ || !IsFieldDependent(field)) {
+ GenerateSingularFieldHasBits(field, vars, printer);
+ }
}
- if (!IsCrossFileMaybeMap(field)) {
- GenerateFieldClear(field, vars, true, printer);
+ if (!use_dependent_base_ || !IsFieldDependent(field)) {
+ GenerateFieldClear(field, vars, printer);
}
// Generate type-specific accessors.
- field_generators_.get(field).GenerateInlineAccessorDefinitions(printer);
+ field_generators_.get(field).GenerateInlineAccessorDefinitions(printer,
+ is_inline);
printer->Print("\n");
}
- // Generate has_$name$() and clear_has_$name$() functions for oneofs.
- GenerateOneofHasBits(printer);
+ if (!use_dependent_base_) {
+ // Generate has_$name$() and clear_has_$name$() functions for oneofs
+ // If we aren't using a dependent base, they can be with the other functions
+ // that are #ifdef-guarded.
+ GenerateOneofHasBits(printer, is_inline);
+ }
}
void MessageGenerator::
-GenerateClassDefinition(io::Printer* printer) {
- if (IsMapEntryMessage(descriptor_)) {
- std::map<string, string> vars;
- vars["classname"] = classname_;
- CollectMapInfo(descriptor_, &vars);
- vars["lite"] =
- HasDescriptorMethods(descriptor_->file(), options_) ? "" : "Lite";
- printer->Print(
- vars,
- "class $classname$ : public "
- "::google::protobuf::internal::MapEntry$lite$<$classname$, \n"
- " $key_cpp$, $val_cpp$,\n"
- " $key_wire_type$,\n"
- " $val_wire_type$,\n"
- " $default_enum_value$ > {\n"
- "public:\n"
- " typedef ::google::protobuf::internal::MapEntry$lite$<$classname$, \n"
- " $key_cpp$, $val_cpp$,\n"
- " $key_wire_type$,\n"
- " $val_wire_type$,\n"
- " $default_enum_value$ > SuperType;\n"
- " $classname$();\n"
- " $classname$(::google::protobuf::Arena* arena);\n"
- " void MergeFrom(const $classname$& other);\n"
- " static const $classname$* internal_default_instance() { return "
- "reinterpret_cast<const "
- "$classname$*>(&_$classname$_default_instance_); }\n");
- if (HasDescriptorMethods(descriptor_->file(), options_)) {
- printer->Print(
- " void MergeFrom(const ::google::protobuf::Message& other) final;\n"
- " ::google::protobuf::Metadata GetMetadata() const;\n"
- "};\n");
- } else {
- printer->Print("};\n");
- }
+GenerateDependentBaseClassDefinition(io::Printer* printer) {
+ if (!use_dependent_base_) {
return;
}
std::map<string, string> vars;
+ vars["classname"] = DependentBaseClassTemplateName(descriptor_);
+ vars["full_name"] = descriptor_->full_name();
+ vars["superclass"] = SuperClassName(descriptor_, options_);
+
+ printer->Print(vars,
+ "template <class T>\n"
+ "class $classname$ : public $superclass$ "
+ "/* @@protoc_insertion_point(dep_base_class_definition:$full_name$) */ {\n"
+ " public:\n");
+ printer->Indent();
+
+ printer->Print(vars,
+ "$classname$() {}\n"
+ "virtual ~$classname$() {}\n"
+ "\n");
+
+ // Generate dependent accessor methods for all fields.
+ GenerateDependentFieldAccessorDeclarations(printer);
+
+ printer->Outdent();
+ printer->Print("};\n");
+}
+
+void MessageGenerator::
+GenerateClassDefinition(io::Printer* printer) {
+ if (IsMapEntryMessage(descriptor_)) return;
+ if (use_dependent_base_) {
+ GenerateDependentBaseClassDefinition(printer);
+ printer->Print("\n");
+ }
+
+ std::map<string, string> vars;
vars["classname"] = classname_;
vars["full_name"] = descriptor_->full_name();
vars["field_count"] = SimpleItoa(descriptor_->field_count());
@@ -826,12 +1072,20 @@ GenerateClassDefinition(io::Printer* printer) {
} else {
vars["dllexport"] = options_.dllexport_decl + " ";
}
- vars["superclass"] = SuperClassName(descriptor_, options_);
+ if (use_dependent_base_) {
+ vars["superclass"] =
+ DependentBaseClassTemplateName(descriptor_) + "<" + classname_ + ">";
+ } else {
+ vars["superclass"] = SuperClassName(descriptor_, options_);
+ }
printer->Print(vars,
"class $dllexport$$classname$ : public $superclass$ "
"/* @@protoc_insertion_point(class_definition:$full_name$) */ "
"{\n");
printer->Annotate("classname", descriptor_);
+ if (use_dependent_base_) {
+ printer->Print(vars, " friend class $superclass$;\n");
+ }
printer->Print(" public:\n");
printer->Indent();
@@ -855,23 +1109,26 @@ GenerateClassDefinition(io::Printer* printer) {
"\n");
}
- // Generate move constructor and move assignment operator.
- printer->Print(vars,
- "#if LANG_CXX11\n"
- "$classname$($classname$&& from) noexcept\n"
- " : $classname$() {\n"
- " *this = ::std::move(from);\n"
- "}\n"
- "\n"
- "inline $classname$& operator=($classname$&& from) noexcept {\n"
- " if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {\n"
- " if (this != &from) InternalSwap(&from);\n"
- " } else {\n"
- " CopyFrom(from);\n"
- " }\n"
- " return *this;\n"
- "}\n"
- "#endif\n");
+ // Generate move constructor and move assignment operator for types other than
+ // Any.
+ if (!IsAnyMessage(descriptor_)) {
+ printer->Print(vars,
+ "#if LANG_CXX11\n"
+ "$classname$($classname$&& from) noexcept\n"
+ " : $classname$() {\n"
+ " *this = ::std::move(from);\n"
+ "}\n"
+ "\n"
+ "inline $classname$& operator=($classname$&& from) noexcept {\n"
+ " if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {\n"
+ " if (this != &from) InternalSwap(&from);\n"
+ " } else {\n"
+ " CopyFrom(from);\n"
+ " }\n"
+ " return *this;\n"
+ "}\n"
+ "#endif\n");
+ }
SetUnknkownFieldsVariable(descriptor_, options_, &vars);
if (PublicUnknownFieldsAccessors(descriptor_)) {
@@ -892,10 +1149,10 @@ GenerateClassDefinition(io::Printer* printer) {
// virtual method version of GetArenaNoVirtual(), required for generic dispatch given a
// MessageLite* (e.g., in RepeatedField::AddAllocated()).
printer->Print(
- "inline ::google::protobuf::Arena* GetArena() const final {\n"
+ "inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {\n"
" return GetArenaNoVirtual();\n"
"}\n"
- "inline void* GetMaybeArenaPointer() const final {\n"
+ "inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {\n"
" return MaybeArenaPtr();\n"
"}\n");
}
@@ -942,12 +1199,11 @@ GenerateClassDefinition(io::Printer* printer) {
vars["message_index"] = SimpleItoa(index_in_file_messages_);
printer->Print(
vars,
- "static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY\n"
"static inline const $classname$* internal_default_instance() {\n"
" return reinterpret_cast<const $classname$*>(\n"
" &_$classname$_default_instance_);\n"
"}\n"
- "static constexpr int kIndexInFileMessages =\n"
+ "static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =\n"
" $message_index$;\n"
"\n");
@@ -967,12 +1223,10 @@ GenerateClassDefinition(io::Printer* printer) {
"template<typename T> bool Is() const {\n"
" return _any_metadata_.Is<T>();\n"
"}\n"
- "static bool ParseAnyTypeUrl(const string& type_url,\n"
- " string* full_type_name);\n"
"\n");
}
- vars["new_final"] = " final";
+ vars["new_final"] = " PROTOBUF_FINAL";
printer->Print(vars,
"void Swap($classname$* other);\n"
@@ -982,33 +1236,29 @@ GenerateClassDefinition(io::Printer* printer) {
"\n"
"// implements Message ----------------------------------------------\n"
"\n"
- "inline $classname$* New() const$new_final$ {\n"
- " return CreateMaybeMessage<$classname$>(NULL);\n"
- "}\n"
+ "inline $classname$* New() const$new_final$ { return New(NULL); }\n"
"\n"
- "$classname$* New(::google::protobuf::Arena* arena) const$new_final$ {\n"
- " return CreateMaybeMessage<$classname$>(arena);\n"
- "}\n");
+ "$classname$* New(::google::protobuf::Arena* arena) const$new_final$;\n");
// For instances that derive from Message (rather than MessageLite), some
// methods are virtual and should be marked as final.
string use_final = HasDescriptorMethods(descriptor_->file(), options_) ?
- " final" : "";
+ " PROTOBUF_FINAL" : "";
if (HasGeneratedMethods(descriptor_->file(), options_)) {
if (HasDescriptorMethods(descriptor_->file(), options_)) {
printer->Print(vars,
- "void CopyFrom(const ::google::protobuf::Message& from) final;\n"
- "void MergeFrom(const ::google::protobuf::Message& from) final;\n");
+ "void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;\n"
+ "void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;\n");
} else {
printer->Print(vars,
"void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from)\n"
- " final;\n");
+ " PROTOBUF_FINAL;\n");
}
- vars["clear_final"] = " final";
- vars["is_initialized_final"] = " final";
- vars["merge_partial_final"] = " final";
+ vars["clear_final"] = " PROTOBUF_FINAL";
+ vars["is_initialized_final"] = " PROTOBUF_FINAL";
+ vars["merge_partial_final"] = " PROTOBUF_FINAL";
printer->Print(
vars,
@@ -1017,7 +1267,7 @@ GenerateClassDefinition(io::Printer* printer) {
"void Clear()$clear_final$;\n"
"bool IsInitialized() const$is_initialized_final$;\n"
"\n"
- "size_t ByteSizeLong() const final;\n"
+ "size_t ByteSizeLong() const PROTOBUF_FINAL;\n"
"bool MergePartialFromCodedStream(\n"
" ::google::protobuf::io::CodedInputStream* input)$merge_partial_final$;\n");
if (!options_.table_driven_serialization ||
@@ -1025,7 +1275,7 @@ GenerateClassDefinition(io::Printer* printer) {
printer->Print(
"void SerializeWithCachedSizes(\n"
" ::google::protobuf::io::CodedOutputStream* output) const "
- "final;\n");
+ "PROTOBUF_FINAL;\n");
}
// DiscardUnknownFields() is implemented in message.cc using reflections. We
// need to implement this function in generated code for messages.
@@ -1037,18 +1287,19 @@ GenerateClassDefinition(io::Printer* printer) {
if (HasFastArraySerialization(descriptor_->file(), options_)) {
printer->Print(
"::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(\n"
- " bool deterministic, ::google::protobuf::uint8* target) const final;\n");
+ " bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;\n");
}
}
printer->Print(
- "int GetCachedSize() const final { return _cached_size_.Get(); }"
- "\n\nprivate:\n"
- "void SharedCtor();\n"
- "void SharedDtor();\n"
- "void SetCachedSize(int size) const$final$;\n"
- "void InternalSwap($classname$* other);\n",
- "classname", classname_, "final", use_final);
+ "int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }\n"
+ "private:\n"
+ "void SharedCtor();\n"
+ "void SharedDtor();\n"
+ "void SetCachedSize(int size) const$final$;\n"
+ "void InternalSwap($classname$* other);\n",
+ "classname", classname_,
+ "final", use_final);
if (SupportsArenas(descriptor_)) {
printer->Print(
// TODO(gerbens) Make this private! Currently people are deriving from
@@ -1088,11 +1339,11 @@ GenerateClassDefinition(io::Printer* printer) {
if (HasDescriptorMethods(descriptor_->file(), options_)) {
printer->Print(
- "::google::protobuf::Metadata GetMetadata() const final;\n"
+ "::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;\n"
"\n");
} else {
printer->Print(
- "::std::string GetTypeName() const final;\n"
+ "::std::string GetTypeName() const PROTOBUF_FINAL;\n"
"\n");
}
@@ -1107,8 +1358,6 @@ GenerateClassDefinition(io::Printer* printer) {
printer->Print("typedef $nested_full_name$ $nested_name$;\n",
"nested_name", nested_type->name(),
"nested_full_name", ClassName(nested_type, false));
- printer->Annotate("nested_full_name", nested_type);
- printer->Annotate("nested_name", nested_type);
}
}
@@ -1171,6 +1420,7 @@ GenerateClassDefinition(io::Printer* printer) {
for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
printer->Print(
"inline bool has_$oneof_name$() const;\n"
+ "void clear_$oneof_name$();\n"
"inline void clear_has_$oneof_name$();\n\n",
"oneof_name", descriptor_->oneof_decl(i)->name());
}
@@ -1188,8 +1438,7 @@ GenerateClassDefinition(io::Printer* printer) {
bool need_to_emit_cached_size = true;
// TODO(kenton): Make _cached_size_ an atomic<int> when C++ supports it.
- const string cached_size_decl =
- "mutable ::google::protobuf::internal::CachedSize _cached_size_;\n";
+ const string cached_size_decl = "mutable int _cached_size_;\n";
const size_t sizeof_has_bits = HasBitsSize();
const string has_bits_decl = sizeof_has_bits == 0 ? "" :
@@ -1299,10 +1548,14 @@ GenerateClassDefinition(io::Printer* printer) {
// The TableStruct struct needs access to the private parts, in order to
// construct the offsets of all members.
- printer->Print("friend struct ::$file_namespace$::TableStruct;\n",
- // Vars.
- "scc_name", scc_name_, "file_namespace",
- FileLevelNamespace(descriptor_));
+ //
+ // Some InitDefault and Shutdown are defined as static member functions of
+ // TableStruct such that they are also allowed to access private members.
+ printer->Print(
+ "friend struct $file_namespace$::TableStruct;\n",
+ // Vars.
+ "file_namespace",
+ FileLevelNamespace(descriptor_->file()->name()));
printer->Outdent();
printer->Print("};");
@@ -1310,9 +1563,21 @@ GenerateClassDefinition(io::Printer* printer) {
}
void MessageGenerator::
-GenerateInlineMethods(io::Printer* printer) {
+GenerateDependentInlineMethods(io::Printer* printer) {
+ if (IsMapEntryMessage(descriptor_)) return;
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ if (descriptor_->field(i)->options().weak()) {
+ field_generators_.get(descriptor_->field(i))
+ .GenerateDependentInlineAccessorDefinitions(printer);
+ }
+ }
+ GenerateDependentFieldAccessorDefinitions(printer);
+}
+
+void MessageGenerator::
+GenerateInlineMethods(io::Printer* printer, bool is_inline) {
if (IsMapEntryMessage(descriptor_)) return;
- GenerateFieldAccessorDefinitions(printer);
+ GenerateFieldAccessorDefinitions(printer, is_inline);
// Generate oneof_case() functions.
for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
@@ -1322,9 +1587,11 @@ GenerateInlineMethods(io::Printer* printer) {
descriptor_->oneof_decl(i)->name(), true);
vars["oneof_name"] = descriptor_->oneof_decl(i)->name();
vars["oneof_index"] = SimpleItoa(descriptor_->oneof_decl(i)->index());
+ vars["inline"] = is_inline ? "inline " : "";
printer->Print(
vars,
- "inline $class_name$::$camel_oneof_name$Case $class_name$::"
+ "$inline$"
+ "$class_name$::$camel_oneof_name$Case $class_name$::"
"$oneof_name$_case() const {\n"
" return $class_name$::$camel_oneof_name$Case("
"_oneof_case_[$oneof_index$]);\n"
@@ -1367,8 +1634,7 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset,
std::map<string, string> vars;
- vars["classname"] = ClassName(descriptor_);
- vars["classtype"] = QualifiedClassName(descriptor_);
+ vars["classname"] = classname_;
vars["offset"] = SimpleItoa(offset);
vars["aux_offset"] = SimpleItoa(aux_offset);
@@ -1395,34 +1661,48 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset,
printer->Print(vars, "-1,\n");
} else {
printer->Print(vars,
- "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n"
- " $classtype$, _has_bits_),\n");
+ "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n"
+ " $classname$, _has_bits_),\n");
}
if (descriptor_->oneof_decl_count() > 0) {
printer->Print(vars,
"GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n"
- " $classtype$, _oneof_case_),\n");
+ " $classname$, _oneof_case_),\n");
} else {
printer->Print("-1, // no _oneof_case_\n");
}
if (descriptor_->extension_range_count() > 0) {
printer->Print(vars,
- "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classtype$, "
- "_extensions_),\n");
+ "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, "
+ "_extensions_),\n");
} else {
printer->Print("-1, // no _extensions_\n");
}
// TODO(ckennelly): Consolidate this with the calculation for
// AuxillaryParseTableField.
- vars["ns"] = Namespace(descriptor_);
+ std::vector<string> package_parts;
+
+ const Descriptor* outer = descriptor_;
+ while (outer->containing_type() != NULL) {
+ outer = outer->containing_type();
+ }
+
+ package_parts = Split(
+ outer->full_name(), ".", true);
+ // outer->full_name() contains the class itself. Remove it as it is
+ // used in the name of the default instance variable.
+ GOOGLE_DCHECK_NE(package_parts.size(), 0);
+ package_parts.back().clear();
+
+ vars["ns"] = Join(package_parts, "::");
printer->Print(vars,
- "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n"
- " $classtype$, _internal_metadata_),\n"
- "&$ns$::_$classname$_default_instance_,\n");
+ "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n"
+ " $classname$, _internal_metadata_),\n"
+ "&::$ns$_$classname$_default_instance_,\n");
if (UseUnknownFieldSet(descriptor_->file(), options_)) {
printer->Print(vars, "true,\n");
@@ -1437,14 +1717,15 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset,
void MessageGenerator::GenerateSchema(io::Printer* printer, int offset,
int has_offset) {
+ if (IsMapEntryMessage(descriptor_)) return;
+
std::map<string, string> vars;
- vars["classname"] = QualifiedClassName(descriptor_);
+ vars["classname"] = classname_;
vars["offset"] = SimpleItoa(offset);
- vars["has_bits_offsets"] =
- HasFieldPresence(descriptor_->file()) || IsMapEntryMessage(descriptor_)
- ? SimpleItoa(offset + has_offset)
- : "-1";
+ vars["has_bits_offsets"] = HasFieldPresence(descriptor_->file())
+ ? SimpleItoa(offset + has_offset)
+ : "-1";
printer->Print(vars,
"{ $offset$, $has_bits_offsets$, sizeof($classname$)},\n");
@@ -1464,8 +1745,7 @@ uint32 CalculateType(uint32 type, uint32 type_class) {
return (type - 1) + type_class * 20;
}
-uint32 CalcFieldNum(const FieldGenerator&, const FieldDescriptor* field,
- const Options& options) {
+uint32 CalcFieldNum(const FieldDescriptor* field, const Options& options) {
bool is_a_map = IsMapEntryMessage(field->containing_type());
int type = field->type();
if (field->containing_oneof()) {
@@ -1486,16 +1766,9 @@ uint32 CalcFieldNum(const FieldGenerator&, const FieldDescriptor* field,
#else
// We need to calculate for each field what function the table driven code
// should use to serialize it. This returns the index in a lookup table.
-uint32 CalcFieldNum(const FieldGenerator& generator,
- const FieldDescriptor* field, const Options& options) {
+uint32 CalcFieldNum(const FieldDescriptor* field, const Options& options) {
bool is_a_map = IsMapEntryMessage(field->containing_type());
int type = field->type();
- if (type == FieldDescriptor::TYPE_STRING ||
- type == FieldDescriptor::TYPE_BYTES) {
- if (generator.IsInlined()) {
- type = internal::FieldMetadata::kInlinedType;
- }
- }
if (field->containing_oneof()) {
return internal::FieldMetadata::CalculateType(
type, internal::FieldMetadata::kOneOf);
@@ -1531,40 +1804,43 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) {
return 0;
}
- string full_classname = QualifiedClassName(descriptor_);
-
std::vector<const FieldDescriptor*> sorted = SortFieldsByNumber(descriptor_);
if (IsMapEntryMessage(descriptor_)) {
for (int i = 0; i < 2; i++) {
const FieldDescriptor* field = sorted[i];
- const FieldGenerator& generator = field_generators_.get(field);
-
uint32 tag = internal::WireFormatLite::MakeTag(
field->number(), WireFormat::WireTypeForFieldType(field->type()));
std::map<string, string> vars;
- vars["classname"] = QualifiedClassName(descriptor_);
+ vars["classname"] = classname_;
+ vars["parent_classname"] =
+ ClassName(descriptor_->containing_type(), false);
vars["field_name"] = FieldName(field);
vars["tag"] = SimpleItoa(tag);
vars["hasbit"] = SimpleItoa(i);
- vars["type"] = SimpleItoa(CalcFieldNum(generator, field, options_));
+ vars["type"] = SimpleItoa(CalcFieldNum(field, options_));
vars["ptr"] = "NULL";
if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
GOOGLE_CHECK(!IsMapEntryMessage(field->message_type()));
{
vars["ptr"] =
- "::" + FileLevelNamespace(field->message_type()) +
+ QualifiedFileLevelSymbol(
+ field->message_type()->file()->package(),
+ FileLevelNamespace(field->message_type()->file()->name())) +
"::TableStruct::serialization_table + " +
SimpleItoa(FindMessageIndexInFile(field->message_type()));
}
}
+ vars["extra"] = HasDescriptorMethods(descriptor_->file(), options_)
+ ? "::SuperType"
+ : "";
printer->Print(vars,
"{GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET("
- "::google::protobuf::internal::MapEntryHelper<$classname$::"
- "SuperType>, $field_name$_), $tag$,"
+ "::google::protobuf::internal::MapEntryHelper<$parent_classname$::$"
+ "classname$$extra$>, $field_name$_), $tag$,"
"GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET("
- "::google::protobuf::internal::MapEntryHelper<$classname$::"
- "SuperType>, _has_bits_) * 8 + $hasbit$, $type$, "
+ "::google::protobuf::internal::MapEntryHelper<$parent_classname$::$"
+ "classname$$extra$>, _has_bits_) * 8 + $hasbit$, $type$, "
"$ptr$},\n");
}
return 2;
@@ -1572,7 +1848,7 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) {
printer->Print(
"{GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, "
"_cached_size_), 0, 0, 0, NULL},\n",
- "classname", full_classname);
+ "classname", classname_);
std::vector<const Descriptor::ExtensionRange*> sorted_extensions;
for (int i = 0; i < descriptor_->extension_range_count(); ++i) {
sorted_extensions.push_back(descriptor_->extension_range(i));
@@ -1592,7 +1868,7 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) {
"::google::protobuf::internal::FieldMetadata::kSpecial, "
"reinterpret_cast<const "
"void*>(::google::protobuf::internal::ExtensionSerializer)},\n",
- "classname", full_classname, "start", SimpleItoa(range->start), "end",
+ "classname", classname_, "start", SimpleItoa(range->start), "end",
SimpleItoa(range->end));
}
if (i == sorted.size()) break;
@@ -1610,14 +1886,14 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) {
classfieldname = field->containing_oneof()->name();
}
std::map<string, string> vars;
- vars["classname"] = full_classname;
+ vars["classname"] = classname_;
vars["field_name"] = classfieldname;
vars["tag"] = SimpleItoa(tag);
vars["ptr"] = "NULL";
if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
if (IsMapEntryMessage(field->message_type())) {
vars["idx"] = SimpleItoa(FindMessageIndexInFile(field->message_type()));
- vars["fieldclassname"] = QualifiedClassName(field->message_type());
+ vars["fieldclassname"] = ClassName(field->message_type(), false);
printer->Print(vars,
"{GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($"
"classname$, $field_name$_), $tag$, $idx$, "
@@ -1625,20 +1901,20 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) {
"reinterpret_cast<const void*>(static_cast< "
"::google::protobuf::internal::SpecialSerializer>("
"::google::protobuf::internal::MapFieldSerializer< "
- "::google::protobuf::internal::MapEntryToMapField<"
- "$fieldclassname$>::MapFieldType, "
+ "::google::protobuf::internal::MapEntryToMapField<$classname$::$"
+ "fieldclassname$>::MapFieldType, "
"TableStruct::serialization_table>))},\n");
continue;
} else {
vars["ptr"] =
- "::" + FileLevelNamespace(field->message_type()) +
+ QualifiedFileLevelSymbol(
+ field->message_type()->file()->package(),
+ FileLevelNamespace(field->message_type()->file()->name())) +
"::TableStruct::serialization_table + " +
SimpleItoa(FindMessageIndexInFile(field->message_type()));
}
}
-
- const FieldGenerator& generator = field_generators_.get(field);
- vars["type"] = SimpleItoa(CalcFieldNum(generator, field, options_));
+ vars["type"] = SimpleItoa(CalcFieldNum(field, options_));
if (field->options().weak()) {
@@ -1684,20 +1960,40 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) {
"_internal_metadata_), 0, ~0u, "
"::google::protobuf::internal::FieldMetadata::kSpecial, reinterpret_cast<const "
"void*>($serializer$)},\n",
- "classname", full_classname, "serializer", serializer);
+ "classname", classname_, "serializer", serializer);
return num_field_metadata;
}
-void MessageGenerator::GenerateFieldDefaultInstances(io::Printer* printer) {
- // Construct the default instances for all fields that need one.
+void MessageGenerator::
+GenerateDefaultInstanceAllocator(io::Printer* printer) {
+ // Construct the default instances of all fields, as they will be used
+ // when creating the default instance of the entire message.
for (int i = 0; i < descriptor_->field_count(); i++) {
field_generators_.get(descriptor_->field(i))
.GenerateDefaultInstanceAllocator(printer);
}
+
+ // Construct the default instance. We can't call InitAsDefaultInstance() yet
+ // because we need to make sure all default instances that this one might
+ // depend on are constructed first.
+ printer->Print("_$classname$_default_instance_._instance.DefaultConstruct();\n"
+ "::google::protobuf::internal::OnShutdownDestroyMessage(\n"
+ " &_$classname$_default_instance_);",
+ "classname", classname_);
}
void MessageGenerator::
GenerateDefaultInstanceInitializer(io::Printer* printer) {
+ if (IsMapEntryMessage(descriptor_)) {
+ printer->Print(
+ "_$classname$_default_instance_._instance.get_mutable()->set_default_instance(_$"
+ "classname$_default_instance_._instance.get_mutable());\n"
+ "_$classname$_default_instance_._instance.get_mutable()->InitAsDefaultInstance();"
+ "\n",
+ "classname", classname_);
+ return;
+ }
+
// The default instance needs all of its embedded message pointers
// cross-linked to other default instances. We can't do this initialization
// in the constructor because some other default instances may not have been
@@ -1720,11 +2016,10 @@ GenerateDefaultInstanceInitializer(io::Printer* printer) {
}
name += FieldName(field);
printer->Print(
- "$ns$::$name$_ = const_cast< $type$*>(\n"
+ "$name$_ = const_cast< $type$*>(\n"
" $type$::internal_default_instance());\n",
// Vars.
- "name", name, "type", FieldMessageTypeName(field), "ns",
- Namespace(descriptor_));
+ "name", name, "type", FieldMessageTypeName(field));
} else if (field->containing_oneof() &&
HasDescriptorMethods(descriptor_->file(), options_)) {
field_generators_.get(descriptor_->field(i))
@@ -1736,41 +2031,31 @@ GenerateDefaultInstanceInitializer(io::Printer* printer) {
void MessageGenerator::
GenerateClassMethods(io::Printer* printer) {
if (IsMapEntryMessage(descriptor_)) {
- printer->Print(
- "$classname$::$classname$() {}\n"
- "$classname$::$classname$(::google::protobuf::Arena* arena) : "
- "SuperType(arena) {}\n"
- "void $classname$::MergeFrom(const $classname$& other) {\n"
- " MergeFromInternal(other);\n"
- "}\n",
- "classname", classname_);
if (HasDescriptorMethods(descriptor_->file(), options_)) {
printer->Print(
- "::google::protobuf::Metadata $classname$::GetMetadata() const {\n"
- " ::$file_namespace$::protobuf_AssignDescriptorsOnce();\n"
- " return ::$file_namespace$::file_level_metadata[$index$];\n"
+ "$parent$::$classname$::$classname$() {}\n"
+ "$parent$::$classname$::$classname$(::google::protobuf::Arena* arena) : "
+ "SuperType(arena) {}\n"
+ "::google::protobuf::Metadata $parent$::$classname$::GetMetadata() const {\n"
+ " $file_namespace$::protobuf_AssignDescriptorsOnce();\n"
+ " return $file_namespace$::file_level_metadata[$index$];\n"
"}\n"
- "void $classname$::MergeFrom(\n"
+ "void $parent$::$classname$::MergeFrom(\n"
" const ::google::protobuf::Message& other) {\n"
" ::google::protobuf::Message::MergeFrom(other);\n"
"}\n"
+ "void $parent$::$classname$::MergeFrom(const $classname$& other) {\n"
+ " MergeFromInternal(other);\n"
+ "}\n"
"\n",
- "file_namespace", FileLevelNamespace(descriptor_),
+ "file_namespace", FileLevelNamespace(descriptor_->file()->name()),
+ "parent", ClassName(descriptor_->containing_type(), false),
"classname", classname_, "index",
SimpleItoa(index_in_file_messages_));
}
return;
}
- // TODO(gerbens) Remove this function. With a little bit of cleanup and
- // refactoring this is superfluous.
- printer->Print("void $classname$::InitAsDefaultInstance() {\n", "classname",
- classname_);
- printer->Indent();
- GenerateDefaultInstanceInitializer(printer);
- printer->Outdent();
- printer->Print("}\n");
-
if (IsAnyMessage(descriptor_)) {
printer->Print(
"void $classname$::PackFrom(const ::google::protobuf::Message& message) {\n"
@@ -1785,28 +2070,14 @@ GenerateClassMethods(io::Printer* printer) {
"bool $classname$::UnpackTo(::google::protobuf::Message* message) const {\n"
" return _any_metadata_.UnpackTo(message);\n"
"}\n"
- "bool $classname$::ParseAnyTypeUrl(const string& type_url,\n"
- " string* full_type_name) {\n"
- " return ::google::protobuf::internal::ParseAnyTypeUrl(type_url,\n"
- " full_type_name);\n"
- "}\n"
"\n",
"classname", classname_);
}
// Generate non-inline field definitions.
for (int i = 0; i < descriptor_->field_count(); i++) {
- const FieldDescriptor* field = descriptor_->field(i);
- field_generators_.get(field)
+ field_generators_.get(descriptor_->field(i))
.GenerateNonInlineAccessorDefinitions(printer);
- if (IsCrossFileMaybeMap(field)) {
- std::map<string, string> vars;
- SetCommonFieldVariables(field, &vars, options_);
- if (field->containing_oneof()) {
- SetCommonOneofFieldVariables(field, &vars);
- }
- GenerateFieldClear(field, vars, false, printer);
- }
}
// Generate field number constants.
@@ -1863,24 +2134,23 @@ GenerateClassMethods(io::Printer* printer) {
if (options_.table_driven_serialization) {
printer->Print(
- "const void* $classname$::InternalGetTable() const {\n"
- " return ::$file_namespace$::TableStruct::serialization_table + "
- "$index$;\n"
- "}\n"
- "\n",
- "classname", classname_, "index", SimpleItoa(index_in_file_messages_),
- "file_namespace", FileLevelNamespace(descriptor_));
+ "const void* $classname$::InternalGetTable() const {\n"
+ " return $file_namespace$::TableStruct::serialization_table + $index$;\n"
+ "}\n"
+ "\n",
+ "classname", classname_, "index", SimpleItoa(index_in_file_messages_),
+ "file_namespace", FileLevelNamespace(descriptor_->file()->name()));
}
if (HasDescriptorMethods(descriptor_->file(), options_)) {
printer->Print(
"::google::protobuf::Metadata $classname$::GetMetadata() const {\n"
" $file_namespace$::protobuf_AssignDescriptorsOnce();\n"
- " return ::"
+ " return "
"$file_namespace$::file_level_metadata[kIndexInFileMessages];\n"
"}\n"
"\n",
"classname", classname_, "file_namespace",
- FileLevelNamespace(descriptor_));
+ FileLevelNamespace(descriptor_->file()->name()));
} else {
printer->Print(
"::std::string $classname$::GetTypeName() const {\n"
@@ -1927,26 +2197,16 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) {
}
processing_type = static_cast<unsigned>(field->type());
- const FieldGenerator& generator = field_generators_.get(field);
if (field->type() == FieldDescriptor::TYPE_STRING) {
switch (EffectiveStringCType(field)) {
case FieldOptions::STRING:
- default: {
- if (generator.IsInlined()) {
- processing_type = internal::TYPE_STRING_INLINED;
- break;
- }
+ default:
break;
- }
}
} else if (field->type() == FieldDescriptor::TYPE_BYTES) {
switch (EffectiveStringCType(field)) {
case FieldOptions::STRING:
default:
- if (generator.IsInlined()) {
- processing_type = internal::TYPE_BYTES_INLINED;
- break;
- }
break;
}
}
@@ -1964,7 +2224,7 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) {
WireFormat::TagSize(field->number(), field->type());
std::map<string, string> vars;
- vars["classname"] = QualifiedClassName(descriptor_);
+ vars["classname"] = classname_;
if (field->containing_oneof() != NULL) {
vars["name"] = field->containing_oneof()->name();
vars["presence"] = SimpleItoa(field->containing_oneof()->index());
@@ -1981,7 +2241,7 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) {
"{\n"
" GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n"
" $classname$, $name$_),\n"
- " static_cast<::google::protobuf::uint32>($presence$),\n"
+ " static_cast< ::google::protobuf::uint32>($presence$),\n"
" $nwtype$, $pwtype$, $ptype$, $tag_size$\n"
"},\n");
}
@@ -2020,8 +2280,23 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) {
last_field_number++;
break;
case FieldDescriptor::CPPTYPE_MESSAGE: {
+ std::vector<string> package_parts;
+
+ const Descriptor* outer = field->message_type();
+ while (outer->containing_type() != NULL) {
+ outer = outer->containing_type();
+ }
+
+ package_parts = Split(
+ outer->full_name(), ".", true);
+ // outer->full_name() contains the class itself. Remove it as it is
+ // used in the name of the default instance variable.
+ GOOGLE_DCHECK_NE(package_parts.size(), 0);
+ package_parts.back().clear();
+
if (field->is_map()) {
- vars["classname"] = QualifiedClassName(field->message_type());
+ vars["classname"] = ClassName(field->containing_type(), false) +
+ "::" + ClassName(field->message_type(), false);
printer->Print(vars,
"{::google::protobuf::internal::AuxillaryParseTableField::map_"
"aux{&::google::protobuf::internal::ParseMap<$classname$>}},\n");
@@ -2030,15 +2305,26 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) {
} else {
vars["classname"] = ClassName(field->message_type(), false);
}
- vars["ns"] = Namespace(field->message_type());
+ vars["ns"] = Join(package_parts, "::");
vars["type"] = FieldMessageTypeName(field);
- vars["file_namespace"] =
- FileLevelNamespace(field->message_type());
+ vars["file_namespace"] = FileLevelNamespace(outer->file()->name());
- printer->Print(
- vars,
+ printer->Print(vars,
"{::google::protobuf::internal::AuxillaryParseTableField::message_aux{\n"
- " &$ns$::_$classname$_default_instance_}},\n");
+ " &::$ns$_$classname$_default_instance_,\n");
+
+ bool dont_emit_table =
+ !TableDrivenParsingEnabled(field->message_type(), options_);
+
+ if (dont_emit_table) {
+ printer->Print(" NULL,\n");
+ } else {
+ printer->Print(vars,
+ " ::$ns$$file_namespace$::TableStruct::schema +\n"
+ " ::$ns$$classname$::kIndexInFileMessages,\n");
+ }
+
+ printer->Print("}},\n");
last_field_number++;
break;
}
@@ -2047,9 +2333,8 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) {
case FieldOptions::STRING:
vars["default"] =
field->default_value_string().empty()
- ? "&::google::protobuf::internal::fixed_address_empty_string"
- : "&" + Namespace(field) + " ::" + classname_ +
- "::" + MakeDefaultName(field);
+ ? "&::google::protobuf::internal::fixed_address_empty_string"
+ : "&" + classname_ + "::_default_" + FieldName(field) + "_";
break;
case FieldOptions::CORD:
case FieldOptions::STRING_PIECE:
@@ -2075,11 +2360,11 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) {
std::pair<size_t, size_t> MessageGenerator::GenerateOffsets(
io::Printer* printer) {
+ if (IsMapEntryMessage(descriptor_)) return std::make_pair(0, 0);
std::map<string, string> variables;
- string full_classname = QualifiedClassName(descriptor_);
- variables["classname"] = full_classname;
+ variables["classname"] = classname_;
- if (HasFieldPresence(descriptor_->file()) || IsMapEntryMessage(descriptor_)) {
+ if (HasFieldPresence(descriptor_->file())) {
printer->Print(
variables,
"GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, "
@@ -2120,35 +2405,27 @@ std::pair<size_t, size_t> MessageGenerator::GenerateOffsets(
for (int i = 0; i < descriptor_->field_count(); i++) {
const FieldDescriptor* field = descriptor_->field(i);
if (field->containing_oneof() || field->options().weak()) {
- printer->Print("offsetof($classname$DefaultTypeInternal, $name$_)",
- "classname", full_classname, "name", FieldName(field));
+ printer->Print(
+ "offsetof($classname$DefaultTypeInternal, $name$_),\n",
+ "classname", classname_, "name", FieldName(field));
} else {
printer->Print(
- "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, $name$_)",
- "classname", full_classname, "name", FieldName(field));
- }
-
- uint32 tag = field_generators_.get(field).CalculateFieldTag();
- if (tag != 0) {
- printer->Print(" | $tag$", "tag", SimpleItoa(tag));
+ "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, "
+ "$name$_),\n",
+ "classname", classname_,
+ "name", FieldName(field));
}
-
- printer->Print(",\n");
}
for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
const OneofDescriptor* oneof = descriptor_->oneof_decl(i);
printer->Print(
- "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, $name$_),\n",
- "classname", full_classname, "name", oneof->name());
+ "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, $name$_),\n",
+ "classname", classname_,
+ "name", oneof->name());
}
- if (IsMapEntryMessage(descriptor_)) {
- entries += 2;
- printer->Print(
- "0,\n"
- "1,\n");
- } else if (HasFieldPresence(descriptor_->file())) {
+ if (HasFieldPresence(descriptor_->file())) {
entries += has_bit_indices_.size();
for (int i = 0; i < has_bit_indices_.size(); i++) {
const string index = has_bit_indices_[i] >= 0 ?
@@ -2167,6 +2444,15 @@ GenerateSharedConstructorCode(io::Printer* printer) {
"classname", classname_);
printer->Indent();
+ bool need_to_clear_cached_size = true;
+ // 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_ = 0;\n");
+ need_to_clear_cached_size = false;
+ }
+
std::vector<bool> processed(optimized_order_.size(), false);
GenerateConstructorBody(printer, processed, false);
@@ -2176,6 +2462,10 @@ GenerateSharedConstructorCode(io::Printer* printer) {
"oneof_name", descriptor_->oneof_decl(i)->name());
}
+ if (need_to_clear_cached_size) {
+ printer->Print("_cached_size_ = 0;\n");
+ }
+
printer->Outdent();
printer->Print("}\n\n");
}
@@ -2187,9 +2477,16 @@ GenerateSharedDestructorCode(io::Printer* printer) {
"classname", classname_);
printer->Indent();
if (SupportsArenas(descriptor_)) {
+ // Do nothing when the message is allocated in an arena.
printer->Print(
- "GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);\n");
+ "::google::protobuf::Arena* arena = GetArenaNoVirtual();\n"
+ "GOOGLE_DCHECK(arena == NULL);\n"
+ "if (arena != NULL) {\n"
+ " return;\n"
+ "}\n"
+ "\n");
}
+
// Write the destructors for each field except oneof members.
// optimized_order_ does not contain oneof fields.
for (int i = 0; i < optimized_order_.size(); i++) {
@@ -2359,7 +2656,12 @@ void MessageGenerator::GenerateConstructorBody(io::Printer* printer,
void MessageGenerator::
GenerateStructors(io::Printer* printer) {
string superclass;
- superclass = SuperClassName(descriptor_, options_);
+ if (use_dependent_base_) {
+ superclass =
+ DependentBaseClassTemplateName(descriptor_) + "<" + classname_ + ">";
+ } else {
+ superclass = SuperClassName(descriptor_, options_);
+ }
string initializer_with_arena = superclass + "()";
if (descriptor_->extension_range_count() > 0) {
@@ -2391,143 +2693,143 @@ GenerateStructors(io::Printer* printer) {
initializer_null += ", _any_metadata_(&type_url_, &value_)";
}
if (num_weak_fields_ > 0) {
- initializer_null += ", _weak_field_map_(nullptr)";
+ initializer_null += ", _weak_field_map_(NULL)";
}
printer->Print(
"$classname$::$classname$()\n"
" : $initializer$ {\n"
- " ::google::protobuf::internal::InitSCC(\n"
- " &$file_namespace$::scc_info_$scc_name$.base);\n"
+ " if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {\n"
+ " $file_namespace$::InitDefaults();\n"
+ " }\n"
" SharedCtor();\n"
" // @@protoc_insertion_point(constructor:$full_name$)\n"
"}\n",
"classname", classname_, "full_name", descriptor_->full_name(),
- "scc_name", scc_name_, "initializer", initializer_null, "file_namespace",
- FileLevelNamespace(descriptor_));
+ "initializer", initializer_null, "file_namespace",
+ FileLevelNamespace(descriptor_->file()->name()));
if (SupportsArenas(descriptor_)) {
printer->Print(
"$classname$::$classname$(::google::protobuf::Arena* arena)\n"
" : $initializer$ {\n"
- " "
- "::google::protobuf::internal::InitSCC(&$file_namespace$::scc_info_$scc_name$."
- "base);\n"
+ " $file_namespace$::InitDefaults();\n"
" SharedCtor();\n"
" RegisterArenaDtor(arena);\n"
" // @@protoc_insertion_point(arena_constructor:$full_name$)\n"
"}\n",
"initializer", initializer_with_arena, "classname", classname_,
"superclass", superclass, "full_name", descriptor_->full_name(),
- "scc_name", scc_name_, "file_namespace",
- FileLevelNamespace(descriptor_));
+ "file_namespace", FileLevelNamespace(descriptor_->file()->name()));
}
// Generate the copy constructor.
- 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(
+ "$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_)");
+ }
- std::vector<bool> processed(optimized_order_.size(), false);
- for (int i = 0; i < optimized_order_.size(); ++i) {
- const FieldDescriptor* field = optimized_order_[i];
+ 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;
+ }
- if (!(field->is_repeated() && !(field->is_map()))
- ) {
- continue;
- }
+ std::vector<bool> processed(optimized_order_.size(), false);
+ for (int i = 0; i < optimized_order_.size(); ++i) {
+ const FieldDescriptor* field = optimized_order_[i];
- processed[i] = true;
- printer->Print(",\n$name$_(from.$name$_)",
- "name", FieldName(field));
+ if (!(field->is_repeated() && !(field->is_map()))
+ ) {
+ continue;
}
- 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_)");
- }
+ processed[i] = true;
+ printer->Print(",\n$name$_(from.$name$_)",
+ "name", FieldName(field));
+ }
- printer->Outdent();
- printer->Outdent();
- printer->Print(" {\n");
+ if (need_to_emit_cached_size) {
+ printer->Print(cached_size_decl.c_str());
+ need_to_emit_cached_size = false;
+ }
- printer->Print(
- "_internal_metadata_.MergeFrom(from._internal_metadata_);\n");
+ 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 (descriptor_->extension_range_count() > 0) {
- printer->Print("_extensions_.MergeFrom(from._extensions_);\n");
- }
+ printer->Outdent();
+ printer->Outdent();
+ printer->Print(" {\n");
+
+ printer->Print(
+ "_internal_metadata_.MergeFrom(from._internal_metadata_);\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) {
+ // 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);
printer->Print(
- "clear_has_$oneofname$();\n"
- "switch (from.$oneofname$_case()) {\n",
- "oneofname", descriptor_->oneof_decl(i)->name());
+ "case k$field_name$: {\n",
+ "field_name", UnderscoresToCamelCase(field->name(), true));
printer->Indent();
- 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");
- }
+ field_generators_.get(field).GenerateMergingCode(printer);
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()));
+ "break;\n");
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(
- " // @@protoc_insertion_point(copy_constructor:$full_name$)\n"
- "}\n"
- "\n",
- "full_name", descriptor_->full_name());
+ "}\n");
}
+ 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);
@@ -2551,46 +2853,53 @@ GenerateStructors(io::Printer* printer) {
// Generate SetCachedSize.
printer->Print(
- "void $classname$::SetCachedSize(int size) const {\n"
- " _cached_size_.Set(size);\n"
- "}\n",
- "classname", classname_);
+ "void $classname$::SetCachedSize(int size) const {\n"
+ " GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n"
+ " _cached_size_ = size;\n"
+ " GOOGLE_SAFE_CONCURRENT_WRITES_END();\n"
+ "}\n",
+ "classname", classname_);
// Only generate this member if it's not disabled.
if (HasDescriptorMethods(descriptor_->file(), options_) &&
!descriptor_->options().no_standard_descriptor_accessor()) {
printer->Print(
"const ::google::protobuf::Descriptor* $classname$::descriptor() {\n"
- " ::$file_namespace$::protobuf_AssignDescriptorsOnce();\n"
- " return ::"
+ " $file_namespace$::protobuf_AssignDescriptorsOnce();\n"
+ " return "
"$file_namespace$::file_level_metadata[kIndexInFileMessages]."
"descriptor;\n"
"}\n"
"\n",
"classname", classname_, "file_namespace",
- FileLevelNamespace(descriptor_));
+ FileLevelNamespace(descriptor_->file()->name()));
}
printer->Print(
"const $classname$& $classname$::default_instance() {\n"
- " "
- "::google::protobuf::internal::InitSCC(&$file_namespace$::scc_info_$scc_name$.base)"
- ";\n"
+ " $file_namespace$::InitDefaults();\n"
" return *internal_default_instance();\n"
"}\n\n",
- "classname", classname_, "scc_name", scc_name_, "file_namespace",
- FileLevelNamespace(descriptor_));
-}
+ "classname", classname_, "file_namespace",
+ FileLevelNamespace(descriptor_->file()->name()));
-void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* printer) {
- printer->Print(
- "template<> "
- "GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE "
- "$classname$* Arena::CreateMaybeMessage< $classname$ >(Arena* arena) {\n"
- " return Arena::$create_func$Internal< $classname$ >(arena);\n"
+ if (SupportsArenas(descriptor_)) {
+ printer->Print(
+ "$classname$* $classname$::New(::google::protobuf::Arena* arena) const {\n"
+ " return ::google::protobuf::Arena::CreateMessage<$classname$>(arena);\n"
"}\n",
- "classname", QualifiedClassName(descriptor_),
- "create_func", MessageCreateFunction(descriptor_));
+ "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"
+ "}\n",
+ "classname", classname_);
+ }
}
// Return the number of bits set in n, a non-negative integer.
@@ -2621,9 +2930,6 @@ bool MessageGenerator::MaybeGenerateOptionalFieldCondition(
void MessageGenerator::
GenerateClear(io::Printer* printer) {
- // Performance tuning parameters
- const int kMaxUnconditionalPrimitiveBytesClear = 4;
-
printer->Print(
"void $classname$::Clear() {\n"
"// @@protoc_insertion_point(message_clear_start:$full_name$)\n",
@@ -2644,173 +2950,186 @@ GenerateClear(io::Printer* printer) {
printer->Print("_extensions_.Clear();\n");
}
- int unconditional_budget = kMaxUnconditionalPrimitiveBytesClear;
- for (int i = 0; i < optimized_order_.size(); i++) {
- const FieldDescriptor* field = optimized_order_[i];
+ int last_i = -1;
+ for (int i = 0; i < optimized_order_.size(); ) {
+ // Detect infinite loops.
+ GOOGLE_CHECK_NE(i, last_i);
+ last_i = i;
- if (!CanInitializeByZeroing(field)) {
- continue;
+ // 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 (!field->is_repeated()) {
+ break;
+ }
+
+ if (use_dependent_base_ && IsFieldDependent(field)) {
+ printer->Print("clear_$name$();\n", "name", FieldName(field));
+ } else {
+ generator.GenerateMessageClearingCode(printer);
+ }
}
- unconditional_budget -= EstimateAlignmentSize(field);
- }
+ // 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;
- std::vector<std::vector<const FieldDescriptor*> > chunks_frag = CollectFields(
- optimized_order_,
- MatchRepeatedAndHasByteAndZeroInits(
- &has_bit_indices_, HasFieldPresence(descriptor_->file())));
+ int memset_run_start = -1;
+ int memset_run_end = -1;
+ for (; i < optimized_order_.size(); i++) {
+ const FieldDescriptor* field = optimized_order_[i];
- // 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() : nullptr;
- if (CanInitializeByZeroing(field) &&
- (chunks_frag[i].size() == 1 || unconditional_budget < 0) &&
- next_field != nullptr &&
- 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++;
+ if (!CanInitializeByZeroing(field)) {
+ break;
}
- }
- }
- for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) {
- std::vector<const FieldDescriptor*>& chunk = chunks[chunk_index];
- GOOGLE_CHECK(!chunk.empty());
+ // "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;
- // Step 2: Repeated fields don't use _has_bits_; emit code to clear them
- // here.
- 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 (last_chunk == -1) {
+ last_chunk = chunk;
+ last_chunk_start = i;
+ } else if (chunk != last_chunk) {
+ // Emit the fields for this chunk so far.
+ break;
+ }
- generator.GenerateMessageClearingCode(printer);
+ if (memset_run_start == -1) {
+ memset_run_start = i;
}
- continue;
+
+ memset_run_end = i;
+ last_chunk_end = i;
+ last_chunk_mask |= static_cast<uint32>(1) << (index % 32);
}
- // 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;
+ // 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;
+ }
- 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;
+ // "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;
}
+
+ last_chunk_end = i;
+ last_chunk_mask |= static_cast<uint32>(1) << (index % 32);
}
- const bool have_outer_if =
- HasFieldPresence(descriptor_->file()) && chunk.size() > 1 &&
- (memset_run_end != chunk.size() - 1 || unconditional_budget < 0);
+ 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);
- if (have_outer_if) {
- uint32 last_chunk_mask = GenChunkMask(chunk, has_bit_indices_);
const int count = popcnt(last_chunk_mask);
+ const bool have_outer_if = HasFieldPresence(descriptor_->file()) &&
+ (last_chunk_start != last_chunk_end);
- // 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 (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 (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));
+ 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();
}
- 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(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 (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(
+ 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);
- }
+ "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;
- }
+ // 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);
+ // 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);
- // 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));
+ bool have_enclosing_if = false;
+ if (should_check_bit &&
+ // If no field presence, then always clear strings/messages as well.
+ HasFieldPresence(descriptor_->file())) {
+ if (!MaybeGenerateOptionalFieldCondition(printer, field,
+ cached_has_bit_index)) {
+ printer->Print(
+ "if (has_$name$()) {\n",
+ "name", fieldname);
+ }
+ printer->Indent();
+ have_enclosing_if = true;
}
- if (!MaybeGenerateOptionalFieldCondition(printer, field,
- cached_has_bit_index)) {
- printer->Print("if (has_$name$()) {\n", "name", fieldname);
+
+ generator.GenerateMessageClearingCode(printer);
+
+ if (have_enclosing_if) {
+ printer->Outdent();
+ printer->Print("}\n");
}
- printer->Indent();
- have_enclosing_if = true;
}
- generator.GenerateMessageClearingCode(printer);
-
- if (have_enclosing_if) {
+ if (have_outer_if) {
printer->Outdent();
printer->Print("}\n");
}
}
-
- if (have_outer_if) {
- printer->Outdent();
- printer->Print("}\n");
- }
}
// Step 4: Unions.
@@ -2960,6 +3279,7 @@ GenerateSwap(io::Printer* printer) {
printer->Print("_internal_metadata_.Swap(&other->_internal_metadata_);\n");
+ printer->Print("swap(_cached_size_, other->_cached_size_);\n");
if (descriptor_->extension_range_count() > 0) {
printer->Print("_extensions_.Swap(&other->_extensions_);\n");
}
@@ -3275,6 +3595,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
"}\n");
return;
}
+
std::vector<const FieldDescriptor*> ordered_fields =
SortFieldsByNumber(descriptor_);
@@ -3292,11 +3613,12 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
printer->Print(
"return ::google::protobuf::internal::MergePartialFromCodedStream$lite$(\n"
" this,\n"
- " ::$file_namespace$::TableStruct::schema[\n"
+ " $file_namespace$::TableStruct::schema[\n"
" $classname$::kIndexInFileMessages],\n"
" input);\n",
- "classname", classname_, "file_namespace",
- FileLevelNamespace(descriptor_), "lite", lite);
+ "classname", classname_,
+ "file_namespace", FileLevelNamespace(descriptor_->file()->name()),
+ "lite", lite);
printer->Outdent();
@@ -3304,32 +3626,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_)) {
+ // Use LazyStringOutputString to avoid initializing unknown fields string
+ // unless it is actually needed. For the same reason, disable eager refresh
+ // on the CodedOutputStream.
printer->Print(
- " ::google::protobuf::internal::LiteUnknownFieldSetter unknown_fields_setter(\n"
- " &_internal_metadata_);\n"
- " ::google::protobuf::io::StringOutputStream unknown_fields_output(\n"
- " unknown_fields_setter.buffer());\n"
- " ::google::protobuf::io::CodedOutputStream unknown_fields_stream(\n"
- " &unknown_fields_output, false);\n",
- "classname", classname_);
+ " ::google::protobuf::io::LazyStringOutputStream unknown_fields_string(\n"
+ " ::google::protobuf::NewPermanentCallback(&_internal_metadata_,\n"
+ " &::google::protobuf::internal::InternalMetadataWithArenaLite::\n"
+ " mutable_unknown_fields));\n"
+ " ::google::protobuf::io::CodedOutputStream unknown_fields_stream(\n"
+ " &unknown_fields_string, false);\n",
+ "classname", classname_);
}
printer->Print(
@@ -3340,12 +3652,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
printer->Print("for (;;) {\n");
printer->Indent();
- // To calculate the maximum tag to expect, we look at the highest-numbered
- // field. We need to be prepared to handle more than one wire type if that
- // field is a packable repeated field, so to simplify things we assume the
- // highest possible wire type of 5.
- uint32 maxtag =
- ordered_fields.empty() ? 0 : ordered_fields.back()->number() * 8 + 5;
+ uint32 maxtag = descriptor_->field_count() == 0 ? 0 :
+ WireFormat::MakeTag(ordered_fields[descriptor_->field_count() - 1]);
const int kCutoff0 = 127; // fits in 1-byte varint
const int kCutoff1 = (127 << 7) + 127; // fits in 2-byte varint
@@ -3363,15 +3671,6 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
break;
}
}
-
- for (int i = 0; i < parent->extension_count(); i++) {
- const FieldDescriptor* field = parent->extension(i);
- if (field->type() == FieldDescriptor::TYPE_GROUP &&
- field->message_type() == descriptor_) {
- capture_last_tag = true;
- break;
- }
- }
}
for (int i = 0; i < descriptor_->file()->extension_count(); i++) {
@@ -3383,7 +3682,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
}
}
- printer->Print("::std::pair<::google::protobuf::uint32, bool> p = "
+ printer->Print("::std::pair< ::google::protobuf::uint32, bool> p = "
"input->ReadTagWithCutoffNoLastTag($max$u);\n"
"tag = p.first;\n"
"if (!p.second) goto handle_unusual;\n",
@@ -3482,6 +3781,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
printer->Outdent();
printer->Print("}\n\n");
}
+
printer->Print("default: {\n");
printer->Indent();
}
@@ -3872,7 +4172,7 @@ GenerateSerializeWithCachedSizesBody(io::Printer* printer, bool to_array) {
// Merge the fields and the extension ranges, both sorted by field number.
{
LazySerializerEmitter e(this, printer, to_array);
- const FieldDescriptor* last_weak_field = nullptr;
+ const FieldDescriptor* last_weak_field = NULL;
int i, j;
for (i = 0, j = 0;
i < ordered_fields.size() || j < sorted_extensions.size();) {
@@ -3884,16 +4184,16 @@ GenerateSerializeWithCachedSizesBody(io::Printer* printer, bool to_array) {
last_weak_field = field;
PrintFieldComment(printer, field);
} else {
- if (last_weak_field != nullptr) {
+ if (last_weak_field != NULL) {
e.Emit(last_weak_field);
- last_weak_field = nullptr;
+ last_weak_field = NULL;
}
e.Emit(field);
}
} else {
- if (last_weak_field != nullptr) {
+ if (last_weak_field != NULL) {
e.Emit(last_weak_field);
- last_weak_field = nullptr;
+ last_weak_field = NULL;
}
e.Flush();
GenerateSerializeOneExtensionRange(printer,
@@ -3901,7 +4201,7 @@ GenerateSerializeWithCachedSizesBody(io::Printer* printer, bool to_array) {
to_array);
}
}
- if (last_weak_field != nullptr) {
+ if (last_weak_field != NULL) {
e.Emit(last_weak_field);
}
}
@@ -3963,9 +4263,8 @@ static string ConditionalToCheckBitmasks(const std::vector<uint32>& masks) {
}
GOOGLE_CHECK(!parts.empty());
// If we have multiple parts, each expected to be 0, then bitwise-or them.
- string result = parts.size() == 1
- ? parts[0]
- : StrCat("(", Join(parts, "\n | "), ")");
+ string result = parts.size() == 1 ? parts[0] :
+ StrCat("(", Join(parts, "\n | "), ")");
return result + " == 0";
}
@@ -3978,19 +4277,20 @@ GenerateByteSize(io::Printer* printer) {
SetUnknkownFieldsVariable(descriptor_, options_, &vars);
vars["classname"] = classname_;
vars["full_name"] = descriptor_->full_name();
- printer->Print(
- vars,
- "size_t $classname$::ByteSizeLong() const {\n"
- "// @@protoc_insertion_point(message_set_byte_size_start:$full_name$)\n"
- " size_t total_size = _extensions_.MessageSetByteSize();\n"
- " if ($have_unknown_fields$) {\n"
- " total_size += ::google::protobuf::internal::WireFormat::\n"
- " ComputeUnknownMessageSetItemsSize($unknown_fields$);\n"
- " }\n"
- " int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);\n"
- " SetCachedSize(cached_size);\n"
- " return total_size;\n"
- "}\n");
+ printer->Print(vars,
+ "size_t $classname$::ByteSizeLong() const {\n"
+ "// @@protoc_insertion_point(message_set_byte_size_start:$full_name$)\n"
+ " size_t total_size = _extensions_.MessageSetByteSize();\n"
+ " if ($have_unknown_fields$) {\n"
+ " total_size += ::google::protobuf::internal::WireFormat::\n"
+ " ComputeUnknownMessageSetItemsSize($unknown_fields$);\n"
+ " }\n"
+ " int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);\n"
+ " GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n"
+ " _cached_size_ = cached_size;\n"
+ " GOOGLE_SAFE_CONCURRENT_WRITES_END();\n"
+ " return total_size;\n"
+ "}\n");
return;
}
@@ -4091,30 +4391,28 @@ GenerateByteSize(io::Printer* printer) {
}
}
- std::vector<std::vector<const FieldDescriptor*> > chunks = CollectFields(
- optimized_order_,
- MatchRepeatedAndHasByteAndRequired(
- &has_bit_indices_, HasFieldPresence(descriptor_->file())));
-
- // Remove chunks with required fields.
- chunks.erase(std::remove_if(chunks.begin(), chunks.end(), IsRequired),
- chunks.end());
+ int last_i = -1;
+ for (int i = 0; i < optimized_order_.size(); ) {
+ // Detect infinite loops.
+ GOOGLE_CHECK_NE(i, last_i);
+ last_i = i;
- for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) {
- const std::vector<const FieldDescriptor*>& chunk = chunks[chunk_index];
- GOOGLE_CHECK(!chunk.empty());
+ // Skip required fields.
+ for (; i < optimized_order_.size() &&
+ optimized_order_[i]->is_required(); i++) {
+ }
// Handle repeated fields.
- 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");
+ for (; i < optimized_order_.size(); i++) {
+ const FieldDescriptor* field = optimized_order_[i];
+ if (!field->is_repeated()) {
+ break;
}
- continue;
+
+ PrintFieldComment(printer, field);
+ const FieldGenerator& generator = field_generators_.get(field);
+ generator.GenerateByteSize(printer);
+ printer->Print("\n");
}
// Handle optional (non-repeated/oneof) fields.
@@ -4126,62 +4424,92 @@ GenerateByteSize(io::Printer* printer) {
// descriptor_->field(8), descriptor_->field(9), ...
// descriptor_->field(15),
// etc.
- int last_chunk = HasFieldPresence(descriptor_->file())
- ? has_bit_indices_[chunk.front()->index()] / 8
- : 0;
- GOOGLE_DCHECK_NE(-1, last_chunk);
-
- const bool have_outer_if =
- HasFieldPresence(descriptor_->file()) && chunk.size() > 1;
+ 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;
+ }
- 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;
+ }
- printer->Print("if (_has_bits_[$index$ / 32] & $mask$u) {\n", "index",
- SimpleItoa(last_chunk * 8), "mask",
- SimpleItoa(last_chunk_mask));
- printer->Indent();
+ last_chunk_end = i;
+ last_chunk_mask |= static_cast<uint32>(1) << (index % 32);
}
- // 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 (last_chunk != -1) {
+ GOOGLE_DCHECK_NE(-1, last_chunk_start);
+ GOOGLE_DCHECK_NE(-1, last_chunk_end);
+ GOOGLE_DCHECK_NE(0, last_chunk_mask);
- PrintFieldComment(printer, field);
+ const int count = popcnt(last_chunk_mask);
+ const bool have_outer_if = HasFieldPresence(descriptor_->file()) &&
+ (last_chunk_start != last_chunk_end);
+
+ 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);
- bool have_enclosing_if = false;
- if (HasFieldPresence(descriptor_->file())) {
- printer->Print("if (has_$name$()) {\n", "name", FieldName(field));
+ printer->Print(
+ "if (_has_bits_[$index$ / 32] & $mask$u) {\n",
+ "index", SimpleItoa(last_chunk * 8),
+ "mask", SimpleItoa(last_chunk_mask));
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);
+ // 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);
- if (have_enclosing_if) {
- printer->Outdent();
- printer->Print(
+ 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);
+
+ 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");
+ }
}
}
@@ -4222,18 +4550,17 @@ GenerateByteSize(io::Printer* printer) {
printer->Print("total_size += _weak_field_map_.ByteSizeLong();\n");
}
- // We update _cached_size_ even though this is a const method. Because
- // const methods might be called concurrently this needs to be atomic
- // operations or the program is undefined. In practice, since any concurrent
- // writes will be writing the exact same value, normal writes will work on
- // all common processors. We use a dedicated wrapper class to abstract away
- // the underlying atomic. This makes it easier on platforms where even relaxed
- // memory order might have perf impact to replace it with ordinary loads and
- // stores.
+ // We update _cached_size_ even though this is a const method. In theory,
+ // this is not thread-compatible, because concurrent writes have undefined
+ // results. In practice, since any concurrent writes will be writing the
+ // exact same value, it works on all common processors. In a future version
+ // of C++, _cached_size_ should be made into an atomic<int>.
printer->Print(
- "int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);\n"
- "SetCachedSize(cached_size);\n"
- "return total_size;\n");
+ "int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);\n"
+ "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n"
+ "_cached_size_ = cached_size;\n"
+ "GOOGLE_SAFE_CONCURRENT_WRITES_END();\n"
+ "return total_size;\n");
printer->Outdent();
printer->Print("}\n");
@@ -4282,17 +4609,10 @@ GenerateIsInitialized(io::Printer* printer) {
!ShouldIgnoreRequiredFieldCheck(field, options_) &&
scc_analyzer_->HasRequiredFields(field->message_type())) {
if (field->is_repeated()) {
- if (IsImplicitWeakField(field, options_, scc_analyzer_)) {
- 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));
- }
+ 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/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message.h
index ca2ca2c90a..352069eb44 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message.h
@@ -36,11 +36,13 @@
#define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <set>
#include <string>
#include <google/protobuf/compiler/cpp/cpp_field.h>
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
-#include <google/protobuf/compiler/cpp/cpp_message_layout_helper.h>
#include <google/protobuf/compiler/cpp/cpp_options.h>
namespace google {
@@ -60,10 +62,12 @@ class ExtensionGenerator; // extension.h
class MessageGenerator {
public:
// See generator.cc for the meaning of dllexport_decl.
- MessageGenerator(const Descriptor* descriptor, int index_in_file_messages,
- const Options& options, SCCAnalyzer* scc_analyzer);
+ MessageGenerator(const Descriptor* descriptor, const Options& options,
+ SCCAnalyzer* scc_analyzer);
~MessageGenerator();
+ // Appends the pre-order walk of the nested generators to list.
+ void Flatten(std::vector<MessageGenerator*>* list);
// Append the two types of nested generators to the corresponding vector.
void AddGenerators(std::vector<EnumGenerator*>* enum_generators,
std::vector<ExtensionGenerator*>* extension_generators);
@@ -82,15 +86,18 @@ class MessageGenerator {
// Generate definitions of inline methods (placed at the end of the header
// file).
- void GenerateInlineMethods(io::Printer* printer);
+ void GenerateInlineMethods(io::Printer* printer, bool is_inline);
+
+ // Dependent methods are always inline.
+ void GenerateDependentInlineMethods(io::Printer* printer);
// Source file stuff.
// Generate extra fields
void GenerateExtraDefaultFields(io::Printer* printer);
- // Generates code that creates default instances for fields.
- void GenerateFieldDefaultInstances(io::Printer* printer);
+ // Generates code that allocates the message's default instance.
+ void GenerateDefaultInstanceAllocator(io::Printer* printer);
// Generates code that initializes the message's default instance. This
// is separate from allocating because all default instances must be
@@ -100,13 +107,13 @@ 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);
+ void GenerateDependentFieldAccessorDeclarations(io::Printer* printer);
void GenerateFieldAccessorDeclarations(io::Printer* printer);
- void GenerateFieldAccessorDefinitions(io::Printer* printer);
+ void GenerateDependentFieldAccessorDefinitions(io::Printer* printer);
+ void GenerateFieldAccessorDefinitions(io::Printer* printer, bool is_inline);
// Generate the table-driven parsing array. Returns the number of entries
// generated.
@@ -183,7 +190,7 @@ class MessageGenerator {
std::map<string, string> vars,
io::Printer* printer);
// Generates has_foo() functions and variables for oneof field has-bits.
- void GenerateOneofHasBits(io::Printer* printer);
+ void GenerateOneofHasBits(io::Printer* printer, bool is_inline);
// Generates has_foo_bar() functions for oneof members.
void GenerateOneofMemberHasBits(const FieldDescriptor* field,
const std::map<string, string>& vars,
@@ -191,7 +198,6 @@ class MessageGenerator {
// Generates the clear_foo() method for a field.
void GenerateFieldClear(const FieldDescriptor* field,
const std::map<string, string>& vars,
- bool is_inline,
io::Printer* printer);
void GenerateConstructorBody(io::Printer* printer,
@@ -202,7 +208,6 @@ class MessageGenerator {
std::vector<uint32> RequiredFieldsBitMask() const;
const Descriptor* descriptor_;
- int index_in_file_messages_;
string classname_;
Options options_;
FieldGeneratorMap field_generators_;
@@ -213,17 +218,18 @@ class MessageGenerator {
std::vector<const FieldDescriptor *> optimized_order_;
std::vector<int> has_bit_indices_;
int max_has_bit_index_;
- std::unique_ptr<std::unique_ptr<EnumGenerator> []> enum_generators_;
- std::unique_ptr<std::unique_ptr<ExtensionGenerator> []> extension_generators_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> > nested_generators_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<EnumGenerator> > enum_generators_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator> > extension_generators_;
int num_required_fields_;
+ bool use_dependent_base_;
int num_weak_fields_;
// table_driven_ indicates the generated message uses table-driven parsing.
bool table_driven_;
- std::unique_ptr<MessageLayoutHelper> message_layout_helper_;
+ int index_in_file_messages_;
SCCAnalyzer* scc_analyzer_;
- string scc_name_;
friend class FileGenerator;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message_field.cc
new file mode 100644
index 0000000000..da4c395034
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message_field.cc
@@ -0,0 +1,1138 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <google/protobuf/compiler/cpp/cpp_message_field.h>
+#include <google/protobuf/compiler/cpp/cpp_helpers.h>
+#include <google/protobuf/io/printer.h>
+
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace cpp {
+
+namespace {
+
+void SetMessageVariables(const FieldDescriptor* descriptor,
+ std::map<string, string>* variables,
+ const Options& options) {
+ SetCommonFieldVariables(descriptor, variables, options);
+ (*variables)["type"] = FieldMessageTypeName(descriptor);
+ (*variables)["type_default_instance"] =
+ DefaultInstanceName(descriptor->message_type());
+ if (descriptor->options().weak() || !descriptor->containing_oneof()) {
+ (*variables)["non_null_ptr_to_name"] =
+ StrCat("this->", (*variables)["name"], "_");
+ }
+ (*variables)["stream_writer"] =
+ (*variables)["declared_type"] +
+ (HasFastArraySerialization(descriptor->message_type()->file(), options)
+ ? "MaybeToArray"
+ : "");
+ // NOTE: Escaped here to unblock proto1->proto2 migration.
+ // TODO(liujisi): Extend this to apply for other conflicting methods.
+ (*variables)["release_name"] =
+ 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);
+ }
+}
+
+} // namespace
+
+// ===================================================================
+
+MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor,
+ const Options& options)
+ : FieldGenerator(options),
+ descriptor_(descriptor),
+ dependent_field_(options.proto_h && IsFieldDependent(descriptor)) {
+ SetMessageVariables(descriptor, &variables_, options);
+}
+
+MessageFieldGenerator::~MessageFieldGenerator() {}
+
+void MessageFieldGenerator::
+GeneratePrivateMembers(io::Printer* printer) const {
+ printer->Print(variables_, "$type$* $name$_;\n");
+}
+
+void MessageFieldGenerator::
+GenerateGetterDeclaration(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$deprecated_attr$const $type$& $name$() const;\n");
+ printer->Annotate("name", descriptor_);
+}
+
+void MessageFieldGenerator::
+GenerateDependentAccessorDeclarations(io::Printer* printer) const {
+ if (!dependent_field_) {
+ return;
+ }
+ // Arena manipulation code is out-of-line in the derived message class.
+ printer->Print(variables_,
+ "$deprecated_attr$$type$* ${$mutable_$name$$}$();\n");
+ printer->Annotate("{", "}", descriptor_);
+ printer->Print(variables_, "$deprecated_attr$$type$* $release_name$();\n");
+ printer->Annotate("release_name", descriptor_);
+ printer->Print(variables_,
+ "$deprecated_attr$void ${$set_allocated_$name$$}$"
+ "($type$* $name$);\n");
+ printer->Annotate("{", "}", descriptor_);
+}
+
+void MessageFieldGenerator::
+GenerateAccessorDeclarations(io::Printer* printer) const {
+ if (SupportsArenas(descriptor_)) {
+ printer->Print(variables_,
+ "private:\n"
+ "void _slow_mutable_$name$();\n");
+ if (SupportsArenas(descriptor_->message_type())) {
+ printer->Print(variables_,
+ "void _slow_set_allocated_$name$(\n"
+ " ::google::protobuf::Arena* message_arena, $type$** $name$);\n");
+ }
+ printer->Print(variables_,
+ "$type$* _slow_$release_name$();\n"
+ "public:\n");
+ }
+ GenerateGetterDeclaration(printer);
+ if (!dependent_field_) {
+ printer->Print(variables_,
+ "$deprecated_attr$$type$* ${$mutable_$name$$}$();\n");
+ printer->Annotate("{", "}", descriptor_);
+ printer->Print(variables_, "$deprecated_attr$$type$* $release_name$();\n");
+ printer->Annotate("release_name", descriptor_);
+ printer->Print(variables_,
+ "$deprecated_attr$void ${$set_allocated_$name$$}$"
+ "($type$* $name$);\n");
+ printer->Annotate("{", "}", descriptor_);
+ }
+ if (SupportsArenas(descriptor_)) {
+ printer->Print(
+ variables_,
+ "$deprecated_attr$$type$* ${$unsafe_arena_release_$name$$}$();\n");
+ printer->Annotate("{", "}", descriptor_);
+ printer->Print(variables_,
+ "$deprecated_attr$void "
+ "${$unsafe_arena_set_allocated_$name$$}$(\n"
+ " $type$* $name$);\n");
+ printer->Annotate("{", "}", descriptor_);
+ }
+}
+
+void MessageFieldGenerator::GenerateNonInlineAccessorDefinitions(
+ io::Printer* printer) const {
+ if (SupportsArenas(descriptor_)) {
+ 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");
+ }
+ printer->Print(variables_,
+ "}\n"
+ "$type$* $classname$::_slow_$release_name$() {\n"
+ " if ($name$_ == NULL) {\n"
+ " return NULL;\n"
+ " } else {\n"
+ " $type$* temp = new $type$(*$name$_);\n"
+ " $name$_ = NULL;\n"
+ " return temp;\n"
+ " }\n"
+ "}\n"
+ "$type$* $classname$::unsafe_arena_release_$name$() {\n"
+ " // @@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
+ " $clear_hasbit$\n"
+ " $type$* temp = $name$_;\n"
+ " $name$_ = NULL;\n"
+ " return temp;\n"
+ "}\n");
+ if (SupportsArenas(descriptor_->message_type())) {
+ // NOTE: the same logic is mirrored in weak_message_field.cc. Any
+ // arena-related semantics changes should be made in both places.
+ printer->Print(variables_,
+ "void $classname$::_slow_set_allocated_$name$(\n"
+ " ::google::protobuf::Arena* message_arena, $type$** $name$) {\n"
+ " if (message_arena != NULL && \n"
+ " ::google::protobuf::Arena::GetArena(*$name$) == NULL) {\n"
+ " message_arena->Own(*$name$);\n"
+ " } else if (message_arena !=\n"
+ " ::google::protobuf::Arena::GetArena(*$name$)) {\n"
+ " $type$* new_$name$ = \n"
+ " ::google::protobuf::Arena::CreateMessage< $type$ >(\n"
+ " message_arena);\n"
+ " new_$name$->CopyFrom(**$name$);\n"
+ " *$name$ = new_$name$;\n"
+ " }\n"
+ "}\n");
+ }
+ printer->Print(variables_,
+ "void $classname$::unsafe_arena_set_allocated_$name$(\n"
+ " $type$* $name$) {\n"
+ // If we're not on an arena, free whatever we were holding before.
+ // (If we are on arena, we can just forget the earlier pointer.)
+ " if (GetArenaNoVirtual() == NULL) {\n"
+ " delete $name$_;\n"
+ " }\n"
+ " $name$_ = $name$;\n"
+ " if ($name$) {\n"
+ " $set_hasbit$\n"
+ " } else {\n"
+ " $clear_hasbit$\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_unsafe_arena_set_allocated"
+ ":$full_name$)\n"
+ "}\n");
+ }
+}
+
+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();
+ 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"
+ " $set_hasbit$\n"
+ " $dependent_typename$*& $name$_ = $this_message$$name$_;\n"
+ " if ($name$_ == NULL) {\n"
+ " $this_message$_slow_mutable_$name$();\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
+ " return $name$_;\n"
+ "}\n"
+ "template <class T>\n"
+ "inline $type$* $dependent_classname$::$release_name$() {\n"
+ " // @@protoc_insertion_point(field_release:$full_name$)\n"
+ " $dependent_typename$*& $name$_ = $this_message$$name$_;\n"
+ " $clear_hasbit$\n"
+ " if ($this_message$GetArenaNoVirtual() != NULL) {\n"
+ " return $this_message$_slow_$release_name$();\n"
+ " } else {\n"
+ " $dependent_typename$* temp = $name$_;\n"
+ " $name$_ = NULL;\n"
+ " return temp;\n"
+ " }\n"
+ "}\n"
+ "template <class T>\n"
+ "inline void $dependent_classname$::"
+ "set_allocated_$name$($type$* $name$) {\n"
+ " ::google::protobuf::Arena* message_arena = $this_message$GetArenaNoVirtual();\n"
+ " $dependent_typename$*& $name$_ = $this_message$$name$_;\n"
+ " if (message_arena == NULL) {\n"
+ " delete $name$_;\n"
+ " }\n"
+ " if ($name$ != NULL) {\n");
+ if (SupportsArenas(descriptor_->message_type())) {
+ // If we're on an arena and the incoming message is not, simply Own() it
+ // rather than copy to the arena -- either way we need a heap dealloc,
+ // so we might as well defer it. Otherwise, if incoming message is on a
+ // different ownership domain (specific arena, or the heap) than we are,
+ // copy to our arena (or heap, as the case may be).
+ printer->Print(variables,
+ " $this_message$_slow_set_allocated_$name$(message_arena, "
+ "&$name$);\n");
+ } else {
+ printer->Print(variables,
+ " if (message_arena != NULL) {\n"
+ " message_arena->Own($name$);\n"
+ " }\n");
+ }
+ printer->Print(variables,
+ " }\n"
+ " $name$_ = $name$;\n"
+ " if ($name$) {\n"
+ " $set_hasbit$\n"
+ " } else {\n"
+ " $clear_hasbit$\n"
+ " }\n"
+ // TODO(dlj): move insertion points to message class.
+ " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
+ "}\n");
+ } else {
+ printer->Print(variables,
+ "template <class T>\n"
+ "inline $type$* $dependent_classname$::mutable_$name$() {\n"
+ " $set_hasbit$\n"
+ " $dependent_typename$*& $name$_ = $this_message$$name$_;\n"
+ " if ($name$_ == NULL) {\n"
+ " $name$_ = new $dependent_typename$;\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
+ " return $name$_;\n"
+ "}\n"
+ "template <class T>\n"
+ "inline $type$* $dependent_classname$::$release_name$() {\n"
+ " // @@protoc_insertion_point(field_release:$full_name$)\n"
+ " $clear_hasbit$\n"
+ " $dependent_typename$*& $name$_ = $this_message$$name$_;\n"
+ " $dependent_typename$* temp = $name$_;\n"
+ " $name$_ = NULL;\n"
+ " return temp;\n"
+ "}\n"
+ "template <class T>\n"
+ "inline void $dependent_classname$::"
+ "set_allocated_$name$($type$* $name$) {\n"
+ " $dependent_typename$*& $name$_ = $this_message$$name$_;\n"
+ " delete $name$_;\n");
+
+ if (SupportsArenas(descriptor_->message_type())) {
+ printer->Print(variables,
+ " if ($name$ != NULL && static_cast< $dependent_typename$* >($name$)"
+ "->GetArena() != NULL) {\n"
+ " $dependent_typename$* new_$name$ = new $dependent_typename$;\n"
+ " new_$name$->CopyFrom(*$name$);\n"
+ " $name$ = new_$name$;\n"
+ " }\n");
+ }
+
+ printer->Print(variables,
+ " $name$_ = $name$;\n"
+ " if ($name$) {\n"
+ " $set_hasbit$\n"
+ " } else {\n"
+ " $clear_hasbit$\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
+ "}\n");
+ }
+}
+
+void MessageFieldGenerator::
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ printer->Print(variables,
+ "$inline$const $type$& $classname$::$name$() const {\n"
+ " const $type$* p = $name$_;\n"
+ " // @@protoc_insertion_point(field_get:$full_name$)\n"
+ " return p != NULL ? *p : *reinterpret_cast<const $type$*>(\n"
+ " &$type_default_instance$);\n"
+ "}\n");
+
+ if (dependent_field_) return;
+
+ if (SupportsArenas(descriptor_)) {
+ printer->Print(variables,
+ "$inline$"
+ "$type$* $classname$::mutable_$name$() {\n"
+ " $set_hasbit$\n"
+ " if ($name$_ == NULL) {\n"
+ " _slow_mutable_$name$();\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
+ " return $name$_;\n"
+ "}\n"
+ "$inline$"
+ "$type$* $classname$::$release_name$() {\n"
+ " // @@protoc_insertion_point(field_release:$full_name$)\n"
+ " $clear_hasbit$\n"
+ " if (GetArenaNoVirtual() != NULL) {\n"
+ " return _slow_$release_name$();\n"
+ " } else {\n"
+ " $type$* temp = $name$_;\n"
+ " $name$_ = NULL;\n"
+ " return temp;\n"
+ " }\n"
+ "}\n"
+ "$inline$ "
+ "void $classname$::set_allocated_$name$($type$* $name$) {\n"
+ " ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();\n"
+ " if (message_arena == NULL) {\n"
+ " delete $name$_;\n"
+ " }\n"
+ " if ($name$ != NULL) {\n");
+ if (SupportsArenas(descriptor_->message_type())) {
+ // If we're on an arena and the incoming message is not, simply Own() it
+ // rather than copy to the arena -- either way we need a heap dealloc,
+ // so we might as well defer it. Otherwise, if incoming message is on a
+ // different ownership domain (specific arena, or the heap) than we are,
+ // copy to our arena (or heap, as the case may be).
+ printer->Print(variables,
+ " _slow_set_allocated_$name$(message_arena, &$name$);\n");
+ } else {
+ printer->Print(variables,
+ " if (message_arena != NULL) {\n"
+ " message_arena->Own($name$);\n"
+ " }\n");
+ }
+ printer->Print(variables,
+ " }\n"
+ " $name$_ = $name$;\n"
+ " if ($name$) {\n"
+ " $set_hasbit$\n"
+ " } else {\n"
+ " $clear_hasbit$\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_set_allocated:$full_name$)\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 $name$_;\n"
+ "}\n"
+ "$inline$"
+ "$type$* $classname$::$release_name$() {\n"
+ " // @@protoc_insertion_point(field_release:$full_name$)\n"
+ " $clear_hasbit$\n"
+ " $type$* temp = $name$_;\n"
+ " $name$_ = NULL;\n"
+ " return temp;\n"
+ "}\n"
+ "$inline$"
+ "void $classname$::set_allocated_$name$($type$* $name$) {\n"
+ " delete $name$_;\n");
+
+ if (SupportsArenas(descriptor_->message_type())) {
+ printer->Print(variables,
+ " if ($name$ != NULL && $name$->GetArena() != NULL) {\n"
+ " $type$* new_$name$ = new $type$;\n"
+ " new_$name$->CopyFrom(*$name$);\n"
+ " $name$ = new_$name$;\n"
+ " }\n");
+ }
+
+ printer->Print(variables,
+ " $name$_ = $name$;\n"
+ " if ($name$) {\n"
+ " $set_hasbit$\n"
+ " } else {\n"
+ " $clear_hasbit$\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
+ "}\n");
+ }
+}
+
+void MessageFieldGenerator::
+GenerateClearingCode(io::Printer* printer) const {
+ std::map<string, string> variables(variables_);
+ variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : "";
+ if (!HasFieldPresence(descriptor_->file())) {
+ // If we don't have has-bits, message presence is indicated only by ptr !=
+ // NULL. Thus on clear, we need to delete the object.
+ printer->Print(variables,
+ "if ($this_message$GetArenaNoVirtual() == NULL && "
+ "$this_message$$name$_ != NULL) delete $this_message$$name$_;\n"
+ "$this_message$$name$_ = NULL;\n");
+ } else {
+ printer->Print(variables,
+ "if ($this_message$$name$_ != NULL) $this_message$$name$_->"
+ "$dependent_type$::Clear();\n");
+ }
+}
+
+void MessageFieldGenerator::
+GenerateMessageClearingCode(io::Printer* printer) const {
+ if (!HasFieldPresence(descriptor_->file())) {
+ // If we don't have has-bits, message presence is indicated only by ptr !=
+ // NULL. Thus on clear, we need to delete the object.
+ printer->Print(variables_,
+ "if (GetArenaNoVirtual() == NULL && $name$_ != NULL) {\n"
+ " delete $name$_;\n"
+ "}\n"
+ "$name$_ = NULL;\n");
+ } else {
+ printer->Print(variables_,
+ "GOOGLE_DCHECK($name$_ != NULL);\n"
+ "$name$_->$type$::Clear();\n");
+ }
+}
+
+void MessageFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "mutable_$name$()->$type$::MergeFrom(from.$name$());\n");
+}
+
+void MessageFieldGenerator::
+GenerateSwappingCode(io::Printer* printer) const {
+ printer->Print(variables_, "swap($name$_, other->$name$_);\n");
+}
+
+void MessageFieldGenerator::
+GenerateDestructorCode(io::Printer* printer) const {
+ // TODO(gerbens) Remove this when we don't need to destruct default instances.
+ // In google3 a default instance will never get deleted so we don't need to
+ // worry about that but in opensource protobuf default instances are deleted
+ // in shutdown process and we need to take special care when handling them.
+ printer->Print(variables_,
+ "if (this != internal_default_instance()) ");
+ printer->Print(variables_, "delete $name$_;\n");
+}
+
+void MessageFieldGenerator::
+GenerateConstructorCode(io::Printer* printer) const {
+ printer->Print(variables_, "$name$_ = NULL;\n");
+}
+
+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.
+
+ printer->Print(variables_,
+ "if (from.has_$name$()) {\n"
+ " $name$_ = new $type$(*from.$name$_);\n"
+ "} else {\n"
+ " $name$_ = NULL;\n"
+ "}\n");
+}
+
+void MessageFieldGenerator::
+GenerateMergeFromCodedStream(io::Printer* printer) const {
+ if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) {
+ printer->Print(variables_,
+ "DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(\n"
+ " input, mutable_$name$()));\n");
+ } else {
+ printer->Print(variables_,
+ "DO_(::google::protobuf::internal::WireFormatLite::ReadGroupNoVirtual(\n"
+ " $number$, input, mutable_$name$()));\n");
+ }
+}
+
+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");
+}
+
+void MessageFieldGenerator::
+GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
+ printer->Print(variables_,
+ "target = ::google::protobuf::internal::WireFormatLite::\n"
+ " InternalWrite$declared_type$NoVirtualToArray(\n"
+ " $number$, *$non_null_ptr_to_name$, deterministic, target);\n");
+}
+
+void MessageFieldGenerator::
+GenerateByteSize(io::Printer* printer) const {
+ printer->Print(variables_,
+ "total_size += $tag_size$ +\n"
+ " ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n"
+ " *$non_null_ptr_to_name$);\n");
+}
+
+// ===================================================================
+
+MessageOneofFieldGenerator::
+MessageOneofFieldGenerator(const FieldDescriptor* descriptor,
+ const Options& options)
+ : MessageFieldGenerator(descriptor, options),
+ dependent_base_(options.proto_h) {
+ SetCommonOneofFieldVariables(descriptor, &variables_);
+}
+
+MessageOneofFieldGenerator::~MessageOneofFieldGenerator() {}
+
+
+void MessageOneofFieldGenerator::
+GenerateDependentAccessorDeclarations(io::Printer* printer) const {
+ // Oneof field getters must be dependent as they call default_instance().
+ // Otherwise, the logic is the same as MessageFields.
+ if (!dependent_field_) {
+ return;
+ }
+ printer->Print(variables_,
+ "$deprecated_attr$const $type$& $name$() const;\n");
+ MessageFieldGenerator::GenerateDependentAccessorDeclarations(printer);
+}
+
+void MessageOneofFieldGenerator::
+GenerateGetterDeclaration(io::Printer* printer) const {
+ // Oneof field getters must be dependent as they call default_instance().
+ // Unlike MessageField, this means there is no (non-dependent) getter to
+ // generate.
+ if (dependent_field_) {
+ return;
+ }
+ printer->Print(variables_,
+ "$deprecated_attr$const $type$& $name$() const;\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["inline"] = "inline ";
+ 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,
+ bool is_inline) const {
+ if (dependent_base_) {
+ return;
+ }
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ 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"];
+ InternalGenerateInlineAccessorDefinitions(variables, printer);
+}
+
+void MessageOneofFieldGenerator::InternalGenerateInlineAccessorDefinitions(
+ const std::map<string, string>& variables, io::Printer* printer) const {
+ printer->Print(variables,
+ "$tmpl$"
+ "$inline$ "
+ "const $type$& $dependent_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"
+ " : $dependent_type$::default_instance();\n"
+ "}\n");
+
+ 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"
+ "$tmpl$"
+ "$inline$"
+ "$type$* $dependent_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 ($this_message$GetArenaNoVirtual() != NULL) {\n"
+ // N.B.: safe to use the underlying field pointer here because we are sure
+ // that it is non-NULL (because has_$name$() returned true).
+ " $dependent_typename$* temp = "
+ "new $dependent_typename$(*$field_member$);\n"
+ " $field_member$ = NULL;\n"
+ " return temp;\n"
+ " } else {\n"
+ " $dependent_typename$* temp = $field_member$;\n"
+ " $field_member$ = NULL;\n"
+ " return temp;\n"
+ " }\n"
+ " } else {\n"
+ " return NULL;\n"
+ " }\n"
+ "}\n"
+ "$tmpl$"
+ "$inline$"
+ "void $dependent_classname$::"
+ "set_allocated_$name$($type$* $name$) {\n"
+ " $this_message$clear_$oneof_name$();\n"
+ " if ($name$) {\n");
+
+ if (SupportsArenas(descriptor_->message_type())) {
+ printer->Print(variables,
+ // If incoming message is on the heap and we are on an arena, just Own()
+ // it (see above). If it's on a different arena than we are or one of us
+ // is on the heap, we make a copy to our arena/heap.
+ " if ($this_message$GetArenaNoVirtual() != NULL &&\n"
+ " ::google::protobuf::Arena::GetArena($name$) == NULL) {\n"
+ " $this_message$GetArenaNoVirtual()->Own($name$);\n"
+ " } else if ($this_message$GetArenaNoVirtual() !=\n"
+ " ::google::protobuf::Arena::GetArena($name$)) {\n"
+ " $dependent_typename$* new_$name$ = \n"
+ " ::google::protobuf::Arena::CreateMessage< $dependent_typename$ >(\n"
+ " $this_message$GetArenaNoVirtual());\n"
+ " new_$name$->CopyFrom(*$name$);\n"
+ " $name$ = new_$name$;\n"
+ " }\n");
+ } else {
+ printer->Print(variables,
+ " if ($this_message$GetArenaNoVirtual() != NULL) {\n"
+ " $this_message$GetArenaNoVirtual()->Own($name$);\n"
+ " }\n");
+ }
+
+ printer->Print(variables,
+ " $this_message$set_has_$name$();\n"
+ " $field_member$ = $name$;\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
+ "}\n"
+ "$inline$ $type$* $classname$::unsafe_arena_release_$name$() {\n"
+ " // @@protoc_insertion_point(field_unsafe_arena_release"
+ ":$full_name$)\n"
+ " if (has_$name$()) {\n"
+ " clear_has_$oneof_name$();\n"
+ " $type$* temp = $oneof_prefix$$name$_;\n"
+ " $oneof_prefix$$name$_ = NULL;\n"
+ " return temp;\n"
+ " } else {\n"
+ " return NULL;\n"
+ " }\n"
+ "}\n"
+ "$inline$ void $classname$::unsafe_arena_set_allocated_$name$"
+ "($type$* $name$) {\n"
+ // We rely on the oneof clear method to free the earlier contents of this
+ // oneof. We can directly use the pointer we're given to set the new
+ // value.
+ " clear_$oneof_name$();\n"
+ " if ($name$) {\n"
+ " set_has_$name$();\n"
+ " $oneof_prefix$$name$_ = $name$;\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:"
+ "$full_name$)\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"
+ "$tmpl$"
+ "$inline$"
+ "$type$* $dependent_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"
+ " $dependent_typename$* temp = $field_member$;\n"
+ " $field_member$ = NULL;\n"
+ " return temp;\n"
+ " } else {\n"
+ " return NULL;\n"
+ " }\n"
+ "}\n"
+ "$tmpl$"
+ "$inline$"
+ "void $dependent_classname$::"
+ "set_allocated_$name$($type$* $name$) {\n"
+ " $this_message$clear_$oneof_name$();\n"
+ " if ($name$) {\n");
+ if (SupportsArenas(descriptor_->message_type())) {
+ printer->Print(variables,
+ " if (static_cast< $dependent_typename$*>($name$)->"
+ "GetArena() != NULL) {\n"
+ " $dependent_typename$* new_$name$ = new $dependent_typename$;\n"
+ " new_$name$->CopyFrom(*$name$);\n"
+ " $name$ = new_$name$;\n"
+ " }\n");
+ }
+ printer->Print(variables,
+ " $this_message$set_has_$name$();\n"
+ " $field_member$ = $name$;\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
+ "}\n");
+ }
+}
+
+void MessageOneofFieldGenerator::
+GenerateClearingCode(io::Printer* printer) const {
+ std::map<string, string> variables(variables_);
+ variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : "";
+ if (SupportsArenas(descriptor_)) {
+ printer->Print(variables,
+ "if ($this_message$GetArenaNoVirtual() == NULL) {\n"
+ " delete $this_message$$oneof_prefix$$name$_;\n"
+ "}\n");
+ } else {
+ printer->Print(variables,
+ "delete $this_message$$oneof_prefix$$name$_;\n");
+ }
+}
+
+void MessageOneofFieldGenerator::
+GenerateMessageClearingCode(io::Printer* printer) const {
+ GenerateClearingCode(printer);
+}
+
+void MessageOneofFieldGenerator::
+GenerateSwappingCode(io::Printer* printer) const {
+ // Don't print any swapping code. Swapping the union will swap this field.
+}
+
+void MessageOneofFieldGenerator::
+GenerateDestructorCode(io::Printer* printer) const {
+ // We inherit from MessageFieldGenerator, so we need to override the default
+ // behavior.
+}
+
+void MessageOneofFieldGenerator::
+GenerateConstructorCode(io::Printer* printer) const {
+ // Don't print any constructor code. The field is in a union. We allocate
+ // space only when this field is used.
+}
+
+// ===================================================================
+
+RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator(
+ const FieldDescriptor* descriptor, const Options& options)
+ : FieldGenerator(options),
+ descriptor_(descriptor),
+ dependent_field_(options.proto_h && IsFieldDependent(descriptor)),
+ dependent_getter_(dependent_field_ && options.safe_boundary_check) {
+ SetMessageVariables(descriptor, &variables_, options);
+}
+
+RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {}
+
+void RepeatedMessageFieldGenerator::
+GeneratePrivateMembers(io::Printer* printer) const {
+ printer->Print(variables_,
+ "::google::protobuf::RepeatedPtrField< $type$ > $name$_;\n");
+}
+
+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);
+ }
+}
+
+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_);
+ }
+ 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_);
+ }
+}
+
+void RepeatedMessageFieldGenerator::
+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["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"
+ " 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"
+ "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n"
+ "$dependent_classname$::mutable_$name$() {\n"
+ " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
+ " return &$this_message$$name$_;\n"
+ "}\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+
+ if (!dependent_getter_) {
+ 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"
+ "}\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"
+ " 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");
+ }
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateClearingCode(io::Printer* printer) const {
+ std::map<string, string> variables(variables_);
+ variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : "";
+ printer->Print(variables, "$this_message$$name$_.Clear();\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_, "$name$_.MergeFrom(from.$name$_);\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateSwappingCode(io::Printer* printer) const {
+ printer->Print(variables_, "$name$_.InternalSwap(&other->$name$_);\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateConstructorCode(io::Printer* printer) const {
+ // Not needed for repeated fields.
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateMergeFromCodedStream(io::Printer* printer) const {
+ if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) {
+ printer->Print(variables_,
+ "DO_(::google::protobuf::internal::WireFormatLite::"
+ "ReadMessageNoVirtual(\n"
+ " input, add_$name$()));\n");
+ } else {
+ printer->Print(variables_,
+ "DO_(::google::protobuf::internal::WireFormatLite::"
+ "ReadGroupNoVirtual(\n"
+ " $number$, input, add_$name$()));\n");
+ }
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateSerializeWithCachedSizes(io::Printer* printer) const {
+ printer->Print(variables_,
+ "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"
+ "}\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
+ printer->Print(variables_,
+ "for (unsigned int i = 0,\n"
+ " n = static_cast<unsigned int>(this->$name$_size()); i < n; i++) {\n"
+ " target = ::google::protobuf::internal::WireFormatLite::\n"
+ " InternalWrite$declared_type$NoVirtualToArray(\n"
+ " $number$, this->$name$(static_cast<int>(i)), deterministic, target);\n"
+ "}\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateByteSize(io::Printer* printer) const {
+ printer->Print(variables_,
+ "{\n"
+ " unsigned int count = static_cast<unsigned int>(this->$name$_size());\n");
+ printer->Indent();
+ printer->Print(variables_,
+ "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$SizeNoVirtual(\n"
+ " this->$name$(static_cast<int>(i)));\n"
+ "}\n");
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+} // namespace cpp
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message_field.h
index 6879539c7d..cd9737f0e3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_message_field.h
@@ -38,7 +38,6 @@
#include <map>
#include <string>
#include <google/protobuf/compiler/cpp/cpp_field.h>
-#include <google/protobuf/compiler/cpp/cpp_helpers.h>
namespace google {
namespace protobuf {
@@ -48,13 +47,16 @@ namespace cpp {
class MessageFieldGenerator : public FieldGenerator {
public:
MessageFieldGenerator(const FieldDescriptor* descriptor,
- const Options& options, SCCAnalyzer* scc_analyzer);
+ const Options& options);
~MessageFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
+ void GenerateDependentAccessorDeclarations(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMessageClearingCode(io::Printer* printer) const;
@@ -69,8 +71,13 @@ class MessageFieldGenerator : public FieldGenerator {
void GenerateByteSize(io::Printer* printer) const;
protected:
+ void GenerateArenaManipulationCode(const std::map<string, string>& variables,
+ io::Printer* printer) const;
+
+ virtual void GenerateGetterDeclaration(io::Printer* printer) const;
+
const FieldDescriptor* descriptor_;
- const bool implicit_weak_field_;
+ const bool dependent_field_;
std::map<string, string> variables_;
private:
@@ -80,12 +87,15 @@ class MessageFieldGenerator : public FieldGenerator {
class MessageOneofFieldGenerator : public MessageFieldGenerator {
public:
MessageOneofFieldGenerator(const FieldDescriptor* descriptor,
- const Options& options, SCCAnalyzer* scc_analyzer);
+ const Options& options);
~MessageOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
- void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateDependentAccessorDeclarations(io::Printer* printer) const;
+ void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
+ void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const { }
void GenerateClearingCode(io::Printer* printer) const;
// MessageFieldGenerator, from which we inherit, overrides this so we need to
@@ -95,21 +105,30 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator {
void GenerateDestructorCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
+ protected:
+ void GenerateGetterDeclaration(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);
};
class RepeatedMessageFieldGenerator : public FieldGenerator {
public:
RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor,
- const Options& options,
- SCCAnalyzer* scc_analyzer);
+ const Options& options);
~RepeatedMessageFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
+ void GenerateDependentAccessorDeclarations(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
@@ -121,8 +140,12 @@ class RepeatedMessageFieldGenerator : public FieldGenerator {
void GenerateByteSize(io::Printer* printer) const;
private:
+ void InternalGenerateTypeDependentAccessorDeclarations(
+ io::Printer* printer) const;
+
const FieldDescriptor* descriptor_;
- const bool implicit_weak_field_;
+ const bool dependent_field_;
+ const bool dependent_getter_;
std::map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
index eb7cd1c775..f72a7d6014 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
@@ -34,7 +34,7 @@
#include <gtest/gtest.h>
#if LANG_CXX11
-#include <type_traits>
+#include <google/protobuf/stubs/type_traits.h>
#endif
namespace google {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_options.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_options.h
index f09885bebe..04338083bd 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_options.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_options.h
@@ -39,8 +39,6 @@
namespace google {
namespace protobuf {
namespace compiler {
-class AccessInfoMap;
-
namespace cpp {
// Generator options (see generator.cc for a description of each):
@@ -52,11 +50,7 @@ struct Options {
annotate_headers(false),
enforce_lite(false),
table_driven_parsing(false),
- table_driven_serialization(false),
- lite_implicit_weak_fields(false),
- bootstrap(false),
- num_cc_files(0),
- access_info_map(NULL) {}
+ table_driven_serialization(false) {}
string dllexport_decl;
bool safe_boundary_check;
@@ -66,12 +60,8 @@ struct Options {
bool enforce_lite;
bool table_driven_parsing;
bool table_driven_serialization;
- bool lite_implicit_weak_fields;
- bool bootstrap;
- int num_cc_files;
string annotation_pragma_name;
string annotation_guard_name;
- const AccessInfoMap* access_info_map;
};
} // namespace cpp
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
index ff6ba0f819..34a41d8232 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
@@ -35,6 +35,9 @@
// worth.
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/compiler/cpp/cpp_generator.h>
#include <google/protobuf/compiler/command_line_interface.h>
@@ -129,7 +132,7 @@ class TestGenerator : public CodeGenerator {
// Check field accessors for a message inside oneof{}:
TryInsert("test.pb.h", "field_get:foo.Bar.oneOfMessage", context);
TryInsert("test.pb.h", "field_mutable:foo.Bar.oneOfMessage", context);
- TryInsert("test.pb.cc", "field_set_allocated:foo.Bar.oneOfMessage", context);
+ TryInsert("test.pb.h", "field_set_allocated:foo.Bar.oneOfMessage", context);
// Check field accessors for an optional enum:
TryInsert("test.pb.h", "field_get:foo.Bar.optEnum", context);
@@ -169,7 +172,7 @@ class TestGenerator : public CodeGenerator {
void TryInsert(const string& filename, const string& insertion_point,
GeneratorContext* context) const {
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->OpenForInsert(filename, insertion_point));
io::Printer printer(output.get(), '$');
printer.Print("// inserted $name$\n", "name", insertion_point);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
index 701f9d2dc1..b05fcc4e3d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
@@ -123,13 +123,15 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
}
void PrimitiveFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- printer->Print(variables_,
- "inline $type$ $classname$::$name$() const {\n"
+GenerateInlineAccessorDefinitions(io::Printer* printer, bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ printer->Print(variables,
+ "$inline$$type$ $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return $name$_;\n"
"}\n"
- "inline void $classname$::set_$name$($type$ value) {\n"
+ "$inline$void $classname$::set_$name$($type$ value) {\n"
" $set_hasbit$\n"
" $name$_ = value;\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
@@ -210,28 +212,30 @@ PrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor,
PrimitiveOneofFieldGenerator::~PrimitiveOneofFieldGenerator() {}
void PrimitiveOneofFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- printer->Print(variables_,
- "inline $type$ $classname$::$name$() const {\n"
+GenerateInlineAccessorDefinitions(io::Printer* printer, bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ printer->Print(variables,
+ "$inline$$type$ $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" if (has_$name$()) {\n"
- " return $field_member$;\n"
+ " return $oneof_prefix$$name$_;\n"
" }\n"
" return $default$;\n"
"}\n"
- "inline void $classname$::set_$name$($type$ value) {\n"
+ "$inline$void $classname$::set_$name$($type$ value) {\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" }\n"
- " $field_member$ = value;\n"
+ " $oneof_prefix$$name$_ = value;\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n");
}
void PrimitiveOneofFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
- printer->Print(variables_, "$field_member$ = $default$;\n");
+ printer->Print(variables_, "$oneof_prefix$$name$_ = $default$;\n");
}
void PrimitiveOneofFieldGenerator::
@@ -241,8 +245,9 @@ GenerateSwappingCode(io::Printer* printer) const {
void PrimitiveOneofFieldGenerator::
GenerateConstructorCode(io::Printer* printer) const {
- printer->Print(variables_,
- "$ns$::_$classname$_default_instance_.$name$_ = $default$;\n");
+ printer->Print(
+ variables_,
+ "_$classname$_default_instance_.$name$_ = $default$;\n");
}
void PrimitiveOneofFieldGenerator::
@@ -251,7 +256,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
"clear_$oneof_name$();\n"
"DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n"
" $type$, $wire_format_field_type$>(\n"
- " input, &$field_member$)));\n"
+ " input, &$oneof_prefix$$name$_)));\n"
"set_has_$name$();\n");
}
@@ -307,26 +312,28 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
}
void RepeatedPrimitiveFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- printer->Print(variables_,
- "inline $type$ $classname$::$name$(int index) const {\n"
+GenerateInlineAccessorDefinitions(io::Printer* printer, bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ printer->Print(variables,
+ "$inline$$type$ $classname$::$name$(int index) const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return $name$_.Get(index);\n"
"}\n"
- "inline void $classname$::set_$name$(int index, $type$ value) {\n"
+ "$inline$void $classname$::set_$name$(int index, $type$ value) {\n"
" $name$_.Set(index, value);\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
- "inline void $classname$::add_$name$($type$ value) {\n"
+ "$inline$void $classname$::add_$name$($type$ value) {\n"
" $name$_.Add(value);\n"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
"}\n"
- "inline const ::google::protobuf::RepeatedField< $type$ >&\n"
+ "$inline$const ::google::protobuf::RepeatedField< $type$ >&\n"
"$classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_list:$full_name$)\n"
" return $name$_;\n"
"}\n"
- "inline ::google::protobuf::RepeatedField< $type$ >*\n"
+ "$inline$::google::protobuf::RepeatedField< $type$ >*\n"
"$classname$::mutable_$name$() {\n"
" // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
" return &$name$_;\n"
@@ -426,7 +433,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
" ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n"
" target);\n"
" target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n"
- " static_cast< ::google::protobuf::int32>(\n"
+ " static_cast< ::google::protobuf::uint32>(\n"
" _$name$_cached_byte_size_), target);\n"
" target = ::google::protobuf::internal::WireFormatLite::\n"
" Write$declared_type$NoTagToArray(this->$name$_, target);\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
index d52228e969..44c9ff3ee5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
@@ -53,7 +53,8 @@ class PrimitiveFieldGenerator : public FieldGenerator {
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
@@ -79,7 +80,8 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator {
~PrimitiveOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
@@ -98,7 +100,8 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator {
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_service.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_service.cc
index 95357d9f43..95357d9f43 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_service.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_service.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_service.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_service.h
index 33c025476a..33c025476a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_service.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_service.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index cf6c4b33af..fec13b6dd0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -34,8 +34,8 @@
#include <google/protobuf/compiler/cpp/cpp_string_field.h>
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/stubs/strutil.h>
@@ -53,13 +53,13 @@ void SetStringVariables(const FieldDescriptor* descriptor,
(*variables)["default"] = DefaultValue(descriptor);
(*variables)["default_length"] =
SimpleItoa(descriptor->default_value_string().length());
- string default_variable_string = MakeDefaultName(descriptor);
+ string default_variable_string = "_default_" + FieldName(descriptor) + "_";
(*variables)["default_variable_name"] = default_variable_string;
(*variables)["default_variable"] =
descriptor->default_value_string().empty()
? "&::google::protobuf::internal::GetEmptyStringAlreadyInited()"
- : "&" + Namespace(descriptor) + "::" + (*variables)["classname"] +
- "::" + default_variable_string + ".get()";
+ : "&" + (*variables)["classname"] + "::" + default_variable_string +
+ ".get()";
(*variables)["pointer_type"] =
descriptor->type() == FieldDescriptor::TYPE_BYTES ? "void" : "char";
(*variables)["null_check"] = "GOOGLE_DCHECK(value != NULL);\n";
@@ -71,9 +71,6 @@ void SetStringVariables(const FieldDescriptor* descriptor,
(*variables)["full_name"] = descriptor->full_name();
(*variables)["string_piece"] = "::std::string";
-
- (*variables)["lite"] =
- HasDescriptorMethods(descriptor->file(), options) ? "" : "Lite";
}
} // namespace
@@ -82,24 +79,7 @@ void SetStringVariables(const FieldDescriptor* descriptor,
StringFieldGenerator::StringFieldGenerator(const FieldDescriptor* descriptor,
const Options& options)
- : FieldGenerator(options),
- descriptor_(descriptor),
- lite_(!HasDescriptorMethods(descriptor->file(), options)),
- inlined_(false) {
-
- // TODO(ckennelly): Handle inlining for any.proto.
- if (IsAnyMessage(descriptor_->containing_type())) {
- inlined_ = false;
- }
- if (descriptor_->containing_type()->options().map_entry()) {
- inlined_ = false;
- }
-
- // Limit to proto2, as we rely on has bits to distinguish field presence for
- // release_$name$. On proto3, we cannot use the address of the string
- // instance when the field has been inlined.
- inlined_ = inlined_ && HasFieldPresence(descriptor_->file());
-
+ : FieldGenerator(options), descriptor_(descriptor) {
SetStringVariables(descriptor, &variables_, options);
}
@@ -107,36 +87,27 @@ StringFieldGenerator::~StringFieldGenerator() {}
void StringFieldGenerator::
GeneratePrivateMembers(io::Printer* printer) const {
- if (inlined_) {
- printer->Print(variables_,
- "::google::protobuf::internal::InlinedStringField $name$_;\n");
- } else {
- // N.B. that we continue to use |ArenaStringPtr| instead of |string*| for
- // string fields, even when SupportArenas(descriptor_) == false. Why? The
- // simple answer is to avoid unmaintainable complexity. The reflection code
- // assumes ArenaStringPtrs. These are *almost* in-memory-compatible with
- // string*, except for the pointer tags and related ownership semantics. We
- // could modify the runtime code to use string* for the
- // not-supporting-arenas case, but this would require a way to detect which
- // type of class was generated (adding overhead and complexity to
- // GeneratedMessageReflection) and littering the runtime code paths with
- // conditionals. It's simpler to stick with this but use lightweight
- // accessors that assume arena == NULL. There should be very little
- // overhead anyway because it's just a tagged pointer in-memory.
- printer->Print(variables_, "::google::protobuf::internal::ArenaStringPtr $name$_;\n");
- }
+ // N.B. that we continue to use |ArenaStringPtr| instead of |string*| for
+ // string fields, even when SupportArenas(descriptor_) == false. Why?
+ // The simple answer is to avoid unmaintainable complexity. The reflection
+ // code assumes ArenaStringPtrs. These are *almost* in-memory-compatible with
+ // string*, except for the pointer tags and related ownership semantics. We
+ // could modify the runtime code to use string* for the not-supporting-arenas
+ // case, but this would require a way to detect which type of class was
+ // generated (adding overhead and complexity to GeneratedMessageReflection)
+ // and littering the runtime code paths with conditionals. It's simpler to
+ // stick with this but use lightweight accessors that assume arena == NULL.
+ // There should be very little overhead anyway because it's just a tagged
+ // pointer in-memory.
+ printer->Print(variables_, "::google::protobuf::internal::ArenaStringPtr $name$_;\n");
}
void StringFieldGenerator::
GenerateStaticMembers(io::Printer* printer) const {
if (!descriptor_->default_value_string().empty()) {
- // We make the default instance public, so it can be initialized by
- // non-friend code.
printer->Print(variables_,
- "public:\n"
"static ::google::protobuf::internal::ExplicitlyConstructed< ::std::string>"
- " $default_variable_name$;\n"
- "private:\n");
+ " $default_variable_name$;\n");
}
}
@@ -205,21 +176,16 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
if (SupportsArenas(descriptor_)) {
printer->Print(
variables_,
- "PROTOBUF_RUNTIME_DEPRECATED(\"The unsafe_arena_ accessors for\"\n"
- "\" string fields are deprecated and will be removed in a\"\n"
- "\" future release.\")\n"
- "::std::string* ${$unsafe_arena_release_$name$$}$();\n");
+ "$deprecated_attr$::std::string* ${$unsafe_arena_release_$name$$}$();\n");
printer->Annotate("{", "}", descriptor_);
printer->Print(
variables_,
- "PROTOBUF_RUNTIME_DEPRECATED(\"The unsafe_arena_ accessors for\"\n"
- "\" string fields are deprecated and will be removed in a\"\n"
- "\" future release.\")\n"
- "void ${$unsafe_arena_set_allocated_$name$$}$(\n"
+ "$deprecated_attr$void ${$unsafe_arena_set_allocated_$name$$}$(\n"
" ::std::string* $name$);\n");
printer->Annotate("{", "}", descriptor_);
}
+
if (unknown_ctype) {
printer->Outdent();
printer->Print(" public:\n");
@@ -228,68 +194,65 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
}
void StringFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
if (SupportsArenas(descriptor_)) {
printer->Print(
- variables_,
- "inline const ::std::string& $classname$::$name$() const {\n"
+ variables,
+ "$inline$const ::std::string& $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return $name$_.Get();\n"
"}\n"
- "inline void $classname$::set_$name$(const ::std::string& value) {\n"
+ "$inline$void $classname$::set_$name$(const ::std::string& value) {\n"
" $set_hasbit$\n"
- " $name$_.Set$lite$($default_variable$, value, GetArenaNoVirtual());\n"
+ " $name$_.Set($default_variable$, value, GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"#if LANG_CXX11\n"
- "inline void $classname$::set_$name$(::std::string&& value) {\n"
+ "$inline$void $classname$::set_$name$(::std::string&& value) {\n"
" $set_hasbit$\n"
- " $name$_.Set$lite$(\n"
+ " $name$_.Set(\n"
" $default_variable$, ::std::move(value), GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n"
"}\n"
"#endif\n"
- "inline void $classname$::set_$name$(const char* value) {\n"
+ "$inline$void $classname$::set_$name$(const char* value) {\n"
" $null_check$"
" $set_hasbit$\n"
- " $name$_.Set$lite$($default_variable$, $string_piece$(value),\n"
+ " $name$_.Set($default_variable$, $string_piece$(value),\n"
" GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n"
- "inline "
+ "$inline$"
"void $classname$::set_$name$(const $pointer_type$* value,\n"
" size_t size) {\n"
" $set_hasbit$\n"
- " $name$_.Set$lite$($default_variable$, $string_piece$(\n"
+ " $name$_.Set($default_variable$, $string_piece$(\n"
" reinterpret_cast<const char*>(value), size), "
"GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline ::std::string* $classname$::mutable_$name$() {\n"
+ "$inline$::std::string* $classname$::mutable_$name$() {\n"
" $set_hasbit$\n"
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
" return $name$_.Mutable($default_variable$, GetArenaNoVirtual());\n"
"}\n"
- "inline ::std::string* $classname$::$release_name$() {\n"
- " // @@protoc_insertion_point(field_release:$full_name$)\n");
-
- if (HasFieldPresence(descriptor_->file())) {
- printer->Print(variables_,
- " if (!has_$name$()) {\n"
- " return NULL;\n"
- " }\n"
+ "$inline$::std::string* $classname$::$release_name$() {\n"
+ " // @@protoc_insertion_point(field_release:$full_name$)\n"
" $clear_hasbit$\n"
- " return $name$_.ReleaseNonDefault("
- "$default_variable$, GetArenaNoVirtual());\n");
- } else {
- printer->Print(variables_,
+ " return $name$_.Release($default_variable$, GetArenaNoVirtual());\n"
+ "}\n"
+ "$inline$::std::string* $classname$::unsafe_arena_release_$name$() {\n"
+ " // "
+ "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
+ " GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n"
" $clear_hasbit$\n"
- " return $name$_.Release($default_variable$, GetArenaNoVirtual());\n");
- }
-
- printer->Print(variables_,
+ " return $name$_.UnsafeArenaRelease($default_variable$,\n"
+ " GetArenaNoVirtual());\n"
"}\n"
- "inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
+ "$inline$void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
" if ($name$ != NULL) {\n"
" $set_hasbit$\n"
" } else {\n"
@@ -299,15 +262,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
"}\n"
- "inline ::std::string* $classname$::unsafe_arena_release_$name$() {\n"
- " // "
- "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
- " GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n"
- " $clear_hasbit$\n"
- " return $name$_.UnsafeArenaRelease($default_variable$,\n"
- " GetArenaNoVirtual());\n"
- "}\n"
- "inline void $classname$::unsafe_arena_set_allocated_$name$(\n"
+ "$inline$void $classname$::unsafe_arena_set_allocated_$name$(\n"
" ::std::string* $name$) {\n"
" GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n"
" if ($name$ != NULL) {\n"
@@ -323,31 +278,31 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
} else {
// No-arena case.
printer->Print(
- variables_,
- "inline const ::std::string& $classname$::$name$() const {\n"
+ variables,
+ "$inline$const ::std::string& $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return $name$_.GetNoArena();\n"
"}\n"
- "inline void $classname$::set_$name$(const ::std::string& value) {\n"
+ "$inline$void $classname$::set_$name$(const ::std::string& value) {\n"
" $set_hasbit$\n"
" $name$_.SetNoArena($default_variable$, value);\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"#if LANG_CXX11\n"
- "inline void $classname$::set_$name$(::std::string&& value) {\n"
+ "$inline$void $classname$::set_$name$(::std::string&& value) {\n"
" $set_hasbit$\n"
" $name$_.SetNoArena(\n"
" $default_variable$, ::std::move(value));\n"
" // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n"
"}\n"
"#endif\n"
- "inline void $classname$::set_$name$(const char* value) {\n"
+ "$inline$void $classname$::set_$name$(const char* value) {\n"
" $null_check$"
" $set_hasbit$\n"
" $name$_.SetNoArena($default_variable$, $string_piece$(value));\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n"
- "inline "
+ "$inline$"
"void $classname$::set_$name$(const $pointer_type$* value, "
"size_t size) {\n"
" $set_hasbit$\n"
@@ -355,30 +310,17 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" $string_piece$(reinterpret_cast<const char*>(value), size));\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline ::std::string* $classname$::mutable_$name$() {\n"
+ "$inline$::std::string* $classname$::mutable_$name$() {\n"
" $set_hasbit$\n"
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
" return $name$_.MutableNoArena($default_variable$);\n"
"}\n"
- "inline ::std::string* $classname$::$release_name$() {\n"
- " // @@protoc_insertion_point(field_release:$full_name$)\n");
-
- if (HasFieldPresence(descriptor_->file())) {
- printer->Print(variables_,
- " if (!has_$name$()) {\n"
- " return NULL;\n"
- " }\n"
- " $clear_hasbit$\n"
- " return $name$_.ReleaseNonDefaultNoArena($default_variable$);\n");
- } else {
- printer->Print(variables_,
+ "$inline$::std::string* $classname$::$release_name$() {\n"
+ " // @@protoc_insertion_point(field_release:$full_name$)\n"
" $clear_hasbit$\n"
- " return $name$_.ReleaseNoArena($default_variable$);\n");
- }
-
- printer->Print(variables_,
+ " return $name$_.ReleaseNoArena($default_variable$);\n"
"}\n"
- "inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
+ "$inline$void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
" if ($name$ != NULL) {\n"
" $set_hasbit$\n"
" } else {\n"
@@ -395,7 +337,7 @@ GenerateNonInlineAccessorDefinitions(io::Printer* printer) const {
if (!descriptor_->default_value_string().empty()) {
// Initialized in GenerateDefaultInstanceAllocator.
printer->Print(variables_,
- "::google::protobuf::internal::ExplicitlyConstructed<::std::string> "
+ "::google::protobuf::internal::ExplicitlyConstructed< ::std::string> "
"$classname$::$default_variable_name$;\n");
}
}
@@ -435,34 +377,18 @@ GenerateMessageClearingCode(io::Printer* printer) const {
// If we have field presence, then the Clear() method of the protocol buffer
// will have checked that this field is set. If so, we can avoid redundant
// checks against default_variable.
- const bool must_be_present =
- HasFieldPresence(descriptor_->file());
-
- if (inlined_ && must_be_present) {
- // Calling mutable_$name$() gives us a string reference and sets the has bit
- // for $name$ (in proto2). We may get here when the string field is inlined
- // but the string's contents have not been changed by the user, so we cannot
- // make an assertion about the contents of the string and could never make
- // an assertion about the string instance.
- //
- // For non-inlined strings, we distinguish from non-default by comparing
- // instances, rather than contents.
+ const bool must_be_present = HasFieldPresence(descriptor_->file());
+
+ if (must_be_present) {
printer->Print(variables_,
"GOOGLE_DCHECK(!$name$_.IsDefault($default_variable$));\n");
}
if (SupportsArenas(descriptor_)) {
if (descriptor_->default_value_string().empty()) {
- if (must_be_present) {
- printer->Print(variables_,
- "$name$_.ClearNonDefaultToEmpty();\n");
- } else {
- printer->Print(variables_,
- "$name$_.ClearToEmpty($default_variable$, GetArenaNoVirtual());\n");
- }
+ printer->Print(variables_,
+ "$name$_.ClearToEmpty($default_variable$, GetArenaNoVirtual());\n");
} else {
- // Clear to a non-empty default is more involved, as we try to use the
- // Arena if one is present and may need to reallocate the string.
printer->Print(variables_,
"$name$_.ClearToDefault($default_variable$, GetArenaNoVirtual());\n");
}
@@ -470,11 +396,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$_.ClearNonDefaultToEmptyNoArena();\n");
+ printer->Print(variables_,
+ "(*$name$_.UnsafeRawStringPointer())->clear();\n");
} else {
- printer->Print(
- variables_,
- "$name$_.UnsafeMutablePointer()->assign(*$default_variable$);\n");
+ printer->Print(variables_,
+ "(*$name$_.UnsafeRawStringPointer())->assign(*$default_variable$);\n");
}
} else {
if (descriptor_->default_value_string().empty()) {
@@ -501,29 +427,13 @@ GenerateMergingCode(io::Printer* printer) const {
void StringFieldGenerator::
GenerateSwappingCode(io::Printer* printer) const {
- if (inlined_) {
- printer->Print(
- variables_,
- "$name$_.Swap(&other->$name$_);\n");
- } else {
- printer->Print(
- variables_,
- "$name$_.Swap(&other->$name$_, $default_variable$,\n"
- " GetArenaNoVirtual());\n");
- }
+ printer->Print(variables_, "$name$_.Swap(&other->$name$_);\n");
}
void StringFieldGenerator::
GenerateConstructorCode(io::Printer* printer) const {
- // TODO(ckennelly): Construct non-empty strings as part of the initializer
- // list.
- if (inlined_ && descriptor_->default_value_string().empty()) {
- // Automatic initialization will construct the string.
- return;
- }
-
printer->Print(variables_,
- "$name$_.UnsafeSetDefault($default_variable$);\n");
+ "$name$_.UnsafeSetDefault($default_variable$);\n");
}
void StringFieldGenerator::
@@ -543,7 +453,7 @@ GenerateCopyConstructorCode(io::Printer* printer) const {
if (SupportsArenas(descriptor_) || descriptor_->containing_oneof() != NULL) {
// TODO(gpike): improve this
printer->Print(variables_,
- "$name$_.Set$lite$($default_variable$, from.$name$(),\n"
+ "$name$_.Set($default_variable$, from.$name$(),\n"
" GetArenaNoVirtual());\n");
} else {
printer->Print(variables_,
@@ -556,36 +466,27 @@ GenerateCopyConstructorCode(io::Printer* printer) const {
void StringFieldGenerator::
GenerateDestructorCode(io::Printer* printer) const {
- if (inlined_) {
- // The destructor is automatically invoked.
- return;
- }
-
- printer->Print(variables_, "$name$_.DestroyNoArena($default_variable$);\n");
-}
-
-bool StringFieldGenerator::GenerateArenaDestructorCode(
- io::Printer* printer) const {
- if (!inlined_) {
- return false;
+ if (SupportsArenas(descriptor_)) {
+ // The variable |arena| is defined by the enclosing code.
+ // See MessageGenerator::GenerateSharedDestructorCode.
+ printer->Print(variables_,
+ "$name$_.Destroy($default_variable$, arena);\n");
+ } else {
+ printer->Print(variables_,
+ "$name$_.DestroyNoArena($default_variable$);\n");
}
-
- printer->Print(variables_,
- "_this->$name$_.DestroyNoArena($default_variable$);\n");
- return true;
}
void StringFieldGenerator::
GenerateDefaultInstanceAllocator(io::Printer* printer) const {
if (!descriptor_->default_value_string().empty()) {
- printer->Print(
- variables_,
- "$ns$::$classname$::$default_variable_name$.DefaultConstruct();\n"
- "*$ns$::$classname$::$default_variable_name$.get_mutable() = "
- "::std::string($default$, $default_length$);\n"
- "::google::protobuf::internal::OnShutdownDestroyString(\n"
- " $ns$::$classname$::$default_variable_name$.get_mutable());\n"
- );
+ printer->Print(variables_,
+ "$classname$::$default_variable_name$.DefaultConstruct();\n"
+ "*$classname$::$default_variable_name$.get_mutable() = "
+ "::std::string($default$, $default_length$);\n"
+ "::google::protobuf::internal::OnShutdownDestroyString(\n"
+ " $classname$::$default_variable_name$.get_mutable());\n"
+ );
}
}
@@ -603,11 +504,6 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
}
}
-bool StringFieldGenerator::
-MergeFromCodedStreamNeedsArena() const {
- return false;
-}
-
void StringFieldGenerator::
GenerateSerializeWithCachedSizes(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
@@ -643,136 +539,134 @@ GenerateByteSize(io::Printer* printer) const {
" this->$name$());\n");
}
-uint32 StringFieldGenerator::CalculateFieldTag() const {
- return inlined_ ? 1 : 0;
-}
-
// ===================================================================
-StringOneofFieldGenerator::StringOneofFieldGenerator(
- const FieldDescriptor* descriptor, const Options& options)
- : StringFieldGenerator(descriptor, options) {
- inlined_ = false;
-
+StringOneofFieldGenerator::
+StringOneofFieldGenerator(const FieldDescriptor* descriptor,
+ const Options& options)
+ : StringFieldGenerator(descriptor, options),
+ dependent_field_(options.proto_h) {
SetCommonOneofFieldVariables(descriptor, &variables_);
}
StringOneofFieldGenerator::~StringOneofFieldGenerator() {}
void StringOneofFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
if (SupportsArenas(descriptor_)) {
printer->Print(
- variables_,
- "inline const ::std::string& $classname$::$name$() const {\n"
+ variables,
+ "$inline$const ::std::string& $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" if (has_$name$()) {\n"
- " return $field_member$.Get();\n"
+ " return $oneof_prefix$$name$_.Get();\n"
" }\n"
" return *$default_variable$;\n"
"}\n"
- "inline void $classname$::set_$name$(const ::std::string& value) {\n"
+ "$inline$void $classname$::set_$name$(const ::std::string& value) {\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $field_member$.Set$lite$($default_variable$, value,\n"
+ " $oneof_prefix$$name$_.Set($default_variable$, value,\n"
" GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"#if LANG_CXX11\n"
- "inline void $classname$::set_$name$(::std::string&& value) {\n"
+ "$inline$void $classname$::set_$name$(::std::string&& value) {\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $field_member$.Set$lite$(\n"
+ " $oneof_prefix$$name$_.Set(\n"
" $default_variable$, ::std::move(value), GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n"
"}\n"
"#endif\n"
- "inline void $classname$::set_$name$(const char* value) {\n"
+ "$inline$void $classname$::set_$name$(const char* value) {\n"
" $null_check$"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $field_member$.Set$lite$($default_variable$,\n"
+ " $oneof_prefix$$name$_.Set($default_variable$,\n"
" $string_piece$(value), GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n"
- "inline "
+ "$inline$"
"void $classname$::set_$name$(const $pointer_type$* value,\n"
" size_t size) {\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $field_member$.Set$lite$(\n"
- " $default_variable$, $string_piece$(\n"
+ " $oneof_prefix$$name$_.Set($default_variable$, $string_piece$(\n"
" reinterpret_cast<const char*>(value), size),\n"
" GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline ::std::string* $classname$::mutable_$name$() {\n"
+ "$inline$::std::string* $classname$::mutable_$name$() {\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " return $field_member$.Mutable($default_variable$,\n"
+ " return $oneof_prefix$$name$_.Mutable($default_variable$,\n"
" GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
"}\n"
- "inline ::std::string* $classname$::$release_name$() {\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 $field_member$.Release($default_variable$,\n"
+ " return $oneof_prefix$$name$_.Release($default_variable$,\n"
" GetArenaNoVirtual());\n"
" } else {\n"
" return NULL;\n"
" }\n"
"}\n"
- "inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
- " if (!has_$name$()) {\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
- " }\n"
- " clear_$oneof_name$();\n"
- " if ($name$ != NULL) {\n"
- " set_has_$name$();\n"
- " $field_member$.SetAllocated($default_variable$, $name$,\n"
- " GetArenaNoVirtual());\n"
- " }\n"
- " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
- "}\n"
- "inline ::std::string* $classname$::unsafe_arena_release_$name$() {\n"
+ "$inline$::std::string* $classname$::unsafe_arena_release_$name$() {\n"
" // "
"@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
" GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n"
" if (has_$name$()) {\n"
" clear_has_$oneof_name$();\n"
- " return $field_member$.UnsafeArenaRelease(\n"
+ " return $oneof_prefix$$name$_.UnsafeArenaRelease(\n"
" $default_variable$, GetArenaNoVirtual());\n"
" } else {\n"
" return NULL;\n"
" }\n"
"}\n"
- "inline void $classname$::unsafe_arena_set_allocated_$name$("
+ "$inline$void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
+ " if (!has_$name$()) {\n"
+ " $oneof_prefix$$name$_.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"
+ " GetArenaNoVirtual());\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
+ "}\n"
+ "$inline$void $classname$::unsafe_arena_set_allocated_$name$("
"::std::string* $name$) {\n"
" GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n"
" if (!has_$name$()) {\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
" clear_$oneof_name$();\n"
" if ($name$) {\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeArenaSetAllocated($default_variable$, "
+ " $oneof_prefix$$name$_.UnsafeArenaSetAllocated($default_variable$, "
"$name$, GetArenaNoVirtual());\n"
" }\n"
" // @@protoc_insertion_point(field_unsafe_arena_set_allocated:"
@@ -781,85 +675,88 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
} else {
// No-arena case.
printer->Print(
- variables_,
- "inline const ::std::string& $classname$::$name$() const {\n"
+ variables,
+ "$inline$const ::std::string& $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" if (has_$name$()) {\n"
- " return $field_member$.GetNoArena();\n"
+ " return $oneof_prefix$$name$_.GetNoArena();\n"
" }\n"
" return *$default_variable$;\n"
"}\n"
- "inline void $classname$::set_$name$(const ::std::string& value) {\n"
+ "$inline$void $classname$::set_$name$(const ::std::string& value) {\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $field_member$.SetNoArena($default_variable$, value);\n"
+ " $oneof_prefix$$name$_.SetNoArena($default_variable$, value);\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"#if LANG_CXX11\n"
- "inline void $classname$::set_$name$(::std::string&& value) {\n"
+ "$inline$void $classname$::set_$name$(::std::string&& value) {\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $field_member$.SetNoArena($default_variable$, ::std::move(value));\n"
+ " $oneof_prefix$$name$_.SetNoArena(\n"
+ " $default_variable$, ::std::move(value));\n"
" // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n"
"}\n"
"#endif\n"
- "inline void $classname$::set_$name$(const char* value) {\n"
+ "$inline$void $classname$::set_$name$(const char* value) {\n"
" $null_check$"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $field_member$.SetNoArena($default_variable$,\n"
+ " $oneof_prefix$$name$_.SetNoArena($default_variable$,\n"
" $string_piece$(value));\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n"
- "inline "
+ "$inline$"
"void $classname$::set_$name$(const $pointer_type$* value, size_t "
"size) {\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $field_member$.SetNoArena($default_variable$, $string_piece$(\n"
+ " $oneof_prefix$$name$_.SetNoArena($default_variable$, "
+ "$string_piece$(\n"
" reinterpret_cast<const char*>(value), size));\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline ::std::string* $classname$::mutable_$name$() {\n"
+ "$inline$::std::string* $classname$::mutable_$name$() {\n"
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $field_member$.MutableNoArena($default_variable$);\n"
+ " return $oneof_prefix$$name$_.MutableNoArena($default_variable$);\n"
"}\n"
- "inline ::std::string* $classname$::$release_name$() {\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 $field_member$.ReleaseNoArena($default_variable$);\n"
+ " return $oneof_prefix$$name$_.ReleaseNoArena($default_variable$);\n"
" } else {\n"
" return NULL;\n"
" }\n"
"}\n"
- "inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
+ "$inline$void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
" if (!has_$name$()) {\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
+ " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
" }\n"
" clear_$oneof_name$();\n"
" if ($name$ != NULL) {\n"
" set_has_$name$();\n"
- " $field_member$.SetAllocatedNoArena($default_variable$, $name$);\n"
+ " $oneof_prefix$$name$_.SetAllocatedNoArena($default_variable$,\n"
+ " $name$);\n"
" }\n"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
"}\n");
@@ -868,13 +765,30 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
void StringOneofFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
+ std::map<string, string> variables(variables_);
+ if (dependent_field_) {
+ variables["this_message"] = DependentBaseDownCast();
+ // This clearing code may be in the dependent base class. If the default
+ // value is an empty string, then the $default_variable$ is a global
+ // singleton. If the default is not empty, we need to down-cast to get the
+ // default value's global singleton instance. See SetStringVariables() for
+ // possible values of default_variable.
+ if (!descriptor_->default_value_string().empty()) {
+ variables["default_variable"] = "&" + DependentBaseDownCast() +
+ variables["default_variable_name"] +
+ ".get()";
+ }
+ } else {
+ variables["this_message"] = "";
+ }
if (SupportsArenas(descriptor_)) {
- printer->Print(variables_,
- "$field_member$.Destroy($default_variable$,\n"
- " GetArenaNoVirtual());\n");
+ printer->Print(variables,
+ "$this_message$$oneof_prefix$$name$_.Destroy($default_variable$,\n"
+ " $this_message$GetArenaNoVirtual());\n");
} else {
- printer->Print(variables_,
- "$field_member$.DestroyNoArena($default_variable$);\n");
+ printer->Print(variables,
+ "$this_message$$oneof_prefix$$name$_."
+ "DestroyNoArena($default_variable$);\n");
}
}
@@ -892,16 +806,24 @@ void StringOneofFieldGenerator::
GenerateConstructorCode(io::Printer* printer) const {
printer->Print(
variables_,
- "$ns$::_$classname$_default_instance_.$name$_.UnsafeSetDefault(\n"
+ "_$classname$_default_instance_.$name$_.UnsafeSetDefault(\n"
" $default_variable$);\n");
}
void StringOneofFieldGenerator::
GenerateDestructorCode(io::Printer* printer) const {
- printer->Print(variables_,
- "if (has_$name$()) {\n"
- " $field_member$.DestroyNoArena($default_variable$);\n"
- "}\n");
+ if (SupportsArenas(descriptor_)) {
+ printer->Print(variables_,
+ "if (has_$name$()) {\n"
+ " $oneof_prefix$$name$_.Destroy($default_variable$,\n"
+ " GetArenaNoVirtual());\n"
+ "}\n");
+ } else {
+ printer->Print(variables_,
+ "if (has_$name$()) {\n"
+ " $oneof_prefix$$name$_.DestroyNoArena($default_variable$);\n"
+ "}\n");
+ }
}
void StringOneofFieldGenerator::
@@ -1015,78 +937,71 @@ 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 ::std::string* $classname$::mutable_$name$(int index) {\n"
+GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const {
+ std::map<string, string> variables(variables_);
+ variables["inline"] = is_inline ? "inline " : "";
+ 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"
"}\n"
- "inline void $classname$::set_$name$(int index, const ::std::string& value) {\n"
+ "$inline$void $classname$::set_$name$(int index, const ::std::string& value) {\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
" $name$_.Mutable(index)->assign(value);\n"
"}\n"
"#if LANG_CXX11\n"
- "inline void $classname$::set_$name$(int index, ::std::string&& value) {\n"
+ "$inline$void $classname$::set_$name$(int index, ::std::string&& value) {\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
" $name$_.Mutable(index)->assign(std::move(value));\n"
"}\n"
"#endif\n"
- "inline void $classname$::set_$name$(int index, const char* value) {\n"
+ "$inline$void $classname$::set_$name$(int index, const char* value) {\n"
" $null_check$"
" $name$_.Mutable(index)->assign(value);\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n"
- "inline void "
+ "$inline$void "
"$classname$::set_$name$"
"(int index, const $pointer_type$* value, size_t size) {\n"
" $name$_.Mutable(index)->assign(\n"
" reinterpret_cast<const char*>(value), size);\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline ::std::string* $classname$::add_$name$() {\n"
+ "$inline$::std::string* $classname$::add_$name$() {\n"
" // @@protoc_insertion_point(field_add_mutable:$full_name$)\n"
" return $name$_.Add();\n"
"}\n"
- "inline void $classname$::add_$name$(const ::std::string& value) {\n"
+ "$inline$void $classname$::add_$name$(const ::std::string& value) {\n"
" $name$_.Add()->assign(value);\n"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
"}\n"
"#if LANG_CXX11\n"
- "inline void $classname$::add_$name$(::std::string&& value) {\n"
+ "$inline$void $classname$::add_$name$(::std::string&& value) {\n"
" $name$_.Add(std::move(value));\n"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
"}\n"
"#endif\n"
- "inline void $classname$::add_$name$(const char* value) {\n"
+ "$inline$void $classname$::add_$name$(const char* value) {\n"
" $null_check$"
" $name$_.Add()->assign(value);\n"
" // @@protoc_insertion_point(field_add_char:$full_name$)\n"
"}\n"
- "inline void "
+ "$inline$void "
"$classname$::add_$name$(const $pointer_type$* value, size_t size) {\n"
" $name$_.Add()->assign(reinterpret_cast<const char*>(value), size);\n"
" // @@protoc_insertion_point(field_add_pointer:$full_name$)\n"
"}\n"
- "inline const ::google::protobuf::RepeatedPtrField< ::std::string>&\n"
+ "$inline$const ::google::protobuf::RepeatedPtrField< ::std::string>&\n"
"$classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_list:$full_name$)\n"
" return $name$_;\n"
"}\n"
- "inline ::google::protobuf::RepeatedPtrField< ::std::string>*\n"
+ "$inline$::google::protobuf::RepeatedPtrField< ::std::string>*\n"
"$classname$::mutable_$name$() {\n"
" // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
" return &$name$_;\n"
@@ -1105,8 +1020,7 @@ GenerateMergingCode(io::Printer* printer) const {
void RepeatedStringFieldGenerator::
GenerateSwappingCode(io::Printer* printer) const {
- printer->Print(variables_,
- "$name$_.InternalSwap(CastToBase(&other->$name$_));\n");
+ printer->Print(variables_, "$name$_.InternalSwap(&other->$name$_);\n");
}
void RepeatedStringFieldGenerator::
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_string_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_string_field.h
index 6cbf722fc1..531252b0ae 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_string_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_string_field.h
@@ -54,7 +54,8 @@ class StringFieldGenerator : public FieldGenerator {
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateStaticMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMessageClearingCode(io::Printer* printer) const;
@@ -63,22 +64,15 @@ class StringFieldGenerator : public FieldGenerator {
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const;
void GenerateDestructorCode(io::Printer* printer) const;
- bool GenerateArenaDestructorCode(io::Printer* printer) const;
void GenerateDefaultInstanceAllocator(io::Printer* printer) const;
void GenerateMergeFromCodedStream(io::Printer* printer) const;
void GenerateSerializeWithCachedSizes(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
- uint32 CalculateFieldTag() const;
- bool IsInlined() const { return inlined_; }
-
- bool MergeFromCodedStreamNeedsArena() const;
protected:
const FieldDescriptor* descriptor_;
std::map<string, string> variables_;
- const bool lite_;
- bool inlined_;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator);
@@ -91,7 +85,8 @@ class StringOneofFieldGenerator : public StringFieldGenerator {
~StringOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
// StringFieldGenerator, from which we inherit, overrides this so we need to
@@ -103,6 +98,7 @@ class StringOneofFieldGenerator : public StringFieldGenerator {
void GenerateMergeFromCodedStream(io::Printer* printer) const;
private:
+ const bool dependent_field_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOneofFieldGenerator);
};
@@ -115,7 +111,8 @@ class RepeatedStringFieldGenerator : public FieldGenerator {
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
+ void GenerateInlineAccessorDefinitions(io::Printer* printer,
+ bool is_inline) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto
index 7fe9875978..4e25b2ea8f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto
@@ -151,10 +151,6 @@ enum ConflictingEnum { // NO_PROTO3
message DummyMessage {}
-// Message names that could conflict.
-message Shutdown {}
-message TableStruct {}
-
service TestConflictingMethodNames {
rpc Closure(DummyMessage) returns (DummyMessage);
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto
index cb6ca1b151..cb6ca1b151 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.inc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_unittest.cc
index ff6354f815..fdde771b82 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.inc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_unittest.cc
@@ -47,23 +47,30 @@
#include <google/protobuf/compiler/cpp/cpp_unittest.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
+#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/unittest_no_arena.pb.h>
+#include <google/protobuf/unittest_optimize_for.pb.h>
+#include <google/protobuf/unittest_embed_optimize_for.pb.h>
#if !defined(GOOGLE_PROTOBUF_CMAKE_BUILD) && !defined(_MSC_VER)
// We exclude this large proto from cmake build because it's too large for
// visual studio to compile (report internal errors).
#include <google/protobuf/unittest_enormous_descriptor.pb.h>
#endif
+#include <google/protobuf/unittest_no_generic_services.pb.h>
+#include <google/protobuf/test_util.h>
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.h>
#include <google/protobuf/compiler/importer.h>
-#include <google/protobuf/unittest_no_generic_services.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/descriptor.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/stubs/callback.h>
@@ -82,6 +89,8 @@ namespace cpp {
// Can't use an anonymous namespace here due to brokenness of Tru64 compiler.
namespace cpp_unittest {
+namespace protobuf_unittest = ::protobuf_unittest;
+
class MockErrorCollector : public MultiFileErrorCollector {
public:
@@ -103,9 +112,9 @@ class MockErrorCollector : public MultiFileErrorCollector {
// Test that generated code has proper descriptors:
// Parse a descriptor directly (using google::protobuf::compiler::Importer) and
// compare it to the one that was produced by generated code.
-TEST(GENERATED_DESCRIPTOR_TEST_NAME, IdenticalDescriptors) {
+TEST(GeneratedDescriptorTest, IdenticalDescriptors) {
const FileDescriptor* generated_descriptor =
- UNITTEST::TestAllTypes::descriptor()->file();
+ unittest::TestAllTypes::descriptor()->file();
// Set up the Importer.
MockErrorCollector error_collector;
@@ -115,7 +124,7 @@ TEST(GENERATED_DESCRIPTOR_TEST_NAME, IdenticalDescriptors) {
// Import (parse) unittest.proto.
const FileDescriptor* parsed_descriptor =
- importer.Import(UNITTEST_PROTO_PATH);
+ importer.Import("google/protobuf/unittest.proto");
EXPECT_EQ("", error_collector.text_);
ASSERT_TRUE(parsed_descriptor != NULL);
@@ -134,7 +143,7 @@ TEST(GENERATED_DESCRIPTOR_TEST_NAME, IdenticalDescriptors) {
// Touch a descriptor generated from an enormous message to validate special
// handling for descriptors exceeding the C++ standard's recommended minimum
// limit for string literal size
-TEST(GENERATED_DESCRIPTOR_TEST_NAME, EnormousDescriptor) {
+TEST(GeneratedDescriptorTest, EnormousDescriptor) {
const Descriptor* generated_descriptor =
TestEnormousDescriptor::descriptor();
@@ -146,33 +155,33 @@ TEST(GENERATED_DESCRIPTOR_TEST_NAME, EnormousDescriptor) {
// ===================================================================
-TEST(GENERATED_MESSAGE_TEST_NAME, Defaults) {
+TEST(GeneratedMessageTest, Defaults) {
// Check that all default values are set correctly in the initial message.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
TestUtil::ExpectClear(message);
// Messages should return pointers to default instances until first use.
// (This is not checked by ExpectClear() since it is not actually true after
// the fields have been set and then cleared.)
- EXPECT_EQ(&UNITTEST::TestAllTypes::OptionalGroup::default_instance(),
+ EXPECT_EQ(&unittest::TestAllTypes::OptionalGroup::default_instance(),
&message.optionalgroup());
- EXPECT_EQ(&UNITTEST::TestAllTypes::NestedMessage::default_instance(),
+ EXPECT_EQ(&unittest::TestAllTypes::NestedMessage::default_instance(),
&message.optional_nested_message());
- EXPECT_EQ(&UNITTEST::ForeignMessage::default_instance(),
+ EXPECT_EQ(&unittest::ForeignMessage::default_instance(),
&message.optional_foreign_message());
- EXPECT_EQ(&UNITTEST_IMPORT::ImportMessage::default_instance(),
+ EXPECT_EQ(&unittest_import::ImportMessage::default_instance(),
&message.optional_import_message());
}
#ifndef PROTOBUF_USE_DLLS
-TEST(GENERATED_MESSAGE_TEST_NAME, Int32StringConversion) {
+TEST(GeneratedMessageTest, Int32StringConversion) {
EXPECT_EQ("971", Int32ToString(971));
EXPECT_EQ("(~0x7fffffff)", Int32ToString(kint32min));
EXPECT_EQ("2147483647", Int32ToString(kint32max));
}
-TEST(GENERATED_MESSAGE_TEST_NAME, Int64StringConversion) {
+TEST(GeneratedMessageTest, Int64StringConversion) {
EXPECT_EQ("GOOGLE_LONGLONG(971)", Int64ToString(971));
EXPECT_EQ("GOOGLE_LONGLONG(-2147483648)", Int64ToString(kint32min));
EXPECT_EQ("GOOGLE_LONGLONG(~0x7fffffffffffffff)", Int64ToString(kint64min));
@@ -180,9 +189,9 @@ TEST(GENERATED_MESSAGE_TEST_NAME, Int64StringConversion) {
}
#endif // !PROTOBUF_USE_DLLS
-TEST(GENERATED_MESSAGE_TEST_NAME, FloatingPointDefaults) {
- const UNITTEST::TestExtremeDefaultValues& extreme_default =
- UNITTEST::TestExtremeDefaultValues::default_instance();
+TEST(GeneratedMessageTest, FloatingPointDefaults) {
+ const unittest::TestExtremeDefaultValues& extreme_default =
+ unittest::TestExtremeDefaultValues::default_instance();
EXPECT_EQ(0.0f, extreme_default.zero_float());
EXPECT_EQ(1.0f, extreme_default.one_float());
@@ -203,26 +212,26 @@ TEST(GENERATED_MESSAGE_TEST_NAME, FloatingPointDefaults) {
EXPECT_TRUE(extreme_default.nan_float() != extreme_default.nan_float());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, Trigraph) {
- const UNITTEST::TestExtremeDefaultValues& extreme_default =
- UNITTEST::TestExtremeDefaultValues::default_instance();
+TEST(GeneratedMessageTest, Trigraph) {
+ const unittest::TestExtremeDefaultValues& extreme_default =
+ unittest::TestExtremeDefaultValues::default_instance();
EXPECT_EQ("? ? ?? ?? ??? ?\?/ ?\?-", extreme_default.cpp_trigraph());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, ExtremeSmallIntegerDefault) {
- const UNITTEST::TestExtremeDefaultValues& extreme_default =
- UNITTEST::TestExtremeDefaultValues::default_instance();
+TEST(GeneratedMessageTest, ExtremeSmallIntegerDefault) {
+ const unittest::TestExtremeDefaultValues& extreme_default =
+ unittest::TestExtremeDefaultValues::default_instance();
EXPECT_EQ(~0x7fffffff, kint32min);
EXPECT_EQ(GOOGLE_LONGLONG(~0x7fffffffffffffff), kint64min);
EXPECT_EQ(kint32min, extreme_default.really_small_int32());
EXPECT_EQ(kint64min, extreme_default.really_small_int64());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, Accessors) {
+TEST(GeneratedMessageTest, Accessors) {
// Set every field to a unique value then go back and check all those
// values.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
TestUtil::SetAllFields(&message);
TestUtil::ExpectAllFieldsSet(message);
@@ -231,10 +240,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, Accessors) {
TestUtil::ExpectRepeatedFieldsModified(message);
}
-TEST(GENERATED_MESSAGE_TEST_NAME, MutableStringDefault) {
+TEST(GeneratedMessageTest, MutableStringDefault) {
// mutable_foo() for a string should return a string initialized to its
// default value.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
EXPECT_EQ("hello", *message.mutable_default_string());
@@ -247,17 +256,17 @@ TEST(GENERATED_MESSAGE_TEST_NAME, MutableStringDefault) {
EXPECT_EQ("hello", *message.mutable_default_string());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, StringDefaults) {
- UNITTEST::TestExtremeDefaultValues message;
+TEST(GeneratedMessageTest, StringDefaults) {
+ unittest::TestExtremeDefaultValues message;
// Check if '\000' can be used in default string value.
EXPECT_EQ(string("hel\000lo", 6), message.string_with_zero());
EXPECT_EQ(string("wor\000ld", 6), message.bytes_with_zero());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, ReleaseString) {
+TEST(GeneratedMessageTest, ReleaseString) {
// Check that release_foo() starts out NULL, and gives us a value
// that we can delete after it's been set.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
EXPECT_EQ(NULL, message.release_default_string());
EXPECT_FALSE(message.has_default_string());
@@ -265,7 +274,7 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ReleaseString) {
message.set_default_string("blah");
EXPECT_TRUE(message.has_default_string());
- std::unique_ptr<string> str(message.release_default_string());
+ google::protobuf::scoped_ptr<string> str(message.release_default_string());
EXPECT_FALSE(message.has_default_string());
ASSERT_TRUE(str != NULL);
EXPECT_EQ("blah", *str);
@@ -275,16 +284,16 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ReleaseString) {
EXPECT_EQ("hello", message.default_string());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, ReleaseMessage) {
+TEST(GeneratedMessageTest, ReleaseMessage) {
// Check that release_foo() starts out NULL, and gives us a value
// that we can delete after it's been set.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
EXPECT_EQ(NULL, message.release_optional_nested_message());
EXPECT_FALSE(message.has_optional_nested_message());
message.mutable_optional_nested_message()->set_bb(1);
- std::unique_ptr<UNITTEST::TestAllTypes::NestedMessage> nest(
+ google::protobuf::scoped_ptr<unittest::TestAllTypes::NestedMessage> nest(
message.release_optional_nested_message());
EXPECT_FALSE(message.has_optional_nested_message());
ASSERT_TRUE(nest != NULL);
@@ -294,9 +303,9 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ReleaseMessage) {
EXPECT_FALSE(message.has_optional_nested_message());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, SetAllocatedString) {
+TEST(GeneratedMessageTest, SetAllocatedString) {
// Check that set_allocated_foo() works for strings.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
EXPECT_FALSE(message.has_optional_string());
const string kHello("hello");
@@ -312,9 +321,9 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SetAllocatedString) {
EXPECT_EQ(kHello, message.optional_string());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, SetAllocatedMessage) {
+TEST(GeneratedMessageTest, SetAllocatedMessage) {
// Check that set_allocated_foo() can be called in all cases.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
EXPECT_FALSE(message.has_optional_nested_message());
@@ -323,11 +332,11 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SetAllocatedMessage) {
message.set_allocated_optional_nested_message(NULL);
EXPECT_FALSE(message.has_optional_nested_message());
- EXPECT_EQ(&UNITTEST::TestAllTypes::NestedMessage::default_instance(),
+ EXPECT_EQ(&unittest::TestAllTypes::NestedMessage::default_instance(),
&message.optional_nested_message());
message.mutable_optional_nested_message()->set_bb(1);
- UNITTEST::TestAllTypes::NestedMessage* nest =
+ unittest::TestAllTypes::NestedMessage* nest =
message.release_optional_nested_message();
ASSERT_TRUE(nest != NULL);
EXPECT_FALSE(message.has_optional_nested_message());
@@ -337,10 +346,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SetAllocatedMessage) {
EXPECT_EQ(1, message.optional_nested_message().bb());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, Clear) {
+TEST(GeneratedMessageTest, Clear) {
// Set every field to a unique value, clear the message, then check that
// it is cleared.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
TestUtil::SetAllFields(&message);
message.Clear();
@@ -350,18 +359,18 @@ TEST(GENERATED_MESSAGE_TEST_NAME, Clear) {
// messages will return a pointer to the default instance. Instead, they
// should return the objects that were created when mutable_blah() was
// called.
- EXPECT_NE(&UNITTEST::TestAllTypes::OptionalGroup::default_instance(),
+ EXPECT_NE(&unittest::TestAllTypes::OptionalGroup::default_instance(),
&message.optionalgroup());
- EXPECT_NE(&UNITTEST::TestAllTypes::NestedMessage::default_instance(),
+ EXPECT_NE(&unittest::TestAllTypes::NestedMessage::default_instance(),
&message.optional_nested_message());
- EXPECT_NE(&UNITTEST::ForeignMessage::default_instance(),
+ EXPECT_NE(&unittest::ForeignMessage::default_instance(),
&message.optional_foreign_message());
- EXPECT_NE(&UNITTEST_IMPORT::ImportMessage::default_instance(),
+ EXPECT_NE(&unittest_import::ImportMessage::default_instance(),
&message.optional_import_message());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, EmbeddedNullsInBytesCharStar) {
- UNITTEST::TestAllTypes message;
+TEST(GeneratedMessageTest, EmbeddedNullsInBytesCharStar) {
+ unittest::TestAllTypes message;
const char* value = "\0lalala\0\0";
message.set_optional_bytes(value, 9);
@@ -373,10 +382,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, EmbeddedNullsInBytesCharStar) {
EXPECT_EQ(0, memcmp(value, message.repeated_bytes(0).data(), 9));
}
-TEST(GENERATED_MESSAGE_TEST_NAME, ClearOneField) {
+TEST(GeneratedMessageTest, ClearOneField) {
// Set every field to a unique value, then clear one value and insure that
// only that one value is cleared.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
TestUtil::SetAllFields(&message);
int64 original_value = message.optional_int64();
@@ -395,9 +404,9 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ClearOneField) {
TestUtil::ExpectAllFieldsSet(message);
}
-TEST(GENERATED_MESSAGE_TEST_NAME, StringCharStarLength) {
+TEST(GeneratedMessageTest, StringCharStarLength) {
// Verify that we can use a char*,length to set one of the string fields.
- UNITTEST::TestAllTypes message;
+ unittest::TestAllTypes message;
message.set_optional_string("abcdef", 3);
EXPECT_EQ("abc", message.optional_string());
@@ -412,7 +421,7 @@ TEST(GENERATED_MESSAGE_TEST_NAME, StringCharStarLength) {
}
#if LANG_CXX11
-TEST(GENERATED_MESSAGE_TEST_NAME, StringMove) {
+TEST(GeneratedMessageTest, StringMove) {
// Verify that we trigger the move behavior on a scalar setter.
protobuf_unittest_no_arena::TestAllTypes message;
{
@@ -477,8 +486,8 @@ TEST(GENERATED_MESSAGE_TEST_NAME, StringMove) {
#endif
-TEST(GENERATED_MESSAGE_TEST_NAME, CopyFrom) {
- UNITTEST::TestAllTypes message1, message2;
+TEST(GeneratedMessageTest, CopyFrom) {
+ unittest::TestAllTypes message1, message2;
TestUtil::SetAllFields(&message1);
message2.CopyFrom(message1);
@@ -490,8 +499,8 @@ TEST(GENERATED_MESSAGE_TEST_NAME, CopyFrom) {
}
-TEST(GENERATED_MESSAGE_TEST_NAME, SwapWithEmpty) {
- UNITTEST::TestAllTypes message1, message2;
+TEST(GeneratedMessageTest, SwapWithEmpty) {
+ unittest::TestAllTypes message1, message2;
TestUtil::SetAllFields(&message1);
TestUtil::ExpectAllFieldsSet(message1);
@@ -501,45 +510,45 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SwapWithEmpty) {
TestUtil::ExpectClear(message1);
}
-TEST(GENERATED_MESSAGE_TEST_NAME, SwapWithSelf) {
- UNITTEST::TestAllTypes message;
+TEST(GeneratedMessageTest, SwapWithSelf) {
+ unittest::TestAllTypes message;
TestUtil::SetAllFields(&message);
TestUtil::ExpectAllFieldsSet(message);
message.Swap(&message);
TestUtil::ExpectAllFieldsSet(message);
}
-TEST(GENERATED_MESSAGE_TEST_NAME, SwapWithOther) {
- UNITTEST::TestAllTypes message1, message2;
+TEST(GeneratedMessageTest, SwapWithOther) {
+ unittest::TestAllTypes message1, message2;
message1.set_optional_int32(123);
message1.set_optional_string("abc");
message1.mutable_optional_nested_message()->set_bb(1);
- message1.set_optional_nested_enum(UNITTEST::TestAllTypes::FOO);
+ message1.set_optional_nested_enum(unittest::TestAllTypes::FOO);
message1.add_repeated_int32(1);
message1.add_repeated_int32(2);
message1.add_repeated_string("a");
message1.add_repeated_string("b");
message1.add_repeated_nested_message()->set_bb(7);
message1.add_repeated_nested_message()->set_bb(8);
- message1.add_repeated_nested_enum(UNITTEST::TestAllTypes::FOO);
- message1.add_repeated_nested_enum(UNITTEST::TestAllTypes::BAR);
+ message1.add_repeated_nested_enum(unittest::TestAllTypes::FOO);
+ message1.add_repeated_nested_enum(unittest::TestAllTypes::BAR);
message2.set_optional_int32(456);
message2.set_optional_string("def");
message2.mutable_optional_nested_message()->set_bb(2);
- message2.set_optional_nested_enum(UNITTEST::TestAllTypes::BAR);
+ message2.set_optional_nested_enum(unittest::TestAllTypes::BAR);
message2.add_repeated_int32(3);
message2.add_repeated_string("c");
message2.add_repeated_nested_message()->set_bb(9);
- message2.add_repeated_nested_enum(UNITTEST::TestAllTypes::BAZ);
+ message2.add_repeated_nested_enum(unittest::TestAllTypes::BAZ);
message1.Swap(&message2);
EXPECT_EQ(456, message1.optional_int32());
EXPECT_EQ("def", message1.optional_string());
EXPECT_EQ(2, message1.optional_nested_message().bb());
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR, message1.optional_nested_enum());
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message1.optional_nested_enum());
ASSERT_EQ(1, message1.repeated_int32_size());
EXPECT_EQ(3, message1.repeated_int32(0));
ASSERT_EQ(1, message1.repeated_string_size());
@@ -547,12 +556,12 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SwapWithOther) {
ASSERT_EQ(1, message1.repeated_nested_message_size());
EXPECT_EQ(9, message1.repeated_nested_message(0).bb());
ASSERT_EQ(1, message1.repeated_nested_enum_size());
- EXPECT_EQ(UNITTEST::TestAllTypes::BAZ, message1.repeated_nested_enum(0));
+ EXPECT_EQ(unittest::TestAllTypes::BAZ, message1.repeated_nested_enum(0));
EXPECT_EQ(123, message2.optional_int32());
EXPECT_EQ("abc", message2.optional_string());
EXPECT_EQ(1, message2.optional_nested_message().bb());
- EXPECT_EQ(UNITTEST::TestAllTypes::FOO, message2.optional_nested_enum());
+ EXPECT_EQ(unittest::TestAllTypes::FOO, message2.optional_nested_enum());
ASSERT_EQ(2, message2.repeated_int32_size());
EXPECT_EQ(1, message2.repeated_int32(0));
EXPECT_EQ(2, message2.repeated_int32(1));
@@ -563,12 +572,12 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SwapWithOther) {
EXPECT_EQ(7, message2.repeated_nested_message(0).bb());
EXPECT_EQ(8, message2.repeated_nested_message(1).bb());
ASSERT_EQ(2, message2.repeated_nested_enum_size());
- EXPECT_EQ(UNITTEST::TestAllTypes::FOO, message2.repeated_nested_enum(0));
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR, message2.repeated_nested_enum(1));
+ EXPECT_EQ(unittest::TestAllTypes::FOO, message2.repeated_nested_enum(0));
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message2.repeated_nested_enum(1));
}
-TEST(GENERATED_MESSAGE_TEST_NAME, ADLSwap) {
- UNITTEST::TestAllTypes message1, message2;
+TEST(GeneratedMessageTest, ADLSwap) {
+ unittest::TestAllTypes message1, message2;
TestUtil::SetAllFields(&message1);
// Note the address of one of the repeated fields, to verify it was swapped
@@ -584,28 +593,30 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ADLSwap) {
EXPECT_EQ(addr, &message2.repeated_int32().Get(0));
}
-TEST(GENERATED_MESSAGE_TEST_NAME, CopyConstructor) {
+TEST(GeneratedMessageTest, CopyConstructor) {
// All set.
{
- UNITTEST::TestAllTypes message1;
+ unittest::TestAllTypes message1;
TestUtil::SetAllFields(&message1);
- UNITTEST::TestAllTypes message2(message1);
+ unittest::TestAllTypes message2(message1);
TestUtil::ExpectAllFieldsSet(message2);
}
// None set.
{
- UNITTEST::TestAllTypes message1;
- UNITTEST::TestAllTypes message2(message1);
+ unittest::TestAllTypes message1;
+ unittest::TestAllTypes message2(message1);
EXPECT_FALSE(message1.has_optional_string());
EXPECT_FALSE(message2.has_optional_string());
- EXPECT_EQ(message1.optional_string(), message2.optional_string());
+ EXPECT_EQ(&message1.optional_string(),
+ &message2.optional_string());
EXPECT_FALSE(message1.has_optional_bytes());
EXPECT_FALSE(message2.has_optional_bytes());
- EXPECT_EQ(message1.optional_bytes(), message2.optional_bytes());
+ EXPECT_EQ(&message1.optional_bytes(),
+ &message2.optional_bytes());
EXPECT_FALSE(message1.has_optional_nested_message());
EXPECT_FALSE(message2.has_optional_nested_message());
@@ -634,17 +645,17 @@ TEST(GENERATED_MESSAGE_TEST_NAME, CopyConstructor) {
}
}
-TEST(GENERATED_MESSAGE_TEST_NAME, CopyConstructorWithArenas) {
+TEST(GeneratedMessageTest, CopyConstructorWithArenas) {
Arena arena;
- UNITTEST::TestAllTypes* message1 =
- Arena::CreateMessage<UNITTEST::TestAllTypes>(&arena);
+ unittest::TestAllTypes* message1 =
+ Arena::CreateMessage<unittest::TestAllTypes>(&arena);
TestUtil::SetAllFields(message1);
- UNITTEST::TestAllTypes message2_stack(*message1);
+ unittest::TestAllTypes message2_stack(*message1);
TestUtil::ExpectAllFieldsSet(message2_stack);
- std::unique_ptr<UNITTEST::TestAllTypes> message2_heap(
- new UNITTEST::TestAllTypes(*message1));
+ google::protobuf::scoped_ptr<unittest::TestAllTypes> message2_heap(
+ new unittest::TestAllTypes(*message1));
TestUtil::ExpectAllFieldsSet(*message2_heap);
arena.Reset();
@@ -654,11 +665,11 @@ TEST(GENERATED_MESSAGE_TEST_NAME, CopyConstructorWithArenas) {
TestUtil::ExpectAllFieldsSet(*message2_heap);
}
-TEST(GENERATED_MESSAGE_TEST_NAME, CopyAssignmentOperator) {
- UNITTEST::TestAllTypes message1;
+TEST(GeneratedMessageTest, CopyAssignmentOperator) {
+ unittest::TestAllTypes message1;
TestUtil::SetAllFields(&message1);
- UNITTEST::TestAllTypes message2;
+ unittest::TestAllTypes message2;
message2 = message1;
TestUtil::ExpectAllFieldsSet(message2);
@@ -669,10 +680,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, CopyAssignmentOperator) {
#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \
!defined(GOOGLE_PROTOBUF_NO_RTTI)
-TEST(GENERATED_MESSAGE_TEST_NAME, UpcastCopyFrom) {
+TEST(GeneratedMessageTest, UpcastCopyFrom) {
// Test the CopyFrom method that takes in the generic const Message&
// parameter.
- UNITTEST::TestAllTypes message1, message2;
+ unittest::TestAllTypes message1, message2;
TestUtil::SetAllFields(&message1);
@@ -685,19 +696,19 @@ TEST(GENERATED_MESSAGE_TEST_NAME, UpcastCopyFrom) {
#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
-TEST(GENERATED_MESSAGE_TEST_NAME, DynamicMessageCopyFrom) {
+TEST(GeneratedMessageTest, DynamicMessageCopyFrom) {
// Test copying from a DynamicMessage, which must fall back to using
// reflection.
- UNITTEST::TestAllTypes message2;
+ unittest::TestAllTypes message2;
// Construct a new version of the dynamic message via the factory.
DynamicMessageFactory factory;
- std::unique_ptr<Message> message1;
+ google::protobuf::scoped_ptr<Message> message1;
message1.reset(factory.GetPrototype(
- UNITTEST::TestAllTypes::descriptor())->New());
+ unittest::TestAllTypes::descriptor())->New());
TestUtil::ReflectionTester reflection_tester(
- UNITTEST::TestAllTypes::descriptor());
+ unittest::TestAllTypes::descriptor());
reflection_tester.SetAllFieldsViaReflection(message1.get());
message2.CopyFrom(*message1);
@@ -707,10 +718,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, DynamicMessageCopyFrom) {
#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
-TEST(GENERATED_MESSAGE_TEST_NAME, NonEmptyMergeFrom) {
+TEST(GeneratedMessageTest, NonEmptyMergeFrom) {
// Test merging with a non-empty message. Code is a modified form
// of that found in google/protobuf/reflection_ops_unittest.cc.
- UNITTEST::TestAllTypes message1, message2;
+ unittest::TestAllTypes message1, message2;
TestUtil::SetAllFields(&message1);
@@ -733,13 +744,28 @@ TEST(GENERATED_MESSAGE_TEST_NAME, NonEmptyMergeFrom) {
TestUtil::ExpectAllFieldsSet(message1);
}
+#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \
+ !defined(GOOGLE_PROTOBUF_NO_RTTI)
+#ifdef PROTOBUF_HAS_DEATH_TEST
+#ifndef NDEBUG
+
+TEST(GeneratedMessageTest, MergeFromSelf) {
+ unittest::TestAllTypes message;
+ EXPECT_DEATH(message.MergeFrom(message), "pb[.]cc.*Check failed:");
+ EXPECT_DEATH(message.MergeFrom(implicit_cast<const Message&>(message)),
+ "pb[.]cc.*Check failed:");
+}
+
+#endif // NDEBUG
+#endif // PROTOBUF_HAS_DEATH_TEST
+#endif // !PROTOBUF_TEST_NO_DESCRIPTORS || !GOOGLE_PROTOBUF_NO_RTTI
// Test the generated SerializeWithCachedSizesToArray(),
-TEST(GENERATED_MESSAGE_TEST_NAME, SerializationToArray) {
- UNITTEST::TestAllTypes message1, message2;
+TEST(GeneratedMessageTest, SerializationToArray) {
+ unittest::TestAllTypes message1, message2;
string data;
TestUtil::SetAllFields(&message1);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
uint8* start = reinterpret_cast<uint8*>(string_as_array(&data));
uint8* end = message1.SerializeWithCachedSizesToArray(start);
@@ -749,11 +775,11 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SerializationToArray) {
}
-TEST(GENERATED_MESSAGE_TEST_NAME, PackedFieldsSerializationToArray) {
- UNITTEST::TestPackedTypes packed_message1, packed_message2;
+TEST(GeneratedMessageTest, PackedFieldsSerializationToArray) {
+ unittest::TestPackedTypes packed_message1, packed_message2;
string packed_data;
TestUtil::SetPackedFields(&packed_message1);
- int packed_size = packed_message1.ByteSizeLong();
+ int packed_size = packed_message1.ByteSize();
packed_data.resize(packed_size);
uint8* start = reinterpret_cast<uint8*>(string_as_array(&packed_data));
uint8* end = packed_message1.SerializeWithCachedSizesToArray(start);
@@ -764,10 +790,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, PackedFieldsSerializationToArray) {
// Test the generated SerializeWithCachedSizes() by forcing the buffer to write
// one byte at a time.
-TEST(GENERATED_MESSAGE_TEST_NAME, SerializationToStream) {
- UNITTEST::TestAllTypes message1, message2;
+TEST(GeneratedMessageTest, SerializationToStream) {
+ unittest::TestAllTypes message1, message2;
TestUtil::SetAllFields(&message1);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
string data;
data.resize(size);
{
@@ -783,10 +809,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SerializationToStream) {
}
-TEST(GENERATED_MESSAGE_TEST_NAME, PackedFieldsSerializationToStream) {
- UNITTEST::TestPackedTypes message1, message2;
+TEST(GeneratedMessageTest, PackedFieldsSerializationToStream) {
+ unittest::TestPackedTypes message1, message2;
TestUtil::SetPackedFields(&message1);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
string data;
data.resize(size);
{
@@ -802,9 +828,9 @@ TEST(GENERATED_MESSAGE_TEST_NAME, PackedFieldsSerializationToStream) {
}
-TEST(GENERATED_MESSAGE_TEST_NAME, Required) {
+TEST(GeneratedMessageTest, Required) {
// Test that IsInitialized() returns false if required fields are missing.
- UNITTEST::TestRequired message;
+ unittest::TestRequired message;
EXPECT_FALSE(message.IsInitialized());
message.set_a(1);
@@ -815,10 +841,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, Required) {
EXPECT_TRUE(message.IsInitialized());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, RequiredForeign) {
+TEST(GeneratedMessageTest, RequiredForeign) {
// Test that IsInitialized() returns false if required fields in nested
// messages are missing.
- UNITTEST::TestRequiredForeign message;
+ unittest::TestRequiredForeign message;
EXPECT_TRUE(message.IsInitialized());
@@ -839,21 +865,21 @@ TEST(GENERATED_MESSAGE_TEST_NAME, RequiredForeign) {
EXPECT_TRUE(message.IsInitialized());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, ForeignNested) {
+TEST(GeneratedMessageTest, ForeignNested) {
// Test that TestAllTypes::NestedMessage can be embedded directly into
// another message.
- UNITTEST::TestForeignNested message;
+ unittest::TestForeignNested message;
// If this compiles and runs without crashing, it must work. We have
// nothing more to test.
- UNITTEST::TestAllTypes::NestedMessage* nested =
+ unittest::TestAllTypes::NestedMessage* nested =
message.mutable_foreign_nested();
nested->set_bb(1);
}
-TEST(GENERATED_MESSAGE_TEST_NAME, ReallyLargeTagNumber) {
+TEST(GeneratedMessageTest, ReallyLargeTagNumber) {
// Test that really large tag numbers don't break anything.
- UNITTEST::TestReallyLargeTagNumber message1, message2;
+ unittest::TestReallyLargeTagNumber message1, message2;
string data;
// For the most part, if this compiles and runs then we're probably good.
@@ -868,11 +894,11 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ReallyLargeTagNumber) {
EXPECT_EQ(5678, message2.bb());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, MutualRecursion) {
+TEST(GeneratedMessageTest, MutualRecursion) {
// Test that mutually-recursive message types work.
- UNITTEST::TestMutualRecursionA message;
- UNITTEST::TestMutualRecursionA* nested = message.mutable_bb()->mutable_a();
- UNITTEST::TestMutualRecursionA* nested2 = nested->mutable_bb()->mutable_a();
+ unittest::TestMutualRecursionA message;
+ unittest::TestMutualRecursionA* nested = message.mutable_bb()->mutable_a();
+ unittest::TestMutualRecursionA* nested2 = nested->mutable_bb()->mutable_a();
// Again, if the above compiles and runs, that's all we really have to
// test, but just for run we'll check that the system didn't somehow come
@@ -882,7 +908,7 @@ TEST(GENERATED_MESSAGE_TEST_NAME, MutualRecursion) {
EXPECT_NE(nested, nested2);
}
-TEST(GENERATED_MESSAGE_TEST_NAME, CamelCaseFieldNames) {
+TEST(GeneratedMessageTest, CamelCaseFieldNames) {
// This test is mainly checking that the following compiles, which verifies
// that the field names were coerced to lower-case.
//
@@ -891,38 +917,76 @@ TEST(GENERATED_MESSAGE_TEST_NAME, CamelCaseFieldNames) {
// names. In proto1, these names were forced to lower-case. So, we do the
// same thing in proto2.
- UNITTEST::TestCamelCaseFieldNames message;
+ unittest::TestCamelCaseFieldNames message;
message.set_primitivefield(2);
message.set_stringfield("foo");
- message.set_enumfield(UNITTEST::FOREIGN_FOO);
+ message.set_enumfield(unittest::FOREIGN_FOO);
message.mutable_messagefield()->set_c(6);
message.add_repeatedprimitivefield(8);
message.add_repeatedstringfield("qux");
- message.add_repeatedenumfield(UNITTEST::FOREIGN_BAR);
+ message.add_repeatedenumfield(unittest::FOREIGN_BAR);
message.add_repeatedmessagefield()->set_c(15);
EXPECT_EQ(2, message.primitivefield());
EXPECT_EQ("foo", message.stringfield());
- EXPECT_EQ(UNITTEST::FOREIGN_FOO, message.enumfield());
+ EXPECT_EQ(unittest::FOREIGN_FOO, message.enumfield());
EXPECT_EQ(6, message.messagefield().c());
EXPECT_EQ(8, message.repeatedprimitivefield(0));
EXPECT_EQ("qux", message.repeatedstringfield(0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.repeatedenumfield(0));
+ EXPECT_EQ(unittest::FOREIGN_BAR, message.repeatedenumfield(0));
EXPECT_EQ(15, message.repeatedmessagefield(0).c());
}
+TEST(GeneratedMessageTest, TestConflictingSymbolNames) {
+ // test_bad_identifiers.proto successfully compiled, then it works. The
+ // following is just a token usage to insure that the code is, in fact,
+ // being compiled and linked.
+
+ protobuf_unittest::TestConflictingSymbolNames message;
+ message.set_uint32(1);
+ EXPECT_EQ(3, message.ByteSize());
+
+ message.set_friend_(5);
+ EXPECT_EQ(5, message.friend_());
+
+ message.set_class_(6);
+ EXPECT_EQ(6, message.class_());
+
+ // Instantiate extension template functions to test conflicting template
+ // parameter names.
+ typedef protobuf_unittest::TestConflictingSymbolNamesExtension ExtensionMessage;
+ message.AddExtension(ExtensionMessage::repeated_int32_ext, 123);
+ EXPECT_EQ(123,
+ message.GetExtension(ExtensionMessage::repeated_int32_ext, 0));
+}
+
+TEST(GeneratedMessageTest, TestConflictingEnumNames) {
+ protobuf_unittest::TestConflictingEnumNames message;
+ message.set_conflicting_enum(protobuf_unittest::TestConflictingEnumNames_NestedConflictingEnum_and_);
+ EXPECT_EQ(1, message.conflicting_enum());
+ message.set_conflicting_enum(protobuf_unittest::TestConflictingEnumNames_NestedConflictingEnum_XOR);
+ EXPECT_EQ(5, message.conflicting_enum());
+
+
+ protobuf_unittest::ConflictingEnum conflicting_enum;
+ conflicting_enum = protobuf_unittest::NOT_EQ;
+ EXPECT_EQ(1, conflicting_enum);
+ conflicting_enum = protobuf_unittest::return_;
+ EXPECT_EQ(3, conflicting_enum);
+}
+
#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
-TEST(GENERATED_MESSAGE_TEST_NAME, TestOptimizedForSize) {
+TEST(GeneratedMessageTest, TestOptimizedForSize) {
// We rely on the tests in reflection_ops_unittest and wire_format_unittest
// to really test that reflection-based methods work. Here we are mostly
// just making sure that TestOptimizedForSize actually builds and seems to
// function.
- UNITTEST::TestOptimizedForSize message, message2;
+ protobuf_unittest::TestOptimizedForSize message, message2;
message.set_i(1);
message.mutable_msg()->set_c(2);
message2.CopyFrom(message);
@@ -930,11 +994,11 @@ TEST(GENERATED_MESSAGE_TEST_NAME, TestOptimizedForSize) {
EXPECT_EQ(2, message2.msg().c());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, TestEmbedOptimizedForSize) {
+TEST(GeneratedMessageTest, TestEmbedOptimizedForSize) {
// Verifies that something optimized for speed can contain something optimized
// for size.
- UNITTEST::TestEmbedOptimizedForSize message, message2;
+ protobuf_unittest::TestEmbedOptimizedForSize message, message2;
message.mutable_optional_message()->set_i(1);
message.add_repeated_message()->mutable_msg()->set_c(2);
string data;
@@ -944,110 +1008,109 @@ TEST(GENERATED_MESSAGE_TEST_NAME, TestEmbedOptimizedForSize) {
EXPECT_EQ(2, message2.repeated_message(0).msg().c());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, TestSpaceUsed) {
- UNITTEST::TestAllTypes message1;
- // sizeof provides a lower bound on SpaceUsedLong().
- EXPECT_LE(sizeof(UNITTEST::TestAllTypes), message1.SpaceUsedLong());
- const size_t empty_message_size = message1.SpaceUsedLong();
+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();
// 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.SpaceUsedLong());
+ EXPECT_EQ(empty_message_size, message1.SpaceUsed());
// On some STL implementations, setting the string to a small value should
- // only increase SpaceUsedLong() by the size of a string object, though this
- // is not true everywhere.
+ // only increase SpaceUsed() by the size of a string object, though this is
+ // not true everywhere.
message1.set_optional_string("abc");
- EXPECT_LE(empty_message_size + message1.optional_string().size(),
- message1.SpaceUsedLong());
+ EXPECT_LE(empty_message_size + sizeof(string), message1.SpaceUsed());
// Setting a string to a value larger than the string object itself should
- // increase SpaceUsedLong(), because it cannot store the value internally.
+ // increase SpaceUsed(), because it cannot store the value internally.
message1.set_optional_string(string(sizeof(string) + 1, 'x'));
- int min_expected_increase = message1.optional_string().capacity();
+ int min_expected_increase = message1.optional_string().capacity() +
+ sizeof(string);
EXPECT_LE(empty_message_size + min_expected_increase,
- message1.SpaceUsedLong());
+ message1.SpaceUsed());
- size_t previous_size = message1.SpaceUsedLong();
+ int previous_size = message1.SpaceUsed();
// 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().SpaceUsedLong());
+ ASSERT_EQ(sizeof(unittest::TestAllTypes::NestedMessage),
+ message1.optional_nested_message().SpaceUsed());
EXPECT_EQ(previous_size +
- sizeof(UNITTEST::TestAllTypes::NestedMessage),
- message1.SpaceUsedLong());
+ sizeof(unittest::TestAllTypes::NestedMessage),
+ message1.SpaceUsed());
}
-TEST(GENERATED_MESSAGE_TEST_NAME, TestOneofSpaceUsed) {
- UNITTEST::TestOneof2 message1;
- EXPECT_LE(sizeof(UNITTEST::TestOneof2), message1.SpaceUsedLong());
+TEST(GeneratedMessageTest, TestOneofSpaceUsed) {
+ unittest::TestOneof2 message1;
+ EXPECT_LE(sizeof(unittest::TestOneof2), message1.SpaceUsed());
- const size_t empty_message_size = message1.SpaceUsedLong();
+ const int empty_message_size = message1.SpaceUsed();
// 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.SpaceUsedLong());
+ EXPECT_EQ(empty_message_size, message1.SpaceUsed());
- // Setting a string in oneof to a small value should only increase
- // SpaceUsedLong() by the size of a string object.
+ // Setting a string in oneof to a small value should only increase SpaceUsed()
+ // by the size of a string object.
message1.set_foo_string("abc");
- EXPECT_LE(empty_message_size + sizeof(string), message1.SpaceUsedLong());
+ EXPECT_LE(empty_message_size + sizeof(string), message1.SpaceUsed());
// Setting a string in oneof to a value larger than the string object itself
- // should increase SpaceUsedLong(), because it cannot store the value
- // internally.
+ // should increase SpaceUsed(), 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.SpaceUsedLong());
+ message1.SpaceUsed());
// 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().SpaceUsedLong());
+ ASSERT_EQ(sizeof(unittest::TestOneof2::NestedMessage),
+ message1.foo_message().SpaceUsed());
EXPECT_EQ(empty_message_size +
- sizeof(UNITTEST::TestOneof2::NestedMessage),
- message1.SpaceUsedLong());
+ sizeof(unittest::TestOneof2::NestedMessage),
+ message1.SpaceUsed());
}
#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
-TEST(GENERATED_MESSAGE_TEST_NAME, FieldConstantValues) {
- UNITTEST::TestRequired message;
- EXPECT_EQ(UNITTEST::TestAllTypes_NestedMessage::kBbFieldNumber, 1);
- EXPECT_EQ(UNITTEST::TestAllTypes::kOptionalInt32FieldNumber, 1);
- EXPECT_EQ(UNITTEST::TestAllTypes::kOptionalgroupFieldNumber, 16);
- EXPECT_EQ(UNITTEST::TestAllTypes::kOptionalNestedMessageFieldNumber, 18);
- EXPECT_EQ(UNITTEST::TestAllTypes::kOptionalNestedEnumFieldNumber, 21);
- EXPECT_EQ(UNITTEST::TestAllTypes::kRepeatedInt32FieldNumber, 31);
- EXPECT_EQ(UNITTEST::TestAllTypes::kRepeatedgroupFieldNumber, 46);
- EXPECT_EQ(UNITTEST::TestAllTypes::kRepeatedNestedMessageFieldNumber, 48);
- EXPECT_EQ(UNITTEST::TestAllTypes::kRepeatedNestedEnumFieldNumber, 51);
-}
-
-TEST(GENERATED_MESSAGE_TEST_NAME, ExtensionConstantValues) {
- EXPECT_EQ(UNITTEST::TestRequired::kSingleFieldNumber, 1000);
- EXPECT_EQ(UNITTEST::TestRequired::kMultiFieldNumber, 1001);
- EXPECT_EQ(UNITTEST::kOptionalInt32ExtensionFieldNumber, 1);
- EXPECT_EQ(UNITTEST::kOptionalgroupExtensionFieldNumber, 16);
- EXPECT_EQ(UNITTEST::kOptionalNestedMessageExtensionFieldNumber, 18);
- EXPECT_EQ(UNITTEST::kOptionalNestedEnumExtensionFieldNumber, 21);
- EXPECT_EQ(UNITTEST::kRepeatedInt32ExtensionFieldNumber, 31);
- EXPECT_EQ(UNITTEST::kRepeatedgroupExtensionFieldNumber, 46);
- EXPECT_EQ(UNITTEST::kRepeatedNestedMessageExtensionFieldNumber, 48);
- EXPECT_EQ(UNITTEST::kRepeatedNestedEnumExtensionFieldNumber, 51);
-}
-
-TEST(GENERATED_MESSAGE_TEST_NAME, ParseFromTruncated) {
+TEST(GeneratedMessageTest, FieldConstantValues) {
+ unittest::TestRequired message;
+ EXPECT_EQ(unittest::TestAllTypes_NestedMessage::kBbFieldNumber, 1);
+ EXPECT_EQ(unittest::TestAllTypes::kOptionalInt32FieldNumber, 1);
+ EXPECT_EQ(unittest::TestAllTypes::kOptionalgroupFieldNumber, 16);
+ EXPECT_EQ(unittest::TestAllTypes::kOptionalNestedMessageFieldNumber, 18);
+ EXPECT_EQ(unittest::TestAllTypes::kOptionalNestedEnumFieldNumber, 21);
+ EXPECT_EQ(unittest::TestAllTypes::kRepeatedInt32FieldNumber, 31);
+ EXPECT_EQ(unittest::TestAllTypes::kRepeatedgroupFieldNumber, 46);
+ EXPECT_EQ(unittest::TestAllTypes::kRepeatedNestedMessageFieldNumber, 48);
+ EXPECT_EQ(unittest::TestAllTypes::kRepeatedNestedEnumFieldNumber, 51);
+}
+
+TEST(GeneratedMessageTest, ExtensionConstantValues) {
+ EXPECT_EQ(unittest::TestRequired::kSingleFieldNumber, 1000);
+ EXPECT_EQ(unittest::TestRequired::kMultiFieldNumber, 1001);
+ EXPECT_EQ(unittest::kOptionalInt32ExtensionFieldNumber, 1);
+ EXPECT_EQ(unittest::kOptionalgroupExtensionFieldNumber, 16);
+ EXPECT_EQ(unittest::kOptionalNestedMessageExtensionFieldNumber, 18);
+ EXPECT_EQ(unittest::kOptionalNestedEnumExtensionFieldNumber, 21);
+ EXPECT_EQ(unittest::kRepeatedInt32ExtensionFieldNumber, 31);
+ EXPECT_EQ(unittest::kRepeatedgroupExtensionFieldNumber, 46);
+ EXPECT_EQ(unittest::kRepeatedNestedMessageExtensionFieldNumber, 48);
+ EXPECT_EQ(unittest::kRepeatedNestedEnumExtensionFieldNumber, 51);
+}
+
+TEST(GeneratedMessageTest, ParseFromTruncated) {
const string long_string = string(128, 'q');
FileDescriptorProto p;
p.add_extension()->set_name(long_string);
@@ -1065,23 +1128,23 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ParseFromTruncated) {
// ===================================================================
-TEST(GENERATED_ENUM_TEST_NAME, EnumValuesAsSwitchCases) {
+TEST(GeneratedEnumTest, EnumValuesAsSwitchCases) {
// Test that our nested enum values can be used as switch cases. This test
// doesn't actually do anything, the proof that it works is that it
// compiles.
int i =0;
- UNITTEST::TestAllTypes::NestedEnum a = UNITTEST::TestAllTypes::BAR;
+ unittest::TestAllTypes::NestedEnum a = unittest::TestAllTypes::BAR;
switch (a) {
- case UNITTEST::TestAllTypes::FOO:
+ case unittest::TestAllTypes::FOO:
i = 1;
break;
- case UNITTEST::TestAllTypes::BAR:
+ case unittest::TestAllTypes::BAR:
i = 2;
break;
- case UNITTEST::TestAllTypes::BAZ:
+ case unittest::TestAllTypes::BAZ:
i = 3;
break;
- case UNITTEST::TestAllTypes::NEG:
+ case unittest::TestAllTypes::NEG:
i = -1;
break;
// no default case: We want to make sure the compiler recognizes that
@@ -1093,57 +1156,57 @@ TEST(GENERATED_ENUM_TEST_NAME, EnumValuesAsSwitchCases) {
EXPECT_EQ(2, i);
}
-TEST(GENERATED_ENUM_TEST_NAME, IsValidValue) {
+TEST(GeneratedEnumTest, IsValidValue) {
// Test enum IsValidValue.
- EXPECT_TRUE(UNITTEST::TestAllTypes::NestedEnum_IsValid(1));
- EXPECT_TRUE(UNITTEST::TestAllTypes::NestedEnum_IsValid(2));
- EXPECT_TRUE(UNITTEST::TestAllTypes::NestedEnum_IsValid(3));
+ EXPECT_TRUE(unittest::TestAllTypes::NestedEnum_IsValid(1));
+ EXPECT_TRUE(unittest::TestAllTypes::NestedEnum_IsValid(2));
+ EXPECT_TRUE(unittest::TestAllTypes::NestedEnum_IsValid(3));
- EXPECT_FALSE(UNITTEST::TestAllTypes::NestedEnum_IsValid(0));
- EXPECT_FALSE(UNITTEST::TestAllTypes::NestedEnum_IsValid(4));
+ EXPECT_FALSE(unittest::TestAllTypes::NestedEnum_IsValid(0));
+ EXPECT_FALSE(unittest::TestAllTypes::NestedEnum_IsValid(4));
// Make sure it also works when there are dups.
- EXPECT_TRUE(UNITTEST::TestEnumWithDupValue_IsValid(1));
- EXPECT_TRUE(UNITTEST::TestEnumWithDupValue_IsValid(2));
- EXPECT_TRUE(UNITTEST::TestEnumWithDupValue_IsValid(3));
+ EXPECT_TRUE(unittest::TestEnumWithDupValue_IsValid(1));
+ EXPECT_TRUE(unittest::TestEnumWithDupValue_IsValid(2));
+ EXPECT_TRUE(unittest::TestEnumWithDupValue_IsValid(3));
- EXPECT_FALSE(UNITTEST::TestEnumWithDupValue_IsValid(0));
- EXPECT_FALSE(UNITTEST::TestEnumWithDupValue_IsValid(4));
+ EXPECT_FALSE(unittest::TestEnumWithDupValue_IsValid(0));
+ EXPECT_FALSE(unittest::TestEnumWithDupValue_IsValid(4));
}
-TEST(GENERATED_ENUM_TEST_NAME, MinAndMax) {
- EXPECT_EQ(UNITTEST::TestAllTypes::NEG,
- UNITTEST::TestAllTypes::NestedEnum_MIN);
- EXPECT_EQ(UNITTEST::TestAllTypes::BAZ,
- UNITTEST::TestAllTypes::NestedEnum_MAX);
- EXPECT_EQ(4, UNITTEST::TestAllTypes::NestedEnum_ARRAYSIZE);
+TEST(GeneratedEnumTest, MinAndMax) {
+ EXPECT_EQ(unittest::TestAllTypes::NEG,
+ unittest::TestAllTypes::NestedEnum_MIN);
+ EXPECT_EQ(unittest::TestAllTypes::BAZ,
+ unittest::TestAllTypes::NestedEnum_MAX);
+ EXPECT_EQ(4, unittest::TestAllTypes::NestedEnum_ARRAYSIZE);
- EXPECT_EQ(UNITTEST::FOREIGN_FOO, UNITTEST::ForeignEnum_MIN);
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ, UNITTEST::ForeignEnum_MAX);
- EXPECT_EQ(7, UNITTEST::ForeignEnum_ARRAYSIZE);
+ EXPECT_EQ(unittest::FOREIGN_FOO, unittest::ForeignEnum_MIN);
+ EXPECT_EQ(unittest::FOREIGN_BAZ, unittest::ForeignEnum_MAX);
+ EXPECT_EQ(7, unittest::ForeignEnum_ARRAYSIZE);
- EXPECT_EQ(1, UNITTEST::TestEnumWithDupValue_MIN);
- EXPECT_EQ(3, UNITTEST::TestEnumWithDupValue_MAX);
- EXPECT_EQ(4, UNITTEST::TestEnumWithDupValue_ARRAYSIZE);
+ EXPECT_EQ(1, unittest::TestEnumWithDupValue_MIN);
+ EXPECT_EQ(3, unittest::TestEnumWithDupValue_MAX);
+ EXPECT_EQ(4, unittest::TestEnumWithDupValue_ARRAYSIZE);
- EXPECT_EQ(UNITTEST::SPARSE_E, UNITTEST::TestSparseEnum_MIN);
- EXPECT_EQ(UNITTEST::SPARSE_C, UNITTEST::TestSparseEnum_MAX);
- EXPECT_EQ(12589235, UNITTEST::TestSparseEnum_ARRAYSIZE);
+ EXPECT_EQ(unittest::SPARSE_E, unittest::TestSparseEnum_MIN);
+ EXPECT_EQ(unittest::SPARSE_C, unittest::TestSparseEnum_MAX);
+ EXPECT_EQ(12589235, unittest::TestSparseEnum_ARRAYSIZE);
// Make sure we can take the address of _MIN, _MAX and _ARRAYSIZE.
void* null_pointer = 0; // NULL may be integer-type, not pointer-type.
- EXPECT_NE(null_pointer, &UNITTEST::TestAllTypes::NestedEnum_MIN);
- EXPECT_NE(null_pointer, &UNITTEST::TestAllTypes::NestedEnum_MAX);
- EXPECT_NE(null_pointer, &UNITTEST::TestAllTypes::NestedEnum_ARRAYSIZE);
+ EXPECT_NE(null_pointer, &unittest::TestAllTypes::NestedEnum_MIN);
+ EXPECT_NE(null_pointer, &unittest::TestAllTypes::NestedEnum_MAX);
+ EXPECT_NE(null_pointer, &unittest::TestAllTypes::NestedEnum_ARRAYSIZE);
- EXPECT_NE(null_pointer, &UNITTEST::ForeignEnum_MIN);
- EXPECT_NE(null_pointer, &UNITTEST::ForeignEnum_MAX);
- EXPECT_NE(null_pointer, &UNITTEST::ForeignEnum_ARRAYSIZE);
+ EXPECT_NE(null_pointer, &unittest::ForeignEnum_MIN);
+ EXPECT_NE(null_pointer, &unittest::ForeignEnum_MAX);
+ EXPECT_NE(null_pointer, &unittest::ForeignEnum_ARRAYSIZE);
// Make sure we can use _MIN and _MAX as switch cases.
- switch (UNITTEST::SPARSE_A) {
- case UNITTEST::TestSparseEnum_MIN:
- case UNITTEST::TestSparseEnum_MAX:
+ switch (unittest::SPARSE_A) {
+ case unittest::TestSparseEnum_MIN:
+ case unittest::TestSparseEnum_MAX:
break;
default:
break;
@@ -1152,49 +1215,49 @@ TEST(GENERATED_ENUM_TEST_NAME, MinAndMax) {
#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
-TEST(GENERATED_ENUM_TEST_NAME, Name) {
+TEST(GeneratedEnumTest, Name) {
// "Names" in the presence of dup values are a bit arbitrary.
- EXPECT_EQ("FOO1", UNITTEST::TestEnumWithDupValue_Name(UNITTEST::FOO1));
- EXPECT_EQ("FOO1", UNITTEST::TestEnumWithDupValue_Name(UNITTEST::FOO2));
-
- EXPECT_EQ("SPARSE_A", UNITTEST::TestSparseEnum_Name(UNITTEST::SPARSE_A));
- EXPECT_EQ("SPARSE_B", UNITTEST::TestSparseEnum_Name(UNITTEST::SPARSE_B));
- EXPECT_EQ("SPARSE_C", UNITTEST::TestSparseEnum_Name(UNITTEST::SPARSE_C));
- EXPECT_EQ("SPARSE_D", UNITTEST::TestSparseEnum_Name(UNITTEST::SPARSE_D));
- EXPECT_EQ("SPARSE_E", UNITTEST::TestSparseEnum_Name(UNITTEST::SPARSE_E));
- EXPECT_EQ("SPARSE_F", UNITTEST::TestSparseEnum_Name(UNITTEST::SPARSE_F));
- EXPECT_EQ("SPARSE_G", UNITTEST::TestSparseEnum_Name(UNITTEST::SPARSE_G));
-}
-
-TEST(GENERATED_ENUM_TEST_NAME, Parse) {
- UNITTEST::TestEnumWithDupValue dup_value = UNITTEST::FOO1;
- EXPECT_TRUE(UNITTEST::TestEnumWithDupValue_Parse("FOO1", &dup_value));
- EXPECT_EQ(UNITTEST::FOO1, dup_value);
- EXPECT_TRUE(UNITTEST::TestEnumWithDupValue_Parse("FOO2", &dup_value));
- EXPECT_EQ(UNITTEST::FOO2, dup_value);
- EXPECT_FALSE(UNITTEST::TestEnumWithDupValue_Parse("FOO", &dup_value));
-}
-
-TEST(GENERATED_ENUM_TEST_NAME, GetEnumDescriptor) {
- EXPECT_EQ(UNITTEST::TestAllTypes::NestedEnum_descriptor(),
- GetEnumDescriptor<UNITTEST::TestAllTypes::NestedEnum>());
- EXPECT_EQ(UNITTEST::ForeignEnum_descriptor(),
- GetEnumDescriptor<UNITTEST::ForeignEnum>());
- EXPECT_EQ(UNITTEST::TestEnumWithDupValue_descriptor(),
- GetEnumDescriptor<UNITTEST::TestEnumWithDupValue>());
- EXPECT_EQ(UNITTEST::TestSparseEnum_descriptor(),
- GetEnumDescriptor<UNITTEST::TestSparseEnum>());
+ EXPECT_EQ("FOO1", unittest::TestEnumWithDupValue_Name(unittest::FOO1));
+ EXPECT_EQ("FOO1", unittest::TestEnumWithDupValue_Name(unittest::FOO2));
+
+ EXPECT_EQ("SPARSE_A", unittest::TestSparseEnum_Name(unittest::SPARSE_A));
+ EXPECT_EQ("SPARSE_B", unittest::TestSparseEnum_Name(unittest::SPARSE_B));
+ EXPECT_EQ("SPARSE_C", unittest::TestSparseEnum_Name(unittest::SPARSE_C));
+ EXPECT_EQ("SPARSE_D", unittest::TestSparseEnum_Name(unittest::SPARSE_D));
+ EXPECT_EQ("SPARSE_E", unittest::TestSparseEnum_Name(unittest::SPARSE_E));
+ EXPECT_EQ("SPARSE_F", unittest::TestSparseEnum_Name(unittest::SPARSE_F));
+ EXPECT_EQ("SPARSE_G", unittest::TestSparseEnum_Name(unittest::SPARSE_G));
+}
+
+TEST(GeneratedEnumTest, Parse) {
+ unittest::TestEnumWithDupValue dup_value = unittest::FOO1;
+ EXPECT_TRUE(unittest::TestEnumWithDupValue_Parse("FOO1", &dup_value));
+ EXPECT_EQ(unittest::FOO1, dup_value);
+ EXPECT_TRUE(unittest::TestEnumWithDupValue_Parse("FOO2", &dup_value));
+ EXPECT_EQ(unittest::FOO2, dup_value);
+ EXPECT_FALSE(unittest::TestEnumWithDupValue_Parse("FOO", &dup_value));
+}
+
+TEST(GeneratedEnumTest, GetEnumDescriptor) {
+ EXPECT_EQ(unittest::TestAllTypes::NestedEnum_descriptor(),
+ GetEnumDescriptor<unittest::TestAllTypes::NestedEnum>());
+ EXPECT_EQ(unittest::ForeignEnum_descriptor(),
+ GetEnumDescriptor<unittest::ForeignEnum>());
+ EXPECT_EQ(unittest::TestEnumWithDupValue_descriptor(),
+ GetEnumDescriptor<unittest::TestEnumWithDupValue>());
+ EXPECT_EQ(unittest::TestSparseEnum_descriptor(),
+ GetEnumDescriptor<unittest::TestSparseEnum>());
}
enum NonProtoEnum {
kFoo = 1,
};
-TEST(GENERATED_ENUM_TEST_NAME, IsProtoEnumTypeTrait) {
- EXPECT_TRUE(is_proto_enum<UNITTEST::TestAllTypes::NestedEnum>::value);
- EXPECT_TRUE(is_proto_enum<UNITTEST::ForeignEnum>::value);
- EXPECT_TRUE(is_proto_enum<UNITTEST::TestEnumWithDupValue>::value);
- EXPECT_TRUE(is_proto_enum<UNITTEST::TestSparseEnum>::value);
+TEST(GeneratedEnumTest, IsProtoEnumTypeTrait) {
+ EXPECT_TRUE(is_proto_enum<unittest::TestAllTypes::NestedEnum>::value);
+ EXPECT_TRUE(is_proto_enum<unittest::ForeignEnum>::value);
+ EXPECT_TRUE(is_proto_enum<unittest::TestEnumWithDupValue>::value);
+ EXPECT_TRUE(is_proto_enum<unittest::TestSparseEnum>::value);
EXPECT_FALSE(is_proto_enum<int>::value);
EXPECT_FALSE(is_proto_enum<NonProtoEnum>::value);
@@ -1207,9 +1270,9 @@ TEST(GENERATED_ENUM_TEST_NAME, IsProtoEnumTypeTrait) {
#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
// Support code for testing services.
-class GENERATED_SERVICE_TEST_NAME : public testing::Test {
+class GeneratedServiceTest : public testing::Test {
protected:
- class MockTestService : public UNITTEST::TestService {
+ class MockTestService : public unittest::TestService {
public:
MockTestService()
: called_(false),
@@ -1226,8 +1289,8 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
// implements TestService ----------------------------------------
void Foo(RpcController* controller,
- const UNITTEST::FooRequest* request,
- UNITTEST::FooResponse* response,
+ const unittest::FooRequest* request,
+ unittest::FooResponse* response,
Closure* done) {
ASSERT_FALSE(called_);
called_ = true;
@@ -1239,8 +1302,8 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
}
void Bar(RpcController* controller,
- const UNITTEST::BarRequest* request,
- UNITTEST::BarResponse* response,
+ const unittest::BarRequest* request,
+ unittest::BarResponse* response,
Closure* done) {
ASSERT_FALSE(called_);
called_ = true;
@@ -1333,8 +1396,8 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
}
};
- GENERATED_SERVICE_TEST_NAME()
- : descriptor_(UNITTEST::TestService::descriptor()),
+ GeneratedServiceTest()
+ : descriptor_(unittest::TestService::descriptor()),
foo_(descriptor_->FindMethodByName("Foo")),
bar_(descriptor_->FindMethodByName("Bar")),
stub_(&mock_channel_),
@@ -1353,33 +1416,33 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
MockController mock_controller_;
MockRpcChannel mock_channel_;
- UNITTEST::TestService::Stub stub_;
+ unittest::TestService::Stub stub_;
// Just so we don't have to re-define these with every test.
- UNITTEST::FooRequest foo_request_;
- UNITTEST::FooResponse foo_response_;
- UNITTEST::BarRequest bar_request_;
- UNITTEST::BarResponse bar_response_;
- std::unique_ptr<Closure> done_;
+ unittest::FooRequest foo_request_;
+ unittest::FooResponse foo_response_;
+ unittest::BarRequest bar_request_;
+ unittest::BarResponse bar_response_;
+ google::protobuf::scoped_ptr<Closure> done_;
};
-TEST_F(GENERATED_SERVICE_TEST_NAME, GetDescriptor) {
+TEST_F(GeneratedServiceTest, GetDescriptor) {
// Test that GetDescriptor() works.
EXPECT_EQ(descriptor_, mock_service_.GetDescriptor());
}
-TEST_F(GENERATED_SERVICE_TEST_NAME, GetChannel) {
+TEST_F(GeneratedServiceTest, GetChannel) {
EXPECT_EQ(&mock_channel_, stub_.channel());
}
-TEST_F(GENERATED_SERVICE_TEST_NAME, OwnsChannel) {
+TEST_F(GeneratedServiceTest, OwnsChannel) {
MockRpcChannel* channel = new MockRpcChannel;
bool destroyed = false;
channel->destroyed_ = &destroyed;
{
- UNITTEST::TestService::Stub owning_stub(channel,
+ unittest::TestService::Stub owning_stub(channel,
Service::STUB_OWNS_CHANNEL);
EXPECT_FALSE(destroyed);
}
@@ -1387,7 +1450,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, OwnsChannel) {
EXPECT_TRUE(destroyed);
}
-TEST_F(GENERATED_SERVICE_TEST_NAME, CallMethod) {
+TEST_F(GeneratedServiceTest, CallMethod) {
// Test that CallMethod() works.
// Call Foo() via CallMethod().
@@ -1411,7 +1474,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, CallMethod) {
EXPECT_EQ("Bar", mock_service_.method_);
}
-TEST_F(GENERATED_SERVICE_TEST_NAME, CallMethodTypeFailure) {
+TEST_F(GeneratedServiceTest, CallMethodTypeFailure) {
// Verify death if we call Foo() with Bar's message types.
#ifdef PROTOBUF_HAS_DEATH_TEST // death tests do not work on Windows yet
@@ -1428,21 +1491,21 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, CallMethodTypeFailure) {
#endif // PROTOBUF_HAS_DEATH_TEST
}
-TEST_F(GENERATED_SERVICE_TEST_NAME, GetPrototypes) {
+TEST_F(GeneratedServiceTest, GetPrototypes) {
// Test Get{Request,Response}Prototype() methods.
- EXPECT_EQ(&UNITTEST::FooRequest::default_instance(),
+ EXPECT_EQ(&unittest::FooRequest::default_instance(),
&mock_service_.GetRequestPrototype(foo_));
- EXPECT_EQ(&UNITTEST::BarRequest::default_instance(),
+ EXPECT_EQ(&unittest::BarRequest::default_instance(),
&mock_service_.GetRequestPrototype(bar_));
- EXPECT_EQ(&UNITTEST::FooResponse::default_instance(),
+ EXPECT_EQ(&unittest::FooResponse::default_instance(),
&mock_service_.GetResponsePrototype(foo_));
- EXPECT_EQ(&UNITTEST::BarResponse::default_instance(),
+ EXPECT_EQ(&unittest::BarResponse::default_instance(),
&mock_service_.GetResponsePrototype(bar_));
}
-TEST_F(GENERATED_SERVICE_TEST_NAME, Stub) {
+TEST_F(GeneratedServiceTest, Stub) {
// Test that the stub class works.
// Call Foo() via the stub.
@@ -1464,12 +1527,12 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, Stub) {
EXPECT_EQ(bar_, mock_channel_.method_);
}
-TEST_F(GENERATED_SERVICE_TEST_NAME, NotImplemented) {
+TEST_F(GeneratedServiceTest, NotImplemented) {
// Test that failing to implement a method of a service causes it to fail
// with a "not implemented" error message.
// A service which doesn't implement any methods.
- class UnimplementedService : public UNITTEST::TestService {
+ class UnimplementedService : public unittest::TestService {
public:
UnimplementedService() {}
};
@@ -1506,43 +1569,43 @@ class OneofTest : public testing::Test {
virtual void SetUp() {
}
- void ExpectEnumCasesWork(const UNITTEST::TestOneof2 &message) {
+ void ExpectEnumCasesWork(const unittest::TestOneof2 &message) {
switch (message.foo_case()) {
- case UNITTEST::TestOneof2::kFooInt:
+ case unittest::TestOneof2::kFooInt:
EXPECT_TRUE(message.has_foo_int());
break;
- case UNITTEST::TestOneof2::kFooString:
+ case unittest::TestOneof2::kFooString:
EXPECT_TRUE(message.has_foo_string());
break;
- case UNITTEST::TestOneof2::kFooCord:
+ case unittest::TestOneof2::kFooCord:
EXPECT_TRUE(message.has_foo_cord());
break;
- case UNITTEST::TestOneof2::kFooStringPiece:
+ case unittest::TestOneof2::kFooStringPiece:
EXPECT_TRUE(message.has_foo_string_piece());
break;
- case UNITTEST::TestOneof2::kFooBytes:
+ case unittest::TestOneof2::kFooBytes:
EXPECT_TRUE(message.has_foo_bytes());
break;
- case UNITTEST::TestOneof2::kFooEnum:
+ case unittest::TestOneof2::kFooEnum:
EXPECT_TRUE(message.has_foo_enum());
break;
- case UNITTEST::TestOneof2::kFooMessage:
+ case unittest::TestOneof2::kFooMessage:
EXPECT_TRUE(message.has_foo_message());
break;
- case UNITTEST::TestOneof2::kFoogroup:
+ case unittest::TestOneof2::kFoogroup:
EXPECT_TRUE(message.has_foogroup());
break;
- case UNITTEST::TestOneof2::kFooLazyMessage:
+ case unittest::TestOneof2::kFooLazyMessage:
EXPECT_TRUE(message.has_foo_lazy_message());
break;
- case UNITTEST::TestOneof2::FOO_NOT_SET:
+ case unittest::TestOneof2::FOO_NOT_SET:
break;
}
}
};
TEST_F(OneofTest, SettingOneFieldClearsOthers) {
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
message.set_foo_int(123);
EXPECT_TRUE(message.has_foo_int());
@@ -1557,7 +1620,7 @@ TEST_F(OneofTest, SettingOneFieldClearsOthers) {
EXPECT_TRUE(message.has_foo_bytes());
TestUtil::ExpectAtMostOneFieldSetInOneof(message);
- message.set_foo_enum(UNITTEST::TestOneof2::FOO);
+ message.set_foo_enum(unittest::TestOneof2::FOO);
EXPECT_TRUE(message.has_foo_enum());
TestUtil::ExpectAtMostOneFieldSetInOneof(message);
@@ -1578,7 +1641,7 @@ TEST_F(OneofTest, SettingOneFieldClearsOthers) {
}
TEST_F(OneofTest, EnumCases) {
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
message.set_foo_int(123);
ExpectEnumCasesWork(message);
@@ -1586,7 +1649,7 @@ TEST_F(OneofTest, EnumCases) {
ExpectEnumCasesWork(message);
message.set_foo_bytes("qux");
ExpectEnumCasesWork(message);
- message.set_foo_enum(UNITTEST::TestOneof2::FOO);
+ message.set_foo_enum(unittest::TestOneof2::FOO);
ExpectEnumCasesWork(message);
message.mutable_foo_message()->set_qux_int(234);
ExpectEnumCasesWork(message);
@@ -1595,7 +1658,7 @@ TEST_F(OneofTest, EnumCases) {
}
TEST_F(OneofTest, PrimitiveType) {
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
// Unset field returns default value
EXPECT_EQ(message.foo_int(), 0);
@@ -1607,20 +1670,20 @@ TEST_F(OneofTest, PrimitiveType) {
}
TEST_F(OneofTest, EnumType) {
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
// Unset field returns default value
EXPECT_EQ(message.foo_enum(), 1);
- message.set_foo_enum(UNITTEST::TestOneof2::FOO);
+ message.set_foo_enum(unittest::TestOneof2::FOO);
EXPECT_TRUE(message.has_foo_enum());
- EXPECT_EQ(message.foo_enum(), UNITTEST::TestOneof2::FOO);
+ EXPECT_EQ(message.foo_enum(), unittest::TestOneof2::FOO);
message.clear_foo_enum();
EXPECT_FALSE(message.has_foo_enum());
}
TEST_F(OneofTest, SetString) {
// Check that setting a string field in various ways works
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
// Unset field returns default value
EXPECT_EQ(message.foo_string(), "");
@@ -1660,14 +1723,14 @@ TEST_F(OneofTest, SetString) {
TEST_F(OneofTest, ReleaseString) {
// Check that release_foo() starts out NULL, and gives us a value
// that we can delete after it's been set.
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
EXPECT_EQ(NULL, message.release_foo_string());
EXPECT_FALSE(message.has_foo_string());
message.set_foo_string("blah");
EXPECT_TRUE(message.has_foo_string());
- std::unique_ptr<string> str(message.release_foo_string());
+ google::protobuf::scoped_ptr<string> str(message.release_foo_string());
EXPECT_FALSE(message.has_foo_string());
ASSERT_TRUE(str != NULL);
EXPECT_EQ("blah", *str);
@@ -1678,7 +1741,7 @@ TEST_F(OneofTest, ReleaseString) {
TEST_F(OneofTest, SetAllocatedString) {
// Check that set_allocated_foo() works for strings.
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
EXPECT_FALSE(message.has_foo_string());
const string kHello("hello");
@@ -1697,11 +1760,11 @@ TEST_F(OneofTest, SetAllocatedString) {
TEST_F(OneofTest, SetMessage) {
// Check that setting a message field works
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
// Unset field returns default instance
EXPECT_EQ(&message.foo_message(),
- &UNITTEST::TestOneof2_NestedMessage::default_instance());
+ &unittest::TestOneof2_NestedMessage::default_instance());
EXPECT_EQ(message.foo_message().qux_int(), 0);
message.mutable_foo_message()->set_qux_int(234);
@@ -1714,14 +1777,14 @@ TEST_F(OneofTest, SetMessage) {
TEST_F(OneofTest, ReleaseMessage) {
// Check that release_foo() starts out NULL, and gives us a value
// that we can delete after it's been set.
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
EXPECT_EQ(NULL, message.release_foo_message());
EXPECT_FALSE(message.has_foo_message());
message.mutable_foo_message()->set_qux_int(1);
EXPECT_TRUE(message.has_foo_message());
- std::unique_ptr<UNITTEST::TestOneof2_NestedMessage> mes(
+ google::protobuf::scoped_ptr<unittest::TestOneof2_NestedMessage> mes(
message.release_foo_message());
EXPECT_FALSE(message.has_foo_message());
ASSERT_TRUE(mes != NULL);
@@ -1733,7 +1796,7 @@ TEST_F(OneofTest, ReleaseMessage) {
TEST_F(OneofTest, SetAllocatedMessage) {
// Check that set_allocated_foo() works for messages.
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
EXPECT_FALSE(message.has_foo_message());
@@ -1743,10 +1806,10 @@ TEST_F(OneofTest, SetAllocatedMessage) {
message.set_allocated_foo_message(NULL);
EXPECT_FALSE(message.has_foo_message());
EXPECT_EQ(&message.foo_message(),
- &UNITTEST::TestOneof2_NestedMessage::default_instance());
+ &unittest::TestOneof2_NestedMessage::default_instance());
message.mutable_foo_message()->set_qux_int(1);
- UNITTEST::TestOneof2_NestedMessage* mes = message.release_foo_message();
+ unittest::TestOneof2_NestedMessage* mes = message.release_foo_message();
ASSERT_TRUE(mes != NULL);
EXPECT_FALSE(message.has_foo_message());
@@ -1757,7 +1820,7 @@ TEST_F(OneofTest, SetAllocatedMessage) {
TEST_F(OneofTest, Clear) {
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
message.set_foo_int(1);
EXPECT_TRUE(message.has_foo_int());
@@ -1766,7 +1829,7 @@ TEST_F(OneofTest, Clear) {
}
TEST_F(OneofTest, Defaults) {
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
EXPECT_FALSE(message.has_foo_int());
EXPECT_EQ(message.foo_int(), 0);
@@ -1803,7 +1866,7 @@ TEST_F(OneofTest, Defaults) {
}
TEST_F(OneofTest, SwapWithEmpty) {
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
message1.set_foo_string("FOO");
EXPECT_TRUE(message1.has_foo_string());
message1.Swap(&message2);
@@ -1813,7 +1876,7 @@ TEST_F(OneofTest, SwapWithEmpty) {
}
TEST_F(OneofTest, SwapWithSelf) {
- UNITTEST::TestOneof2 message;
+ unittest::TestOneof2 message;
message.set_foo_string("FOO");
EXPECT_TRUE(message.has_foo_string());
message.Swap(&message);
@@ -1822,7 +1885,7 @@ TEST_F(OneofTest, SwapWithSelf) {
}
TEST_F(OneofTest, SwapBothHasFields) {
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
message1.set_foo_string("FOO");
EXPECT_TRUE(message1.has_foo_string());
@@ -1839,35 +1902,35 @@ TEST_F(OneofTest, SwapBothHasFields) {
}
TEST_F(OneofTest, CopyConstructor) {
- UNITTEST::TestOneof2 message1;
+ unittest::TestOneof2 message1;
message1.set_foo_bytes("FOO");
- UNITTEST::TestOneof2 message2(message1);
+ unittest::TestOneof2 message2(message1);
EXPECT_TRUE(message2.has_foo_bytes());
EXPECT_EQ(message2.foo_bytes(), "FOO");
}
TEST_F(OneofTest, CopyFrom) {
- UNITTEST::TestOneof2 message1, message2;
- message1.set_foo_enum(UNITTEST::TestOneof2::BAR);
+ unittest::TestOneof2 message1, message2;
+ message1.set_foo_enum(unittest::TestOneof2::BAR);
EXPECT_TRUE(message1.has_foo_enum());
message2.CopyFrom(message1);
EXPECT_TRUE(message2.has_foo_enum());
- EXPECT_EQ(message2.foo_enum(), UNITTEST::TestOneof2::BAR);
+ EXPECT_EQ(message2.foo_enum(), unittest::TestOneof2::BAR);
// Copying from self should be a no-op.
message2.CopyFrom(message2);
EXPECT_TRUE(message2.has_foo_enum());
- EXPECT_EQ(message2.foo_enum(), UNITTEST::TestOneof2::BAR);
+ EXPECT_EQ(message2.foo_enum(), unittest::TestOneof2::BAR);
}
TEST_F(OneofTest, CopyAssignmentOperator) {
- UNITTEST::TestOneof2 message1;
+ unittest::TestOneof2 message1;
message1.mutable_foo_message()->set_qux_int(123);
EXPECT_TRUE(message1.has_foo_message());
- UNITTEST::TestOneof2 message2;
+ unittest::TestOneof2 message2;
message2 = message1;
EXPECT_EQ(message2.foo_message().qux_int(), 123);
@@ -1879,7 +1942,7 @@ TEST_F(OneofTest, CopyAssignmentOperator) {
TEST_F(OneofTest, UpcastCopyFrom) {
// Test the CopyFrom method that takes in the generic const Message&
// parameter.
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
message1.mutable_foogroup()->set_a(123);
EXPECT_TRUE(message1.has_foogroup());
@@ -1897,10 +1960,10 @@ TEST_F(OneofTest, UpcastCopyFrom) {
TEST_F(OneofTest, SerializationToArray) {
// Primitive type
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.set_foo_int(123);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
uint8* start = reinterpret_cast<uint8*>(string_as_array(&data));
uint8* end = message1.SerializeWithCachedSizesToArray(start);
@@ -1911,10 +1974,10 @@ TEST_F(OneofTest, SerializationToArray) {
// String
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.set_foo_string("foo");
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
uint8* start = reinterpret_cast<uint8*>(string_as_array(&data));
uint8* end = message1.SerializeWithCachedSizesToArray(start);
@@ -1926,10 +1989,10 @@ TEST_F(OneofTest, SerializationToArray) {
// Bytes
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.set_foo_bytes("qux");
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
uint8* start = reinterpret_cast<uint8*>(string_as_array(&data));
uint8* end = message1.SerializeWithCachedSizesToArray(start);
@@ -1940,24 +2003,24 @@ TEST_F(OneofTest, SerializationToArray) {
// Enum
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
- message1.set_foo_enum(UNITTEST::TestOneof2::FOO);
- int size = message1.ByteSizeLong();
+ message1.set_foo_enum(unittest::TestOneof2::FOO);
+ int size = message1.ByteSize();
data.resize(size);
uint8* start = reinterpret_cast<uint8*>(string_as_array(&data));
uint8* end = message1.SerializeWithCachedSizesToArray(start);
EXPECT_EQ(size, end - start);
EXPECT_TRUE(message2.ParseFromString(data));
- EXPECT_EQ(message2.foo_enum(), UNITTEST::TestOneof2::FOO);
+ EXPECT_EQ(message2.foo_enum(), unittest::TestOneof2::FOO);
}
// Message
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.mutable_foo_message()->set_qux_int(234);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
uint8* start = reinterpret_cast<uint8*>(string_as_array(&data));
uint8* end = message1.SerializeWithCachedSizesToArray(start);
@@ -1968,10 +2031,10 @@ TEST_F(OneofTest, SerializationToArray) {
// Group
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.mutable_foogroup()->set_a(345);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
uint8* start = reinterpret_cast<uint8*>(string_as_array(&data));
uint8* end = message1.SerializeWithCachedSizesToArray(start);
@@ -1990,10 +2053,10 @@ TEST_F(OneofTest, SerializationToArray) {
TEST_F(OneofTest, SerializationToStream) {
// Primitive type
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.set_foo_int(123);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
{
@@ -2011,10 +2074,10 @@ TEST_F(OneofTest, SerializationToStream) {
// String
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.set_foo_string("foo");
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
{
@@ -2033,10 +2096,10 @@ TEST_F(OneofTest, SerializationToStream) {
// Bytes
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.set_foo_bytes("qux");
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
{
@@ -2054,10 +2117,10 @@ TEST_F(OneofTest, SerializationToStream) {
// Enum
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
- message1.set_foo_enum(UNITTEST::TestOneof2::FOO);
- int size = message1.ByteSizeLong();
+ message1.set_foo_enum(unittest::TestOneof2::FOO);
+ int size = message1.ByteSize();
data.resize(size);
{
@@ -2070,15 +2133,15 @@ TEST_F(OneofTest, SerializationToStream) {
}
EXPECT_TRUE(message2.ParseFromString(data));
- EXPECT_EQ(message2.foo_enum(), UNITTEST::TestOneof2::FOO);
+ EXPECT_EQ(message2.foo_enum(), unittest::TestOneof2::FOO);
}
// Message
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.mutable_foo_message()->set_qux_int(234);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
{
@@ -2096,10 +2159,10 @@ TEST_F(OneofTest, SerializationToStream) {
// Group
{
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
string data;
message1.mutable_foogroup()->set_a(345);
- int size = message1.ByteSizeLong();
+ int size = message1.ByteSize();
data.resize(size);
{
@@ -2118,7 +2181,7 @@ TEST_F(OneofTest, SerializationToStream) {
}
TEST_F(OneofTest, MergeFrom) {
- UNITTEST::TestOneof2 message1, message2;
+ unittest::TestOneof2 message1, message2;
message1.set_foo_int(123);
message2.MergeFrom(message1);
@@ -2139,11 +2202,11 @@ TEST_F(OneofTest, MergeFrom) {
EXPECT_TRUE(message2.has_foo_bytes());
EXPECT_EQ(message2.foo_bytes(), "qux");
- message1.set_foo_enum(UNITTEST::TestOneof2::FOO);
+ message1.set_foo_enum(unittest::TestOneof2::FOO);
message2.MergeFrom(message1);
TestUtil::ExpectAtMostOneFieldSetInOneof(message2);
EXPECT_TRUE(message2.has_foo_enum());
- EXPECT_EQ(message2.foo_enum(), UNITTEST::TestOneof2::FOO);
+ EXPECT_EQ(message2.foo_enum(), unittest::TestOneof2::FOO);
message1.mutable_foo_message()->set_qux_int(234);
message2.MergeFrom(message1);
@@ -2159,21 +2222,20 @@ TEST_F(OneofTest, MergeFrom) {
}
-TEST(HELPERS_TEST_NAME, TestSCC) {
- UNITTEST::TestMutualRecursionA a;
+TEST(HelpersTest, TestSCC) {
+ protobuf_unittest::TestMutualRecursionA a;
SCCAnalyzer scc_analyzer((Options()));
const SCC* scc = scc_analyzer.GetSCC(a.GetDescriptor());
std::vector<string> names;
for (int i = 0; i < scc->descriptors.size(); i++) {
names.push_back(scc->descriptors[i]->full_name());
}
- string package = a.GetDescriptor()->file()->package();
ASSERT_EQ(names.size(), 4);
std::sort(names.begin(), names.end());
- EXPECT_EQ(names[0], package + ".TestMutualRecursionA");
- EXPECT_EQ(names[1], package + ".TestMutualRecursionA.SubGroup");
- EXPECT_EQ(names[2], package + ".TestMutualRecursionA.SubMessage");
- EXPECT_EQ(names[3], package + ".TestMutualRecursionB");
+ EXPECT_EQ(names[0], "protobuf_unittest.TestMutualRecursionA");
+ EXPECT_EQ(names[1], "protobuf_unittest.TestMutualRecursionA.SubGroup");
+ EXPECT_EQ(names[2], "protobuf_unittest.TestMutualRecursionA.SubMessage");
+ EXPECT_EQ(names[3], "protobuf_unittest.TestMutualRecursionB");
MessageAnalysis result = scc_analyzer.GetSCCAnalysis(scc);
EXPECT_EQ(result.is_recursive, true);
@@ -2182,9 +2244,9 @@ TEST(HELPERS_TEST_NAME, TestSCC) {
EXPECT_EQ(result.contains_extension, false); // TestAllTypes
}
-TEST(HELPERS_TEST_NAME, TestSCCAnalysis) {
+TEST(HelpersTest, TestSCCAnalysis) {
{
- UNITTEST::TestRecursiveMessage msg;
+ protobuf_unittest::TestRecursiveMessage msg;
SCCAnalyzer scc_analyzer((Options()));
const SCC* scc = scc_analyzer.GetSCC(msg.GetDescriptor());
MessageAnalysis result = scc_analyzer.GetSCCAnalysis(scc);
@@ -2194,7 +2256,7 @@ TEST(HELPERS_TEST_NAME, TestSCCAnalysis) {
EXPECT_EQ(result.contains_extension, false);
}
{
- UNITTEST::TestAllExtensions msg;
+ protobuf_unittest::TestAllExtensions msg;
SCCAnalyzer scc_analyzer((Options()));
const SCC* scc = scc_analyzer.GetSCC(msg.GetDescriptor());
MessageAnalysis result = scc_analyzer.GetSCCAnalysis(scc);
@@ -2204,7 +2266,7 @@ TEST(HELPERS_TEST_NAME, TestSCCAnalysis) {
EXPECT_EQ(result.contains_extension, true);
}
{
- UNITTEST::TestRequired msg;
+ protobuf_unittest::TestRequired msg;
SCCAnalyzer scc_analyzer((Options()));
const SCC* scc = scc_analyzer.GetSCC(msg.GetDescriptor());
MessageAnalysis result = scc_analyzer.GetSCCAnalysis(scc);
@@ -2232,7 +2294,7 @@ namespace compiler {
namespace cpp {
namespace cpp_unittest {
-TEST_F(GENERATED_SERVICE_TEST_NAME, NoGenericServices) {
+TEST_F(GeneratedServiceTest, NoGenericServices) {
// Verify that non-services in unittest_no_generic_services.proto were
// generated.
no_generic_services_test::TestMessage message;
@@ -2261,7 +2323,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, NoGenericServices) {
// When this is defined, we skip all tests which are expected to trigger
// descriptor initialization. This verifies that everything else still works
// if descriptors are not initialized.
-TEST(DESCRIPTOR_INIT_TEST_NAME, Initialized) {
+TEST(DescriptorInitializationTest, Initialized) {
#ifdef PROTOBUF_TEST_NO_DESCRIPTORS
bool should_have_descriptors = false;
#else
@@ -2270,7 +2332,7 @@ TEST(DESCRIPTOR_INIT_TEST_NAME, Initialized) {
EXPECT_EQ(should_have_descriptors,
DescriptorPool::generated_pool()->InternalIsFileLoaded(
- UNITTEST_PROTO_PATH));
+ "google/protobuf/unittest.proto"));
}
} // namespace cpp_unittest
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_unittest.h
index 69c8f44c1d..69c8f44c1d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/cpp_unittest.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/metadata_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/metadata_test.cc
index 2ad4edd248..03f6b12b4a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/metadata_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/cpp/metadata_test.cc
@@ -29,11 +29,16 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/compiler/cpp/cpp_generator.h>
-#include <google/protobuf/compiler/annotation_test_util.h>
#include <google/protobuf/compiler/command_line_interface.h>
+#include <google/protobuf/io/zero_copy_stream.h>
+#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
+#include <google/protobuf/io/printer.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/testing/file.h>
@@ -42,15 +47,37 @@
#include <gtest/gtest.h>
namespace google {
-namespace atu = ::google::protobuf::compiler::annotation_test_util;
-
namespace protobuf {
namespace compiler {
namespace cpp {
namespace {
+// A CodeGenerator that captures the FileDescriptor it's passed as a
+// FileDescriptorProto.
+class DescriptorCapturingGenerator : public CodeGenerator {
+ public:
+ // Does not own file; file must outlive the Generator.
+ explicit DescriptorCapturingGenerator(FileDescriptorProto* file)
+ : file_(file) {}
+
+ virtual bool Generate(const FileDescriptor* file, const string& parameter,
+ GeneratorContext* context, string* error) const {
+ file->CopyTo(file_);
+ return true;
+ }
+
+ private:
+ FileDescriptorProto* file_;
+};
+
class CppMetadataTest : public ::testing::Test {
public:
+ // Adds a file with name `filename` and content `data`.
+ void AddFile(const string& filename, const string& data) {
+ GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data,
+ true));
+ }
+
// Tries to capture a FileDescriptorProto, GeneratedCodeInfo, and output
// code from the previously added file with name `filename`. Returns true on
// success. If pb_h is non-null, expects a .pb.h and a .pb.h.meta (copied to
@@ -60,19 +87,26 @@ class CppMetadataTest : public ::testing::Test {
string* proto_h, GeneratedCodeInfo* proto_h_info,
string* pb_cc) {
google::protobuf::compiler::CommandLineInterface cli;
+ cli.SetInputsAreProtoPathRelative(true);
+
CppGenerator cpp_generator;
+ DescriptorCapturingGenerator capturing_generator(file);
cli.RegisterGenerator("--cpp_out", &cpp_generator, "");
+ cli.RegisterGenerator("--capture_out", &capturing_generator, "");
+
+ string proto_path = "-I" + TestTempDir();
string cpp_out =
"--cpp_out=annotate_headers=true,"
"annotation_pragma_name=pragma_name,"
"annotation_guard_name=guard_name:" +
TestTempDir();
+ string capture_out = "--capture_out=" + TestTempDir();
- const bool result =
- atu::RunProtoCompiler(filename, cpp_out, &cli, file);
+ const char* argv[] = {"protoc", proto_path.c_str(), cpp_out.c_str(),
+ capture_out.c_str(), filename.c_str()};
- if (!result) {
- return result;
+ if (cli.Run(5, argv) != 0) {
+ return false;
}
string output_base = TestTempDir() + "/" + StripProto(filename);
@@ -85,7 +119,7 @@ class CppMetadataTest : public ::testing::Test {
if (pb_h != NULL && pb_h_info != NULL) {
GOOGLE_CHECK_OK(
File::GetContents(output_base + ".pb.h", pb_h, true));
- if (!atu::DecodeMetadata(output_base + ".pb.h.meta", pb_h_info)) {
+ if (!DecodeMetadata(output_base + ".pb.h.meta", pb_h_info)) {
return false;
}
}
@@ -93,13 +127,23 @@ class CppMetadataTest : public ::testing::Test {
if (proto_h != NULL && proto_h_info != NULL) {
GOOGLE_CHECK_OK(File::GetContents(output_base + ".proto.h", proto_h,
true));
- if (!atu::DecodeMetadata(output_base + ".proto.h.meta", proto_h_info)) {
+ if (!DecodeMetadata(output_base + ".proto.h.meta", proto_h_info)) {
return false;
}
}
return true;
}
+
+ private:
+ // Decodes GeneratedCodeInfo stored in path and copies it to info.
+ // Returns true on success.
+ bool DecodeMetadata(const string& path, GeneratedCodeInfo* info) {
+ string data;
+ GOOGLE_CHECK_OK(File::GetContents(path, &data, true));
+ io::ArrayInputStream input(data.data(), data.size());
+ return info->ParseFromZeroCopyStream(&input);
+ }
};
const char kSmallTestFile[] =
@@ -108,11 +152,48 @@ const char kSmallTestFile[] =
"enum Enum { VALUE = 0; }\n"
"message Message { }\n";
+// Finds the Annotation for a given source file and path (or returns null if it
+// couldn't).
+const GeneratedCodeInfo::Annotation* FindAnnotationOnPath(
+ const GeneratedCodeInfo& info, const string& source_file,
+ const std::vector<int>& path) {
+ for (int i = 0; i < info.annotation_size(); ++i) {
+ const GeneratedCodeInfo::Annotation* annotation = &info.annotation(i);
+ if (annotation->source_file() != source_file ||
+ annotation->path_size() != path.size()) {
+ continue;
+ }
+ int node = 0;
+ for (; node < path.size(); ++node) {
+ if (annotation->path(node) != path[node]) {
+ break;
+ }
+ }
+ if (node == path.size()) {
+ return annotation;
+ }
+ }
+ return NULL;
+}
+
+// Returns true if the provided annotation covers a given substring in
+// file_content.
+bool AnnotationMatchesSubstring(const string& file_content,
+ const GeneratedCodeInfo::Annotation* annotation,
+ const string& expected_text) {
+ uint32 begin = annotation->begin();
+ uint32 end = annotation->end();
+ if (end < begin || end > file_content.size()) {
+ return false;
+ }
+ return file_content.substr(begin, end - begin) == expected_text;
+}
+
TEST_F(CppMetadataTest, CapturesEnumNames) {
FileDescriptorProto file;
GeneratedCodeInfo info;
string pb_h;
- atu::AddFile("test.proto", kSmallTestFile);
+ AddFile("test.proto", kSmallTestFile);
EXPECT_TRUE(
CaptureMetadata("test.proto", &file, &pb_h, &info, NULL, NULL, NULL));
EXPECT_EQ("Enum", file.enum_type(0).name());
@@ -120,16 +201,16 @@ TEST_F(CppMetadataTest, CapturesEnumNames) {
enum_path.push_back(FileDescriptorProto::kEnumTypeFieldNumber);
enum_path.push_back(0);
const GeneratedCodeInfo::Annotation* enum_annotation =
- atu::FindAnnotationOnPath(info, "test.proto", enum_path);
+ FindAnnotationOnPath(info, "test.proto", enum_path);
EXPECT_TRUE(NULL != enum_annotation);
- EXPECT_TRUE(atu::AnnotationMatchesSubstring(pb_h, enum_annotation, "Enum"));
+ EXPECT_TRUE(AnnotationMatchesSubstring(pb_h, enum_annotation, "Enum"));
}
TEST_F(CppMetadataTest, AddsPragma) {
FileDescriptorProto file;
GeneratedCodeInfo info;
string pb_h;
- atu::AddFile("test.proto", kSmallTestFile);
+ AddFile("test.proto", kSmallTestFile);
EXPECT_TRUE(
CaptureMetadata("test.proto", &file, &pb_h, &info, NULL, NULL, NULL));
EXPECT_TRUE(pb_h.find("#ifdef guard_name") != string::npos);
@@ -141,7 +222,7 @@ TEST_F(CppMetadataTest, CapturesMessageNames) {
FileDescriptorProto file;
GeneratedCodeInfo info;
string pb_h;
- atu::AddFile("test.proto", kSmallTestFile);
+ AddFile("test.proto", kSmallTestFile);
EXPECT_TRUE(
CaptureMetadata("test.proto", &file, &pb_h, &info, NULL, NULL, NULL));
EXPECT_EQ("Message", file.message_type(0).name());
@@ -149,10 +230,9 @@ TEST_F(CppMetadataTest, CapturesMessageNames) {
message_path.push_back(FileDescriptorProto::kMessageTypeFieldNumber);
message_path.push_back(0);
const GeneratedCodeInfo::Annotation* message_annotation =
- atu::FindAnnotationOnPath(info, "test.proto", message_path);
+ FindAnnotationOnPath(info, "test.proto", message_path);
EXPECT_TRUE(NULL != message_annotation);
- EXPECT_TRUE(
- atu::AnnotationMatchesSubstring(pb_h, message_annotation, "Message"));
+ EXPECT_TRUE(AnnotationMatchesSubstring(pb_h, message_annotation, "Message"));
}
} // namespace
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
index 8c38e52fe1..5c54270e4c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
@@ -184,6 +184,11 @@ TEST(CsharpBootstrapTest, GeneratedCsharpDescriptorMatches) {
"../csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs");
generate_test.SetParameter("");
+ source_tree.MapPath("", TestSourceDir() + "/../examples");
+ generate_test.Run(importer.Import("addressbook.proto"),
+ "Addressbook.cs",
+ "../csharp/src/AddressBook/Addressbook.cs");
+
source_tree.MapPath("", TestSourceDir() + "/../conformance");
generate_test.Run(importer.Import("conformance.proto"),
"Conformance.cs",
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
index a21dc0a495..636a76a0b9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
@@ -56,7 +56,7 @@ void WriteDocCommentBodyImpl(io::Printer* printer, SourceLocation location) {
// node of a summary element, not part of an attribute.
comments = StringReplace(comments, "&", "&amp;", true);
comments = StringReplace(comments, "<", "&lt;", true);
- std::vector<string> lines = Split(comments, "\n", false /* skip_empty */);
+ vector<string> lines = Split(comments, "\n", false /* skip_empty */);
// TODO: We really should work out which part to put in the summary and which to put in the remarks...
// but that needs to be part of a bigger effort to understand the markdown better anyway.
printer->Print("/// <summary>\n");
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
index 75eb0ea04d..75eb0ea04d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum.cc
index 32c719907c..9759e3ef26 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum.cc
@@ -43,6 +43,8 @@
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_options.h>
+using google::protobuf::internal::scoped_ptr;
+
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum.h
index 8925cdf2be..8925cdf2be 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
index 9ceffa8cab..67c0b5961a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
@@ -89,10 +89,6 @@ EnumOneofFieldGenerator::EnumOneofFieldGenerator(
EnumOneofFieldGenerator::~EnumOneofFieldGenerator() {
}
-void EnumOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) {
- printer->Print(variables_, "$property_name$ = other.$property_name$;\n");
-}
-
void EnumOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) {
// TODO(jonskeet): What about if we read the default value?
printer->Print(
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum_field.h
index 631632bcba..9b7669ba5d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_enum_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_enum_field.h
@@ -64,7 +64,6 @@ class EnumOneofFieldGenerator : public PrimitiveOneofFieldGenerator {
const Options *options);
~EnumOneofFieldGenerator();
- virtual void GenerateMergingCode(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
virtual void GenerateSerializationCode(io::Printer* printer);
virtual void GenerateSerializedSizeCode(io::Printer* printer);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_field_base.cc
index 7e737e47f9..ecf29ecea5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_field_base.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_field_base.cc
@@ -46,6 +46,8 @@
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_names.h>
+using google::protobuf::internal::scoped_ptr;
+
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_field_base.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_field_base.h
index df26853b17..df26853b17 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_field_base.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_field_base.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator.cc
index 0c93fc2929..c13ed65bec 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator.cc
@@ -44,6 +44,8 @@
#include <google/protobuf/compiler/csharp/csharp_options.h>
#include <google/protobuf/compiler/csharp/csharp_reflection_class.h>
+using google::protobuf::internal::scoped_ptr;
+
namespace google {
namespace protobuf {
namespace compiler {
@@ -62,7 +64,7 @@ bool Generator::Generate(
GeneratorContext* generator_context,
string* error) const {
- std::vector<std::pair<string, string> > options;
+ vector<pair<string, string> > options;
ParseGeneratorParameter(parameter, &options);
// We only support proto3 - but we make an exception for descriptor.proto.
@@ -98,7 +100,7 @@ bool Generator::Generate(
*error = filename_error;
return false;
}
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(filename));
io::Printer printer(output.get(), '$');
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator.h
index c8b1952913..c8b1952913 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
index 5755fee00b..5755fee00b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_helpers.cc
index 5bca1ffa72..5bca1ffa72 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_helpers.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_helpers.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_helpers.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_helpers.h
index c317ad0e55..c317ad0e55 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_helpers.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_helpers.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_map_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_map_field.cc
index d58514ce4a..e6eac6edb2 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_map_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_map_field.cc
@@ -63,9 +63,9 @@ void MapFieldGenerator::GenerateMembers(io::Printer* printer) {
descriptor_->message_type()->FindFieldByName("value");
variables_["key_type_name"] = type_name(key_descriptor);
variables_["value_type_name"] = type_name(value_descriptor);
- std::unique_ptr<FieldGeneratorBase> key_generator(
+ scoped_ptr<FieldGeneratorBase> key_generator(
CreateFieldGenerator(key_descriptor, 1, this->options()));
- std::unique_ptr<FieldGeneratorBase> value_generator(
+ scoped_ptr<FieldGeneratorBase> value_generator(
CreateFieldGenerator(value_descriptor, 2, this->options()));
printer->Print(
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_map_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_map_field.h
index 84a33a0367..84a33a0367 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_map_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_map_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message.cc
index 8a4307f157..5ef0e4e860 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message.cc
@@ -49,6 +49,8 @@
#include <google/protobuf/compiler/csharp/csharp_message.h>
#include <google/protobuf/compiler/csharp/csharp_names.h>
+using google::protobuf::internal::scoped_ptr;
+
namespace google {
namespace protobuf {
namespace compiler {
@@ -109,7 +111,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
WriteMessageDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
-
+
printer->Print(
vars,
"$access_level$ sealed partial class $class_name$ : pb::IMessage<$class_name$> {\n");
@@ -117,17 +119,14 @@ void MessageGenerator::Generate(io::Printer* printer) {
// All static fields and properties
printer->Print(
- vars,
- "private static readonly pb::MessageParser<$class_name$> _parser = new pb::MessageParser<$class_name$>(() => new $class_name$());\n");
-
- printer->Print(
- "private pb::UnknownFieldSet _unknownFields;\n");
+ vars,
+ "private static readonly pb::MessageParser<$class_name$> _parser = new pb::MessageParser<$class_name$>(() => new $class_name$());\n");
WriteGeneratedCodeAttributes(printer);
printer->Print(
- vars,
- "public static pb::MessageParser<$class_name$> Parser { get { return _parser; } }\n\n");
+ vars,
+ "public static pb::MessageParser<$class_name$> Parser { get { return _parser; } }\n\n");
// Access the message descriptor via the relevant file descriptor or containing message descriptor.
if (!descriptor_->containing_type()) {
@@ -140,14 +139,14 @@ void MessageGenerator::Generate(io::Printer* printer) {
WriteGeneratedCodeAttributes(printer);
printer->Print(
- vars,
- "public static pbr::MessageDescriptor Descriptor {\n"
- " get { return $descriptor_accessor$; }\n"
- "}\n"
- "\n");
+ vars,
+ "public static pbr::MessageDescriptor Descriptor {\n"
+ " get { return $descriptor_accessor$; }\n"
+ "}\n"
+ "\n");
WriteGeneratedCodeAttributes(printer);
printer->Print(
- vars,
+ vars,
"pbr::MessageDescriptor pb::IMessage.Descriptor {\n"
" get { return Descriptor; }\n"
"}\n"
@@ -182,7 +181,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
"field_name", fieldDescriptor->name(),
"field_constant_name", GetFieldConstantName(fieldDescriptor),
"index", SimpleItoa(fieldDescriptor->number()));
- std::unique_ptr<FieldGeneratorBase> generator(
+ scoped_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(fieldDescriptor));
generator->GenerateMembers(printer);
printer->Print("\n");
@@ -210,18 +209,18 @@ void MessageGenerator::Generate(io::Printer* printer) {
printer->Print("}\n");
// TODO: Should we put the oneof .proto comments here?
// It's unclear exactly where they should go.
- printer->Print(
- vars,
- "private $property_name$OneofCase $name$Case_ = $property_name$OneofCase.None;\n");
- WriteGeneratedCodeAttributes(printer);
- printer->Print(
- vars,
- "public $property_name$OneofCase $property_name$Case {\n"
- " get { return $name$Case_; }\n"
- "}\n\n");
- WriteGeneratedCodeAttributes(printer);
- printer->Print(
- vars,
+ printer->Print(
+ vars,
+ "private $property_name$OneofCase $name$Case_ = $property_name$OneofCase.None;\n");
+ WriteGeneratedCodeAttributes(printer);
+ printer->Print(
+ vars,
+ "public $property_name$OneofCase $property_name$Case {\n"
+ " get { return $name$Case_; }\n"
+ "}\n\n");
+ WriteGeneratedCodeAttributes(printer);
+ printer->Print(
+ vars,
"public void Clear$property_name$() {\n"
" $name$Case_ = $property_name$OneofCase.None;\n"
" $name$_ = null;\n"
@@ -291,7 +290,7 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) {
// Clone non-oneof fields first
for (int i = 0; i < descriptor_->field_count(); i++) {
if (!descriptor_->field(i)->containing_oneof()) {
- std::unique_ptr<FieldGeneratorBase> generator(
+ scoped_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(descriptor_->field(i)));
generator->GenerateCloningCode(printer);
}
@@ -305,7 +304,7 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) {
printer->Indent();
for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) {
const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j);
- std::unique_ptr<FieldGeneratorBase> generator(CreateFieldGeneratorInternal(field));
+ scoped_ptr<FieldGeneratorBase> generator(CreateFieldGeneratorInternal(field));
vars["field_property_name"] = GetPropertyName(field);
printer->Print(
vars,
@@ -318,9 +317,6 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) {
printer->Outdent();
printer->Print("}\n\n");
}
- // Clone unknown fields
- printer->Print(
- "_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);\n");
printer->Outdent();
printer->Print("}\n\n");
@@ -341,15 +337,15 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
vars["class_name"] = class_name();
// Equality
- WriteGeneratedCodeAttributes(printer);
+ WriteGeneratedCodeAttributes(printer);
printer->Print(
vars,
"public override bool Equals(object other) {\n"
" return Equals(other as $class_name$);\n"
"}\n\n");
- WriteGeneratedCodeAttributes(printer);
- printer->Print(
- vars,
+ WriteGeneratedCodeAttributes(printer);
+ printer->Print(
+ vars,
"public bool Equals($class_name$ other) {\n"
" if (ReferenceEquals(other, null)) {\n"
" return false;\n"
@@ -359,7 +355,7 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
" }\n");
printer->Indent();
for (int i = 0; i < descriptor_->field_count(); i++) {
- std::unique_ptr<FieldGeneratorBase> generator(
+ scoped_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(descriptor_->field(i)));
generator->WriteEquals(printer);
}
@@ -369,18 +365,18 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
}
printer->Outdent();
printer->Print(
- " return Equals(_unknownFields, other._unknownFields);\n"
+ " return true;\n"
"}\n\n");
// GetHashCode
// Start with a non-zero value to easily distinguish between null and "empty" messages.
- WriteGeneratedCodeAttributes(printer);
- printer->Print(
+ WriteGeneratedCodeAttributes(printer);
+ printer->Print(
"public override int GetHashCode() {\n"
" int hash = 1;\n");
printer->Indent();
for (int i = 0; i < descriptor_->field_count(); i++) {
- std::unique_ptr<FieldGeneratorBase> generator(
+ scoped_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(descriptor_->field(i)));
generator->WriteHash(printer);
}
@@ -388,16 +384,12 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
printer->Print("hash ^= (int) $name$Case_;\n",
"name", UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), false));
}
- printer->Print(
- "if (_unknownFields != null) {\n"
- " hash ^= _unknownFields.GetHashCode();\n"
- "}\n"
- "return hash;\n");
+ printer->Print("return hash;\n");
printer->Outdent();
printer->Print("}\n\n");
- WriteGeneratedCodeAttributes(printer);
- printer->Print(
+ WriteGeneratedCodeAttributes(printer);
+ printer->Print(
"public override string ToString() {\n"
" return pb::JsonFormatter.ToDiagnosticString(this);\n"
"}\n\n");
@@ -411,38 +403,26 @@ void MessageGenerator::GenerateMessageSerializationMethods(io::Printer* printer)
// Serialize all the fields
for (int i = 0; i < fields_by_number().size(); i++) {
- std::unique_ptr<FieldGeneratorBase> generator(
+ scoped_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(fields_by_number()[i]));
generator->GenerateSerializationCode(printer);
}
- // Serialize unknown fields
- printer->Print(
- "if (_unknownFields != null) {\n"
- " _unknownFields.WriteTo(output);\n"
- "}\n");
-
// TODO(jonskeet): Memoize size of frozen messages?
printer->Outdent();
printer->Print(
- "}\n"
- "\n");
+ "}\n"
+ "\n");
WriteGeneratedCodeAttributes(printer);
printer->Print(
"public int CalculateSize() {\n");
printer->Indent();
printer->Print("int size = 0;\n");
for (int i = 0; i < descriptor_->field_count(); i++) {
- std::unique_ptr<FieldGeneratorBase> generator(
+ scoped_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(descriptor_->field(i)));
generator->GenerateSerializedSizeCode(printer);
}
-
- printer->Print(
- "if (_unknownFields != null) {\n"
- " size += _unknownFields.CalculateSize();\n"
- "}\n");
-
printer->Print("return size;\n");
printer->Outdent();
printer->Print("}\n\n");
@@ -467,7 +447,7 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
// Merge non-oneof fields
for (int i = 0; i < descriptor_->field_count(); i++) {
if (!descriptor_->field(i)->containing_oneof()) {
- std::unique_ptr<FieldGeneratorBase> generator(
+ scoped_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(descriptor_->field(i)));
generator->GenerateMergingCode(printer);
}
@@ -483,24 +463,15 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
vars["field_property_name"] = GetPropertyName(field);
printer->Print(
vars,
- "case $property_name$OneofCase.$field_property_name$:\n");
- printer->Indent();
- std::unique_ptr<FieldGeneratorBase> generator(CreateFieldGeneratorInternal(field));
- generator->GenerateMergingCode(printer);
- printer->Print("break;\n");
- printer->Outdent();
+ "case $property_name$OneofCase.$field_property_name$:\n"
+ " $field_property_name$ = other.$field_property_name$;\n"
+ " break;\n");
}
printer->Outdent();
printer->Print("}\n\n");
}
- // Merge unknown fields.
- printer->Print(
- "_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);\n");
-
printer->Outdent();
printer->Print("}\n\n");
-
-
WriteGeneratedCodeAttributes(printer);
printer->Print("public void MergeFrom(pb::CodedInputStream input) {\n");
printer->Indent();
@@ -512,14 +483,14 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
printer->Indent();
// Option messages need to store unknown fields so that options can be parsed later.
if (IsDescriptorOptionMessage(descriptor_)) {
- printer->Print(
+ printer->Print(
"default:\n"
" CustomOptions = CustomOptions.ReadOrSkipUnknownField(input);\n"
" break;\n");
} else {
printer->Print(
"default:\n"
- " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);\n"
+ " input.SkipLastField();\n" // We're not storing the data, but we still need to consume it.
" break;\n");
}
for (int i = 0; i < fields_by_number().size(); i++) {
@@ -544,7 +515,7 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
printer->Print("case $tag$: {\n", "tag", SimpleItoa(tag));
printer->Indent();
- std::unique_ptr<FieldGeneratorBase> generator(
+ scoped_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(field));
generator->GenerateParsingCode(printer);
printer->Print("break;\n");
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message.h
index e7f3b4d009..e7f3b4d009 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message_field.cc
index cf1b4dbfea..438f310221 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message_field.cc
@@ -133,7 +133,7 @@ void MessageFieldGenerator::WriteToString(io::Printer* printer) {
void MessageFieldGenerator::GenerateCloningCode(io::Printer* printer) {
printer->Print(variables_,
- "$name$_ = other.$has_property_check$ ? other.$name$_.Clone() : null;\n");
+ "$property_name$ = other.$has_property_check$ ? other.$property_name$.Clone() : null;\n");
}
void MessageFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
@@ -171,14 +171,6 @@ void MessageOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
"}\n");
}
-void MessageOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) {
- printer->Print(variables_,
- "if ($property_name$ == null) {\n"
- " $property_name$ = new $type_name$();\n"
- "}\n"
- "$property_name$.MergeFrom(other.$property_name$);\n");
-}
-
void MessageOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) {
// TODO(jonskeet): We may be able to do better than this
printer->Print(
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message_field.h
index c41ee88a76..7d614756fa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_message_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_message_field.h
@@ -74,7 +74,6 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator {
virtual void GenerateCloningCode(io::Printer* printer);
virtual void GenerateMembers(io::Printer* printer);
- virtual void GenerateMergingCode(io::Printer* printer);
virtual void WriteToString(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_names.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_names.h
index 21758f2882..21758f2882 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_names.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_names.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_options.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_options.h
index 426fb3b50f..426fb3b50f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_options.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_options.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
index c3003e3d8d..169122e6be 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
@@ -137,22 +137,14 @@ void PrimitiveFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) {
}
void PrimitiveFieldGenerator::WriteHash(io::Printer* printer) {
- const char *text = "if ($has_property_check$) hash ^= $property_name$.GetHashCode();\n";
- if (descriptor_->type() == FieldDescriptor::TYPE_FLOAT) {
- text = "if ($has_property_check$) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode($property_name$);\n";
- } else if (descriptor_->type() == FieldDescriptor::TYPE_DOUBLE) {
- text = "if ($has_property_check$) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode($property_name$);\n";
- }
- printer->Print(variables_, text);
+ printer->Print(
+ variables_,
+ "if ($has_property_check$) hash ^= $property_name$.GetHashCode();\n");
}
void PrimitiveFieldGenerator::WriteEquals(io::Printer* printer) {
- const char *text = "if ($property_name$ != other.$property_name$) return false;\n";
- if (descriptor_->type() == FieldDescriptor::TYPE_FLOAT) {
- text = "if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals($property_name$, other.$property_name$)) return false;\n";
- } else if (descriptor_->type() == FieldDescriptor::TYPE_DOUBLE) {
- text = "if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals($property_name$, other.$property_name$)) return false;\n";
- }
- printer->Print(variables_, text);
+ printer->Print(
+ variables_,
+ "if ($property_name$ != other.$property_name$) return false;\n");
}
void PrimitiveFieldGenerator::WriteToString(io::Printer* printer) {
printer->Print(
@@ -204,10 +196,6 @@ void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
"}\n");
}
-void PrimitiveOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) {
- printer->Print(variables_, "$property_name$ = other.$property_name$;\n");
-}
-
void PrimitiveOneofFieldGenerator::WriteToString(io::Printer* printer) {
printer->Print(variables_,
"PrintField(\"$descriptor_name$\", $has_property_check$, $oneof_name$_, writer);\n");
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
index ca7b8b3da6..5f466fc47c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
@@ -78,7 +78,6 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator {
virtual void GenerateCloningCode(io::Printer* printer);
virtual void GenerateMembers(io::Printer* printer);
- virtual void GenerateMergingCode(io::Printer* printer);
virtual void WriteToString(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
index 5ddd616e10..bac9aef7b8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
@@ -104,10 +104,8 @@ void ReflectionClassGenerator::Generate(io::Printer* printer) {
void ReflectionClassGenerator::WriteIntroduction(io::Printer* printer) {
printer->Print(
- "// <auto-generated>\n"
- "// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
- "// source: $file_name$\n"
- "// </auto-generated>\n"
+ "// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
+ "// source: $file_name$\n"
"#pragma warning disable 1591, 0612, 3021\n"
"#region Designer generated code\n"
"\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.h
index e0c69f31fb..e0c69f31fb 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_reflection_class.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
index 683c4b0b7a..683c4b0b7a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
index 819b583262..819b583262 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
index 90af569c47..8fa0b0504f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
@@ -66,11 +66,11 @@ void RepeatedMessageFieldGenerator::GenerateMembers(io::Printer* printer) {
// "create single field generator for this repeated field"
// function, but it doesn't seem worth it for just this.
if (IsWrapperType(descriptor_)) {
- std::unique_ptr<FieldGeneratorBase> single_generator(
+ scoped_ptr<FieldGeneratorBase> single_generator(
new WrapperFieldGenerator(descriptor_, fieldOrdinal_, this->options()));
single_generator->GenerateCodecCode(printer);
} else {
- std::unique_ptr<FieldGeneratorBase> single_generator(
+ scoped_ptr<FieldGeneratorBase> single_generator(
new MessageFieldGenerator(descriptor_, fieldOrdinal_, this->options()));
single_generator->GenerateCodecCode(printer);
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
index 6e33648b6c..6e33648b6c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
index cd91506ff1..cd91506ff1 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
index a59348a95f..a59348a95f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
index 1fda7ddf31..1fda7ddf31 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h
index c741080ed8..c741080ed8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
index 047edf7345..797d498ed3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
@@ -120,25 +120,15 @@ void WrapperFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) {
}
void WrapperFieldGenerator::WriteHash(io::Printer* printer) {
- const char *text = "if ($has_property_check$) hash ^= $property_name$.GetHashCode();\n";
- if (descriptor_->message_type()->field(0)->type() == FieldDescriptor::TYPE_FLOAT) {
- text = "if ($has_property_check$) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode($property_name$);\n";
- }
- else if (descriptor_->message_type()->field(0)->type() == FieldDescriptor::TYPE_DOUBLE) {
- text = "if ($has_property_check$) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode($property_name$);\n";
- }
- printer->Print(variables_, text);
+ printer->Print(
+ variables_,
+ "if ($has_property_check$) hash ^= $property_name$.GetHashCode();\n");
}
void WrapperFieldGenerator::WriteEquals(io::Printer* printer) {
- const char *text = "if ($property_name$ != other.$property_name$) return false;\n";
- if (descriptor_->message_type()->field(0)->type() == FieldDescriptor::TYPE_FLOAT) {
- text = "if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals($property_name$, other.$property_name$)) return false;\n";
- }
- else if (descriptor_->message_type()->field(0)->type() == FieldDescriptor::TYPE_DOUBLE) {
- text = "if (!pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.Equals($property_name$, other.$property_name$)) return false;\n";
- }
- printer->Print(variables_, text);
+ printer->Print(
+ variables_,
+ "if ($property_name$ != other.$property_name$) return false;\n");
}
void WrapperFieldGenerator::WriteToString(io::Printer* printer) {
@@ -191,10 +181,6 @@ void WrapperOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
"}\n");
}
-void WrapperOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) {
- printer->Print(variables_, "$property_name$ = other.$property_name$;\n");
-}
-
void WrapperOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) {
printer->Print(
variables_,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
index 452531fbfa..250dfd2548 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
@@ -75,7 +75,6 @@ class WrapperOneofFieldGenerator : public WrapperFieldGenerator {
~WrapperOneofFieldGenerator();
virtual void GenerateMembers(io::Printer* printer);
- virtual void GenerateMergingCode(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
virtual void GenerateSerializationCode(io::Printer* printer);
virtual void GenerateSerializedSizeCode(io::Printer* printer);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer.cc
index c3831e72a6..4c357aa0e6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer.cc
@@ -32,6 +32,7 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
+
#ifdef _MSC_VER
#include <direct.h>
#else
@@ -44,32 +45,33 @@
#include <algorithm>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/compiler/importer.h>
#include <google/protobuf/compiler/parser.h>
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
-#include <google/protobuf/stubs/strutil.h>
-
-
#include <google/protobuf/stubs/io_win32.h>
+#include <google/protobuf/stubs/strutil.h>
#ifdef _WIN32
#include <ctype.h>
#endif
-namespace google {
-namespace protobuf {
-namespace compiler {
-
-#ifdef _WIN32
+#ifdef _MSC_VER
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
using google::protobuf::internal::win32::access;
using google::protobuf::internal::win32::open;
#endif
+namespace google {
+namespace protobuf {
+namespace compiler {
+
// Returns true if the text looks like a Windows-style absolute path, starting
// with a drive letter. Example: "C:\foo". TODO(kenton): Share this with
// copy in command_line_interface.cc?
@@ -129,7 +131,7 @@ SourceTreeDescriptorDatabase::~SourceTreeDescriptorDatabase() {}
bool SourceTreeDescriptorDatabase::FindFileByName(
const string& filename, FileDescriptorProto* output) {
- std::unique_ptr<io::ZeroCopyInputStream> input(source_tree_->Open(filename));
+ google::protobuf::scoped_ptr<io::ZeroCopyInputStream> input(source_tree_->Open(filename));
if (input == NULL) {
if (error_collector_ != NULL) {
error_collector_->AddError(filename, -1, 0,
@@ -418,7 +420,7 @@ DiskSourceTree::DiskFileToVirtualFile(
// Verify that we can open the file. Note that this also has the side-effect
// of verifying that we are not canonicalizing away any non-existent
// directories.
- std::unique_ptr<io::ZeroCopyInputStream> stream(OpenDiskFile(disk_file));
+ google::protobuf::scoped_ptr<io::ZeroCopyInputStream> stream(OpenDiskFile(disk_file));
if (stream == NULL) {
return CANNOT_OPEN;
}
@@ -428,7 +430,7 @@ DiskSourceTree::DiskFileToVirtualFile(
bool DiskSourceTree::VirtualFileToDiskFile(const string& virtual_file,
string* disk_file) {
- std::unique_ptr<io::ZeroCopyInputStream> stream(
+ google::protobuf::scoped_ptr<io::ZeroCopyInputStream> stream(
OpenVirtualFile(virtual_file, disk_file));
return stream != NULL;
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer.h
index a4ffcf87de..a4ffcf87de 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer_unittest.cc
index 73bef3f4b0..a96ac85339 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/importer_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/importer_unittest.cc
@@ -36,6 +36,9 @@
#include <google/protobuf/stubs/hash.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -265,7 +268,7 @@ class DiskSourceTreeTest : public testing::Test {
void ExpectFileContents(const string& filename,
const char* expected_contents) {
- std::unique_ptr<io::ZeroCopyInputStream> input(source_tree_.Open(filename));
+ google::protobuf::scoped_ptr<io::ZeroCopyInputStream> input(source_tree_.Open(filename));
ASSERT_FALSE(input == NULL);
@@ -282,7 +285,7 @@ class DiskSourceTreeTest : public testing::Test {
void ExpectCannotOpenFile(const string& filename,
const string& error_message) {
- std::unique_ptr<io::ZeroCopyInputStream> input(source_tree_.Open(filename));
+ google::protobuf::scoped_ptr<io::ZeroCopyInputStream> input(source_tree_.Open(filename));
EXPECT_TRUE(input == NULL);
EXPECT_EQ(error_message, source_tree_.GetLastErrorMessage());
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_context.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_context.cc
index 2528c2d13f..0771d5e19c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_context.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_context.cc
@@ -69,14 +69,14 @@ bool IsConflicting(const FieldDescriptor* field1, const string& name1,
// field1 is repeated, and field2 is not.
if (name1 + "Count" == name2) {
*info = "both repeated field \"" + field1->name() + "\" and singular " +
- "field \"" + field2->name() + "\" generate the method \"" +
- "get" + name1 + "Count()\"";
+ "field \"" + field2->name() + "\" generates the method \"" +
+ "get" + name1 + "Count()\"";
return true;
}
if (name1 + "List" == name2) {
*info = "both repeated field \"" + field1->name() + "\" and singular " +
- "field \"" + field2->name() + "\" generate the method \"" +
- "get" + name1 + "List()\"";
+ "field \"" + field2->name() + "\" generates the method \"" +
+ "get" + name1 + "List()\"";
return true;
}
// Well, there are obviously many more conflicting cases, but it probably
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_context.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_context.h
index 9de7415ad2..9a74c4303d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_context.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_context.h
@@ -33,6 +33,9 @@
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/stubs/common.h>
@@ -94,7 +97,7 @@ class Context {
void InitializeFieldGeneratorInfoForFields(
const std::vector<const FieldDescriptor*>& fields);
- std::unique_ptr<ClassNameResolver> name_resolver_;
+ google::protobuf::scoped_ptr<ClassNameResolver> name_resolver_;
std::map<const FieldDescriptor*, FieldGeneratorInfo>
field_generator_info_map_;
std::map<const OneofDescriptor*, OneofGeneratorInfo>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment.cc
index 59c04ad412..59c04ad412 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment.h
index 7d9535c959..7d9535c959 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
index ae582ea649..ae582ea649 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum.cc
index bef69f1a10..d125ebe52c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum.cc
@@ -36,12 +36,12 @@
#include <string>
#include <google/protobuf/compiler/java/java_context.h>
-#include <google/protobuf/compiler/java/java_doc_comment.h>
#include <google/protobuf/compiler/java/java_enum.h>
+#include <google/protobuf/compiler/java/java_doc_comment.h>
#include <google/protobuf/compiler/java/java_helpers.h>
#include <google/protobuf/compiler/java/java_name_resolver.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/stubs/strutil.h>
namespace google {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum.h
index 13dfc32d49..13dfc32d49 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field.cc
index 0686ea0f66..9f7bb3490b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field.cc
+++ b/third_party/protobuf/3.4.0/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, and remove the @SuppressWarnings annotations.
+ // with v2.5.0/v2.6.1.
(*variables)["for_number"] = "valueOf";
if (SupportFieldPresence(descriptor->file())) {
@@ -199,7 +199,6 @@ 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");
@@ -238,7 +237,6 @@ 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");
@@ -322,7 +320,6 @@ 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"
@@ -415,7 +412,6 @@ 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"
@@ -460,7 +456,6 @@ 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"
@@ -522,7 +517,6 @@ 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"
@@ -632,7 +626,6 @@ 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"
@@ -674,7 +667,8 @@ GenerateMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
}
- if (descriptor_->is_packed()) {
+ if (descriptor_->is_packed() &&
+ context_->HasGeneratedMethods(descriptor_->containing_type())) {
printer->Print(variables_,
"private int $name$MemoizedSerializedSize;\n");
}
@@ -885,7 +879,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field.h
index 924ff28149..924ff28149 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field_lite.cc
index f1fe71b044..a4de1e2334 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field_lite.cc
@@ -165,7 +165,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $get_has_field_bit_message$;\n"
"}\n");
@@ -174,7 +173,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportUnknownEnumValue(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Value$}$() {\n"
" return $name$_;\n"
"}\n");
@@ -182,7 +180,6 @@ GenerateMembers(io::Printer* printer) const {
}
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" $type$ result = $type$.forNumber($name$_);\n"
" return result == null ? $unknown$ : result;\n"
@@ -220,7 +217,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return instance.has$capitalized_name$();\n"
"}\n");
@@ -229,7 +225,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportUnknownEnumValue(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Value$}$() {\n"
" return instance.get$capitalized_name$Value();\n"
"}\n");
@@ -246,7 +241,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
}
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return instance.get$capitalized_name$();\n"
"}\n");
@@ -384,7 +378,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $has_oneof_case_message$;\n"
"}\n");
@@ -393,7 +386,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportUnknownEnumValue(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Value$}$() {\n"
" if ($has_oneof_case_message$) {\n"
" return (java.lang.Integer) $oneof_name$_;\n"
@@ -404,7 +396,6 @@ GenerateMembers(io::Printer* printer) const {
}
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" if ($has_oneof_case_message$) {\n"
" $type$ result = $type$.forNumber((java.lang.Integer) $oneof_name$_);\n"
@@ -448,7 +439,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return instance.has$capitalized_name$();\n"
"}\n");
@@ -457,7 +447,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportUnknownEnumValue(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Value$}$() {\n"
" return instance.get$capitalized_name$Value();\n"
"}\n");
@@ -474,7 +463,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
}
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return instance.get$capitalized_name$();\n"
"}\n");
@@ -623,7 +611,6 @@ GenerateMembers(io::Printer* printer) const {
" java.lang.Integer, $type$> $name$_converter_ =\n"
" new com.google.protobuf.Internal.ListAdapter.Converter<\n"
" java.lang.Integer, $type$>() {\n"
- " @java.lang.Override\n"
" public $type$ convert(java.lang.Integer from) {\n"
" $type$ result = $type$.forNumber(from);\n"
" return result == null ? $unknown$ : result;\n"
@@ -632,7 +619,6 @@ GenerateMembers(io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<$type$> "
"${$get$capitalized_name$List$}$() {\n"
" return new com.google.protobuf.Internal.ListAdapter<\n"
@@ -641,14 +627,12 @@ GenerateMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
" return $name$_.size();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n"
" return $name$_converter_.convert($name$_.getInt(index));\n"
"}\n");
@@ -656,7 +640,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportUnknownEnumValue(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<java.lang.Integer>\n"
"${$get$capitalized_name$ValueList$}$() {\n"
" return $name$_;\n"
@@ -664,7 +647,6 @@ GenerateMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Value$}$(int index) {\n"
" return $name$_.getInt(index);\n"
"}\n");
@@ -750,7 +732,6 @@ void RepeatedImmutableEnumFieldLiteGenerator::
GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<$type$> "
"${$get$capitalized_name$List$}$() {\n"
" return instance.get$capitalized_name$List();\n"
@@ -758,14 +739,12 @@ GenerateBuilderMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
" return instance.get$capitalized_name$Count();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n"
" return instance.get$capitalized_name$(index);\n"
"}\n");
@@ -808,7 +787,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportUnknownEnumValue(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<java.lang.Integer>\n"
"${$get$capitalized_name$ValueList$}$() {\n"
" return java.util.Collections.unmodifiableList(\n"
@@ -817,7 +795,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Value$}$(int index) {\n"
" return instance.get$capitalized_name$Value(index);\n"
"}\n");
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field_lite.h
index fa004720fd..fa004720fd 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_field_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_field_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_lite.cc
index 806008ee13..ab3b332345 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_lite.cc
@@ -36,12 +36,12 @@
#include <string>
#include <google/protobuf/compiler/java/java_context.h>
-#include <google/protobuf/compiler/java/java_doc_comment.h>
#include <google/protobuf/compiler/java/java_enum_lite.h>
+#include <google/protobuf/compiler/java/java_doc_comment.h>
#include <google/protobuf/compiler/java/java_helpers.h>
#include <google/protobuf/compiler/java/java_name_resolver.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/stubs/strutil.h>
namespace google {
@@ -135,7 +135,6 @@ void EnumLiteGenerator::Generate(io::Printer* printer) {
printer->Print(
"\n"
- "@java.lang.Override\n"
"public final int getNumber() {\n");
if (SupportUnknownEnumValue(descriptor_->file())) {
printer->Print(
@@ -183,7 +182,6 @@ void EnumLiteGenerator::Generate(io::Printer* printer) {
"private static final com.google.protobuf.Internal.EnumLiteMap<\n"
" $classname$> internalValueMap =\n"
" new com.google.protobuf.Internal.EnumLiteMap<$classname$>() {\n"
- " @java.lang.Override\n"
" public $classname$ findValueByNumber(int number) {\n"
" return $classname$.forNumber(number);\n"
" }\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_lite.h
index b7be912cb9..b7be912cb9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_enum_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_enum_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension.cc
index 3eb1370dd8..9b9be55b42 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension.cc
@@ -141,7 +141,6 @@ void ImmutableExtensionGenerator::Generate(io::Printer* printer) {
" $singular_type$.class,\n"
" $prototype$);\n");
}
- printer->Annotate("name", descriptor_);
}
int ImmutableExtensionGenerator::GenerateNonNestedInitializationCode(
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension.h
index fb8d52015b..fb8d52015b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension_lite.cc
index 70ce8e7d1f..c48c92e9fc 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension_lite.cc
@@ -96,7 +96,6 @@ void ImmutableExtensionLiteGenerator::Generate(io::Printer* printer) {
" com.google.protobuf.WireFormat.FieldType.$type_constant$,\n"
" $singular_type$.class);\n");
}
- printer->Annotate("name", descriptor_);
}
int ImmutableExtensionLiteGenerator::GenerateNonNestedInitializationCode(
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension_lite.h
index 4cd49bda20..4cd49bda20 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_extension_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_extension_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_field.cc
index 93de0229ae..1ab1862953 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_field.cc
@@ -35,6 +35,9 @@
#include <google/protobuf/compiler/java/java_field.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -211,7 +214,8 @@ template <>
FieldGeneratorMap<ImmutableFieldGenerator>::FieldGeneratorMap(
const Descriptor* descriptor, Context* context)
: descriptor_(descriptor),
- field_generators_(descriptor->field_count()) {
+ field_generators_(new google::protobuf::scoped_ptr<
+ ImmutableFieldGenerator>[descriptor->field_count()]) {
// Construct all the FieldGenerators and assign them bit indices for their
// bit fields.
@@ -233,7 +237,8 @@ template <>
FieldGeneratorMap<ImmutableFieldLiteGenerator>::FieldGeneratorMap(
const Descriptor* descriptor, Context* context)
: descriptor_(descriptor),
- field_generators_(descriptor->field_count()) {
+ field_generators_(new google::protobuf::scoped_ptr<
+ ImmutableFieldLiteGenerator>[descriptor->field_count()]) {
// Construct all the FieldGenerators and assign them bit indices for their
// bit fields.
int messageBitIndex = 0;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_field.h
index 7275c0998a..cc1d83d981 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_field.h
@@ -37,6 +37,9 @@
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <google/protobuf/stubs/common.h>
@@ -138,7 +141,7 @@ class FieldGeneratorMap {
const Descriptor* descriptor_;
Context* context_;
ClassNameResolver* name_resolver_;
- std::vector<std::unique_ptr<FieldGeneratorType>> field_generators_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<FieldGeneratorType> > field_generators_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
};
@@ -160,14 +163,6 @@ template<>
FieldGeneratorMap<ImmutableFieldGenerator>::~FieldGeneratorMap();
-template <>
-FieldGeneratorMap<ImmutableFieldLiteGenerator>::FieldGeneratorMap(
- const Descriptor* descriptor, Context* context);
-
-template <>
-FieldGeneratorMap<ImmutableFieldLiteGenerator>::~FieldGeneratorMap();
-
-
// Field information used in FieldGeneartors.
struct FieldGeneratorInfo {
string name;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_file.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_file.cc
index 5583b7795d..2d5465ba2d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_file.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_file.cc
@@ -35,6 +35,9 @@
#include <google/protobuf/compiler/java/java_file.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <set>
#include <google/protobuf/compiler/java/java_context.h>
@@ -48,9 +51,9 @@
#include <google/protobuf/compiler/java/java_service.h>
#include <google/protobuf/compiler/java/java_shared_code_generator.h>
#include <google/protobuf/compiler/code_generator.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/stubs/strutil.h>
@@ -133,7 +136,7 @@ void CollectExtensions(const FileDescriptorProto& file_proto,
"descriptor.proto is not in the transitive dependencies. "
"This normally should not happen. Please report a bug.";
DynamicMessageFactory factory;
- std::unique_ptr<Message> dynamic_file_proto(
+ google::protobuf::scoped_ptr<Message> dynamic_file_proto(
factory.GetPrototype(file_proto_desc)->New());
GOOGLE_CHECK(dynamic_file_proto.get() != NULL);
GOOGLE_CHECK(dynamic_file_proto->ParseFromString(file_data));
@@ -186,8 +189,10 @@ FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options,
bool immutable_api)
: file_(file),
java_package_(FileJavaPackage(file, immutable_api)),
- message_generators_(file->message_type_count()),
- extension_generators_(file->extension_count()),
+ message_generators_(
+ new google::protobuf::scoped_ptr<MessageGenerator>[file->message_type_count()]),
+ extension_generators_(
+ new google::protobuf::scoped_ptr<ExtensionGenerator>[file->extension_count()]),
context_(new Context(file, options)),
name_resolver_(context_->GetNameResolver()),
options_(options),
@@ -223,16 +228,6 @@ bool FileGenerator::Validate(string* error) {
"option to specify a different outer class name for the .proto file.");
return false;
}
- // Print a warning if optimize_for = LITE_RUNTIME is used.
- if (file_->options().optimize_for() == FileOptions::LITE_RUNTIME) {
- GOOGLE_LOG(WARNING)
- << "The optimize_for = LITE_RUNTIME option is no longer supported by "
- << "protobuf Java code generator and may generate broken code. It "
- << "will be ignored by protoc in the future and protoc will always "
- << "generate full runtime code for Java. To use Java Lite runtime, "
- << "users should use the Java Lite plugin instead. See:\n"
- << " https://github.com/google/protobuf/blob/master/java/lite.md";
- }
return true;
}
@@ -253,12 +248,9 @@ void FileGenerator::Generate(io::Printer* printer) {
PrintGeneratedAnnotation(
printer, '$', options_.annotate_code ? classname_ + ".java.pb.meta" : "");
printer->Print(
- "$deprecation$public final class $classname$ {\n"
+ "public final class $classname$ {\n"
" private $ctor$() {}\n",
- "deprecation", file_->options().deprecated() ?
- "@java.lang.Deprecated " : "",
- "classname", classname_,
- "ctor", classname_);
+ "classname", classname_, "ctor", classname_);
printer->Annotate("classname", file_->name());
printer->Indent();
@@ -314,7 +306,7 @@ void FileGenerator::Generate(io::Printer* printer) {
}
if (HasGenericServices(file_, context_->EnforceLite())) {
for (int i = 0; i < file_->service_count(); i++) {
- std::unique_ptr<ServiceGenerator> generator(
+ google::protobuf::scoped_ptr<ServiceGenerator> generator(
generator_factory_->NewServiceGenerator(file_->service(i)));
generator->Generate(printer);
}
@@ -440,7 +432,7 @@ void FileGenerator::GenerateDescriptorInitializationCodeForImmutable(
" com.google.protobuf.ExtensionRegistry.newInstance();\n");
FieldDescriptorSet::iterator it;
for (it = extensions.begin(); it != extensions.end(); it++) {
- std::unique_ptr<ExtensionGenerator> generator(
+ google::protobuf::scoped_ptr<ExtensionGenerator> generator(
generator_factory_->NewExtensionGenerator(*it));
bytecode_estimate += generator->GenerateRegistrationCode(printer);
MaybeRestartJavaMethod(
@@ -593,7 +585,7 @@ static void GenerateSibling(const string& package_dir,
io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
&annotations);
- std::unique_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
io::Printer printer(output.get(), '$',
annotate_code ? &annotation_collector : NULL);
@@ -612,7 +604,7 @@ static void GenerateSibling(const string& package_dir,
(generator->*pfn)(&printer);
if (annotate_code) {
- std::unique_ptr<io::ZeroCopyOutputStream> info_output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> info_output(
context->Open(info_full_path));
annotations.SerializeToZeroCopyStream(info_output.get());
annotation_list->push_back(info_full_path);
@@ -655,7 +647,7 @@ void FileGenerator::GenerateSiblings(const string& package_dir,
}
if (HasGenericServices(file_, context_->EnforceLite())) {
for (int i = 0; i < file_->service_count(); i++) {
- std::unique_ptr<ServiceGenerator> generator(
+ google::protobuf::scoped_ptr<ServiceGenerator> generator(
generator_factory_->NewServiceGenerator(file_->service(i)));
GenerateSibling<ServiceGenerator>(
package_dir, java_package_, file_->service(i), context, file_list,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_file.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_file.h
index 78833a4589..e95aef0912 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_file.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_file.h
@@ -36,6 +36,9 @@
#define GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
#include <google/protobuf/stubs/common.h>
@@ -98,10 +101,10 @@ class FileGenerator {
string java_package_;
string classname_;
- std::vector<std::unique_ptr<MessageGenerator>> message_generators_;
- std::vector<std::unique_ptr<ExtensionGenerator>> extension_generators_;
- std::unique_ptr<GeneratorFactory> generator_factory_;
- std::unique_ptr<Context> context_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> > message_generators_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator> > extension_generators_;
+ google::protobuf::scoped_ptr<GeneratorFactory> generator_factory_;
+ google::protobuf::scoped_ptr<Context> context_;
ClassNameResolver* name_resolver_;
const Options options_;
bool immutable_api_;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator.cc
index a5b2e78412..84a3b90d6c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator.cc
@@ -35,6 +35,9 @@
#include <google/protobuf/compiler/java/java_generator.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/compiler/java/java_file.h>
#include <google/protobuf/compiler/java/java_generator_factory.h>
@@ -42,9 +45,9 @@
#include <google/protobuf/compiler/java/java_name_resolver.h>
#include <google/protobuf/compiler/java/java_options.h>
#include <google/protobuf/compiler/java/java_shared_code_generator.h>
-#include <google/protobuf/descriptor.pb.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>
@@ -141,7 +144,7 @@ bool JavaGenerator::Generate(const FileDescriptor* file,
}
// Generate main java file.
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->Open(java_filename));
GeneratedCodeInfo annotations;
io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
@@ -157,7 +160,7 @@ bool JavaGenerator::Generate(const FileDescriptor* file,
&all_annotations);
if (file_options.annotate_code) {
- std::unique_ptr<io::ZeroCopyOutputStream> info_output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> info_output(
context->Open(info_full_path));
annotations.SerializeToZeroCopyStream(info_output.get());
}
@@ -172,7 +175,7 @@ bool JavaGenerator::Generate(const FileDescriptor* file,
if (!file_options.output_list_file.empty()) {
// Generate output list. This is just a simple text file placed in a
// deterministic location which lists the .java files being generated.
- std::unique_ptr<io::ZeroCopyOutputStream> srclist_raw_output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> srclist_raw_output(
context->Open(file_options.output_list_file));
io::Printer srclist_printer(srclist_raw_output.get(), '$');
for (int i = 0; i < all_files.size(); i++) {
@@ -183,7 +186,7 @@ bool JavaGenerator::Generate(const FileDescriptor* file,
if (!file_options.annotation_list_file.empty()) {
// Generate output list. This is just a simple text file placed in a
// deterministic location which lists the .java files being generated.
- std::unique_ptr<io::ZeroCopyOutputStream> annotation_list_raw_output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> annotation_list_raw_output(
context->Open(file_options.annotation_list_file));
io::Printer annotation_list_printer(annotation_list_raw_output.get(), '$');
for (int i = 0; i < all_annotations.size(); i++) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator.h
index 47f76be983..47f76be983 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator_factory.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator_factory.cc
index 3218b41076..3218b41076 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator_factory.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator_factory.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator_factory.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator_factory.h
index 55365a9d4e..55365a9d4e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_generator_factory.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_generator_factory.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_helpers.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_helpers.cc
index 957076cb4a..d8ac2db374 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_helpers.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_helpers.cc
@@ -37,7 +37,6 @@
#include <limits>
#include <vector>
-#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/compiler/java/java_helpers.h>
#include <google/protobuf/compiler/java/java_name_resolver.h>
#include <google/protobuf/descriptor.pb.h>
@@ -75,8 +74,6 @@ const char* kForbiddenWordList[] = {
"class",
};
-const int kDefaultLookUpStartFieldNumber = 40;
-
bool IsForbidden(const string& field_name) {
for (int i = 0; i < GOOGLE_ARRAYSIZE(kForbiddenWordList); ++i) {
if (field_name == kForbiddenWordList[i]) {
@@ -105,20 +102,6 @@ string FieldName(const FieldDescriptor* field) {
}
-// Judge whether should use table or use look up.
-// Copied from com.google.protobuf.SchemaUtil.shouldUseTableSwitch
-bool ShouldUseTable(int lo, int hi, int number_of_fields) {
- if (hi < kDefaultLookUpStartFieldNumber) {
- return true;
- }
- int64 table_space_cost = (static_cast<int64>(hi) - lo + 1); // words
- int64 table_time_cost = 3; // comparisons
- int64 lookup_space_cost = 3 + 2 * static_cast<int64>(number_of_fields);
- int64 lookup_time_cost = 3 + number_of_fields;
- return table_space_cost + 3 * table_time_cost <=
- lookup_space_cost + 3 * lookup_time_cost;
-}
-
} // namespace
void PrintGeneratedAnnotation(io::Printer* printer, char delimiter,
@@ -800,154 +783,6 @@ bool HasRepeatedFields(const Descriptor* descriptor) {
return false;
}
-// Encode an unsigned 32-bit value into a sequence of UTF-16 characters.
-//
-// If the value is in [0x0000, 0xD7FF], we encode it with a single character
-// with the same numeric value.
-//
-// If the value is larger than 0xD7FF, we encode its lowest 13 bits into a
-// character in the range [0xE000, 0xFFFF] by combining these 13 bits with
-// 0xE000 using logic-or. Then we shift the value to the right by 13 bits, and
-// encode the remaining value by repeating this same process until we get to
-// a value in [0x0000, 0xD7FF] where we will encode it using a character with
-// the same numeric value.
-//
-// Note that we only use code points in [0x0000, 0xD7FF] and [0xE000, 0xFFFF].
-// There will be no surrogate pairs in the encoded character sequence.
-void WriteUInt32ToUtf16CharSequence(uint32 number,
- std::vector<uint16>* output) {
- // For values in [0x0000, 0xD7FF], only use one char to encode it.
- if (number < 0xD800) {
- output->push_back(static_cast<uint16>(number));
- return;
- }
- // Encode into multiple chars. All except the last char will be in the range
- // [0xE000, 0xFFFF], and the last char will be in the range [0x0000, 0xD7FF].
- // Note that we don't use any value in range [0xD800, 0xDFFF] because they
- // have to come in pairs and the encoding is just more space-efficient w/o
- // them.
- while (number >= 0xD800) {
- // [0xE000, 0xFFFF] can represent 13 bits of info.
- output->push_back(static_cast<uint16>(0xE000 | (number & 0x1FFF)));
- number >>= 13;
- }
- output->push_back(static_cast<uint16>(number));
-}
-
-int GetExperimentalJavaFieldTypeForSingular(const FieldDescriptor* field) {
- // j/c/g/protobuf/FieldType.java lists field types in a slightly different
- // order from FieldDescriptor::Type so we can't do a simple cast.
- //
- // TODO(xiaofeng): Make j/c/g/protobuf/FieldType.java follow the same order.
- int result = field->type();
- if (result == FieldDescriptor::TYPE_GROUP) {
- return 17;
- } else if (result < FieldDescriptor::TYPE_GROUP) {
- return result - 1;
- } else {
- return result - 2;
- }
-}
-
-int GetExperimentalJavaFieldTypeForRepeated(const FieldDescriptor* field) {
- if (field->type() == FieldDescriptor::TYPE_GROUP) {
- return 49;
- } else {
- return GetExperimentalJavaFieldTypeForSingular(field) + 18;
- }
-}
-
-int GetExperimentalJavaFieldTypeForPacked(const FieldDescriptor* field) {
- int result = field->type();
- if (result < FieldDescriptor::TYPE_STRING) {
- return result + 34;
- } else if (result > FieldDescriptor::TYPE_BYTES) {
- return result + 30;
- } else {
- GOOGLE_LOG(FATAL) << field->full_name() << " can't be packed.";
- return 0;
- }
-}
-
-int GetExperimentalJavaFieldType(const FieldDescriptor* field) {
- static const int kMapFieldType = 50;
- static const int kOneofFieldTypeOffset = 51;
- static const int kRequiredBit = 0x100;
- static const int kUtf8CheckBit = 0x200;
- static const int kCheckInitialized = 0x400;
- static const int kMapWithProto2EnumValue = 0x800;
- int extra_bits = field->is_required() ? kRequiredBit : 0;
- if (field->type() == FieldDescriptor::TYPE_STRING && CheckUtf8(field)) {
- extra_bits |= kUtf8CheckBit;
- }
- if (field->is_required() || (GetJavaType(field) == JAVATYPE_MESSAGE &&
- HasRequiredFields(field->message_type()))) {
- extra_bits |= kCheckInitialized;
- }
-
- if (field->is_map()) {
- if (SupportFieldPresence(field->file())) {
- const FieldDescriptor* value =
- field->message_type()->FindFieldByName("value");
- if (GetJavaType(value) == JAVATYPE_ENUM) {
- extra_bits |= kMapWithProto2EnumValue;
- }
- }
- return kMapFieldType | extra_bits;
- } else if (field->is_packed()) {
- return GetExperimentalJavaFieldTypeForPacked(field);
- } else if (field->is_repeated()) {
- return GetExperimentalJavaFieldTypeForRepeated(field) | extra_bits;
- } else if (field->containing_oneof() != NULL) {
- return (GetExperimentalJavaFieldTypeForSingular(field) +
- kOneofFieldTypeOffset) |
- extra_bits;
- } else {
- return GetExperimentalJavaFieldTypeForSingular(field) | extra_bits;
- }
-}
-
-// Escape a UTF-16 character to be embedded in a Java string.
-void EscapeUtf16ToString(uint16 code, string* output) {
- if (code == '\t') {
- output->append("\\t");
- } else if (code == '\b') {
- output->append("\\b");
- } else if (code == '\n') {
- output->append("\\n");
- } else if (code == '\r') {
- output->append("\\r");
- } else if (code == '\f') {
- output->append("\\f");
- } else if (code == '\'') {
- output->append("\\'");
- } else if (code == '\"') {
- output->append("\\\"");
- } else if (code == '\\') {
- output->append("\\\\");
- } else if (code >= 0x20 && code <= 0x7f) {
- output->push_back(static_cast<char>(code));
- } else {
- output->append(StringPrintf("\\u%04x", code));
- }
-}
-
-std::pair<int, int> GetTableDrivenNumberOfEntriesAndLookUpStartFieldNumber(
- const FieldDescriptor** fields, int count) {
- GOOGLE_CHECK_GT(count, 0);
- int table_driven_number_of_entries = count;
- int look_up_start_field_number = 0;
- for (int i = 0; i < count; i++) {
- const int field_number = fields[i]->number();
- if (ShouldUseTable(fields[0]->number(), field_number, i + 1)) {
- table_driven_number_of_entries =
- field_number - fields[0]->number() + 1 + count - i - 1;
- look_up_start_field_number = field_number + 1;
- }
- }
- return std::make_pair(
- table_driven_number_of_entries, look_up_start_field_number);
-}
} // namespace java
} // namespace compiler
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_helpers.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_helpers.h
index dd9b65b816..bd565ced0d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_helpers.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_helpers.h
@@ -37,8 +37,8 @@
#include <string>
#include <google/protobuf/compiler/java/java_context.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
namespace google {
@@ -136,13 +136,6 @@ inline string ShortMutableJavaClassName(const Descriptor* descriptor) {
return descriptor->name();
}
-// Whether the given descriptor is for one of the core descriptor protos. We
-// cannot currently use the new runtime with core protos since there is a
-// bootstrapping problem with obtaining their descriptors.
-inline bool IsDescriptorProto(const Descriptor* descriptor) {
- return descriptor->file()->name() == "google/protobuf/descriptor.proto";
-}
-
// Whether we should generate multiple java files for messages.
inline bool MultipleJavaFiles(
@@ -378,10 +371,6 @@ inline bool IsAnyMessage(const Descriptor* descriptor) {
return descriptor->full_name() == "google.protobuf.Any";
}
-inline bool IsWrappersProtoFile(const FileDescriptor* descriptor) {
- return descriptor->name() == "google/protobuf/wrappers.proto";
-}
-
inline bool CheckUtf8(const FieldDescriptor* descriptor) {
return descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ||
descriptor->file()->options().java_string_check_utf8();
@@ -390,35 +379,6 @@ inline bool CheckUtf8(const FieldDescriptor* descriptor) {
inline string GeneratedCodeVersionSuffix() {
return "V3";
}
-
-inline bool EnableExperimentalRuntime(Context* context) {
- return false;
-}
-
-void WriteUInt32ToUtf16CharSequence(uint32 number, std::vector<uint16>* output);
-
-inline void WriteIntToUtf16CharSequence(int value,
- std::vector<uint16>* output) {
- WriteUInt32ToUtf16CharSequence(static_cast<uint32>(value), output);
-}
-
-// Escape a UTF-16 character so it can be embedded in a Java string literal.
-void EscapeUtf16ToString(uint16 code, string* output);
-
-// Only the lowest two bytes of the return value are used. The lowest byte
-// is the integer value of a j/c/g/protobuf/FieldType enum. For the other
-// byte:
-// bit 0: whether the field is required.
-// bit 1: whether the field requires UTF-8 validation.
-// bit 2: whether the field needs isInitialized check.
-// bit 3: whether the field is a map field with proto2 enum value.
-// bits 4-7: unused
-int GetExperimentalJavaFieldType(const FieldDescriptor* field);
-
-// To get the total number of entries need to be built for experimental runtime
-// and the first field number that are not in the table part
-std::pair<int, int> GetTableDrivenNumberOfEntriesAndLookUpStartFieldNumber(
- const FieldDescriptor** fields, int count);
} // namespace java
} // namespace compiler
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field.cc
index abf8e55cf7..abf8e55cf7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field.h
index b1b7f2820e..b1b7f2820e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc
index 51bb11f1c7..51bb11f1c7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h
index 65b84fbcab..65b84fbcab 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field.cc
index b22a21993f..b22a21993f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field.h
index 4702174063..4702174063 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field_lite.cc
index e2e68076c7..f19ec271e0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field_lite.cc
@@ -301,7 +301,6 @@ GenerateMembers(io::Printer* printer) const {
"}\n");
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public int ${$get$capitalized_name$Count$}$() {\n"
" return internalGet$capitalized_name$().size();\n"
@@ -310,7 +309,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public boolean ${$contains$capitalized_name$$}$(\n"
" $key_type$ key) {\n"
@@ -341,7 +339,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public java.util.Map<$boxed_key_type$, $value_enum_type$>\n"
"${$get$capitalized_name$Map$}$() {\n"
@@ -355,7 +352,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_enum_type$ ${$get$capitalized_name$OrDefault$}$(\n"
" $key_type$ key,\n"
@@ -371,7 +367,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_enum_type$ ${$get$capitalized_name$OrThrow$}$(\n"
" $key_type$ key) {\n"
@@ -390,7 +385,6 @@ GenerateMembers(io::Printer* printer) const {
"/**\n"
" * Use {@link #get$capitalized_name$ValueMap()} instead.\n"
" */\n"
- "@java.lang.Override\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n"
"${$get$capitalized_name$Value$}$() {\n"
@@ -400,7 +394,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n"
"${$get$capitalized_name$ValueMap$}$() {\n"
@@ -411,7 +404,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_type$ ${$get$capitalized_name$ValueOrDefault$}$(\n"
" $key_type$ key,\n"
@@ -425,7 +417,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n"
" $key_type$ key) {\n"
@@ -445,7 +436,6 @@ GenerateMembers(io::Printer* printer) const {
"/**\n"
" * Use {@link #get$capitalized_name$Map()} instead.\n"
" */\n"
- "@java.lang.Override\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$type_parameters$> "
"${$get$capitalized_name$$}$() {\n"
@@ -455,7 +445,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public java.util.Map<$type_parameters$> "
"${$get$capitalized_name$Map$}$() {\n"
@@ -466,7 +455,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_type$ ${$get$capitalized_name$OrDefault$}$(\n"
" $key_type$ key,\n"
@@ -480,7 +468,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_type$ ${$get$capitalized_name$OrThrow$}$(\n"
" $key_type$ key) {\n"
@@ -532,7 +519,6 @@ void ImmutableMapFieldLiteGenerator::
GenerateBuilderMembers(io::Printer* printer) const {
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public int ${$get$capitalized_name$Count$}$() {\n"
" return instance.get$capitalized_name$Map().size();\n"
@@ -541,7 +527,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public boolean ${$contains$capitalized_name$$}$(\n"
" $key_type$ key) {\n"
@@ -585,7 +570,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public java.util.Map<$boxed_key_type$, $value_enum_type$>\n"
"${$get$capitalized_name$Map$}$() {\n"
@@ -596,7 +580,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_enum_type$ ${$get$capitalized_name$OrDefault$}$(\n"
" $key_type$ key,\n"
@@ -612,7 +595,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_enum_type$ ${$get$capitalized_name$OrThrow$}$(\n"
" $key_type$ key) {\n"
@@ -654,7 +636,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
"/**\n"
" * Use {@link #get$capitalized_name$ValueMap()} instead.\n"
" */\n"
- "@java.lang.Override\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n"
"${$get$capitalized_name$Value$}$() {\n"
@@ -664,7 +645,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n"
"${$get$capitalized_name$ValueMap$}$() {\n"
@@ -675,7 +655,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_type$ ${$get$capitalized_name$ValueOrDefault$}$(\n"
" $key_type$ key,\n"
@@ -689,7 +668,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n"
" $key_type$ key) {\n"
@@ -731,7 +709,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
"/**\n"
" * Use {@link #get$capitalized_name$Map()} instead.\n"
" */\n"
- "@java.lang.Override\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$type_parameters$> "
"${$get$capitalized_name$$}$() {\n"
@@ -741,7 +718,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$"
"public java.util.Map<$type_parameters$> "
"${$get$capitalized_name$Map$}$() {\n"
@@ -752,7 +728,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_type$ ${$get$capitalized_name$OrDefault$}$(\n"
" $key_type$ key,\n"
@@ -766,7 +741,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
- "@java.lang.Override\n"
"$deprecation$\n"
"public $value_type$ ${$get$capitalized_name$OrThrow$}$(\n"
" $key_type$ key) {\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field_lite.h
index 94aa48136b..94aa48136b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_map_field_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_map_field_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message.cc
index 209c0b2a2a..ecc67575a5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message.cc
@@ -38,6 +38,9 @@
#include <google/protobuf/stubs/hash.h>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/compiler/java/java_context.h>
@@ -49,9 +52,9 @@
#include <google/protobuf/compiler/java/java_message_builder.h>
#include <google/protobuf/compiler/java/java_message_builder_lite.h>
#include <google/protobuf/compiler/java/java_name_resolver.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/stubs/strutil.h>
@@ -368,7 +371,6 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) {
"}\n"
"\n");
-
printer->Print(
"@java.lang.Override\n"
"public final com.google.protobuf.UnknownFieldSet\n"
@@ -377,10 +379,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) {
"}\n");
if (context_->HasGeneratedMethods(descriptor_)) {
- if (!EnableExperimentalRuntime(context_) ||
- IsDescriptorProto(descriptor_)) {
- GenerateParsingConstructor(printer);
- }
+ GenerateParsingConstructor(printer);
}
GenerateDescriptorMethods(printer);
@@ -434,11 +433,11 @@ 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(
- "$deprecation$$field_name$($field_number$),\n",
- "deprecation",
- field->options().deprecated() ? "@java.lang.Deprecated " : "",
- "field_name", ToUpper(field->name()),
- "field_number", SimpleItoa(field->number()));
+ "$field_name$($field_number$),\n",
+ "field_name",
+ ToUpper(field->name()),
+ "field_number",
+ SimpleItoa(field->number()));
}
printer->Print(
"$cap_oneof_name$_NOT_SET(0);\n",
@@ -538,21 +537,9 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) {
"\n",
"classname", name_resolver_->GetImmutableClassName(descriptor_));
- // 'of' method for Wrappers
- if (IsWrappersProtoFile(descriptor_->file())) {
- printer->Print(
- "public static $classname$ of($field_type$ value) {\n"
- " return newBuilder().setValue(value).build();\n"
- "}\n"
- "\n",
- "classname", name_resolver_->GetImmutableClassName(descriptor_),
- "field_type", PrimitiveTypeName(GetJavaType(descriptor_->field(0))));
- }
-
GenerateParser(printer);
printer->Print(
- "@java.lang.Override\n"
"public $classname$ getDefaultInstanceForType() {\n"
" return DEFAULT_INSTANCE;\n"
"}\n"
@@ -576,7 +563,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) {
void ImmutableMessageGenerator::
GenerateMessageSerializationMethods(io::Printer* printer) {
- std::unique_ptr<const FieldDescriptor * []> sorted_fields(
+ google::protobuf::scoped_array<const FieldDescriptor * > sorted_fields(
SortFieldsByNumber(descriptor_));
std::vector<const Descriptor::ExtensionRange*> sorted_extensions;
@@ -586,108 +573,98 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
std::sort(sorted_extensions.begin(), sorted_extensions.end(),
ExtensionRangeOrdering());
printer->Print(
- "@java.lang.Override\n"
"public void writeTo(com.google.protobuf.CodedOutputStream output)\n"
" throws java.io.IOException {\n");
printer->Indent();
+ if (HasPackedFields(descriptor_)) {
+ // writeTo(CodedOutputStream output) might be invoked without
+ // getSerializedSize() ever being called, but we need the memoized
+ // sizes in case this message has packed fields. Rather than emit checks for
+ // each packed field, just call getSerializedSize() up front.
+ // In most cases, getSerializedSize() will have already been called anyway
+ // by one of the wrapper writeTo() methods, making this call cheap.
+ printer->Print(
+ "getSerializedSize();\n");
+ }
- if (EnableExperimentalRuntime(context_) && !IsDescriptorProto(descriptor_)) {
- printer->Print("writeToInternal(output);\n");
- } else {
- if (HasPackedFields(descriptor_)) {
- // writeTo(CodedOutputStream output) might be invoked without
- // getSerializedSize() ever being called, but we need the memoized
- // sizes in case this message has packed fields. Rather than emit checks
- // for each packed field, just call getSerializedSize() up front. In most
- // cases, getSerializedSize() will have already been called anyway by one
- // of the wrapper writeTo() methods, making this call cheap.
- printer->Print("getSerializedSize();\n");
- }
-
- if (descriptor_->extension_range_count() > 0) {
- if (descriptor_->options().message_set_wire_format()) {
- printer->Print(
- "com.google.protobuf.GeneratedMessage$ver$\n"
- " .ExtendableMessage<$classname$>.ExtensionWriter\n"
- " extensionWriter = newMessageSetExtensionWriter();\n",
- "classname", name_resolver_->GetImmutableClassName(descriptor_),
- "ver", GeneratedCodeVersionSuffix());
- } else {
- printer->Print(
- "com.google.protobuf.GeneratedMessage$ver$\n"
- " .ExtendableMessage<$classname$>.ExtensionWriter\n"
- " extensionWriter = newExtensionWriter();\n",
- "classname", name_resolver_->GetImmutableClassName(descriptor_),
- "ver", GeneratedCodeVersionSuffix());
- }
- }
-
- // Merge the fields and the extension ranges, both sorted by field number.
- for (int i = 0, j = 0;
- i < descriptor_->field_count() || j < sorted_extensions.size();) {
- if (i == descriptor_->field_count()) {
- GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]);
- } else if (j == sorted_extensions.size()) {
- GenerateSerializeOneField(printer, sorted_fields[i++]);
- } else if (sorted_fields[i]->number() < sorted_extensions[j]->start) {
- GenerateSerializeOneField(printer, sorted_fields[i++]);
- } else {
- GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]);
- }
+ if (descriptor_->extension_range_count() > 0) {
+ if (descriptor_->options().message_set_wire_format()) {
+ printer->Print(
+ "com.google.protobuf.GeneratedMessage$ver$\n"
+ " .ExtendableMessage<$classname$>.ExtensionWriter\n"
+ " extensionWriter = newMessageSetExtensionWriter();\n",
+ "classname", name_resolver_->GetImmutableClassName(descriptor_),
+ "ver", GeneratedCodeVersionSuffix());
+ } else {
+ printer->Print(
+ "com.google.protobuf.GeneratedMessage$ver$\n"
+ " .ExtendableMessage<$classname$>.ExtensionWriter\n"
+ " extensionWriter = newExtensionWriter();\n",
+ "classname", name_resolver_->GetImmutableClassName(descriptor_),
+ "ver", GeneratedCodeVersionSuffix());
}
+ }
- if (descriptor_->options().message_set_wire_format()) {
- printer->Print("unknownFields.writeAsMessageSetTo(output);\n");
+ // Merge the fields and the extension ranges, both sorted by field number.
+ for (int i = 0, j = 0;
+ i < descriptor_->field_count() || j < sorted_extensions.size();
+ ) {
+ if (i == descriptor_->field_count()) {
+ GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]);
+ } else if (j == sorted_extensions.size()) {
+ GenerateSerializeOneField(printer, sorted_fields[i++]);
+ } else if (sorted_fields[i]->number() < sorted_extensions[j]->start) {
+ GenerateSerializeOneField(printer, sorted_fields[i++]);
} else {
- printer->Print("unknownFields.writeTo(output);\n");
+ GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]);
}
}
- printer->Outdent();
- printer->Print(
- "}\n"
- "\n"
- "@java.lang.Override\n"
- "public int getSerializedSize() {\n"
- " int size = memoizedSize;\n"
- " if (size != -1) return size;\n"
- "\n");
- printer->Indent();
- if (EnableExperimentalRuntime(context_) && !IsDescriptorProto(descriptor_)) {
+ if (descriptor_->options().message_set_wire_format()) {
printer->Print(
- "memoizedSize = getSerializedSizeInternal();\n"
- "return memoizedSize;\n");
+ "unknownFields.writeAsMessageSetTo(output);\n");
} else {
+ printer->Print(
+ "unknownFields.writeTo(output);\n");
+ }
- printer->Print("size = 0;\n");
-
- for (int i = 0; i < descriptor_->field_count(); i++) {
- field_generators_.get(sorted_fields[i])
- .GenerateSerializedSizeCode(printer);
- }
+ printer->Outdent();
+ printer->Print(
+ "}\n"
+ "\n"
+ "public int getSerializedSize() {\n"
+ " int size = memoizedSize;\n"
+ " if (size != -1) return size;\n"
+ "\n"
+ " size = 0;\n");
+ printer->Indent();
- if (descriptor_->extension_range_count() > 0) {
- if (descriptor_->options().message_set_wire_format()) {
- printer->Print("size += extensionsSerializedSizeAsMessageSet();\n");
- } else {
- printer->Print("size += extensionsSerializedSize();\n");
- }
- }
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ field_generators_.get(sorted_fields[i]).GenerateSerializedSizeCode(printer);
+ }
+ if (descriptor_->extension_range_count() > 0) {
if (descriptor_->options().message_set_wire_format()) {
printer->Print(
- "size += unknownFields.getSerializedSizeAsMessageSet();\n");
+ "size += extensionsSerializedSizeAsMessageSet();\n");
} else {
- printer->Print("size += unknownFields.getSerializedSize();\n");
+ printer->Print(
+ "size += extensionsSerializedSize();\n");
}
+ }
+ if (descriptor_->options().message_set_wire_format()) {
printer->Print(
- "memoizedSize = size;\n"
- "return size;\n");
+ "size += unknownFields.getSerializedSizeAsMessageSet();\n");
+ } else {
+ printer->Print(
+ "size += unknownFields.getSerializedSize();\n");
}
printer->Outdent();
printer->Print(
+ " memoizedSize = size;\n"
+ " return size;\n"
"}\n"
"\n");
}
@@ -789,7 +766,6 @@ void ImmutableMessageGenerator::GenerateSerializeOneExtensionRange(
void ImmutableMessageGenerator::GenerateBuilder(io::Printer* printer) {
// LITE_RUNTIME implements this at the GeneratedMessageLite level.
printer->Print(
- "@java.lang.Override\n"
"public Builder newBuilderForType() { return newBuilder(); }\n");
printer->Print(
@@ -799,7 +775,6 @@ void ImmutableMessageGenerator::GenerateBuilder(io::Printer* printer) {
"public static Builder newBuilder($classname$ prototype) {\n"
" return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);\n"
"}\n"
- "@java.lang.Override\n"
"public Builder toBuilder() {\n"
" return this == DEFAULT_INSTANCE\n"
" ? new Builder() : new Builder().mergeFrom(this);\n"
@@ -843,7 +818,6 @@ GenerateDescriptorMethods(io::Printer* printer) {
if (!map_fields.empty()) {
printer->Print(
"@SuppressWarnings({\"rawtypes\"})\n"
- "@java.lang.Override\n"
"protected com.google.protobuf.MapField internalGetMapField(\n"
" int number) {\n"
" switch (number) {\n");
@@ -869,7 +843,6 @@ GenerateDescriptorMethods(io::Printer* printer) {
"}\n");
}
printer->Print(
- "@java.lang.Override\n"
"protected com.google.protobuf.GeneratedMessage$ver$.FieldAccessorTable\n"
" internalGetFieldAccessorTable() {\n"
" return $fileclass$.internal_$identifier$_fieldAccessorTable\n"
@@ -893,7 +866,6 @@ void ImmutableMessageGenerator::GenerateIsInitialized(
printer->Print(
"private byte memoizedIsInitialized = -1;\n");
printer->Print(
- "@java.lang.Override\n"
"public final boolean isInitialized() {\n");
printer->Indent();
@@ -1214,7 +1186,7 @@ GenerateExtensionRegistrationCode(io::Printer* printer) {
// ===================================================================
void ImmutableMessageGenerator::
GenerateParsingConstructor(io::Printer* printer) {
- std::unique_ptr<const FieldDescriptor * []> sorted_fields(
+ google::protobuf::scoped_array<const FieldDescriptor * > sorted_fields(
SortFieldsByNumber(descriptor_));
printer->Print(
@@ -1227,10 +1199,7 @@ GenerateParsingConstructor(io::Printer* printer) {
// Initialize all fields to default.
printer->Print(
- "this();\n"
- "if (extensionRegistry == null) {\n"
- " throw new java.lang.NullPointerException();\n"
- "}\n");
+ "this();\n");
// Use builder bits to track mutable repeated fields.
int totalBuilderBits = 0;
@@ -1264,9 +1233,19 @@ GenerateParsingConstructor(io::Printer* printer) {
printer->Indent();
printer->Print(
- "case 0:\n" // zero signals EOF / limit reached
- " done = true;\n"
- " break;\n");
+ "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"
+ : "");
for (int i = 0; i < descriptor_->field_count(); i++) {
const FieldDescriptor* field = sorted_fields[i];
@@ -1304,18 +1283,6 @@ 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(
@@ -1363,24 +1330,15 @@ void ImmutableMessageGenerator::GenerateParser(io::Printer* printer) {
"classname", descriptor_->name());
printer->Indent();
printer->Print(
- "@java.lang.Override\n"
"public $classname$ parsePartialFrom(\n"
" com.google.protobuf.CodedInputStream input,\n"
" com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n"
" throws com.google.protobuf.InvalidProtocolBufferException {\n",
"classname", descriptor_->name());
- if (EnableExperimentalRuntime(context_) && !IsDescriptorProto(descriptor_)) {
- printer->Indent();
+ if (context_->HasGeneratedMethods(descriptor_)) {
printer->Print(
- "$classname$ msg = new $classname$();\n"
- "msg.mergeFromInternal(input, extensionRegistry);\n"
- "msg.makeImmutableInternal();\n"
- "return msg;\n",
+ " return new $classname$(input, extensionRegistry);\n",
"classname", descriptor_->name());
- printer->Outdent();
- } else if (context_->HasGeneratedMethods(descriptor_)) {
- printer->Print(" return new $classname$(input, extensionRegistry);\n",
- "classname", descriptor_->name());
} else {
// When parsing constructor isn't generated, use builder to parse
// messages. Note, will fallback to use reflection based mergeFieldFrom()
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message.h
index da1447c176..da1447c176 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder.cc
index 4c67e8066f..f9bbfbf4c9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder.cc
@@ -38,6 +38,9 @@
#include <google/protobuf/stubs/hash.h>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/compiler/java/java_context.h>
@@ -47,9 +50,9 @@
#include <google/protobuf/compiler/java/java_generator_factory.h>
#include <google/protobuf/compiler/java/java_helpers.h>
#include <google/protobuf/compiler/java/java_name_resolver.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/stubs/strutil.h>
@@ -177,13 +180,11 @@ Generate(io::Printer* printer) {
// to subclass a different GeneratedMessage class (e.g., in v3.0.0 release
// we changed all generated code to subclass GeneratedMessageV3).
printer->Print(
- "@java.lang.Override\n"
"public final Builder setUnknownFields(\n"
" final com.google.protobuf.UnknownFieldSet unknownFields) {\n"
" return super.setUnknownFields$suffix$(unknownFields);\n"
"}\n"
"\n"
- "@java.lang.Override\n"
"public final Builder mergeUnknownFields(\n"
" final com.google.protobuf.UnknownFieldSet unknownFields) {\n"
" return super.mergeUnknownFields(unknownFields);\n"
@@ -276,7 +277,6 @@ GenerateDescriptorMethods(io::Printer* printer) {
"}\n");
}
printer->Print(
- "@java.lang.Override\n"
"protected com.google.protobuf.GeneratedMessage$ver$.FieldAccessorTable\n"
" internalGetFieldAccessorTable() {\n"
" return $fileclass$.internal_$identifier$_fieldAccessorTable\n"
@@ -333,7 +333,6 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
"}\n");
printer->Print(
- "@java.lang.Override\n"
"public Builder clear() {\n"
" super.clear();\n");
@@ -362,7 +361,6 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
"\n");
printer->Print(
- "@java.lang.Override\n"
"public com.google.protobuf.Descriptors.Descriptor\n"
" getDescriptorForType() {\n"
" return $fileclass$.internal_$identifier$_descriptor;\n"
@@ -373,7 +371,6 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
// LITE runtime implements this in GeneratedMessageLite.
printer->Print(
- "@java.lang.Override\n"
"public $classname$ getDefaultInstanceForType() {\n"
" return $classname$.getDefaultInstance();\n"
"}\n"
@@ -381,7 +378,6 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
"classname", name_resolver_->GetImmutableClassName(descriptor_));
printer->Print(
- "@java.lang.Override\n"
"public $classname$ build() {\n"
" $classname$ result = buildPartial();\n"
" if (!result.isInitialized()) {\n"
@@ -393,7 +389,6 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
"classname", name_resolver_->GetImmutableClassName(descriptor_));
printer->Print(
- "@java.lang.Override\n"
"public $classname$ buildPartial() {\n"
" $classname$ result = new $classname$(this);\n",
"classname", name_resolver_->GetImmutableClassName(descriptor_));
@@ -462,33 +457,27 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
// to subclass a different GeneratedMessage class (e.g., in v3.0.0 release
// we changed all generated code to subclass GeneratedMessageV3).
printer->Print(
- "@java.lang.Override\n"
"public Builder clone() {\n"
" return (Builder) super.clone();\n"
"}\n"
- "@java.lang.Override\n"
"public Builder setField(\n"
" com.google.protobuf.Descriptors.FieldDescriptor field,\n"
" java.lang.Object value) {\n"
" return (Builder) super.setField(field, value);\n"
"}\n"
- "@java.lang.Override\n"
"public Builder clearField(\n"
" com.google.protobuf.Descriptors.FieldDescriptor field) {\n"
" return (Builder) super.clearField(field);\n"
"}\n"
- "@java.lang.Override\n"
"public Builder clearOneof(\n"
" com.google.protobuf.Descriptors.OneofDescriptor oneof) {\n"
" return (Builder) super.clearOneof(oneof);\n"
"}\n"
- "@java.lang.Override\n"
"public Builder setRepeatedField(\n"
" com.google.protobuf.Descriptors.FieldDescriptor field,\n"
" int index, java.lang.Object value) {\n"
" return (Builder) super.setRepeatedField(field, index, value);\n"
"}\n"
- "@java.lang.Override\n"
"public Builder addRepeatedField(\n"
" com.google.protobuf.Descriptors.FieldDescriptor field,\n"
" java.lang.Object value) {\n"
@@ -497,28 +486,24 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
if (descriptor_->extension_range_count() > 0) {
printer->Print(
- "@java.lang.Override\n"
"public <Type> Builder setExtension(\n"
" com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
" $classname$, Type> extension,\n"
" Type value) {\n"
" return (Builder) super.setExtension(extension, value);\n"
"}\n"
- "@java.lang.Override\n"
"public <Type> Builder setExtension(\n"
" com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
" $classname$, java.util.List<Type>> extension,\n"
" int index, Type value) {\n"
" return (Builder) super.setExtension(extension, index, value);\n"
"}\n"
- "@java.lang.Override\n"
"public <Type> Builder addExtension(\n"
" com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
" $classname$, java.util.List<Type>> extension,\n"
" Type value) {\n"
" return (Builder) super.addExtension(extension, value);\n"
"}\n"
- "@java.lang.Override\n"
"public <Type> Builder clearExtension(\n"
" com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
" $classname$, ?> extension) {\n"
@@ -531,7 +516,6 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
if (context_->HasGeneratedMethods(descriptor_)) {
printer->Print(
- "@java.lang.Override\n"
"public Builder mergeFrom(com.google.protobuf.Message other) {\n"
" if (other instanceof $classname$) {\n"
" return mergeFrom(($classname$)other);\n"
@@ -618,7 +602,6 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
void MessageBuilderGenerator::
GenerateBuilderParsingMethods(io::Printer* printer) {
printer->Print(
- "@java.lang.Override\n"
"public Builder mergeFrom(\n"
" com.google.protobuf.CodedInputStream input,\n"
" com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n"
@@ -644,7 +627,6 @@ GenerateBuilderParsingMethods(io::Printer* printer) {
void MessageBuilderGenerator::GenerateIsInitialized(
io::Printer* printer) {
printer->Print(
- "@java.lang.Override\n"
"public final boolean isInitialized() {\n");
printer->Indent();
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder.h
index 015ea06206..015ea06206 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder_lite.cc
index f04d394e7b..1ad58c09ce 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder_lite.cc
@@ -38,6 +38,9 @@
#include <google/protobuf/stubs/hash.h>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/compiler/java/java_context.h>
@@ -47,12 +50,12 @@
#include <google/protobuf/compiler/java/java_generator_factory.h>
#include <google/protobuf/compiler/java/java_helpers.h>
#include <google/protobuf/compiler/java/java_name_resolver.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/wire_format.h>
-#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/stubs/substitute.h>
namespace google {
namespace protobuf {
@@ -106,7 +109,6 @@ Generate(io::Printer* printer) {
// oneofCase() and clearOneof()
printer->Print(vars,
- "@java.lang.Override\n"
"public $oneof_capitalized_name$Case\n"
" get$oneof_capitalized_name$Case() {\n"
" return instance.get$oneof_capitalized_name$Case();\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder_lite.h
index 8597b2e66f..8597b2e66f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_builder_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_builder_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field.cc
index baa7f87275..baa7f87275 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field.h
index 7ee0edb269..7ee0edb269 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field_lite.cc
index 9cf6f36364..df3e80d4e0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field_lite.cc
@@ -147,14 +147,12 @@ GenerateMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $get_has_field_bit_message$;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n"
"}\n");
@@ -162,14 +160,12 @@ GenerateMembers(io::Printer* printer) const {
} else {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $name$_ != null;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n"
"}\n");
@@ -199,11 +195,7 @@ GenerateMembers(io::Printer* printer) const {
// Field.Builder mergeField(Field value)
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.SuppressWarnings({\"ReferenceEquality\"})\n"
"private void merge$capitalized_name$($type$ value) {\n"
- " if (value == null) {\n"
- " throw new NullPointerException();\n"
- " }\n"
" if ($name$_ != null &&\n"
" $name$_ != $type$.getDefaultInstance()) {\n"
" $name$_ =\n"
@@ -231,7 +223,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
// boolean hasField()
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return instance.has$capitalized_name$();\n"
"}\n");
@@ -240,7 +231,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
// Field getField()
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return instance.get$capitalized_name$();\n"
"}\n");
@@ -406,14 +396,12 @@ GenerateMembers(io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $has_oneof_case_message$;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" if ($has_oneof_case_message$) {\n"
" return ($type$) $oneof_name$_;\n"
@@ -446,9 +434,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"private void merge$capitalized_name$($type$ value) {\n"
- " if (value == null) {\n"
- " throw new NullPointerException();\n"
- " }\n"
" if ($has_oneof_case_message$ &&\n"
" $oneof_name$_ != $type$.getDefaultInstance()) {\n"
" $oneof_name$_ = $type$.newBuilder(($type$) $oneof_name$_)\n"
@@ -479,7 +464,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
// boolean hasField()
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return instance.has$capitalized_name$();\n"
"}\n");
@@ -488,7 +472,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
// Field getField()
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return instance.get$capitalized_name$();\n"
"}\n");
@@ -641,7 +624,6 @@ GenerateMembers(io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<$type$> "
"${$get$capitalized_name$List$}$() {\n"
" return $name$_;\n" // note: unmodifiable list
@@ -656,14 +638,12 @@ GenerateMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
" return $name$_.size();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n"
" return $name$_.get(index);\n"
"}\n");
@@ -781,7 +761,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
// List<Field> getRepeatedFieldList()
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<$type$> "
"${$get$capitalized_name$List$}$() {\n"
" return java.util.Collections.unmodifiableList(\n"
@@ -792,7 +771,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
// int getRepeatedFieldCount()
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
" return instance.get$capitalized_name$Count();\n"
"}");
@@ -801,7 +779,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
// Field getRepeatedField(int index)
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n"
" return instance.get$capitalized_name$(index);\n"
"}\n");
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field_lite.h
index 7c814c6d7e..7c814c6d7e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_field_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_field_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_lite.cc
index 3a512e8dda..26f16439a4 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -38,6 +38,9 @@
#include <google/protobuf/stubs/hash.h>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/compiler/java/java_context.h>
@@ -49,9 +52,9 @@
#include <google/protobuf/compiler/java/java_message_builder.h>
#include <google/protobuf/compiler/java/java_message_builder_lite.h>
#include <google/protobuf/compiler/java/java_name_resolver.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/stubs/strutil.h>
@@ -66,14 +69,6 @@ using internal::WireFormat;
using internal::WireFormatLite;
namespace {
-bool EnableExperimentalRuntimeForLite() {
-#ifdef PROTOBUF_EXPERIMENT
- return PROTOBUF_EXPERIMENT;
-#else // PROTOBUF_EXPERIMENT
- return false;
-#endif // !PROTOBUF_EXPERIMENT
-}
-
bool GenerateHasBits(const Descriptor* descriptor) {
return SupportFieldPresence(descriptor->file()) ||
HasRepeatedFields(descriptor);
@@ -307,7 +302,6 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) {
" default: return null;\n"
" }\n"
"}\n"
- "@java.lang.Override\n"
"public int getNumber() {\n"
" return this.value;\n"
"}\n",
@@ -316,7 +310,6 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) {
printer->Print("};\n\n");
// oneofCase()
printer->Print(vars,
- "@java.lang.Override\n"
"public $oneof_capitalized_name$Case\n"
"get$oneof_capitalized_name$Case() {\n"
" return $oneof_capitalized_name$Case.forNumber(\n"
@@ -339,23 +332,20 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) {
printer->Print("\n");
}
- if (!EnableExperimentalRuntime(context_)) {
- GenerateMessageSerializationMethods(printer);
- }
+ GenerateMessageSerializationMethods(printer);
GenerateParseFromMethods(printer);
GenerateBuilder(printer);
if (HasRequiredFields(descriptor_)) {
// Memoizes whether the protocol buffer is fully initialized (has all
- // required fields). 0 means false, 1 means true, and all other values
- // mean not yet computed.
+ // required fields). -1 means not yet computed. 0 means false and 1 means
+ // true.
printer->Print(
- "private byte memoizedIsInitialized = 2;\n");
+ "private byte memoizedIsInitialized = -1;\n");
}
printer->Print(
- "@java.lang.Override\n"
"@java.lang.SuppressWarnings({\"unchecked\", \"fallthrough\"})\n"
"protected final java.lang.Object dynamicMethod(\n"
" com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,\n"
@@ -370,46 +360,42 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) {
printer->Indent();
printer->Print(
- "case NEW_BUILDER: {\n");
-
+ "case IS_INITIALIZED: {\n");
printer->Indent();
- GenerateDynamicMethodNewBuilder(printer);
+ GenerateDynamicMethodIsInitialized(printer);
printer->Outdent();
- if (!EnableExperimentalRuntimeForLite()) {
- printer->Print(
- "}\n"
- "case IS_INITIALIZED: {\n");
- printer->Indent();
- GenerateDynamicMethodIsInitialized(printer);
- printer->Outdent();
-
- printer->Print("}\n");
+ printer->Print(
+ "}\n"
+ "case MAKE_IMMUTABLE: {\n");
- printer->Print(
- "case MAKE_IMMUTABLE: {\n");
+ printer->Indent();
+ GenerateDynamicMethodMakeImmutable(printer);
+ printer->Outdent();
- printer->Indent();
- GenerateDynamicMethodMakeImmutable(printer);
- printer->Outdent();
+ printer->Print(
+ "}\n"
+ "case NEW_BUILDER: {\n");
- printer->Print(
- "}\n"
- "case VISIT: {\n");
+ printer->Indent();
+ GenerateDynamicMethodNewBuilder(printer);
+ printer->Outdent();
- printer->Indent();
- GenerateDynamicMethodVisit(printer);
- printer->Outdent();
+ printer->Print(
+ "}\n"
+ "case VISIT: {\n");
- printer->Print(
- "}\n"
- "case MERGE_FROM_STREAM: {\n");
+ printer->Indent();
+ GenerateDynamicMethodVisit(printer);
+ printer->Outdent();
- printer->Indent();
- GenerateDynamicMethodMergeFromStream(printer);
- printer->Outdent();
- }
+ printer->Print(
+ "}\n"
+ "case MERGE_FROM_STREAM: {\n");
+ printer->Indent();
+ GenerateDynamicMethodMergeFromStream(printer);
+ printer->Outdent();
printer->Print(
"}\n"
@@ -422,46 +408,20 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) {
// manipulating static fields but that has exceptional cost on Android as
// it will generate an extra class for every message. Instead, use the
// double-check locking pattern which works just as well.
- //
- // The "parser" temporary mirrors the "PARSER" field to eliminate a read
- // at the final return statement.
- " com.google.protobuf.Parser<$classname$> parser = PARSER;\n"
- " if (parser == null) {\n"
+ " if (PARSER == null) {"
" synchronized ($classname$.class) {\n"
- " parser = PARSER;\n"
- " if (parser == null) {\n"
- " parser = new DefaultInstanceBasedParser(DEFAULT_INSTANCE);\n"
- " PARSER = parser;\n"
+ " if (PARSER == null) {\n"
+ " PARSER = new DefaultInstanceBasedParser(DEFAULT_INSTANCE);\n"
" }\n"
" }\n"
" }\n"
- " return parser;\n",
+ " return PARSER;\n"
+ "}\n",
"classname", name_resolver_->GetImmutableClassName(descriptor_));
printer->Outdent();
-
- if (HasRequiredFields(descriptor_)) {
- printer->Print(
- "}\n"
- "case GET_MEMOIZED_IS_INITIALIZED: {\n"
- " return memoizedIsInitialized;\n"
- "}\n"
- "case SET_MEMOIZED_IS_INITIALIZED: {\n"
- " memoizedIsInitialized = (byte) (arg0 == null ? 0 : 1);\n"
- " return null;\n"
- "}\n");
- } else {
- printer->Print(
- "}\n"
- "case GET_MEMOIZED_IS_INITIALIZED: {\n"
- " return (byte) 1;\n"
- "}\n"
- "case SET_MEMOIZED_IS_INITIALIZED: {\n"
- " return null;\n"
- "}\n");
- }
-
printer->Outdent();
+
printer->Print(
" }\n"
" throw new UnsupportedOperationException();\n"
@@ -483,24 +443,11 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) {
printer->Print(
"static {\n"
- " // New instances are implicitly immutable so no need to make\n"
- " // immutable.\n"
" DEFAULT_INSTANCE = new $classname$();\n"
+ " DEFAULT_INSTANCE.makeImmutable();\n"
"}\n"
"\n",
"classname", descriptor_->name());
- if (EnableExperimentalRuntimeForLite()) {
- // Register the default instance in a map. This map will be used by
- // experimental runtime to lookup default instance given a class instance
- // without using Java reflection.
- printer->Print(
- "static {\n"
- " com.google.protobuf.GeneratedMessageLite.registerDefaultInstance(\n"
- " $classname$.class, DEFAULT_INSTANCE);\n"
- "}\n",
- "classname", descriptor_->name());
- }
-
printer->Print(
"public static $classname$ getDefaultInstance() {\n"
" return DEFAULT_INSTANCE;\n"
@@ -508,17 +455,6 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) {
"\n",
"classname", name_resolver_->GetImmutableClassName(descriptor_));
- // 'of' method for Wrappers
- if (IsWrappersProtoFile(descriptor_->file())) {
- printer->Print(
- "public static $classname$ of($field_type$ value) {\n"
- " return newBuilder().setValue(value).build();\n"
- "}\n"
- "\n",
- "classname", name_resolver_->GetImmutableClassName(descriptor_),
- "field_type", PrimitiveTypeName(GetJavaType(descriptor_->field(0))));
- }
-
GenerateParser(printer);
// Extensions must be declared after the DEFAULT_INSTANCE is initialized
@@ -529,21 +465,15 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) {
.Generate(printer);
}
-
printer->Outdent();
printer->Print("}\n\n");
}
-
// ===================================================================
void ImmutableMessageLiteGenerator::
GenerateMessageSerializationMethods(io::Printer* printer) {
- if (EnableExperimentalRuntimeForLite()) {
- return;
- }
-
- std::unique_ptr<const FieldDescriptor * []> sorted_fields(
+ google::protobuf::scoped_array<const FieldDescriptor * > sorted_fields(
SortFieldsByNumber(descriptor_));
std::vector<const Descriptor::ExtensionRange*> sorted_extensions;
@@ -554,41 +484,42 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
ExtensionRangeOrdering());
printer->Print(
- "@java.lang.Override\n"
"public void writeTo(com.google.protobuf.CodedOutputStream output)\n"
" throws java.io.IOException {\n");
printer->Indent();
if (HasPackedFields(descriptor_)) {
// writeTo(CodedOutputStream output) might be invoked without
// getSerializedSize() ever being called, but we need the memoized
- // sizes in case this message has packed fields. Rather than emit checks
- // for each packed field, just call getSerializedSize() up front. In most
- // cases, getSerializedSize() will have already been called anyway by one
- // of the wrapper writeTo() methods, making this call cheap.
- printer->Print("getSerializedSize();\n");
+ // sizes in case this message has packed fields. Rather than emit checks for
+ // each packed field, just call getSerializedSize() up front.
+ // In most cases, getSerializedSize() will have already been called anyway
+ // by one of the wrapper writeTo() methods, making this call cheap.
+ printer->Print(
+ "getSerializedSize();\n");
}
if (descriptor_->extension_range_count() > 0) {
if (descriptor_->options().message_set_wire_format()) {
printer->Print(
- "com.google.protobuf.GeneratedMessageLite\n"
- " .ExtendableMessage<$classname$, $classname$.Builder>\n"
- " .ExtensionWriter extensionWriter =\n"
- " newMessageSetExtensionWriter();\n",
- "classname", name_resolver_->GetImmutableClassName(descriptor_));
+ "com.google.protobuf.GeneratedMessageLite\n"
+ " .ExtendableMessage<$classname$, $classname$.Builder>\n"
+ " .ExtensionWriter extensionWriter =\n"
+ " newMessageSetExtensionWriter();\n",
+ "classname", name_resolver_->GetImmutableClassName(descriptor_));
} else {
printer->Print(
- "com.google.protobuf.GeneratedMessageLite\n"
- " .ExtendableMessage<$classname$, $classname$.Builder>\n"
- " .ExtensionWriter extensionWriter =\n"
- " newExtensionWriter();\n",
- "classname", name_resolver_->GetImmutableClassName(descriptor_));
+ "com.google.protobuf.GeneratedMessageLite\n"
+ " .ExtendableMessage<$classname$, $classname$.Builder>\n"
+ " .ExtensionWriter extensionWriter =\n"
+ " newExtensionWriter();\n",
+ "classname", name_resolver_->GetImmutableClassName(descriptor_));
}
}
// Merge the fields and the extension ranges, both sorted by field number.
for (int i = 0, j = 0;
- i < descriptor_->field_count() || j < sorted_extensions.size();) {
+ i < descriptor_->field_count() || j < sorted_extensions.size();
+ ) {
if (i == descriptor_->field_count()) {
GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]);
} else if (j == sorted_extensions.size()) {
@@ -601,23 +532,23 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
}
if (descriptor_->options().message_set_wire_format()) {
- printer->Print("unknownFields.writeAsMessageSetTo(output);\n");
+ printer->Print(
+ "unknownFields.writeAsMessageSetTo(output);\n");
} else {
- printer->Print("unknownFields.writeTo(output);\n");
+ printer->Print(
+ "unknownFields.writeTo(output);\n");
}
printer->Outdent();
printer->Print(
- "}\n"
- "\n"
- "@java.lang.Override\n"
- "public int getSerializedSize() {\n"
- " int size = memoizedSerializedSize;\n"
- " if (size != -1) return size;\n"
- "\n");
+ "}\n"
+ "\n"
+ "public int getSerializedSize() {\n"
+ " int size = memoizedSerializedSize;\n"
+ " if (size != -1) return size;\n"
+ "\n"
+ " size = 0;\n");
printer->Indent();
- printer->Print(
- "size = 0;\n");
for (int i = 0; i < descriptor_->field_count(); i++) {
field_generators_.get(sorted_fields[i]).GenerateSerializedSizeCode(printer);
@@ -625,24 +556,26 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
if (descriptor_->extension_range_count() > 0) {
if (descriptor_->options().message_set_wire_format()) {
- printer->Print("size += extensionsSerializedSizeAsMessageSet();\n");
+ printer->Print(
+ "size += extensionsSerializedSizeAsMessageSet();\n");
} else {
- printer->Print("size += extensionsSerializedSize();\n");
+ printer->Print(
+ "size += extensionsSerializedSize();\n");
}
}
if (descriptor_->options().message_set_wire_format()) {
- printer->Print("size += unknownFields.getSerializedSizeAsMessageSet();\n");
+ printer->Print(
+ "size += unknownFields.getSerializedSizeAsMessageSet();\n");
} else {
- printer->Print("size += unknownFields.getSerializedSize();\n");
+ printer->Print(
+ "size += unknownFields.getSerializedSize();\n");
}
- printer->Print(
- "memoizedSerializedSize = size;\n"
- "return size;\n");
-
printer->Outdent();
printer->Print(
+ " memoizedSerializedSize = size;\n"
+ " return size;\n"
"}\n"
"\n");
}
@@ -747,10 +680,10 @@ void ImmutableMessageLiteGenerator::GenerateSerializeOneExtensionRange(
void ImmutableMessageLiteGenerator::GenerateBuilder(io::Printer* printer) {
printer->Print(
"public static Builder newBuilder() {\n"
- " return (Builder) DEFAULT_INSTANCE.createBuilder();\n"
+ " return DEFAULT_INSTANCE.toBuilder();\n"
"}\n"
"public static Builder newBuilder($classname$ prototype) {\n"
- " return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);\n"
+ " return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);\n"
"}\n"
"\n",
"classname", name_resolver_->GetImmutableClassName(descriptor_));
@@ -769,10 +702,7 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized(
return;
}
- // TODO(xiaofeng): Remove this when b/64445758 is fixed. We don't need to
- // check memoizedIsInitialized here because the caller does that already,
- // but right now proguard proto shrinker asserts on the bytecode layout of
- // this code so it can't be removed until proguard is updated.
+ // Don't directly compare to -1 to avoid an Android x86 JIT bug.
printer->Print(
"byte isInitialized = memoizedIsInitialized;\n"
"if (isInitialized == 1) return DEFAULT_INSTANCE;\n"
@@ -790,6 +720,9 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized(
if (field->is_required()) {
printer->Print(
"if (!has$name$()) {\n"
+ " if (shouldMemoize) {\n"
+ " memoizedIsInitialized = 0;\n"
+ " }\n"
" return null;\n"
"}\n",
"name", info->capitalized_name);
@@ -806,6 +739,9 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized(
case FieldDescriptor::LABEL_REQUIRED:
printer->Print(
"if (!get$name$().isInitialized()) {\n"
+ " if (shouldMemoize) {\n"
+ " memoizedIsInitialized = 0;\n"
+ " }\n"
" return null;\n"
"}\n",
"type", name_resolver_->GetImmutableClassName(
@@ -829,6 +765,9 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized(
}
printer->Print(
" if (!get$name$().isInitialized()) {\n"
+ " if (shouldMemoize) {\n"
+ " memoizedIsInitialized = 0;\n"
+ " }\n"
" return null;\n"
" }\n"
"}\n",
@@ -839,6 +778,9 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized(
printer->Print(
"for ($type$ item : get$name$Map().values()) {\n"
" if (!item.isInitialized()) {\n"
+ " if (shouldMemoize) {\n"
+ " memoizedIsInitialized = 0;\n"
+ " }\n"
" return null;\n"
" }\n"
"}\n",
@@ -849,6 +791,9 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized(
printer->Print(
"for (int i = 0; i < get$name$Count(); i++) {\n"
" if (!get$name$(i).isInitialized()) {\n"
+ " if (shouldMemoize) {\n"
+ " memoizedIsInitialized = 0;\n"
+ " }\n"
" return null;\n"
" }\n"
"}\n",
@@ -864,11 +809,17 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized(
if (descriptor_->extension_range_count() > 0) {
printer->Print(
"if (!extensionsAreInitialized()) {\n"
+ " if (shouldMemoize) {\n"
+ " memoizedIsInitialized = 0;\n"
+ " }\n"
" return null;\n"
"}\n");
}
printer->Print(
+ "if (shouldMemoize) memoizedIsInitialized = 1;\n");
+
+ printer->Print(
"return DEFAULT_INSTANCE;\n"
"\n");
}
@@ -995,109 +946,101 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodMergeFromStream(
"com.google.protobuf.CodedInputStream input =\n"
" (com.google.protobuf.CodedInputStream) arg0;\n"
"com.google.protobuf.ExtensionRegistryLite extensionRegistry =\n"
- " (com.google.protobuf.ExtensionRegistryLite) arg1;\n"
- "if (extensionRegistry == null) {\n"
- " throw new java.lang.NullPointerException();\n"
- "}\n");
+ " (com.google.protobuf.ExtensionRegistryLite) arg1;\n");
printer->Print(
"try {\n");
printer->Indent();
- if (EnableExperimentalRuntime(context_)) {
- printer->Print(
- "mergeFromInternal(input, extensionRegistry);\n"
- "return DEFAULT_INSTANCE;\n");
+ printer->Print(
+ "boolean done = false;\n"
+ "while (!done) {\n");
+ printer->Indent();
+
+ printer->Print(
+ "int tag = input.readTag();\n"
+ "switch (tag) {\n");
+ printer->Indent();
+
+ printer->Print(
+ "case 0:\n" // zero signals EOF / limit reached
+ " 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(
- "boolean done = false;\n"
- "while (!done) {\n");
- printer->Indent();
+ "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++) {
+ const FieldDescriptor* field = sorted_fields[i];
+ uint32 tag = WireFormatLite::MakeTag(field->number(),
+ WireFormat::WireTypeForFieldType(field->type()));
printer->Print(
- "int tag = input.readTag();\n"
- "switch (tag) {\n");
+ "case $tag$: {\n",
+ "tag", SimpleItoa(static_cast<int32>(tag)));
printer->Indent();
- printer->Print(
- "case 0:\n" // zero signals EOF / limit reached
- " done = true;\n"
- " break;\n");
+ field_generators_.get(field).GenerateParsingCode(printer);
- std::unique_ptr<const FieldDescriptor* []> sorted_fields(
- SortFieldsByNumber(descriptor_));
- for (int i = 0; i < descriptor_->field_count(); i++) {
- const FieldDescriptor* field = sorted_fields[i];
- uint32 tag = WireFormatLite::MakeTag(
- field->number(), WireFormat::WireTypeForFieldType(field->type()));
+ printer->Outdent();
+ printer->Print(
+ " break;\n"
+ "}\n");
- printer->Print("case $tag$: {\n", "tag",
- SimpleItoa(static_cast<int32>(tag)));
+ if (field->is_packable()) {
+ // To make packed = true wire compatible, we generate parsing code from a
+ // packed version of this field regardless of field->options().packed().
+ uint32 packed_tag = WireFormatLite::MakeTag(field->number(),
+ WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
+ printer->Print(
+ "case $tag$: {\n",
+ "tag", SimpleItoa(static_cast<int32>(packed_tag)));
printer->Indent();
- field_generators_.get(field).GenerateParsingCode(printer);
+ field_generators_.get(field).GenerateParsingCodeFromPacked(printer);
printer->Outdent();
printer->Print(
" break;\n"
"}\n");
-
- if (field->is_packable()) {
- // To make packed = true wire compatible, we generate parsing code from
- // a packed version of this field regardless of
- // field->options().packed().
- uint32 packed_tag = WireFormatLite::MakeTag(
- field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
- printer->Print("case $tag$: {\n", "tag",
- SimpleItoa(static_cast<int32>(packed_tag)));
- printer->Indent();
-
- field_generators_.get(field).GenerateParsingCodeFromPacked(printer);
-
- printer->Outdent();
- printer->Print(
- " break;\n"
- "}\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");
- }
-
- printer->Outdent();
- printer->Outdent();
- printer->Print(
- " }\n" // switch (tag)
- "}\n"); // while (!done)
}
printer->Outdent();
+ printer->Outdent();
+ printer->Print(
+ " }\n" // switch (tag)
+ "}\n"); // while (!done)
+
+ printer->Outdent();
printer->Print(
"} catch (com.google.protobuf.InvalidProtocolBufferException e) {\n"
" throw new RuntimeException(e.setUnfinishedMessage(this));\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_lite.h
index 1e319c6d6e..1e319c6d6e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_message_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_message_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_name_resolver.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_name_resolver.cc
index 1673b4ee76..1673b4ee76 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_name_resolver.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_name_resolver.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_name_resolver.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_name_resolver.h
index 28b049d1e5..28b049d1e5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_name_resolver.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_name_resolver.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_names.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_names.h
index 0d6143353a..0d6143353a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_names.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_names.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_options.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_options.h
index e4e7d5e266..e4e7d5e266 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_options.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_options.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_plugin_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_plugin_unittest.cc
index 87f687da18..3e4910c88a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_plugin_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_plugin_unittest.cc
@@ -35,6 +35,9 @@
// worth.
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/compiler/java/java_generator.h>
#include <google/protobuf/compiler/command_line_interface.h>
@@ -73,7 +76,7 @@ class TestGenerator : public CodeGenerator {
void TryInsert(const string& filename, const string& insertion_point,
GeneratorContext* context) const {
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->OpenForInsert(filename, insertion_point));
io::Printer printer(output.get(), '$');
printer.Print("// inserted $name$\n", "name", insertion_point);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field.cc
index 71ee0992b1..074a6be867 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field.cc
@@ -633,7 +633,8 @@ GenerateMembers(io::Printer* printer) const {
"}\n");
printer->Annotate("{", "}", descriptor_);
- if (descriptor_->is_packed()) {
+ if (descriptor_->is_packed() &&
+ context_->HasGeneratedMethods(descriptor_->containing_type())) {
printer->Print(variables_,
"private int $name$MemoizedSerializedSize = -1;\n");
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field.h
index 7ac9bbfb74..7ac9bbfb74 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
index d2ebc56741..f92931711f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
@@ -222,7 +222,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $get_has_field_bit_message$;\n"
"}\n");
@@ -231,7 +230,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return $name$_;\n"
"}\n");
@@ -268,7 +266,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return instance.has$capitalized_name$();\n"
"}\n");
@@ -277,7 +274,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return instance.get$capitalized_name$();\n"
"}\n");
@@ -492,7 +488,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $has_oneof_case_message$;\n"
"}\n");
@@ -501,7 +496,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" if ($has_oneof_case_message$) {\n"
" return ($boxed_type$) $oneof_name$_;\n"
@@ -534,7 +528,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return instance.has$capitalized_name$();\n"
"}\n");
@@ -543,7 +536,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" return instance.get$capitalized_name$();\n"
"}\n");
@@ -653,7 +645,6 @@ GenerateMembers(io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<$boxed_type$>\n"
" ${$get$capitalized_name$List$}$() {\n"
" return $name$_;\n" // note: unmodifiable list
@@ -661,14 +652,12 @@ GenerateMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
" return $name$_.size();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n"
" return $repeated_get$(index);\n"
"}\n");
@@ -722,7 +711,6 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::
GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<$boxed_type$>\n"
" ${$get$capitalized_name$List$}$() {\n"
" return java.util.Collections.unmodifiableList(\n"
@@ -731,14 +719,12 @@ GenerateBuilderMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
" return instance.get$capitalized_name$Count();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n"
" return instance.get$capitalized_name$(index);\n"
"}\n");
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field_lite.h
index 93416f0b68..93416f0b68 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_primitive_field_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_primitive_field_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_service.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_service.cc
index 988e1942b7..988e1942b7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_service.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_service.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_service.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_service.h
index 12b3f94266..12b3f94266 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_service.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_service.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_shared_code_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_shared_code_generator.cc
index 0cec20b97b..f73bfb0461 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_shared_code_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_shared_code_generator.cc
@@ -33,13 +33,16 @@
#include <google/protobuf/compiler/java/java_shared_code_generator.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/compiler/java/java_helpers.h>
#include <google/protobuf/compiler/java/java_name_resolver.h>
#include <google/protobuf/compiler/code_generator.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/stubs/strutil.h>
@@ -66,11 +69,11 @@ void SharedCodeGenerator::Generate(GeneratorContext* context,
string classname = name_resolver_->GetDescriptorClassName(file_);
string filename = package_dir + classname + ".java";
file_list->push_back(filename);
- std::unique_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
GeneratedCodeInfo annotations;
io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
&annotations);
- std::unique_ptr<io::Printer> printer(
+ google::protobuf::scoped_ptr<io::Printer> printer(
new io::Printer(output.get(), '$',
options_.annotate_code ? &annotation_collector : NULL));
string info_relative_path = classname + ".java.pb.meta";
@@ -105,7 +108,7 @@ void SharedCodeGenerator::Generate(GeneratorContext* context,
"}\n");
if (options_.annotate_code) {
- std::unique_ptr<io::ZeroCopyOutputStream> info_output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> info_output(
context->Open(info_full_path));
annotations.SerializeToZeroCopyStream(info_output.get());
annotation_file_list->push_back(info_full_path);
@@ -137,16 +140,13 @@ void SharedCodeGenerator::GenerateDescriptors(io::Printer* printer) {
"java.lang.String[] descriptorData = {\n");
printer->Indent();
- // Limit the number of bytes per line.
+ // Only write 40 bytes per line.
static const int kBytesPerLine = 40;
- // Limit the number of lines per string part.
- static const int kLinesPerPart = 400;
- // Every block of bytes, start a new string literal, in order to avoid the
- // 64k length limit. Note that this value needs to be <64k.
- static const int kBytesPerPart = kBytesPerLine * kLinesPerPart;
for (int i = 0; i < file_data.size(); i += kBytesPerLine) {
if (i > 0) {
- if (i % kBytesPerPart == 0) {
+ // Every 400 lines, start a new string literal, in order to avoid the
+ // 64k length limit.
+ if (i % 400 == 0) {
printer->Print(",\n");
} else {
printer->Print(" +\n");
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_shared_code_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_shared_code_generator.h
index 58a31f5d7c..40502270ac 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_shared_code_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_shared_code_generator.h
@@ -36,6 +36,9 @@
#define GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
@@ -74,7 +77,7 @@ class SharedCodeGenerator {
void GenerateDescriptors(io::Printer* printer);
private:
- std::unique_ptr<ClassNameResolver> name_resolver_;
+ google::protobuf::scoped_ptr<ClassNameResolver> name_resolver_;
const FileDescriptor* file_;
const Options options_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SharedCodeGenerator);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field.cc
index 2b6e938180..2b6e938180 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field.h
index 0f7c705b8f..0f7c705b8f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field_lite.cc
index a238c67d9e..adda307cf9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field_lite.cc
@@ -192,7 +192,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $get_has_field_bit_message$;\n"
"}\n");
@@ -201,14 +200,12 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n"
" return $name$_;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public com.google.protobuf.ByteString\n"
" ${$get$capitalized_name$Bytes$}$() {\n"
" return com.google.protobuf.ByteString.copyFromUtf8($name$_);\n"
@@ -252,7 +249,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return instance.has$capitalized_name$();\n"
"}\n");
@@ -261,7 +257,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n"
" return instance.get$capitalized_name$();\n"
"}\n");
@@ -269,7 +264,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public com.google.protobuf.ByteString\n"
" ${$get$capitalized_name$Bytes$}$() {\n"
" return instance.get$capitalized_name$Bytes();\n"
@@ -425,7 +419,6 @@ GenerateMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return $has_oneof_case_message$;\n"
"}\n");
@@ -434,7 +427,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n"
" java.lang.String ref $default_init$;\n"
" if ($has_oneof_case_message$) {\n"
@@ -446,7 +438,6 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public com.google.protobuf.ByteString\n"
" ${$get$capitalized_name$Bytes$}$() {\n"
" java.lang.String ref $default_init$;\n"
@@ -498,7 +489,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
if (SupportFieldPresence(descriptor_->file())) {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
" return instance.has$capitalized_name$();\n"
"}\n");
@@ -507,7 +497,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n"
" return instance.get$capitalized_name$();\n"
"}\n");
@@ -515,7 +504,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public com.google.protobuf.ByteString\n"
" ${$get$capitalized_name$Bytes$}$() {\n"
" return instance.get$capitalized_name$Bytes();\n"
@@ -653,7 +641,6 @@ GenerateMembers(io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<java.lang.String> "
"${$get$capitalized_name$List$}$() {\n"
" return $name$_;\n" // note: unmodifiable list
@@ -661,14 +648,12 @@ GenerateMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
" return $name$_.size();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.lang.String "
"${$get$capitalized_name$$}$(int index) {\n"
" return $name$_.get(index);\n"
@@ -676,7 +661,6 @@ GenerateMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public com.google.protobuf.ByteString\n"
" ${$get$capitalized_name$Bytes$}$(int index) {\n"
" return com.google.protobuf.ByteString.copyFromUtf8(\n"
@@ -741,7 +725,6 @@ void RepeatedImmutableStringFieldLiteGenerator::
GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.util.List<java.lang.String>\n"
" ${$get$capitalized_name$List$}$() {\n"
" return java.util.Collections.unmodifiableList(\n"
@@ -750,14 +733,12 @@ GenerateBuilderMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
" return instance.get$capitalized_name$Count();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public java.lang.String "
"${$get$capitalized_name$$}$(int index) {\n"
" return instance.get$capitalized_name$(index);\n"
@@ -765,7 +746,6 @@ GenerateBuilderMembers(io::Printer* printer) const {
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "@java.lang.Override\n"
"$deprecation$public com.google.protobuf.ByteString\n"
" ${$get$capitalized_name$Bytes$}$(int index) {\n"
" return instance.get$capitalized_name$Bytes(index);\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field_lite.h
index b7fb640959..b7fb640959 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/java/java_string_field_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/java/java_string_field_lite.h
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum.cc
new file mode 100644
index 0000000000..c6e8dfe90d
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum.cc
@@ -0,0 +1,143 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <map>
+#include <string>
+
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+#include <google/protobuf/compiler/javanano/javanano_enum.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor, const Params& params)
+ : params_(params), descriptor_(descriptor) {
+ for (int i = 0; i < descriptor_->value_count(); i++) {
+ const EnumValueDescriptor* value = descriptor_->value(i);
+ const EnumValueDescriptor* canonical_value =
+ descriptor_->FindValueByNumber(value->number());
+
+ if (value == canonical_value) {
+ canonical_values_.push_back(value);
+ } else {
+ Alias alias;
+ alias.value = value;
+ alias.canonical_value = canonical_value;
+ aliases_.push_back(alias);
+ }
+ }
+}
+
+EnumGenerator::~EnumGenerator() {}
+
+void EnumGenerator::Generate(io::Printer* printer) {
+ printer->Print(
+ "\n"
+ "// enum $classname$\n",
+ "classname", descriptor_->name());
+
+ const string classname = RenameJavaKeywords(descriptor_->name());
+
+ // Start of container interface
+ // If generating intdefs, we use the container interface as the intdef if
+ // present. Otherwise, we just make an empty @interface parallel to the
+ // constants.
+ bool use_intdef = params_.generate_intdefs();
+ bool use_shell_class = params_.java_enum_style();
+ if (use_intdef) {
+ // @IntDef annotation so tools can enforce correctness
+ // Annotations will be discarded by the compiler
+ printer->Print("@java.lang.annotation.Retention("
+ "java.lang.annotation.RetentionPolicy.SOURCE)\n"
+ "@android.support.annotation.IntDef({\n");
+ printer->Indent();
+ for (int i = 0; i < canonical_values_.size(); i++) {
+ const string constant_name =
+ RenameJavaKeywords(canonical_values_[i]->name());
+ if (use_shell_class) {
+ printer->Print("$classname$.$name$,\n",
+ "classname", classname,
+ "name", constant_name);
+ } else {
+ printer->Print("$name$,\n", "name", constant_name);
+ }
+ }
+ printer->Outdent();
+ printer->Print("})\n");
+ }
+ if (use_shell_class || use_intdef) {
+ printer->Print(
+ "public $at_for_intdef$interface $classname$ {\n",
+ "classname", classname,
+ "at_for_intdef", use_intdef ? "@" : "");
+ if (use_shell_class) {
+ printer->Indent();
+ } else {
+ printer->Print("}\n\n");
+ }
+ }
+
+ // Canonical values
+ for (int i = 0; i < canonical_values_.size(); i++) {
+ printer->Print(
+ "public static final int $name$ = $canonical_value$;\n",
+ "name", RenameJavaKeywords(canonical_values_[i]->name()),
+ "canonical_value", SimpleItoa(canonical_values_[i]->number()));
+ }
+
+ // Aliases
+ for (int i = 0; i < aliases_.size(); i++) {
+ printer->Print(
+ "public static final int $name$ = $canonical_name$;\n",
+ "name", RenameJavaKeywords(aliases_[i].value->name()),
+ "canonical_name", RenameJavaKeywords(aliases_[i].canonical_value->name()));
+ }
+
+ // End of container interface
+ if (use_shell_class) {
+ printer->Outdent();
+ printer->Print("}\n");
+ }
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/message_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum.h
index 45b46bee86..10dd364876 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/message_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum.h
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -32,20 +32,56 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
-#include <google/protobuf/unittest.pb.h>
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_ENUM_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_ENUM_H__
-#define MESSAGE_TEST_NAME MessageTest
-#define MESSAGE_FACTORY_TEST_NAME MessageFactoryTest
-#define UNITTEST_PACKAGE_NAME "protobuf_unittest"
-#define UNITTEST ::protobuf_unittest
-#define UNITTEST_IMPORT ::protobuf_unittest_import
+#include <string>
+#include <vector>
-// Must include after the above macros.
-#include <google/protobuf/test_util.inc>
-#include <google/protobuf/message_unittest.inc>
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+#include <google/protobuf/descriptor.h>
-// Make extract script happy.
namespace google {
namespace protobuf {
+ namespace io {
+ class Printer; // printer.h
+ }
+}
+
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+class EnumGenerator {
+ public:
+ explicit EnumGenerator(const EnumDescriptor* descriptor, const Params& params);
+ ~EnumGenerator();
+
+ void Generate(io::Printer* printer);
+
+ private:
+ const Params& params_;
+ const EnumDescriptor* descriptor_;
+
+ // The proto language allows multiple enum constants to have the same numeric
+ // value. Java, however, does not allow multiple enum constants to be
+ // considered equivalent. We treat the first defined constant for any
+ // given numeric value as "canonical" and the rest as aliases of that
+ // canonical value.
+ vector<const EnumValueDescriptor*> canonical_values_;
+
+ struct Alias {
+ const EnumValueDescriptor* value;
+ const EnumValueDescriptor* canonical_value;
+ };
+ vector<Alias> aliases_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
+};
+
+} // namespace javanano
+} // namespace compiler
} // namespace protobuf
+
} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_ENUM_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
new file mode 100644
index 0000000000..26bc7f85d4
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
@@ -0,0 +1,544 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <map>
+#include <string>
+
+#include <google/protobuf/compiler/javanano/javanano_enum_field.h>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/wire_format.h>
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+namespace {
+
+// TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of
+// repeat code between this and the other field types.
+void SetEnumVariables(const Params& params,
+ const FieldDescriptor* descriptor, std::map<string, string>* variables) {
+ (*variables)["name"] =
+ RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
+ (*variables)["capitalized_name"] =
+ RenameJavaKeywords(UnderscoresToCapitalizedCamelCase(descriptor));
+ (*variables)["number"] = SimpleItoa(descriptor->number());
+ if (params.use_reference_types_for_primitives()
+ && !params.reftypes_primitive_enums()
+ && !descriptor->is_repeated()) {
+ (*variables)["type"] = "java.lang.Integer";
+ (*variables)["default"] = "null";
+ } else {
+ (*variables)["type"] = "int";
+ (*variables)["default"] = DefaultValue(params, descriptor);
+ }
+ (*variables)["repeated_default"] =
+ "com.google.protobuf.nano.WireFormatNano.EMPTY_INT_ARRAY";
+ (*variables)["tag"] = SimpleItoa(internal::WireFormat::MakeTag(descriptor));
+ (*variables)["tag_size"] = SimpleItoa(
+ internal::WireFormat::TagSize(descriptor->number(), descriptor->type()));
+ (*variables)["non_packed_tag"] = SimpleItoa(
+ internal::WireFormatLite::MakeTag(descriptor->number(),
+ internal::WireFormat::WireTypeForFieldType(descriptor->type())));
+ (*variables)["message_name"] = descriptor->containing_type()->name();
+ const EnumDescriptor* enum_type = descriptor->enum_type();
+ (*variables)["message_type_intdef"] = "@"
+ + ToJavaName(params, enum_type->name(), true,
+ enum_type->containing_type(), enum_type->file());
+}
+
+void LoadEnumValues(const Params& params,
+ const EnumDescriptor* enum_descriptor, vector<string>* canonical_values) {
+ string enum_class_name = ClassName(params, enum_descriptor);
+ for (int i = 0; i < enum_descriptor->value_count(); i++) {
+ const EnumValueDescriptor* value = enum_descriptor->value(i);
+ const EnumValueDescriptor* canonical_value =
+ enum_descriptor->FindValueByNumber(value->number());
+ if (value == canonical_value) {
+ canonical_values->push_back(
+ enum_class_name + "." + RenameJavaKeywords(value->name()));
+ }
+ }
+}
+
+void PrintCaseLabels(
+ io::Printer* printer, const vector<string>& canonical_values) {
+ for (int i = 0; i < canonical_values.size(); i++) {
+ printer->Print(
+ " case $value$:\n",
+ "value", canonical_values[i]);
+ }
+}
+
+} // namespace
+
+// ===================================================================
+
+EnumFieldGenerator::
+EnumFieldGenerator(const FieldDescriptor* descriptor, const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetEnumVariables(params, descriptor, &variables_);
+ LoadEnumValues(params, descriptor->enum_type(), &canonical_values_);
+}
+
+EnumFieldGenerator::~EnumFieldGenerator() {}
+
+void EnumFieldGenerator::
+GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
+ if (params_.generate_intdefs()) {
+ printer->Print(variables_, "$message_type_intdef$\n");
+ }
+ printer->Print(variables_, "public $type$ $name$;\n");
+
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "public boolean has$capitalized_name$;\n");
+ }
+}
+
+void EnumFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$ = $default$;\n");
+
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "has$capitalized_name$ = false;\n");
+ }
+}
+
+void EnumFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "int value = input.readInt32();\n"
+ "switch (value) {\n");
+ PrintCaseLabels(printer, canonical_values_);
+ printer->Print(variables_,
+ " this.$name$ = value;\n");
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ " has$capitalized_name$ = true;\n");
+ }
+ printer->Print(
+ " break;\n"
+ "}\n");
+ // No default case: in case of invalid value from the wire, preserve old
+ // field value. Also we are not storing the invalid value into the unknown
+ // fields, because there is no way to get the value out.
+}
+
+void EnumFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ if (descriptor_->is_required() && !params_.generate_has()) {
+ // Always serialize a required field if we don't have the 'has' signal.
+ printer->Print(variables_,
+ "output.writeInt32($number$, this.$name$);\n");
+ } else {
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "if (this.$name$ != $default$ || has$capitalized_name$) {\n");
+ } else {
+ printer->Print(variables_,
+ "if (this.$name$ != $default$) {\n");
+ }
+ printer->Print(variables_,
+ " output.writeInt32($number$, this.$name$);\n"
+ "}\n");
+ }
+}
+
+void EnumFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ if (descriptor_->is_required() && !params_.generate_has()) {
+ printer->Print(variables_,
+ "size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .computeInt32Size($number$, this.$name$);\n");
+ } else {
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "if (this.$name$ != $default$ || has$capitalized_name$) {\n");
+ } else {
+ printer->Print(variables_,
+ "if (this.$name$ != $default$) {\n");
+ }
+ printer->Print(variables_,
+ " size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .computeInt32Size($number$, this.$name$);\n"
+ "}\n");
+ }
+}
+
+void EnumFieldGenerator::GenerateEqualsCode(io::Printer* printer) const {
+ if (params_.use_reference_types_for_primitives()
+ && !params_.reftypes_primitive_enums()) {
+ printer->Print(variables_,
+ "if (this.$name$ == null) {\n"
+ " if (other.$name$ != null) {\n"
+ " return false;\n"
+ " }\n"
+ "} else if (!this.$name$.equals(other.$name$)) {\n"
+ " return false;"
+ "}\n");
+ } else {
+ // We define equality as serialized form equality. If generate_has(),
+ // then if the field value equals the default value in both messages,
+ // but one's 'has' field is set and the other's is not, the serialized
+ // forms are different and we should return false.
+ printer->Print(variables_,
+ "if (this.$name$ != other.$name$");
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "\n"
+ " || (this.$name$ == $default$\n"
+ " && this.has$capitalized_name$ != other.has$capitalized_name$)");
+ }
+ printer->Print(") {\n"
+ " return false;\n"
+ "}\n");
+ }
+}
+
+void EnumFieldGenerator::GenerateHashCodeCode(io::Printer* printer) const {
+ printer->Print(
+ "result = 31 * result + ");
+ if (params_.use_reference_types_for_primitives()
+ && !params_.reftypes_primitive_enums()) {
+ printer->Print(variables_,
+ "(this.$name$ == null ? 0 : this.$name$)");
+ } else {
+ printer->Print(variables_,
+ "this.$name$");
+ }
+ printer->Print(";\n");
+}
+
+// ===================================================================
+
+AccessorEnumFieldGenerator::
+AccessorEnumFieldGenerator(const FieldDescriptor* descriptor,
+ const Params& params, int has_bit_index)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetEnumVariables(params, descriptor, &variables_);
+ LoadEnumValues(params, descriptor->enum_type(), &canonical_values_);
+ SetBitOperationVariables("has", has_bit_index, &variables_);
+}
+
+AccessorEnumFieldGenerator::~AccessorEnumFieldGenerator() {}
+
+void AccessorEnumFieldGenerator::
+GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
+ printer->Print(variables_, "private int $name$_;\n");
+ if (params_.generate_intdefs()) {
+ printer->Print(variables_, "$message_type_intdef$\n");
+ }
+ printer->Print(variables_,
+ "public int get$capitalized_name$() {\n"
+ " return $name$_;\n"
+ "}\n"
+ "public $message_name$ set$capitalized_name$(");
+ if (params_.generate_intdefs()) {
+ printer->Print(variables_,
+ "\n"
+ " $message_type_intdef$ ");
+ }
+ printer->Print(variables_,
+ "int value) {\n"
+ " $name$_ = value;\n"
+ " $set_has$;\n"
+ " return this;\n"
+ "}\n"
+ "public boolean has$capitalized_name$() {\n"
+ " return $get_has$;\n"
+ "}\n"
+ "public $message_name$ clear$capitalized_name$() {\n"
+ " $name$_ = $default$;\n"
+ " $clear_has$;\n"
+ " return this;\n"
+ "}\n");
+}
+
+void AccessorEnumFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$_ = $default$;\n");
+}
+
+void AccessorEnumFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "int value = input.readInt32();\n"
+ "switch (value) {\n");
+ PrintCaseLabels(printer, canonical_values_);
+ printer->Print(variables_,
+ " $name$_ = value;\n"
+ " $set_has$;\n"
+ " break;\n"
+ "}\n");
+ // No default case: in case of invalid value from the wire, preserve old
+ // field value. Also we are not storing the invalid value into the unknown
+ // fields, because there is no way to get the value out.
+}
+
+void AccessorEnumFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($get_has$) {\n"
+ " output.writeInt32($number$, $name$_);\n"
+ "}\n");
+}
+
+void AccessorEnumFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($get_has$) {\n"
+ " size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .computeInt32Size($number$, $name$_);\n"
+ "}\n");
+}
+
+void AccessorEnumFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($different_has$\n"
+ " || $name$_ != other.$name$_) {\n"
+ " return false;\n"
+ "}\n");
+}
+
+void AccessorEnumFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "result = 31 * result + $name$_;\n");
+}
+
+// ===================================================================
+
+RepeatedEnumFieldGenerator::
+RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetEnumVariables(params, descriptor, &variables_);
+ LoadEnumValues(params, descriptor->enum_type(), &canonical_values_);
+}
+
+RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() {}
+
+void RepeatedEnumFieldGenerator::
+GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
+ printer->Print(variables_,
+ "public $type$[] $name$;\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$ = $repeated_default$;\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ // First, figure out the maximum length of the array, then parse,
+ // and finally copy the valid values to the field.
+ printer->Print(variables_,
+ "int length = com.google.protobuf.nano.WireFormatNano\n"
+ " .getRepeatedFieldArrayLength(input, $non_packed_tag$);\n"
+ "int[] validValues = new int[length];\n"
+ "int validCount = 0;\n"
+ "for (int i = 0; i < length; i++) {\n"
+ " if (i != 0) { // tag for first value already consumed.\n"
+ " input.readTag();\n"
+ " }\n"
+ " int value = input.readInt32();\n"
+ " switch (value) {\n");
+ printer->Indent();
+ PrintCaseLabels(printer, canonical_values_);
+ printer->Outdent();
+ printer->Print(variables_,
+ " validValues[validCount++] = value;\n"
+ " break;\n"
+ " }\n"
+ "}\n"
+ "if (validCount != 0) {\n"
+ " int i = this.$name$ == null ? 0 : this.$name$.length;\n"
+ " if (i == 0 && validCount == validValues.length) {\n"
+ " this.$name$ = validValues;\n"
+ " } else {\n"
+ " int[] newArray = new int[i + validCount];\n"
+ " if (i != 0) {\n"
+ " java.lang.System.arraycopy(this.$name$, 0, newArray, 0, i);\n"
+ " }\n"
+ " java.lang.System.arraycopy(validValues, 0, newArray, i, validCount);\n"
+ " this.$name$ = newArray;\n"
+ " }\n"
+ "}\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateMergingCodeFromPacked(io::Printer* printer) const {
+ printer->Print(variables_,
+ "int bytes = input.readRawVarint32();\n"
+ "int limit = input.pushLimit(bytes);\n"
+ "// First pass to compute array length.\n"
+ "int arrayLength = 0;\n"
+ "int startPos = input.getPosition();\n"
+ "while (input.getBytesUntilLimit() > 0) {\n"
+ " switch (input.readInt32()) {\n");
+ printer->Indent();
+ PrintCaseLabels(printer, canonical_values_);
+ printer->Outdent();
+ printer->Print(variables_,
+ " arrayLength++;\n"
+ " break;\n"
+ " }\n"
+ "}\n"
+ "if (arrayLength != 0) {\n"
+ " input.rewindToPosition(startPos);\n"
+ " int i = this.$name$ == null ? 0 : this.$name$.length;\n"
+ " int[] newArray = new int[i + arrayLength];\n"
+ " if (i != 0) {\n"
+ " java.lang.System.arraycopy(this.$name$, 0, newArray, 0, i);\n"
+ " }\n"
+ " while (input.getBytesUntilLimit() > 0) {\n"
+ " int value = input.readInt32();\n"
+ " switch (value) {\n");
+ printer->Indent();
+ printer->Indent();
+ PrintCaseLabels(printer, canonical_values_);
+ printer->Outdent();
+ printer->Outdent();
+ printer->Print(variables_,
+ " newArray[i++] = value;\n"
+ " break;\n"
+ " }\n"
+ " }\n"
+ " this.$name$ = newArray;\n"
+ "}\n"
+ "input.popLimit(limit);\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateRepeatedDataSizeCode(io::Printer* printer) const {
+ // Creates a variable dataSize and puts the serialized size in there.
+ printer->Print(variables_,
+ "int dataSize = 0;\n"
+ "for (int i = 0; i < this.$name$.length; i++) {\n"
+ " int element = this.$name$[i];\n"
+ " dataSize += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .computeInt32SizeNoTag(element);\n"
+ "}\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n");
+ printer->Indent();
+
+ if (descriptor_->options().packed()) {
+ GenerateRepeatedDataSizeCode(printer);
+ printer->Print(variables_,
+ "output.writeRawVarint32($tag$);\n"
+ "output.writeRawVarint32(dataSize);\n"
+ "for (int i = 0; i < this.$name$.length; i++) {\n"
+ " output.writeRawVarint32(this.$name$[i]);\n"
+ "}\n");
+ } else {
+ printer->Print(variables_,
+ "for (int i = 0; i < this.$name$.length; i++) {\n"
+ " output.writeInt32($number$, this.$name$[i]);\n"
+ "}\n");
+ }
+
+ printer->Outdent();
+ printer->Print(variables_,
+ "}\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n");
+ printer->Indent();
+
+ GenerateRepeatedDataSizeCode(printer);
+
+ printer->Print(
+ "size += dataSize;\n");
+ if (descriptor_->options().packed()) {
+ printer->Print(variables_,
+ "size += $tag_size$;\n"
+ "size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .computeRawVarint32Size(dataSize);\n");
+ } else {
+ printer->Print(variables_,
+ "size += $tag_size$ * this.$name$.length;\n");
+ }
+
+ printer->Outdent();
+
+ printer->Print(
+ "}\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateFixClonedCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n"
+ " cloned.$name$ = this.$name$.clone();\n"
+ "}\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (!com.google.protobuf.nano.InternalNano.equals(\n"
+ " this.$name$, other.$name$)) {\n"
+ " return false;\n"
+ "}\n");
+}
+
+void RepeatedEnumFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "result = 31 * result\n"
+ " + com.google.protobuf.nano.InternalNano.hashCode(this.$name$);\n");
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum_field.h
new file mode 100644
index 0000000000..1be25d10ab
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_enum_field.h
@@ -0,0 +1,126 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_ENUM_FIELD_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_ENUM_FIELD_H__
+
+#include <map>
+#include <string>
+#include <vector>
+#include <google/protobuf/compiler/javanano/javanano_field.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+class EnumFieldGenerator : public FieldGenerator {
+ public:
+ explicit EnumFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params);
+ ~EnumFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+
+ private:
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+ vector<string> canonical_values_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
+};
+
+class AccessorEnumFieldGenerator : public FieldGenerator {
+ public:
+ explicit AccessorEnumFieldGenerator(const FieldDescriptor* descriptor,
+ const Params& params, int has_bit_index);
+ ~AccessorEnumFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+
+ private:
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+ vector<string> canonical_values_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorEnumFieldGenerator);
+};
+
+class RepeatedEnumFieldGenerator : public FieldGenerator {
+ public:
+ explicit RepeatedEnumFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params);
+ ~RepeatedEnumFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateMergingCodeFromPacked(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+ void GenerateFixClonedCode(io::Printer* printer) const;
+
+ private:
+ void GenerateRepeatedDataSizeCode(io::Printer* printer) const;
+
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+ vector<string> canonical_values_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);
+};
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+
+} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_ENUM_FIELD_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_extension.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_extension.cc
new file mode 100644
index 0000000000..4c61f915c7
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_extension.cc
@@ -0,0 +1,150 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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: bduff@google.com (Brian Duff)
+
+#include <google/protobuf/compiler/javanano/javanano_extension.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/wire_format.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+using internal::WireFormat;
+using internal::WireFormatLite;
+
+namespace {
+
+const char* GetTypeConstantName(const FieldDescriptor::Type type) {
+ switch (type) {
+ case FieldDescriptor::TYPE_INT32 : return "TYPE_INT32" ;
+ case FieldDescriptor::TYPE_UINT32 : return "TYPE_UINT32" ;
+ case FieldDescriptor::TYPE_SINT32 : return "TYPE_SINT32" ;
+ case FieldDescriptor::TYPE_FIXED32 : return "TYPE_FIXED32" ;
+ case FieldDescriptor::TYPE_SFIXED32: return "TYPE_SFIXED32";
+ case FieldDescriptor::TYPE_INT64 : return "TYPE_INT64" ;
+ case FieldDescriptor::TYPE_UINT64 : return "TYPE_UINT64" ;
+ case FieldDescriptor::TYPE_SINT64 : return "TYPE_SINT64" ;
+ case FieldDescriptor::TYPE_FIXED64 : return "TYPE_FIXED64" ;
+ case FieldDescriptor::TYPE_SFIXED64: return "TYPE_SFIXED64";
+ case FieldDescriptor::TYPE_FLOAT : return "TYPE_FLOAT" ;
+ case FieldDescriptor::TYPE_DOUBLE : return "TYPE_DOUBLE" ;
+ case FieldDescriptor::TYPE_BOOL : return "TYPE_BOOL" ;
+ case FieldDescriptor::TYPE_STRING : return "TYPE_STRING" ;
+ case FieldDescriptor::TYPE_BYTES : return "TYPE_BYTES" ;
+ case FieldDescriptor::TYPE_ENUM : return "TYPE_ENUM" ;
+ case FieldDescriptor::TYPE_GROUP : return "TYPE_GROUP" ;
+ case FieldDescriptor::TYPE_MESSAGE : return "TYPE_MESSAGE" ;
+
+ // No default because we want the compiler to complain if any new
+ // types are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return NULL;
+}
+
+} // namespace
+
+void SetVariables(const FieldDescriptor* descriptor, const Params params,
+ std::map<string, string>* variables) {
+ (*variables)["extends"] = ClassName(params, descriptor->containing_type());
+ (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
+ bool repeated = descriptor->is_repeated();
+ (*variables)["repeated"] = repeated ? "Repeated" : "";
+ (*variables)["type"] = GetTypeConstantName(descriptor->type());
+ JavaType java_type = GetJavaType(descriptor->type());
+ string tag = SimpleItoa(WireFormat::MakeTag(descriptor));
+ if (java_type == JAVATYPE_MESSAGE) {
+ (*variables)["ext_type"] = "MessageTyped";
+ string message_type = ClassName(params, descriptor->message_type());
+ if (repeated) {
+ message_type += "[]";
+ }
+ (*variables)["class"] = message_type;
+ // For message typed extensions, tags_params contains a single tag
+ // for both singular and repeated cases.
+ (*variables)["tag_params"] = tag;
+ } else {
+ (*variables)["ext_type"] = "PrimitiveTyped";
+ if (!repeated) {
+ (*variables)["class"] = BoxedPrimitiveTypeName(java_type);
+ (*variables)["tag_params"] = tag;
+ } else {
+ (*variables)["class"] = PrimitiveTypeName(java_type) + "[]";
+ if (!descriptor->is_packable()) {
+ // Non-packable: nonPackedTag == tag, packedTag == 0
+ (*variables)["tag_params"] = tag + ", " + tag + ", 0";
+ } else if (descriptor->options().packed()) {
+ // Packable and packed: tag == packedTag
+ string non_packed_tag = SimpleItoa(WireFormatLite::MakeTag(
+ descriptor->number(),
+ WireFormat::WireTypeForFieldType(descriptor->type())));
+ (*variables)["tag_params"] = tag + ", " + non_packed_tag + ", " + tag;
+ } else {
+ // Packable and not packed: tag == nonPackedTag
+ string packed_tag = SimpleItoa(WireFormatLite::MakeTag(
+ descriptor->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED));
+ (*variables)["tag_params"] = tag + ", " + tag + ", " + packed_tag;
+ }
+ }
+ }
+}
+
+ExtensionGenerator::
+ExtensionGenerator(const FieldDescriptor* descriptor, const Params& params)
+ : params_(params), descriptor_(descriptor) {
+ SetVariables(descriptor, params, &variables_);
+}
+
+ExtensionGenerator::~ExtensionGenerator() {}
+
+void ExtensionGenerator::Generate(io::Printer* printer) const {
+ printer->Print("\n");
+ PrintFieldComment(printer, descriptor_);
+ printer->Print(variables_,
+ "public static final com.google.protobuf.nano.Extension<\n"
+ " $extends$,\n"
+ " $class$> $name$ =\n"
+ " com.google.protobuf.nano.Extension.create$repeated$$ext_type$(\n"
+ " com.google.protobuf.nano.Extension.$type$,\n"
+ " $class$.class,\n"
+ " $tag_params$L);\n");
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
+
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_extension.h
index d502a6f0df..f4e9eb2d0b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_extension.h
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,34 +28,47 @@
// (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: seongkim@google.com (Seong Beom Kim)
+// Author: bduff@google.com (Brian Duff)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
-#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__
-#define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_EXTENSION_H_
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_EXTENSION_H_
+
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/compiler/cpp/cpp_options.h>
-#include <google/protobuf/descriptor.h>
namespace google {
namespace protobuf {
+ namespace io {
+ class Printer; // printer.h
+ }
+}
+
+namespace protobuf {
namespace compiler {
-namespace cpp {
+namespace javanano {
-// Provides an abstract interface to optimize message layout
-// by rearranging the fields of a message.
-class MessageLayoutHelper {
+class ExtensionGenerator {
public:
- virtual ~MessageLayoutHelper() {}
+ explicit ExtensionGenerator(const FieldDescriptor* descriptor, const Params& params);
+ ~ExtensionGenerator();
+
+ void Generate(io::Printer* printer) const;
- virtual void OptimizeLayout(std::vector<const FieldDescriptor*>* fields,
- const Options& options) = 0;
+ private:
+ const Params& params_;
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
};
-} // namespace cpp
+} // namespace javanano
} // namespace compiler
} // namespace protobuf
-
} // namespace google
-#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__
+
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_EXTENSION_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_field.cc
new file mode 100644
index 0000000000..e31d11777e
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_field.cc
@@ -0,0 +1,209 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <google/protobuf/compiler/javanano/javanano_field.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/compiler/javanano/javanano_primitive_field.h>
+#include <google/protobuf/compiler/javanano/javanano_enum_field.h>
+#include <google/protobuf/compiler/javanano/javanano_map_field.h>
+#include <google/protobuf/compiler/javanano/javanano_message_field.h>
+#include <google/protobuf/stubs/common.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+FieldGenerator::~FieldGenerator() {}
+
+bool FieldGenerator::SavedDefaultNeeded() const {
+ // No saved default for this field by default.
+ // Subclasses whose instances may need saved defaults will override this
+ // and return the appropriate value.
+ return false;
+}
+
+void FieldGenerator::GenerateInitSavedDefaultCode(io::Printer* printer) const {
+ // No saved default for this field by default.
+ // Subclasses whose instances may need saved defaults will override this
+ // and generate the appropriate init code to the printer.
+}
+
+void FieldGenerator::GenerateMergingCodeFromPacked(io::Printer* printer) const {
+ // Reaching here indicates a bug. Cases are:
+ // - This FieldGenerator should support packing, but this method should be
+ // overridden.
+ // - This FieldGenerator doesn't support packing, and this method should
+ // never have been called.
+ GOOGLE_LOG(FATAL) << "GenerateParsingCodeFromPacked() "
+ << "called on field generator that does not support packing.";
+}
+
+// =============================================
+
+FieldGeneratorMap::FieldGeneratorMap(
+ const Descriptor* descriptor, const Params &params)
+ : descriptor_(descriptor),
+ field_generators_(
+ new scoped_ptr<FieldGenerator>[descriptor->field_count()]) {
+
+ int next_has_bit_index = 0;
+ bool saved_defaults_needed = false;
+ // Construct all the FieldGenerators.
+ for (int i = 0; i < descriptor->field_count(); i++) {
+ FieldGenerator* field_generator = MakeGenerator(
+ descriptor->field(i), params, &next_has_bit_index);
+ saved_defaults_needed = saved_defaults_needed
+ || field_generator->SavedDefaultNeeded();
+ field_generators_[i].reset(field_generator);
+ }
+ total_bits_ = next_has_bit_index;
+ saved_defaults_needed_ = saved_defaults_needed;
+}
+
+FieldGenerator* FieldGeneratorMap::MakeGenerator(const FieldDescriptor* field,
+ const Params &params, int* next_has_bit_index) {
+ JavaType java_type = GetJavaType(field);
+ if (field->is_repeated()) {
+ switch (java_type) {
+ case JAVATYPE_MESSAGE:
+ if (IsMapEntry(field->message_type())) {
+ return new MapFieldGenerator(field, params);
+ } else {
+ return new RepeatedMessageFieldGenerator(field, params);
+ }
+ case JAVATYPE_ENUM:
+ return new RepeatedEnumFieldGenerator(field, params);
+ default:
+ return new RepeatedPrimitiveFieldGenerator(field, params);
+ }
+ } else if (field->containing_oneof()) {
+ switch (java_type) {
+ case JAVATYPE_MESSAGE:
+ return new MessageOneofFieldGenerator(field, params);
+ case JAVATYPE_ENUM:
+ default:
+ return new PrimitiveOneofFieldGenerator(field, params);
+ }
+ } else if (params.optional_field_accessors() && field->is_optional()
+ && java_type != JAVATYPE_MESSAGE) {
+ // We need a has-bit for each primitive/enum field because their default
+ // values could be same as explicitly set values. But we don't need it
+ // for a message field because they have no defaults and Nano uses 'null'
+ // for unset messages, which cannot be set explicitly.
+ switch (java_type) {
+ case JAVATYPE_ENUM:
+ return new AccessorEnumFieldGenerator(
+ field, params, (*next_has_bit_index)++);
+ default:
+ return new AccessorPrimitiveFieldGenerator(
+ field, params, (*next_has_bit_index)++);
+ }
+ } else {
+ switch (java_type) {
+ case JAVATYPE_MESSAGE:
+ return new MessageFieldGenerator(field, params);
+ case JAVATYPE_ENUM:
+ return new EnumFieldGenerator(field, params);
+ default:
+ return new PrimitiveFieldGenerator(field, params);
+ }
+ }
+}
+
+FieldGeneratorMap::~FieldGeneratorMap() {}
+
+const FieldGenerator& FieldGeneratorMap::get(
+ const FieldDescriptor* field) const {
+ GOOGLE_CHECK_EQ(field->containing_type(), descriptor_);
+ return *field_generators_[field->index()];
+}
+
+void SetCommonOneofVariables(const FieldDescriptor* descriptor,
+ std::map<string, string>* variables) {
+ (*variables)["oneof_name"] =
+ UnderscoresToCamelCase(descriptor->containing_oneof());
+ (*variables)["oneof_capitalized_name"] =
+ UnderscoresToCapitalizedCamelCase(descriptor->containing_oneof());
+ (*variables)["oneof_index"] =
+ SimpleItoa(descriptor->containing_oneof()->index());
+ (*variables)["set_oneof_case"] =
+ "this." + (*variables)["oneof_name"] +
+ "Case_ = " + SimpleItoa(descriptor->number());
+ (*variables)["clear_oneof_case"] =
+ "this." + (*variables)["oneof_name"] + "Case_ = 0";
+ (*variables)["has_oneof_case"] =
+ "this." + (*variables)["oneof_name"] + "Case_ == " +
+ SimpleItoa(descriptor->number());
+}
+
+void GenerateOneofFieldEquals(const FieldDescriptor* descriptor,
+ const std::map<string, string>& variables,
+ io::Printer* printer) {
+ if (GetJavaType(descriptor) == JAVATYPE_BYTES) {
+ printer->Print(variables,
+ "if (this.has$capitalized_name$()) {\n"
+ " if (!java.util.Arrays.equals((byte[]) this.$oneof_name$_,\n"
+ " (byte[]) other.$oneof_name$_)) {\n"
+ " return false;\n"
+ " }\n"
+ "}\n");
+ } else {
+ printer->Print(variables,
+ "if (this.has$capitalized_name$()) {\n"
+ " if (!this.$oneof_name$_.equals(other.$oneof_name$_)) {\n"
+ " return false;\n"
+ " }\n"
+ "}\n");
+ }
+}
+
+void GenerateOneofFieldHashCode(const FieldDescriptor* descriptor,
+ const std::map<string, string>& variables,
+ io::Printer* printer) {
+ if (GetJavaType(descriptor) == JAVATYPE_BYTES) {
+ printer->Print(variables,
+ "result = 31 * result + ($has_oneof_case$\n"
+ " ? java.util.Arrays.hashCode((byte[]) this.$oneof_name$_) : 0);\n");
+ } else {
+ printer->Print(variables,
+ "result = 31 * result +\n"
+ " ($has_oneof_case$ ? this.$oneof_name$_.hashCode() : 0);\n");
+ }
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_field.h
new file mode 100644
index 0000000000..347c888c9b
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_field.h
@@ -0,0 +1,130 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_FIELD_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_FIELD_H__
+
+#include <map>
+#include <string>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+
+namespace google {
+namespace protobuf {
+ namespace io {
+ class Printer; // printer.h
+ }
+}
+
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+class FieldGenerator {
+ public:
+ FieldGenerator(const Params& params) : params_(params) {}
+ virtual ~FieldGenerator();
+
+ virtual bool SavedDefaultNeeded() const;
+ virtual void GenerateInitSavedDefaultCode(io::Printer* printer) const;
+
+ // Generates code for Java fields and methods supporting this field.
+ // If this field needs a saved default (SavedDefaultNeeded() is true),
+ // then @lazy_init controls how the static field for that default value
+ // and its initialization code should be generated. If @lazy_init is
+ // true, the static field is not declared final and the initialization
+ // code is generated only when GenerateInitSavedDefaultCode is called;
+ // otherwise, the static field is declared final and initialized inline.
+ // GenerateInitSavedDefaultCode will not be called in the latter case.
+ virtual void GenerateMembers(
+ io::Printer* printer, bool lazy_init) const = 0;
+
+ virtual void GenerateClearCode(io::Printer* printer) const = 0;
+ virtual void GenerateMergingCode(io::Printer* printer) const = 0;
+
+ // Generates code to merge from packed serialized form. The default
+ // implementation will fail; subclasses which can handle packed serialized
+ // forms will override this and print appropriate code to the printer.
+ virtual void GenerateMergingCodeFromPacked(io::Printer* printer) const;
+
+ virtual void GenerateSerializationCode(io::Printer* printer) const = 0;
+ virtual void GenerateSerializedSizeCode(io::Printer* printer) const = 0;
+ virtual void GenerateEqualsCode(io::Printer* printer) const = 0;
+ virtual void GenerateHashCodeCode(io::Printer* printer) const = 0;
+ virtual void GenerateFixClonedCode(io::Printer* printer) const {}
+
+ protected:
+ const Params& params_;
+ private:
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
+};
+
+// Convenience class which constructs FieldGenerators for a Descriptor.
+class FieldGeneratorMap {
+ public:
+ explicit FieldGeneratorMap(const Descriptor* descriptor, const Params &params);
+ ~FieldGeneratorMap();
+
+ const FieldGenerator& get(const FieldDescriptor* field) const;
+ int total_bits() const { return total_bits_; }
+ bool saved_defaults_needed() const { return saved_defaults_needed_; }
+
+ private:
+ const Descriptor* descriptor_;
+ scoped_array<scoped_ptr<FieldGenerator> > field_generators_;
+ int total_bits_;
+ bool saved_defaults_needed_;
+
+ static FieldGenerator* MakeGenerator(const FieldDescriptor* field,
+ const Params &params, int* next_has_bit_index);
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
+};
+
+void SetCommonOneofVariables(const FieldDescriptor* descriptor,
+ std::map<string, string>* variables);
+void GenerateOneofFieldEquals(const FieldDescriptor* descriptor,
+ const std::map<string, string>& variables,
+ io::Printer* printer);
+void GenerateOneofFieldHashCode(const FieldDescriptor* descriptor,
+ const std::map<string, string>& variables,
+ io::Printer* printer);
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+
+} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_FIELD_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_file.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_file.cc
new file mode 100644
index 0000000000..17f7386e77
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_file.cc
@@ -0,0 +1,263 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <iostream>
+
+#include <google/protobuf/compiler/javanano/javanano_file.h>
+#include <google/protobuf/compiler/javanano/javanano_enum.h>
+#include <google/protobuf/compiler/javanano/javanano_extension.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/compiler/javanano/javanano_message.h>
+#include <google/protobuf/compiler/code_generator.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 {
+namespace compiler {
+namespace javanano {
+
+namespace {
+
+// Recursively searches the given message to see if it contains any extensions.
+bool UsesExtensions(const Message& message) {
+ const Reflection* reflection = message.GetReflection();
+
+ // We conservatively assume that unknown fields are extensions.
+ if (reflection->GetUnknownFields(message).field_count() > 0) return true;
+
+ vector<const FieldDescriptor*> fields;
+ reflection->ListFields(message, &fields);
+
+ for (int i = 0; i < fields.size(); i++) {
+ if (fields[i]->is_extension()) return true;
+
+ if (fields[i]->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
+ if (fields[i]->is_repeated()) {
+ int size = reflection->FieldSize(message, fields[i]);
+ for (int j = 0; j < size; j++) {
+ const Message& sub_message =
+ reflection->GetRepeatedMessage(message, fields[i], j);
+ if (UsesExtensions(sub_message)) return true;
+ }
+ } else {
+ const Message& sub_message = reflection->GetMessage(message, fields[i]);
+ if (UsesExtensions(sub_message)) return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+} // namespace
+
+FileGenerator::FileGenerator(const FileDescriptor* file, const Params& params)
+ : file_(file),
+ params_(params),
+ java_package_(FileJavaPackage(params, file)),
+ classname_(FileClassName(params, file)) {}
+
+FileGenerator::~FileGenerator() {}
+
+bool FileGenerator::Validate(string* error) {
+ // Check for extensions
+ FileDescriptorProto file_proto;
+ file_->CopyTo(&file_proto);
+ if (UsesExtensions(file_proto) && !params_.store_unknown_fields()) {
+ error->assign(file_->name());
+ error->append(
+ ": Java NANO_RUNTIME only supports extensions when the "
+ "'store_unknown_fields' generator option is 'true'.");
+ return false;
+ }
+
+ if (file_->service_count() != 0 && !params_.ignore_services()) {
+ error->assign(file_->name());
+ error->append(
+ ": Java NANO_RUNTIME does not support services\"");
+ return false;
+ }
+
+ if (!IsOuterClassNeeded(params_, file_)) {
+ return true;
+ }
+
+ // Check whether legacy javanano generator would omit the outer class.
+ if (!params_.has_java_outer_classname(file_->name())
+ && file_->message_type_count() == 1
+ && file_->enum_type_count() == 0 && file_->extension_count() == 0) {
+ std::cout << "INFO: " << file_->name() << ":" << std::endl;
+ std::cout << "Javanano generator has changed to align with java generator. "
+ "An outer class will be created for this file and the single message "
+ "in the file will become a nested class. Use java_multiple_files to "
+ "skip generating the outer class, or set an explicit "
+ "java_outer_classname to suppress this message." << std::endl;
+ }
+
+ // Check that no class name matches the file's class name. This is a common
+ // problem that leads to Java compile errors that can be hard to understand.
+ // It's especially bad when using the java_multiple_files, since we would
+ // end up overwriting the outer class with one of the inner ones.
+ bool found_conflict = false;
+ for (int i = 0; !found_conflict && i < file_->message_type_count(); i++) {
+ if (file_->message_type(i)->name() == classname_) {
+ found_conflict = true;
+ }
+ }
+ if (params_.java_enum_style()) {
+ for (int i = 0; !found_conflict && i < file_->enum_type_count(); i++) {
+ if (file_->enum_type(i)->name() == classname_) {
+ found_conflict = true;
+ }
+ }
+ }
+ if (found_conflict) {
+ error->assign(file_->name());
+ error->append(
+ ": Cannot generate Java output because the file's outer class name, \"");
+ error->append(classname_);
+ error->append(
+ "\", matches the name of one of the types declared inside it. "
+ "Please either rename the type or use the java_outer_classname "
+ "option to specify a different outer class name for the .proto file.");
+ return false;
+ }
+ return true;
+}
+
+void FileGenerator::Generate(io::Printer* printer) {
+ // We don't import anything because we refer to all classes by their
+ // fully-qualified names in the generated source.
+ printer->Print(
+ "// Generated by the protocol buffer compiler. DO NOT EDIT!\n");
+ if (!java_package_.empty()) {
+ printer->Print(
+ "\n"
+ "package $package$;\n",
+ "package", java_package_);
+ }
+
+ // Note: constants (from enums, emitted in the loop below) may have the same names as constants
+ // in the nested classes. This causes Java warnings, but is not fatal, so we suppress those
+ // warnings here in the top-most class declaration.
+ printer->Print(
+ "\n"
+ "@SuppressWarnings(\"hiding\")\n"
+ "public interface $classname$ {\n",
+ "classname", classname_);
+ printer->Indent();
+
+ // -----------------------------------------------------------------
+
+ // Extensions.
+ for (int i = 0; i < file_->extension_count(); i++) {
+ ExtensionGenerator(file_->extension(i), params_).Generate(printer);
+ }
+
+ // Enums.
+ for (int i = 0; i < file_->enum_type_count(); i++) {
+ EnumGenerator(file_->enum_type(i), params_).Generate(printer);
+ }
+
+ // Messages.
+ if (!params_.java_multiple_files(file_->name())) {
+ for (int i = 0; i < file_->message_type_count(); i++) {
+ MessageGenerator(file_->message_type(i), params_).Generate(printer);
+ }
+ }
+
+ // Static variables.
+ for (int i = 0; i < file_->message_type_count(); i++) {
+ // TODO(kenton): Reuse MessageGenerator objects?
+ MessageGenerator(file_->message_type(i), params_).GenerateStaticVariables(printer);
+ }
+
+ printer->Outdent();
+ printer->Print(
+ "}\n");
+}
+
+template<typename GeneratorClass, typename DescriptorClass>
+static void GenerateSibling(const string& package_dir,
+ const string& java_package,
+ const DescriptorClass* descriptor,
+ GeneratorContext* output_directory,
+ vector<string>* file_list,
+ const Params& params) {
+ string filename = package_dir + descriptor->name() + ".java";
+ file_list->push_back(filename);
+
+ scoped_ptr<io::ZeroCopyOutputStream> output(
+ output_directory->Open(filename));
+ io::Printer printer(output.get(), '$');
+
+ printer.Print(
+ "// Generated by the protocol buffer compiler. DO NOT EDIT!\n");
+ if (!java_package.empty()) {
+ printer.Print(
+ "\n"
+ "package $package$;\n",
+ "package", java_package);
+ }
+
+ GeneratorClass(descriptor, params).Generate(&printer);
+}
+
+void FileGenerator::GenerateSiblings(const string& package_dir,
+ GeneratorContext* output_directory,
+ vector<string>* file_list) {
+ if (params_.java_multiple_files(file_->name())) {
+ for (int i = 0; i < file_->message_type_count(); i++) {
+ GenerateSibling<MessageGenerator>(package_dir, java_package_,
+ file_->message_type(i),
+ output_directory, file_list, params_);
+ }
+
+ if (params_.java_enum_style()) {
+ for (int i = 0; i < file_->enum_type_count(); i++) {
+ GenerateSibling<EnumGenerator>(package_dir, java_package_,
+ file_->enum_type(i),
+ output_directory, file_list, params_);
+ }
+ }
+ }
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_file.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_file.h
new file mode 100644
index 0000000000..217eafe2a8
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_file.h
@@ -0,0 +1,94 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_FILE_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_FILE_H__
+
+#include <string>
+#include <vector>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+
+namespace google {
+namespace protobuf {
+ class FileDescriptor; // descriptor.h
+ namespace io {
+ class Printer; // printer.h
+ }
+ namespace compiler {
+ class GeneratorContext; // code_generator.h
+ }
+}
+
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+class FileGenerator {
+ public:
+ explicit FileGenerator(const FileDescriptor* file, const Params& params);
+ ~FileGenerator();
+
+ // Checks for problems that would otherwise lead to cryptic compile errors.
+ // Returns true if there are no problems, or writes an error description to
+ // the given string and returns false otherwise.
+ bool Validate(string* error);
+
+ void Generate(io::Printer* printer);
+
+ // If we aren't putting everything into one file, this will write all the
+ // files other than the outer file (i.e. one for each message, enum, and
+ // service type).
+ void GenerateSiblings(const string& package_dir,
+ GeneratorContext* output_directory,
+ vector<string>* file_list);
+
+ const string& java_package() { return java_package_; }
+ const string& classname() { return classname_; }
+
+ private:
+ const FileDescriptor* file_;
+ const Params& params_;
+ string java_package_;
+ string classname_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
+};
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+
+} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_FILE_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_generator.cc
new file mode 100644
index 0000000000..7c3a04212f
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_generator.cc
@@ -0,0 +1,230 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+#include <google/protobuf/compiler/javanano/javanano_generator.h>
+#include <google/protobuf/compiler/javanano/javanano_file.h>
+#include <google/protobuf/compiler/javanano/javanano_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 {
+namespace compiler {
+namespace javanano {
+
+namespace {
+
+string TrimString(const string& s) {
+ string::size_type start = s.find_first_not_of(" \n\r\t");
+ if (start == string::npos) {
+ return "";
+ }
+ string::size_type end = s.find_last_not_of(" \n\r\t") + 1;
+ return s.substr(start, end - start);
+}
+
+} // namespace
+
+void UpdateParamsRecursively(Params& params,
+ const FileDescriptor* file) {
+ // Add any parameters for this file
+ if (file->options().has_java_outer_classname()) {
+ params.set_java_outer_classname(
+ file->name(), file->options().java_outer_classname());
+ }
+ if (file->options().has_java_package()) {
+ string result = file->options().java_package();
+ if (!result.empty()) {
+ result += ".";
+ }
+ result += "nano";
+ params.set_java_package(
+ file->name(), result);
+ }
+ if (file->options().has_java_multiple_files()) {
+ params.set_java_multiple_files(
+ file->name(), file->options().java_multiple_files());
+ }
+
+ // Loop through all dependent files recursively
+ // adding dep
+ for (int i = 0; i < file->dependency_count(); i++) {
+ UpdateParamsRecursively(params, file->dependency(i));
+ }
+}
+
+JavaNanoGenerator::JavaNanoGenerator() {}
+JavaNanoGenerator::~JavaNanoGenerator() {}
+
+bool JavaNanoGenerator::Generate(const FileDescriptor* file,
+ const string& parameter,
+ GeneratorContext* output_directory,
+ string* error) const {
+ vector<pair<string, string> > options;
+
+ ParseGeneratorParameter(parameter, &options);
+
+ // -----------------------------------------------------------------
+ // parse generator options
+
+ // Name a file where we will write a list of generated file names, one
+ // per line.
+ string output_list_file;
+ Params params(file->name());
+
+ // Update per file params
+ UpdateParamsRecursively(params, file);
+
+ // Replace any existing options with ones from command line
+ for (int i = 0; i < options.size(); i++) {
+ string option_name = TrimString(options[i].first);
+ string option_value = TrimString(options[i].second);
+ if (option_name == "output_list_file") {
+ output_list_file = option_value;
+ } else if (option_name == "java_package") {
+ vector<string> parts;
+ SplitStringUsing(option_value, "|", &parts);
+ if (parts.size() != 2) {
+ *error = "Bad java_package, expecting filename|PackageName found '"
+ + option_value + "'";
+ return false;
+ }
+ params.set_java_package(parts[0], parts[1]);
+ } else if (option_name == "java_outer_classname") {
+ vector<string> parts;
+ SplitStringUsing(option_value, "|", &parts);
+ if (parts.size() != 2) {
+ *error = "Bad java_outer_classname, "
+ "expecting filename|ClassName found '"
+ + option_value + "'";
+ return false;
+ }
+ params.set_java_outer_classname(parts[0], parts[1]);
+ } else if (option_name == "store_unknown_fields") {
+ params.set_store_unknown_fields(option_value == "true");
+ } else if (option_name == "java_multiple_files") {
+ params.set_override_java_multiple_files(option_value == "true");
+ } else if (option_name == "java_nano_generate_has") {
+ params.set_generate_has(option_value == "true");
+ } else if (option_name == "enum_style") {
+ params.set_java_enum_style(option_value == "java");
+ } else if (option_name == "optional_field_style") {
+ params.set_optional_field_accessors(option_value == "accessors");
+ params.set_use_reference_types_for_primitives(option_value == "reftypes"
+ || option_value == "reftypes_compat_mode");
+ params.set_reftypes_primitive_enums(
+ option_value == "reftypes_compat_mode");
+ if (option_value == "reftypes_compat_mode") {
+ params.set_generate_clear(false);
+ }
+ } else if (option_name == "generate_equals") {
+ params.set_generate_equals(option_value == "true");
+ } else if (option_name == "ignore_services") {
+ params.set_ignore_services(option_value == "true");
+ } else if (option_name == "parcelable_messages") {
+ params.set_parcelable_messages(option_value == "true");
+ } else if (option_name == "generate_clone") {
+ params.set_generate_clone(option_value == "true");
+ } else if (option_name == "generate_intdefs") {
+ params.set_generate_intdefs(option_value == "true");
+ } else if (option_name == "generate_clear") {
+ params.set_generate_clear(option_value == "true");
+ } else {
+ *error = "Ignore unknown javanano generator option: " + option_name;
+ }
+ }
+
+ // Check illegal parameter combinations
+ // Note: the enum-like optional_field_style generator param ensures
+ // that we can never have illegal combinations of field styles
+ // (e.g. reftypes and accessors can't be on at the same time).
+ if (params.generate_has()
+ && (params.optional_field_accessors()
+ || params.use_reference_types_for_primitives())) {
+ error->assign("java_nano_generate_has=true cannot be used in conjunction"
+ " with optional_field_style=accessors or optional_field_style=reftypes");
+ return false;
+ }
+
+ // -----------------------------------------------------------------
+
+ FileGenerator file_generator(file, params);
+ if (!file_generator.Validate(error)) {
+ return false;
+ }
+
+ string package_dir =
+ StringReplace(file_generator.java_package(), ".", "/", true);
+ if (!package_dir.empty()) package_dir += "/";
+
+ vector<string> all_files;
+
+ if (IsOuterClassNeeded(params, file)) {
+ string java_filename = package_dir;
+ java_filename += file_generator.classname();
+ java_filename += ".java";
+ all_files.push_back(java_filename);
+
+ // Generate main java file.
+ scoped_ptr<io::ZeroCopyOutputStream> output(
+ output_directory->Open(java_filename));
+ io::Printer printer(output.get(), '$');
+ file_generator.Generate(&printer);
+ }
+
+ // Generate sibling files.
+ file_generator.GenerateSiblings(package_dir, output_directory, &all_files);
+
+ // Generate output list if requested.
+ if (!output_list_file.empty()) {
+ // Generate output list. This is just a simple text file placed in a
+ // deterministic location which lists the .java files being generated.
+ scoped_ptr<io::ZeroCopyOutputStream> srclist_raw_output(
+ output_directory->Open(output_list_file));
+ io::Printer srclist_printer(srclist_raw_output.get(), '$');
+ for (int i = 0; i < all_files.size(); i++) {
+ srclist_printer.Print("$filename$\n", "filename", all_files[i]);
+ }
+ }
+
+ return true;
+}
+
+} // namespace java
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_generator.h
index 42a3b5cdf8..6f9f7f2a4a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_generator.h
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,37 +28,45 @@
// (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: seongkim@google.com (Seong Beom Kim)
+// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
+//
+// Generates Java nano code for a given .proto file.
-#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__
-#define GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
-#include <google/protobuf/compiler/cpp/cpp_message_layout_helper.h>
+#include <string>
+#include <google/protobuf/compiler/code_generator.h>
namespace google {
namespace protobuf {
namespace compiler {
-namespace cpp {
+namespace javanano {
-// Rearranges the fields of a message to minimize padding.
-// Fields are grouped by the type and the size.
-// For example, grouping four boolean fields and one int32
-// field results in zero padding overhead. See OptimizeLayout's
-// comment for details.
-class PaddingOptimizer : public MessageLayoutHelper {
+// CodeGenerator implementation which generates Java nano code. If you create your
+// own protocol compiler binary and you want it to support Java output for the
+// nano runtime, you can do so by registering an instance of this CodeGenerator with
+// the CommandLineInterface in your main() function.
+class LIBPROTOC_EXPORT JavaNanoGenerator : public CodeGenerator {
public:
- PaddingOptimizer() {}
- ~PaddingOptimizer() override {}
+ JavaNanoGenerator();
+ ~JavaNanoGenerator();
+
+ // implements CodeGenerator ----------------------------------------
+ bool Generate(const FileDescriptor* file,
+ const string& parameter,
+ GeneratorContext* output_directory,
+ string* error) const;
- void OptimizeLayout(std::vector<const FieldDescriptor*>* fields,
- const Options& options) override;
+ private:
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaNanoGenerator);
};
-} // namespace cpp
+} // namespace javanano
} // namespace compiler
} // namespace protobuf
} // namespace google
-#endif // GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_helpers.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_helpers.cc
new file mode 100644
index 0000000000..1927ba12f2
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_helpers.cc
@@ -0,0 +1,591 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <limits>
+#include <vector>
+
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/stubs/hash.h>
+#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/stubs/substitute.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+const char kThickSeparator[] =
+ "// ===================================================================\n";
+const char kThinSeparator[] =
+ "// -------------------------------------------------------------------\n";
+
+class RenameKeywords {
+ private:
+ hash_set<string> java_keywords_set_;
+
+ public:
+ RenameKeywords() {
+ static const char* kJavaKeywordsList[] = {
+ // Reserved Java Keywords
+ "abstract", "assert", "boolean", "break", "byte", "case", "catch",
+ "char", "class", "const", "continue", "default", "do", "double", "else",
+ "enum", "extends", "final", "finally", "float", "for", "goto", "if",
+ "implements", "import", "instanceof", "int", "interface", "long",
+ "native", "new", "package", "private", "protected", "public", "return",
+ "short", "static", "strictfp", "super", "switch", "synchronized",
+ "this", "throw", "throws", "transient", "try", "void", "volatile", "while",
+
+ // Reserved Keywords for Literals
+ "false", "null", "true"
+ };
+
+ for (int i = 0; i < GOOGLE_ARRAYSIZE(kJavaKeywordsList); i++) {
+ java_keywords_set_.insert(kJavaKeywordsList[i]);
+ }
+ }
+
+ // Used to rename the a field name if it's a java keyword. Specifically
+ // this is used to rename the ["name"] or ["capitalized_name"] field params.
+ // (http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html)
+ string RenameJavaKeywordsImpl(const string& input) {
+ string result = input;
+
+ if (java_keywords_set_.find(result) != java_keywords_set_.end()) {
+ result += "_";
+ }
+
+ return result;
+ }
+
+};
+
+static RenameKeywords sRenameKeywords;
+
+namespace {
+
+const char* kDefaultPackage = "";
+
+const string& FieldName(const FieldDescriptor* field) {
+ // Groups are hacky: The name of the field is just the lower-cased name
+ // of the group type. In Java, though, we would like to retain the original
+ // capitalization of the type name.
+ if (field->type() == FieldDescriptor::TYPE_GROUP) {
+ return field->message_type()->name();
+ } else {
+ return field->name();
+ }
+}
+
+string UnderscoresToCamelCaseImpl(const string& input, bool cap_next_letter) {
+ string result;
+ // Note: I distrust ctype.h due to locales.
+ for (int i = 0; i < input.size(); i++) {
+ if ('a' <= input[i] && input[i] <= 'z') {
+ if (cap_next_letter) {
+ result += input[i] + ('A' - 'a');
+ } else {
+ result += input[i];
+ }
+ cap_next_letter = false;
+ } else if ('A' <= input[i] && input[i] <= 'Z') {
+ if (i == 0 && !cap_next_letter) {
+ // Force first letter to lower-case unless explicitly told to
+ // capitalize it.
+ result += input[i] + ('a' - 'A');
+ } else {
+ // Capital letters after the first are left as-is.
+ result += input[i];
+ }
+ cap_next_letter = false;
+ } else if ('0' <= input[i] && input[i] <= '9') {
+ result += input[i];
+ cap_next_letter = true;
+ } else {
+ cap_next_letter = true;
+ }
+ }
+ return result;
+}
+
+} // namespace
+
+string UnderscoresToCamelCase(const FieldDescriptor* field) {
+ return UnderscoresToCamelCaseImpl(FieldName(field), false);
+}
+
+string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field) {
+ return UnderscoresToCamelCaseImpl(FieldName(field), true);
+}
+
+string UnderscoresToCamelCase(const MethodDescriptor* method) {
+ return UnderscoresToCamelCaseImpl(method->name(), false);
+}
+
+string UnderscoresToCamelCase(const OneofDescriptor* oneof) {
+ return UnderscoresToCamelCaseImpl(oneof->name(), false);
+}
+
+string UnderscoresToCapitalizedCamelCase(const OneofDescriptor* oneof) {
+ return UnderscoresToCamelCaseImpl(oneof->name(), true);
+}
+
+string RenameJavaKeywords(const string& input) {
+ return sRenameKeywords.RenameJavaKeywordsImpl(input);
+}
+
+string StripProto(const string& filename) {
+ if (HasSuffixString(filename, ".protodevel")) {
+ return StripSuffixString(filename, ".protodevel");
+ } else {
+ return StripSuffixString(filename, ".proto");
+ }
+}
+
+string FileClassName(const Params& params, const FileDescriptor* file) {
+ if (params.has_java_outer_classname(file->name())) {
+ return params.java_outer_classname(file->name());
+ } else {
+ // Use the filename itself with underscores removed
+ // and a CamelCase style name.
+ string basename;
+ string::size_type last_slash = file->name().find_last_of('/');
+ if (last_slash == string::npos) {
+ basename = file->name();
+ } else {
+ basename = file->name().substr(last_slash + 1);
+ }
+ return UnderscoresToCamelCaseImpl(StripProto(basename), true);
+ }
+}
+
+string FileJavaPackage(const Params& params, const FileDescriptor* file) {
+ if (params.has_java_package(file->name())) {
+ return params.java_package(file->name());
+ } else {
+ string result = kDefaultPackage;
+ if (!file->package().empty()) {
+ if (!result.empty()) result += '.';
+ result += file->package();
+ }
+
+ if (!result.empty()) {
+ result += ".";
+ }
+ result += "nano";
+
+ return result;
+ }
+}
+
+bool IsOuterClassNeeded(const Params& params, const FileDescriptor* file) {
+ // If java_multiple_files is false, the outer class is always needed.
+ if (!params.java_multiple_files(file->name())) {
+ return true;
+ }
+
+ // File-scope extensions need the outer class as the scope.
+ if (file->extension_count() != 0) {
+ return true;
+ }
+
+ // If container interfaces are not generated, file-scope enums need the
+ // outer class as the scope.
+ if (file->enum_type_count() != 0 && !params.java_enum_style()) {
+ return true;
+ }
+
+ return false;
+}
+
+string ToJavaName(const Params& params, const string& name, bool is_class,
+ const Descriptor* parent, const FileDescriptor* file) {
+ string result;
+ if (parent != NULL) {
+ result.append(ClassName(params, parent));
+ } else if (is_class && params.java_multiple_files(file->name())) {
+ result.append(FileJavaPackage(params, file));
+ } else {
+ result.append(ClassName(params, file));
+ }
+ if (!result.empty()) result.append(1, '.');
+ result.append(RenameJavaKeywords(name));
+ return result;
+}
+
+string ClassName(const Params& params, const FileDescriptor* descriptor) {
+ string result = FileJavaPackage(params, descriptor);
+ if (!result.empty()) result += '.';
+ result += FileClassName(params, descriptor);
+ return result;
+}
+
+string ClassName(const Params& params, const EnumDescriptor* descriptor) {
+ const Descriptor* parent = descriptor->containing_type();
+ // When using Java enum style, an enum's class name contains the enum name.
+ // Use the standard ToJavaName translation.
+ if (params.java_enum_style()) {
+ return ToJavaName(params, descriptor->name(), true, parent,
+ descriptor->file());
+ }
+ // Otherwise the enum members are accessed from the enclosing class.
+ if (parent != NULL) {
+ return ClassName(params, parent);
+ } else {
+ return ClassName(params, descriptor->file());
+ }
+}
+
+string FieldConstantName(const FieldDescriptor *field) {
+ string name = field->name() + "_FIELD_NUMBER";
+ UpperString(&name);
+ return name;
+}
+
+string FieldDefaultConstantName(const FieldDescriptor *field) {
+ return "_" + RenameJavaKeywords(UnderscoresToCamelCase(field)) + "Default";
+}
+
+void PrintFieldComment(io::Printer* printer, const FieldDescriptor* field) {
+ // We don't want to print group bodies so we cut off after the first line
+ // (the second line for extensions).
+ string def = field->DebugString();
+ string::size_type first_line_end = def.find_first_of('\n');
+ printer->Print("// $def$\n",
+ "def", def.substr(0, first_line_end));
+ if (field->is_extension()) {
+ string::size_type second_line_start = first_line_end + 1;
+ string::size_type second_line_length =
+ def.find('\n', second_line_start) - second_line_start;
+ printer->Print("// $def$\n",
+ "def", def.substr(second_line_start, second_line_length));
+ }
+}
+
+JavaType GetJavaType(FieldDescriptor::Type field_type) {
+ switch (field_type) {
+ case FieldDescriptor::TYPE_INT32:
+ case FieldDescriptor::TYPE_UINT32:
+ case FieldDescriptor::TYPE_SINT32:
+ case FieldDescriptor::TYPE_FIXED32:
+ case FieldDescriptor::TYPE_SFIXED32:
+ return JAVATYPE_INT;
+
+ case FieldDescriptor::TYPE_INT64:
+ case FieldDescriptor::TYPE_UINT64:
+ case FieldDescriptor::TYPE_SINT64:
+ case FieldDescriptor::TYPE_FIXED64:
+ case FieldDescriptor::TYPE_SFIXED64:
+ return JAVATYPE_LONG;
+
+ case FieldDescriptor::TYPE_FLOAT:
+ return JAVATYPE_FLOAT;
+
+ case FieldDescriptor::TYPE_DOUBLE:
+ return JAVATYPE_DOUBLE;
+
+ case FieldDescriptor::TYPE_BOOL:
+ return JAVATYPE_BOOLEAN;
+
+ case FieldDescriptor::TYPE_STRING:
+ return JAVATYPE_STRING;
+
+ case FieldDescriptor::TYPE_BYTES:
+ return JAVATYPE_BYTES;
+
+ case FieldDescriptor::TYPE_ENUM:
+ return JAVATYPE_ENUM;
+
+ case FieldDescriptor::TYPE_GROUP:
+ case FieldDescriptor::TYPE_MESSAGE:
+ return JAVATYPE_MESSAGE;
+
+ // No default because we want the compiler to complain if any new
+ // types are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return JAVATYPE_INT;
+}
+
+string PrimitiveTypeName(JavaType type) {
+ switch (type) {
+ case JAVATYPE_INT : return "int";
+ case JAVATYPE_LONG : return "long";
+ case JAVATYPE_FLOAT : return "float";
+ case JAVATYPE_DOUBLE : return "double";
+ case JAVATYPE_BOOLEAN: return "boolean";
+ case JAVATYPE_STRING : return "java.lang.String";
+ case JAVATYPE_BYTES : return "byte[]";
+ case JAVATYPE_ENUM : return "int";
+ case JAVATYPE_MESSAGE: return "";
+
+ // No default because we want the compiler to complain if any new
+ // JavaTypes are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
+string BoxedPrimitiveTypeName(JavaType type) {
+ switch (type) {
+ case JAVATYPE_INT : return "java.lang.Integer";
+ case JAVATYPE_LONG : return "java.lang.Long";
+ case JAVATYPE_FLOAT : return "java.lang.Float";
+ case JAVATYPE_DOUBLE : return "java.lang.Double";
+ case JAVATYPE_BOOLEAN: return "java.lang.Boolean";
+ case JAVATYPE_STRING : return "java.lang.String";
+ case JAVATYPE_BYTES : return "byte[]";
+ case JAVATYPE_ENUM : return "java.lang.Integer";
+ case JAVATYPE_MESSAGE: return "";
+
+ // No default because we want the compiler to complain if any new
+ // JavaTypes are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
+string EmptyArrayName(const Params& params, const FieldDescriptor* field) {
+ switch (GetJavaType(field)) {
+ case JAVATYPE_INT : return "com.google.protobuf.nano.WireFormatNano.EMPTY_INT_ARRAY";
+ case JAVATYPE_LONG : return "com.google.protobuf.nano.WireFormatNano.EMPTY_LONG_ARRAY";
+ case JAVATYPE_FLOAT : return "com.google.protobuf.nano.WireFormatNano.EMPTY_FLOAT_ARRAY";
+ case JAVATYPE_DOUBLE : return "com.google.protobuf.nano.WireFormatNano.EMPTY_DOUBLE_ARRAY";
+ case JAVATYPE_BOOLEAN: return "com.google.protobuf.nano.WireFormatNano.EMPTY_BOOLEAN_ARRAY";
+ case JAVATYPE_STRING : return "com.google.protobuf.nano.WireFormatNano.EMPTY_STRING_ARRAY";
+ case JAVATYPE_BYTES : return "com.google.protobuf.nano.WireFormatNano.EMPTY_BYTES_ARRAY";
+ case JAVATYPE_ENUM : return "com.google.protobuf.nano.WireFormatNano.EMPTY_INT_ARRAY";
+ case JAVATYPE_MESSAGE: return ClassName(params, field->message_type()) + ".EMPTY_ARRAY";
+
+ // No default because we want the compiler to complain if any new
+ // JavaTypes are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
+string DefaultValue(const Params& params, const FieldDescriptor* field) {
+ if (field->label() == FieldDescriptor::LABEL_REPEATED) {
+ return EmptyArrayName(params, field);
+ }
+
+ if (params.use_reference_types_for_primitives()) {
+ if (params.reftypes_primitive_enums()
+ && field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) {
+ return "Integer.MIN_VALUE";
+ }
+ return "null";
+ }
+
+ // Switch on cpp_type since we need to know which default_value_* method
+ // of FieldDescriptor to call.
+ switch (field->cpp_type()) {
+ case FieldDescriptor::CPPTYPE_INT32:
+ return SimpleItoa(field->default_value_int32());
+ case FieldDescriptor::CPPTYPE_UINT32:
+ // Need to print as a signed int since Java has no unsigned.
+ return SimpleItoa(static_cast<int32>(field->default_value_uint32()));
+ case FieldDescriptor::CPPTYPE_INT64:
+ return SimpleItoa(field->default_value_int64()) + "L";
+ case FieldDescriptor::CPPTYPE_UINT64:
+ return SimpleItoa(static_cast<int64>(field->default_value_uint64())) +
+ "L";
+ case FieldDescriptor::CPPTYPE_DOUBLE: {
+ double value = field->default_value_double();
+ if (value == std::numeric_limits<double>::infinity()) {
+ return "Double.POSITIVE_INFINITY";
+ } else if (value == -std::numeric_limits<double>::infinity()) {
+ return "Double.NEGATIVE_INFINITY";
+ } else if (value != value) {
+ return "Double.NaN";
+ } else {
+ return SimpleDtoa(value) + "D";
+ }
+ }
+ case FieldDescriptor::CPPTYPE_FLOAT: {
+ float value = field->default_value_float();
+ if (value == std::numeric_limits<float>::infinity()) {
+ return "Float.POSITIVE_INFINITY";
+ } else if (value == -std::numeric_limits<float>::infinity()) {
+ return "Float.NEGATIVE_INFINITY";
+ } else if (value != value) {
+ return "Float.NaN";
+ } else {
+ return SimpleFtoa(value) + "F";
+ }
+ }
+ case FieldDescriptor::CPPTYPE_BOOL:
+ return field->default_value_bool() ? "true" : "false";
+ case FieldDescriptor::CPPTYPE_STRING:
+ if (!field->default_value_string().empty()) {
+ // Point it to the static final in the generated code.
+ return FieldDefaultConstantName(field);
+ } else {
+ if (field->type() == FieldDescriptor::TYPE_BYTES) {
+ return "com.google.protobuf.nano.WireFormatNano.EMPTY_BYTES";
+ } else {
+ return "\"\"";
+ }
+ }
+
+ case FieldDescriptor::CPPTYPE_ENUM:
+ return ClassName(params, field->enum_type()) + "." +
+ RenameJavaKeywords(field->default_value_enum()->name());
+
+ case FieldDescriptor::CPPTYPE_MESSAGE:
+ return "null";
+
+ // No default because we want the compiler to complain if any new
+ // types are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
+
+static const char* kBitMasks[] = {
+ "0x00000001",
+ "0x00000002",
+ "0x00000004",
+ "0x00000008",
+ "0x00000010",
+ "0x00000020",
+ "0x00000040",
+ "0x00000080",
+
+ "0x00000100",
+ "0x00000200",
+ "0x00000400",
+ "0x00000800",
+ "0x00001000",
+ "0x00002000",
+ "0x00004000",
+ "0x00008000",
+
+ "0x00010000",
+ "0x00020000",
+ "0x00040000",
+ "0x00080000",
+ "0x00100000",
+ "0x00200000",
+ "0x00400000",
+ "0x00800000",
+
+ "0x01000000",
+ "0x02000000",
+ "0x04000000",
+ "0x08000000",
+ "0x10000000",
+ "0x20000000",
+ "0x40000000",
+ "0x80000000",
+};
+
+string GetBitFieldName(int index) {
+ string var_name = "bitField";
+ var_name += SimpleItoa(index);
+ var_name += "_";
+ return var_name;
+}
+
+string GetBitFieldNameForBit(int bit_index) {
+ return GetBitFieldName(bit_index / 32);
+}
+
+string GenerateGetBit(int bit_index) {
+ string var_name = GetBitFieldNameForBit(bit_index);
+ int bit_in_var_index = bit_index % 32;
+
+ string mask = kBitMasks[bit_in_var_index];
+ string result = "((" + var_name + " & " + mask + ") != 0)";
+ return result;
+}
+
+string GenerateSetBit(int bit_index) {
+ string var_name = GetBitFieldNameForBit(bit_index);
+ int bit_in_var_index = bit_index % 32;
+
+ string mask = kBitMasks[bit_in_var_index];
+ string result = var_name + " |= " + mask;
+ return result;
+}
+
+string GenerateClearBit(int bit_index) {
+ string var_name = GetBitFieldNameForBit(bit_index);
+ int bit_in_var_index = bit_index % 32;
+
+ string mask = kBitMasks[bit_in_var_index];
+ string result = var_name + " = (" + var_name + " & ~" + mask + ")";
+ return result;
+}
+
+string GenerateDifferentBit(int bit_index) {
+ string var_name = GetBitFieldNameForBit(bit_index);
+ int bit_in_var_index = bit_index % 32;
+
+ string mask = kBitMasks[bit_in_var_index];
+ string result = "((" + var_name + " & " + mask
+ + ") != (other." + var_name + " & " + mask + "))";
+ return result;
+}
+
+void SetBitOperationVariables(const string name,
+ int bitIndex, std::map<string, string>* variables) {
+ (*variables)["get_" + name] = GenerateGetBit(bitIndex);
+ (*variables)["set_" + name] = GenerateSetBit(bitIndex);
+ (*variables)["clear_" + name] = GenerateClearBit(bitIndex);
+ (*variables)["different_" + name] = GenerateDifferentBit(bitIndex);
+}
+
+bool HasMapField(const Descriptor* descriptor) {
+ for (int i = 0; i < descriptor->field_count(); ++i) {
+ const FieldDescriptor* field = descriptor->field(i);
+ if (field->type() == FieldDescriptor::TYPE_MESSAGE &&
+ IsMapEntry(field->message_type())) {
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_helpers.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_helpers.h
new file mode 100644
index 0000000000..04b2d63353
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_helpers.h
@@ -0,0 +1,199 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_HELPERS_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_HELPERS_H__
+
+#include <string>
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/printer.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+// Commonly-used separator comments. Thick is a line of '=', thin is a line
+// of '-'.
+extern const char kThickSeparator[];
+extern const char kThinSeparator[];
+
+// Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes
+// "fooBarBaz" or "FooBarBaz", respectively.
+string UnderscoresToCamelCase(const FieldDescriptor* field);
+string UnderscoresToCamelCase(const OneofDescriptor* oneof);
+string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field);
+string UnderscoresToCapitalizedCamelCase(const OneofDescriptor* oneof);
+
+// Appends an "_" to the end of a field where the name is a reserved java
+// keyword. For example int32 public = 1 will generate int public_.
+string RenameJavaKeywords(const string& input);
+
+// Similar, but for method names. (Typically, this merely has the effect
+// of lower-casing the first letter of the name.)
+string UnderscoresToCamelCase(const MethodDescriptor* method);
+
+// Strips ".proto" or ".protodevel" from the end of a filename.
+string StripProto(const string& filename);
+
+// Gets the unqualified class name for the file. Each .proto file becomes a
+// single Java class, with all its contents nested in that class.
+string FileClassName(const Params& params, const FileDescriptor* file);
+
+// Returns the file's Java package name.
+string FileJavaPackage(const Params& params, const FileDescriptor* file);
+
+// Returns whether the Java outer class is needed, i.e. whether the option
+// java_multiple_files is false, or the proto file contains any file-scope
+// enums/extensions.
+bool IsOuterClassNeeded(const Params& params, const FileDescriptor* file);
+
+// Converts the given simple name of a proto entity to its fully-qualified name
+// in the Java namespace, given that it is in the given file enclosed in the
+// given parent message (or NULL for file-scope entities). Whether the file's
+// outer class name should be included in the return value depends on factors
+// inferrable from the given arguments, including is_class which indicates
+// whether the entity translates to a Java class.
+string ToJavaName(const Params& params, const string& name, bool is_class,
+ const Descriptor* parent, const FileDescriptor* file);
+
+// These return the fully-qualified class name corresponding to the given
+// descriptor.
+inline string ClassName(const Params& params, const Descriptor* descriptor) {
+ return ToJavaName(params, descriptor->name(), true,
+ descriptor->containing_type(), descriptor->file());
+}
+string ClassName(const Params& params, const EnumDescriptor* descriptor);
+inline string ClassName(const Params& params,
+ const ServiceDescriptor* descriptor) {
+ return ToJavaName(params, descriptor->name(), true, NULL, descriptor->file());
+}
+inline string ExtensionIdentifierName(const Params& params,
+ const FieldDescriptor* descriptor) {
+ return ToJavaName(params, descriptor->name(), false,
+ descriptor->extension_scope(), descriptor->file());
+}
+string ClassName(const Params& params, const FileDescriptor* descriptor);
+
+// Get the unqualified name that should be used for a field's field
+// number constant.
+string FieldConstantName(const FieldDescriptor *field);
+
+string FieldDefaultConstantName(const FieldDescriptor *field);
+
+// Print the field's proto-syntax definition as a comment.
+void PrintFieldComment(io::Printer* printer, const FieldDescriptor* field);
+
+enum JavaType {
+ JAVATYPE_INT,
+ JAVATYPE_LONG,
+ JAVATYPE_FLOAT,
+ JAVATYPE_DOUBLE,
+ JAVATYPE_BOOLEAN,
+ JAVATYPE_STRING,
+ JAVATYPE_BYTES,
+ JAVATYPE_ENUM,
+ JAVATYPE_MESSAGE
+};
+
+JavaType GetJavaType(FieldDescriptor::Type field_type);
+
+inline JavaType GetJavaType(const FieldDescriptor* field) {
+ return GetJavaType(field->type());
+}
+
+string PrimitiveTypeName(JavaType type);
+
+// Get the fully-qualified class name for a boxed primitive type, e.g.
+// "java.lang.Integer" for JAVATYPE_INT. Returns NULL for enum and message
+// types.
+string BoxedPrimitiveTypeName(JavaType type);
+
+string EmptyArrayName(const Params& params, const FieldDescriptor* field);
+
+string DefaultValue(const Params& params, const FieldDescriptor* field);
+
+
+// Methods for shared bitfields.
+
+// Gets the name of the shared bitfield for the given field index.
+string GetBitFieldName(int index);
+
+// Gets the name of the shared bitfield for the given bit index.
+// Effectively, GetBitFieldName(bit_index / 32)
+string GetBitFieldNameForBit(int bit_index);
+
+// Generates the java code for the expression that returns whether the bit at
+// the given bit index is set.
+// Example: "((bitField1_ & 0x04000000) != 0)"
+string GenerateGetBit(int bit_index);
+
+// Generates the java code for the expression that sets the bit at the given
+// bit index.
+// Example: "bitField1_ |= 0x04000000"
+string GenerateSetBit(int bit_index);
+
+// Generates the java code for the expression that clears the bit at the given
+// bit index.
+// Example: "bitField1_ = (bitField1_ & ~0x04000000)"
+string GenerateClearBit(int bit_index);
+
+// Generates the java code for the expression that returns whether the bit at
+// the given bit index contains different values in the current object and
+// another object accessible via the variable 'other'.
+// Example: "((bitField1_ & 0x04000000) != (other.bitField1_ & 0x04000000))"
+string GenerateDifferentBit(int bit_index);
+
+// Sets the 'get_*', 'set_*', 'clear_*' and 'different_*' variables, where * is
+// the given name of the bit, to the appropriate Java expressions for the given
+// bit index.
+void SetBitOperationVariables(const string name,
+ int bitIndex, std::map<string, string>* variables);
+
+inline bool IsMapEntry(const Descriptor* descriptor) {
+ // TODO(liujisi): Add an option to turn on maps for proto2 syntax as well.
+ return descriptor->options().map_entry() &&
+ descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3;
+}
+
+bool HasMapField(const Descriptor* descriptor);
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+
+} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_HELPERS_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_map_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_map_field.cc
new file mode 100644
index 0000000000..a4ab8858f2
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_map_field.cc
@@ -0,0 +1,186 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <google/protobuf/compiler/javanano/javanano_map_field.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/wire_format.h>
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+namespace {
+
+string TypeName(const Params& params, const FieldDescriptor* field,
+ bool boxed) {
+ JavaType java_type = GetJavaType(field);
+ switch (java_type) {
+ case JAVATYPE_MESSAGE:
+ return ClassName(params, field->message_type());
+ case JAVATYPE_INT:
+ case JAVATYPE_LONG:
+ case JAVATYPE_FLOAT:
+ case JAVATYPE_DOUBLE:
+ case JAVATYPE_BOOLEAN:
+ case JAVATYPE_STRING:
+ case JAVATYPE_BYTES:
+ case JAVATYPE_ENUM:
+ if (boxed) {
+ return BoxedPrimitiveTypeName(java_type);
+ } else {
+ return PrimitiveTypeName(java_type);
+ }
+ // No default because we want the compiler to complain if any new JavaTypes
+ // are added..
+ }
+
+ GOOGLE_LOG(FATAL) << "should not reach here.";
+ return "";
+}
+
+const FieldDescriptor* KeyField(const FieldDescriptor* descriptor) {
+ GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
+ const Descriptor* message = descriptor->message_type();
+ GOOGLE_CHECK(message->options().map_entry());
+ return message->FindFieldByName("key");
+}
+
+const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) {
+ GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
+ const Descriptor* message = descriptor->message_type();
+ GOOGLE_CHECK(message->options().map_entry());
+ return message->FindFieldByName("value");
+}
+
+void SetMapVariables(const Params& params,
+ const FieldDescriptor* descriptor, std::map<string, string>* variables) {
+ const FieldDescriptor* key = KeyField(descriptor);
+ const FieldDescriptor* value = ValueField(descriptor);
+ (*variables)["name"] =
+ RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
+ (*variables)["number"] = SimpleItoa(descriptor->number());
+ (*variables)["key_type"] = TypeName(params, key, false);
+ (*variables)["boxed_key_type"] = TypeName(params,key, true);
+ (*variables)["key_desc_type"] =
+ "TYPE_" + ToUpper(FieldDescriptor::TypeName(key->type()));
+ (*variables)["key_tag"] = SimpleItoa(internal::WireFormat::MakeTag(key));
+ (*variables)["value_type"] = TypeName(params, value, false);
+ (*variables)["boxed_value_type"] = TypeName(params, value, true);
+ (*variables)["value_desc_type"] =
+ "TYPE_" + ToUpper(FieldDescriptor::TypeName(value->type()));
+ (*variables)["value_tag"] = SimpleItoa(internal::WireFormat::MakeTag(value));
+ (*variables)["type_parameters"] =
+ (*variables)["boxed_key_type"] + ", " + (*variables)["boxed_value_type"];
+ (*variables)["value_default"] =
+ value->type() == FieldDescriptor::TYPE_MESSAGE
+ ? "new " + (*variables)["value_type"] + "()"
+ : "null";
+}
+} // namespace
+
+// ===================================================================
+MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor,
+ const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetMapVariables(params, descriptor, &variables_);
+}
+
+MapFieldGenerator::~MapFieldGenerator() {}
+
+void MapFieldGenerator::
+GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
+ printer->Print(variables_,
+ "public java.util.Map<$type_parameters$> $name$;\n");
+}
+
+void MapFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$ = null;\n");
+}
+
+void MapFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "this.$name$ = com.google.protobuf.nano.InternalNano.mergeMapEntry(\n"
+ " input, this.$name$, mapFactory,\n"
+ " com.google.protobuf.nano.InternalNano.$key_desc_type$,\n"
+ " com.google.protobuf.nano.InternalNano.$value_desc_type$,\n"
+ " $value_default$,\n"
+ " $key_tag$, $value_tag$);\n"
+ "\n");
+}
+
+void MapFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null) {\n"
+ " com.google.protobuf.nano.InternalNano.serializeMapField(\n"
+ " output, this.$name$, $number$,\n"
+ " com.google.protobuf.nano.InternalNano.$key_desc_type$,\n"
+ " com.google.protobuf.nano.InternalNano.$value_desc_type$);\n"
+ "}\n");
+}
+
+void MapFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null) {\n"
+ " size += com.google.protobuf.nano.InternalNano.computeMapFieldSize(\n"
+ " this.$name$, $number$,\n"
+ " com.google.protobuf.nano.InternalNano.$key_desc_type$,\n"
+ " com.google.protobuf.nano.InternalNano.$value_desc_type$);\n"
+ "}\n");
+}
+
+void MapFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (!com.google.protobuf.nano.InternalNano.equals(\n"
+ " this.$name$, other.$name$)) {\n"
+ " return false;\n"
+ "}\n");
+}
+
+void MapFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "result = 31 * result +\n"
+ " com.google.protobuf.nano.InternalNano.hashCode(this.$name$);\n");
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/implicit_weak_message.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_map_field.h
index 7a1d4446bf..81e5915dfe 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/implicit_weak_message.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_map_field.h
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,36 +28,43 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <google/protobuf/implicit_weak_message.h>
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_MAP_FIELD_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_MAP_FIELD_H__
-#include <google/protobuf/stubs/once.h>
-#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
-#include <google/protobuf/wire_format_lite.h>
+#include <map>
+#include <string>
+#include <vector>
+#include <google/protobuf/compiler/javanano/javanano_field.h>
namespace google {
namespace protobuf {
-namespace internal {
+namespace compiler {
+namespace javanano {
-bool ImplicitWeakMessage::MergePartialFromCodedStream(io::CodedInputStream* input) {
- io::StringOutputStream string_stream(&data_);
- io::CodedOutputStream coded_stream(&string_stream, false);
- return WireFormatLite::SkipMessage(input, &coded_stream);
-}
+class MapFieldGenerator : public FieldGenerator {
+ public:
+ explicit MapFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params);
+ ~MapFieldGenerator();
-::google::protobuf::internal::ExplicitlyConstructed<ImplicitWeakMessage>
- implicit_weak_message_default_instance;
-GOOGLE_PROTOBUF_DECLARE_ONCE(implicit_weak_message_once_init_);
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
-void InitImplicitWeakMessageDefaultInstance() {
- implicit_weak_message_default_instance.DefaultConstruct();
-}
+ private:
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
-const ImplicitWeakMessage* ImplicitWeakMessage::default_instance() {
- ::google::protobuf::GoogleOnceInit(&implicit_weak_message_once_init_,
- &InitImplicitWeakMessageDefaultInstance);
- return &implicit_weak_message_default_instance.get();
-}
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator);
+};
-} // namespace internal
+} // namespace javanano
+} // namespace compiler
} // namespace protobuf
} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_MAP_FIELD_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message.cc
new file mode 100644
index 0000000000..7842188784
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message.cc
@@ -0,0 +1,676 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <algorithm>
+#include <google/protobuf/stubs/hash.h>
+#include <google/protobuf/compiler/javanano/javanano_message.h>
+#include <google/protobuf/compiler/javanano/javanano_enum.h>
+#include <google/protobuf/compiler/javanano/javanano_extension.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/wire_format.h>
+#include <google/protobuf/descriptor.pb.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+using internal::WireFormat;
+using internal::WireFormatLite;
+
+namespace {
+
+struct FieldOrderingByNumber {
+ inline bool operator()(const FieldDescriptor* a,
+ const FieldDescriptor* b) const {
+ return a->number() < b->number();
+ }
+};
+
+// Sort the fields of the given Descriptor by number into a new[]'d array
+// and return it.
+const FieldDescriptor** SortFieldsByNumber(const Descriptor* descriptor) {
+ const FieldDescriptor** fields =
+ new const FieldDescriptor*[descriptor->field_count()];
+ for (int i = 0; i < descriptor->field_count(); i++) {
+ fields[i] = descriptor->field(i);
+ }
+ std::sort(fields, fields + descriptor->field_count(),
+ FieldOrderingByNumber());
+ return fields;
+}
+
+} // namespace
+
+// ===================================================================
+
+MessageGenerator::MessageGenerator(const Descriptor* descriptor, const Params& params)
+ : params_(params),
+ descriptor_(descriptor),
+ field_generators_(descriptor, params) {
+}
+
+MessageGenerator::~MessageGenerator() {}
+
+void MessageGenerator::GenerateStaticVariables(io::Printer* printer) {
+ // Generate static members for all nested types.
+ for (int i = 0; i < descriptor_->nested_type_count(); i++) {
+ // TODO(kenton): Reuse MessageGenerator objects?
+ if (IsMapEntry(descriptor_->nested_type(i))) continue;
+ MessageGenerator(descriptor_->nested_type(i), params_)
+ .GenerateStaticVariables(printer);
+ }
+}
+
+void MessageGenerator::GenerateStaticVariableInitializers(
+ io::Printer* printer) {
+ // Generate static member initializers for all nested types.
+ for (int i = 0; i < descriptor_->nested_type_count(); i++) {
+ // TODO(kenton): Reuse MessageGenerator objects?
+ if (IsMapEntry(descriptor_->nested_type(i))) continue;
+ MessageGenerator(descriptor_->nested_type(i), params_)
+ .GenerateStaticVariableInitializers(printer);
+ }
+}
+
+void MessageGenerator::Generate(io::Printer* printer) {
+ if (!params_.store_unknown_fields() &&
+ (descriptor_->extension_count() != 0 || descriptor_->extension_range_count() != 0)) {
+ GOOGLE_LOG(FATAL) << "Extensions are only supported in NANO_RUNTIME if the "
+ "'store_unknown_fields' generator option is 'true'\n";
+ }
+
+ const string& file_name = descriptor_->file()->name();
+ bool is_own_file =
+ params_.java_multiple_files(file_name)
+ && descriptor_->containing_type() == NULL;
+
+ if (is_own_file) {
+ // Note: constants (from enums and fields requiring stored defaults, emitted in the loop below)
+ // may have the same names as constants in the nested classes. This causes Java warnings, but
+ // is not fatal, so we suppress those warnings here in the top-most class declaration.
+ printer->Print(
+ "\n"
+ "@SuppressWarnings(\"hiding\")\n"
+ "public final class $classname$ extends\n",
+ "classname", descriptor_->name());
+ } else {
+ printer->Print(
+ "\n"
+ "public static final class $classname$ extends\n",
+ "classname", descriptor_->name());
+ }
+ if (params_.store_unknown_fields() && params_.parcelable_messages()) {
+ printer->Print(
+ " com.google.protobuf.nano.android.ParcelableExtendableMessageNano<$classname$>",
+ "classname", descriptor_->name());
+ } else if (params_.store_unknown_fields()) {
+ printer->Print(
+ " com.google.protobuf.nano.ExtendableMessageNano<$classname$>",
+ "classname", descriptor_->name());
+ } else if (params_.parcelable_messages()) {
+ printer->Print(
+ " com.google.protobuf.nano.android.ParcelableMessageNano");
+ } else {
+ printer->Print(
+ " com.google.protobuf.nano.MessageNano");
+ }
+ if (params_.generate_clone()) {
+ printer->Print(" implements java.lang.Cloneable {\n");
+ } else {
+ printer->Print(" {\n");
+ }
+ printer->Indent();
+
+ if (params_.parcelable_messages()) {
+ printer->Print(
+ "\n"
+ "// Used by Parcelable\n"
+ "@SuppressWarnings({\"unused\"})\n"
+ "public static final android.os.Parcelable.Creator<$classname$> CREATOR =\n"
+ " new com.google.protobuf.nano.android.ParcelableMessageNanoCreator<\n"
+ " $classname$>($classname$.class);\n",
+ "classname", descriptor_->name());
+ }
+
+ // Nested types and extensions
+ for (int i = 0; i < descriptor_->extension_count(); i++) {
+ ExtensionGenerator(descriptor_->extension(i), params_).Generate(printer);
+ }
+
+ for (int i = 0; i < descriptor_->enum_type_count(); i++) {
+ EnumGenerator(descriptor_->enum_type(i), params_).Generate(printer);
+ }
+
+ for (int i = 0; i < descriptor_->nested_type_count(); i++) {
+ if (IsMapEntry(descriptor_->nested_type(i))) continue;
+ MessageGenerator(descriptor_->nested_type(i), params_).Generate(printer);
+ }
+
+ // oneof
+ std::map<string, string> vars;
+ vars["message_name"] = descriptor_->name();
+ for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
+ const OneofDescriptor* oneof_desc = descriptor_->oneof_decl(i);
+ vars["oneof_name"] = UnderscoresToCamelCase(oneof_desc);
+ vars["oneof_capitalized_name"] =
+ UnderscoresToCapitalizedCamelCase(oneof_desc);
+ vars["oneof_index"] = SimpleItoa(oneof_desc->index());
+ // Oneof Constants
+ for (int j = 0; j < oneof_desc->field_count(); j++) {
+ const FieldDescriptor* field = oneof_desc->field(j);
+ vars["number"] = SimpleItoa(field->number());
+ vars["cap_field_name"] = ToUpper(field->name());
+ printer->Print(vars,
+ "public static final int $cap_field_name$_FIELD_NUMBER = $number$;\n");
+ }
+ // oneofCase_ and oneof_
+ printer->Print(vars,
+ "private int $oneof_name$Case_ = 0;\n"
+ "private java.lang.Object $oneof_name$_;\n");
+ printer->Print(vars,
+ "public int get$oneof_capitalized_name$Case() {\n"
+ " return this.$oneof_name$Case_;\n"
+ "}\n");
+ // Oneof clear
+ printer->Print(vars,
+ "public $message_name$ clear$oneof_capitalized_name$() {\n"
+ " this.$oneof_name$Case_ = 0;\n"
+ " this.$oneof_name$_ = null;\n"
+ " return this;\n"
+ "}\n");
+ }
+
+ // Lazy initialization of otherwise static final fields can help prevent the
+ // class initializer from being generated. We want to prevent it because it
+ // stops ProGuard from inlining any methods in this class into call sites and
+ // therefore reducing the method count. However, extensions are best kept as
+ // public static final fields with initializers, so with their existence we
+ // won't bother with lazy initialization.
+ bool lazy_init = descriptor_->extension_count() == 0;
+
+ // Empty array
+ if (lazy_init) {
+ printer->Print(
+ "\n"
+ "private static volatile $classname$[] _emptyArray;\n"
+ "public static $classname$[] emptyArray() {\n"
+ " // Lazily initializes the empty array\n"
+ " if (_emptyArray == null) {\n"
+ " synchronized (\n"
+ " com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK) {\n"
+ " if (_emptyArray == null) {\n"
+ " _emptyArray = new $classname$[0];\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ " return _emptyArray;\n"
+ "}\n",
+ "classname", descriptor_->name());
+ } else {
+ printer->Print(
+ "\n"
+ "private static final $classname$[] EMPTY_ARRAY = {};\n"
+ "public static $classname$[] emptyArray() {\n"
+ " return EMPTY_ARRAY;\n"
+ "}\n",
+ "classname", descriptor_->name());
+ }
+
+ // Integers for bit fields
+ int totalInts = (field_generators_.total_bits() + 31) / 32;
+ if (totalInts > 0) {
+ printer->Print("\n");
+ for (int i = 0; i < totalInts; i++) {
+ printer->Print("private int $bit_field_name$;\n",
+ "bit_field_name", GetBitFieldName(i));
+ }
+ }
+
+ // Fields and maybe their default values
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ printer->Print("\n");
+ PrintFieldComment(printer, descriptor_->field(i));
+ field_generators_.get(descriptor_->field(i)).GenerateMembers(
+ printer, lazy_init);
+ }
+
+ // Constructor, with lazy init code if needed
+ if (lazy_init && field_generators_.saved_defaults_needed()) {
+ printer->Print(
+ "\n"
+ "private static volatile boolean _classInitialized;\n"
+ "\n"
+ "public $classname$() {\n"
+ " // Lazily initializes the field defaults\n"
+ " if (!_classInitialized) {\n"
+ " synchronized (\n"
+ " com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK) {\n"
+ " if (!_classInitialized) {\n",
+ "classname", descriptor_->name());
+ printer->Indent();
+ printer->Indent();
+ printer->Indent();
+ printer->Indent();
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ field_generators_.get(descriptor_->field(i))
+ .GenerateInitSavedDefaultCode(printer);
+ }
+ printer->Outdent();
+ printer->Outdent();
+ printer->Outdent();
+ printer->Outdent();
+ printer->Print(
+ " _classInitialized = true;\n"
+ " }\n"
+ " }\n"
+ " }\n");
+ if (params_.generate_clear()) {
+ printer->Print(" clear();\n");
+ }
+ printer->Print("}\n");
+ } else {
+ printer->Print(
+ "\n"
+ "public $classname$() {\n",
+ "classname", descriptor_->name());
+ if (params_.generate_clear()) {
+ printer->Print(" clear();\n");
+ } else {
+ printer->Indent();
+ GenerateFieldInitializers(printer);
+ printer->Outdent();
+ }
+ printer->Print("}\n");
+ }
+
+ // Other methods in this class
+
+ GenerateClear(printer);
+
+ if (params_.generate_clone()) {
+ GenerateClone(printer);
+ }
+
+ if (params_.generate_equals()) {
+ GenerateEquals(printer);
+ GenerateHashCode(printer);
+ }
+
+ GenerateMessageSerializationMethods(printer);
+ GenerateMergeFromMethods(printer);
+ GenerateParseFromMethods(printer);
+
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+// ===================================================================
+
+void MessageGenerator::
+GenerateMessageSerializationMethods(io::Printer* printer) {
+ // Rely on the parent implementations of writeTo() and getSerializedSize()
+ // if there are no fields to serialize in this message.
+ if (descriptor_->field_count() == 0) {
+ return;
+ }
+
+ scoped_array<const FieldDescriptor*> sorted_fields(
+ SortFieldsByNumber(descriptor_));
+
+ printer->Print(
+ "\n"
+ "@Override\n"
+ "public void writeTo(com.google.protobuf.nano.CodedOutputByteBufferNano output)\n"
+ " throws java.io.IOException {\n");
+ printer->Indent();
+
+ // Output the fields in sorted order
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ GenerateSerializeOneField(printer, sorted_fields[i]);
+ }
+
+ // The parent implementation will write any unknown fields if necessary.
+ printer->Print(
+ "super.writeTo(output);\n");
+
+ printer->Outdent();
+ printer->Print("}\n");
+
+ // The parent implementation will get the serialized size for unknown
+ // fields if necessary.
+ printer->Print(
+ "\n"
+ "@Override\n"
+ "protected int computeSerializedSize() {\n"
+ " int size = super.computeSerializedSize();\n");
+ printer->Indent();
+
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ field_generators_.get(sorted_fields[i]).GenerateSerializedSizeCode(printer);
+ }
+
+ printer->Outdent();
+ printer->Print(
+ " return size;\n"
+ "}\n");
+}
+
+void MessageGenerator::GenerateMergeFromMethods(io::Printer* printer) {
+ scoped_array<const FieldDescriptor*> sorted_fields(
+ SortFieldsByNumber(descriptor_));
+
+ printer->Print(
+ "\n"
+ "@Override\n"
+ "public $classname$ mergeFrom(\n"
+ " com.google.protobuf.nano.CodedInputByteBufferNano input)\n"
+ " throws java.io.IOException {\n",
+ "classname", descriptor_->name());
+
+ printer->Indent();
+ if (HasMapField(descriptor_)) {
+ printer->Print(
+ "com.google.protobuf.nano.MapFactories.MapFactory mapFactory =\n"
+ " com.google.protobuf.nano.MapFactories.getMapFactory();\n");
+ }
+
+ printer->Print(
+ "while (true) {\n");
+ printer->Indent();
+
+ printer->Print(
+ "int tag = input.readTag();\n"
+ "switch (tag) {\n");
+ printer->Indent();
+
+ printer->Print(
+ "case 0:\n" // zero signals EOF / limit reached
+ " return this;\n"
+ "default: {\n");
+
+ printer->Indent();
+ if (params_.store_unknown_fields()) {
+ printer->Print(
+ "if (!storeUnknownField(input, tag)) {\n"
+ " return this;\n"
+ "}\n");
+ } else {
+ printer->Print(
+ "if (!com.google.protobuf.nano.WireFormatNano.parseUnknownField(input, tag)) {\n"
+ " return this;\n" // it's an endgroup tag
+ "}\n");
+ }
+ printer->Print("break;\n");
+ printer->Outdent();
+ printer->Print("}\n");
+
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ const FieldDescriptor* field = sorted_fields[i];
+ uint32 tag = WireFormatLite::MakeTag(field->number(),
+ WireFormat::WireTypeForFieldType(field->type()));
+
+ printer->Print(
+ "case $tag$: {\n",
+ "tag", SimpleItoa(tag));
+ printer->Indent();
+
+ field_generators_.get(field).GenerateMergingCode(printer);
+
+ printer->Outdent();
+ printer->Print(
+ " break;\n"
+ "}\n");
+
+ if (field->is_packable()) {
+ // To make packed = true wire compatible, we generate parsing code from a
+ // packed version of this field regardless of field->options().packed().
+ uint32 packed_tag = WireFormatLite::MakeTag(field->number(),
+ WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
+ printer->Print(
+ "case $tag$: {\n",
+ "tag", SimpleItoa(packed_tag));
+ printer->Indent();
+
+ field_generators_.get(field).GenerateMergingCodeFromPacked(printer);
+
+ printer->Outdent();
+ printer->Print(
+ " break;\n"
+ "}\n");
+ }
+ }
+
+ printer->Outdent();
+ printer->Outdent();
+ printer->Outdent();
+ printer->Print(
+ " }\n" // switch (tag)
+ " }\n" // while (true)
+ "}\n");
+}
+
+void MessageGenerator::
+GenerateParseFromMethods(io::Printer* printer) {
+ // Note: These are separate from GenerateMessageSerializationMethods()
+ // because they need to be generated even for messages that are optimized
+ // for code size.
+ printer->Print(
+ "\n"
+ "public static $classname$ parseFrom(byte[] data)\n"
+ " throws com.google.protobuf.nano.InvalidProtocolBufferNanoException {\n"
+ " return com.google.protobuf.nano.MessageNano.mergeFrom(new $classname$(), data);\n"
+ "}\n"
+ "\n"
+ "public static $classname$ parseFrom(\n"
+ " com.google.protobuf.nano.CodedInputByteBufferNano input)\n"
+ " throws java.io.IOException {\n"
+ " return new $classname$().mergeFrom(input);\n"
+ "}\n",
+ "classname", descriptor_->name());
+}
+
+void MessageGenerator::GenerateSerializeOneField(
+ io::Printer* printer, const FieldDescriptor* field) {
+ field_generators_.get(field).GenerateSerializationCode(printer);
+}
+
+void MessageGenerator::GenerateClear(io::Printer* printer) {
+ if (!params_.generate_clear()) {
+ return;
+ }
+ printer->Print(
+ "\n"
+ "public $classname$ clear() {\n",
+ "classname", descriptor_->name());
+ printer->Indent();
+
+ GenerateFieldInitializers(printer);
+
+ printer->Outdent();
+ printer->Print(
+ " return this;\n"
+ "}\n");
+}
+
+void MessageGenerator::GenerateFieldInitializers(io::Printer* printer) {
+ // Clear bit fields.
+ int totalInts = (field_generators_.total_bits() + 31) / 32;
+ for (int i = 0; i < totalInts; i++) {
+ printer->Print("$bit_field_name$ = 0;\n",
+ "bit_field_name", GetBitFieldName(i));
+ }
+
+ // Call clear for all of the fields.
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ const FieldDescriptor* field = descriptor_->field(i);
+ field_generators_.get(field).GenerateClearCode(printer);
+ }
+
+ // Clear oneofs.
+ for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
+ printer->Print(
+ "clear$oneof_capitalized_name$();\n",
+ "oneof_capitalized_name", UnderscoresToCapitalizedCamelCase(
+ descriptor_->oneof_decl(i)));
+ }
+
+ // Clear unknown fields.
+ if (params_.store_unknown_fields()) {
+ printer->Print("unknownFieldData = null;\n");
+ }
+ printer->Print("cachedSize = -1;\n");
+}
+
+void MessageGenerator::GenerateClone(io::Printer* printer) {
+ printer->Print(
+ "@Override\n"
+ "public $classname$ clone() {\n",
+ "classname", descriptor_->name());
+ printer->Indent();
+
+ printer->Print(
+ "$classname$ cloned;\n"
+ "try {\n"
+ " cloned = ($classname$) super.clone();\n"
+ "} catch (java.lang.CloneNotSupportedException e) {\n"
+ " throw new java.lang.AssertionError(e);\n"
+ "}\n",
+ "classname", descriptor_->name());
+
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ field_generators_.get(descriptor_->field(i)).GenerateFixClonedCode(printer);
+ }
+
+ printer->Outdent();
+ printer->Print(
+ " return cloned;\n"
+ "}\n"
+ "\n");
+}
+
+void MessageGenerator::GenerateEquals(io::Printer* printer) {
+ // Don't override if there are no fields. We could generate an
+ // equals method that compares types, but often empty messages
+ // are used as namespaces.
+ if (descriptor_->field_count() == 0 && !params_.store_unknown_fields()) {
+ return;
+ }
+
+ printer->Print(
+ "\n"
+ "@Override\n"
+ "public boolean equals(Object o) {\n");
+ printer->Indent();
+ printer->Print(
+ "if (o == this) {\n"
+ " return true;\n"
+ "}\n"
+ "if (!(o instanceof $classname$)) {\n"
+ " return false;\n"
+ "}\n"
+ "$classname$ other = ($classname$) o;\n",
+ "classname", descriptor_->name());
+
+ // Checking oneof case before checking each oneof field.
+ for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
+ const OneofDescriptor* oneof_desc = descriptor_->oneof_decl(i);
+ printer->Print(
+ "if (this.$oneof_name$Case_ != other.$oneof_name$Case_) {\n"
+ " return false;\n"
+ "}\n",
+ "oneof_name", UnderscoresToCamelCase(oneof_desc));
+ }
+
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ const FieldDescriptor* field = descriptor_->field(i);
+ field_generators_.get(field).GenerateEqualsCode(printer);
+ }
+
+ if (params_.store_unknown_fields()) {
+ printer->Print(
+ "if (unknownFieldData == null || unknownFieldData.isEmpty()) {\n"
+ " return other.unknownFieldData == null || other.unknownFieldData.isEmpty();\n"
+ "} else {\n"
+ " return unknownFieldData.equals(other.unknownFieldData);\n"
+ "}");
+ } else {
+ printer->Print(
+ "return true;\n");
+ }
+
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+void MessageGenerator::GenerateHashCode(io::Printer* printer) {
+ if (descriptor_->field_count() == 0 && !params_.store_unknown_fields()) {
+ return;
+ }
+
+ printer->Print(
+ "\n"
+ "@Override\n"
+ "public int hashCode() {\n");
+ printer->Indent();
+
+ printer->Print("int result = 17;\n");
+ printer->Print("result = 31 * result + getClass().getName().hashCode();\n");
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ const FieldDescriptor* field = descriptor_->field(i);
+ field_generators_.get(field).GenerateHashCodeCode(printer);
+ }
+
+ if (params_.store_unknown_fields()) {
+ printer->Print(
+ "result = 31 * result + \n"
+ " (unknownFieldData == null || unknownFieldData.isEmpty() ? 0 : \n"
+ " unknownFieldData.hashCode());\n");
+ }
+
+ printer->Print("return result;\n");
+
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+// ===================================================================
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message.h
new file mode 100644
index 0000000000..281ec64fdd
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message.h
@@ -0,0 +1,97 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_MESSAGE_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_MESSAGE_H__
+
+#include <string>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/compiler/javanano/javanano_field.h>
+#include <google/protobuf/compiler/javanano/javanano_params.h>
+#include <google/protobuf/stubs/common.h>
+
+namespace google {
+namespace protobuf {
+ namespace io {
+ class Printer; // printer.h
+ }
+}
+
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+class MessageGenerator {
+ public:
+ explicit MessageGenerator(const Descriptor* descriptor, const Params& params);
+ ~MessageGenerator();
+
+ // All static variables have to be declared at the top-level of the file
+ // so that we can control initialization order, which is important for
+ // DescriptorProto bootstrapping to work.
+ void GenerateStaticVariables(io::Printer* printer);
+
+ // Output code which initializes the static variables generated by
+ // GenerateStaticVariables().
+ void GenerateStaticVariableInitializers(io::Printer* printer);
+
+ // Generate the class itself.
+ void Generate(io::Printer* printer);
+
+ private:
+ void GenerateMessageSerializationMethods(io::Printer* printer);
+ void GenerateMergeFromMethods(io::Printer* printer);
+ void GenerateParseFromMethods(io::Printer* printer);
+ void GenerateSerializeOneField(io::Printer* printer,
+ const FieldDescriptor* field);
+
+ void GenerateClear(io::Printer* printer);
+ void GenerateFieldInitializers(io::Printer* printer);
+ void GenerateEquals(io::Printer* printer);
+ void GenerateHashCode(io::Printer* printer);
+ void GenerateClone(io::Printer* printer);
+
+ const Params& params_;
+ const Descriptor* descriptor_;
+ FieldGeneratorMap field_generators_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
+};
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+
+} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_MESSAGE_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message_field.cc
new file mode 100644
index 0000000000..2ed8a3aa66
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message_field.cc
@@ -0,0 +1,363 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <map>
+#include <string>
+
+#include <google/protobuf/compiler/javanano/javanano_message_field.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/wire_format.h>
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+using internal::WireFormat;
+using internal::WireFormatLite;
+
+namespace {
+
+// TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of
+// repeat code between this and the other field types.
+void SetMessageVariables(const Params& params,
+ const FieldDescriptor* descriptor, std::map<string, string>* variables) {
+ (*variables)["name"] =
+ RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
+ (*variables)["capitalized_name"] =
+ RenameJavaKeywords(UnderscoresToCapitalizedCamelCase(descriptor));
+ (*variables)["number"] = SimpleItoa(descriptor->number());
+ (*variables)["type"] = ClassName(params, descriptor->message_type());
+ (*variables)["group_or_message"] =
+ (descriptor->type() == FieldDescriptor::TYPE_GROUP) ?
+ "Group" : "Message";
+ (*variables)["message_name"] = descriptor->containing_type()->name();
+ //(*variables)["message_type"] = descriptor->message_type()->name();
+ (*variables)["tag"] = SimpleItoa(WireFormat::MakeTag(descriptor));
+}
+
+} // namespace
+
+// ===================================================================
+
+MessageFieldGenerator::
+MessageFieldGenerator(const FieldDescriptor* descriptor, const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetMessageVariables(params, descriptor, &variables_);
+}
+
+MessageFieldGenerator::~MessageFieldGenerator() {}
+
+void MessageFieldGenerator::
+GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
+ printer->Print(variables_,
+ "public $type$ $name$;\n");
+}
+
+void MessageFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$ = null;\n");
+}
+
+void MessageFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ == null) {\n"
+ " this.$name$ = new $type$();\n"
+ "}\n");
+
+ if (descriptor_->type() == FieldDescriptor::TYPE_GROUP) {
+ printer->Print(variables_,
+ "input.readGroup(this.$name$, $number$);\n");
+ } else {
+ printer->Print(variables_,
+ "input.readMessage(this.$name$);\n");
+ }
+}
+
+void MessageFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null) {\n"
+ " output.write$group_or_message$($number$, this.$name$);\n"
+ "}\n");
+}
+
+void MessageFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null) {\n"
+ " size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .compute$group_or_message$Size($number$, this.$name$);\n"
+ "}\n");
+}
+
+void MessageFieldGenerator::
+GenerateFixClonedCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null) {\n"
+ " cloned.$name$ = this.$name$.clone();\n"
+ "}\n");
+}
+
+void MessageFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ == null) { \n"
+ " if (other.$name$ != null) {\n"
+ " return false;\n"
+ " }\n"
+ "} else {\n"
+ " if (!this.$name$.equals(other.$name$)) {\n"
+ " return false;\n"
+ " }\n"
+ "}\n");
+}
+
+void MessageFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "result = 31 * result +\n"
+ " (this.$name$ == null ? 0 : this.$name$.hashCode());\n");
+}
+// ===================================================================
+
+MessageOneofFieldGenerator::MessageOneofFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetMessageVariables(params, descriptor, &variables_);
+ SetCommonOneofVariables(descriptor, &variables_);
+}
+
+MessageOneofFieldGenerator::~MessageOneofFieldGenerator() {}
+
+void MessageOneofFieldGenerator::
+GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
+ printer->Print(variables_,
+ "public boolean has$capitalized_name$() {\n"
+ " return $has_oneof_case$;\n"
+ "}\n"
+ "public $type$ get$capitalized_name$() {\n"
+ " if ($has_oneof_case$) {\n"
+ " return ($type$) this.$oneof_name$_;\n"
+ " }\n"
+ " return null;\n"
+ "}\n"
+ "public $message_name$ set$capitalized_name$($type$ value) {\n"
+ " if (value == null) { throw new java.lang.NullPointerException(); }\n"
+ " $set_oneof_case$;\n"
+ " this.$oneof_name$_ = value;\n"
+ " return this;\n"
+ "}\n");
+}
+
+void MessageOneofFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ // No clear method for oneof fields.
+}
+
+void MessageOneofFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (!($has_oneof_case$)) {\n"
+ " this.$oneof_name$_ = new $type$();\n"
+ "}\n"
+ "input.readMessage(\n"
+ " (com.google.protobuf.nano.MessageNano) this.$oneof_name$_);\n"
+ "$set_oneof_case$;\n");
+}
+
+void MessageOneofFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($has_oneof_case$) {\n"
+ " output.writeMessage($number$,\n"
+ " (com.google.protobuf.nano.MessageNano) this.$oneof_name$_);\n"
+ "}\n");
+}
+
+void MessageOneofFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($has_oneof_case$) {\n"
+ " size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .computeMessageSize($number$,\n"
+ " (com.google.protobuf.nano.MessageNano) this.$oneof_name$_);\n"
+ "}\n");
+}
+
+void MessageOneofFieldGenerator::
+GenerateFixClonedCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$oneof_name$ != null) {\n"
+ " cloned.$oneof_name$ = this.$oneof_name$.clone();\n"
+ "}\n");
+}
+
+void MessageOneofFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ GenerateOneofFieldEquals(descriptor_, variables_, printer);
+}
+
+void MessageOneofFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ GenerateOneofFieldHashCode(descriptor_, variables_, printer);
+}
+
+// ===================================================================
+
+RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetMessageVariables(params, descriptor, &variables_);
+}
+
+RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {}
+
+void RepeatedMessageFieldGenerator::
+GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
+ printer->Print(variables_,
+ "public $type$[] $name$;\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$ = $type$.emptyArray();\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ // First, figure out the length of the array, then parse.
+ printer->Print(variables_,
+ "int arrayLength = com.google.protobuf.nano.WireFormatNano\n"
+ " .getRepeatedFieldArrayLength(input, $tag$);\n"
+ "int i = this.$name$ == null ? 0 : this.$name$.length;\n"
+ "$type$[] newArray =\n"
+ " new $type$[i + arrayLength];\n"
+ "if (i != 0) {\n"
+ " java.lang.System.arraycopy(this.$name$, 0, newArray, 0, i);\n"
+ "}\n"
+ "for (; i < newArray.length - 1; i++) {\n"
+ " newArray[i] = new $type$();\n");
+
+ if (descriptor_->type() == FieldDescriptor::TYPE_GROUP) {
+ printer->Print(variables_,
+ " input.readGroup(newArray[i], $number$);\n");
+ } else {
+ printer->Print(variables_,
+ " input.readMessage(newArray[i]);\n");
+ }
+
+ printer->Print(variables_,
+ " input.readTag();\n"
+ "}\n"
+ "// Last one without readTag.\n"
+ "newArray[i] = new $type$();\n");
+
+ if (descriptor_->type() == FieldDescriptor::TYPE_GROUP) {
+ printer->Print(variables_,
+ "input.readGroup(newArray[i], $number$);\n");
+ } else {
+ printer->Print(variables_,
+ "input.readMessage(newArray[i]);\n");
+ }
+
+ printer->Print(variables_,
+ "this.$name$ = newArray;\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n"
+ " for (int i = 0; i < this.$name$.length; i++) {\n"
+ " $type$ element = this.$name$[i];\n"
+ " if (element != null) {\n"
+ " output.write$group_or_message$($number$, element);\n"
+ " }\n"
+ " }\n"
+ "}\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n"
+ " for (int i = 0; i < this.$name$.length; i++) {\n"
+ " $type$ element = this.$name$[i];\n"
+ " if (element != null) {\n"
+ " size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .compute$group_or_message$Size($number$, element);\n"
+ " }\n"
+ " }\n"
+ "}\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateFixClonedCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n"
+ " cloned.$name$ = new $type$[this.$name$.length];\n"
+ " for (int i = 0; i < this.$name$.length; i++) {\n"
+ " if (this.$name$[i] != null) {\n"
+ " cloned.$name$[i] = this.$name$[i].clone();\n"
+ " }\n"
+ " }\n"
+ "}\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (!com.google.protobuf.nano.InternalNano.equals(\n"
+ " this.$name$, other.$name$)) {\n"
+ " return false;\n"
+ "}\n");
+}
+
+void RepeatedMessageFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "result = 31 * result\n"
+ " + com.google.protobuf.nano.InternalNano.hashCode(this.$name$);\n");
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message_field.h
new file mode 100644
index 0000000000..0ae8879ba2
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_message_field.h
@@ -0,0 +1,121 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_MESSAGE_FIELD_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_MESSAGE_FIELD_H__
+
+#include <map>
+#include <string>
+#include <google/protobuf/compiler/javanano/javanano_field.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+class MessageFieldGenerator : public FieldGenerator {
+ public:
+ explicit MessageFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params);
+ ~MessageFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+ void GenerateFixClonedCode(io::Printer* printer) const;
+
+ private:
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
+};
+
+class MessageOneofFieldGenerator : public FieldGenerator {
+ public:
+ explicit MessageOneofFieldGenerator(const FieldDescriptor* descriptor,
+ const Params& params);
+ ~MessageOneofFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+ void GenerateFixClonedCode(io::Printer* printer) const;
+
+ private:
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator);
+};
+
+class RepeatedMessageFieldGenerator : public FieldGenerator {
+ public:
+ explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor,
+ const Params& params);
+ ~RepeatedMessageFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+ void GenerateFixClonedCode(io::Printer* printer) const;
+
+ private:
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
+};
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+
+} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_MESSAGE_FIELD_H__
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_params.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_params.h
new file mode 100644
index 0000000000..3594767d67
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_params.h
@@ -0,0 +1,258 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2010 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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: wink@google.com (Wink Saville)
+
+#ifndef PROTOBUF_COMPILER_JAVANANO_JAVANANO_PARAMS_H_
+#define PROTOBUF_COMPILER_JAVANANO_JAVANANO_PARAMS_H_
+
+#include <map>
+#include <set>
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+enum eMultipleFiles { JAVANANO_MUL_UNSET, JAVANANO_MUL_FALSE, JAVANANO_MUL_TRUE };
+
+// Parameters for used by the generators
+class Params {
+ public:
+ typedef std::map<string, string> NameMap;
+ typedef std::set<string> NameSet;
+ private:
+ string empty_;
+ string base_name_;
+ eMultipleFiles override_java_multiple_files_;
+ bool store_unknown_fields_;
+ NameMap java_packages_;
+ NameMap java_outer_classnames_;
+ NameSet java_multiple_files_;
+ bool generate_has_;
+ bool java_enum_style_;
+ bool optional_field_accessors_;
+ bool use_reference_types_for_primitives_;
+ bool generate_equals_;
+ bool ignore_services_;
+ bool parcelable_messages_;
+ bool reftypes_primitive_enums_;
+ bool generate_clear_;
+ bool generate_clone_;
+ bool generate_intdefs_;
+
+ public:
+ Params(const string & base_name) :
+ empty_(""),
+ base_name_(base_name),
+ override_java_multiple_files_(JAVANANO_MUL_UNSET),
+ store_unknown_fields_(false),
+ generate_has_(false),
+ java_enum_style_(false),
+ optional_field_accessors_(false),
+ use_reference_types_for_primitives_(false),
+ generate_equals_(false),
+ ignore_services_(false),
+ parcelable_messages_(false),
+ reftypes_primitive_enums_(false),
+ generate_clear_(true),
+ generate_clone_(false),
+ generate_intdefs_(false) {
+ }
+
+ const string& base_name() const {
+ return base_name_;
+ }
+
+ bool has_java_package(const string& file_name) const {
+ return java_packages_.find(file_name)
+ != java_packages_.end();
+ }
+ void set_java_package(const string& file_name,
+ const string& java_package) {
+ java_packages_[file_name] = java_package;
+ }
+ const string& java_package(const string& file_name) const {
+ NameMap::const_iterator itr;
+
+ itr = java_packages_.find(file_name);
+ if (itr == java_packages_.end()) {
+ return empty_;
+ } else {
+ return itr->second;
+ }
+ }
+ const NameMap& java_packages() {
+ return java_packages_;
+ }
+
+ bool has_java_outer_classname(const string& file_name) const {
+ return java_outer_classnames_.find(file_name)
+ != java_outer_classnames_.end();
+ }
+ void set_java_outer_classname(const string& file_name,
+ const string& java_outer_classname) {
+ java_outer_classnames_[file_name] = java_outer_classname;
+ }
+ const string& java_outer_classname(const string& file_name) const {
+ NameMap::const_iterator itr;
+
+ itr = java_outer_classnames_.find(file_name);
+ if (itr == java_outer_classnames_.end()) {
+ return empty_;
+ } else {
+ return itr->second;
+ }
+ }
+ const NameMap& java_outer_classnames() {
+ return java_outer_classnames_;
+ }
+
+ void set_override_java_multiple_files(bool java_multiple_files) {
+ if (java_multiple_files) {
+ override_java_multiple_files_ = JAVANANO_MUL_TRUE;
+ } else {
+ override_java_multiple_files_ = JAVANANO_MUL_FALSE;
+ }
+ }
+ void clear_override_java_multiple_files() {
+ override_java_multiple_files_ = JAVANANO_MUL_UNSET;
+ }
+
+ void set_java_multiple_files(const string& file_name, bool value) {
+ if (value) {
+ java_multiple_files_.insert(file_name);
+ } else {
+ java_multiple_files_.erase(file_name);
+ }
+ }
+ bool java_multiple_files(const string& file_name) const {
+ switch (override_java_multiple_files_) {
+ case JAVANANO_MUL_FALSE:
+ return false;
+ case JAVANANO_MUL_TRUE:
+ return true;
+ default:
+ return java_multiple_files_.find(file_name)
+ != java_multiple_files_.end();
+ }
+ }
+
+ void set_store_unknown_fields(bool value) {
+ store_unknown_fields_ = value;
+ }
+ bool store_unknown_fields() const {
+ return store_unknown_fields_;
+ }
+
+ void set_generate_has(bool value) {
+ generate_has_ = value;
+ }
+ bool generate_has() const {
+ return generate_has_;
+ }
+
+ void set_java_enum_style(bool value) {
+ java_enum_style_ = value;
+ }
+ bool java_enum_style() const {
+ return java_enum_style_;
+ }
+
+ void set_optional_field_accessors(bool value) {
+ optional_field_accessors_ = value;
+ }
+ bool optional_field_accessors() const {
+ return optional_field_accessors_;
+ }
+
+ void set_use_reference_types_for_primitives(bool value) {
+ use_reference_types_for_primitives_ = value;
+ }
+ bool use_reference_types_for_primitives() const {
+ return use_reference_types_for_primitives_;
+ }
+
+ void set_generate_equals(bool value) {
+ generate_equals_ = value;
+ }
+ bool generate_equals() const {
+ return generate_equals_;
+ }
+
+ void set_ignore_services(bool value) {
+ ignore_services_ = value;
+ }
+ bool ignore_services() const {
+ return ignore_services_;
+ }
+
+ void set_parcelable_messages(bool value) {
+ parcelable_messages_ = value;
+ }
+ bool parcelable_messages() const {
+ return parcelable_messages_;
+ }
+
+ void set_reftypes_primitive_enums(bool value) {
+ reftypes_primitive_enums_ = value;
+ }
+ bool reftypes_primitive_enums() const {
+ return reftypes_primitive_enums_;
+ }
+
+ void set_generate_clear(bool value) {
+ generate_clear_ = value;
+ }
+ bool generate_clear() const {
+ return generate_clear_;
+ }
+
+ void set_generate_clone(bool value) {
+ generate_clone_ = value;
+ }
+ bool generate_clone() const {
+ return generate_clone_;
+ }
+
+ void set_generate_intdefs(bool value) {
+ generate_intdefs_ = value;
+ }
+ bool generate_intdefs() const {
+ return generate_intdefs_;
+ }
+};
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
+#endif // PROTOBUF_COMPILER_JAVANANO_JAVANANO_PARAMS_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
new file mode 100644
index 0000000000..66a0ff057c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
@@ -0,0 +1,968 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <map>
+#include <math.h>
+#include <string>
+
+#include <google/protobuf/compiler/javanano/javanano_primitive_field.h>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/compiler/javanano/javanano_helpers.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/wire_format.h>
+#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/stubs/substitute.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+using internal::WireFormat;
+using internal::WireFormatLite;
+
+namespace {
+
+bool IsReferenceType(JavaType type) {
+ switch (type) {
+ case JAVATYPE_INT : return false;
+ case JAVATYPE_LONG : return false;
+ case JAVATYPE_FLOAT : return false;
+ case JAVATYPE_DOUBLE : return false;
+ case JAVATYPE_BOOLEAN: return false;
+ case JAVATYPE_STRING : return true;
+ case JAVATYPE_BYTES : return true;
+ case JAVATYPE_ENUM : return false;
+ case JAVATYPE_MESSAGE: return true;
+
+ // No default because we want the compiler to complain if any new
+ // JavaTypes are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return false;
+}
+
+bool IsArrayType(JavaType type) {
+ switch (type) {
+ case JAVATYPE_INT : return false;
+ case JAVATYPE_LONG : return false;
+ case JAVATYPE_FLOAT : return false;
+ case JAVATYPE_DOUBLE : return false;
+ case JAVATYPE_BOOLEAN: return false;
+ case JAVATYPE_STRING : return false;
+ case JAVATYPE_BYTES : return true;
+ case JAVATYPE_ENUM : return false;
+ case JAVATYPE_MESSAGE: return false;
+
+ // No default because we want the compiler to complain if any new
+ // JavaTypes are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return false;
+}
+
+const char* GetCapitalizedType(const FieldDescriptor* field) {
+ switch (field->type()) {
+ case FieldDescriptor::TYPE_INT32 : return "Int32" ;
+ case FieldDescriptor::TYPE_UINT32 : return "UInt32" ;
+ case FieldDescriptor::TYPE_SINT32 : return "SInt32" ;
+ case FieldDescriptor::TYPE_FIXED32 : return "Fixed32" ;
+ case FieldDescriptor::TYPE_SFIXED32: return "SFixed32";
+ case FieldDescriptor::TYPE_INT64 : return "Int64" ;
+ case FieldDescriptor::TYPE_UINT64 : return "UInt64" ;
+ case FieldDescriptor::TYPE_SINT64 : return "SInt64" ;
+ case FieldDescriptor::TYPE_FIXED64 : return "Fixed64" ;
+ case FieldDescriptor::TYPE_SFIXED64: return "SFixed64";
+ case FieldDescriptor::TYPE_FLOAT : return "Float" ;
+ case FieldDescriptor::TYPE_DOUBLE : return "Double" ;
+ case FieldDescriptor::TYPE_BOOL : return "Bool" ;
+ case FieldDescriptor::TYPE_STRING : return "String" ;
+ case FieldDescriptor::TYPE_BYTES : return "Bytes" ;
+ case FieldDescriptor::TYPE_ENUM : return "Enum" ;
+ case FieldDescriptor::TYPE_GROUP : return "Group" ;
+ case FieldDescriptor::TYPE_MESSAGE : return "Message" ;
+
+ // No default because we want the compiler to complain if any new
+ // types are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return NULL;
+}
+
+// For encodings with fixed sizes, returns that size in bytes. Otherwise
+// returns -1.
+int FixedSize(FieldDescriptor::Type type) {
+ switch (type) {
+ case FieldDescriptor::TYPE_INT32 : return -1;
+ case FieldDescriptor::TYPE_INT64 : return -1;
+ case FieldDescriptor::TYPE_UINT32 : return -1;
+ case FieldDescriptor::TYPE_UINT64 : return -1;
+ case FieldDescriptor::TYPE_SINT32 : return -1;
+ case FieldDescriptor::TYPE_SINT64 : return -1;
+ case FieldDescriptor::TYPE_FIXED32 : return WireFormatLite::kFixed32Size;
+ case FieldDescriptor::TYPE_FIXED64 : return WireFormatLite::kFixed64Size;
+ case FieldDescriptor::TYPE_SFIXED32: return WireFormatLite::kSFixed32Size;
+ case FieldDescriptor::TYPE_SFIXED64: return WireFormatLite::kSFixed64Size;
+ case FieldDescriptor::TYPE_FLOAT : return WireFormatLite::kFloatSize;
+ case FieldDescriptor::TYPE_DOUBLE : return WireFormatLite::kDoubleSize;
+
+ case FieldDescriptor::TYPE_BOOL : return WireFormatLite::kBoolSize;
+ case FieldDescriptor::TYPE_ENUM : return -1;
+
+ case FieldDescriptor::TYPE_STRING : return -1;
+ case FieldDescriptor::TYPE_BYTES : return -1;
+ case FieldDescriptor::TYPE_GROUP : return -1;
+ case FieldDescriptor::TYPE_MESSAGE : return -1;
+
+ // No default because we want the compiler to complain if any new
+ // types are added.
+ }
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return -1;
+}
+
+bool AllAscii(const string& text) {
+ for (int i = 0; i < text.size(); i++) {
+ if ((text[i] & 0x80) != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+void SetPrimitiveVariables(const FieldDescriptor* descriptor, const Params params,
+ std::map<string, string>* variables) {
+ (*variables)["name"] =
+ RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
+ (*variables)["capitalized_name"] =
+ RenameJavaKeywords(UnderscoresToCapitalizedCamelCase(descriptor));
+ (*variables)["number"] = SimpleItoa(descriptor->number());
+ if (params.use_reference_types_for_primitives()
+ && !descriptor->is_repeated()) {
+ (*variables)["type"] = BoxedPrimitiveTypeName(GetJavaType(descriptor));
+ } else {
+ (*variables)["type"] = PrimitiveTypeName(GetJavaType(descriptor));
+ }
+ // Deals with defaults. For C++-string types (string and bytes),
+ // we might need to have the generated code do the unicode decoding
+ // (see comments in InternalNano.java for gory details.). We would
+ // like to do this once into a static field and re-use that from
+ // then on.
+ if (descriptor->cpp_type() == FieldDescriptor::CPPTYPE_STRING &&
+ !descriptor->default_value_string().empty() &&
+ !params.use_reference_types_for_primitives()) {
+ if (descriptor->type() == FieldDescriptor::TYPE_BYTES) {
+ (*variables)["default"] = DefaultValue(params, descriptor);
+ (*variables)["default_constant"] = FieldDefaultConstantName(descriptor);
+ (*variables)["default_constant_value"] = strings::Substitute(
+ "com.google.protobuf.nano.InternalNano.bytesDefaultValue(\"$0\")",
+ CEscape(descriptor->default_value_string()));
+ (*variables)["default_copy_if_needed"] =
+ (*variables)["default"] + ".clone()";
+ } else if (AllAscii(descriptor->default_value_string())) {
+ // All chars are ASCII. In this case directly referencing a
+ // CEscape()'d string literal works fine.
+ (*variables)["default"] =
+ "\"" + CEscape(descriptor->default_value_string()) + "\"";
+ (*variables)["default_copy_if_needed"] = (*variables)["default"];
+ } else {
+ // Strings where some chars are non-ASCII. We need to save the
+ // default value.
+ (*variables)["default"] = DefaultValue(params, descriptor);
+ (*variables)["default_constant"] = FieldDefaultConstantName(descriptor);
+ (*variables)["default_constant_value"] = strings::Substitute(
+ "com.google.protobuf.nano.InternalNano.stringDefaultValue(\"$0\")",
+ CEscape(descriptor->default_value_string()));
+ (*variables)["default_copy_if_needed"] = (*variables)["default"];
+ }
+ } else {
+ // Non-string, non-bytes field. Defaults are literals.
+ (*variables)["default"] = DefaultValue(params, descriptor);
+ (*variables)["default_copy_if_needed"] = (*variables)["default"];
+ }
+ (*variables)["boxed_type"] = BoxedPrimitiveTypeName(GetJavaType(descriptor));
+ (*variables)["capitalized_type"] = GetCapitalizedType(descriptor);
+ (*variables)["tag"] = SimpleItoa(WireFormat::MakeTag(descriptor));
+ (*variables)["tag_size"] = SimpleItoa(
+ WireFormat::TagSize(descriptor->number(), descriptor->type()));
+ (*variables)["non_packed_tag"] = SimpleItoa(
+ internal::WireFormatLite::MakeTag(descriptor->number(),
+ internal::WireFormat::WireTypeForFieldType(descriptor->type())));
+ int fixed_size = FixedSize(descriptor->type());
+ if (fixed_size != -1) {
+ (*variables)["fixed_size"] = SimpleItoa(fixed_size);
+ }
+ (*variables)["message_name"] = descriptor->containing_type()->name();
+ (*variables)["empty_array_name"] = EmptyArrayName(params, descriptor);
+}
+} // namespace
+
+// ===================================================================
+
+PrimitiveFieldGenerator::
+PrimitiveFieldGenerator(const FieldDescriptor* descriptor, const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetPrimitiveVariables(descriptor, params, &variables_);
+}
+
+PrimitiveFieldGenerator::~PrimitiveFieldGenerator() {}
+
+bool PrimitiveFieldGenerator::SavedDefaultNeeded() const {
+ return variables_.find("default_constant") != variables_.end();
+}
+
+void PrimitiveFieldGenerator::GenerateInitSavedDefaultCode(io::Printer* printer) const {
+ if (variables_.find("default_constant") != variables_.end()) {
+ printer->Print(variables_,
+ "$default_constant$ = $default_constant_value$;\n");
+ }
+}
+
+void PrimitiveFieldGenerator::
+GenerateMembers(io::Printer* printer, bool lazy_init) const {
+ if (variables_.find("default_constant") != variables_.end()) {
+ // Those primitive types that need a saved default.
+ if (lazy_init) {
+ printer->Print(variables_,
+ "private static $type$ $default_constant$;\n");
+ } else {
+ printer->Print(variables_,
+ "private static final $type$ $default_constant$ =\n"
+ " $default_constant_value$;\n");
+ }
+ }
+
+ printer->Print(variables_,
+ "public $type$ $name$;\n");
+
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "public boolean has$capitalized_name$;\n");
+ }
+}
+
+void PrimitiveFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$ = $default_copy_if_needed$;\n");
+
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "has$capitalized_name$ = false;\n");
+ }
+}
+
+void PrimitiveFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "this.$name$ = input.read$capitalized_type$();\n");
+
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "has$capitalized_name$ = true;\n");
+ }
+}
+
+void PrimitiveFieldGenerator::
+GenerateSerializationConditional(io::Printer* printer) const {
+ if (params_.use_reference_types_for_primitives()) {
+ // For reference type mode, serialize based on equality
+ // to null.
+ printer->Print(variables_,
+ "if (this.$name$ != null) {\n");
+ return;
+ }
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "if (has$capitalized_name$ || ");
+ } else {
+ printer->Print(variables_,
+ "if (");
+ }
+ JavaType java_type = GetJavaType(descriptor_);
+ if (IsArrayType(java_type)) {
+ printer->Print(variables_,
+ "!java.util.Arrays.equals(this.$name$, $default$)) {\n");
+ } else if (IsReferenceType(java_type)) {
+ printer->Print(variables_,
+ "!this.$name$.equals($default$)) {\n");
+ } else if (java_type == JAVATYPE_FLOAT) {
+ printer->Print(variables_,
+ "java.lang.Float.floatToIntBits(this.$name$)\n"
+ " != java.lang.Float.floatToIntBits($default$)) {\n");
+ } else if (java_type == JAVATYPE_DOUBLE) {
+ printer->Print(variables_,
+ "java.lang.Double.doubleToLongBits(this.$name$)\n"
+ " != java.lang.Double.doubleToLongBits($default$)) {\n");
+ } else {
+ printer->Print(variables_,
+ "this.$name$ != $default$) {\n");
+ }
+}
+
+void PrimitiveFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ if (descriptor_->is_required() && !params_.generate_has()) {
+ // Always serialize a required field if we don't have the 'has' signal.
+ printer->Print(variables_,
+ "output.write$capitalized_type$($number$, this.$name$);\n");
+ } else {
+ GenerateSerializationConditional(printer);
+ printer->Print(variables_,
+ " output.write$capitalized_type$($number$, this.$name$);\n"
+ "}\n");
+ }
+}
+
+void PrimitiveFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ if (descriptor_->is_required() && !params_.generate_has()) {
+ printer->Print(variables_,
+ "size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .compute$capitalized_type$Size($number$, this.$name$);\n");
+ } else {
+ GenerateSerializationConditional(printer);
+ printer->Print(variables_,
+ " size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .compute$capitalized_type$Size($number$, this.$name$);\n"
+ "}\n");
+ }
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateFixClonedCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n"
+ " cloned.$name$ = this.$name$.clone();\n"
+ "}\n");
+}
+
+void PrimitiveFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ // We define equality as serialized form equality. If generate_has(),
+ // then if the field value equals the default value in both messages,
+ // but one's 'has' field is set and the other's is not, the serialized
+ // forms are different and we should return false.
+ JavaType java_type = GetJavaType(descriptor_);
+ if (java_type == JAVATYPE_BYTES) {
+ printer->Print(variables_,
+ "if (!java.util.Arrays.equals(this.$name$, other.$name$)");
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "\n"
+ " || (java.util.Arrays.equals(this.$name$, $default$)\n"
+ " && this.has$capitalized_name$ != other.has$capitalized_name$)");
+ }
+ printer->Print(") {\n"
+ " return false;\n"
+ "}\n");
+ } else if (java_type == JAVATYPE_STRING
+ || params_.use_reference_types_for_primitives()) {
+ printer->Print(variables_,
+ "if (this.$name$ == null) {\n"
+ " if (other.$name$ != null) {\n"
+ " return false;\n"
+ " }\n"
+ "} else if (!this.$name$.equals(other.$name$)");
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "\n"
+ " || (this.$name$.equals($default$)\n"
+ " && this.has$capitalized_name$ != other.has$capitalized_name$)");
+ }
+ printer->Print(") {\n"
+ " return false;\n"
+ "}\n");
+ } else if (java_type == JAVATYPE_FLOAT) {
+ printer->Print(variables_,
+ "{\n"
+ " int bits = java.lang.Float.floatToIntBits(this.$name$);\n"
+ " if (bits != java.lang.Float.floatToIntBits(other.$name$)");
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "\n"
+ " || (bits == java.lang.Float.floatToIntBits($default$)\n"
+ " && this.has$capitalized_name$ != other.has$capitalized_name$)");
+ }
+ printer->Print(") {\n"
+ " return false;\n"
+ " }\n"
+ "}\n");
+ } else if (java_type == JAVATYPE_DOUBLE) {
+ printer->Print(variables_,
+ "{\n"
+ " long bits = java.lang.Double.doubleToLongBits(this.$name$);\n"
+ " if (bits != java.lang.Double.doubleToLongBits(other.$name$)");
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "\n"
+ " || (bits == java.lang.Double.doubleToLongBits($default$)\n"
+ " && this.has$capitalized_name$ != other.has$capitalized_name$)");
+ }
+ printer->Print(") {\n"
+ " return false;\n"
+ " }\n"
+ "}\n");
+ } else {
+ printer->Print(variables_,
+ "if (this.$name$ != other.$name$");
+ if (params_.generate_has()) {
+ printer->Print(variables_,
+ "\n"
+ " || (this.$name$ == $default$\n"
+ " && this.has$capitalized_name$ != other.has$capitalized_name$)");
+ }
+ printer->Print(") {\n"
+ " return false;\n"
+ "}\n");
+ }
+}
+
+void PrimitiveFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ JavaType java_type = GetJavaType(descriptor_);
+ if (java_type == JAVATYPE_BYTES) {
+ printer->Print(variables_,
+ "result = 31 * result + java.util.Arrays.hashCode(this.$name$);\n");
+ } else if (java_type == JAVATYPE_STRING
+ || params_.use_reference_types_for_primitives()) {
+ printer->Print(variables_,
+ "result = 31 * result\n"
+ " + (this.$name$ == null ? 0 : this.$name$.hashCode());\n");
+ } else {
+ switch (java_type) {
+ // For all Java primitive types below, the hash codes match the
+ // results of BoxedType.valueOf(primitiveValue).hashCode().
+ case JAVATYPE_INT:
+ printer->Print(variables_,
+ "result = 31 * result + this.$name$;\n");
+ break;
+ case JAVATYPE_LONG:
+ printer->Print(variables_,
+ "result = 31 * result\n"
+ " + (int) (this.$name$ ^ (this.$name$ >>> 32));\n");
+ break;
+ case JAVATYPE_FLOAT:
+ printer->Print(variables_,
+ "result = 31 * result\n"
+ " + java.lang.Float.floatToIntBits(this.$name$);\n");
+ break;
+ case JAVATYPE_DOUBLE:
+ printer->Print(variables_,
+ "{\n"
+ " long v = java.lang.Double.doubleToLongBits(this.$name$);\n"
+ " result = 31 * result + (int) (v ^ (v >>> 32));\n"
+ "}\n");
+ break;
+ case JAVATYPE_BOOLEAN:
+ printer->Print(variables_,
+ "result = 31 * result + (this.$name$ ? 1231 : 1237);\n");
+ break;
+ default:
+ GOOGLE_LOG(ERROR) << "unknown java type for primitive field";
+ break;
+ }
+ }
+}
+
+// ===================================================================
+
+AccessorPrimitiveFieldGenerator::
+AccessorPrimitiveFieldGenerator(const FieldDescriptor* descriptor,
+ const Params& params, int has_bit_index)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetPrimitiveVariables(descriptor, params, &variables_);
+ SetBitOperationVariables("has", has_bit_index, &variables_);
+}
+
+AccessorPrimitiveFieldGenerator::~AccessorPrimitiveFieldGenerator() {}
+
+bool AccessorPrimitiveFieldGenerator::SavedDefaultNeeded() const {
+ return variables_.find("default_constant") != variables_.end();
+}
+
+void AccessorPrimitiveFieldGenerator::
+GenerateInitSavedDefaultCode(io::Printer* printer) const {
+ if (variables_.find("default_constant") != variables_.end()) {
+ printer->Print(variables_,
+ "$default_constant$ = $default_constant_value$;\n");
+ }
+}
+
+void AccessorPrimitiveFieldGenerator::
+GenerateMembers(io::Printer* printer, bool lazy_init) const {
+ if (variables_.find("default_constant") != variables_.end()) {
+ // Those primitive types that need a saved default.
+ if (lazy_init) {
+ printer->Print(variables_,
+ "private static $type$ $default_constant$;\n");
+ } else {
+ printer->Print(variables_,
+ "private static final $type$ $default_constant$ =\n"
+ " $default_constant_value$;\n");
+ }
+ }
+ printer->Print(variables_,
+ "private $type$ $name$_;\n"
+ "public $type$ get$capitalized_name$() {\n"
+ " return $name$_;\n"
+ "}\n"
+ "public $message_name$ set$capitalized_name$($type$ value) {\n");
+ if (IsReferenceType(GetJavaType(descriptor_))) {
+ printer->Print(variables_,
+ " if (value == null) {\n"
+ " throw new java.lang.NullPointerException();\n"
+ " }\n");
+ }
+ printer->Print(variables_,
+ " $name$_ = value;\n"
+ " $set_has$;\n"
+ " return this;\n"
+ "}\n"
+ "public boolean has$capitalized_name$() {\n"
+ " return $get_has$;\n"
+ "}\n"
+ "public $message_name$ clear$capitalized_name$() {\n"
+ " $name$_ = $default_copy_if_needed$;\n"
+ " $clear_has$;\n"
+ " return this;\n"
+ "}\n");
+}
+
+void AccessorPrimitiveFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$_ = $default_copy_if_needed$;\n");
+}
+
+void AccessorPrimitiveFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$_ = input.read$capitalized_type$();\n"
+ "$set_has$;\n");
+}
+
+void AccessorPrimitiveFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($get_has$) {\n"
+ " output.write$capitalized_type$($number$, $name$_);\n"
+ "}\n");
+}
+
+void AccessorPrimitiveFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($get_has$) {\n"
+ " size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .compute$capitalized_type$Size($number$, $name$_);\n"
+ "}\n");
+}
+
+void AccessorPrimitiveFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ switch (GetJavaType(descriptor_)) {
+ // For all Java primitive types below, the equality checks match the
+ // results of BoxedType.valueOf(primitiveValue).equals(otherValue).
+ case JAVATYPE_FLOAT:
+ printer->Print(variables_,
+ "if ($different_has$\n"
+ " || java.lang.Float.floatToIntBits($name$_)\n"
+ " != java.lang.Float.floatToIntBits(other.$name$_)) {\n"
+ " return false;\n"
+ "}\n");
+ break;
+ case JAVATYPE_DOUBLE:
+ printer->Print(variables_,
+ "if ($different_has$\n"
+ " || java.lang.Double.doubleToLongBits($name$_)\n"
+ " != java.lang.Double.doubleToLongBits(other.$name$_)) {\n"
+ " return false;\n"
+ "}\n");
+ break;
+ case JAVATYPE_INT:
+ case JAVATYPE_LONG:
+ case JAVATYPE_BOOLEAN:
+ printer->Print(variables_,
+ "if ($different_has$\n"
+ " || $name$_ != other.$name$_) {\n"
+ " return false;\n"
+ "}\n");
+ break;
+ case JAVATYPE_STRING:
+ // Accessor style would guarantee $name$_ non-null
+ printer->Print(variables_,
+ "if ($different_has$\n"
+ " || !$name$_.equals(other.$name$_)) {\n"
+ " return false;\n"
+ "}\n");
+ break;
+ case JAVATYPE_BYTES:
+ // Accessor style would guarantee $name$_ non-null
+ printer->Print(variables_,
+ "if ($different_has$\n"
+ " || !java.util.Arrays.equals($name$_, other.$name$_)) {\n"
+ " return false;\n"
+ "}\n");
+ break;
+ default:
+ GOOGLE_LOG(ERROR) << "unknown java type for primitive field";
+ break;
+ }
+}
+
+void AccessorPrimitiveFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ switch (GetJavaType(descriptor_)) {
+ // For all Java primitive types below, the hash codes match the
+ // results of BoxedType.valueOf(primitiveValue).hashCode().
+ case JAVATYPE_INT:
+ printer->Print(variables_,
+ "result = 31 * result + $name$_;\n");
+ break;
+ case JAVATYPE_LONG:
+ printer->Print(variables_,
+ "result = 31 * result + (int) ($name$_ ^ ($name$_ >>> 32));\n");
+ break;
+ case JAVATYPE_FLOAT:
+ printer->Print(variables_,
+ "result = 31 * result +\n"
+ " java.lang.Float.floatToIntBits($name$_);\n");
+ break;
+ case JAVATYPE_DOUBLE:
+ printer->Print(variables_,
+ "{\n"
+ " long v = java.lang.Double.doubleToLongBits($name$_);\n"
+ " result = 31 * result + (int) (v ^ (v >>> 32));\n"
+ "}\n");
+ break;
+ case JAVATYPE_BOOLEAN:
+ printer->Print(variables_,
+ "result = 31 * result + ($name$_ ? 1231 : 1237);\n");
+ break;
+ case JAVATYPE_STRING:
+ // Accessor style would guarantee $name$_ non-null
+ printer->Print(variables_,
+ "result = 31 * result + $name$_.hashCode();\n");
+ break;
+ case JAVATYPE_BYTES:
+ // Accessor style would guarantee $name$_ non-null
+ printer->Print(variables_,
+ "result = 31 * result + java.util.Arrays.hashCode($name$_);\n");
+ break;
+ default:
+ GOOGLE_LOG(ERROR) << "unknown java type for primitive field";
+ break;
+ }
+}
+
+// ===================================================================
+
+PrimitiveOneofFieldGenerator::PrimitiveOneofFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetPrimitiveVariables(descriptor, params, &variables_);
+ SetCommonOneofVariables(descriptor, &variables_);
+}
+
+PrimitiveOneofFieldGenerator::~PrimitiveOneofFieldGenerator() {}
+
+void PrimitiveOneofFieldGenerator::GenerateMembers(
+ io::Printer* printer, bool /*unused lazy_init*/) const {
+ printer->Print(variables_,
+ "public boolean has$capitalized_name$() {\n"
+ " return $has_oneof_case$;\n"
+ "}\n"
+ "public $type$ get$capitalized_name$() {\n"
+ " if ($has_oneof_case$) {\n"
+ " return ($type$) ($boxed_type$) this.$oneof_name$_;\n"
+ " }\n"
+ " return $default$;\n"
+ "}\n"
+ "public $message_name$ set$capitalized_name$($type$ value) {\n"
+ " $set_oneof_case$;\n"
+ " this.$oneof_name$_ = value;\n"
+ " return this;\n"
+ "}\n");
+}
+
+void PrimitiveOneofFieldGenerator::GenerateClearCode(
+ io::Printer* printer) const {
+ // No clear method for oneof fields.
+}
+
+void PrimitiveOneofFieldGenerator::GenerateMergingCode(
+ io::Printer* printer) const {
+ printer->Print(variables_,
+ "this.$oneof_name$_ = input.read$capitalized_type$();\n"
+ "$set_oneof_case$;\n");
+}
+
+void PrimitiveOneofFieldGenerator::GenerateSerializationCode(
+ io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($has_oneof_case$) {\n"
+ " output.write$capitalized_type$(\n"
+ " $number$, ($boxed_type$) this.$oneof_name$_);\n"
+ "}\n");
+}
+
+void PrimitiveOneofFieldGenerator::GenerateSerializedSizeCode(
+ io::Printer* printer) const {
+ printer->Print(variables_,
+ "if ($has_oneof_case$) {\n"
+ " size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .compute$capitalized_type$Size(\n"
+ " $number$, ($boxed_type$) this.$oneof_name$_);\n"
+ "}\n");
+}
+
+void PrimitiveOneofFieldGenerator::GenerateEqualsCode(
+ io::Printer* printer) const {
+ GenerateOneofFieldEquals(descriptor_, variables_, printer);
+}
+
+void PrimitiveOneofFieldGenerator::GenerateHashCodeCode(
+ io::Printer* printer) const {
+ GenerateOneofFieldHashCode(descriptor_, variables_, printer);
+}
+
+// ===================================================================
+
+RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params)
+ : FieldGenerator(params), descriptor_(descriptor) {
+ SetPrimitiveVariables(descriptor, params, &variables_);
+}
+
+RepeatedPrimitiveFieldGenerator::~RepeatedPrimitiveFieldGenerator() {}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateMembers(io::Printer* printer, bool /*unused init_defaults*/) const {
+ printer->Print(variables_,
+ "public $type$[] $name$;\n");
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateClearCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "$name$ = $default$;\n");
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateMergingCode(io::Printer* printer) const {
+ // First, figure out the length of the array, then parse.
+ printer->Print(variables_,
+ "int arrayLength = com.google.protobuf.nano.WireFormatNano\n"
+ " .getRepeatedFieldArrayLength(input, $non_packed_tag$);\n"
+ "int i = this.$name$ == null ? 0 : this.$name$.length;\n");
+
+ if (GetJavaType(descriptor_) == JAVATYPE_BYTES) {
+ printer->Print(variables_,
+ "byte[][] newArray = new byte[i + arrayLength][];\n");
+ } else {
+ printer->Print(variables_,
+ "$type$[] newArray = new $type$[i + arrayLength];\n");
+ }
+ printer->Print(variables_,
+ "if (i != 0) {\n"
+ " java.lang.System.arraycopy(this.$name$, 0, newArray, 0, i);\n"
+ "}\n"
+ "for (; i < newArray.length - 1; i++) {\n"
+ " newArray[i] = input.read$capitalized_type$();\n"
+ " input.readTag();\n"
+ "}\n"
+ "// Last one without readTag.\n"
+ "newArray[i] = input.read$capitalized_type$();\n"
+ "this.$name$ = newArray;\n");
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateMergingCodeFromPacked(io::Printer* printer) const {
+ printer->Print(
+ "int length = input.readRawVarint32();\n"
+ "int limit = input.pushLimit(length);\n");
+
+ // If we know the elements will all be of the same size, the arrayLength
+ // can be calculated much more easily. However, FixedSize() returns 1 for
+ // repeated bool fields, which are guaranteed to have the fixed size of
+ // 1 byte per value only if we control the output. On the wire they can
+ // legally appear as variable-size integers, so we need to use the slow
+ // way for repeated bool fields.
+ if (descriptor_->type() == FieldDescriptor::TYPE_BOOL
+ || FixedSize(descriptor_->type()) == -1) {
+ printer->Print(variables_,
+ "// First pass to compute array length.\n"
+ "int arrayLength = 0;\n"
+ "int startPos = input.getPosition();\n"
+ "while (input.getBytesUntilLimit() > 0) {\n"
+ " input.read$capitalized_type$();\n"
+ " arrayLength++;\n"
+ "}\n"
+ "input.rewindToPosition(startPos);\n");
+ } else {
+ printer->Print(variables_,
+ "int arrayLength = length / $fixed_size$;\n");
+ }
+
+ printer->Print(variables_,
+ "int i = this.$name$ == null ? 0 : this.$name$.length;\n"
+ "$type$[] newArray = new $type$[i + arrayLength];\n"
+ "if (i != 0) {\n"
+ " java.lang.System.arraycopy(this.$name$, 0, newArray, 0, i);\n"
+ "}\n"
+ "for (; i < newArray.length; i++) {\n"
+ " newArray[i] = input.read$capitalized_type$();\n"
+ "}\n"
+ "this.$name$ = newArray;\n"
+ "input.popLimit(limit);\n");
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateRepeatedDataSizeCode(io::Printer* printer) const {
+ // Creates a variable dataSize and puts the serialized size in there.
+ // If the element type is a Java reference type, also generates
+ // dataCount which stores the number of non-null elements in the field.
+ if (IsReferenceType(GetJavaType(descriptor_))) {
+ printer->Print(variables_,
+ "int dataCount = 0;\n"
+ "int dataSize = 0;\n"
+ "for (int i = 0; i < this.$name$.length; i++) {\n"
+ " $type$ element = this.$name$[i];\n"
+ " if (element != null) {\n"
+ " dataCount++;\n"
+ " dataSize += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .compute$capitalized_type$SizeNoTag(element);\n"
+ " }\n"
+ "}\n");
+ } else if (FixedSize(descriptor_->type()) == -1) {
+ printer->Print(variables_,
+ "int dataSize = 0;\n"
+ "for (int i = 0; i < this.$name$.length; i++) {\n"
+ " $type$ element = this.$name$[i];\n"
+ " dataSize += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .compute$capitalized_type$SizeNoTag(element);\n"
+ "}\n");
+ } else {
+ printer->Print(variables_,
+ "int dataSize = $fixed_size$ * this.$name$.length;\n");
+ }
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateSerializationCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n");
+ printer->Indent();
+
+ if (descriptor_->is_packable() && descriptor_->options().packed()) {
+ GenerateRepeatedDataSizeCode(printer);
+ printer->Print(variables_,
+ "output.writeRawVarint32($tag$);\n"
+ "output.writeRawVarint32(dataSize);\n"
+ "for (int i = 0; i < this.$name$.length; i++) {\n"
+ " output.write$capitalized_type$NoTag(this.$name$[i]);\n"
+ "}\n");
+ } else if (IsReferenceType(GetJavaType(descriptor_))) {
+ printer->Print(variables_,
+ "for (int i = 0; i < this.$name$.length; i++) {\n"
+ " $type$ element = this.$name$[i];\n"
+ " if (element != null) {\n"
+ " output.write$capitalized_type$($number$, element);\n"
+ " }\n"
+ "}\n");
+ } else {
+ printer->Print(variables_,
+ "for (int i = 0; i < this.$name$.length; i++) {\n"
+ " output.write$capitalized_type$($number$, this.$name$[i]);\n"
+ "}\n");
+ }
+
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateSerializedSizeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (this.$name$ != null && this.$name$.length > 0) {\n");
+ printer->Indent();
+
+ GenerateRepeatedDataSizeCode(printer);
+
+ printer->Print(
+ "size += dataSize;\n");
+ if (descriptor_->is_packable() && descriptor_->options().packed()) {
+ printer->Print(variables_,
+ "size += $tag_size$;\n"
+ "size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
+ " .computeRawVarint32Size(dataSize);\n");
+ } else if (IsReferenceType(GetJavaType(descriptor_))) {
+ printer->Print(variables_,
+ "size += $tag_size$ * dataCount;\n");
+ } else {
+ printer->Print(variables_,
+ "size += $tag_size$ * this.$name$.length;\n");
+ }
+
+ printer->Outdent();
+
+ printer->Print(
+ "}\n");
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateEqualsCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "if (!com.google.protobuf.nano.InternalNano.equals(\n"
+ " this.$name$, other.$name$)) {\n"
+ " return false;\n"
+ "}\n");
+}
+
+void RepeatedPrimitiveFieldGenerator::
+GenerateHashCodeCode(io::Printer* printer) const {
+ printer->Print(variables_,
+ "result = 31 * result\n"
+ " + com.google.protobuf.nano.InternalNano.hashCode(this.$name$);\n");
+}
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_primitive_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_primitive_field.h
new file mode 100644
index 0000000000..d7d72d578d
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/javanano/javanano_primitive_field.h
@@ -0,0 +1,150 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__
+
+#include <map>
+#include <string>
+#include <google/protobuf/compiler/javanano/javanano_field.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace javanano {
+
+class PrimitiveFieldGenerator : public FieldGenerator {
+ public:
+ explicit PrimitiveFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params);
+ ~PrimitiveFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ bool SavedDefaultNeeded() const;
+ void GenerateInitSavedDefaultCode(io::Printer* printer) const;
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+
+ private:
+ void GenerateSerializationConditional(io::Printer* printer) const;
+
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
+};
+
+class AccessorPrimitiveFieldGenerator : public FieldGenerator {
+ public:
+ explicit AccessorPrimitiveFieldGenerator(const FieldDescriptor* descriptor,
+ const Params &params, int has_bit_index);
+ ~AccessorPrimitiveFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ bool SavedDefaultNeeded() const;
+ void GenerateInitSavedDefaultCode(io::Printer* printer) const;
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+
+ private:
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorPrimitiveFieldGenerator);
+};
+
+class PrimitiveOneofFieldGenerator : public FieldGenerator {
+ public:
+ explicit PrimitiveOneofFieldGenerator(
+ const FieldDescriptor* descriptor, const Params& params);
+ ~PrimitiveOneofFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+
+ private:
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator);
+};
+
+class RepeatedPrimitiveFieldGenerator : public FieldGenerator {
+ public:
+ explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor,
+ const Params& params);
+ ~RepeatedPrimitiveFieldGenerator();
+
+ // implements FieldGenerator ---------------------------------------
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const;
+ void GenerateClearCode(io::Printer* printer) const;
+ void GenerateMergingCode(io::Printer* printer) const;
+ void GenerateMergingCodeFromPacked(io::Printer* printer) const;
+ void GenerateSerializationCode(io::Printer* printer) const;
+ void GenerateSerializedSizeCode(io::Printer* printer) const;
+ void GenerateEqualsCode(io::Printer* printer) const;
+ void GenerateHashCodeCode(io::Printer* printer) const;
+ void GenerateFixClonedCode(io::Printer* printer) const;
+
+ private:
+ void GenerateRepeatedDataSizeCode(io::Printer* printer) const;
+
+ const FieldDescriptor* descriptor_;
+ std::map<string, string> variables_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator);
+};
+
+} // namespace javanano
+} // namespace compiler
+} // namespace protobuf
+
+} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/embed.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/embed.cc
index f0f946e56d..a725b62eb8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/embed.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/embed.cc
@@ -34,6 +34,8 @@
#include <iostream>
#include <string>
+const char output_file[] = "well_known_types_embed.cc";
+
static bool AsciiIsPrint(unsigned char c) {
return c >= 32 && c < 127;
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/js_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/js_generator.cc
index b5771f260c..73d3276297 100644..100755
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/js_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/js_generator.cc
@@ -35,6 +35,9 @@
#include <limits>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <utility>
#include <vector>
@@ -49,7 +52,6 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
@@ -193,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);
- ReplaceCharacters(&basename, "-", '$');
- ReplaceCharacters(&basename, "/", '_');
- ReplaceCharacters(&basename, ".", '_');
+ StripString(&basename, "-", '$');
+ StripString(&basename, "/", '_');
+ StripString(&basename, ".", '_');
return basename + "_pb";
}
@@ -242,35 +244,22 @@ string GetPrefix(const GeneratorOptions& options,
return prefix;
}
-// Returns the fully normalized JavaScript path prefix for the given
-// message descriptor.
-string GetMessagePathPrefix(const GeneratorOptions& options,
- const Descriptor* descriptor) {
- return GetPrefix(
- options, descriptor->file(),
- descriptor->containing_type());
-}
-
// Returns the fully normalized JavaScript path for the given
// message descriptor.
string GetMessagePath(const GeneratorOptions& options,
const Descriptor* descriptor) {
- return GetMessagePathPrefix(options, descriptor) + descriptor->name();
-}
-
-// Returns the fully normalized JavaScript path prefix for the given
-// enumeration descriptor.
-string GetEnumPathPrefix(const GeneratorOptions& options,
- const EnumDescriptor* enum_descriptor) {
- return GetPrefix(options, enum_descriptor->file(),
- enum_descriptor->containing_type());
+ return GetPrefix(
+ options, descriptor->file(),
+ descriptor->containing_type()) + descriptor->name();
}
// Returns the fully normalized JavaScript path for the given
// enumeration descriptor.
string GetEnumPath(const GeneratorOptions& options,
const EnumDescriptor* enum_descriptor) {
- return GetEnumPathPrefix(options, enum_descriptor) + enum_descriptor->name();
+ return GetPrefix(
+ options, enum_descriptor->file(),
+ enum_descriptor->containing_type()) + enum_descriptor->name();
}
string MaybeCrossFileRef(const GeneratorOptions& options,
@@ -1026,7 +1015,7 @@ string JSFieldTypeAnnotation(const GeneratorOptions& options,
if (!IsPrimitive(jstype)) {
jstype = "!" + jstype;
}
- jstype = "Array<" + jstype + ">";
+ jstype = "Array.<" + jstype + ">";
}
}
@@ -1093,40 +1082,6 @@ string JSReturnClause(const FieldDescriptor* desc) {
return "";
}
-string JSTypeTag(const FieldDescriptor* desc) {
- switch (desc->type()) {
- case FieldDescriptor::TYPE_DOUBLE:
- case FieldDescriptor::TYPE_FLOAT:
- return "Float";
- case FieldDescriptor::TYPE_INT32:
- case FieldDescriptor::TYPE_UINT32:
- case FieldDescriptor::TYPE_INT64:
- case FieldDescriptor::TYPE_UINT64:
- case FieldDescriptor::TYPE_FIXED32:
- case FieldDescriptor::TYPE_FIXED64:
- case FieldDescriptor::TYPE_SINT32:
- case FieldDescriptor::TYPE_SINT64:
- case FieldDescriptor::TYPE_SFIXED32:
- case FieldDescriptor::TYPE_SFIXED64:
- if (IsIntegralFieldWithStringJSType(desc)) {
- return "StringInt";
- } else {
- return "Int";
- }
- case FieldDescriptor::TYPE_BOOL:
- return "Boolean";
- case FieldDescriptor::TYPE_STRING:
- return "String";
- case FieldDescriptor::TYPE_BYTES:
- return "Bytes";
- case FieldDescriptor::TYPE_ENUM:
- return "Enum";
- default:
- assert(false);
- }
- return "";
-}
-
string JSReturnDoc(const GeneratorOptions& options,
const FieldDescriptor* desc) {
return "";
@@ -1556,22 +1511,6 @@ 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,
@@ -1957,10 +1896,8 @@ void Generator::GenerateClassConstructor(const GeneratorOptions& options,
" * @extends {jspb.Message}\n"
" * @constructor\n"
" */\n"
- "$classprefix$$classname$ = function(opt_data) {\n",
- "classprefix", GetMessagePathPrefix(options, desc),
- "classname", desc->name());
- printer->Annotate("classname", desc);
+ "$classname$ = function(opt_data) {\n",
+ "classname", GetMessagePath(options, desc));
string message_id = GetMessageId(desc);
printer->Print(
" jspb.Message.initialize(this, opt_data, $messageId$, $pivot$, "
@@ -2060,7 +1997,6 @@ void Generator::GenerateOneofCaseDefinition(
" $upcase$: $number$",
"upcase", ToEnumCase(oneof->field(i)->name()),
"number", JSFieldIndex(oneof->field(i)));
- printer->Annotate("upcase", oneof->field(i));
}
printer->Print(
@@ -2443,13 +2379,12 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
"keytype", key_type,
"valuetype", value_type);
printer->Print(
- "$class$.prototype.$gettername$ = function(opt_noLazyCreate) {\n"
+ "$class$.prototype.get$name$ = function(opt_noLazyCreate) {\n"
" return /** @type {!jspb.Map<$keytype$,$valuetype$>} */ (\n",
"class", GetMessagePath(options, field->containing_type()),
- "gettername", "get" + JSGetterName(options, field),
+ "name", JSGetterName(options, field),
"keytype", key_type,
"valuetype", value_type);
- printer->Annotate("gettername", field);
printer->Print(
" jspb.Message.getMapField(this, $index$, opt_noLazyCreate",
"index", JSFieldIndex(field));
@@ -2488,7 +2423,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
/* force_present = */ false,
/* singular_if_not_packed = */ false));
printer->Print(
- "$class$.prototype.$gettername$ = function() {\n"
+ "$class$.prototype.get$name$ = function() {\n"
" return /** @type{$type$} */ (\n"
" jspb.Message.get$rpt$WrapperField(this, $wrapperclass$, "
"$index$$required$));\n"
@@ -2496,7 +2431,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
"\n"
"\n",
"class", GetMessagePath(options, field->containing_type()),
- "gettername", "get" + JSGetterName(options, field),
+ "name", JSGetterName(options, field),
"type", JSFieldTypeAnnotation(options, field,
/* is_setter_argument = */ false,
/* force_present = */ false,
@@ -2506,10 +2441,9 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
"wrapperclass", SubmessageTypeRef(options, field),
"required", (field->label() == FieldDescriptor::LABEL_REQUIRED ?
", 1" : ""));
- printer->Annotate("gettername", field);
printer->Print(
"/** @param {$optionaltype$} value$returndoc$ */\n"
- "$class$.prototype.$settername$ = function(value) {\n"
+ "$class$.prototype.set$name$ = function(value) {\n"
" jspb.Message.set$oneoftag$$repeatedtag$WrapperField(",
"optionaltype",
JSFieldTypeAnnotation(options, field,
@@ -2518,10 +2452,9 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
/* singular_if_not_packed = */ false),
"returndoc", JSReturnDoc(options, field),
"class", GetMessagePath(options, field->containing_type()),
- "settername", "set" + JSGetterName(options, field),
+ "name", JSGetterName(options, field),
"oneoftag", (field->containing_oneof() ? "Oneof" : ""),
"repeatedtag", (field->is_repeated() ? "Repeated" : ""));
- printer->Annotate("settername", field);
printer->Print(
"this, $index$$oneofgroup$, value);$returnvalue$\n"
@@ -2573,10 +2506,9 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
}
printer->Print(
- "$class$.prototype.$gettername$ = function() {\n",
+ "$class$.prototype.get$name$ = function() {\n",
"class", GetMessagePath(options, field->containing_type()),
- "gettername", "get" + JSGetterName(options, field));
- printer->Annotate("gettername", field);
+ "name", JSGetterName(options, field));
if (untyped) {
printer->Print(
@@ -2637,47 +2569,26 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
/* singular_if_not_packed = */ false),
"returndoc", JSReturnDoc(options, field));
}
-
- if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 &&
- !field->is_repeated() && !field->is_map() &&
- !HasFieldPresence(options, field)) {
- // Proto3 non-repeated and non-map fields without presence use the
- // setProto3*Field function.
- printer->Print(
- "$class$.prototype.$settername$ = function(value) {\n"
- " jspb.Message.setProto3$typetag$Field(this, $index$, "
- "value);$returnvalue$\n"
- "};\n"
- "\n"
- "\n",
- "class", GetMessagePath(options, field->containing_type()),
- "settername", "set" + JSGetterName(options, field), "typetag",
- JSTypeTag(field), "index", JSFieldIndex(field), "returnvalue",
- JSReturnClause(field));
- printer->Annotate("settername", field);
- } else {
- // Otherwise, use the regular setField function.
- printer->Print(
- "$class$.prototype.$settername$ = function(value) {\n"
- " jspb.Message.set$oneoftag$Field(this, $index$",
- "class", GetMessagePath(options, field->containing_type()),
- "settername", "set" + JSGetterName(options, field), "oneoftag",
- (field->containing_oneof() ? "Oneof" : ""), "index",
- JSFieldIndex(field));
- printer->Annotate("settername", field);
- printer->Print(
- "$oneofgroup$, $type$value$rptvalueinit$$typeclose$);$returnvalue$\n"
- "};\n"
- "\n"
- "\n",
- "type",
- untyped ? "/** @type{string|number|boolean|Array|undefined} */(" : "",
- "typeclose", untyped ? ")" : "", "oneofgroup",
- (field->containing_oneof() ? (", " + JSOneofArray(options, field))
- : ""),
- "returnvalue", JSReturnClause(field), "rptvalueinit",
- (field->is_repeated() ? " || []" : ""));
- }
+ printer->Print(
+ "$class$.prototype.set$name$ = function(value) {\n"
+ " jspb.Message.set$oneoftag$Field(this, $index$",
+ "class", GetMessagePath(options, field->containing_type()),
+ "name", JSGetterName(options, field),
+ "oneoftag", (field->containing_oneof() ? "Oneof" : ""),
+ "index", JSFieldIndex(field));
+ printer->Print(
+ "$oneofgroup$, $type$value$rptvalueinit$$typeclose$);$returnvalue$\n"
+ "};\n"
+ "\n"
+ "\n",
+ "type",
+ untyped ? "/** @type{string|number|boolean|Array|undefined} */(" : "",
+ "typeclose", untyped ? ")" : "",
+ "oneofgroup",
+ (field->containing_oneof() ? (", " + JSOneofArray(options, field))
+ : ""),
+ "returnvalue", JSReturnClause(field), "rptvalueinit",
+ (field->is_repeated() ? " || []" : ""));
if (untyped) {
printer->Print(
@@ -2697,46 +2608,41 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
// fields with presence.
if (IsMap(options, field)) {
printer->Print(
- "$class$.prototype.$clearername$ = function() {\n"
- " this.$gettername$().clear();$returnvalue$\n"
+ "$class$.prototype.clear$name$ = function() {\n"
+ " this.get$name$().clear();$returnvalue$\n"
"};\n"
"\n"
"\n",
"class", GetMessagePath(options, field->containing_type()),
- "clearername", "clear" + JSGetterName(options, field),
- "gettername", "get" + JSGetterName(options, field),
+ "name", JSGetterName(options, field),
"returnvalue", JSReturnClause(field));
- printer->Annotate("clearername", field);
} else if (field->is_repeated() ||
(field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
!field->is_required())) {
// Fields where we can delegate to the regular setter.
printer->Print(
- "$class$.prototype.$clearername$ = function() {\n"
- " this.$settername$($clearedvalue$);$returnvalue$\n"
+ "$class$.prototype.clear$name$ = function() {\n"
+ " this.set$name$($clearedvalue$);$returnvalue$\n"
"};\n"
"\n"
"\n",
"class", GetMessagePath(options, field->containing_type()),
- "clearername", "clear" + JSGetterName(options, field),
- "settername", "set" + JSGetterName(options, field),
+ "name", JSGetterName(options, field),
"clearedvalue", (field->is_repeated() ? "[]" : "undefined"),
"returnvalue", JSReturnClause(field));
- printer->Annotate("clearername", field);
} else if (HasFieldPresence(options, field)) {
// Fields where we can't delegate to the regular setter because it doesn't
// accept "undefined" as an argument.
printer->Print(
- "$class$.prototype.$clearername$ = function() {\n"
+ "$class$.prototype.clear$name$ = function() {\n"
" jspb.Message.set$maybeoneof$Field(this, "
"$index$$maybeoneofgroup$, ",
"class", GetMessagePath(options, field->containing_type()),
- "clearername", "clear" + JSGetterName(options, field),
+ "name", JSGetterName(options, field),
"maybeoneof", (field->containing_oneof() ? "Oneof" : ""),
"maybeoneofgroup", (field->containing_oneof() ?
(", " + JSOneofArray(options, field)) : ""),
"index", JSFieldIndex(field));
- printer->Annotate("clearername", field);
printer->Print(
"$clearedvalue$);$returnvalue$\n"
"};\n"
@@ -2752,48 +2658,41 @@ void Generator::GenerateClassField(const GeneratorOptions& options,
" * Returns whether this field is set.\n"
" * @return {!boolean}\n"
" */\n"
- "$class$.prototype.$hasername$ = function() {\n"
+ "$class$.prototype.has$name$ = function() {\n"
" return jspb.Message.getField(this, $index$) != null;\n"
"};\n"
"\n"
"\n",
"class", GetMessagePath(options, field->containing_type()),
- "hasername", "has" + JSGetterName(options, field),
+ "name", JSGetterName(options, field),
"index", JSFieldIndex(field));
- printer->Annotate("hasername", field);
}
}
void Generator::GenerateRepeatedPrimitiveHelperMethods(
const GeneratorOptions& options, io::Printer* printer,
const FieldDescriptor* field, bool untyped) const {
- // clang-format off
printer->Print(
"/**\n"
" * @param {!$optionaltype$} value\n"
- " * @param {number=} opt_index$returndoc$\n"
+ " * @param {number=} opt_index\n"
" */\n"
- "$class$.prototype.$addername$ = function(value, opt_index) {\n"
+ "$class$.prototype.add$name$ = function(value, opt_index) {\n"
" jspb.Message.addToRepeatedField(this, $index$",
- "class", GetMessagePath(options, field->containing_type()), "addername",
- "add" + JSGetterName(options, field, BYTES_DEFAULT,
- /* drop_list = */ true),
- "optionaltype", JSTypeName(options, field, BYTES_DEFAULT),
- "index", JSFieldIndex(field),
- "returndoc", JSReturnDoc(options, field));
- printer->Annotate("addername", field);
+ "class", GetMessagePath(options, field->containing_type()),
+ "name", JSGetterName(options, field, BYTES_DEFAULT,
+ /* drop_list = */ true),
+ "optionaltype", JSTypeName(options, field, BYTES_DEFAULT), "index",
+ JSFieldIndex(field));
printer->Print(
- "$oneofgroup$, $type$value$rptvalueinit$$typeclose$, "
- "opt_index);$returnvalue$\n"
+ "$oneofgroup$, $type$value$rptvalueinit$$typeclose$, opt_index);\n"
"};\n"
"\n"
"\n",
"type", untyped ? "/** @type{string|number|boolean|!Uint8Array} */(" : "",
"typeclose", untyped ? ")" : "", "oneofgroup",
(field->containing_oneof() ? (", " + JSOneofArray(options, field)) : ""),
- "rptvalueinit", "",
- "returnvalue", JSReturnClause(field));
- // clang-format on
+ "rptvalueinit", "");
}
void Generator::GenerateRepeatedMessageHelperMethods(
@@ -2842,7 +2741,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",
@@ -2863,7 +2762,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",
@@ -2962,12 +2861,8 @@ void Generator::GenerateClassDeserializeBinaryField(
if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) {
printer->Print(", $messageType$.deserializeBinaryFromReader",
"messageType", GetMessagePath(options, value_field->message_type()));
- } else {
- printer->Print(", null");
}
- printer->Print(", $defaultKey$",
- "defaultKey", JSFieldDefault(key_field)
- );
+
printer->Print(");\n");
printer->Print(" });\n");
} else {
@@ -3186,10 +3081,8 @@ void Generator::GenerateEnum(const GeneratorOptions& options,
"/**\n"
" * @enum {number}\n"
" */\n"
- "$enumprefix$$name$ = {\n",
- "enumprefix", GetEnumPathPrefix(options, enumdesc),
- "name", enumdesc->name());
- printer->Annotate("name", enumdesc);
+ "$name$ = {\n",
+ "name", GetEnumPath(options, enumdesc));
for (int i = 0; i < enumdesc->value_count(); i++) {
const EnumValueDescriptor* value = enumdesc->value(i);
@@ -3198,7 +3091,6 @@ void Generator::GenerateEnum(const GeneratorOptions& options,
"name", ToEnumCase(value->name()),
"value", SimpleItoa(value->number()),
"comma", (i == enumdesc->value_count() - 1) ? "" : ",");
- printer->Annotate("name", value);
}
printer->Print(
@@ -3214,24 +3106,21 @@ void Generator::GenerateExtension(const GeneratorOptions& options,
? GetMessagePath(options, field->extension_scope())
: GetFilePath(options, field->file()));
- const string extension_object_name = JSObjectFieldName(options, field);
printer->Print(
"\n"
"/**\n"
" * A tuple of {field number, class constructor} for the extension\n"
- " * field named `$nameInComment$`.\n"
- " * @type {!jspb.ExtensionFieldInfo<$extensionType$>}\n"
+ " * field named `$name$`.\n"
+ " * @type {!jspb.ExtensionFieldInfo.<$extensionType$>}\n"
" */\n"
"$class$.$name$ = new jspb.ExtensionFieldInfo(\n",
- "nameInComment", extension_object_name,
- "name", extension_object_name,
+ "name", JSObjectFieldName(options, field),
"class", extension_scope,
"extensionType", JSFieldTypeAnnotation(
options, field,
/* is_setter_argument = */ false,
/* force_present = */ true,
/* singular_if_not_packed = */ false));
- printer->Annotate("name", field);
printer->Print(
" $index$,\n"
" {$name$: 0},\n"
@@ -3241,7 +3130,7 @@ void Generator::GenerateExtension(const GeneratorOptions& options,
" $toObject$),\n"
" $repeated$);\n",
"index", SimpleItoa(field->number()),
- "name", extension_object_name,
+ "name", JSObjectFieldName(options, field),
"ctor", (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ?
SubmessageTypeRef(options, field) : string("null")),
"toObject", (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ?
@@ -3260,7 +3149,7 @@ void Generator::GenerateExtension(const GeneratorOptions& options,
"extendName",
JSExtensionsObjectName(options, field->file(), field->containing_type()),
"index", SimpleItoa(field->number()), "class", extension_scope, "name",
- extension_object_name, "binaryReaderFn",
+ JSObjectFieldName(options, field), "binaryReaderFn",
JSBinaryReaderMethodName(options, field), "binaryWriterFn",
JSBinaryWriterMethodName(options, field), "binaryMessageSerializeFn",
(field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE)
@@ -3283,7 +3172,7 @@ void Generator::GenerateExtension(const GeneratorOptions& options,
field->containing_type()),
"index", SimpleItoa(field->number()),
"class", extension_scope,
- "name", extension_object_name);
+ "name", JSObjectFieldName(options, field));
}
bool GeneratorOptions::ParseFromOptions(
@@ -3341,12 +3230,6 @@ bool GeneratorOptions::ParseFromOptions(
return false;
}
one_output_file_per_input_file = true;
- } else if (options[i].first == "annotate_code") {
- if (!options[i].second.empty()) {
- *error = "Unexpected option value for annotate_code";
- return false;
- }
- annotate_code = true;
} else {
// Assume any other option is an output directory, as long as it is a bare
// `key` rather than a `key=value` option.
@@ -3511,7 +3394,7 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files,
// All output should go in a single file.
string filename = options.output_dir + "/" + options.library +
options.GetFileNameExtension();
- std::unique_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
GOOGLE_CHECK(output.get());
io::Printer printer(output.get(), '$');
@@ -3560,7 +3443,7 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files,
}
string filename = GetMessageFileName(options, desc);
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->Open(filename));
GOOGLE_CHECK(output.get());
io::Printer printer(output.get(), '$');
@@ -3586,7 +3469,7 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files,
}
string filename = GetEnumFileName(options, enumdesc);
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->Open(filename));
GOOGLE_CHECK(output.get());
io::Printer printer(output.get(), '$');
@@ -3609,7 +3492,7 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files,
if (allowed_set.count(file) == 1) {
string filename = GetExtensionFileName(options, file);
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->Open(filename));
GOOGLE_CHECK(output.get());
io::Printer printer(output.get(), '$');
@@ -3645,26 +3528,18 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files,
string filename =
options.output_dir + "/" + GetJSFilename(options, file->name());
- std::unique_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
GOOGLE_CHECK(output.get());
- GeneratedCodeInfo annotations;
- io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
- &annotations);
- io::Printer printer(output.get(), '$',
- options.annotate_code ? &annotation_collector : NULL);
-
+ io::Printer printer(output.get(), '$');
GenerateFile(options, &printer, file);
if (printer.failed()) {
return false;
}
-
- if (options.annotate_code) {
- EmbedCodeAnnotations(annotations, &printer);
- }
}
}
+
return true;
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/js_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/js_generator.h
index 3cc60e2283..6e932d7f3d 100644..100755
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/js_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/js_generator.h
@@ -79,8 +79,7 @@ struct GeneratorOptions {
library(""),
error_on_name_conflict(false),
extension(".js"),
- one_output_file_per_input_file(false),
- annotate_code(false) {}
+ one_output_file_per_input_file(false) {}
bool ParseFromOptions(
const std::vector< std::pair< string, string > >& options,
@@ -119,9 +118,6 @@ struct GeneratorOptions {
string extension;
// Create a separate output file for each input file?
bool one_output_file_per_input_file;
- // If true, we should build .meta files that contain annotations for
- // generated code. See GeneratedCodeInfo in descriptor.proto.
- bool annotate_code;
};
// CodeGenerator implementation which generates a JavaScript source file and
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/any.js b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/any.js
index d7ca6e3a40..d7ca6e3a40 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/any.js
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/any.js
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/struct.js b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/struct.js
index 30e3d02a6b..30e3d02a6b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/struct.js
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/struct.js
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/timestamp.js b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/timestamp.js
index b7e43f1967..b7e43f1967 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types/timestamp.js
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types/timestamp.js
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types_embed.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types_embed.h
index 174c665e45..174c665e45 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/js/well_known_types_embed.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/js/well_known_types_embed.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/main.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/main.cc
index 1db35441ad..680d642857 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/main.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/main.cc
@@ -40,6 +40,7 @@
#ifndef OPENSOURCE_PROTOBUF_CPP_BOOTSTRAP
#include <google/protobuf/compiler/csharp/csharp_generator.h>
+#include <google/protobuf/compiler/javanano/javanano_generator.h>
#include <google/protobuf/compiler/js/js_generator.h>
#include <google/protobuf/compiler/objectivec/objectivec_generator.h>
#include <google/protobuf/compiler/php/php_generator.h>
@@ -70,6 +71,11 @@ int main(int argc, char* argv[]) {
cli.RegisterGenerator("--python_out", &py_generator,
"Generate Python source file.");
+ // Java Nano
+ google::protobuf::compiler::javanano::JavaNanoGenerator javanano_generator;
+ cli.RegisterGenerator("--javanano_out", &javanano_generator,
+ "Generate Java Nano source file.");
+
// PHP
google::protobuf::compiler::php::Generator php_generator;
cli.RegisterGenerator("--php_out", &php_generator,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/mock_code_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/mock_code_generator.cc
index e150f97d49..cc660f4abe 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/mock_code_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/mock_code_generator.cc
@@ -35,6 +35,9 @@
#include <stdlib.h>
#include <iostream>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
@@ -54,12 +57,12 @@
#include <google/protobuf/stubs/substitute.h>
#include <gtest/gtest.h>
-#ifdef major
-#undef major
-#endif
-#ifdef minor
-#undef minor
-#endif
+#ifdef major
+#undef major
+#endif
+#ifdef minor
+#undef minor
+#endif
namespace google {
namespace protobuf {
@@ -67,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());
@@ -100,7 +103,8 @@ void MockCodeGenerator::ExpectGenerated(
File::GetContents(output_directory + "/" + GetOutputFileName(name, file),
&content, true));
- std::vector<string> lines = Split(content, "\n", true);
+ std::vector<string> lines =
+ Split(content, "\n", true);
while (!lines.empty() && lines.back().empty()) {
lines.pop_back();
@@ -228,7 +232,7 @@ bool MockCodeGenerator::Generate(
for (size_t i = 0; i < insert_into.size(); i++) {
{
- std::unique_ptr<io::ZeroCopyOutputStream> output(context->OpenForInsert(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(context->OpenForInsert(
GetOutputFileName(insert_into[i], file), kFirstInsertionPointName));
io::Printer printer(output.get(), '$');
printer.PrintRaw(GetOutputFileContent(name_, "first_insert",
@@ -240,7 +244,7 @@ bool MockCodeGenerator::Generate(
}
{
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->OpenForInsert(GetOutputFileName(insert_into[i], file),
kSecondInsertionPointName));
io::Printer printer(output.get(), '$');
@@ -253,7 +257,7 @@ bool MockCodeGenerator::Generate(
}
}
} else {
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->Open(GetOutputFileName(name_, file)));
GeneratedCodeInfo annotations;
@@ -283,7 +287,7 @@ bool MockCodeGenerator::Generate(
return false;
}
if (annotate) {
- std::unique_ptr<io::ZeroCopyOutputStream> meta_output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> meta_output(
context->Open(GetOutputFileName(name_, file) + ".meta"));
if (!TextFormat::Print(annotations, meta_output.get())) {
*error = "MockCodeGenerator couldn't write .meta";
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/mock_code_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/mock_code_generator.h
index cdd9138c95..cdd9138c95 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/mock_code_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/mock_code_generator.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
index 978e985cf5..02d60b3e97 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
@@ -149,7 +149,7 @@ void EnumGenerator::GenerateSource(io::Printer* printer) {
printer->Print(
"GPBEnumDescriptor *$name$_EnumDescriptor(void) {\n"
- " static _Atomic(GPBEnumDescriptor*) descriptor = nil;\n"
+ " static GPBEnumDescriptor *descriptor = NULL;\n"
" if (!descriptor) {\n",
"name", name_);
@@ -192,8 +192,7 @@ void EnumGenerator::GenerateSource(io::Printer* printer) {
"extraTextFormatInfo", CEscape(text_format_decode_data.Data()));
}
printer->Print(
- " GPBEnumDescriptor *expected = nil;\n"
- " if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {\n"
+ " if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {\n"
" [worker release];\n"
" }\n"
" }\n"
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum.h
index f52e9e687b..0b41cf7352 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum.h
@@ -59,8 +59,8 @@ class EnumGenerator {
private:
const EnumDescriptor* descriptor_;
- std::vector<const EnumValueDescriptor*> base_values_;
- std::vector<const EnumValueDescriptor*> all_values_;
+ vector<const EnumValueDescriptor*> base_values_;
+ vector<const EnumValueDescriptor*> all_values_;
const string name_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
index 8899a13aa9..8899a13aa9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
index ae56c069a1..ae56c069a1 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_extension.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
index b788d0a32a..b788d0a32a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_extension.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_extension.h
index e361e639bd..e361e639bd 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_extension.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_extension.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_field.cc
index f74599ba85..b6123fad7b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_field.cc
@@ -410,8 +410,10 @@ bool RepeatedFieldGenerator::RuntimeUsesHasBit(void) const {
FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor,
const Options& options)
: descriptor_(descriptor),
- field_generators_(descriptor->field_count()),
- extension_generators_(descriptor->extension_count()) {
+ field_generators_(
+ new scoped_ptr<FieldGenerator>[descriptor->field_count()]),
+ extension_generators_(
+ new scoped_ptr<FieldGenerator>[descriptor->extension_count()]) {
// Construct all the FieldGenerators.
for (int i = 0; i < descriptor->field_count(); i++) {
field_generators_[i].reset(
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_field.h
index 216034d067..6bd5db2eeb 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_field.h
@@ -182,8 +182,8 @@ class FieldGeneratorMap {
private:
const Descriptor* descriptor_;
- std::vector<std::unique_ptr<FieldGenerator>> field_generators_;
- std::vector<std::unique_ptr<FieldGenerator>> extension_generators_;
+ scoped_array<scoped_ptr<FieldGenerator> > field_generators_;
+ scoped_array<scoped_ptr<FieldGenerator> > extension_generators_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_file.cc
index f0d9b4d5f5..954b26885b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_file.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_file.cc
@@ -56,20 +56,6 @@ const int32 GOOGLE_PROTOBUF_OBJC_VERSION = 30002;
const char* kHeaderExtension = ".pbobjc.h";
-// Checks if a message contains any enums definitions (on the message or
-// a nested message under it).
-bool MessageContainsEnums(const Descriptor* message) {
- if (message->enum_type_count() > 0) {
- return true;
- }
- for (int i = 0; i < message->nested_type_count(); i++) {
- if (MessageContainsEnums(message->nested_type(i))) {
- return true;
- }
- }
- return false;
-}
-
// Checks if a message contains any extension definitions (on the message or
// a nested message under it).
bool MessageContainsExtensions(const Descriptor* message) {
@@ -84,20 +70,6 @@ bool MessageContainsExtensions(const Descriptor* message) {
return false;
}
-// Checks if the file contains any enum definitions (at the root or
-// nested under a message).
-bool FileContainsEnums(const FileDescriptor* file) {
- if (file->enum_type_count() > 0) {
- return true;
- }
- for (int i = 0; i < file->message_type_count(); i++) {
- if (MessageContainsEnums(file->message_type(i))) {
- return true;
- }
- }
- return false;
-}
-
// Checks if the file contains any extensions definitions (at the root or
// nested under a message).
bool FileContainsExtensions(const FileDescriptor* file) {
@@ -116,9 +88,9 @@ bool FileContainsExtensions(const FileDescriptor* file) {
// deps as visited and prunes them from the needed files list.
void PruneFileAndDepsMarkingAsVisited(
const FileDescriptor* file,
- std::vector<const FileDescriptor*>* files,
+ vector<const FileDescriptor*>* files,
std::set<const FileDescriptor*>* files_visited) {
- std::vector<const FileDescriptor*>::iterator iter =
+ vector<const FileDescriptor*>::iterator iter =
std::find(files->begin(), files->end(), file);
if (iter != files->end()) {
files->erase(iter);
@@ -132,7 +104,7 @@ void PruneFileAndDepsMarkingAsVisited(
// Helper for CollectMinimalFileDepsContainingExtensions.
void CollectMinimalFileDepsContainingExtensionsWorker(
const FileDescriptor* file,
- std::vector<const FileDescriptor*>* files,
+ vector<const FileDescriptor*>* files,
std::set<const FileDescriptor*>* files_visited) {
if (files_visited->find(file) != files_visited->end()) {
return;
@@ -165,7 +137,7 @@ void CollectMinimalFileDepsContainingExtensionsWorker(
// specifically).
void CollectMinimalFileDepsContainingExtensions(
const FileDescriptor* file,
- std::vector<const FileDescriptor*>* files) {
+ vector<const FileDescriptor*>* files) {
std::set<const FileDescriptor*> files_visited;
for (int i = 0; i < file->dependency_count(); i++) {
const FileDescriptor* dep = file->dependency(i);
@@ -188,7 +160,6 @@ bool IsDirectDependency(const FileDescriptor* dep, const FileDescriptor* file) {
FileGenerator::FileGenerator(const FileDescriptor *file, const Options& options)
: file_(file),
root_class_name_(FileClassName(file)),
- is_bundled_proto_(IsProtobufLibraryBundledProtoFile(file)),
options_(options) {
for (int i = 0; i < file_->enum_type_count(); i++) {
EnumGenerator *generator = new EnumGenerator(file_->enum_type(i));
@@ -215,17 +186,7 @@ FileGenerator::~FileGenerator() {
}
void FileGenerator::GenerateHeader(io::Printer *printer) {
- std::set<string> headers;
- // Generated files bundled with the library get minimal imports, everything
- // else gets the wrapper so everything is usable.
- if (is_bundled_proto_) {
- headers.insert("GPBRootObject.h");
- headers.insert("GPBMessage.h");
- headers.insert("GPBDescriptor.h");
- } else {
- headers.insert("GPBProtocolBuffers.h");
- }
- PrintFileRuntimePreamble(printer, headers);
+ PrintFileRuntimePreamble(printer, "GPBProtocolBuffers.h");
// Add some verification that the generated code matches the source the
// code is being compiled with.
@@ -247,8 +208,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
{
ImportWriter import_writer(
options_.generate_for_named_framework,
- options_.named_framework_to_proto_path_mappings_path,
- is_bundled_proto_);
+ options_.named_framework_to_proto_path_mappings_path);
const string header_extension(kHeaderExtension);
for (int i = 0; i < file_->public_dependency_count(); i++) {
import_writer.AddFile(file_->public_dependency(i), header_extension);
@@ -270,7 +230,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
"\n");
std::set<string> fwd_decls;
- for (std::vector<MessageGenerator *>::iterator iter = message_generators_.begin();
+ for (vector<MessageGenerator *>::iterator iter = message_generators_.begin();
iter != message_generators_.end(); ++iter) {
(*iter)->DetermineForwardDeclarations(&fwd_decls);
}
@@ -287,12 +247,12 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
"\n");
// need to write out all enums first
- for (std::vector<EnumGenerator *>::iterator iter = enum_generators_.begin();
+ for (vector<EnumGenerator *>::iterator iter = enum_generators_.begin();
iter != enum_generators_.end(); ++iter) {
(*iter)->GenerateHeader(printer);
}
- for (std::vector<MessageGenerator *>::iterator iter = message_generators_.begin();
+ for (vector<MessageGenerator *>::iterator iter = message_generators_.begin();
iter != message_generators_.end(); ++iter) {
(*iter)->GenerateEnumHeader(printer);
}
@@ -323,7 +283,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
"@interface $root_class_name$ (DynamicMethods)\n",
"root_class_name", root_class_name_);
- for (std::vector<ExtensionGenerator *>::iterator iter =
+ for (vector<ExtensionGenerator *>::iterator iter =
extension_generators_.begin();
iter != extension_generators_.end(); ++iter) {
(*iter)->GenerateMembersHeader(printer);
@@ -332,7 +292,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
printer->Print("@end\n\n");
} // extension_generators_.size() > 0
- for (std::vector<MessageGenerator *>::iterator iter = message_generators_.begin();
+ for (vector<MessageGenerator *>::iterator iter = message_generators_.begin();
iter != message_generators_.end(); ++iter) {
(*iter)->GenerateMessageHeader(printer);
}
@@ -349,25 +309,15 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
void FileGenerator::GenerateSource(io::Printer *printer) {
// #import the runtime support.
- std::set<string> headers;
- headers.insert("GPBProtocolBuffers_RuntimeSupport.h");
- PrintFileRuntimePreamble(printer, headers);
-
- // Enums use atomic in the generated code, so add the system import as needed.
- if (FileContainsEnums(file_)) {
- printer->Print(
- "#import <stdatomic.h>\n"
- "\n");
- }
+ PrintFileRuntimePreamble(printer, "GPBProtocolBuffers_RuntimeSupport.h");
- std::vector<const FileDescriptor*> deps_with_extensions;
+ vector<const FileDescriptor*> deps_with_extensions;
CollectMinimalFileDepsContainingExtensions(file_, &deps_with_extensions);
{
ImportWriter import_writer(
options_.generate_for_named_framework,
- options_.named_framework_to_proto_path_mappings_path,
- is_bundled_proto_);
+ options_.named_framework_to_proto_path_mappings_path);
const string header_extension(kHeaderExtension);
// #import the header for this proto file.
@@ -391,7 +341,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
// imported so it can get merged into the root's extensions registry.
// See the Note by CollectMinimalFileDepsContainingExtensions before
// changing this.
- for (std::vector<const FileDescriptor *>::iterator iter =
+ for (vector<const FileDescriptor *>::iterator iter =
deps_with_extensions.begin();
iter != deps_with_extensions.end(); ++iter) {
if (!IsDirectDependency(*iter, file_)) {
@@ -403,7 +353,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
}
bool includes_oneof = false;
- for (std::vector<MessageGenerator *>::iterator iter = message_generators_.begin();
+ for (vector<MessageGenerator *>::iterator iter = message_generators_.begin();
iter != message_generators_.end(); ++iter) {
if ((*iter)->IncludesOneOfDefinition()) {
includes_oneof = true;
@@ -456,12 +406,12 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
printer->Print(
"static GPBExtensionDescription descriptions[] = {\n");
printer->Indent();
- for (std::vector<ExtensionGenerator *>::iterator iter =
+ for (vector<ExtensionGenerator *>::iterator iter =
extension_generators_.begin();
iter != extension_generators_.end(); ++iter) {
(*iter)->GenerateStaticVariablesInitialization(printer);
}
- for (std::vector<MessageGenerator *>::iterator iter =
+ for (vector<MessageGenerator *>::iterator iter =
message_generators_.begin();
iter != message_generators_.end(); ++iter) {
(*iter)->GenerateStaticVariablesInitialization(printer);
@@ -485,7 +435,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
} else {
printer->Print(
"// Merge in the imports (direct or indirect) that defined extensions.\n");
- for (std::vector<const FileDescriptor *>::iterator iter =
+ for (vector<const FileDescriptor *>::iterator iter =
deps_with_extensions.begin();
iter != deps_with_extensions.end(); ++iter) {
const string root_class_name(FileClassName((*iter)));
@@ -561,11 +511,11 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
"\n");
}
- for (std::vector<EnumGenerator *>::iterator iter = enum_generators_.begin();
+ for (vector<EnumGenerator *>::iterator iter = enum_generators_.begin();
iter != enum_generators_.end(); ++iter) {
(*iter)->GenerateSource(printer);
}
- for (std::vector<MessageGenerator *>::iterator iter = message_generators_.begin();
+ for (vector<MessageGenerator *>::iterator iter = message_generators_.begin();
iter != message_generators_.end(); ++iter) {
(*iter)->GenerateSource(printer);
}
@@ -581,7 +531,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
// files. This currently only supports the runtime coming from a framework
// as defined by the official CocoaPod.
void FileGenerator::PrintFileRuntimePreamble(
- io::Printer* printer, const std::set<string>& headers_to_import) const {
+ io::Printer* printer, const string& header_to_import) const {
printer->Print(
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"// source: $filename$\n"
@@ -590,7 +540,6 @@ void FileGenerator::PrintFileRuntimePreamble(
const string framework_name(ProtobufLibraryFrameworkName);
const string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name));
-
printer->Print(
"// This CPP symbol can be defined to use imports that match up to the framework\n"
"// imports needed when using CocoaPods.\n"
@@ -598,31 +547,15 @@ void FileGenerator::PrintFileRuntimePreamble(
" #define $cpp_symbol$ 0\n"
"#endif\n"
"\n"
- "#if $cpp_symbol$\n",
- "cpp_symbol", cpp_symbol);
-
-
- for (std::set<string>::const_iterator iter = headers_to_import.begin();
- iter != headers_to_import.end(); ++iter) {
- printer->Print(
- " #import <$framework_name$/$header$>\n",
- "header", *iter,
- "framework_name", framework_name);
- }
-
- printer->Print(
- "#else\n");
-
- for (std::set<string>::const_iterator iter = headers_to_import.begin();
- iter != headers_to_import.end(); ++iter) {
- printer->Print(
- " #import \"$header$\"\n",
- "header", *iter);
- }
-
- printer->Print(
+ "#if $cpp_symbol$\n"
+ " #import <$framework_name$/$header$>\n"
+ "#else\n"
+ " #import \"$header$\"\n"
"#endif\n"
- "\n");
+ "\n",
+ "cpp_symbol", cpp_symbol,
+ "header", header_to_import,
+ "framework_name", framework_name);
}
} // namespace objectivec
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_file.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_file.h
index 1754fc0ad2..a60a6885c0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_file.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_file.h
@@ -66,16 +66,15 @@ class FileGenerator {
private:
const FileDescriptor* file_;
string root_class_name_;
- bool is_bundled_proto_;
- std::vector<EnumGenerator*> enum_generators_;
- std::vector<MessageGenerator*> message_generators_;
- std::vector<ExtensionGenerator*> extension_generators_;
+ vector<EnumGenerator*> enum_generators_;
+ vector<MessageGenerator*> message_generators_;
+ vector<ExtensionGenerator*> extension_generators_;
const Options options_;
void PrintFileRuntimePreamble(
- io::Printer* printer, const std::set<string>& headers_to_import) const;
+ io::Printer* printer, const string& header_to_import) const;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
index e0597cc7ff..3640746798 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
@@ -57,7 +57,7 @@ bool ObjectiveCGenerator::Generate(const FileDescriptor* file,
return false;
}
-bool ObjectiveCGenerator::GenerateAll(const std::vector<const FileDescriptor*>& files,
+bool ObjectiveCGenerator::GenerateAll(const vector<const FileDescriptor*>& files,
const string& parameter,
GeneratorContext* context,
string* error) const {
@@ -71,7 +71,7 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector<const FileDescriptor*>&
Options generation_options;
- std::vector<std::pair<string, string> > options;
+ vector<pair<string, string> > options;
ParseGeneratorParameter(parameter, &options);
for (int i = 0; i < options.size(); i++) {
if (options[i].first == "expected_prefixes_path") {
@@ -142,7 +142,7 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector<const FileDescriptor*>&
// Generate header.
{
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ scoped_ptr<io::ZeroCopyOutputStream> output(
context->Open(filepath + ".pbobjc.h"));
io::Printer printer(output.get(), '$');
file_generator.GenerateHeader(&printer);
@@ -150,7 +150,7 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector<const FileDescriptor*>&
// Generate m file.
{
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ scoped_ptr<io::ZeroCopyOutputStream> output(
context->Open(filepath + ".pbobjc.m"));
io::Printer printer(output.get(), '$');
file_generator.GenerateSource(&printer);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_generator.h
index 3e43f732d8..b172331861 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_generator.h
@@ -56,7 +56,7 @@ class LIBPROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator {
const string& parameter,
GeneratorContext* context,
string* error) const;
- bool GenerateAll(const std::vector<const FileDescriptor*>& files,
+ bool GenerateAll(const vector<const FileDescriptor*>& files,
const string& parameter,
GeneratorContext* context,
string* error) const;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
index df71c8bb1e..54dc7455d9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
@@ -50,6 +50,11 @@
#include <google/protobuf/stubs/io_win32.h>
#include <google/protobuf/stubs/strutil.h>
+#if defined(_MSC_VER)
+// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
+// them like we do below.
+using google::protobuf::internal::win32::open;
+#endif
// NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
// error cases, so it seems to be ok to use as a back door for errors.
@@ -59,16 +64,6 @@ namespace protobuf {
namespace compiler {
namespace objectivec {
-// <io.h> is transitively included in this file. Import the functions explicitly
-// in this port namespace to avoid ambiguous definition.
-namespace posix {
-#ifdef _WIN32
-using ::google::protobuf::internal::win32::open;
-#else
-using ::open;
-#endif
-} // namespace port
-
Options::Options() {
// Default is the value of the env for the package prefixes.
const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES");
@@ -100,7 +95,7 @@ bool ascii_isnewline(char c) {
// Do not expose this outside of helpers, stick to having functions for specific
// cases (ClassName(), FieldName()), so there is always consistent suffix rules.
string UnderscoresToCamelCase(const string& input, bool first_capitalized) {
- std::vector<string> values;
+ vector<string> values;
string current;
bool last_char_was_number = false;
@@ -141,7 +136,7 @@ string UnderscoresToCamelCase(const string& input, bool first_capitalized) {
string result;
bool first_segment_forces_upper = false;
- for (std::vector<string>::iterator i = values.begin(); i != values.end(); ++i) {
+ for (vector<string>::iterator i = values.begin(); i != values.end(); ++i) {
string value = *i;
bool all_upper = (kUpperSegments.count(value) > 0);
if (all_upper && (result.length() == 0)) {
@@ -864,7 +859,7 @@ bool HasNonZeroDefaultValue(const FieldDescriptor* field) {
}
string BuildFlagsString(const FlagType flag_type,
- const std::vector<string>& strings) {
+ const vector<string>& strings) {
if (strings.size() == 0) {
return GetZeroEnumNameForFlagType(flag_type);
} else if (strings.size() == 1) {
@@ -886,7 +881,7 @@ string BuildCommentsString(const SourceLocation& location,
const string& comments = location.leading_comments.empty()
? location.trailing_comments
: location.leading_comments;
- std::vector<string> lines;
+ vector<string> lines;
SplitStringAllowEmpty(comments, "\n", &lines);
while (!lines.empty() && lines.back().empty()) {
lines.pop_back();
@@ -1156,7 +1151,7 @@ bool ValidateObjCClassPrefix(
} // namespace
-bool ValidateObjCClassPrefixes(const std::vector<const FileDescriptor*>& files,
+bool ValidateObjCClassPrefixes(const vector<const FileDescriptor*>& files,
const Options& generation_options,
string* out_error) {
// Load the expected package prefixes, if available, to validate against.
@@ -1187,7 +1182,7 @@ TextFormatDecodeData::~TextFormatDecodeData() { }
void TextFormatDecodeData::AddString(int32 key,
const string& input_for_decode,
const string& desired_output) {
- for (std::vector<DataEntry>::const_iterator i = entries_.begin();
+ for (vector<DataEntry>::const_iterator i = entries_.begin();
i != entries_.end(); ++i) {
if (i->first == key) {
std::cerr << "error: duplicate key (" << key
@@ -1211,7 +1206,7 @@ string TextFormatDecodeData::Data() const {
io::CodedOutputStream output_stream(&data_outputstream);
output_stream.WriteVarint32(num_entries());
- for (std::vector<DataEntry>::const_iterator i = entries_.begin();
+ for (vector<DataEntry>::const_iterator i = entries_.begin();
i != entries_.end(); ++i) {
output_stream.WriteVarint32(i->first);
output_stream.WriteString(i->second);
@@ -1474,7 +1469,7 @@ bool ParseSimpleFile(
const string& path, LineConsumer* line_consumer, string* out_error) {
int fd;
do {
- fd = posix::open(path.c_str(), O_RDONLY);
+ fd = open(path.c_str(), O_RDONLY);
} while (fd < 0 && errno == EINTR);
if (fd < 0) {
*out_error =
@@ -1504,12 +1499,10 @@ bool ParseSimpleFile(
ImportWriter::ImportWriter(
const string& generate_for_named_framework,
- const string& named_framework_to_proto_path_mappings_path,
- bool include_wkt_imports)
+ const string& named_framework_to_proto_path_mappings_path)
: generate_for_named_framework_(generate_for_named_framework),
named_framework_to_proto_path_mappings_path_(
named_framework_to_proto_path_mappings_path),
- include_wkt_imports_(include_wkt_imports),
need_to_parse_mapping_file_(true) {
}
@@ -1520,14 +1513,9 @@ void ImportWriter::AddFile(const FileDescriptor* file,
const string file_path(FilePath(file));
if (IsProtobufLibraryBundledProtoFile(file)) {
- // The imports of the WKTs are only needed within the library itself,
- // in other cases, they get skipped because the generated code already
- // import GPBProtocolBuffers.h and hence proves them.
- if (include_wkt_imports_) {
- protobuf_framework_imports_.push_back(
- FilePathBasename(file) + header_extension);
- protobuf_non_framework_imports_.push_back(file_path + header_extension);
- }
+ protobuf_framework_imports_.push_back(
+ FilePathBasename(file) + header_extension);
+ protobuf_non_framework_imports_.push_back(file_path + header_extension);
return;
}
@@ -1568,7 +1556,7 @@ void ImportWriter::Print(io::Printer* printer) const {
printer->Print(
"#if $cpp_symbol$\n",
"cpp_symbol", cpp_symbol);
- for (std::vector<string>::const_iterator iter = protobuf_framework_imports_.begin();
+ for (vector<string>::const_iterator iter = protobuf_framework_imports_.begin();
iter != protobuf_framework_imports_.end(); ++iter) {
printer->Print(
" #import <$framework_name$/$header$>\n",
@@ -1577,7 +1565,7 @@ void ImportWriter::Print(io::Printer* printer) const {
}
printer->Print(
"#else\n");
- for (std::vector<string>::const_iterator iter = protobuf_non_framework_imports_.begin();
+ for (vector<string>::const_iterator iter = protobuf_non_framework_imports_.begin();
iter != protobuf_non_framework_imports_.end(); ++iter) {
printer->Print(
" #import \"$header$\"\n",
@@ -1594,10 +1582,10 @@ void ImportWriter::Print(io::Printer* printer) const {
printer->Print("\n");
}
- for (std::vector<string>::const_iterator iter = other_framework_imports_.begin();
+ for (vector<string>::const_iterator iter = other_framework_imports_.begin();
iter != other_framework_imports_.end(); ++iter) {
printer->Print(
- "#import <$header$>\n",
+ " #import <$header$>\n",
"header", *iter);
}
@@ -1609,10 +1597,10 @@ void ImportWriter::Print(io::Printer* printer) const {
printer->Print("\n");
}
- for (std::vector<string>::const_iterator iter = other_imports_.begin();
+ for (vector<string>::const_iterator iter = other_imports_.begin();
iter != other_imports_.end(); ++iter) {
printer->Print(
- "#import \"$header$\"\n",
+ " #import \"$header$\"\n",
"header", *iter);
}
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
index 8999aa595e..daea7609e5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
@@ -190,7 +190,7 @@ string LIBPROTOC_EXPORT GPBGenericValueFieldName(const FieldDescriptor* field);
string LIBPROTOC_EXPORT DefaultValue(const FieldDescriptor* field);
bool LIBPROTOC_EXPORT HasNonZeroDefaultValue(const FieldDescriptor* field);
-string LIBPROTOC_EXPORT BuildFlagsString(const FlagType type, const std::vector<string>& strings);
+string LIBPROTOC_EXPORT BuildFlagsString(const FlagType type, const vector<string>& strings);
// Builds HeaderDoc/appledoc style comments out of the comments in the .proto
// file.
@@ -210,7 +210,7 @@ bool LIBPROTOC_EXPORT IsProtobufLibraryBundledProtoFile(const FileDescriptor* fi
// Checks the prefix for the given files and outputs any warnings as needed. If
// there are flat out errors, then out_error is filled in with the first error
// and the result is false.
-bool LIBPROTOC_EXPORT ValidateObjCClassPrefixes(const std::vector<const FileDescriptor*>& files,
+bool LIBPROTOC_EXPORT ValidateObjCClassPrefixes(const vector<const FileDescriptor*>& files,
const Options& generation_options,
string* out_error);
@@ -233,7 +233,7 @@ class LIBPROTOC_EXPORT TextFormatDecodeData {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TextFormatDecodeData);
typedef std::pair<int32, string> DataEntry;
- std::vector<DataEntry> entries_;
+ vector<DataEntry> entries_;
};
// Helper for parsing simple files.
@@ -253,8 +253,7 @@ bool LIBPROTOC_EXPORT ParseSimpleFile(
class LIBPROTOC_EXPORT ImportWriter {
public:
ImportWriter(const string& generate_for_named_framework,
- const string& named_framework_to_proto_path_mappings_path,
- bool include_wkt_imports);
+ const string& named_framework_to_proto_path_mappings_path);
~ImportWriter();
void AddFile(const FileDescriptor* file, const string& header_extension);
@@ -276,14 +275,13 @@ class LIBPROTOC_EXPORT ImportWriter {
const string generate_for_named_framework_;
const string named_framework_to_proto_path_mappings_path_;
- const bool include_wkt_imports_;
std::map<string, string> proto_file_to_framework_name_;
bool need_to_parse_mapping_file_;
- std::vector<string> protobuf_framework_imports_;
- std::vector<string> protobuf_non_framework_imports_;
- std::vector<string> other_framework_imports_;
- std::vector<string> other_imports_;
+ vector<string> protobuf_framework_imports_;
+ vector<string> protobuf_non_framework_imports_;
+ vector<string> other_framework_imports_;
+ vector<string> other_imports_;
};
} // namespace objectivec
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
index dc1cef556f..dc1cef556f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
index bcaf570900..bcaf570900 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
index dc7beacf2d..6664d84939 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
@@ -54,7 +54,7 @@ class MapFieldGenerator : public RepeatedFieldGenerator {
virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const;
private:
- std::unique_ptr<FieldGenerator> value_field_generator_;
+ scoped_ptr<FieldGenerator> value_field_generator_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message.cc
index 838888549c..4f22e290fa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message.cc
@@ -220,13 +220,13 @@ MessageGenerator::~MessageGenerator() {
void MessageGenerator::GenerateStaticVariablesInitialization(
io::Printer* printer) {
- for (std::vector<ExtensionGenerator*>::iterator iter =
+ for (vector<ExtensionGenerator*>::iterator iter =
extension_generators_.begin();
iter != extension_generators_.end(); ++iter) {
(*iter)->GenerateStaticVariablesInitialization(printer);
}
- for (std::vector<MessageGenerator*>::iterator iter =
+ for (vector<MessageGenerator*>::iterator iter =
nested_message_generators_.begin();
iter != nested_message_generators_.end(); ++iter) {
(*iter)->GenerateStaticVariablesInitialization(printer);
@@ -242,7 +242,7 @@ void MessageGenerator::DetermineForwardDeclarations(std::set<string>* fwd_decls)
}
}
- for (std::vector<MessageGenerator*>::iterator iter =
+ for (vector<MessageGenerator*>::iterator iter =
nested_message_generators_.begin();
iter != nested_message_generators_.end(); ++iter) {
(*iter)->DetermineForwardDeclarations(fwd_decls);
@@ -254,7 +254,7 @@ bool MessageGenerator::IncludesOneOfDefinition() const {
return true;
}
- for (std::vector<MessageGenerator*>::const_iterator iter =
+ for (vector<MessageGenerator*>::const_iterator iter =
nested_message_generators_.begin();
iter != nested_message_generators_.end(); ++iter) {
if ((*iter)->IncludesOneOfDefinition()) {
@@ -266,12 +266,12 @@ bool MessageGenerator::IncludesOneOfDefinition() const {
}
void MessageGenerator::GenerateEnumHeader(io::Printer* printer) {
- for (std::vector<EnumGenerator*>::iterator iter = enum_generators_.begin();
+ for (vector<EnumGenerator*>::iterator iter = enum_generators_.begin();
iter != enum_generators_.end(); ++iter) {
(*iter)->GenerateHeader(printer);
}
- for (std::vector<MessageGenerator*>::iterator iter =
+ for (vector<MessageGenerator*>::iterator iter =
nested_message_generators_.begin();
iter != nested_message_generators_.end(); ++iter) {
(*iter)->GenerateEnumHeader(printer);
@@ -280,13 +280,13 @@ void MessageGenerator::GenerateEnumHeader(io::Printer* printer) {
void MessageGenerator::GenerateExtensionRegistrationSource(
io::Printer* printer) {
- for (std::vector<ExtensionGenerator*>::iterator iter =
+ for (vector<ExtensionGenerator*>::iterator iter =
extension_generators_.begin();
iter != extension_generators_.end(); ++iter) {
(*iter)->GenerateRegistrationSource(printer);
}
- for (std::vector<MessageGenerator*>::iterator iter =
+ for (vector<MessageGenerator*>::iterator iter =
nested_message_generators_.begin();
iter != nested_message_generators_.end(); ++iter) {
(*iter)->GenerateExtensionRegistrationSource(printer);
@@ -296,7 +296,7 @@ void MessageGenerator::GenerateExtensionRegistrationSource(
void MessageGenerator::GenerateMessageHeader(io::Printer* printer) {
// This a a map entry message, just recurse and do nothing directly.
if (IsMapEntryMessage(descriptor_)) {
- for (std::vector<MessageGenerator*>::iterator iter =
+ for (vector<MessageGenerator*>::iterator iter =
nested_message_generators_.begin();
iter != nested_message_generators_.end(); ++iter) {
(*iter)->GenerateMessageHeader(printer);
@@ -310,7 +310,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) {
"classname", class_name_);
if (descriptor_->field_count()) {
- std::unique_ptr<const FieldDescriptor*[]> sorted_fields(
+ scoped_array<const FieldDescriptor*> sorted_fields(
SortFieldsByNumber(descriptor_));
printer->Print("typedef GPB_ENUM($classname$_FieldNumber) {\n",
@@ -326,7 +326,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) {
printer->Print("};\n\n");
}
- for (std::vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
+ for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
iter != oneof_generators_.end(); ++iter) {
(*iter)->GenerateCaseEnum(printer);
}
@@ -345,7 +345,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) {
"deprecated_attribute", deprecated_attribute_,
"comments", message_comments);
- std::vector<char> seen_oneofs(descriptor_->oneof_decl_count(), 0);
+ vector<char> seen_oneofs(descriptor_->oneof_decl_count(), 0);
for (int i = 0; i < descriptor_->field_count(); i++) {
const FieldDescriptor* field = descriptor_->field(i);
if (field->containing_oneof() != NULL) {
@@ -367,7 +367,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) {
}
if (!oneof_generators_.empty()) {
- for (std::vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
+ for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
iter != oneof_generators_.end(); ++iter) {
(*iter)->GenerateClearFunctionDeclaration(printer);
}
@@ -377,7 +377,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) {
if (descriptor_->extension_count() > 0) {
printer->Print("@interface $classname$ (DynamicMethods)\n\n",
"classname", class_name_);
- for (std::vector<ExtensionGenerator*>::iterator iter =
+ for (vector<ExtensionGenerator*>::iterator iter =
extension_generators_.begin();
iter != extension_generators_.end(); ++iter) {
(*iter)->GenerateMembersHeader(printer);
@@ -385,7 +385,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) {
printer->Print("@end\n\n");
}
- for (std::vector<MessageGenerator*>::iterator iter =
+ for (vector<MessageGenerator*>::iterator iter =
nested_message_generators_.begin();
iter != nested_message_generators_.end(); ++iter) {
(*iter)->GenerateMessageHeader(printer);
@@ -410,7 +410,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
printer->Print("@implementation $classname$\n\n",
"classname", class_name_);
- for (std::vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
+ for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
iter != oneof_generators_.end(); ++iter) {
(*iter)->GeneratePropertyImplementation(printer);
}
@@ -420,12 +420,12 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
.GeneratePropertyImplementation(printer);
}
- std::unique_ptr<const FieldDescriptor*[]> sorted_fields(
+ scoped_array<const FieldDescriptor*> sorted_fields(
SortFieldsByNumber(descriptor_));
- std::unique_ptr<const FieldDescriptor*[]> size_order_fields(
+ scoped_array<const FieldDescriptor*> size_order_fields(
SortFieldsByStorageSize(descriptor_));
- std::vector<const Descriptor::ExtensionRange*> sorted_extensions;
+ vector<const Descriptor::ExtensionRange*> sorted_extensions;
for (int i = 0; i < descriptor_->extension_range_count(); ++i) {
sorted_extensions.push_back(descriptor_->extension_range(i));
}
@@ -448,7 +448,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
sizeof_has_storage = 1;
}
// Tell all the fields the oneof base.
- for (std::vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
+ for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
iter != oneof_generators_.end(); ++iter) {
(*iter)->SetOneofIndexBase(sizeof_has_storage);
}
@@ -548,7 +548,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
if (oneof_generators_.size() != 0) {
printer->Print(
" static const char *oneofs[] = {\n");
- for (std::vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
+ for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
iter != oneof_generators_.end(); ++iter) {
printer->Print(
" \"$name$\",\n",
@@ -623,18 +623,18 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
.GenerateCFunctionImplementations(printer);
}
- for (std::vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
+ for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
iter != oneof_generators_.end(); ++iter) {
(*iter)->GenerateClearFunctionImplementation(printer);
}
}
- for (std::vector<EnumGenerator*>::iterator iter = enum_generators_.begin();
+ for (vector<EnumGenerator*>::iterator iter = enum_generators_.begin();
iter != enum_generators_.end(); ++iter) {
(*iter)->GenerateSource(printer);
}
- for (std::vector<MessageGenerator*>::iterator iter =
+ for (vector<MessageGenerator*>::iterator iter =
nested_message_generators_.begin();
iter != nested_message_generators_.end(); ++iter) {
(*iter)->GenerateSource(printer);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message.h
index 2de03f12fb..8f317ac05c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message.h
@@ -86,10 +86,10 @@ class MessageGenerator {
FieldGeneratorMap field_generators_;
const string class_name_;
const string deprecated_attribute_;
- std::vector<ExtensionGenerator*> extension_generators_;
- std::vector<EnumGenerator*> enum_generators_;
- std::vector<MessageGenerator*> nested_message_generators_;
- std::vector<OneofGenerator*> oneof_generators_;
+ vector<ExtensionGenerator*> extension_generators_;
+ vector<EnumGenerator*> enum_generators_;
+ vector<MessageGenerator*> nested_message_generators_;
+ vector<OneofGenerator*> oneof_generators_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
index 699d25b31f..699d25b31f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
index 50f4b6d4a9..50f4b6d4a9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
index 5531ae249f..5531ae249f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
index ff353a6c62..ff353a6c62 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
index aa8ac32430..aa8ac32430 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
index 69bb1fddc1..69bb1fddc1 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/package_info.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/package_info.h
index fb6b473e1c..fb6b473e1c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/package_info.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/package_info.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser.cc
index 5c7047a631..bb4a44c354 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser.cc
@@ -39,14 +39,13 @@
#include <limits>
-#include <google/protobuf/stubs/casts.h>
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/parser.h>
-#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/descriptor.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/wire_format.h>
+#include <google/protobuf/io/tokenizer.h>
+#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/map_util.h>
@@ -337,42 +336,31 @@ void Parser::AddError(const string& error) {
Parser::LocationRecorder::LocationRecorder(Parser* parser)
: parser_(parser),
- source_code_info_(parser->source_code_info_),
location_(parser_->source_code_info_->add_location()) {
location_->add_span(parser_->input_->current().line);
location_->add_span(parser_->input_->current().column);
}
Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent) {
- Init(parent, parent.source_code_info_);
-}
-
-Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent,
- int path1,
- SourceCodeInfo* source_code_info) {
- Init(parent, source_code_info);
- AddPath(path1);
+ Init(parent);
}
Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent,
int path1) {
- Init(parent, parent.source_code_info_);
+ Init(parent);
AddPath(path1);
}
Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent,
int path1, int path2) {
- Init(parent, parent.source_code_info_);
+ Init(parent);
AddPath(path1);
AddPath(path2);
}
-void Parser::LocationRecorder::Init(const LocationRecorder& parent,
- SourceCodeInfo* source_code_info) {
+void Parser::LocationRecorder::Init(const LocationRecorder& parent) {
parser_ = parent.parser_;
- source_code_info_ = source_code_info;
-
- location_ = source_code_info_->add_location();
+ location_ = parser_->source_code_info_->add_location();
location_->mutable_path()->CopyFrom(parent.location_->path());
location_->add_span(parser_->input_->current().line);
@@ -414,10 +402,6 @@ void Parser::LocationRecorder::RecordLegacyLocation(const Message* descriptor,
}
}
-int Parser::LocationRecorder::CurrentPathSize() const {
- return location_->path_size();
-}
-
void Parser::LocationRecorder::AttachComments(
string* leading, string* trailing,
std::vector<string>* detached_comments) const {
@@ -1511,30 +1495,21 @@ bool Parser::ParseExtensions(DescriptorProto* message,
range->set_end(end);
} while (TryConsume(","));
-
if (LookingAt("[")) {
- int range_number_index = extensions_location.CurrentPathSize();
- SourceCodeInfo info;
+ LocationRecorder location(
+ extensions_location,
+ DescriptorProto::ExtensionRange::kOptionsFieldNumber);
+
+ DO(Consume("["));
// Parse extension range options in the first range.
ExtensionRangeOptions* options =
message->mutable_extension_range(old_range_size)->mutable_options();
+ do {
+ DO(ParseOption(options, location, containing_file, OPTION_ASSIGNMENT));
+ } while (TryConsume(","));
- {
- LocationRecorder index_location(
- extensions_location, 0 /* we fill this in w/ actual index below */,
- &info);
- LocationRecorder location(
- index_location,
- DescriptorProto::ExtensionRange::kOptionsFieldNumber);
- DO(Consume("["));
-
- do {
- DO(ParseOption(options, location, containing_file, OPTION_ASSIGNMENT));
- } while (TryConsume(","));
-
- DO(Consume("]"));
- }
+ DO(Consume("]"));
// Then copy the extension range options to all of the other ranges we've
// parsed.
@@ -1542,19 +1517,6 @@ bool Parser::ParseExtensions(DescriptorProto* message,
message->mutable_extension_range(i)->mutable_options()
->CopyFrom(*options);
}
- // and copy source locations to the other ranges, too
- for (int i = old_range_size; i < message->extension_range_size(); i++) {
- for (int j = 0; j < info.location_size(); j++) {
- if (info.location(j).path_size() == range_number_index + 1) {
- // this location's path is up to the extension range index, but doesn't
- // include options; so it's redundant with location above
- continue;
- }
- SourceCodeInfo_Location* dest = source_code_info_->add_location();
- dest->CopyFrom(info.location(j));
- dest->set_path(range_number_index, i);
- }
- }
}
DO(ConsumeEndOfDeclaration(";", &extensions_location));
@@ -1578,6 +1540,7 @@ bool Parser::ParseReserved(DescriptorProto* message,
}
}
+
bool Parser::ParseReservedNames(DescriptorProto* message,
const LocationRecorder& parent_location) {
do {
@@ -1638,77 +1601,6 @@ bool Parser::ParseReservedNumbers(DescriptorProto* message,
return true;
}
-bool Parser::ParseReserved(EnumDescriptorProto* message,
- const LocationRecorder& message_location) {
- // Parse the declaration.
- DO(Consume("reserved"));
- if (LookingAtType(io::Tokenizer::TYPE_STRING)) {
- LocationRecorder location(message_location,
- DescriptorProto::kReservedNameFieldNumber);
- return ParseReservedNames(message, location);
- } else {
- LocationRecorder location(message_location,
- DescriptorProto::kReservedRangeFieldNumber);
- return ParseReservedNumbers(message, location);
- }
-}
-
-bool Parser::ParseReservedNames(EnumDescriptorProto* message,
- const LocationRecorder& parent_location) {
- do {
- LocationRecorder location(parent_location, message->reserved_name_size());
- DO(ConsumeString(message->add_reserved_name(), "Expected enum value."));
- } while (TryConsume(","));
- DO(ConsumeEndOfDeclaration(";", &parent_location));
- return true;
-}
-
-bool Parser::ParseReservedNumbers(EnumDescriptorProto* message,
- const LocationRecorder& parent_location) {
- bool first = true;
- do {
- LocationRecorder location(parent_location, message->reserved_range_size());
-
- EnumDescriptorProto::EnumReservedRange* range =
- message->add_reserved_range();
- int start, end;
- io::Tokenizer::Token start_token;
- {
- LocationRecorder start_location(
- location, EnumDescriptorProto::EnumReservedRange::kStartFieldNumber);
- start_token = input_->current();
- DO(ConsumeSignedInteger(&start, (first ?
- "Expected enum value or number range." :
- "Expected enum number range.")));
- }
-
- if (TryConsume("to")) {
- LocationRecorder end_location(
- location, EnumDescriptorProto::EnumReservedRange::kEndFieldNumber);
- if (TryConsume("max")) {
- // This is in the enum descriptor path, which doesn't have the message
- // set duality to fix up, so it doesn't integrate with the sentinel.
- end = INT_MAX;
- } else {
- DO(ConsumeSignedInteger(&end, "Expected integer."));
- }
- } else {
- LocationRecorder end_location(
- location, EnumDescriptorProto::EnumReservedRange::kEndFieldNumber);
- end_location.StartAt(start_token);
- end_location.EndAt(start_token);
- end = start;
- }
-
- range->set_start(start);
- range->set_end(end);
- first = false;
- } while (TryConsume(","));
-
- DO(ConsumeEndOfDeclaration(";", &parent_location));
- return true;
-}
-
bool Parser::ParseExtend(RepeatedPtrField<FieldDescriptorProto>* extensions,
RepeatedPtrField<DescriptorProto>* messages,
const LocationRecorder& parent_location,
@@ -1889,8 +1781,6 @@ bool Parser::ParseEnumStatement(EnumDescriptorProto* enum_type,
EnumDescriptorProto::kOptionsFieldNumber);
return ParseOption(enum_type->mutable_options(), location,
containing_file, OPTION_STATEMENT);
- } else if (LookingAt("reserved")) {
- return ParseReserved(enum_type, enum_location);
} else {
LocationRecorder location(enum_location,
EnumDescriptorProto::kValueFieldNumber, enum_type->value_size());
@@ -2277,5 +2167,4 @@ void SourceLocationTable::Clear() {
} // namespace compiler
} // namespace protobuf
-
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser.h
index 5d98e5e18a..dd8b6586ee 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser.h
@@ -40,10 +40,10 @@
#include <map>
#include <string>
#include <utility>
-#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/descriptor.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/io/tokenizer.h>
namespace google {
namespace protobuf { class Message; }
@@ -224,10 +224,6 @@ class LIBPROTOBUF_EXPORT Parser {
LocationRecorder(const LocationRecorder& parent, int path1);
LocationRecorder(const LocationRecorder& parent, int path1, int path2);
- // Creates a recorder that generates locations into given source code info.
- LocationRecorder(const LocationRecorder& parent, int path1,
- SourceCodeInfo* source_code_info);
-
~LocationRecorder();
// Add a path component. See SourceCodeInfo.Location.path in
@@ -254,9 +250,6 @@ class LIBPROTOBUF_EXPORT Parser {
void RecordLegacyLocation(const Message* descriptor,
DescriptorPool::ErrorCollector::ErrorLocation location);
- // Returns the number of path components in the recorder's current location.
- int CurrentPathSize() const;
-
// Attaches leading and trailing comments to the location. The two strings
// will be swapped into place, so after this is called *leading and
// *trailing will be empty.
@@ -271,10 +264,9 @@ class LIBPROTOBUF_EXPORT Parser {
// SourceCodeInfo.location repeated field. For top-level elements,
// parent_index_ is -1.
Parser* parser_;
- SourceCodeInfo* source_code_info_;
SourceCodeInfo::Location* location_;
- void Init(const LocationRecorder& parent, SourceCodeInfo* source_code_info);
+ void Init(const LocationRecorder& parent);
};
// =================================================================
@@ -379,12 +371,6 @@ class LIBPROTOBUF_EXPORT Parser {
const LocationRecorder& parent_location);
bool ParseReservedNumbers(DescriptorProto* message,
const LocationRecorder& parent_location);
- bool ParseReserved(EnumDescriptorProto* message,
- const LocationRecorder& message_location);
- bool ParseReservedNames(EnumDescriptorProto* message,
- const LocationRecorder& parent_location);
- bool ParseReservedNumbers(EnumDescriptorProto* message,
- const LocationRecorder& parent_location);
// Parse an "extend" declaration. (See also comments for
// ParseMessageField().)
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser_unittest.cc
index 0725a68228..97831f71cb 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/parser_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/parser_unittest.cc
@@ -33,6 +33,9 @@
// Sanjay Ghemawat, Jeff Dean, and others.
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <algorithm>
#include <map>
@@ -47,7 +50,6 @@
#include <google/protobuf/text_format.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/substitute.h>
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/testing/googletest.h>
@@ -175,9 +177,9 @@ class ParserTest : public testing::Test {
MockErrorCollector error_collector_;
DescriptorPool pool_;
- std::unique_ptr<io::ZeroCopyInputStream> raw_input_;
- std::unique_ptr<io::Tokenizer> input_;
- std::unique_ptr<Parser> parser_;
+ google::protobuf::scoped_ptr<io::ZeroCopyInputStream> raw_input_;
+ google::protobuf::scoped_ptr<io::Tokenizer> input_;
+ google::protobuf::scoped_ptr<Parser> parser_;
bool require_syntax_identifier_;
};
@@ -992,42 +994,6 @@ TEST_F(ParseEnumTest, ValueOptions) {
"}");
}
-TEST_F(ParseEnumTest, ReservedRange) {
- ExpectParsesTo(
- "enum TestEnum {\n"
- " FOO = 0;\n"
- " reserved -2147483648, -6 to -4, -1 to 1, 2, 15, 9 to 11, 3, 20 to max;\n"
- "}\n",
-
- "enum_type {"
- " name: \"TestEnum\""
- " value { name:\"FOO\" number:0 }"
- " reserved_range { start:-2147483648 end:-2147483648 }"
- " reserved_range { start:-6 end:-4 }"
- " reserved_range { start:-1 end:1 }"
- " reserved_range { start:2 end:2 }"
- " reserved_range { start:15 end:15 }"
- " reserved_range { start:9 end:11 }"
- " reserved_range { start:3 end:3 }"
- " reserved_range { start:20 end:2147483647 }"
- "}");
-}
-
-TEST_F(ParseEnumTest, ReservedNames) {
- ExpectParsesTo(
- "enum TestEnum {\n"
- " FOO = 0;\n"
- " reserved \"foo\", \"bar\";\n"
- "}\n",
-
- "enum_type {"
- " name: \"TestEnum\""
- " value { name:\"FOO\" number:0 }"
- " reserved_name: \"foo\""
- " reserved_name: \"bar\""
- "}");
-}
-
// ===================================================================
typedef ParserTest ParseServiceTest;
@@ -1522,51 +1488,6 @@ TEST_F(ParseErrorTest, EnumValueMissingNumber) {
"1:5: Missing numeric value for enum constant.\n");
}
-TEST_F(ParseErrorTest, EnumReservedStandaloneMaxNotAllowed) {
- ExpectHasErrors(
- "enum TestEnum {\n"
- " FOO = 1;\n"
- " reserved max;\n"
- "}\n",
- "2:11: Expected enum value or number range.\n");
-}
-
-TEST_F(ParseErrorTest, EnumReservedMixNameAndNumber) {
- ExpectHasErrors(
- "enum TestEnum {\n"
- " FOO = 1;\n"
- " reserved 10, \"foo\";\n"
- "}\n",
- "2:15: Expected enum number range.\n");
-}
-
-TEST_F(ParseErrorTest, EnumReservedPositiveNumberOutOfRange) {
- ExpectHasErrors(
- "enum TestEnum {\n"
- "FOO = 1;\n"
- " reserved 2147483648;\n"
- "}\n",
- "2:11: Integer out of range.\n");
-}
-
-TEST_F(ParseErrorTest, EnumReservedNegativeNumberOutOfRange) {
- ExpectHasErrors(
- "enum TestEnum {\n"
- "FOO = 1;\n"
- " reserved -2147483649;\n"
- "}\n",
- "2:12: Integer out of range.\n");
-}
-
-TEST_F(ParseErrorTest, EnumReservedMissingQuotes) {
- ExpectHasErrors(
- "enum TestEnum {\n"
- " FOO = 1;\n"
- " reserved foo;\n"
- "}\n",
- "2:11: Expected enum value or number range.\n");
-}
-
// -------------------------------------------------------------------
// Reserved field number errors
@@ -1594,23 +1515,6 @@ TEST_F(ParseErrorTest, ReservedMissingQuotes) {
"1:11: Expected field name or number range.\n");
}
-TEST_F(ParseErrorTest, ReservedNegativeNumber) {
- ExpectHasErrors(
- "message Foo {\n"
- " reserved -10;\n"
- "}\n",
- "1:11: Expected field name or number range.\n");
-}
-
-TEST_F(ParseErrorTest, ReservedNumberOutOfRange) {
- ExpectHasErrors(
- "message Foo {\n"
- " reserved 2147483648;\n"
- "}\n",
- "1:11: Integer out of range.\n");
-}
-
-
// -------------------------------------------------------------------
// Service errors
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/php/php_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/php/php_generator.cc
index a58e1754d2..60e6fce99d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/php/php_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/php/php_generator.cc
@@ -40,6 +40,8 @@
#include <sstream>
+using google::protobuf::internal::scoped_ptr;
+
const std::string kDescriptorFile = "google/protobuf/descriptor.proto";
const std::string kEmptyFile = "google/protobuf/empty.proto";
const std::string kEmptyMetadataFile = "GPBMetadata/Google/Protobuf/GPBEmpty.php";
@@ -47,28 +49,8 @@ const std::string kDescriptorMetadataFile =
"GPBMetadata/Google/Protobuf/Internal/Descriptor.php";
const std::string kDescriptorDirName = "Google/Protobuf/Internal";
const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal";
-const char* const kReservedNames[] = {
- "abstract", "and", "array", "as", "break",
- "callable", "case", "catch", "class", "clone",
- "const", "continue", "declare", "default", "die",
- "do", "echo", "else", "elseif", "empty",
- "enddeclare", "endfor", "endforeach", "endif", "endswitch",
- "endwhile", "eval", "exit", "extends", "final",
- "for", "foreach", "function", "global", "goto",
- "if", "implements", "include", "include_once", "instanceof",
- "insteadof", "interface", "isset", "list", "namespace",
- "new", "or", "print", "private", "protected",
- "public", "require", "require_once", "return", "static",
- "switch", "throw", "trait", "try", "unset",
- "use", "var", "while", "xor", "int",
- "float", "bool", "string", "true", "false",
- "null", "void", "iterable"};
-const char* const kValidConstantNames[] = {
- "int", "float", "bool", "string", "true",
- "false", "null", "void", "iterable",
-};
-const int kReservedNamesSize = 73;
-const int kValidConstantNamesSize = 9;
+const char* const kReservedNames[] = {"ARRAY", "Empty", "ECHO"};
+const int kReservedNamesSize = 3;
const int kFieldSetter = 1;
const int kFieldGetter = 2;
const int kFieldProperty = 3;
@@ -83,7 +65,7 @@ std::string PhpName(const std::string& full_name, bool is_descriptor);
std::string DefaultForField(FieldDescriptor* field);
std::string IntToString(int32 value);
std::string FilenameToClassname(const string& filename);
-std::string GeneratedMetadataFileName(const FileDescriptor* file,
+std::string GeneratedMetadataFileName(const std::string& proto_file,
bool is_descriptor);
std::string LabelForField(FieldDescriptor* field);
std::string TypeName(FieldDescriptor* field);
@@ -94,9 +76,6 @@ void Indent(io::Printer* printer);
void Outdent(io::Printer* printer);
void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message,
int is_descriptor);
-void GenerateMessageConstructorDocComment(io::Printer* printer,
- const Descriptor* message,
- int is_descriptor);
void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field,
int is_descriptor, int function_type);
void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_,
@@ -108,40 +87,31 @@ void GenerateServiceDocComment(io::Printer* printer,
void GenerateServiceMethodDocComment(io::Printer* printer,
const MethodDescriptor* method);
-
-std::string ReservedNamePrefix(const string& classname,
- const FileDescriptor* file) {
- bool is_reserved = false;
-
- string lower = classname;
- transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
-
- for (int i = 0; i < kReservedNamesSize; i++) {
- if (lower == kReservedNames[i]) {
- is_reserved = true;
- break;
- }
+std::string RenameEmpty(const std::string& name) {
+ if (name == "Empty") {
+ return "GPBEmpty";
+ } else {
+ return name;
}
+}
- if (is_reserved) {
- if (file->package() == "google.protobuf") {
- return "GPB";
- } else {
- return "PB";
- }
+std::string MessageFullName(const Descriptor* message, bool is_descriptor) {
+ if (is_descriptor) {
+ return StringReplace(message->full_name(),
+ "google.protobuf",
+ "google.protobuf.internal", false);
+ } else {
+ return message->full_name();
}
-
- return "";
}
-template <typename DescriptorType>
-std::string DescriptorFullName(const DescriptorType* desc, bool is_descriptor) {
+std::string EnumFullName(const EnumDescriptor* envm, bool is_descriptor) {
if (is_descriptor) {
- return StringReplace(desc->full_name(),
+ return StringReplace(envm->full_name(),
"google.protobuf",
"google.protobuf.internal", false);
} else {
- return desc->full_name();
+ return envm->full_name();
}
}
@@ -153,123 +123,62 @@ std::string ClassNamePrefix(const string& classname,
return prefix;
}
- return ReservedNamePrefix(classname, desc->file());
-}
-
-template <typename DescriptorType>
-std::string GeneratedClassNameImpl(const DescriptorType* desc) {
- std::string classname = ClassNamePrefix(desc->name(), desc) + desc->name();
- const Descriptor* containing = desc->containing_type();
- while (containing != NULL) {
- classname = ClassNamePrefix(containing->name(), desc) + containing->name()
- + '\\' + classname;
- containing = containing->containing_type();
- }
- return classname;
-}
-
-std::string GeneratedClassNameImpl(const ServiceDescriptor* desc) {
- std::string classname = desc->name();
- return ClassNamePrefix(classname, desc) + classname;
-}
-
-std::string GeneratedClassName(const Descriptor* desc) {
- return GeneratedClassNameImpl(desc);
-}
-
-std::string GeneratedClassName(const EnumDescriptor* desc) {
- return GeneratedClassNameImpl(desc);
-}
-
-std::string GeneratedClassName(const ServiceDescriptor* desc) {
- return GeneratedClassNameImpl(desc);
-}
-
-template <typename DescriptorType>
-std::string LegacyGeneratedClassName(const DescriptorType* desc) {
- std::string classname = desc->name();
- const Descriptor* containing = desc->containing_type();
- while (containing != NULL) {
- classname = containing->name() + '_' + classname;
- containing = containing->containing_type();
- }
- return ClassNamePrefix(classname, desc) + classname;
-}
-
-std::string ClassNamePrefix(const string& classname) {
- string lower = classname;
- transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
-
- for (int i = 0; i < kReservedNamesSize; i++) {
- if (lower == kReservedNames[i]) {
- return "PB";
- }
- }
-
- return "";
-}
-
-std::string ConstantNamePrefix(const string& classname) {
bool is_reserved = false;
- string lower = classname;
- transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
-
for (int i = 0; i < kReservedNamesSize; i++) {
- if (lower == kReservedNames[i]) {
+ if (classname == kReservedNames[i]) {
is_reserved = true;
break;
}
}
- for (int i = 0; i < kValidConstantNamesSize; i++) {
- if (lower == kValidConstantNames[i]) {
- is_reserved = false;
- break;
- }
- }
-
if (is_reserved) {
- return "PB";
+ if (desc->file()->package() == "google.protobuf") {
+ return "GPB";
+ } else {
+ return "PB";
+ }
}
return "";
}
template <typename DescriptorType>
-std::string RootPhpNamespace(const DescriptorType* desc, bool is_descriptor) {
+std::string NamespacedName(const string& classname,
+ const DescriptorType* desc, bool is_descriptor) {
if (desc->file()->options().has_php_namespace()) {
const string& php_namespace = desc->file()->options().php_namespace();
if (php_namespace != "") {
- return php_namespace;
+ return php_namespace + '\\' + classname;
+ } else {
+ return classname;
}
- return "";
}
- if (desc->file()->package() != "") {
- return PhpName(desc->file()->package(), is_descriptor);
+ if (desc->file()->package() == "") {
+ return classname;
+ } else {
+ return PhpName(desc->file()->package(), is_descriptor) + '\\' +
+ classname;
}
- return "";
}
template <typename DescriptorType>
std::string FullClassName(const DescriptorType* desc, bool is_descriptor) {
- string classname = GeneratedClassNameImpl(desc);
- string php_namespace = RootPhpNamespace(desc, is_descriptor);
- if (php_namespace != "") {
- return php_namespace + "\\" + classname;
+ string classname = desc->name();
+ const Descriptor* containing = desc->containing_type();
+ while (containing != NULL) {
+ classname = containing->name() + '_' + classname;
+ containing = containing->containing_type();
}
- return classname;
+ classname = ClassNamePrefix(classname, desc) + classname;
+ return NamespacedName(classname, desc, is_descriptor);
}
-template <typename DescriptorType>
-std::string LegacyFullClassName(const DescriptorType* desc, bool is_descriptor) {
- string classname = LegacyGeneratedClassName(desc);
- string php_namespace = RootPhpNamespace(desc, is_descriptor);
- if (php_namespace != "") {
- return php_namespace + "\\" + classname;
- }
- return classname;
+std::string FullClassName(const ServiceDescriptor* desc, bool is_descriptor) {
+ string classname = desc->name();
+ classname = ClassNamePrefix(classname, desc) + classname;
+ return NamespacedName(classname, desc, is_descriptor);
}
std::string PhpName(const std::string& full_name, bool is_descriptor) {
@@ -277,23 +186,20 @@ std::string PhpName(const std::string& full_name, bool is_descriptor) {
return kDescriptorPackageName;
}
- std::string segment;
std::string result;
bool cap_next_letter = true;
for (int i = 0; i < full_name.size(); i++) {
if ('a' <= full_name[i] && full_name[i] <= 'z' && cap_next_letter) {
- segment += full_name[i] + ('A' - 'a');
+ result += full_name[i] + ('A' - 'a');
cap_next_letter = false;
} else if (full_name[i] == '.') {
- result += ClassNamePrefix(segment) + segment + '\\';
- segment = "";
+ result += '\\';
cap_next_letter = true;
} else {
- segment += full_name[i];
+ result += full_name[i];
cap_next_letter = false;
}
}
- result += ClassNamePrefix(segment) + segment;
return result;
}
@@ -321,13 +227,11 @@ std::string DefaultForField(const FieldDescriptor* field) {
}
}
-std::string GeneratedMetadataFileName(const FileDescriptor* file,
+std::string GeneratedMetadataFileName(const std::string& proto_file,
bool is_descriptor) {
- const string& proto_file = file->name();
int start_index = 0;
int first_index = proto_file.find_first_of("/", start_index);
- std::string result = "";
- std::string segment = "";
+ std::string result = "GPBMetadata/";
if (proto_file == kEmptyFile) {
return kEmptyMetadataFile;
@@ -345,44 +249,24 @@ std::string GeneratedMetadataFileName(const FileDescriptor* file,
file_no_suffix = proto_file.substr(0, lastindex);
}
- if (file->options().has_php_metadata_namespace()) {
- const string& php_metadata_namespace =
- file->options().php_metadata_namespace();
- if (php_metadata_namespace != "" && php_metadata_namespace != "\\") {
- result += php_metadata_namespace;
- std::replace(result.begin(), result.end(), '\\', '/');
- if (result.at(result.size() - 1) != '/') {
- result += "/";
- }
- }
- } else {
- result += "GPBMetadata/";
- while (first_index != string::npos) {
- segment = UnderscoresToCamelCase(
- file_no_suffix.substr(start_index, first_index - start_index), true);
- result += ReservedNamePrefix(segment, file) + segment + "/";
- start_index = first_index + 1;
- first_index = file_no_suffix.find_first_of("/", start_index);
- }
+ while (first_index != string::npos) {
+ result += UnderscoresToCamelCase(
+ file_no_suffix.substr(start_index, first_index - start_index), true);
+ result += "/";
+ start_index = first_index + 1;
+ first_index = file_no_suffix.find_first_of("/", start_index);
}
// Append file name.
- int file_name_start = file_no_suffix.find_last_of("/");
- if (file_name_start == string::npos) {
- file_name_start = 0;
- } else {
- file_name_start += 1;
- }
- segment = UnderscoresToCamelCase(
- file_no_suffix.substr(file_name_start, first_index - file_name_start), true);
+ result += RenameEmpty(UnderscoresToCamelCase(
+ file_no_suffix.substr(start_index, first_index - start_index), true));
- return result + ReservedNamePrefix(segment, file) + segment + ".php";
+ return result += ".php";
}
-template <typename DescriptorType>
-std::string GeneratedClassFileName(const DescriptorType* desc,
+std::string GeneratedMessageFileName(const Descriptor* message,
bool is_descriptor) {
- std::string result = FullClassName(desc, is_descriptor);
+ std::string result = FullClassName(message, is_descriptor);
for (int i = 0; i < result.size(); i++) {
if (result[i] == '\\') {
result[i] = '/';
@@ -391,11 +275,9 @@ std::string GeneratedClassFileName(const DescriptorType* desc,
return result + ".php";
}
-template <typename DescriptorType>
-std::string LegacyGeneratedClassFileName(const DescriptorType* desc,
- bool is_descriptor) {
- std::string result = LegacyFullClassName(desc, is_descriptor);
-
+std::string GeneratedEnumFileName(const EnumDescriptor* en,
+ bool is_descriptor) {
+ std::string result = FullClassName(en, is_descriptor);
for (int i = 0; i < result.size(); i++) {
if (result[i] == '\\') {
result[i] = '/';
@@ -538,10 +420,10 @@ std::string PhpGetterTypeName(const FieldDescriptor* field, bool is_descriptor)
std::string EnumOrMessageSuffix(
const FieldDescriptor* field, bool is_descriptor) {
if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
- return ", '" + DescriptorFullName(field->message_type(), is_descriptor) + "'";
+ return ", '" + MessageFullName(field->message_type(), is_descriptor) + "'";
}
if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) {
- return ", '" + DescriptorFullName(field->enum_type(), is_descriptor) + "'";
+ return ", '" + EnumFullName(field->enum_type(), is_descriptor) + "'";
}
return "";
}
@@ -728,11 +610,11 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
} else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
printer->Print(
"GPBUtil::checkMessage($var, \\^class_name^::class);\n",
- "class_name", LegacyFullClassName(field->message_type(), is_descriptor));
+ "class_name", FullClassName(field->message_type(), is_descriptor));
} else if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) {
printer->Print(
"GPBUtil::checkEnum($var, \\^class_name^::class);\n",
- "class_name", LegacyFullClassName(field->enum_type(), is_descriptor));
+ "class_name", FullClassName(field->enum_type(), is_descriptor));
} else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) {
printer->Print(
"GPBUtil::checkString($var, ^utf8^);\n",
@@ -788,7 +670,7 @@ void GenerateEnumToPool(const EnumDescriptor* en, io::Printer* printer) {
printer->Print(
"$pool->addEnum('^name^', "
"\\Google\\Protobuf\\Internal\\^class_name^::class)\n",
- "name", DescriptorFullName(en, true),
+ "name", EnumFullName(en, true),
"class_name", en->name());
Indent(printer);
@@ -796,7 +678,7 @@ void GenerateEnumToPool(const EnumDescriptor* en, io::Printer* printer) {
const EnumValueDescriptor* value = en->value(i);
printer->Print(
"->value(\"^name^\", ^number^)\n",
- "name", ConstantNamePrefix(value->name()) + value->name(),
+ "name", ClassNamePrefix(value->name(), en) + value->name(),
"number", IntToString(value->number()));
}
printer->Print("->finalizeToPool();\n\n");
@@ -820,13 +702,13 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message,
if (message->options().map_entry()) {
return;
}
- string class_name = (name_prefix.empty() ? "" : name_prefix + "\\") +
- ReservedNamePrefix(message->name(), message->file()) + message->name();
+ string class_name = name_prefix.empty()?
+ message->name() : name_prefix + "_" + message->name();
printer->Print(
"$pool->addMessage('^message^', "
"\\Google\\Protobuf\\Internal\\^class_name^::class)\n",
- "message", DescriptorFullName(message, true),
+ "message", MessageFullName(message, true),
"class_name", class_name);
Indent(printer);
@@ -928,7 +810,7 @@ void GenerateAddFileToPool(const FileDescriptor* file, bool is_descriptor,
continue;
}
std::string dependency_filename =
- GeneratedMetadataFileName(file->dependency(i), is_descriptor);
+ GeneratedMetadataFileName(name, is_descriptor);
printer->Print(
"\\^name^::initOnce();\n",
"name", FilenameToClassname(dependency_filename));
@@ -1022,8 +904,8 @@ std::string FilenameToClassname(const string& filename) {
void GenerateMetadataFile(const FileDescriptor* file,
bool is_descriptor,
GeneratorContext* generator_context) {
- std::string filename = GeneratedMetadataFileName(file, is_descriptor);
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ std::string filename = GeneratedMetadataFileName(file->name(), is_descriptor);
+ scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(filename));
io::Printer printer(output.get(), '^');
@@ -1032,11 +914,11 @@ void GenerateMetadataFile(const FileDescriptor* file,
std::string fullname = FilenameToClassname(filename);
int lastindex = fullname.find_last_of("\\");
- if (lastindex != string::npos) {
- printer.Print(
- "namespace ^name^;\n\n",
- "name", fullname.substr(0, lastindex));
+ printer.Print(
+ "namespace ^name^;\n\n",
+ "name", fullname.substr(0, lastindex));
+ if (lastindex != string::npos) {
printer.Print(
"class ^name^\n"
"{\n",
@@ -1055,48 +937,10 @@ void GenerateMetadataFile(const FileDescriptor* file,
printer.Print("}\n\n");
}
-template <typename DescriptorType>
-void LegacyGenerateClassFile(const FileDescriptor* file, const DescriptorType* desc,
- bool is_descriptor,
- GeneratorContext* generator_context) {
-
- std::string filename = LegacyGeneratedClassFileName(desc, is_descriptor);
- std::unique_ptr<io::ZeroCopyOutputStream> output(
- generator_context->Open(filename));
- io::Printer printer(output.get(), '^');
-
- GenerateHead(file, &printer);
-
- std::string php_namespace = RootPhpNamespace(desc, is_descriptor);
- if (php_namespace != "") {
- printer.Print(
- "namespace ^name^;\n\n",
- "name", php_namespace);
- }
- std::string newname = FullClassName(desc, is_descriptor);
- printer.Print("if (false) {\n");
- Indent(&printer);
- printer.Print("/**\n");
- printer.Print(" * This class is deprecated. Use ^new^ instead.\n",
- "new", newname);
- printer.Print(" * @deprecated\n");
- printer.Print(" */\n");
- printer.Print("class ^old^ {}\n",
- "old", LegacyGeneratedClassName(desc));
- Outdent(&printer);
- printer.Print("}\n");
- printer.Print("class_exists(^new^::class);\n",
- "new", GeneratedClassNameImpl(desc));
- printer.Print("@trigger_error('^old^ is deprecated and will be removed in "
- "the next major release. Use ^fullname^ instead', E_USER_DEPRECATED);\n\n",
- "old", LegacyFullClassName(desc, is_descriptor),
- "fullname", newname);
-}
-
void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
bool is_descriptor, GeneratorContext* generator_context) {
- std::string filename = GeneratedClassFileName(en, is_descriptor);
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ std::string filename = GeneratedEnumFileName(en, is_descriptor);
+ scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(filename));
io::Printer printer(output.get(), '^');
@@ -1105,45 +949,44 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
std::string fullname = FilenameToClassname(filename);
int lastindex = fullname.find_last_of("\\");
- if (lastindex != string::npos) {
+ if (file->options().has_php_namespace()) {
+ const string& php_namespace = file->options().php_namespace();
+ if (!php_namespace.empty()) {
+ printer.Print(
+ "namespace ^name^;\n\n",
+ "name", php_namespace);
+ }
+ } else if (!file->package().empty()) {
printer.Print(
"namespace ^name^;\n\n",
"name", fullname.substr(0, lastindex));
}
- if (lastindex != string::npos) {
- fullname = fullname.substr(lastindex + 1);
- }
-
GenerateEnumDocComment(&printer, en, is_descriptor);
- printer.Print(
- "class ^name^\n"
- "{\n",
- "name", fullname);
+ if (lastindex != string::npos) {
+ printer.Print(
+ "class ^name^\n"
+ "{\n",
+ "name", fullname.substr(lastindex + 1));
+ } else {
+ printer.Print(
+ "class ^name^\n"
+ "{\n",
+ "name", fullname);
+ }
Indent(&printer);
for (int i = 0; i < en->value_count(); i++) {
const EnumValueDescriptor* value = en->value(i);
GenerateEnumValueDocComment(&printer, value);
printer.Print("const ^name^ = ^number^;\n",
- "name", ConstantNamePrefix(value->name()) + value->name(),
+ "name", ClassNamePrefix(value->name(), en) + value->name(),
"number", IntToString(value->number()));
}
Outdent(&printer);
printer.Print("}\n\n");
-
- // write legacy file for backwards compatiblity with nested messages and enums
- if (en->containing_type() != NULL) {
- printer.Print(
- "// Adding a class alias for backwards compatibility with the previous class name.\n");
- printer.Print(
- "class_alias(^new^::class, \\^old^::class);\n\n",
- "new", fullname,
- "old", LegacyFullClassName(en, is_descriptor));
- LegacyGenerateClassFile(file, en, is_descriptor, generator_context);
- }
}
void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
@@ -1155,8 +998,8 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
return;
}
- std::string filename = GeneratedClassFileName(message, is_descriptor);
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ std::string filename = GeneratedMessageFileName(message, is_descriptor);
+ scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(filename));
io::Printer printer(output.get(), '^');
@@ -1165,7 +1008,14 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
std::string fullname = FilenameToClassname(filename);
int lastindex = fullname.find_last_of("\\");
- if (lastindex != string::npos) {
+ if (file->options().has_php_namespace()) {
+ const string& php_namespace = file->options().php_namespace();
+ if (!php_namespace.empty()) {
+ printer.Print(
+ "namespace ^name^;\n\n",
+ "name", php_namespace);
+ }
+ } else if (!file->package().empty()) {
printer.Print(
"namespace ^name^;\n\n",
"name", fullname.substr(0, lastindex));
@@ -1175,13 +1025,16 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
GenerateMessageDocComment(&printer, message, is_descriptor);
if (lastindex != string::npos) {
- fullname = fullname.substr(lastindex + 1);
+ printer.Print(
+ "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n"
+ "{\n",
+ "name", fullname.substr(lastindex + 1));
+ } else {
+ printer.Print(
+ "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n"
+ "{\n",
+ "name", fullname);
}
-
- printer.Print(
- "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n"
- "{\n",
- "name", fullname);
Indent(&printer);
// Field and oneof definitions.
@@ -1195,17 +1048,16 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
}
printer.Print("\n");
- GenerateMessageConstructorDocComment(&printer, message, is_descriptor);
printer.Print(
- "public function __construct($data = NULL) {\n");
+ "public function __construct() {\n");
Indent(&printer);
std::string metadata_filename =
- GeneratedMetadataFileName(file, is_descriptor);
+ GeneratedMetadataFileName(file->name(), is_descriptor);
std::string metadata_fullname = FilenameToClassname(metadata_filename);
printer.Print(
"\\^fullname^::initOnce();\n"
- "parent::__construct($data);\n",
+ "parent::__construct();\n",
"fullname", metadata_fullname);
Outdent(&printer);
@@ -1233,17 +1085,6 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
Outdent(&printer);
printer.Print("}\n\n");
- // write legacy file for backwards compatiblity with nested messages and enums
- if (message->containing_type() != NULL) {
- printer.Print(
- "// Adding a class alias for backwards compatibility with the previous class name.\n");
- printer.Print(
- "class_alias(^new^::class, \\^old^::class);\n\n",
- "new", fullname,
- "old", LegacyFullClassName(message, is_descriptor));
- LegacyGenerateClassFile(file, message, is_descriptor, generator_context);
- }
-
// Nested messages and enums.
for (int i = 0; i < message->nested_type_count(); i++) {
GenerateMessageFile(file, message->nested_type(i), is_descriptor,
@@ -1259,7 +1100,7 @@ void GenerateServiceFile(const FileDescriptor* file,
const ServiceDescriptor* service, bool is_descriptor,
GeneratorContext* generator_context) {
std::string filename = GeneratedServiceFileName(service, is_descriptor);
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(filename));
io::Printer printer(output.get(), '^');
@@ -1268,9 +1109,14 @@ void GenerateServiceFile(const FileDescriptor* file,
std::string fullname = FilenameToClassname(filename);
int lastindex = fullname.find_last_of("\\");
- if (!file->options().php_namespace().empty() ||
- (!file->options().has_php_namespace() && !file->package().empty()) ||
- lastindex != string::npos) {
+ if (file->options().has_php_namespace()) {
+ const string& php_namespace = file->options().php_namespace();
+ if (!php_namespace.empty()) {
+ printer.Print(
+ "namespace ^name^;\n\n",
+ "name", php_namespace);
+ }
+ } else if (!file->package().empty()) {
printer.Print(
"namespace ^name^;\n\n",
"name", fullname.substr(0, lastindex));
@@ -1364,8 +1210,7 @@ static string EscapePhpdoc(const string& input) {
}
static void GenerateDocCommentBodyForLocation(
- io::Printer* printer, const SourceLocation& location, bool trailingNewline,
- int indentCount) {
+ io::Printer* printer, const SourceLocation& location) {
string comments = location.leading_comments.empty() ?
location.trailing_comments : location.leading_comments;
if (!comments.empty()) {
@@ -1377,7 +1222,7 @@ static void GenerateDocCommentBodyForLocation(
// HTML-escape them so that they don't accidentally close the doc comment.
comments = EscapePhpdoc(comments);
- std::vector<string> lines = Split(comments, "\n");
+ vector<string> lines = Split(comments, "\n");
while (!lines.empty() && lines.back().empty()) {
lines.pop_back();
}
@@ -1386,16 +1231,14 @@ static void GenerateDocCommentBodyForLocation(
// Most lines should start with a space. Watch out for lines that start
// with a /, since putting that right after the leading asterisk will
// close the comment.
- if (indentCount == 0 && !lines[i].empty() && lines[i][0] == '/') {
+ if (!lines[i].empty() && lines[i][0] == '/') {
printer->Print(" * ^line^\n", "line", lines[i]);
} else {
- std::string indent = std::string(indentCount, ' ');
- printer->Print(" *^ind^^line^\n", "ind", indent, "line", lines[i]);
+ printer->Print(" *^line^\n", "line", lines[i]);
}
}
- if (trailingNewline) {
- printer->Print(" *\n");
- }
+ printer->Print(
+ " *\n");
}
}
@@ -1404,7 +1247,7 @@ static void GenerateDocCommentBody(
io::Printer* printer, const DescriptorType* descriptor) {
SourceLocation location;
if (descriptor->GetSourceLocation(&location)) {
- GenerateDocCommentBodyForLocation(printer, location, true, 0);
+ GenerateDocCommentBodyForLocation(printer, location);
}
}
@@ -1426,41 +1269,10 @@ void GenerateMessageDocComment(io::Printer* printer,
printer->Print(
" * Generated from protobuf message <code>^messagename^</code>\n"
" */\n",
- "fullname", EscapePhpdoc(FullClassName(message, is_descriptor)),
+ "fullname", EscapePhpdoc(PhpName(message->full_name(), is_descriptor)),
"messagename", EscapePhpdoc(message->full_name()));
}
-void GenerateMessageConstructorDocComment(io::Printer* printer,
- const Descriptor* message,
- int is_descriptor) {
- // In theory we should have slightly different comments for setters, getters,
- // etc., but in practice everyone already knows the difference between these
- // so it's redundant information.
-
- // We start the comment with the main body based on the comments from the
- // .proto file (if present). We then end with the field declaration, e.g.:
- // optional string foo = 5;
- // If the field is a group, the debug string might end with {.
- printer->Print("/**\n");
- printer->Print(" * Constructor.\n");
- printer->Print(" *\n");
- printer->Print(" * @param array $data {\n");
- printer->Print(" * Optional. Data for populating the Message object.\n");
- printer->Print(" *\n");
- for (int i = 0; i < message->field_count(); i++) {
- const FieldDescriptor* field = message->field(i);
- printer->Print(" * @type ^php_type^ $^var^\n",
- "php_type", PhpSetterTypeName(field, is_descriptor),
- "var", field->name());
- SourceLocation location;
- if (field->GetSourceLocation(&location)) {
- GenerateDocCommentBodyForLocation(printer, location, false, 10);
- }
- }
- printer->Print(" * }\n");
- printer->Print(" */\n");
-}
-
void GenerateServiceDocComment(io::Printer* printer,
const ServiceDescriptor* service) {
printer->Print("/**\n");
@@ -1502,9 +1314,9 @@ void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_,
printer->Print("/**\n");
GenerateDocCommentBody(printer, enum_);
printer->Print(
- " * Protobuf type <code>^fullname^</code>\n"
+ " * Protobuf enum <code>^fullname^</code>\n"
" */\n",
- "fullname", EscapePhpdoc(enum_->full_name()));
+ "fullname", EscapePhpdoc(PhpName(enum_->full_name(), is_descriptor)));
}
void GenerateEnumValueDocComment(io::Printer* printer,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/php/php_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/php/php_generator.h
index b851d9b4a2..ce2b000adb 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/php/php_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/php/php_generator.h
@@ -32,7 +32,6 @@
#define GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__
#include <google/protobuf/compiler/code_generator.h>
-#include <google/protobuf/descriptor.h>
#include <string>
@@ -50,16 +49,6 @@ class LIBPROTOC_EXPORT Generator
string* error) const;
};
-// To skip reserved keywords in php, some generated classname are prefixed.
-// Other code generators may need following API to figure out the actual
-// classname.
-LIBPROTOC_EXPORT std::string GeneratedClassName(
- const google::protobuf::Descriptor* desc);
-LIBPROTOC_EXPORT std::string GeneratedClassName(
- const google::protobuf::EnumDescriptor* desc);
-LIBPROTOC_EXPORT std::string GeneratedClassName(
- const google::protobuf::ServiceDescriptor* desc);
-
} // namespace php
} // namespace compiler
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.cc
index 9c1c757c99..cb5e37bb7f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.cc
@@ -41,25 +41,24 @@
#include <unistd.h>
#endif
+#include <google/protobuf/stubs/io_win32.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/plugin.pb.h>
#include <google/protobuf/compiler/code_generator.h>
-#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/descriptor.h>
-#include <google/protobuf/stubs/io_win32.h>
-
-
-namespace google {
-namespace protobuf {
-namespace compiler {
+#include <google/protobuf/io/zero_copy_stream_impl.h>
-#if defined(_WIN32)
+#if defined(_MSC_VER)
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
using google::protobuf::internal::win32::setmode;
#endif
+namespace google {
+namespace protobuf {
+namespace compiler {
+
class GeneratorResponseContext : public GeneratorContext {
public:
GeneratorResponseContext(
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.h
index d2793a9ff1..d2793a9ff1 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.pb.cc
index ef52def36c..07883a3737 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.pb.cc
@@ -1,209 +1,181 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/compiler/plugin.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/compiler/plugin.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
-namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_CodeGeneratorResponse_File;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_Version;
-} // namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto
-namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<6> scc_info_FileDescriptorProto;
-} // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto
namespace google {
namespace protobuf {
namespace compiler {
class VersionDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Version>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Version>
+ _instance;
} _Version_default_instance_;
class CodeGeneratorRequestDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorRequest>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorRequest>
+ _instance;
} _CodeGeneratorRequest_default_instance_;
class CodeGeneratorResponse_FileDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorResponse_File>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorResponse_File>
+ _instance;
} _CodeGeneratorResponse_File_default_instance_;
class CodeGeneratorResponseDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorResponse>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorResponse>
+ _instance;
} _CodeGeneratorResponse_default_instance_;
-} // namespace compiler
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
-static void InitDefaultsVersion() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::compiler::_Version_default_instance_;
- new (ptr) ::google::protobuf::compiler::Version();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::compiler::Version::InitAsDefaultInstance();
-}
-
-LIBPROTOC_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Version =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsVersion}, {}};
-
-static void InitDefaultsCodeGeneratorRequest() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::compiler::_CodeGeneratorRequest_default_instance_;
- new (ptr) ::google::protobuf::compiler::CodeGeneratorRequest();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::compiler::CodeGeneratorRequest::InitAsDefaultInstance();
-}
-
-LIBPROTOC_EXPORT ::google::protobuf::internal::SCCInfo<2> scc_info_CodeGeneratorRequest =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsCodeGeneratorRequest}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_Version.base,}};
-
-static void InitDefaultsCodeGeneratorResponse_File() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::compiler::_CodeGeneratorResponse_File_default_instance_;
- new (ptr) ::google::protobuf::compiler::CodeGeneratorResponse_File();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::compiler::CodeGeneratorResponse_File::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
-LIBPROTOC_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_CodeGeneratorResponse_File =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsCodeGeneratorResponse_File}, {}};
-static void InitDefaultsCodeGeneratorResponse() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
+namespace {
- {
- void* ptr = &::google::protobuf::compiler::_CodeGeneratorResponse_default_instance_;
- new (ptr) ::google::protobuf::compiler::CodeGeneratorResponse();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::compiler::CodeGeneratorResponse::InitAsDefaultInstance();
-}
+::google::protobuf::Metadata file_level_metadata[4];
-LIBPROTOC_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_CodeGeneratorResponse =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsCodeGeneratorResponse}, {
- &protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_CodeGeneratorResponse_File.base,}};
+} // namespace
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_Version.base);
- ::google::protobuf::internal::InitSCC(&scc_info_CodeGeneratorRequest.base);
- ::google::protobuf::internal::InitSCC(&scc_info_CodeGeneratorResponse_File.base);
- ::google::protobuf::internal::InitSCC(&scc_info_CodeGeneratorResponse.base);
-}
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
-::google::protobuf::Metadata file_level_metadata[4];
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, _internal_metadata_),
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, major_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, minor_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, patch_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, suffix_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, major_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, minor_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, patch_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, suffix_),
1,
2,
3,
0,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, file_to_generate_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, parameter_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, proto_file_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, compiler_version_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, file_to_generate_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, parameter_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, proto_file_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, compiler_version_),
~0u,
0,
~0u,
1,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, insertion_point_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, content_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, insertion_point_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, content_),
0,
1,
2,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, error_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, file_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, error_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, file_),
0,
~0u,
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, 9, sizeof(::google::protobuf::compiler::Version)},
- { 13, 22, sizeof(::google::protobuf::compiler::CodeGeneratorRequest)},
- { 26, 34, sizeof(::google::protobuf::compiler::CodeGeneratorResponse_File)},
- { 37, 44, sizeof(::google::protobuf::compiler::CodeGeneratorResponse)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, 9, sizeof(Version)},
+ { 13, 22, sizeof(CodeGeneratorRequest)},
+ { 26, 34, sizeof(CodeGeneratorResponse_File)},
+ { 37, 44, sizeof(CodeGeneratorResponse)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::compiler::_Version_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::compiler::_CodeGeneratorRequest_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::compiler::_CodeGeneratorResponse_File_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::compiler::_CodeGeneratorResponse_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Version_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_CodeGeneratorRequest_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_CodeGeneratorResponse_File_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_CodeGeneratorResponse_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/compiler/plugin.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/compiler/plugin.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 4);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ ::google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ _Version_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Version_default_instance_);_CodeGeneratorRequest_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_CodeGeneratorRequest_default_instance_);_CodeGeneratorResponse_File_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_CodeGeneratorResponse_File_default_instance_);_CodeGeneratorResponse_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_CodeGeneratorResponse_default_instance_);_CodeGeneratorRequest_default_instance_._instance.get_mutable()->compiler_version_ = const_cast< ::google::protobuf::compiler::Version*>(
+ ::google::protobuf::compiler::Version::internal_default_instance());
+}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n%google/protobuf/compiler/plugin.proto\022"
"\030google.protobuf.compiler\032 google/protob"
"uf/descriptor.proto\"F\n\007Version\022\r\n\005major\030"
@@ -225,12 +197,13 @@ void AddDescriptorsImpl() {
descriptor, 638);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/compiler/plugin.proto", &protobuf_RegisterTypes);
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors();
+ ::google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors();
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -238,15 +211,12 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto
-namespace google {
-namespace protobuf {
-namespace compiler {
+
// ===================================================================
-void Version::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Version::kMajorFieldNumber;
const int Version::kMinorFieldNumber;
@@ -256,15 +226,17 @@ const int Version::kSuffixFieldNumber;
Version::Version()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_Version.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.compiler.Version)
}
Version::Version(const Version& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
suffix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_suffix()) {
@@ -277,6 +249,7 @@ Version::Version(const Version& from)
}
void Version::SharedCtor() {
+ _cached_size_ = 0;
suffix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&major_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&patch_) -
@@ -293,18 +266,27 @@ void Version::SharedDtor() {
}
void Version::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Version::descriptor() {
- ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Version& Version::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_Version.base);
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults();
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)
@@ -312,10 +294,11 @@ void Version::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- cached_has_bits = _has_bits_[0];
- if (cached_has_bits & 0x00000001u) {
- suffix_.ClearNonDefaultToEmptyNoArena();
+ if (has_suffix()) {
+ GOOGLE_DCHECK(!suffix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*suffix_.UnsafeRawStringPointer())->clear();
}
+ cached_has_bits = _has_bits_[0];
if (cached_has_bits & 14u) {
::memset(&major_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&patch_) -
@@ -331,7 +314,7 @@ bool Version::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.compiler.Version)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -534,7 +517,9 @@ size_t Version::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -603,30 +588,162 @@ void Version::Swap(Version* other) {
}
void Version::InternalSwap(Version* other) {
using std::swap;
- suffix_.Swap(&other->suffix_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ suffix_.Swap(&other->suffix_);
swap(major_, other->major_);
swap(minor_, other->minor_);
swap(patch_, other->patch_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Version::GetMetadata() const {
protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Version
-// ===================================================================
+// optional int32 major = 1;
+bool Version::has_major() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void Version::set_has_major() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void Version::clear_has_major() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void Version::clear_major() {
+ major_ = 0;
+ clear_has_major();
+}
+::google::protobuf::int32 Version::major() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.major)
+ return major_;
+}
+void Version::set_major(::google::protobuf::int32 value) {
+ set_has_major();
+ major_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major)
+}
-void CodeGeneratorRequest::InitAsDefaultInstance() {
- ::google::protobuf::compiler::_CodeGeneratorRequest_default_instance_._instance.get_mutable()->compiler_version_ = const_cast< ::google::protobuf::compiler::Version*>(
- ::google::protobuf::compiler::Version::internal_default_instance());
+// optional int32 minor = 2;
+bool Version::has_minor() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
}
-void CodeGeneratorRequest::clear_proto_file() {
- proto_file_.Clear();
+void Version::set_has_minor() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void Version::clear_has_minor() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void Version::clear_minor() {
+ minor_ = 0;
+ clear_has_minor();
+}
+::google::protobuf::int32 Version::minor() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.minor)
+ return minor_;
+}
+void Version::set_minor(::google::protobuf::int32 value) {
+ set_has_minor();
+ minor_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor)
+}
+
+// optional int32 patch = 3;
+bool Version::has_patch() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+void Version::set_has_patch() {
+ _has_bits_[0] |= 0x00000008u;
+}
+void Version::clear_has_patch() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+void Version::clear_patch() {
+ patch_ = 0;
+ clear_has_patch();
+}
+::google::protobuf::int32 Version::patch() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.patch)
+ return patch_;
+}
+void Version::set_patch(::google::protobuf::int32 value) {
+ set_has_patch();
+ patch_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch)
+}
+
+// optional string suffix = 4;
+bool Version::has_suffix() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void Version::set_has_suffix() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void Version::clear_has_suffix() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void Version::clear_suffix() {
+ suffix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_suffix();
+}
+const ::std::string& Version::suffix() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.suffix)
+ return suffix_.GetNoArena();
+}
+void Version::set_suffix(const ::std::string& value) {
+ set_has_suffix();
+ suffix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix)
+}
+#if LANG_CXX11
+void Version::set_suffix(::std::string&& value) {
+ set_has_suffix();
+ suffix_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.Version.suffix)
}
+#endif
+void Version::set_suffix(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_suffix();
+ suffix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.Version.suffix)
+}
+void Version::set_suffix(const char* value, size_t size) {
+ set_has_suffix();
+ suffix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.Version.suffix)
+}
+::std::string* Version::mutable_suffix() {
+ set_has_suffix();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.Version.suffix)
+ return suffix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* Version::release_suffix() {
+ // @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix)
+ clear_has_suffix();
+ return suffix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void Version::set_allocated_suffix(::std::string* suffix) {
+ if (suffix != NULL) {
+ set_has_suffix();
+ } else {
+ clear_has_suffix();
+ }
+ suffix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), suffix);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CodeGeneratorRequest::kFileToGenerateFieldNumber;
const int CodeGeneratorRequest::kParameterFieldNumber;
@@ -636,8 +753,9 @@ const int CodeGeneratorRequest::kCompilerVersionFieldNumber;
CodeGeneratorRequest::CodeGeneratorRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_CodeGeneratorRequest.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorRequest)
}
@@ -645,6 +763,7 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
file_to_generate_(from.file_to_generate_),
proto_file_(from.proto_file_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
@@ -661,6 +780,7 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
}
void CodeGeneratorRequest::SharedCtor() {
+ _cached_size_ = 0;
parameter_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
compiler_version_ = NULL;
}
@@ -676,18 +796,27 @@ void CodeGeneratorRequest::SharedDtor() {
}
void CodeGeneratorRequest::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CodeGeneratorRequest::descriptor() {
- ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const CodeGeneratorRequest& CodeGeneratorRequest::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_CodeGeneratorRequest.base);
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults();
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)
@@ -700,11 +829,12 @@ void CodeGeneratorRequest::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- parameter_.ClearNonDefaultToEmptyNoArena();
+ GOOGLE_DCHECK(!parameter_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*parameter_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(compiler_version_ != NULL);
- compiler_version_->Clear();
+ compiler_version_->::google::protobuf::compiler::Version::Clear();
}
}
_has_bits_.Clear();
@@ -717,7 +847,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.compiler.CodeGeneratorRequest)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -758,7 +888,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_compiler_version()));
} else {
goto handle_unusual;
@@ -770,7 +900,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_proto_file()));
} else {
goto handle_unusual;
@@ -828,16 +958,14 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
// optional .google.protobuf.compiler.Version compiler_version = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, this->_internal_compiler_version(), output);
+ 3, *this->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()) {
@@ -879,15 +1007,15 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
// optional .google.protobuf.compiler.Version compiler_version = 3;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 3, this->_internal_compiler_version(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 3, *this->compiler_version_, deterministic, target);
}
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->proto_file_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
15, this->proto_file(static_cast<int>(i)), deterministic, target);
}
@@ -922,7 +1050,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->proto_file(static_cast<int>(i)));
}
}
@@ -938,13 +1066,15 @@ size_t CodeGeneratorRequest::ByteSizeLong() const {
// optional .google.protobuf.compiler.Version compiler_version = 3;
if (has_compiler_version()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *compiler_version_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->compiler_version_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1009,25 +1139,235 @@ void CodeGeneratorRequest::Swap(CodeGeneratorRequest* other) {
}
void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) {
using std::swap;
- file_to_generate_.InternalSwap(CastToBase(&other->file_to_generate_));
- CastToBase(&proto_file_)->InternalSwap(CastToBase(&other->proto_file_));
- parameter_.Swap(&other->parameter_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ file_to_generate_.InternalSwap(&other->file_to_generate_);
+ proto_file_.InternalSwap(&other->proto_file_);
+ parameter_.Swap(&other->parameter_);
swap(compiler_version_, other->compiler_version_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CodeGeneratorRequest::GetMetadata() const {
protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// CodeGeneratorRequest
-// ===================================================================
+// repeated string file_to_generate = 1;
+int CodeGeneratorRequest::file_to_generate_size() const {
+ return file_to_generate_.size();
+}
+void CodeGeneratorRequest::clear_file_to_generate() {
+ file_to_generate_.Clear();
+}
+const ::std::string& CodeGeneratorRequest::file_to_generate(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+ return file_to_generate_.Get(index);
+}
+::std::string* CodeGeneratorRequest::mutable_file_to_generate(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+ return file_to_generate_.Mutable(index);
+}
+void CodeGeneratorRequest::set_file_to_generate(int index, const ::std::string& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+ file_to_generate_.Mutable(index)->assign(value);
+}
+#if LANG_CXX11
+void CodeGeneratorRequest::set_file_to_generate(int index, ::std::string&& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+ file_to_generate_.Mutable(index)->assign(std::move(value));
+}
+#endif
+void CodeGeneratorRequest::set_file_to_generate(int index, const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ file_to_generate_.Mutable(index)->assign(value);
+ // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+}
+void CodeGeneratorRequest::set_file_to_generate(int index, const char* value, size_t size) {
+ file_to_generate_.Mutable(index)->assign(
+ reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+}
+::std::string* CodeGeneratorRequest::add_file_to_generate() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+ return file_to_generate_.Add();
+}
+void CodeGeneratorRequest::add_file_to_generate(const ::std::string& value) {
+ file_to_generate_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+}
+#if LANG_CXX11
+void CodeGeneratorRequest::add_file_to_generate(::std::string&& value) {
+ file_to_generate_.Add(std::move(value));
+ // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+}
+#endif
+void CodeGeneratorRequest::add_file_to_generate(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ file_to_generate_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+}
+void CodeGeneratorRequest::add_file_to_generate(const char* value, size_t size) {
+ file_to_generate_.Add()->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_add_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+}
+const ::google::protobuf::RepeatedPtrField< ::std::string>&
+CodeGeneratorRequest::file_to_generate() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+ return file_to_generate_;
+}
+::google::protobuf::RepeatedPtrField< ::std::string>*
+CodeGeneratorRequest::mutable_file_to_generate() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+ return &file_to_generate_;
+}
+
+// optional string parameter = 2;
+bool CodeGeneratorRequest::has_parameter() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void CodeGeneratorRequest::set_has_parameter() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void CodeGeneratorRequest::clear_has_parameter() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void CodeGeneratorRequest::clear_parameter() {
+ parameter_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_parameter();
+}
+const ::std::string& CodeGeneratorRequest::parameter() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+ return parameter_.GetNoArena();
+}
+void CodeGeneratorRequest::set_parameter(const ::std::string& value) {
+ set_has_parameter();
+ parameter_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+}
+#if LANG_CXX11
+void CodeGeneratorRequest::set_parameter(::std::string&& value) {
+ set_has_parameter();
+ parameter_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+}
+#endif
+void CodeGeneratorRequest::set_parameter(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_parameter();
+ parameter_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+}
+void CodeGeneratorRequest::set_parameter(const char* value, size_t size) {
+ set_has_parameter();
+ parameter_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+}
+::std::string* CodeGeneratorRequest::mutable_parameter() {
+ set_has_parameter();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+ return parameter_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* CodeGeneratorRequest::release_parameter() {
+ // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+ clear_has_parameter();
+ return parameter_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void CodeGeneratorRequest::set_allocated_parameter(::std::string* parameter) {
+ if (parameter != NULL) {
+ set_has_parameter();
+ } else {
+ clear_has_parameter();
+ }
+ parameter_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), parameter);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+}
+
+// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
+int CodeGeneratorRequest::proto_file_size() const {
+ return proto_file_.size();
+}
+void CodeGeneratorRequest::clear_proto_file() {
+ proto_file_.Clear();
+}
+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);
+}
+::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);
+}
+::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() {
+ // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
+ return proto_file_.Add();
+}
+::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_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
+CodeGeneratorRequest::proto_file() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
+ return proto_file_;
+}
-void CodeGeneratorResponse_File::InitAsDefaultInstance() {
+// optional .google.protobuf.compiler.Version compiler_version = 3;
+bool CodeGeneratorRequest::has_compiler_version() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void CodeGeneratorRequest::set_has_compiler_version() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void CodeGeneratorRequest::clear_has_compiler_version() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void CodeGeneratorRequest::clear_compiler_version() {
+ if (compiler_version_ != NULL) compiler_version_->::google::protobuf::compiler::Version::Clear();
+ clear_has_compiler_version();
+}
+const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compiler_version() const {
+ const ::google::protobuf::compiler::Version* p = compiler_version_;
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::compiler::Version*>(
+ &::google::protobuf::compiler::_Version_default_instance_);
+}
+::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() {
+ set_has_compiler_version();
+ if (compiler_version_ == NULL) {
+ compiler_version_ = new ::google::protobuf::compiler::Version;
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
+ return compiler_version_;
}
+::google::protobuf::compiler::Version* CodeGeneratorRequest::release_compiler_version() {
+ // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
+ clear_has_compiler_version();
+ ::google::protobuf::compiler::Version* temp = compiler_version_;
+ compiler_version_ = NULL;
+ return temp;
+}
+void CodeGeneratorRequest::set_allocated_compiler_version(::google::protobuf::compiler::Version* compiler_version) {
+ delete compiler_version_;
+ compiler_version_ = compiler_version;
+ if (compiler_version) {
+ set_has_compiler_version();
+ } else {
+ clear_has_compiler_version();
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CodeGeneratorResponse_File::kNameFieldNumber;
const int CodeGeneratorResponse_File::kInsertionPointFieldNumber;
@@ -1036,15 +1376,17 @@ const int CodeGeneratorResponse_File::kContentFieldNumber;
CodeGeneratorResponse_File::CodeGeneratorResponse_File()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_CodeGeneratorResponse_File.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorResponse.File)
}
CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
@@ -1062,6 +1404,7 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
}
void CodeGeneratorResponse_File::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
insertion_point_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
content_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -1079,18 +1422,27 @@ void CodeGeneratorResponse_File::SharedDtor() {
}
void CodeGeneratorResponse_File::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CodeGeneratorResponse_File::descriptor() {
- ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const CodeGeneratorResponse_File& CodeGeneratorResponse_File::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_CodeGeneratorResponse_File.base);
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults();
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)
@@ -1101,13 +1453,16 @@ void CodeGeneratorResponse_File::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 7u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmptyNoArena();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
- insertion_point_.ClearNonDefaultToEmptyNoArena();
+ GOOGLE_DCHECK(!insertion_point_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*insertion_point_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000004u) {
- content_.ClearNonDefaultToEmptyNoArena();
+ GOOGLE_DCHECK(!content_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*content_.UnsafeRawStringPointer())->clear();
}
}
_has_bits_.Clear();
@@ -1120,7 +1475,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.compiler.CodeGeneratorResponse.File)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1318,7 +1673,9 @@ size_t CodeGeneratorResponse_File::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1385,26 +1742,215 @@ void CodeGeneratorResponse_File::Swap(CodeGeneratorResponse_File* other) {
}
void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other) {
using std::swap;
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- insertion_point_.Swap(&other->insertion_point_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- content_.Swap(&other->content_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.Swap(&other->name_);
+ insertion_point_.Swap(&other->insertion_point_);
+ content_.Swap(&other->content_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CodeGeneratorResponse_File::GetMetadata() const {
protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// CodeGeneratorResponse_File
-// ===================================================================
+// optional string name = 1;
+bool CodeGeneratorResponse_File::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void CodeGeneratorResponse_File::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void CodeGeneratorResponse_File::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void CodeGeneratorResponse_File::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
+}
+const ::std::string& CodeGeneratorResponse_File::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+ return name_.GetNoArena();
+}
+void CodeGeneratorResponse_File::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+}
+#if LANG_CXX11
+void CodeGeneratorResponse_File::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+}
+#endif
+void CodeGeneratorResponse_File::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+}
+void CodeGeneratorResponse_File::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+}
+::std::string* CodeGeneratorResponse_File::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* CodeGeneratorResponse_File::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void CodeGeneratorResponse_File::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
+ } else {
+ clear_has_name();
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+}
-void CodeGeneratorResponse::InitAsDefaultInstance() {
+// optional string insertion_point = 2;
+bool CodeGeneratorResponse_File::has_insertion_point() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void CodeGeneratorResponse_File::set_has_insertion_point() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void CodeGeneratorResponse_File::clear_has_insertion_point() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void CodeGeneratorResponse_File::clear_insertion_point() {
+ insertion_point_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_insertion_point();
}
+const ::std::string& CodeGeneratorResponse_File::insertion_point() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+ return insertion_point_.GetNoArena();
+}
+void CodeGeneratorResponse_File::set_insertion_point(const ::std::string& value) {
+ set_has_insertion_point();
+ insertion_point_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+}
+#if LANG_CXX11
+void CodeGeneratorResponse_File::set_insertion_point(::std::string&& value) {
+ set_has_insertion_point();
+ insertion_point_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+}
+#endif
+void CodeGeneratorResponse_File::set_insertion_point(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_insertion_point();
+ insertion_point_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+}
+void CodeGeneratorResponse_File::set_insertion_point(const char* value, size_t size) {
+ set_has_insertion_point();
+ insertion_point_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+}
+::std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
+ set_has_insertion_point();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+ return insertion_point_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* CodeGeneratorResponse_File::release_insertion_point() {
+ // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+ clear_has_insertion_point();
+ return insertion_point_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void CodeGeneratorResponse_File::set_allocated_insertion_point(::std::string* insertion_point) {
+ if (insertion_point != NULL) {
+ set_has_insertion_point();
+ } else {
+ clear_has_insertion_point();
+ }
+ insertion_point_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), insertion_point);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+}
+
+// optional string content = 15;
+bool CodeGeneratorResponse_File::has_content() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void CodeGeneratorResponse_File::set_has_content() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void CodeGeneratorResponse_File::clear_has_content() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void CodeGeneratorResponse_File::clear_content() {
+ content_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_content();
+}
+const ::std::string& CodeGeneratorResponse_File::content() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+ return content_.GetNoArena();
+}
+void CodeGeneratorResponse_File::set_content(const ::std::string& value) {
+ set_has_content();
+ content_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+}
+#if LANG_CXX11
+void CodeGeneratorResponse_File::set_content(::std::string&& value) {
+ set_has_content();
+ content_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+}
+#endif
+void CodeGeneratorResponse_File::set_content(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_content();
+ content_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+}
+void CodeGeneratorResponse_File::set_content(const char* value, size_t size) {
+ set_has_content();
+ content_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+}
+::std::string* CodeGeneratorResponse_File::mutable_content() {
+ set_has_content();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+ return content_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* CodeGeneratorResponse_File::release_content() {
+ // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+ clear_has_content();
+ return content_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void CodeGeneratorResponse_File::set_allocated_content(::std::string* content) {
+ if (content != NULL) {
+ set_has_content();
+ } else {
+ clear_has_content();
+ }
+ content_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), content);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CodeGeneratorResponse::kErrorFieldNumber;
const int CodeGeneratorResponse::kFileFieldNumber;
@@ -1412,8 +1958,9 @@ const int CodeGeneratorResponse::kFileFieldNumber;
CodeGeneratorResponse::CodeGeneratorResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_CodeGeneratorResponse.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorResponse)
}
@@ -1421,6 +1968,7 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
file_(from.file_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
error_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -1431,6 +1979,7 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
}
void CodeGeneratorResponse::SharedCtor() {
+ _cached_size_ = 0;
error_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
@@ -1444,18 +1993,27 @@ void CodeGeneratorResponse::SharedDtor() {
}
void CodeGeneratorResponse::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CodeGeneratorResponse::descriptor() {
- ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const CodeGeneratorResponse& CodeGeneratorResponse::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::scc_info_CodeGeneratorResponse.base);
+ protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults();
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)
@@ -1464,9 +2022,9 @@ void CodeGeneratorResponse::Clear() {
(void) cached_has_bits;
file_.Clear();
- cached_has_bits = _has_bits_[0];
- if (cached_has_bits & 0x00000001u) {
- error_.ClearNonDefaultToEmptyNoArena();
+ if (has_error()) {
+ GOOGLE_DCHECK(!error_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*error_.UnsafeRawStringPointer())->clear();
}
_has_bits_.Clear();
_internal_metadata_.Clear();
@@ -1478,7 +2036,7 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.compiler.CodeGeneratorResponse)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1502,7 +2060,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_file()));
} else {
goto handle_unusual;
@@ -1551,9 +2109,7 @@ 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()) {
@@ -1586,7 +2142,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->file_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
15, this->file(static_cast<int>(i)), deterministic, target);
}
@@ -1613,7 +2169,7 @@ size_t CodeGeneratorResponse::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->file(static_cast<int>(i)));
}
}
@@ -1626,7 +2182,9 @@ size_t CodeGeneratorResponse::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1683,37 +2241,119 @@ void CodeGeneratorResponse::Swap(CodeGeneratorResponse* other) {
}
void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) {
using std::swap;
- CastToBase(&file_)->InternalSwap(CastToBase(&other->file_));
- error_.Swap(&other->error_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ file_.InternalSwap(&other->file_);
+ error_.Swap(&other->error_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CodeGeneratorResponse::GetMetadata() const {
protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// CodeGeneratorResponse
-// @@protoc_insertion_point(namespace_scope)
-} // namespace compiler
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::compiler::Version* Arena::CreateMaybeMessage< ::google::protobuf::compiler::Version >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::compiler::Version >(arena);
+// optional string error = 1;
+bool CodeGeneratorResponse::has_error() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void CodeGeneratorResponse::set_has_error() {
+ _has_bits_[0] |= 0x00000001u;
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage< ::google::protobuf::compiler::CodeGeneratorRequest >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::compiler::CodeGeneratorRequest >(arena);
+void CodeGeneratorResponse::clear_has_error() {
+ _has_bits_[0] &= ~0x00000001u;
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage< ::google::protobuf::compiler::CodeGeneratorResponse_File >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::compiler::CodeGeneratorResponse_File >(arena);
+void CodeGeneratorResponse::clear_error() {
+ error_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_error();
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage< ::google::protobuf::compiler::CodeGeneratorResponse >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::compiler::CodeGeneratorResponse >(arena);
+const ::std::string& CodeGeneratorResponse::error() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.error)
+ return error_.GetNoArena();
+}
+void CodeGeneratorResponse::set_error(const ::std::string& value) {
+ set_has_error();
+ error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error)
+}
+#if LANG_CXX11
+void CodeGeneratorResponse::set_error(::std::string&& value) {
+ set_has_error();
+ error_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.error)
+}
+#endif
+void CodeGeneratorResponse::set_error(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_error();
+ error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.error)
+}
+void CodeGeneratorResponse::set_error(const char* value, size_t size) {
+ set_has_error();
+ error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.error)
+}
+::std::string* CodeGeneratorResponse::mutable_error() {
+ set_has_error();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.error)
+ return error_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* CodeGeneratorResponse::release_error() {
+ // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error)
+ clear_has_error();
+ return error_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void CodeGeneratorResponse::set_allocated_error(::std::string* error) {
+ if (error != NULL) {
+ set_has_error();
+ } else {
+ clear_has_error();
+ }
+ error_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), error);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error)
}
+
+// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
+int CodeGeneratorResponse::file_size() const {
+ return file_.size();
+}
+void CodeGeneratorResponse::clear_file() {
+ file_.Clear();
+}
+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);
+}
+::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file)
+ return file_.Mutable(index);
+}
+::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() {
+ // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file)
+ return file_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >*
+CodeGeneratorResponse::mutable_file() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file)
+ return &file_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >&
+CodeGeneratorResponse::file() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file)
+ return file_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
+} // namespace compiler
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.pb.h
index d5b70a8810..2d66f035a6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/plugin.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/compiler/plugin.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fcompiler_2fplugin_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fcompiler_2fplugin_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,7 +24,6 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
@@ -32,26 +31,12 @@
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/descriptor.pb.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto LIBPROTOC_EXPORT
#ifdef major
#undef major
#endif
#ifdef minor
#undef minor
#endif
-
-namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
-// Internal implementation detail -- do not use these members.
-struct LIBPROTOC_EXPORT TableStruct {
- static const ::google::protobuf::internal::ParseTableField entries[];
- static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[4];
- static const ::google::protobuf::internal::FieldMetadata field_metadata[];
- static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
-};
-void LIBPROTOC_EXPORT AddDescriptors();
-} // namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto
namespace google {
namespace protobuf {
namespace compiler {
@@ -70,18 +55,26 @@ LIBPROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_;
} // namespace compiler
} // namespace protobuf
} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage<::google::protobuf::compiler::CodeGeneratorRequest>(Arena*);
-template<> LIBPROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage<::google::protobuf::compiler::CodeGeneratorResponse>(Arena*);
-template<> LIBPROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage<::google::protobuf::compiler::CodeGeneratorResponse_File>(Arena*);
-template<> LIBPROTOC_EXPORT ::google::protobuf::compiler::Version* Arena::CreateMaybeMessage<::google::protobuf::compiler::Version>(Arena*);
-} // namespace protobuf
-} // namespace google
+
namespace google {
namespace protobuf {
namespace compiler {
+namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
+// Internal implementation detail -- do not call these.
+struct LIBPROTOC_EXPORT TableStruct {
+ static const ::google::protobuf::internal::ParseTableField entries[];
+ static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
+ static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+ static const ::google::protobuf::internal::SerializationTable serialization_table[];
+ static void InitDefaultsImpl();
+};
+void LIBPROTOC_EXPORT AddDescriptors();
+void LIBPROTOC_EXPORT InitDefaults();
+} // namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto
+
// ===================================================================
class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ {
@@ -120,12 +113,11 @@ class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_
static const ::google::protobuf::Descriptor* descriptor();
static const Version& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Version* internal_default_instance() {
return reinterpret_cast<const Version*>(
&_Version_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void Swap(Version* other);
@@ -135,33 +127,28 @@ class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Version* New() const final {
- return CreateMaybeMessage<Version>(NULL);
- }
+ inline Version* New() const PROTOBUF_FINAL { return New(NULL); }
- Version* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Version>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Version* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Version& from);
void MergeFrom(const Version& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Version* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -172,7 +159,7 @@ class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -227,12 +214,12 @@ class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::internal::ArenaStringPtr suffix_;
::google::protobuf::int32 major_;
::google::protobuf::int32 minor_;
::google::protobuf::int32 patch_;
- friend struct ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -272,12 +259,11 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message
static const ::google::protobuf::Descriptor* descriptor();
static const CodeGeneratorRequest& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const CodeGeneratorRequest* internal_default_instance() {
return reinterpret_cast<const CodeGeneratorRequest*>(
&_CodeGeneratorRequest_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
1;
void Swap(CodeGeneratorRequest* other);
@@ -287,33 +273,28 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message
// implements Message ----------------------------------------------
- inline CodeGeneratorRequest* New() const final {
- return CreateMaybeMessage<CodeGeneratorRequest>(NULL);
- }
+ inline CodeGeneratorRequest* New() const PROTOBUF_FINAL { return New(NULL); }
- CodeGeneratorRequest* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<CodeGeneratorRequest>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ CodeGeneratorRequest* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const CodeGeneratorRequest& from);
void MergeFrom(const CodeGeneratorRequest& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(CodeGeneratorRequest* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -324,7 +305,7 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -356,11 +337,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;
@@ -383,12 +364,9 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message
bool has_compiler_version() const;
void clear_compiler_version();
static const int kCompilerVersionFieldNumber = 3;
- private:
- const ::google::protobuf::compiler::Version& _internal_compiler_version() const;
- public:
const ::google::protobuf::compiler::Version& compiler_version() const;
- ::google::protobuf::compiler::Version* release_compiler_version();
::google::protobuf::compiler::Version* mutable_compiler_version();
+ ::google::protobuf::compiler::Version* release_compiler_version();
void set_allocated_compiler_version(::google::protobuf::compiler::Version* compiler_version);
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest)
@@ -400,12 +378,12 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::std::string> file_to_generate_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > proto_file_;
::google::protobuf::internal::ArenaStringPtr parameter_;
::google::protobuf::compiler::Version* compiler_version_;
- friend struct ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -445,12 +423,11 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M
static const ::google::protobuf::Descriptor* descriptor();
static const CodeGeneratorResponse_File& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const CodeGeneratorResponse_File* internal_default_instance() {
return reinterpret_cast<const CodeGeneratorResponse_File*>(
&_CodeGeneratorResponse_File_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
2;
void Swap(CodeGeneratorResponse_File* other);
@@ -460,33 +437,28 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M
// implements Message ----------------------------------------------
- inline CodeGeneratorResponse_File* New() const final {
- return CreateMaybeMessage<CodeGeneratorResponse_File>(NULL);
- }
+ inline CodeGeneratorResponse_File* New() const PROTOBUF_FINAL { return New(NULL); }
- CodeGeneratorResponse_File* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<CodeGeneratorResponse_File>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ CodeGeneratorResponse_File* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const CodeGeneratorResponse_File& from);
void MergeFrom(const CodeGeneratorResponse_File& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(CodeGeneratorResponse_File* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -497,7 +469,7 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -559,11 +531,11 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::internal::ArenaStringPtr insertion_point_;
::google::protobuf::internal::ArenaStringPtr content_;
- friend struct ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -603,12 +575,11 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag
static const ::google::protobuf::Descriptor* descriptor();
static const CodeGeneratorResponse& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const CodeGeneratorResponse* internal_default_instance() {
return reinterpret_cast<const CodeGeneratorResponse*>(
&_CodeGeneratorResponse_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
3;
void Swap(CodeGeneratorResponse* other);
@@ -618,33 +589,28 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag
// implements Message ----------------------------------------------
- inline CodeGeneratorResponse* New() const final {
- return CreateMaybeMessage<CodeGeneratorResponse>(NULL);
- }
+ inline CodeGeneratorResponse* New() const PROTOBUF_FINAL { return New(NULL); }
- CodeGeneratorResponse* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<CodeGeneratorResponse>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ CodeGeneratorResponse* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const CodeGeneratorResponse& from);
void MergeFrom(const CodeGeneratorResponse& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(CodeGeneratorResponse* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -655,7 +621,7 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -667,11 +633,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;
@@ -697,16 +663,17 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File > file_;
::google::protobuf::internal::ArenaStringPtr error_;
- friend struct ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -835,11 +802,8 @@ inline ::std::string* Version::mutable_suffix() {
}
inline ::std::string* Version::release_suffix() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix)
- if (!has_suffix()) {
- return NULL;
- }
clear_has_suffix();
- return suffix_.ReleaseNonDefaultNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return suffix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void Version::set_allocated_suffix(::std::string* suffix) {
if (suffix != NULL) {
@@ -974,11 +938,8 @@ inline ::std::string* CodeGeneratorRequest::mutable_parameter() {
}
inline ::std::string* CodeGeneratorRequest::release_parameter() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter)
- if (!has_parameter()) {
- return NULL;
- }
clear_has_parameter();
- return parameter_.ReleaseNonDefaultNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return parameter_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void CodeGeneratorRequest::set_allocated_parameter(::std::string* parameter) {
if (parameter != NULL) {
@@ -994,23 +955,26 @@ inline void CodeGeneratorRequest::set_allocated_parameter(::std::string* paramet
inline int CodeGeneratorRequest::proto_file_size() const {
return proto_file_.size();
}
-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::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
-CodeGeneratorRequest::mutable_proto_file() {
- // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
- return &proto_file_;
+inline void CodeGeneratorRequest::clear_proto_file() {
+ proto_file_.Clear();
}
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::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
CodeGeneratorRequest::proto_file() const {
// @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
@@ -1028,50 +992,38 @@ inline void CodeGeneratorRequest::clear_has_compiler_version() {
_has_bits_[0] &= ~0x00000002u;
}
inline void CodeGeneratorRequest::clear_compiler_version() {
- if (compiler_version_ != NULL) compiler_version_->Clear();
+ if (compiler_version_ != NULL) compiler_version_->::google::protobuf::compiler::Version::Clear();
clear_has_compiler_version();
}
-inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const {
- return *compiler_version_;
-}
inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compiler_version() const {
const ::google::protobuf::compiler::Version* p = compiler_version_;
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::compiler::Version*>(
&::google::protobuf::compiler::_Version_default_instance_);
}
-inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_compiler_version() {
- // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
- clear_has_compiler_version();
- ::google::protobuf::compiler::Version* temp = compiler_version_;
- compiler_version_ = NULL;
- return temp;
-}
inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() {
set_has_compiler_version();
if (compiler_version_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::compiler::Version>(GetArenaNoVirtual());
- compiler_version_ = p;
+ compiler_version_ = new ::google::protobuf::compiler::Version;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
return compiler_version_;
}
+inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_compiler_version() {
+ // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
+ clear_has_compiler_version();
+ ::google::protobuf::compiler::Version* temp = compiler_version_;
+ compiler_version_ = NULL;
+ return temp;
+}
inline void CodeGeneratorRequest::set_allocated_compiler_version(::google::protobuf::compiler::Version* compiler_version) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete compiler_version_;
- }
+ delete compiler_version_;
+ compiler_version_ = compiler_version;
if (compiler_version) {
- ::google::protobuf::Arena* submessage_arena = NULL;
- if (message_arena != submessage_arena) {
- compiler_version = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, compiler_version, submessage_arena);
- }
set_has_compiler_version();
} else {
clear_has_compiler_version();
}
- compiler_version_ = compiler_version;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
}
@@ -1129,11 +1081,8 @@ inline ::std::string* CodeGeneratorResponse_File::mutable_name() {
}
inline ::std::string* CodeGeneratorResponse_File::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefaultNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void CodeGeneratorResponse_File::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -1195,11 +1144,8 @@ inline ::std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
}
inline ::std::string* CodeGeneratorResponse_File::release_insertion_point() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
- if (!has_insertion_point()) {
- return NULL;
- }
clear_has_insertion_point();
- return insertion_point_.ReleaseNonDefaultNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return insertion_point_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void CodeGeneratorResponse_File::set_allocated_insertion_point(::std::string* insertion_point) {
if (insertion_point != NULL) {
@@ -1261,11 +1207,8 @@ inline ::std::string* CodeGeneratorResponse_File::mutable_content() {
}
inline ::std::string* CodeGeneratorResponse_File::release_content() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content)
- if (!has_content()) {
- return NULL;
- }
clear_has_content();
- return content_.ReleaseNonDefaultNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return content_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void CodeGeneratorResponse_File::set_allocated_content(::std::string* content) {
if (content != NULL) {
@@ -1331,11 +1274,8 @@ inline ::std::string* CodeGeneratorResponse::mutable_error() {
}
inline ::std::string* CodeGeneratorResponse::release_error() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error)
- if (!has_error()) {
- return NULL;
- }
clear_has_error();
- return error_.ReleaseNonDefaultNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return error_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void CodeGeneratorResponse::set_allocated_error(::std::string* error) {
if (error != NULL) {
@@ -1354,23 +1294,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)
@@ -1380,6 +1320,7 @@ CodeGeneratorResponse::file() const {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// -------------------------------------------------------------------
// -------------------------------------------------------------------
@@ -1389,10 +1330,11 @@ CodeGeneratorResponse::file() const {
// @@protoc_insertion_point(namespace_scope)
+
} // namespace compiler
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fcompiler_2fplugin_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.proto b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.proto
new file mode 100644
index 0000000000..5b5574529e
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/plugin.proto
@@ -0,0 +1,167 @@
+// 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)
+//
+// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
+// change.
+//
+// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
+// just a program that reads a CodeGeneratorRequest from stdin and writes a
+// CodeGeneratorResponse to stdout.
+//
+// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
+// of dealing with the raw protocol defined here.
+//
+// A plugin executable needs only to be placed somewhere in the path. The
+// plugin should be named "protoc-gen-$NAME", and will then be used when the
+// flag "--${NAME}_out" is passed to protoc.
+
+syntax = "proto2";
+package google.protobuf.compiler;
+option java_package = "com.google.protobuf.compiler";
+option java_outer_classname = "PluginProtos";
+
+option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go";
+
+import "google/protobuf/descriptor.proto";
+
+// The version number of protocol compiler.
+message Version {
+ optional int32 major = 1;
+ optional int32 minor = 2;
+ optional int32 patch = 3;
+ // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
+ // be empty for mainline stable releases.
+ optional string suffix = 4;
+}
+
+// An encoded CodeGeneratorRequest is written to the plugin's stdin.
+message CodeGeneratorRequest {
+ // The .proto files that were explicitly listed on the command-line. The
+ // code generator should generate code only for these files. Each file's
+ // descriptor will be included in proto_file, below.
+ repeated string file_to_generate = 1;
+
+ // The generator parameter passed on the command-line.
+ optional string parameter = 2;
+
+ // FileDescriptorProtos for all files in files_to_generate and everything
+ // they import. The files will appear in topological order, so each file
+ // appears before any file that imports it.
+ //
+ // protoc guarantees that all proto_files will be written after
+ // the fields above, even though this is not technically guaranteed by the
+ // protobuf wire format. This theoretically could allow a plugin to stream
+ // in the FileDescriptorProtos and handle them one by one rather than read
+ // the entire set into memory at once. However, as of this writing, this
+ // is not similarly optimized on protoc's end -- it will store all fields in
+ // memory at once before sending them to the plugin.
+ //
+ // Type names of fields and extensions in the FileDescriptorProto are always
+ // fully qualified.
+ repeated FileDescriptorProto proto_file = 15;
+
+ // The version number of protocol compiler.
+ optional Version compiler_version = 3;
+
+}
+
+// The plugin writes an encoded CodeGeneratorResponse to stdout.
+message CodeGeneratorResponse {
+ // Error message. If non-empty, code generation failed. The plugin process
+ // should exit with status code zero even if it reports an error in this way.
+ //
+ // This should be used to indicate errors in .proto files which prevent the
+ // code generator from generating correct code. Errors which indicate a
+ // problem in protoc itself -- such as the input CodeGeneratorRequest being
+ // unparseable -- should be reported by writing a message to stderr and
+ // exiting with a non-zero status code.
+ optional string error = 1;
+
+ // Represents a single generated file.
+ message File {
+ // The file name, relative to the output directory. The name must not
+ // contain "." or ".." components and must be relative, not be absolute (so,
+ // the file cannot lie outside the output directory). "/" must be used as
+ // the path separator, not "\".
+ //
+ // If the name is omitted, the content will be appended to the previous
+ // file. This allows the generator to break large files into small chunks,
+ // and allows the generated text to be streamed back to protoc so that large
+ // files need not reside completely in memory at one time. Note that as of
+ // this writing protoc does not optimize for this -- it will read the entire
+ // CodeGeneratorResponse before writing files to disk.
+ optional string name = 1;
+
+ // If non-empty, indicates that the named file should already exist, and the
+ // content here is to be inserted into that file at a defined insertion
+ // point. This feature allows a code generator to extend the output
+ // produced by another code generator. The original generator may provide
+ // insertion points by placing special annotations in the file that look
+ // like:
+ // @@protoc_insertion_point(NAME)
+ // The annotation can have arbitrary text before and after it on the line,
+ // which allows it to be placed in a comment. NAME should be replaced with
+ // an identifier naming the point -- this is what other generators will use
+ // as the insertion_point. Code inserted at this point will be placed
+ // immediately above the line containing the insertion point (thus multiple
+ // insertions to the same point will come out in the order they were added).
+ // The double-@ is intended to make it unlikely that the generated code
+ // could contain things that look like insertion points by accident.
+ //
+ // For example, the C++ code generator places the following line in the
+ // .pb.h files that it generates:
+ // // @@protoc_insertion_point(namespace_scope)
+ // This line appears within the scope of the file's package namespace, but
+ // outside of any particular class. Another plugin can then specify the
+ // insertion_point "namespace_scope" to generate additional classes or
+ // other declarations that should be placed in this scope.
+ //
+ // Note that if the line containing the insertion point begins with
+ // whitespace, the same whitespace will be added to every line of the
+ // inserted text. This is useful for languages like Python, where
+ // indentation matters. In these languages, the insertion point comment
+ // should be indented the same amount as any inserted code will need to be
+ // in order to work correctly in that context.
+ //
+ // The code generator that generates the initial file and the one which
+ // inserts into it must both run as part of a single invocation of protoc.
+ // Code generators are executed in the order in which they appear on the
+ // command line.
+ //
+ // If |insertion_point| is present, |name| must also be present.
+ optional string insertion_point = 2;
+
+ // The file contents.
+ optional string content = 15;
+ }
+ repeated File file = 15;
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_generator.cc
index 01f28b3724..97769835e8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_generator.cc
@@ -49,6 +49,9 @@
#include <limits>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <utility>
#include <vector>
@@ -199,6 +202,11 @@ void PrintTopBoilerplate(
"from google.protobuf import service_reflection\n");
}
+ // Avoid circular imports if this module is descriptor_pb2.
+ if (!descriptor_proto) {
+ printer->Print(
+ "from google.protobuf import descriptor_pb2\n");
+ }
printer->Print(
"# @@protoc_insertion_point(imports)\n\n"
"_sym_db = _symbol_database.Default()\n");
@@ -330,7 +338,7 @@ bool Generator::Generate(const FileDescriptor* file,
fdp.SerializeToString(&file_descriptor_serialized_);
- std::unique_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
GOOGLE_CHECK(output.get());
io::Printer printer(output.get(), '$');
printer_ = &printer;
@@ -414,13 +422,11 @@ void Generator::PrintFileDescriptor() const {
m["name"] = file_->name();
m["package"] = file_->package();
m["syntax"] = StringifySyntax(file_->syntax());
- m["options"] = OptionsValue(file_->options().SerializeAsString());
const char file_descriptor_template[] =
"$descriptor_name$ = _descriptor.FileDescriptor(\n"
" name='$name$',\n"
" package='$package$',\n"
- " syntax='$syntax$',\n"
- " serialized_options=$options$,\n";
+ " syntax='$syntax$',\n";
printer_->Print(m, file_descriptor_template);
printer_->Indent();
printer_->Print(
@@ -520,9 +526,9 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const {
printer_->Outdent();
printer_->Print("],\n");
printer_->Print("containing_type=None,\n");
- printer_->Print("serialized_options=$options_value$,\n",
+ printer_->Print("options=$options_value$,\n",
"options_value",
- OptionsValue(options_string));
+ OptionsValue("EnumOptions", options_string));
EnumDescriptorProto edp;
PrintSerializedPbInterval(enum_descriptor, edp);
printer_->Outdent();
@@ -600,13 +606,13 @@ void Generator::PrintServiceDescriptor(
m["full_name"] = descriptor.full_name();
m["file"] = kDescriptorKey;
m["index"] = SimpleItoa(descriptor.index());
- m["options_value"] = OptionsValue(options_string);
+ m["options_value"] = OptionsValue("ServiceOptions", options_string);
const char required_function_arguments[] =
"name='$name$',\n"
"full_name='$full_name$',\n"
"file=$file$,\n"
"index=$index$,\n"
- "serialized_options=$options_value$,\n";
+ "options=$options_value$,\n";
printer_->Print(m, required_function_arguments);
ServiceDescriptorProto sdp;
@@ -624,7 +630,7 @@ void Generator::PrintServiceDescriptor(
m["serialized_options"] = CEscape(options_string);
m["input_type"] = ModuleLevelDescriptorName(*(method->input_type()));
m["output_type"] = ModuleLevelDescriptorName(*(method->output_type()));
- m["options_value"] = OptionsValue(options_string);
+ m["options_value"] = OptionsValue("MethodOptions", options_string);
printer_->Print("_descriptor.MethodDescriptor(\n");
printer_->Indent();
printer_->Print(
@@ -635,7 +641,7 @@ void Generator::PrintServiceDescriptor(
"containing_service=None,\n"
"input_type=$input_type$,\n"
"output_type=$output_type$,\n"
- "serialized_options=$options_value$,\n");
+ "options=$options_value$,\n");
printer_->Outdent();
printer_->Print("),\n");
}
@@ -731,10 +737,10 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor) const {
string options_string;
message_descriptor.options().SerializeToString(&options_string);
printer_->Print(
- "serialized_options=$options_value$,\n"
+ "options=$options_value$,\n"
"is_extendable=$extendable$,\n"
"syntax='$syntax$'",
- "options_value", OptionsValue(options_string),
+ "options_value", OptionsValue("MessageOptions", options_string),
"extendable", message_descriptor.extension_range_count() > 0 ?
"True" : "False",
"syntax", StringifySyntax(message_descriptor.file()->syntax()));
@@ -759,18 +765,17 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor) const {
m["full_name"] = desc->full_name();
m["index"] = SimpleItoa(desc->index());
string options_string =
- OptionsValue(desc->options().SerializeAsString());
+ OptionsValue("OneofOptions", desc->options().SerializeAsString());
if (options_string == "None") {
- m["serialized_options"] = "";
+ m["options"] = "";
} else {
- m["serialized_options"] = ", serialized_options=" + options_string;
+ m["options"] = ", options=" + options_string;
}
printer_->Print(
m,
"_descriptor.OneofDescriptor(\n"
" name='$name$', full_name='$full_name$',\n"
- " index=$index$, containing_type=None, "
- "fields=[]$serialized_options$),\n");
+ " index=$index$, containing_type=None, fields=[]$options$),\n");
}
printer_->Outdent();
printer_->Print("],\n");
@@ -1093,22 +1098,27 @@ void Generator::PrintEnumValueDescriptor(
m["name"] = descriptor.name();
m["index"] = SimpleItoa(descriptor.index());
m["number"] = SimpleItoa(descriptor.number());
- m["options"] = OptionsValue(options_string);
+ m["options"] = OptionsValue("EnumValueOptions", options_string);
printer_->Print(
m,
"_descriptor.EnumValueDescriptor(\n"
" name='$name$', index=$index$, number=$number$,\n"
- " serialized_options=$options$,\n"
+ " options=$options$,\n"
" type=None)");
}
-// Returns a CEscaped string of serialized_options.
-string Generator::OptionsValue(const string& serialized_options) const {
+// Returns a Python expression that calls descriptor._ParseOptions using
+// the given descriptor class name and serialized options protobuf string.
+string Generator::OptionsValue(
+ const string& class_name, const string& serialized_options) const {
if (serialized_options.length() == 0 || GeneratingDescriptorProto()) {
return "None";
} else {
-//##!PY25 return "b'('" + CEscape(serialized_options)+ "')";
- return "_b('"+ CEscape(serialized_options) + "')"; //##PY25
+ string full_class_name = "descriptor_pb2." + class_name;
+//##!PY25 return "_descriptor._ParseOptions(" + full_class_name + "(), b'"
+//##!PY25 + CEscape(serialized_options)+ "')";
+ return "_descriptor._ParseOptions(" + full_class_name + "(), _b('" //##PY25
+ + CEscape(serialized_options)+ "'))"; //##PY25
}
}
@@ -1128,7 +1138,7 @@ void Generator::PrintFieldDescriptor(
m["has_default_value"] = field.has_default_value() ? "True" : "False";
m["default_value"] = StringifyDefaultValue(field);
m["is_extension"] = is_extension ? "True" : "False";
- m["serialized_options"] = OptionsValue(options_string);
+ m["options"] = OptionsValue("FieldOptions", options_string);
m["json_name"] = field.has_json_name() ?
", json_name='" + field.json_name() + "'": "";
// We always set message_type and enum_type to None at this point, and then
@@ -1141,7 +1151,7 @@ void Generator::PrintFieldDescriptor(
" has_default_value=$has_default_value$, default_value=$default_value$,\n"
" message_type=None, enum_type=None, containing_type=None,\n"
" is_extension=$is_extension$, extension_scope=None,\n"
- " serialized_options=$serialized_options$$json_name$, file=DESCRIPTOR)";
+ " options=$options$$json_name$)";
printer_->Print(m, field_descriptor_decl);
}
@@ -1270,18 +1280,23 @@ namespace {
void PrintDescriptorOptionsFixingCode(const string& descriptor,
const string& options,
io::Printer* printer) {
- // Reset the _options to None thus DescriptorBase.GetOptions() can
- // parse _options again after extensions are registered.
+ // TODO(xiaofeng): I have added a method _SetOptions() to DescriptorBase
+ // in proto2 python runtime but it couldn't be used here because appengine
+ // uses a snapshot version of the library in which the new method is not
+ // yet present. After appengine has synced their runtime library, the code
+ // below should be cleaned up to use _SetOptions().
printer->Print(
- "$descriptor$._options = None\n",
- "descriptor", descriptor);
+ "$descriptor$.has_options = True\n"
+ "$descriptor$._options = $options$\n",
+ "descriptor", descriptor, "options", options);
}
} // namespace
// Prints expressions that set the options field of all descriptors.
void Generator::FixAllDescriptorOptions() const {
// Prints an expression that sets the file descriptor's options.
- string file_options = OptionsValue(file_->options().SerializeAsString());
+ string file_options = OptionsValue(
+ "FileOptions", file_->options().SerializeAsString());
if (file_options != "None") {
PrintDescriptorOptionsFixingCode(kDescriptorKey, file_options, printer_);
}
@@ -1303,7 +1318,8 @@ void Generator::FixAllDescriptorOptions() const {
}
void Generator::FixOptionsForOneof(const OneofDescriptor& oneof) const {
- string oneof_options = OptionsValue(oneof.options().SerializeAsString());
+ string oneof_options = OptionsValue(
+ "OneofOptions", oneof.options().SerializeAsString());
if (oneof_options != "None") {
string oneof_name = strings::Substitute(
"$0.$1['$2']",
@@ -1318,14 +1334,14 @@ void Generator::FixOptionsForOneof(const OneofDescriptor& oneof) const {
void Generator::FixOptionsForEnum(const EnumDescriptor& enum_descriptor) const {
string descriptor_name = ModuleLevelDescriptorName(enum_descriptor);
string enum_options = OptionsValue(
- enum_descriptor.options().SerializeAsString());
+ "EnumOptions", enum_descriptor.options().SerializeAsString());
if (enum_options != "None") {
PrintDescriptorOptionsFixingCode(descriptor_name, enum_options, printer_);
}
for (int i = 0; i < enum_descriptor.value_count(); ++i) {
const EnumValueDescriptor& value_descriptor = *enum_descriptor.value(i);
string value_options = OptionsValue(
- value_descriptor.options().SerializeAsString());
+ "EnumValueOptions", value_descriptor.options().SerializeAsString());
if (value_options != "None") {
PrintDescriptorOptionsFixingCode(
StringPrintf("%s.values_by_name[\"%s\"]", descriptor_name.c_str(),
@@ -1339,7 +1355,8 @@ void Generator::FixOptionsForEnum(const EnumDescriptor& enum_descriptor) const {
// extensions).
void Generator::FixOptionsForField(
const FieldDescriptor& field) const {
- string field_options = OptionsValue(field.options().SerializeAsString());
+ string field_options = OptionsValue(
+ "FieldOptions", field.options().SerializeAsString());
if (field_options != "None") {
string field_name;
if (field.is_extension()) {
@@ -1385,7 +1402,7 @@ void Generator::FixOptionsForMessage(const Descriptor& descriptor) const {
}
// Message option for this message.
string message_options = OptionsValue(
- descriptor.options().SerializeAsString());
+ "MessageOptions", descriptor.options().SerializeAsString());
if (message_options != "None") {
string descriptor_name = ModuleLevelDescriptorName(descriptor);
PrintDescriptorOptionsFixingCode(descriptor_name,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_generator.h
index 8e4050de8c..2b5a028b3f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_generator.h
@@ -135,7 +135,8 @@ class LIBPROTOC_EXPORT Generator : public CodeGenerator {
const ServiceDescriptor& descriptor) const;
void PrintEnumValueDescriptor(const EnumValueDescriptor& descriptor) const;
- string OptionsValue(const string& serialized_options) const;
+ string OptionsValue(const string& class_name,
+ const string& serialized_options) const;
bool GeneratingDescriptorProto() const;
template <typename DescriptorT>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_plugin_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_plugin_unittest.cc
index 2f096808a5..34f857fddb 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/python/python_plugin_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/python/python_plugin_unittest.cc
@@ -35,6 +35,9 @@
// worth.
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/compiler/python/python_generator.h>
#include <google/protobuf/compiler/command_line_interface.h>
@@ -71,7 +74,7 @@ class TestGenerator : public CodeGenerator {
void TryInsert(const string& filename, const string& insertion_point,
GeneratorContext* context) const {
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
context->OpenForInsert(filename, insertion_point));
io::Printer printer(output.get(), '$');
printer.Print("// inserted $name$\n", "name", insertion_point);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generated_code.proto b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generated_code.proto
index 42d82a6bac..42d82a6bac 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generated_code.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generated_code.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb
index 49b23fbe8d..49b23fbe8d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator.cc
index bd737c0278..fbe3b4cb71 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator.cc
@@ -39,6 +39,8 @@
#include <google/protobuf/compiler/ruby/ruby_generator.h>
+using google::protobuf::internal::scoped_ptr;
+
namespace google {
namespace protobuf {
namespace compiler {
@@ -337,20 +339,9 @@ void GenerateEnumAssignment(
}
int GeneratePackageModules(
- const FileDescriptor* file,
+ std::string package_name,
google::protobuf::io::Printer* printer) {
int levels = 0;
- bool need_change_to_module;
- std::string package_name;
-
- if (file->options().has_ruby_package()) {
- package_name = file->options().ruby_package();
- need_change_to_module = false;
- } else {
- package_name = file->package();
- need_change_to_module = true;
- }
-
while (!package_name.empty()) {
size_t dot_index = package_name.find(".");
string component;
@@ -361,9 +352,7 @@ int GeneratePackageModules(
component = package_name.substr(0, dot_index);
package_name = package_name.substr(dot_index + 1);
}
- if (need_change_to_module) {
- component = PackageToModule(component);
- }
+ component = PackageToModule(component);
printer->Print(
"module $name$\n",
"name", component);
@@ -475,7 +464,7 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer,
printer->Print(
"end\n\n");
- int levels = GeneratePackageModules(file, printer);
+ int levels = GeneratePackageModules(file->package(), printer);
for (int i = 0; i < file->message_type_count(); i++) {
GenerateMessageAssignment("", file->message_type(i), printer);
}
@@ -499,7 +488,7 @@ bool Generator::Generate(
return false;
}
- std::unique_ptr<io::ZeroCopyOutputStream> output(
+ scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(GetOutputFilename(file->name())));
io::Printer printer(output.get(), '$');
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator.h
index 8c1dfa2671..8c1dfa2671 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
index 1aabe8aa98..1aabe8aa98 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/subprocess.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/subprocess.cc
index 2e5a89ac49..2e5a89ac49 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/subprocess.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/subprocess.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/subprocess.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/subprocess.h
index 9d980b0609..9d980b0609 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/subprocess.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/subprocess.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/test_plugin.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/test_plugin.cc
index c676ce8ce9..c676ce8ce9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/test_plugin.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/test_plugin.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_output_unittest.sh b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_output_unittest.sh
index f85979128b..abd2c374c3 100644..100755
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_output_unittest.sh
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_output_unittest.sh
@@ -81,7 +81,7 @@ if $JAR c $TEST_TMPDIR/testzip.proto > /dev/null; then
|| fail 'jar failed.'
# Check that -interface.jar timestamps are normalized:
- if [[ "$(TZ=UTC $JAR tvf $TEST_TMPDIR/testzip.jar)" != *'Tue Jan 01 00:00:00 UTC 1980'* ]]; then
+ if [ "$(TZ=UTC $JAR tvf $TEST_TMPDIR/testzip.jar)" != *'Tue Jan 01 00:00:00 UTC 1980'* ]; then
fail 'Zip did not contain normalized timestamps'
fi
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_writer.cc b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_writer.cc
index 1799af6a4a..1799af6a4a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_writer.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_writer.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_writer.h b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_writer.h
index 03db4d573c..03db4d573c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/zip_writer.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_writer.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.cc b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.cc
index 83eae519ef..89b37ee33f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.cc
@@ -32,28 +32,29 @@
// 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
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <set>
#include <string>
#include <vector>
+#include <algorithm>
+#include <limits>
-#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/mutex.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/strutil.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/strtod.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor_database.h>
#include <google/protobuf/dynamic_message.h>
@@ -63,7 +64,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/substitute.h>
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>
@@ -346,14 +346,14 @@ class PrefixRemover {
}
if (ascii_tolower(str[i]) != prefix_[j++]) {
- return string(str);
+ return str.as_string();
}
}
// If we didn't make it through the prefix, we've failed to strip the
// prefix.
if (j < prefix_.size()) {
- return string(str);
+ return str.as_string();
}
// Skip underscores between prefix and further characters.
@@ -363,25 +363,27 @@ class PrefixRemover {
// Enum label can't be the empty string.
if (i == str.size()) {
- return string(str);
+ return str.as_string();
}
// We successfully stripped the prefix.
str.remove_prefix(i);
- return string(str);
+ return str.as_string();
}
private:
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.
+// 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.
//
// 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*
@@ -396,13 +398,6 @@ 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 {
@@ -422,6 +417,9 @@ 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
@@ -447,37 +445,31 @@ struct PointerStringPairHash {
const Symbol kNullSymbol;
-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*,
+typedef hash_map<const char*, Symbol,
+ hash<const char*>, streq>
+ SymbolsByNameMap;
+typedef hash_map<PointerStringPair, Symbol,
PointerStringPairHash, PointerStringPairEqual>
- 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
+ SymbolsByParentMap;
+typedef hash_map<const char*, const FileDescriptor*,
+ hash<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
// 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_);
@@ -572,17 +564,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.
@@ -601,7 +593,7 @@ class DescriptorPool::Tables {
// These return NULL if not found.
inline const FileDescriptor* FindFile(const string& key) const;
inline const FieldDescriptor* FindExtension(const Descriptor* extendee,
- int number) const;
+ int number);
inline void FindAllExtensions(const Descriptor* extendee,
std::vector<const FieldDescriptor*>* out) const;
@@ -760,27 +752,11 @@ class FileDescriptorTables {
const SourceCodeInfo_Location* GetSourceLocation(
const std::vector<int>& path, const SourceCodeInfo* info) const;
- // Must be called after BuildFileImpl(), even if the build failed and
- // we are going to roll back to the last checkpoint.
- void FinalizeTables();
-
private:
- const void* FindParentForFieldsByMap(const FieldDescriptor* field) const;
- static void FieldsByLowercaseNamesLazyInitStatic(
- const FileDescriptorTables* tables);
- void FieldsByLowercaseNamesLazyInitInternal() const;
- static void FieldsByCamelcaseNamesLazyInitStatic(
- const FileDescriptorTables* tables);
- void FieldsByCamelcaseNamesLazyInitInternal() const;
-
- SymbolsByParentMap symbols_by_parent_;
- mutable FieldsByNameMap fields_by_lowercase_name_;
- std::unique_ptr<FieldsByNameMap> fields_by_lowercase_name_tmp_;
- mutable GoogleOnceDynamic fields_by_lowercase_name_once_;
- mutable FieldsByNameMap fields_by_camelcase_name_;
- std::unique_ptr<FieldsByNameMap> fields_by_camelcase_name_tmp_;
- mutable GoogleOnceDynamic fields_by_camelcase_name_once_;
- FieldsByNumberMap fields_by_number_; // Not including extensions.
+ SymbolsByParentMap symbols_by_parent_;
+ FieldsByNameMap fields_by_lowercase_name_;
+ FieldsByNameMap fields_by_camelcase_name_;
+ FieldsByNumberMap fields_by_number_; // Not including extensions.
EnumValuesByNumberMap enum_values_by_number_;
mutable EnumValuesByNumberMap unknown_enum_values_by_number_
GOOGLE_GUARDED_BY(unknown_enum_values_mu_);
@@ -795,13 +771,14 @@ 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
@@ -816,16 +793,14 @@ DescriptorPool::Tables::~Tables() {
}
FileDescriptorTables::FileDescriptorTables()
- // Initialize all the hash tables to start out with a small # of buckets.
+ // Initialize all the hash tables to start out with a small # of buckets
: symbols_by_parent_(3),
fields_by_lowercase_name_(3),
- fields_by_lowercase_name_tmp_(new FieldsByNameMap()),
fields_by_camelcase_name_(3),
- fields_by_camelcase_name_tmp_(new FieldsByNameMap()),
fields_by_number_(3),
enum_values_by_number_(3),
- unknown_enum_values_by_number_(3),
- locations_by_path_(3) {}
+ unknown_enum_values_by_number_(3) {
+}
FileDescriptorTables::~FileDescriptorTables() {}
@@ -955,10 +930,8 @@ inline Symbol FileDescriptorTables::FindNestedSymbolOfType(
Symbol DescriptorPool::Tables::FindByNameHelper(
const DescriptorPool* pool, const string& name) {
MutexLockMaybe lock(pool->mutex_);
- if (pool->fallback_database_ != NULL) {
- known_bad_symbols_.clear();
- known_bad_files_.clear();
- }
+ known_bad_symbols_.clear();
+ known_bad_files_.clear();
Symbol result = FindSymbol(name);
if (result.IsNull() && pool->underlay_ != NULL) {
@@ -987,59 +960,14 @@ inline const FieldDescriptor* FileDescriptorTables::FindFieldByNumber(
return FindPtrOrNull(fields_by_number_, std::make_pair(parent, number));
}
-const void* FileDescriptorTables::FindParentForFieldsByMap(
- const FieldDescriptor* field) const {
- if (field->is_extension()) {
- if (field->extension_scope() == NULL) {
- return field->file();
- } else {
- return field->extension_scope();
- }
- } else {
- return field->containing_type();
- }
-}
-
-void FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic(
- const FileDescriptorTables* tables) {
- tables->FieldsByLowercaseNamesLazyInitInternal();
-}
-
-void FileDescriptorTables::FieldsByLowercaseNamesLazyInitInternal() const {
- for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin();
- it != fields_by_number_.end(); it++) {
- PointerStringPair lowercase_key(FindParentForFieldsByMap(it->second),
- it->second->lowercase_name().c_str());
- InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, it->second);
- }
-}
-
inline const FieldDescriptor* FileDescriptorTables::FindFieldByLowercaseName(
const void* parent, const string& lowercase_name) const {
- fields_by_lowercase_name_once_.Init(
- &FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic, this);
return FindPtrOrNull(fields_by_lowercase_name_,
PointerStringPair(parent, lowercase_name.c_str()));
}
-void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic(
- const FileDescriptorTables* tables) {
- tables->FieldsByCamelcaseNamesLazyInitInternal();
-}
-
-void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitInternal() const {
- for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin();
- it != fields_by_number_.end(); it++) {
- PointerStringPair camelcase_key(FindParentForFieldsByMap(it->second),
- it->second->camelcase_name().c_str());
- InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, it->second);
- }
-}
-
inline const FieldDescriptor* FileDescriptorTables::FindFieldByCamelcaseName(
const void* parent, const string& camelcase_name) const {
- fields_by_camelcase_name_once_.Init(
- &FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic, this);
return FindPtrOrNull(fields_by_camelcase_name_,
PointerStringPair(parent, camelcase_name.c_str()));
}
@@ -1103,7 +1031,7 @@ FileDescriptorTables::FindEnumValueByNumberCreatingIfUnknown(
inline const FieldDescriptor* DescriptorPool::Tables::FindExtension(
- const Descriptor* extendee, int number) const {
+ const Descriptor* extendee, int number) {
return FindPtrOrNull(extensions_, std::make_pair(extendee, number));
}
@@ -1144,38 +1072,24 @@ bool DescriptorPool::Tables::AddFile(const FileDescriptor* file) {
}
}
-void FileDescriptorTables::FinalizeTables() {
- // Clean up the temporary maps used by AddFieldByStylizedNames().
- fields_by_lowercase_name_tmp_ = nullptr;
- fields_by_camelcase_name_tmp_ = nullptr;
-}
-
void FileDescriptorTables::AddFieldByStylizedNames(
const FieldDescriptor* field) {
- const void* parent = FindParentForFieldsByMap(field);
-
- // We want fields_by_{lower,camel}case_name_ to be lazily built, but
- // cross-link order determines which entry will be present in the case of a
- // conflict. So we use the temporary maps that get destroyed after
- // BuildFileImpl() to detect the conflicts, and only store the conflicts in
- // the map that will persist. We will then lazily populate the rest of the
- // entries from fields_by_number_.
+ const void* parent;
+ if (field->is_extension()) {
+ if (field->extension_scope() == NULL) {
+ parent = field->file();
+ } else {
+ parent = field->extension_scope();
+ }
+ } else {
+ parent = field->containing_type();
+ }
PointerStringPair lowercase_key(parent, field->lowercase_name().c_str());
- if (!InsertIfNotPresent(fields_by_lowercase_name_tmp_.get(), lowercase_key,
- field)) {
- InsertIfNotPresent(
- &fields_by_lowercase_name_, lowercase_key,
- FindPtrOrNull(*fields_by_lowercase_name_tmp_, lowercase_key));
- }
+ InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, field);
PointerStringPair camelcase_key(parent, field->camelcase_name().c_str());
- if (!InsertIfNotPresent(fields_by_camelcase_name_tmp_.get(), camelcase_key,
- field)) {
- InsertIfNotPresent(
- &fields_by_camelcase_name_, camelcase_key,
- FindPtrOrNull(*fields_by_camelcase_name_tmp_, camelcase_key));
- }
+ InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, field);
}
bool FileDescriptorTables::AddFieldByNumber(const FieldDescriptor* field) {
@@ -1410,10 +1324,8 @@ void DescriptorPool::InternalAddGeneratedFile(
const FileDescriptor* DescriptorPool::FindFileByName(const string& name) const {
MutexLockMaybe lock(mutex_);
- if (fallback_database_ != NULL) {
- tables_->known_bad_symbols_.clear();
- tables_->known_bad_files_.clear();
- }
+ tables_->known_bad_symbols_.clear();
+ tables_->known_bad_files_.clear();
const FileDescriptor* result = tables_->FindFile(name);
if (result != NULL) return result;
if (underlay_ != NULL) {
@@ -1430,10 +1342,8 @@ const FileDescriptor* DescriptorPool::FindFileByName(const string& name) const {
const FileDescriptor* DescriptorPool::FindFileContainingSymbol(
const string& symbol_name) const {
MutexLockMaybe lock(mutex_);
- if (fallback_database_ != NULL) {
- tables_->known_bad_symbols_.clear();
- tables_->known_bad_files_.clear();
- }
+ 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) {
@@ -1509,20 +1419,9 @@ const MethodDescriptor* DescriptorPool::FindMethodByName(
const FieldDescriptor* DescriptorPool::FindExtensionByNumber(
const Descriptor* extendee, int number) const {
- // A faster path to reduce lock contention in finding extensions, assuming
- // most extensions will be cache hit.
- if (mutex_ != NULL) {
- ReaderMutexLock lock(mutex_);
- const FieldDescriptor* result = tables_->FindExtension(extendee, number);
- if (result != NULL) {
- return result;
- }
- }
MutexLockMaybe lock(mutex_);
- if (fallback_database_ != NULL) {
- tables_->known_bad_symbols_.clear();
- tables_->known_bad_files_.clear();
- }
+ tables_->known_bad_symbols_.clear();
+ tables_->known_bad_files_.clear();
const FieldDescriptor* result = tables_->FindExtension(extendee, number);
if (result != NULL) {
return result;
@@ -1544,10 +1443,8 @@ void DescriptorPool::FindAllExtensions(
const Descriptor* extendee,
std::vector<const FieldDescriptor*>* out) const {
MutexLockMaybe lock(mutex_);
- if (fallback_database_ != NULL) {
- tables_->known_bad_symbols_.clear();
- tables_->known_bad_files_.clear();
- }
+ 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).
@@ -1799,15 +1696,6 @@ FileDescriptor::FindExtensionByCamelcaseName(const string& key) const {
}
}
-void Descriptor::ExtensionRange::CopyTo(
- DescriptorProto_ExtensionRange* proto) const {
- proto->set_start(this->start);
- proto->set_end(this->end);
- if (options_ != &google::protobuf::ExtensionRangeOptions::default_instance()) {
- *proto->mutable_options() = *options_;
- }
-}
-
const Descriptor::ExtensionRange*
Descriptor::FindExtensionRangeContainingNumber(int number) const {
// Linear search should be fine because we don't expect a message to have
@@ -1833,18 +1721,6 @@ Descriptor::FindReservedRangeContainingNumber(int number) const {
return NULL;
}
-const EnumDescriptor::ReservedRange*
-EnumDescriptor::FindReservedRangeContainingNumber(int number) const {
- // TODO(chrisn): Consider a non-linear search.
- for (int i = 0; i < reserved_range_count(); i++) {
- if (number >= reserved_range(i)->start &&
- number <= reserved_range(i)->end) {
- return reserved_range(i);
- }
- }
- return NULL;
-}
-
// -------------------------------------------------------------------
bool DescriptorPool::TryFindFileInFallbackDatabase(const string& name) const {
@@ -1950,8 +1826,8 @@ bool DescriptorPool::TryFindExtensionInFallbackDatabase(
// ===================================================================
-bool FieldDescriptor::is_map_message_type() const {
- return message_type_->options().map_entry();
+bool FieldDescriptor::is_map() const {
+ return type() == TYPE_MESSAGE && message_type()->options().map_entry();
}
string FieldDescriptor::DefaultValueAsString(bool quote_string_type) const {
@@ -2075,7 +1951,13 @@ void Descriptor::CopyTo(DescriptorProto* proto) const {
enum_type(i)->CopyTo(proto->add_enum_type());
}
for (int i = 0; i < extension_range_count(); i++) {
- extension_range(i)->CopyTo(proto->add_extension_range());
+ DescriptorProto::ExtensionRange* range = proto->add_extension_range();
+ range->set_start(extension_range(i)->start);
+ range->set_end(extension_range(i)->end);
+ const ExtensionRangeOptions* options = extension_range(i)->options_;
+ if (options != &ExtensionRangeOptions::default_instance()) {
+ range->mutable_options()->CopyFrom(*options);
+ }
}
for (int i = 0; i < extension_count(); i++) {
extension(i)->CopyTo(proto->add_extension());
@@ -2181,14 +2063,6 @@ void EnumDescriptor::CopyTo(EnumDescriptorProto* proto) const {
for (int i = 0; i < value_count(); i++) {
value(i)->CopyTo(proto->add_value());
}
- for (int i = 0; i < reserved_range_count(); i++) {
- EnumDescriptorProto::EnumReservedRange* range = proto->add_reserved_range();
- range->set_start(reserved_range(i)->start);
- range->set_end(reserved_range(i)->end);
- }
- for (int i = 0; i < reserved_name_count(); i++) {
- proto->add_reserved_name(reserved_name(i));
- }
if (&options() != &EnumOptions::default_instance()) {
proto->mutable_options()->CopyFrom(options());
@@ -2306,7 +2180,7 @@ bool RetrieveOptions(int depth, const Message& options,
return RetrieveOptionsAssumingRightPool(depth, options, option_entries);
}
DynamicMessageFactory factory;
- std::unique_ptr<Message> dynamic_options(
+ google::protobuf::scoped_ptr<Message> dynamic_options(
factory.GetPrototype(option_descriptor)->New());
if (dynamic_options->ParseFromString(options.SerializeAsString())) {
return RetrieveOptionsAssumingRightPool(depth, *dynamic_options,
@@ -2821,30 +2695,6 @@ void EnumDescriptor::DebugString(int depth, string *contents,
for (int i = 0; i < value_count(); i++) {
value(i)->DebugString(depth, contents, debug_string_options);
}
-
- if (reserved_range_count() > 0) {
- strings::SubstituteAndAppend(contents, "$0 reserved ", prefix);
- for (int i = 0; i < reserved_range_count(); i++) {
- const EnumDescriptor::ReservedRange* range = reserved_range(i);
- if (range->end == range->start) {
- strings::SubstituteAndAppend(contents, "$0, ", range->start);
- } else {
- strings::SubstituteAndAppend(contents, "$0 to $1, ",
- range->start, range->end);
- }
- }
- contents->replace(contents->size() - 2, 2, ";\n");
- }
-
- if (reserved_name_count() > 0) {
- strings::SubstituteAndAppend(contents, "$0 reserved ", prefix);
- for (int i = 0; i < reserved_name_count(); i++) {
- strings::SubstituteAndAppend(contents, "\"$0\", ",
- CEscape(reserved_name(i)));
- }
- contents->replace(contents->size() - 2, 2, ";\n");
- }
-
strings::SubstituteAndAppend(contents, "$0}\n", prefix);
comment_printer.AddPostComment(contents);
@@ -3116,18 +2966,15 @@ namespace {
struct OptionsToInterpret {
OptionsToInterpret(const string& ns,
const string& el,
- std::vector<int>& path,
const Message* orig_opt,
Message* opt)
: name_scope(ns),
element_name(el),
- element_path(path),
original_options(orig_opt),
options(opt) {
}
string name_scope;
string element_name;
- std::vector<int> element_path;
const Message* original_options;
Message* options;
};
@@ -3147,7 +2994,7 @@ class DescriptorBuilder {
friend class OptionInterpreter;
// Non-recursive part of BuildFile functionality.
- FileDescriptor* BuildFileImpl(const FileDescriptorProto& proto);
+ const FileDescriptor* BuildFileImpl(const FileDescriptorProto& proto);
const DescriptorPool* pool_;
DescriptorPool::Tables* tables_; // for convenience
@@ -3294,7 +3141,7 @@ class DescriptorBuilder {
// descriptor.proto.
template<class DescriptorT> void AllocateOptions(
const typename DescriptorT::OptionsType& orig_options,
- DescriptorT* descriptor, int options_field_tag);
+ DescriptorT* descriptor);
// Specialization for FileOptions.
void AllocateOptions(const FileOptions& orig_options,
FileDescriptor* descriptor);
@@ -3304,8 +3151,7 @@ class DescriptorBuilder {
const string& name_scope,
const string& element_name,
const typename DescriptorT::OptionsType& orig_options,
- DescriptorT* descriptor,
- std::vector<int>& options_path);
+ DescriptorT* descriptor);
// These methods all have the same signature for the sake of the BUILD_ARRAY
// macro, below.
@@ -3332,9 +3178,6 @@ class DescriptorBuilder {
void BuildReservedRange(const DescriptorProto::ReservedRange& proto,
const Descriptor* parent,
Descriptor::ReservedRange* result);
- void BuildReservedRange(const EnumDescriptorProto::EnumReservedRange& proto,
- const EnumDescriptor* parent,
- EnumDescriptor::ReservedRange* result);
void BuildOneof(const OneofDescriptorProto& proto,
Descriptor* parent,
OneofDescriptor* result);
@@ -3394,21 +3237,13 @@ class DescriptorBuilder {
// Otherwise returns true.
bool InterpretOptions(OptionsToInterpret* options_to_interpret);
- // Updates the given source code info by re-writing uninterpreted option
- // locations to refer to the corresponding interpreted option.
- void UpdateSourceCodeInfo(SourceCodeInfo* info);
-
class AggregateOptionFinder;
private:
// Interprets uninterpreted_option_ on the specified message, which
// must be the mutable copy of the original options message to which
- // uninterpreted_option_ belongs. The given src_path is the source
- // location path to the uninterpreted option, and options_path is the
- // source location path to the options message. The location paths are
- // recorded and then used in UpdateSourceCodeInfo.
- bool InterpretSingleOption(Message* options, std::vector<int>& src_path,
- std::vector<int>& options_path);
+ // uninterpreted_option_ belongs.
+ bool InterpretSingleOption(Message* options);
// Adds the uninterpreted_option to the given options message verbatim.
// Used when AllowUnknownDependencies() is in effect and we can't find
@@ -3483,16 +3318,6 @@ class DescriptorBuilder {
// can use it to find locations recorded by the parser.
const UninterpretedOption* uninterpreted_option_;
- // This maps the element path of uninterpreted options to the element path
- // of the resulting interpreted option. This is used to modify a file's
- // source code info to account for option interpretation.
- std::map<std::vector<int>, std::vector<int>> interpreted_paths_;
-
- // This maps the path to a repeated option field to the known number of
- // elements the field contains. This is used to track the compute the
- // index portion of the element path when interpreting a single option.
- std::map<std::vector<int>, int> repeated_option_counts_;
-
// Factory used to create the dynamic messages we need to parse
// any aggregate option values we encounter.
DynamicMessageFactory dynamic_factory_;
@@ -4110,30 +3935,24 @@ void DescriptorBuilder::ValidateSymbolName(
// FileDescriptor.
template<class DescriptorT> void DescriptorBuilder::AllocateOptions(
const typename DescriptorT::OptionsType& orig_options,
- DescriptorT* descriptor, int options_field_tag) {
- std::vector<int> options_path;
- descriptor->GetLocationPath(&options_path);
- options_path.push_back(options_field_tag);
+ DescriptorT* descriptor) {
AllocateOptionsImpl(descriptor->full_name(), descriptor->full_name(),
- orig_options, descriptor, options_path);
+ orig_options, descriptor);
}
// We specialize for FileDescriptor.
void DescriptorBuilder::AllocateOptions(const FileOptions& orig_options,
FileDescriptor* descriptor) {
- std::vector<int> options_path;
- options_path.push_back(FileDescriptorProto::kOptionsFieldNumber);
// We add the dummy token so that LookupSymbol does the right thing.
AllocateOptionsImpl(descriptor->package() + ".dummy", descriptor->name(),
- orig_options, descriptor, options_path);
+ orig_options, descriptor);
}
template<class DescriptorT> void DescriptorBuilder::AllocateOptionsImpl(
const string& name_scope,
const string& element_name,
const typename DescriptorT::OptionsType& orig_options,
- DescriptorT* descriptor,
- std::vector<int>& options_path) {
+ DescriptorT* descriptor) {
// We need to use a dummy pointer to work around a bug in older versions of
// GCC. Otherwise, the following two lines could be replaced with:
// typename DescriptorT::OptionsType* options =
@@ -4156,8 +3975,7 @@ template<class DescriptorT> void DescriptorBuilder::AllocateOptionsImpl(
// we're still trying to build it.
if (options->uninterpreted_option_size() > 0) {
options_to_interpret_.push_back(
- OptionsToInterpret(name_scope, element_name, options_path,
- &orig_options, options));
+ OptionsToInterpret(name_scope, element_name, &orig_options, options));
}
}
@@ -4271,33 +4089,21 @@ const FileDescriptor* DescriptorBuilder::BuildFile(
tables_->pending_files_.pop_back();
}
}
+ return BuildFileImpl(proto);
+}
+const FileDescriptor* DescriptorBuilder::BuildFileImpl(
+ const FileDescriptorProto& proto) {
// Checkpoint the tables so that we can roll back if something goes wrong.
tables_->AddCheckpoint();
- FileDescriptor* result = BuildFileImpl(proto);
-
- file_tables_->FinalizeTables();
- if (result) {
- tables_->ClearLastCheckpoint();
- result->finished_building_ = true;
- } else {
- tables_->RollbackToLastCheckpoint();
- }
-
- return result;
-}
-
-FileDescriptor* DescriptorBuilder::BuildFileImpl(
- const FileDescriptorProto& proto) {
FileDescriptor* result = tables_->Allocate<FileDescriptor>();
file_ = result;
result->is_placeholder_ = false;
result->finished_building_ = false;
- SourceCodeInfo *info = NULL;
if (proto.has_source_code_info()) {
- info = tables_->AllocateMessage<SourceCodeInfo>();
+ SourceCodeInfo *info = tables_->AllocateMessage<SourceCodeInfo>();
info->CopyFrom(proto.source_code_info());
result->source_code_info_ = info;
} else {
@@ -4342,6 +4148,7 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl(
"A file with this name is already in the pool.");
// Bail out early so that if this is actually the exact same file, we
// don't end up reporting that every single symbol is already defined.
+ tables_->RollbackToLastCheckpoint();
return NULL;
}
if (!result->package().empty()) {
@@ -4357,10 +4164,8 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl(
result->dependencies_once_ = tables_->AllocateOnceDynamic();
result->dependencies_names_ =
tables_->AllocateArray<const string*>(proto.dependency_size());
- if (proto.dependency_size() > 0) {
- memset(result->dependencies_names_, 0,
- sizeof(*result->dependencies_names_) * proto.dependency_size());
- }
+ memset(result->dependencies_names_, 0,
+ sizeof(*result->dependencies_names_) * proto.dependency_size());
} else {
result->dependencies_once_ = NULL;
result->dependencies_names_ = NULL;
@@ -4384,16 +4189,17 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl(
// Recursive import. dependency/result is not fully initialized, and it's
// dangerous to try to do anything with it. The recursive import error
// will be detected and reported in DescriptorBuilder::BuildFile().
+ tables_->RollbackToLastCheckpoint();
return NULL;
}
if (dependency == NULL) {
- if (!pool_->lazily_build_dependencies_) {
- if (pool_->allow_unknown_ ||
- (!pool_->enforce_weak_ && weak_deps.find(i) != weak_deps.end())) {
- dependency =
- pool_->NewPlaceholderFileWithMutexHeld(proto.dependency(i));
- } else {
+ if (pool_->allow_unknown_ ||
+ (!pool_->enforce_weak_ && weak_deps.find(i) != weak_deps.end())) {
+ dependency =
+ pool_->NewPlaceholderFileWithMutexHeld(proto.dependency(i));
+ } else {
+ if (!pool_->lazily_build_dependencies_) {
AddImportError(proto, i);
}
}
@@ -4495,10 +4301,6 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl(
option_interpreter.InterpretOptions(&(*iter));
}
options_to_interpret_.clear();
-
- if (info != NULL) {
- option_interpreter.UpdateSourceCodeInfo(info);
- }
}
// Validate options. See comments at InternalSetLazilyBuildDependencies about
@@ -4523,8 +4325,11 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl(
}
if (had_errors_) {
+ tables_->RollbackToLastCheckpoint();
return NULL;
} else {
+ tables_->ClearLastCheckpoint();
+ result->finished_building_ = true;
return result;
}
}
@@ -4570,8 +4375,7 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto,
if (!proto.has_options()) {
result->options_ = NULL; // Will set to default_instance later.
} else {
- AllocateOptions(proto.options(), result,
- DescriptorProto::kOptionsFieldNumber);
+ AllocateOptions(proto.options(), result);
}
AddSymbol(result->full_name(), parent, result->name(),
@@ -4592,7 +4396,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()) {
@@ -4951,8 +4755,7 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto,
if (!proto.has_options()) {
result->options_ = NULL; // Will set to default_instance later.
} else {
- AllocateOptions(proto.options(), result,
- FieldDescriptorProto::kOptionsFieldNumber);
+ AllocateOptions(proto.options(), result);
}
@@ -4986,16 +4789,8 @@ void DescriptorBuilder::BuildExtensionRange(
if (!proto.has_options()) {
result->options_ = NULL; // Will set to default_instance later.
} else {
- std::vector<int> options_path;
- parent->GetLocationPath(&options_path);
- options_path.push_back(DescriptorProto::kExtensionRangeFieldNumber);
- // find index of this extension range in order to compute path
- int index;
- for (index = 0; parent->extension_ranges_ + index != result; index++);
- options_path.push_back(index);
- options_path.push_back(DescriptorProto_ExtensionRange::kOptionsFieldNumber);
AllocateOptionsImpl(parent->full_name(), parent->full_name(),
- proto.options(), result, options_path);
+ proto.options(), result);
}
}
@@ -5012,19 +4807,6 @@ void DescriptorBuilder::BuildReservedRange(
}
}
-void DescriptorBuilder::BuildReservedRange(
- const EnumDescriptorProto::EnumReservedRange& proto,
- const EnumDescriptor* parent, EnumDescriptor::ReservedRange* result) {
- result->start = proto.start();
- result->end = proto.end();
-
- if (result->start > result->end) {
- AddError(parent->full_name(), proto,
- DescriptorPool::ErrorCollector::NUMBER,
- "Reserved range end number must be greater than start number.");
- }
-}
-
void DescriptorBuilder::BuildOneof(const OneofDescriptorProto& proto,
Descriptor* parent,
OneofDescriptor* result) {
@@ -5047,8 +4829,7 @@ void DescriptorBuilder::BuildOneof(const OneofDescriptorProto& proto,
if (!proto.has_options()) {
result->options_ = NULL; // Will set to default_instance later.
} else {
- AllocateOptions(proto.options(), result,
- OneofDescriptorProto::kOptionsFieldNumber);
+ AllocateOptions(proto.options(), result);
}
AddSymbol(result->full_name(), parent, result->name(),
@@ -5147,17 +4928,6 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto,
}
BUILD_ARRAY(proto, result, value, BuildEnumValue, result);
- BUILD_ARRAY(proto, result, reserved_range, BuildReservedRange, result);
-
- // Copy reserved names.
- int reserved_name_count = proto.reserved_name_size();
- result->reserved_name_count_ = reserved_name_count;
- result->reserved_names_ =
- tables_->AllocateArray<const string*>(reserved_name_count);
- for (int i = 0; i < reserved_name_count; ++i) {
- result->reserved_names_[i] =
- tables_->AllocateString(proto.reserved_name(i));
- }
CheckEnumValueUniqueness(proto, result);
@@ -5165,62 +4935,11 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto,
if (!proto.has_options()) {
result->options_ = NULL; // Will set to default_instance later.
} else {
- AllocateOptions(proto.options(), result,
- EnumDescriptorProto::kOptionsFieldNumber);
+ AllocateOptions(proto.options(), result);
}
AddSymbol(result->full_name(), parent, result->name(),
proto, Symbol(result));
-
- for (int i = 0; i < proto.reserved_range_size(); i++) {
- const EnumDescriptorProto_EnumReservedRange& range1 =
- proto.reserved_range(i);
- for (int j = i + 1; j < proto.reserved_range_size(); j++) {
- const EnumDescriptorProto_EnumReservedRange& range2 =
- proto.reserved_range(j);
- if (range1.end() >= range2.start() && range2.end() >= range1.start()) {
- AddError(result->full_name(), proto.reserved_range(i),
- DescriptorPool::ErrorCollector::NUMBER,
- strings::Substitute("Reserved range $0 to $1 overlaps with "
- "already-defined range $2 to $3.",
- range2.start(), range2.end(),
- range1.start(), range1.end()));
- }
- }
- }
-
- 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()) {
- reserved_name_set.insert(name);
- } else {
- AddError(name, proto, DescriptorPool::ErrorCollector::NAME,
- strings::Substitute(
- "Enum value \"$0\" is reserved multiple times.",
- name));
- }
- }
-
- for (int i = 0; i < result->value_count(); i++) {
- const EnumValueDescriptor* value = result->value(i);
- for (int j = 0; j < result->reserved_range_count(); j++) {
- const EnumDescriptor::ReservedRange* range = result->reserved_range(j);
- if (range->start <= value->number() && value->number() <= range->end) {
- AddError(value->full_name(), proto.reserved_range(j),
- DescriptorPool::ErrorCollector::NUMBER,
- strings::Substitute(
- "Enum value \"$0\" uses reserved number $1.",
- value->name(), value->number()));
- }
- }
- if (reserved_name_set.find(value->name()) != reserved_name_set.end()) {
- AddError(value->full_name(), proto.value(i),
- DescriptorPool::ErrorCollector::NAME,
- strings::Substitute(
- "Enum value \"$0\" is reserved.", value->name()));
- }
- }
}
void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto,
@@ -5243,8 +4962,7 @@ void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto,
if (!proto.has_options()) {
result->options_ = NULL; // Will set to default_instance later.
} else {
- AllocateOptions(proto.options(), result,
- EnumValueDescriptorProto::kOptionsFieldNumber);
+ AllocateOptions(proto.options(), result);
}
// Again, enum values are weird because we makes them appear as siblings
@@ -5311,8 +5029,7 @@ void DescriptorBuilder::BuildService(const ServiceDescriptorProto& proto,
if (!proto.has_options()) {
result->options_ = NULL; // Will set to default_instance later.
} else {
- AllocateOptions(proto.options(), result,
- ServiceDescriptorProto::kOptionsFieldNumber);
+ AllocateOptions(proto.options(), result);
}
AddSymbol(result->full_name(), NULL, result->name(),
@@ -5340,8 +5057,7 @@ void DescriptorBuilder::BuildMethod(const MethodDescriptorProto& proto,
if (!proto.has_options()) {
result->options_ = NULL; // Will set to default_instance later.
} else {
- AllocateOptions(proto.options(), result,
- MethodDescriptorProto::kOptionsFieldNumber);
+ AllocateOptions(proto.options(), result);
}
result->client_streaming_ = proto.client_streaming();
@@ -5532,27 +5248,25 @@ void DescriptorBuilder::CrossLinkField(
bool expecting_enum = (proto.type() == FieldDescriptorProto::TYPE_ENUM) ||
proto.has_default_value();
- // In case of weak fields we force building the dependency. We need to know
- // if the type exist or not. If it doesnt exist we substitute Empty which
- // should only be done if the type can't be found in the generated pool.
- // TODO(gerbens) Ideally we should query the database directly to check
- // if weak fields exist or not so that we don't need to force building
- // weak dependencies. However the name lookup rules for symbols are
- // somewhat complicated, so I defer it too another CL.
- bool is_weak = !pool_->enforce_weak_ && proto.options().weak();
- bool is_lazy = pool_->lazily_build_dependencies_ && !is_weak;
-
Symbol type =
LookupSymbol(proto.type_name(), field->full_name(),
expecting_enum ? DescriptorPool::PLACEHOLDER_ENUM
: DescriptorPool::PLACEHOLDER_MESSAGE,
- LOOKUP_TYPES, !is_lazy);
+ LOOKUP_TYPES, !pool_->lazily_build_dependencies_);
+
+ // If the type is a weak type, we change the type to a google.protobuf.Empty field.
+ if (type.IsNull() && !pool_->enforce_weak_ && proto.options().weak()) {
+ type = FindSymbol(kNonLinkedWeakMessageReplacementName);
+ }
if (type.IsNull()) {
- if (is_lazy) {
+ if (pool_->lazily_build_dependencies_) {
// Save the symbol names for later for lookup, and allocate the once
// object needed for the accessors.
string name = proto.type_name();
+ if (!pool_->enforce_weak_ && proto.options().weak()) {
+ name = kNonLinkedWeakMessageReplacementName;
+ }
field->type_once_ = tables_->AllocateOnceDynamic();
field->type_name_ = tables_->AllocateString(name);
if (proto.has_default_value()) {
@@ -5570,17 +5284,10 @@ void DescriptorBuilder::CrossLinkField(
}
return;
} else {
- // If the type is a weak type, we change the type to a google.protobuf.Empty
- // field.
- if (is_weak) {
- type = FindSymbol(kNonLinkedWeakMessageReplacementName);
- }
- if (type.IsNull()) {
- AddNotDefinedError(field->full_name(), proto,
- DescriptorPool::ErrorCollector::TYPE,
- proto.type_name());
- return;
- }
+ AddNotDefinedError(field->full_name(), proto,
+ DescriptorPool::ErrorCollector::TYPE,
+ proto.type_name());
+ return;
}
}
@@ -5710,15 +5417,13 @@ void DescriptorBuilder::CrossLinkField(
if (!tables_->AddExtension(field)) {
const FieldDescriptor* conflicting_field =
tables_->FindExtension(field->containing_type(), field->number());
- string containing_type_name =
- field->containing_type() == NULL
- ? "unknown"
- : field->containing_type()->full_name();
string error_msg = strings::Substitute(
"Extension number $0 has already been used in \"$1\" by extension "
"\"$2\" defined in $3.",
- field->number(), containing_type_name,
- conflicting_field->full_name(), conflicting_field->file()->name());
+ field->number(),
+ field->containing_type()->full_name(),
+ conflicting_field->full_name(),
+ conflicting_field->file()->name());
// Conflicting extension numbers should be an error. However, before
// turning this into an error we need to fix all existing broken
// protos first.
@@ -6313,9 +6018,6 @@ bool DescriptorBuilder::OptionInterpreter::InterpretOptions(
<< "No field named \"uninterpreted_option\" in the Options proto.";
options->GetReflection()->ClearField(options, uninterpreted_options_field);
- std::vector<int> src_path = options_to_interpret->element_path;
- src_path.push_back(uninterpreted_options_field->number());
-
// Find the uninterpreted_option field in the original options.
const FieldDescriptor* original_uninterpreted_options_field =
original_options->GetDescriptor()->
@@ -6326,17 +6028,14 @@ bool DescriptorBuilder::OptionInterpreter::InterpretOptions(
const int num_uninterpreted_options = original_options->GetReflection()->
FieldSize(*original_options, original_uninterpreted_options_field);
for (int i = 0; i < num_uninterpreted_options; ++i) {
- src_path.push_back(i);
uninterpreted_option_ = down_cast<const UninterpretedOption*>(
&original_options->GetReflection()->GetRepeatedMessage(
*original_options, original_uninterpreted_options_field, i));
- if (!InterpretSingleOption(options, src_path,
- options_to_interpret->element_path)) {
+ if (!InterpretSingleOption(options)) {
// Error already added by InterpretSingleOption().
failed = true;
break;
}
- src_path.pop_back();
}
// Reset these, so we don't have any dangling pointers.
uninterpreted_option_ = NULL;
@@ -6369,7 +6068,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretOptions(
}
bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
- Message* options, std::vector<int>& src_path, std::vector<int>& opts_path) {
+ Message* options) {
// First do some basic validation.
if (uninterpreted_option_->name_size() == 0) {
// This should never happen unless the parser has gone seriously awry or
@@ -6415,8 +6114,6 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
std::vector<const FieldDescriptor*> intermediate_fields;
string debug_msg_name = "";
- std::vector<int> dest_path = opts_path;
-
for (int i = 0; i < uninterpreted_option_->name_size(); ++i) {
const string& name_part = uninterpreted_option_->name(i).name_part();
if (debug_msg_name.size() > 0) {
@@ -6479,24 +6176,19 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
"\" is not a field or extension of message \"" +
descriptor->name() + "\".");
}
- } else {
- // accumulate field numbers to form path to interpreted option
- dest_path.push_back(field->number());
-
- if (i < uninterpreted_option_->name_size() - 1) {
- if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) {
- return AddNameError("Option \"" + debug_msg_name +
- "\" is an atomic type, not a message.");
- } else if (field->is_repeated()) {
- return AddNameError("Option field \"" + debug_msg_name +
- "\" is a repeated message. Repeated message "
- "options must be initialized using an "
- "aggregate value.");
- } else {
- // Drill down into the submessage.
- intermediate_fields.push_back(field);
- descriptor = field->message_type();
- }
+ } else if (i < uninterpreted_option_->name_size() - 1) {
+ if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) {
+ return AddNameError("Option \"" + debug_msg_name +
+ "\" is an atomic type, not a message.");
+ } else if (field->is_repeated()) {
+ return AddNameError("Option field \"" + debug_msg_name +
+ "\" is a repeated message. Repeated message "
+ "options must be initialized using an "
+ "aggregate value.");
+ } else {
+ // Drill down into the submessage.
+ intermediate_fields.push_back(field);
+ descriptor = field->message_type();
}
}
}
@@ -6517,9 +6209,10 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
return false; // ExamineIfOptionIsSet() already added the error.
}
+
// First set the value on the UnknownFieldSet corresponding to the
// innermost message.
- std::unique_ptr<UnknownFieldSet> unknown_fields(new UnknownFieldSet());
+ google::protobuf::scoped_ptr<UnknownFieldSet> unknown_fields(new UnknownFieldSet());
if (!SetOptionValue(field, unknown_fields.get())) {
return false; // SetOptionValue() already added the error.
}
@@ -6529,7 +6222,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
for (std::vector<const FieldDescriptor*>::reverse_iterator iter =
intermediate_fields.rbegin();
iter != intermediate_fields.rend(); ++iter) {
- std::unique_ptr<UnknownFieldSet> parent_unknown_fields(
+ google::protobuf::scoped_ptr<UnknownFieldSet> parent_unknown_fields(
new UnknownFieldSet());
switch ((*iter)->type()) {
case FieldDescriptor::TYPE_MESSAGE: {
@@ -6562,110 +6255,9 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
options->GetReflection()->MutableUnknownFields(options)->MergeFrom(
*unknown_fields);
- // record the element path of the interpreted option
- if (field->is_repeated()) {
- int index = repeated_option_counts_[dest_path]++;
- dest_path.push_back(index);
- }
- interpreted_paths_[src_path] = dest_path;
-
return true;
}
-void DescriptorBuilder::OptionInterpreter::UpdateSourceCodeInfo(
- SourceCodeInfo* info) {
-
- if (interpreted_paths_.empty()) {
- // nothing to do!
- return;
- }
-
- // We find locations that match keys in interpreted_paths_ and
- // 1) replace the path with the corresponding value in interpreted_paths_
- // 2) remove any subsequent sub-locations (sub-location is one whose path
- // has the parent path as a prefix)
- //
- // To avoid quadratic behavior of removing interior rows as we go,
- // we keep a copy. But we don't actually copy anything until we've
- // found the first match (so if the source code info has no locations
- // that need to be changed, there is zero copy overhead).
-
- RepeatedPtrField<SourceCodeInfo_Location>* locs = info->mutable_location();
- RepeatedPtrField<SourceCodeInfo_Location> new_locs;
- bool copying = false;
-
- std::vector<int> pathv;
- bool matched = false;
-
- for (RepeatedPtrField<SourceCodeInfo_Location>::iterator loc = locs->begin();
- loc != locs->end(); loc++) {
-
- if (matched) {
- // see if this location is in the range to remove
- bool loc_matches = true;
- if (loc->path_size() < pathv.size()) {
- loc_matches = false;
- } else {
- for (int j = 0; j < pathv.size(); j++) {
- if (loc->path(j) != pathv[j]) {
- loc_matches = false;
- break;
- }
- }
- }
-
- if (loc_matches) {
- // don't copy this row since it is a sub-location that we're removing
- continue;
- }
-
- matched = false;
- }
-
- pathv.clear();
- for (int j = 0; j < loc->path_size(); j++) {
- pathv.push_back(loc->path(j));
- }
-
- std::map<std::vector<int>, std::vector<int>>::iterator entry =
- interpreted_paths_.find(pathv);
-
- if (entry == interpreted_paths_.end()) {
- // not a match
- if (copying) {
- new_locs.Add()->CopyFrom(*loc);
- }
- continue;
- }
-
- matched = true;
-
- if (!copying) {
- // initialize the copy we are building
- copying = true;
- new_locs.Reserve(locs->size());
- for (RepeatedPtrField<SourceCodeInfo_Location>::iterator it =
- locs->begin(); it != loc; it++) {
- new_locs.Add()->CopyFrom(*it);
- }
- }
-
- // add replacement and update its path
- SourceCodeInfo_Location* replacement = new_locs.Add();
- replacement->CopyFrom(*loc);
- replacement->clear_path();
- for (std::vector<int>::iterator rit = entry->second.begin();
- rit != entry->second.end(); rit++) {
- replacement->add_path(*rit);
- }
- }
-
- // if we made a changed copy, put it in place
- if (copying) {
- *locs = new_locs;
- }
-}
-
void DescriptorBuilder::OptionInterpreter::AddWithoutInterpreting(
const UninterpretedOption& uninterpreted_option, Message* options) {
const FieldDescriptor* field =
@@ -7018,7 +6610,7 @@ bool DescriptorBuilder::OptionInterpreter::SetAggregateOption(
}
const Descriptor* type = option_field->message_type();
- std::unique_ptr<Message> dynamic(dynamic_factory_.GetPrototype(type)->New());
+ google::protobuf::scoped_ptr<Message> dynamic(dynamic_factory_.GetPrototype(type)->New());
GOOGLE_CHECK(dynamic.get() != NULL)
<< "Could not create an instance of " << option_field->DebugString();
@@ -7243,6 +6835,13 @@ const EnumValueDescriptor* FieldDescriptor::default_value_enum() const {
return default_value_enum_;
}
+FieldDescriptor::Type FieldDescriptor::type() const {
+ if (type_once_) {
+ type_once_->Init(&FieldDescriptor::TypeOnceInit, this);
+ }
+ return type_;
+}
+
void FileDescriptor::InternalDependenciesOnceInit() const {
GOOGLE_CHECK(finished_building_ == true);
for (int i = 0; i < dependency_count(); i++) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.h b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.h
index 115d4ddc26..57128e6b0a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.h
@@ -55,6 +55,9 @@
#define GOOGLE_PROTOBUF_DESCRIPTOR_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <set>
#include <string>
#include <vector>
@@ -84,7 +87,6 @@ class DescriptorPool;
// Defined in descriptor.proto
class DescriptorProto;
-class DescriptorProto_ExtensionRange;
class FieldDescriptorProto;
class OneofDescriptorProto;
class EnumDescriptorProto;
@@ -338,9 +340,6 @@ class LIBPROTOBUF_EXPORT Descriptor {
struct ExtensionRange {
typedef ExtensionRangeOptions OptionsType;
- // See Descriptor::CopyTo().
- void CopyTo(DescriptorProto_ExtensionRange* proto) const;
-
int start; // inclusive
int end; // exclusive
@@ -742,9 +741,6 @@ class LIBPROTOBUF_EXPORT FieldDescriptor {
// to this descriptor from the file root.
void GetLocationPath(std::vector<int>* output) const;
- // Returns true if this is a map message type.
- bool is_map_message_type() const;
-
const string* name_;
const string* full_name_;
const string* lowercase_name_;
@@ -928,42 +924,12 @@ class LIBPROTOBUF_EXPORT EnumDescriptor {
// See Descriptor::DebugStringWithOptions().
string DebugStringWithOptions(const DebugStringOptions& options) const;
+
// Returns true if this is a placeholder for an unknown enum. This will
// only be the case if this descriptor comes from a DescriptorPool
// with AllowUnknownDependencies() set.
bool is_placeholder() const;
- // Reserved fields -------------------------------------------------
-
- // A range of reserved field numbers.
- struct ReservedRange {
- int start; // inclusive
- int end; // inclusive
- };
-
- // The number of reserved ranges in this message type.
- int reserved_range_count() const;
- // Gets an reserved range by index, where 0 <= index <
- // reserved_range_count(). These are returned in the order they were defined
- // in the .proto file.
- const EnumDescriptor::ReservedRange* reserved_range(int index) const;
-
- // Returns true if the number is in one of the reserved ranges.
- bool IsReservedNumber(int number) const;
-
- // Returns NULL if no reserved range contains the given number.
- const EnumDescriptor::ReservedRange*
- FindReservedRangeContainingNumber(int number) const;
-
- // The number of reserved field names in this message type.
- int reserved_name_count() const;
-
- // Gets a reserved name by index, where 0 <= index < reserved_name_count().
- const string& reserved_name(int index) const;
-
- // Returns true if the field name is reserved.
- bool IsReservedName(const string& name) const;
-
// Source Location ---------------------------------------------------
// Updates |*out_location| to the source location of the complete
@@ -1010,12 +976,6 @@ class LIBPROTOBUF_EXPORT EnumDescriptor {
int value_count_;
EnumValueDescriptor* values_;
-
- int reserved_range_count_;
- int reserved_name_count_;
- EnumDescriptor::ReservedRange* reserved_ranges_;
- const string** reserved_names_;
-
// IMPORTANT: If you add a new field, make sure to search for all instances
// of Allocate<EnumDescriptor>() and AllocateArray<EnumDescriptor>() in
// descriptor.cc and update them to initialize the field.
@@ -1803,7 +1763,7 @@ class LIBPROTOBUF_EXPORT DescriptorPool {
// This class contains a lot of hash maps with complicated types that
// we'd like to keep out of the header.
class Tables;
- std::unique_ptr<Tables> tables_;
+ google::protobuf::scoped_ptr<Tables> tables_;
bool enforce_dependencies_;
bool lazily_build_dependencies_;
@@ -1904,10 +1864,6 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, value,
const EnumValueDescriptor*)
PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions)
PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, is_placeholder, bool)
-PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_range_count, int)
-PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, reserved_range,
- const EnumDescriptor::ReservedRange*)
-PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_name_count, int)
PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name)
PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name)
@@ -1979,32 +1935,6 @@ inline const string& Descriptor::reserved_name(int index) const {
return *reserved_names_[index];
}
-inline bool EnumDescriptor::IsReservedNumber(int number) const {
- return FindReservedRangeContainingNumber(number) != NULL;
-}
-
-inline bool EnumDescriptor::IsReservedName(const string& name) const {
- for (int i = 0; i < reserved_name_count(); i++) {
- if (name == reserved_name(i)) {
- return true;
- }
- }
- return false;
-}
-
-// Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because reserved_names_ is actually
-// an array of pointers rather than the usual array of objects.
-inline const string& EnumDescriptor::reserved_name(int index) const {
- return *reserved_names_[index];
-}
-
-inline FieldDescriptor::Type FieldDescriptor::type() const {
- if (type_once_) {
- type_once_->Init(&FieldDescriptor::TypeOnceInit, this);
- }
- return type_;
-}
-
inline bool FieldDescriptor::is_required() const {
return label() == LABEL_REQUIRED;
}
@@ -2021,10 +1951,6 @@ inline bool FieldDescriptor::is_packable() const {
return is_repeated() && IsTypePackable(type());
}
-inline bool FieldDescriptor::is_map() const {
- return type() == TYPE_MESSAGE && is_map_message_type();
-}
-
// To save space, index() is computed by looking at the descriptor's position
// in the parent's array of children.
inline int FieldDescriptor::index() const {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.pb.cc
index 59b04abae1..69c0ab0d37 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.pb.cc
@@ -1,662 +1,229 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/descriptor.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/descriptor.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
-namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_DescriptorProto_ReservedRange;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_EnumDescriptorProto_EnumReservedRange;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_GeneratedCodeInfo_Annotation;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_SourceCodeInfo_Location;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_UninterpretedOption_NamePart;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_DescriptorProto_ExtensionRange;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_EnumOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_EnumValueDescriptorProto;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_EnumValueOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_ExtensionRangeOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_FieldDescriptorProto;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_FieldOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_FileOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_MessageOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_MethodDescriptorProto;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_MethodOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_OneofDescriptorProto;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_OneofOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_ServiceOptions;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_SourceCodeInfo;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_UninterpretedOption;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<2> scc_info_ServiceDescriptorProto;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<3> scc_info_EnumDescriptorProto;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<6> scc_info_DescriptorProto;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto ::google::protobuf::internal::SCCInfo<6> scc_info_FileDescriptorProto;
-} // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto
namespace google {
namespace protobuf {
class FileDescriptorSetDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorSet>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorSet>
+ _instance;
} _FileDescriptorSet_default_instance_;
class FileDescriptorProtoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorProto>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorProto>
+ _instance;
} _FileDescriptorProto_default_instance_;
class DescriptorProto_ExtensionRangeDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ExtensionRange>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ExtensionRange>
+ _instance;
} _DescriptorProto_ExtensionRange_default_instance_;
class DescriptorProto_ReservedRangeDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ReservedRange>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ReservedRange>
+ _instance;
} _DescriptorProto_ReservedRange_default_instance_;
class DescriptorProtoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto>
+ _instance;
} _DescriptorProto_default_instance_;
class ExtensionRangeOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<ExtensionRangeOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<ExtensionRangeOptions>
+ _instance;
} _ExtensionRangeOptions_default_instance_;
class FieldDescriptorProtoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<FieldDescriptorProto>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<FieldDescriptorProto>
+ _instance;
} _FieldDescriptorProto_default_instance_;
class OneofDescriptorProtoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<OneofDescriptorProto>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<OneofDescriptorProto>
+ _instance;
} _OneofDescriptorProto_default_instance_;
-class EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<EnumDescriptorProto_EnumReservedRange>
- _instance;
-} _EnumDescriptorProto_EnumReservedRange_default_instance_;
class EnumDescriptorProtoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<EnumDescriptorProto>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<EnumDescriptorProto>
+ _instance;
} _EnumDescriptorProto_default_instance_;
class EnumValueDescriptorProtoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<EnumValueDescriptorProto>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<EnumValueDescriptorProto>
+ _instance;
} _EnumValueDescriptorProto_default_instance_;
class ServiceDescriptorProtoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<ServiceDescriptorProto>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<ServiceDescriptorProto>
+ _instance;
} _ServiceDescriptorProto_default_instance_;
class MethodDescriptorProtoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<MethodDescriptorProto>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<MethodDescriptorProto>
+ _instance;
} _MethodDescriptorProto_default_instance_;
class FileOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<FileOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<FileOptions>
+ _instance;
} _FileOptions_default_instance_;
class MessageOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<MessageOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<MessageOptions>
+ _instance;
} _MessageOptions_default_instance_;
class FieldOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<FieldOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<FieldOptions>
+ _instance;
} _FieldOptions_default_instance_;
class OneofOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<OneofOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<OneofOptions>
+ _instance;
} _OneofOptions_default_instance_;
class EnumOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<EnumOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<EnumOptions>
+ _instance;
} _EnumOptions_default_instance_;
class EnumValueOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<EnumValueOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<EnumValueOptions>
+ _instance;
} _EnumValueOptions_default_instance_;
class ServiceOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<ServiceOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<ServiceOptions>
+ _instance;
} _ServiceOptions_default_instance_;
class MethodOptionsDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<MethodOptions>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<MethodOptions>
+ _instance;
} _MethodOptions_default_instance_;
class UninterpretedOption_NamePartDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption_NamePart>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption_NamePart>
+ _instance;
} _UninterpretedOption_NamePart_default_instance_;
class UninterpretedOptionDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption>
+ _instance;
} _UninterpretedOption_default_instance_;
class SourceCodeInfo_LocationDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo_Location>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo_Location>
+ _instance;
} _SourceCodeInfo_Location_default_instance_;
class SourceCodeInfoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo>
+ _instance;
} _SourceCodeInfo_default_instance_;
class GeneratedCodeInfo_AnnotationDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo_Annotation>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo_Annotation>
+ _instance;
} _GeneratedCodeInfo_Annotation_default_instance_;
class GeneratedCodeInfoDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo>
+ _instance;
} _GeneratedCodeInfo_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto {
-static void InitDefaultsFileDescriptorSet() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_FileDescriptorSet_default_instance_;
- new (ptr) ::google::protobuf::FileDescriptorSet();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::FileDescriptorSet::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_FileDescriptorSet =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsFileDescriptorSet}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileDescriptorProto.base,}};
-
-static void InitDefaultsFileDescriptorProto() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_FileDescriptorProto_default_instance_;
- new (ptr) ::google::protobuf::FileDescriptorProto();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::FileDescriptorProto::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<6> scc_info_FileDescriptorProto =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 6, InitDefaultsFileDescriptorProto}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ServiceDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileOptions.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_SourceCodeInfo.base,}};
-
-static void InitDefaultsDescriptorProto_ExtensionRange() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_DescriptorProto_ExtensionRange_default_instance_;
- new (ptr) ::google::protobuf::DescriptorProto_ExtensionRange();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::DescriptorProto_ExtensionRange::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_DescriptorProto_ExtensionRange =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsDescriptorProto_ExtensionRange}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ExtensionRangeOptions.base,}};
-
-static void InitDefaultsDescriptorProto_ReservedRange() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_DescriptorProto_ReservedRange_default_instance_;
- new (ptr) ::google::protobuf::DescriptorProto_ReservedRange();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::DescriptorProto_ReservedRange::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_DescriptorProto_ReservedRange =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsDescriptorProto_ReservedRange}, {}};
-
-static void InitDefaultsDescriptorProto() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_DescriptorProto_default_instance_;
- new (ptr) ::google::protobuf::DescriptorProto();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::DescriptorProto::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<6> scc_info_DescriptorProto =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 6, InitDefaultsDescriptorProto}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto_ExtensionRange.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_OneofDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MessageOptions.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto_ReservedRange.base,}};
-
-static void InitDefaultsExtensionRangeOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_ExtensionRangeOptions_default_instance_;
- new (ptr) ::google::protobuf::ExtensionRangeOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::ExtensionRangeOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_ExtensionRangeOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsExtensionRangeOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-
-static void InitDefaultsFieldDescriptorProto() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_FieldDescriptorProto_default_instance_;
- new (ptr) ::google::protobuf::FieldDescriptorProto();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::FieldDescriptorProto::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_FieldDescriptorProto =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsFieldDescriptorProto}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldOptions.base,}};
-
-static void InitDefaultsOneofDescriptorProto() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_OneofDescriptorProto_default_instance_;
- new (ptr) ::google::protobuf::OneofDescriptorProto();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::OneofDescriptorProto::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_OneofDescriptorProto =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsOneofDescriptorProto}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_OneofOptions.base,}};
-
-static void InitDefaultsEnumDescriptorProto_EnumReservedRange() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_EnumDescriptorProto_EnumReservedRange_default_instance_;
- new (ptr) ::google::protobuf::EnumDescriptorProto_EnumReservedRange();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::EnumDescriptorProto_EnumReservedRange::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_EnumDescriptorProto_EnumReservedRange =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsEnumDescriptorProto_EnumReservedRange}, {}};
-
-static void InitDefaultsEnumDescriptorProto() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_EnumDescriptorProto_default_instance_;
- new (ptr) ::google::protobuf::EnumDescriptorProto();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::EnumDescriptorProto::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<3> scc_info_EnumDescriptorProto =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsEnumDescriptorProto}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumValueDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumOptions.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto_EnumReservedRange.base,}};
-
-static void InitDefaultsEnumValueDescriptorProto() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_EnumValueDescriptorProto_default_instance_;
- new (ptr) ::google::protobuf::EnumValueDescriptorProto();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::EnumValueDescriptorProto::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_EnumValueDescriptorProto =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsEnumValueDescriptorProto}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumValueOptions.base,}};
-
-static void InitDefaultsServiceDescriptorProto() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_ServiceDescriptorProto_default_instance_;
- new (ptr) ::google::protobuf::ServiceDescriptorProto();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::ServiceDescriptorProto::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<2> scc_info_ServiceDescriptorProto =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsServiceDescriptorProto}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MethodDescriptorProto.base,
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ServiceOptions.base,}};
-
-static void InitDefaultsMethodDescriptorProto() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_MethodDescriptorProto_default_instance_;
- new (ptr) ::google::protobuf::MethodDescriptorProto();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::MethodDescriptorProto::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_MethodDescriptorProto =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsMethodDescriptorProto}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MethodOptions.base,}};
-
-static void InitDefaultsFileOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_FileOptions_default_instance_;
- new (ptr) ::google::protobuf::FileOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::FileOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_FileOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsFileOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-
-static void InitDefaultsMessageOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_MessageOptions_default_instance_;
- new (ptr) ::google::protobuf::MessageOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::MessageOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_MessageOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsMessageOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-
-static void InitDefaultsFieldOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_FieldOptions_default_instance_;
- new (ptr) ::google::protobuf::FieldOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::FieldOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_FieldOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsFieldOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-
-static void InitDefaultsOneofOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_OneofOptions_default_instance_;
- new (ptr) ::google::protobuf::OneofOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::OneofOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_OneofOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsOneofOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-
-static void InitDefaultsEnumOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_EnumOptions_default_instance_;
- new (ptr) ::google::protobuf::EnumOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::EnumOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_EnumOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsEnumOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-
-static void InitDefaultsEnumValueOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_EnumValueOptions_default_instance_;
- new (ptr) ::google::protobuf::EnumValueOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::EnumValueOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_EnumValueOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsEnumValueOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-
-static void InitDefaultsServiceOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_ServiceOptions_default_instance_;
- new (ptr) ::google::protobuf::ServiceOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::ServiceOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_ServiceOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsServiceOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-static void InitDefaultsMethodOptions() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_MethodOptions_default_instance_;
- new (ptr) ::google::protobuf::MethodOptions();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::MethodOptions::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_MethodOptions =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsMethodOptions}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base,}};
-
-static void InitDefaultsUninterpretedOption_NamePart() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_UninterpretedOption_NamePart_default_instance_;
- new (ptr) ::google::protobuf::UninterpretedOption_NamePart();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::UninterpretedOption_NamePart::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_UninterpretedOption_NamePart =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsUninterpretedOption_NamePart}, {}};
-
-static void InitDefaultsUninterpretedOption() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_UninterpretedOption_default_instance_;
- new (ptr) ::google::protobuf::UninterpretedOption();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::UninterpretedOption::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_UninterpretedOption =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsUninterpretedOption}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption_NamePart.base,}};
-
-static void InitDefaultsSourceCodeInfo_Location() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_SourceCodeInfo_Location_default_instance_;
- new (ptr) ::google::protobuf::SourceCodeInfo_Location();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::SourceCodeInfo_Location::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_SourceCodeInfo_Location =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsSourceCodeInfo_Location}, {}};
-
-static void InitDefaultsSourceCodeInfo() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_SourceCodeInfo_default_instance_;
- new (ptr) ::google::protobuf::SourceCodeInfo();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::SourceCodeInfo::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_SourceCodeInfo =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsSourceCodeInfo}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_SourceCodeInfo_Location.base,}};
-static void InitDefaultsGeneratedCodeInfo_Annotation() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
+namespace {
- {
- void* ptr = &::google::protobuf::_GeneratedCodeInfo_Annotation_default_instance_;
- new (ptr) ::google::protobuf::GeneratedCodeInfo_Annotation();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::GeneratedCodeInfo_Annotation::InitAsDefaultInstance();
-}
+::google::protobuf::Metadata file_level_metadata[26];
+const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[6];
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_GeneratedCodeInfo_Annotation =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsGeneratedCodeInfo_Annotation}, {}};
+} // namespace
-static void InitDefaultsGeneratedCodeInfo() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_GeneratedCodeInfo_default_instance_;
- new (ptr) ::google::protobuf::GeneratedCodeInfo();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::GeneratedCodeInfo::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_GeneratedCodeInfo =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsGeneratedCodeInfo}, {
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_GeneratedCodeInfo_Annotation.base,}};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_FileDescriptorSet.base);
- ::google::protobuf::internal::InitSCC(&scc_info_FileDescriptorProto.base);
- ::google::protobuf::internal::InitSCC(&scc_info_DescriptorProto_ExtensionRange.base);
- ::google::protobuf::internal::InitSCC(&scc_info_DescriptorProto_ReservedRange.base);
- ::google::protobuf::internal::InitSCC(&scc_info_DescriptorProto.base);
- ::google::protobuf::internal::InitSCC(&scc_info_ExtensionRangeOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_FieldDescriptorProto.base);
- ::google::protobuf::internal::InitSCC(&scc_info_OneofDescriptorProto.base);
- ::google::protobuf::internal::InitSCC(&scc_info_EnumDescriptorProto_EnumReservedRange.base);
- ::google::protobuf::internal::InitSCC(&scc_info_EnumDescriptorProto.base);
- ::google::protobuf::internal::InitSCC(&scc_info_EnumValueDescriptorProto.base);
- ::google::protobuf::internal::InitSCC(&scc_info_ServiceDescriptorProto.base);
- ::google::protobuf::internal::InitSCC(&scc_info_MethodDescriptorProto.base);
- ::google::protobuf::internal::InitSCC(&scc_info_FileOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_MessageOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_FieldOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_OneofOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_EnumOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_EnumValueOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_ServiceOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_MethodOptions.base);
- ::google::protobuf::internal::InitSCC(&scc_info_UninterpretedOption_NamePart.base);
- ::google::protobuf::internal::InitSCC(&scc_info_UninterpretedOption.base);
- ::google::protobuf::internal::InitSCC(&scc_info_SourceCodeInfo_Location.base);
- ::google::protobuf::internal::InitSCC(&scc_info_SourceCodeInfo.base);
- ::google::protobuf::internal::InitSCC(&scc_info_GeneratedCodeInfo_Annotation.base);
- ::google::protobuf::internal::InitSCC(&scc_info_GeneratedCodeInfo.base);
-}
-
-::google::protobuf::Metadata file_level_metadata[27];
-const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[6];
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorSet, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorSet, _internal_metadata_),
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorSet, file_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, file_),
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, package_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, dependency_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, public_dependency_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, weak_dependency_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, message_type_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, enum_type_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, service_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, extension_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, source_code_info_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, syntax_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, package_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, dependency_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, public_dependency_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, weak_dependency_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, message_type_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, enum_type_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, service_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, extension_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, source_code_info_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, syntax_),
0,
1,
~0u,
@@ -669,41 +236,41 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
3,
4,
2,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, start_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, end_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, start_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, end_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, options_),
1,
2,
0,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ReservedRange, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ReservedRange, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ReservedRange, start_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ReservedRange, end_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, start_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, end_),
0,
1,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, field_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, extension_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, nested_type_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, enum_type_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, extension_range_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, oneof_decl_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, reserved_range_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, reserved_name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, field_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, extension_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, nested_type_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, enum_type_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, extension_range_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, oneof_decl_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, reserved_range_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, reserved_name_),
0,
~0u,
~0u,
@@ -714,28 +281,28 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
1,
~0u,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ExtensionRangeOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ExtensionRangeOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ExtensionRangeOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRangeOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRangeOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRangeOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ExtensionRangeOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRangeOptions, uninterpreted_option_),
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, number_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, label_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, type_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, type_name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, extendee_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, default_value_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, oneof_index_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, json_name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, number_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, label_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, type_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, type_name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, extendee_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, default_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, oneof_index_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, json_name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, options_),
0,
6,
8,
@@ -746,152 +313,135 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
7,
4,
5,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofDescriptorProto, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofDescriptorProto, _internal_metadata_),
- ~0u, // no _extensions_
- ~0u, // no _oneof_case_
- ~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofDescriptorProto, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofDescriptorProto, options_),
- 0,
- 1,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto_EnumReservedRange, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto_EnumReservedRange, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto_EnumReservedRange, start_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto_EnumReservedRange, end_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, options_),
0,
1,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, value_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, reserved_range_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, reserved_name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, options_),
0,
~0u,
1,
- ~0u,
- ~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, number_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, number_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, options_),
0,
2,
1,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, method_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, method_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, options_),
0,
~0u,
1,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, input_type_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, output_type_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, client_streaming_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, server_streaming_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, input_type_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, output_type_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, client_streaming_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, server_streaming_),
0,
1,
2,
3,
4,
5,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_package_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_outer_classname_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_multiple_files_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_generate_equals_and_hash_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_string_check_utf8_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, optimize_for_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, go_package_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, cc_generic_services_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_generic_services_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, py_generic_services_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, php_generic_services_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, deprecated_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, cc_enable_arenas_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, objc_class_prefix_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, csharp_namespace_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, swift_prefix_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, php_class_prefix_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, php_namespace_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, php_metadata_namespace_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, ruby_package_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_package_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_outer_classname_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_multiple_files_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generate_equals_and_hash_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_string_check_utf8_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, optimize_for_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, go_package_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_generic_services_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generic_services_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, py_generic_services_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_generic_services_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, deprecated_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_enable_arenas_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, objc_class_prefix_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, csharp_namespace_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, swift_prefix_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_class_prefix_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_namespace_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, uninterpreted_option_),
0,
1,
+ 8,
+ 9,
10,
+ 17,
+ 2,
11,
12,
- 19,
- 2,
13,
14,
15,
16,
- 17,
- 18,
3,
4,
5,
6,
7,
- 8,
- 9,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, message_set_wire_format_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, no_standard_descriptor_accessor_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, deprecated_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, map_entry_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, message_set_wire_format_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, no_standard_descriptor_accessor_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, deprecated_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, map_entry_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, uninterpreted_option_),
0,
1,
2,
3,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, ctype_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, packed_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, jstype_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, lazy_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, deprecated_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, weak_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, ctype_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, packed_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, jstype_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, lazy_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, deprecated_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, weak_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, uninterpreted_option_),
0,
1,
5,
@@ -899,74 +449,74 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
3,
4,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, uninterpreted_option_),
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, allow_alias_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, deprecated_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, allow_alias_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, deprecated_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, uninterpreted_option_),
0,
1,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, deprecated_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, deprecated_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, uninterpreted_option_),
0,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, deprecated_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, deprecated_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, uninterpreted_option_),
0,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, _internal_metadata_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, _extensions_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, deprecated_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, idempotency_level_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, uninterpreted_option_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, deprecated_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, idempotency_level_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, uninterpreted_option_),
0,
1,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption_NamePart, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption_NamePart, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption_NamePart, name_part_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption_NamePart, is_extension_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, name_part_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, is_extension_),
0,
1,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, identifier_value_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, positive_int_value_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, negative_int_value_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, double_value_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, string_value_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, aggregate_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, identifier_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, positive_int_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, negative_int_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, double_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, string_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, aggregate_value_),
~0u,
0,
3,
@@ -974,130 +524,215 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
5,
1,
2,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, path_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, span_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, leading_comments_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, trailing_comments_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, leading_detached_comments_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, path_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, span_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, leading_comments_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, trailing_comments_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, leading_detached_comments_),
~0u,
~0u,
0,
1,
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo, location_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, location_),
~0u,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, path_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, source_file_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, begin_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, end_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, path_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, source_file_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, begin_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, end_),
~0u,
0,
1,
2,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo, annotation_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, annotation_),
~0u,
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, 6, sizeof(::google::protobuf::FileDescriptorSet)},
- { 7, 24, sizeof(::google::protobuf::FileDescriptorProto)},
- { 36, 44, sizeof(::google::protobuf::DescriptorProto_ExtensionRange)},
- { 47, 54, sizeof(::google::protobuf::DescriptorProto_ReservedRange)},
- { 56, 71, sizeof(::google::protobuf::DescriptorProto)},
- { 81, 87, sizeof(::google::protobuf::ExtensionRangeOptions)},
- { 88, 103, sizeof(::google::protobuf::FieldDescriptorProto)},
- { 113, 120, sizeof(::google::protobuf::OneofDescriptorProto)},
- { 122, 129, sizeof(::google::protobuf::EnumDescriptorProto_EnumReservedRange)},
- { 131, 141, sizeof(::google::protobuf::EnumDescriptorProto)},
- { 146, 154, sizeof(::google::protobuf::EnumValueDescriptorProto)},
- { 157, 165, sizeof(::google::protobuf::ServiceDescriptorProto)},
- { 168, 179, sizeof(::google::protobuf::MethodDescriptorProto)},
- { 185, 211, sizeof(::google::protobuf::FileOptions)},
- { 232, 242, sizeof(::google::protobuf::MessageOptions)},
- { 247, 259, sizeof(::google::protobuf::FieldOptions)},
- { 266, 272, sizeof(::google::protobuf::OneofOptions)},
- { 273, 281, sizeof(::google::protobuf::EnumOptions)},
- { 284, 291, sizeof(::google::protobuf::EnumValueOptions)},
- { 293, 300, sizeof(::google::protobuf::ServiceOptions)},
- { 302, 310, sizeof(::google::protobuf::MethodOptions)},
- { 313, 320, sizeof(::google::protobuf::UninterpretedOption_NamePart)},
- { 322, 334, sizeof(::google::protobuf::UninterpretedOption)},
- { 341, 351, sizeof(::google::protobuf::SourceCodeInfo_Location)},
- { 356, 362, sizeof(::google::protobuf::SourceCodeInfo)},
- { 363, 372, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)},
- { 376, 382, sizeof(::google::protobuf::GeneratedCodeInfo)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, 6, sizeof(FileDescriptorSet)},
+ { 7, 24, sizeof(FileDescriptorProto)},
+ { 36, 44, sizeof(DescriptorProto_ExtensionRange)},
+ { 47, 54, sizeof(DescriptorProto_ReservedRange)},
+ { 56, 71, sizeof(DescriptorProto)},
+ { 81, 87, sizeof(ExtensionRangeOptions)},
+ { 88, 103, sizeof(FieldDescriptorProto)},
+ { 113, 120, sizeof(OneofDescriptorProto)},
+ { 122, 130, sizeof(EnumDescriptorProto)},
+ { 133, 141, sizeof(EnumValueDescriptorProto)},
+ { 144, 152, sizeof(ServiceDescriptorProto)},
+ { 155, 166, sizeof(MethodDescriptorProto)},
+ { 172, 196, sizeof(FileOptions)},
+ { 215, 225, sizeof(MessageOptions)},
+ { 230, 242, sizeof(FieldOptions)},
+ { 249, 255, sizeof(OneofOptions)},
+ { 256, 264, sizeof(EnumOptions)},
+ { 267, 274, sizeof(EnumValueOptions)},
+ { 276, 283, sizeof(ServiceOptions)},
+ { 285, 293, sizeof(MethodOptions)},
+ { 296, 303, sizeof(UninterpretedOption_NamePart)},
+ { 305, 317, sizeof(UninterpretedOption)},
+ { 324, 334, sizeof(SourceCodeInfo_Location)},
+ { 339, 345, sizeof(SourceCodeInfo)},
+ { 346, 355, sizeof(GeneratedCodeInfo_Annotation)},
+ { 359, 365, sizeof(GeneratedCodeInfo)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FileDescriptorSet_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FileDescriptorProto_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_DescriptorProto_ExtensionRange_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_DescriptorProto_ReservedRange_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_DescriptorProto_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ExtensionRangeOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FieldDescriptorProto_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_OneofDescriptorProto_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumDescriptorProto_EnumReservedRange_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumDescriptorProto_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumValueDescriptorProto_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ServiceDescriptorProto_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_MethodDescriptorProto_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FileOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_MessageOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FieldOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_OneofOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumValueOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ServiceOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_MethodOptions_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_UninterpretedOption_NamePart_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_UninterpretedOption_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_SourceCodeInfo_Location_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_SourceCodeInfo_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_GeneratedCodeInfo_Annotation_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_GeneratedCodeInfo_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_FileDescriptorSet_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_FileDescriptorProto_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_ExtensionRange_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_ReservedRange_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_ExtensionRangeOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_FieldDescriptorProto_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_OneofDescriptorProto_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_EnumDescriptorProto_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_EnumValueDescriptorProto_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_ServiceDescriptorProto_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_MethodDescriptorProto_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_FileOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_MessageOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_FieldOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_OneofOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_EnumOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_EnumValueOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_ServiceOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_MethodOptions_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_UninterpretedOption_NamePart_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_UninterpretedOption_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_SourceCodeInfo_Location_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_SourceCodeInfo_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_GeneratedCodeInfo_Annotation_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_GeneratedCodeInfo_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/descriptor.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/descriptor.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, file_level_enum_descriptors, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
- ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 27);
+ ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 26);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _FileDescriptorSet_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_FileDescriptorSet_default_instance_);_FileDescriptorProto_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_FileDescriptorProto_default_instance_);_DescriptorProto_ExtensionRange_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_DescriptorProto_ExtensionRange_default_instance_);_DescriptorProto_ReservedRange_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_DescriptorProto_ReservedRange_default_instance_);_DescriptorProto_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_DescriptorProto_default_instance_);_ExtensionRangeOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_ExtensionRangeOptions_default_instance_);_FieldDescriptorProto_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_FieldDescriptorProto_default_instance_);_OneofDescriptorProto_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_OneofDescriptorProto_default_instance_);_EnumDescriptorProto_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_EnumDescriptorProto_default_instance_);_EnumValueDescriptorProto_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_EnumValueDescriptorProto_default_instance_);_ServiceDescriptorProto_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_ServiceDescriptorProto_default_instance_);_MethodDescriptorProto_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_MethodDescriptorProto_default_instance_);_FileOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_FileOptions_default_instance_);_MessageOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_MessageOptions_default_instance_);_FieldOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_FieldOptions_default_instance_);_OneofOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_OneofOptions_default_instance_);_EnumOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_EnumOptions_default_instance_);_EnumValueOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_EnumValueOptions_default_instance_);_ServiceOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_ServiceOptions_default_instance_);_MethodOptions_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_MethodOptions_default_instance_);_UninterpretedOption_NamePart_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_UninterpretedOption_NamePart_default_instance_);_UninterpretedOption_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_UninterpretedOption_default_instance_);_SourceCodeInfo_Location_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_SourceCodeInfo_Location_default_instance_);_SourceCodeInfo_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_SourceCodeInfo_default_instance_);_GeneratedCodeInfo_Annotation_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_GeneratedCodeInfo_Annotation_default_instance_);_GeneratedCodeInfo_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_GeneratedCodeInfo_default_instance_);_FileDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FileOptions*>(
+ ::google::protobuf::FileOptions::internal_default_instance());
+ _FileDescriptorProto_default_instance_._instance.get_mutable()->source_code_info_ = const_cast< ::google::protobuf::SourceCodeInfo*>(
+ ::google::protobuf::SourceCodeInfo::internal_default_instance());
+ _DescriptorProto_ExtensionRange_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ExtensionRangeOptions*>(
+ ::google::protobuf::ExtensionRangeOptions::internal_default_instance());
+ _DescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MessageOptions*>(
+ ::google::protobuf::MessageOptions::internal_default_instance());
+ _FieldDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FieldOptions*>(
+ ::google::protobuf::FieldOptions::internal_default_instance());
+ _OneofDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::OneofOptions*>(
+ ::google::protobuf::OneofOptions::internal_default_instance());
+ _EnumDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumOptions*>(
+ ::google::protobuf::EnumOptions::internal_default_instance());
+ _EnumValueDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumValueOptions*>(
+ ::google::protobuf::EnumValueOptions::internal_default_instance());
+ _ServiceDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ServiceOptions*>(
+ ::google::protobuf::ServiceOptions::internal_default_instance());
+ _MethodDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MethodOptions*>(
+ ::google::protobuf::MethodOptions::internal_default_instance());
+}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n google/protobuf/descriptor.proto\022\017goog"
"le.protobuf\"G\n\021FileDescriptorSet\0222\n\004file"
"\030\001 \003(\0132$.google.protobuf.FileDescriptorP"
@@ -1152,113 +787,109 @@ void AddDescriptorsImpl() {
"BEL_OPTIONAL\020\001\022\022\n\016LABEL_REQUIRED\020\002\022\022\n\016LA"
"BEL_REPEATED\020\003\"T\n\024OneofDescriptorProto\022\014"
"\n\004name\030\001 \001(\t\022.\n\007options\030\002 \001(\0132\035.google.p"
- "rotobuf.OneofOptions\"\244\002\n\023EnumDescriptorP"
+ "rotobuf.OneofOptions\"\214\001\n\023EnumDescriptorP"
"roto\022\014\n\004name\030\001 \001(\t\0228\n\005value\030\002 \003(\0132).goog"
"le.protobuf.EnumValueDescriptorProto\022-\n\007"
"options\030\003 \001(\0132\034.google.protobuf.EnumOpti"
- "ons\022N\n\016reserved_range\030\004 \003(\01326.google.pro"
- "tobuf.EnumDescriptorProto.EnumReservedRa"
- "nge\022\025\n\rreserved_name\030\005 \003(\t\032/\n\021EnumReserv"
- "edRange\022\r\n\005start\030\001 \001(\005\022\013\n\003end\030\002 \001(\005\"l\n\030E"
- "numValueDescriptorProto\022\014\n\004name\030\001 \001(\t\022\016\n"
- "\006number\030\002 \001(\005\0222\n\007options\030\003 \001(\0132!.google."
- "protobuf.EnumValueOptions\"\220\001\n\026ServiceDes"
- "criptorProto\022\014\n\004name\030\001 \001(\t\0226\n\006method\030\002 \003"
- "(\0132&.google.protobuf.MethodDescriptorPro"
- "to\0220\n\007options\030\003 \001(\0132\037.google.protobuf.Se"
- "rviceOptions\"\301\001\n\025MethodDescriptorProto\022\014"
- "\n\004name\030\001 \001(\t\022\022\n\ninput_type\030\002 \001(\t\022\023\n\013outp"
- "ut_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.google."
- "protobuf.MethodOptions\022\037\n\020client_streami"
- "ng\030\005 \001(\010:\005false\022\037\n\020server_streaming\030\006 \001("
- "\010:\005false\"\246\006\n\013FileOptions\022\024\n\014java_package"
- "\030\001 \001(\t\022\034\n\024java_outer_classname\030\010 \001(\t\022\"\n\023"
- "java_multiple_files\030\n \001(\010:\005false\022)\n\035java"
- "_generate_equals_and_hash\030\024 \001(\010B\002\030\001\022%\n\026j"
- "ava_string_check_utf8\030\033 \001(\010:\005false\022F\n\014op"
- "timize_for\030\t \001(\0162).google.protobuf.FileO"
- "ptions.OptimizeMode:\005SPEED\022\022\n\ngo_package"
- "\030\013 \001(\t\022\"\n\023cc_generic_services\030\020 \001(\010:\005fal"
- "se\022$\n\025java_generic_services\030\021 \001(\010:\005false"
- "\022\"\n\023py_generic_services\030\022 \001(\010:\005false\022#\n\024"
- "php_generic_services\030* \001(\010:\005false\022\031\n\ndep"
- "recated\030\027 \001(\010:\005false\022\037\n\020cc_enable_arenas"
- "\030\037 \001(\010:\005false\022\031\n\021objc_class_prefix\030$ \001(\t"
- "\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014swift_pref"
- "ix\030\' \001(\t\022\030\n\020php_class_prefix\030( \001(\t\022\025\n\rph"
- "p_namespace\030) \001(\t\022\036\n\026php_metadata_namesp"
- "ace\030, \001(\t\022\024\n\014ruby_package\030- \001(\t\022C\n\024unint"
- "erpreted_option\030\347\007 \003(\0132$.google.protobuf"
- ".UninterpretedOption\":\n\014OptimizeMode\022\t\n\005"
- "SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003"
- "*\t\010\350\007\020\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016MessageOptions\022&\n\027"
- "message_set_wire_format\030\001 \001(\010:\005false\022.\n\037"
- "no_standard_descriptor_accessor\030\002 \001(\010:\005f"
- "alse\022\031\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_e"
- "ntry\030\007 \001(\010\022C\n\024uninterpreted_option\030\347\007 \003("
- "\0132$.google.protobuf.UninterpretedOption*"
- "\t\010\350\007\020\200\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014FieldOptions\022"
- ":\n\005ctype\030\001 \001(\0162#.google.protobuf.FieldOp"
- "tions.CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006j"
- "stype\030\006 \001(\0162$.google.protobuf.FieldOptio"
- "ns.JSType:\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005fals"
- "e\022\031\n\ndeprecated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001"
- "(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003(\013"
- "2$.google.protobuf.UninterpretedOption\"/"
- "\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_"
- "PIECE\020\002\"5\n\006JSType\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_S"
- "TRING\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\""
- "^\n\014OneofOptions\022C\n\024uninterpreted_option\030"
- "\347\007 \003(\0132$.google.protobuf.UninterpretedOp"
- "tion*\t\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOptions\022\023\n\013allow"
- "_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022"
- "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google."
- "protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J"
- "\004\010\005\020\006\"}\n\020EnumValueOptions\022\031\n\ndeprecated\030"
- "\001 \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 "
- "\003(\0132$.google.protobuf.UninterpretedOptio"
- "n*\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprec"
- "ated\030! \001(\010:\005false\022C\n\024uninterpreted_optio"
- "n\030\347\007 \003(\0132$.google.protobuf.Uninterpreted"
- "Option*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\nd"
- "eprecated\030! \001(\010:\005false\022_\n\021idempotency_le"
- "vel\030\" \001(\0162/.google.protobuf.MethodOption"
- "s.IdempotencyLevel:\023IDEMPOTENCY_UNKNOWN\022"
- "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google."
- "protobuf.UninterpretedOption\"P\n\020Idempote"
- "ncyLevel\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_"
- "SIDE_EFFECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200"
- "\002\"\236\002\n\023UninterpretedOption\022;\n\004name\030\002 \003(\0132"
- "-.google.protobuf.UninterpretedOption.Na"
- "mePart\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022posi"
- "tive_int_value\030\004 \001(\004\022\032\n\022negative_int_val"
- "ue\030\005 \001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string"
- "_value\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n"
- "\010NamePart\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_exten"
- "sion\030\002 \002(\010\"\325\001\n\016SourceCodeInfo\022:\n\010locatio"
- "n\030\001 \003(\0132(.google.protobuf.SourceCodeInfo"
- ".Location\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001"
- "\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003"
- " \001(\t\022\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leadi"
- "ng_detached_comments\030\006 \003(\t\"\247\001\n\021Generated"
- "CodeInfo\022A\n\nannotation\030\001 \003(\0132-.google.pr"
- "otobuf.GeneratedCodeInfo.Annotation\032O\n\nA"
- "nnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_fi"
- "le\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005B\217\001\n"
- "\023com.google.protobufB\020DescriptorProtosH\001"
- "Z>github.com/golang/protobuf/protoc-gen-"
- "go/descriptor;descriptor\370\001\001\242\002\003GPB\252\002\032Goog"
- "le.Protobuf.Reflection"
+ "ons\"l\n\030EnumValueDescriptorProto\022\014\n\004name\030"
+ "\001 \001(\t\022\016\n\006number\030\002 \001(\005\0222\n\007options\030\003 \001(\0132!"
+ ".google.protobuf.EnumValueOptions\"\220\001\n\026Se"
+ "rviceDescriptorProto\022\014\n\004name\030\001 \001(\t\0226\n\006me"
+ "thod\030\002 \003(\0132&.google.protobuf.MethodDescr"
+ "iptorProto\0220\n\007options\030\003 \001(\0132\037.google.pro"
+ "tobuf.ServiceOptions\"\301\001\n\025MethodDescripto"
+ "rProto\022\014\n\004name\030\001 \001(\t\022\022\n\ninput_type\030\002 \001(\t"
+ "\022\023\n\013output_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036"
+ ".google.protobuf.MethodOptions\022\037\n\020client"
+ "_streaming\030\005 \001(\010:\005false\022\037\n\020server_stream"
+ "ing\030\006 \001(\010:\005false\"\360\005\n\013FileOptions\022\024\n\014java"
+ "_package\030\001 \001(\t\022\034\n\024java_outer_classname\030\010"
+ " \001(\t\022\"\n\023java_multiple_files\030\n \001(\010:\005false"
+ "\022)\n\035java_generate_equals_and_hash\030\024 \001(\010B"
+ "\002\030\001\022%\n\026java_string_check_utf8\030\033 \001(\010:\005fal"
+ "se\022F\n\014optimize_for\030\t \001(\0162).google.protob"
+ "uf.FileOptions.OptimizeMode:\005SPEED\022\022\n\ngo"
+ "_package\030\013 \001(\t\022\"\n\023cc_generic_services\030\020 "
+ "\001(\010:\005false\022$\n\025java_generic_services\030\021 \001("
+ "\010:\005false\022\"\n\023py_generic_services\030\022 \001(\010:\005f"
+ "alse\022#\n\024php_generic_services\030\023 \001(\010:\005fals"
+ "e\022\031\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enabl"
+ "e_arenas\030\037 \001(\010:\005false\022\031\n\021objc_class_pref"
+ "ix\030$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014sw"
+ "ift_prefix\030\' \001(\t\022\030\n\020php_class_prefix\030( \001"
+ "(\t\022\025\n\rphp_namespace\030) \001(\t\022C\n\024uninterpret"
+ "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint"
+ "erpretedOption\":\n\014OptimizeMode\022\t\n\005SPEED\020"
+ "\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007\020"
+ "\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016MessageOptions\022&\n\027messag"
+ "e_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_sta"
+ "ndard_descriptor_accessor\030\002 \001(\010:\005false\022\031"
+ "\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007"
+ " \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go"
+ "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200"
+ "\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014FieldOptions\022:\n\005cty"
+ "pe\030\001 \001(\0162#.google.protobuf.FieldOptions."
+ "CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030"
+ "\006 \001(\0162$.google.protobuf.FieldOptions.JST"
+ "ype:\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\nd"
+ "eprecated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005fa"
+ "lse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goo"
+ "gle.protobuf.UninterpretedOption\"/\n\005CTyp"
+ "e\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020"
+ "\002\"5\n\006JSType\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020"
+ "\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014One"
+ "ofOptions\022C\n\024uninterpreted_option\030\347\007 \003(\013"
+ "2$.google.protobuf.UninterpretedOption*\t"
+ "\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOptions\022\023\n\013allow_alias"
+ "\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022C\n\024uni"
+ "nterpreted_option\030\347\007 \003(\0132$.google.protob"
+ "uf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\""
+ "}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:"
+ "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$."
+ "google.protobuf.UninterpretedOption*\t\010\350\007"
+ "\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030!"
+ " \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003"
+ "(\0132$.google.protobuf.UninterpretedOption"
+ "*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndepreca"
+ "ted\030! \001(\010:\005false\022_\n\021idempotency_level\030\" "
+ "\001(\0162/.google.protobuf.MethodOptions.Idem"
+ "potencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024uni"
+ "nterpreted_option\030\347\007 \003(\0132$.google.protob"
+ "uf.UninterpretedOption\"P\n\020IdempotencyLev"
+ "el\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_E"
+ "FFECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023"
+ "UninterpretedOption\022;\n\004name\030\002 \003(\0132-.goog"
+ "le.protobuf.UninterpretedOption.NamePart"
+ "\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_i"
+ "nt_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001"
+ "(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_value"
+ "\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010NameP"
+ "art\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030\002"
+ " \002(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003("
+ "\0132(.google.protobuf.SourceCodeInfo.Locat"
+ "ion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004sp"
+ "an\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031"
+ "\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_det"
+ "ached_comments\030\006 \003(\t\"\247\001\n\021GeneratedCodeIn"
+ "fo\022A\n\nannotation\030\001 \003(\0132-.google.protobuf"
+ ".GeneratedCodeInfo.Annotation\032O\n\nAnnotat"
+ "ion\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001"
+ "(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005B\214\001\n\023com.g"
+ "oogle.protobufB\020DescriptorProtosH\001Z>gith"
+ "ub.com/golang/protobuf/protoc-gen-go/des"
+ "criptor;descriptor\242\002\003GPB\252\002\032Google.Protob"
+ "uf.Reflection"
};
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
- descriptor, 6022);
+ descriptor, 5813);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -1266,9 +897,9 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto
-namespace google {
-namespace protobuf {
+
const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Type_descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_enum_descriptors[0];
@@ -1440,38 +1071,30 @@ const int MethodOptions::IdempotencyLevel_ARRAYSIZE;
// ===================================================================
-void FileDescriptorSet::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FileDescriptorSet::kFileFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FileDescriptorSet::FileDescriptorSet()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileDescriptorSet.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FileDescriptorSet)
}
-FileDescriptorSet::FileDescriptorSet(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- file_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileDescriptorSet.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.FileDescriptorSet)
-}
FileDescriptorSet::FileDescriptorSet(const FileDescriptorSet& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
file_(from.file_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorSet)
}
void FileDescriptorSet::SharedCtor() {
+ _cached_size_ = 0;
}
FileDescriptorSet::~FileDescriptorSet() {
@@ -1480,28 +1103,30 @@ FileDescriptorSet::~FileDescriptorSet() {
}
void FileDescriptorSet::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void FileDescriptorSet::ArenaDtor(void* object) {
- FileDescriptorSet* _this = reinterpret_cast< FileDescriptorSet* >(object);
- (void)_this;
-}
-void FileDescriptorSet::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void FileDescriptorSet::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FileDescriptorSet::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FileDescriptorSet& FileDescriptorSet::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileDescriptorSet.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+FileDescriptorSet* FileDescriptorSet::New(::google::protobuf::Arena* arena) const {
+ FileDescriptorSet* n = new FileDescriptorSet;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void FileDescriptorSet::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet)
@@ -1520,7 +1145,7 @@ bool FileDescriptorSet::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FileDescriptorSet)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1528,7 +1153,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_file()));
} else {
goto handle_unusual;
@@ -1566,9 +1191,7 @@ 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()) {
@@ -1589,7 +1212,7 @@ void FileDescriptorSet::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->file_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
1, this->file(static_cast<int>(i)), deterministic, target);
}
@@ -1616,13 +1239,15 @@ size_t FileDescriptorSet::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->file(static_cast<int>(i)));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1672,70 +1297,58 @@ bool FileDescriptorSet::IsInitialized() const {
void FileDescriptorSet::Swap(FileDescriptorSet* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- FileDescriptorSet* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void FileDescriptorSet::UnsafeArenaSwap(FileDescriptorSet* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void FileDescriptorSet::InternalSwap(FileDescriptorSet* other) {
using std::swap;
- CastToBase(&file_)->InternalSwap(CastToBase(&other->file_));
+ file_.InternalSwap(&other->file_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata FileDescriptorSet::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// FileDescriptorSet
-// ===================================================================
-
-void FileDescriptorProto::InitAsDefaultInstance() {
- ::google::protobuf::_FileDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FileOptions*>(
- ::google::protobuf::FileOptions::internal_default_instance());
- ::google::protobuf::_FileDescriptorProto_default_instance_._instance.get_mutable()->source_code_info_ = const_cast< ::google::protobuf::SourceCodeInfo*>(
- ::google::protobuf::SourceCodeInfo::internal_default_instance());
+// repeated .google.protobuf.FileDescriptorProto file = 1;
+int FileDescriptorSet::file_size() const {
+ return file_.size();
}
-void FileDescriptorProto::unsafe_arena_set_allocated_options(
- ::google::protobuf::FileOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
- }
- options_ = options;
- if (options) {
- set_has_options();
- } else {
- clear_has_options();
- }
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.options)
+void FileDescriptorSet::clear_file() {
+ file_.Clear();
}
-void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info(
- ::google::protobuf::SourceCodeInfo* source_code_info) {
- if (GetArenaNoVirtual() == NULL) {
- delete source_code_info_;
- }
- source_code_info_ = source_code_info;
- if (source_code_info) {
- set_has_source_code_info();
- } else {
- clear_has_source_code_info();
- }
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.source_code_info)
+const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file)
+ return file_.Get(index);
+}
+::google::protobuf::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorSet.file)
+ return file_.Mutable(index);
}
+::google::protobuf::FileDescriptorProto* FileDescriptorSet::add_file() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file)
+ return file_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
+FileDescriptorSet::mutable_file() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorSet.file)
+ return &file_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
+FileDescriptorSet::file() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorSet.file)
+ return file_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FileDescriptorProto::kNameFieldNumber;
const int FileDescriptorProto::kPackageFieldNumber;
@@ -1753,30 +1366,17 @@ const int FileDescriptorProto::kSyntaxFieldNumber;
FileDescriptorProto::FileDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileDescriptorProto.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FileDescriptorProto)
}
-FileDescriptorProto::FileDescriptorProto(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- dependency_(arena),
- message_type_(arena),
- enum_type_(arena),
- service_(arena),
- extension_(arena),
- public_dependency_(arena),
- weak_dependency_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileDescriptorProto.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.FileDescriptorProto)
-}
FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
dependency_(from.dependency_),
message_type_(from.message_type_),
enum_type_(from.enum_type_),
@@ -1787,18 +1387,15 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
- GetArenaNoVirtual());
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_package()) {
- package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.package(),
- GetArenaNoVirtual());
+ package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.package_);
}
syntax_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_syntax()) {
- syntax_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.syntax(),
- GetArenaNoVirtual());
+ syntax_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.syntax_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::FileOptions(*from.options_);
@@ -1814,6 +1411,7 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
}
void FileDescriptorProto::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
syntax_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -1828,7 +1426,6 @@ FileDescriptorProto::~FileDescriptorProto() {
}
void FileDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
syntax_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -1836,25 +1433,28 @@ void FileDescriptorProto::SharedDtor() {
if (this != internal_default_instance()) delete source_code_info_;
}
-void FileDescriptorProto::ArenaDtor(void* object) {
- FileDescriptorProto* _this = reinterpret_cast< FileDescriptorProto* >(object);
- (void)_this;
-}
-void FileDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void FileDescriptorProto::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FileDescriptorProto::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FileDescriptorProto& FileDescriptorProto::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileDescriptorProto.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+FileDescriptorProto* FileDescriptorProto::New(::google::protobuf::Arena* arena) const {
+ FileDescriptorProto* n = new FileDescriptorProto;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void FileDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto)
@@ -1872,21 +1472,24 @@ void FileDescriptorProto::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 31u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
- package_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*package_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000004u) {
- syntax_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!syntax_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*syntax_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000008u) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::FileOptions::Clear();
}
if (cached_has_bits & 0x00000010u) {
GOOGLE_DCHECK(source_code_info_ != NULL);
- source_code_info_->Clear();
+ source_code_info_->::google::protobuf::SourceCodeInfo::Clear();
}
}
_has_bits_.Clear();
@@ -1899,7 +1502,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FileDescriptorProto)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1956,7 +1559,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_message_type()));
} else {
goto handle_unusual;
@@ -1968,7 +1571,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_enum_type()));
} else {
goto handle_unusual;
@@ -1980,7 +1583,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_service()));
} else {
goto handle_unusual;
@@ -1992,7 +1595,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_extension()));
} else {
goto handle_unusual;
@@ -2004,7 +1607,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u /* 66 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -2016,7 +1619,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
case 9: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(74u /* 74 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_source_code_info()));
} else {
goto handle_unusual;
@@ -2139,48 +1742,40 @@ 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->_internal_options(), output);
+ 8, *this->options_, output);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 9, this->_internal_source_code_info(), output);
+ 9, *this->source_code_info_, output);
}
// repeated int32 public_dependency = 10;
@@ -2256,7 +1851,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->message_type_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
4, this->message_type(static_cast<int>(i)), deterministic, target);
}
@@ -2264,7 +1859,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->enum_type_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
5, this->enum_type(static_cast<int>(i)), deterministic, target);
}
@@ -2272,7 +1867,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->service_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
6, this->service(static_cast<int>(i)), deterministic, target);
}
@@ -2280,22 +1875,22 @@ void FileDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->extension_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
7, this->extension(static_cast<int>(i)), deterministic, target);
}
// optional .google.protobuf.FileOptions options = 8;
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 8, this->_internal_options(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 8, *this->options_, deterministic, target);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (cached_has_bits & 0x00000010u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 9, this->_internal_source_code_info(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 9, *this->source_code_info_, deterministic, target);
}
// repeated int32 public_dependency = 10;
@@ -2348,7 +1943,7 @@ size_t FileDescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->message_type(static_cast<int>(i)));
}
}
@@ -2359,7 +1954,7 @@ size_t FileDescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->enum_type(static_cast<int>(i)));
}
}
@@ -2370,7 +1965,7 @@ size_t FileDescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->service(static_cast<int>(i)));
}
}
@@ -2381,7 +1976,7 @@ size_t FileDescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->extension(static_cast<int>(i)));
}
}
@@ -2429,20 +2024,22 @@ size_t FileDescriptorProto::ByteSizeLong() const {
// optional .google.protobuf.FileOptions options = 8;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (has_source_code_info()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *source_code_info_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->source_code_info_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -2478,13 +2075,16 @@ void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 31u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ set_has_name();
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
- set_package(from.package());
+ set_has_package();
+ package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.package_);
}
if (cached_has_bits & 0x00000004u) {
- set_syntax(from.syntax());
+ set_has_syntax();
+ syntax_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.syntax_);
}
if (cached_has_bits & 0x00000008u) {
mutable_options()->::google::protobuf::FileOptions::MergeFrom(from.options());
@@ -2522,69 +2122,569 @@ bool FileDescriptorProto::IsInitialized() const {
void FileDescriptorProto::Swap(FileDescriptorProto* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- FileDescriptorProto* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void FileDescriptorProto::UnsafeArenaSwap(FileDescriptorProto* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) {
using std::swap;
- 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_));
+ dependency_.InternalSwap(&other->dependency_);
+ message_type_.InternalSwap(&other->message_type_);
+ enum_type_.InternalSwap(&other->enum_type_);
+ service_.InternalSwap(&other->service_);
+ extension_.InternalSwap(&other->extension_);
public_dependency_.InternalSwap(&other->public_dependency_);
weak_dependency_.InternalSwap(&other->weak_dependency_);
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- package_.Swap(&other->package_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- syntax_.Swap(&other->syntax_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.Swap(&other->name_);
+ package_.Swap(&other->package_);
+ syntax_.Swap(&other->syntax_);
swap(options_, other->options_);
swap(source_code_info_, other->source_code_info_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata FileDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// FileDescriptorProto
-// ===================================================================
+// optional string name = 1;
+bool FileDescriptorProto::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void FileDescriptorProto::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void FileDescriptorProto::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void FileDescriptorProto::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
+}
+const ::std::string& FileDescriptorProto::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.name)
+ return name_.GetNoArena();
+}
+void FileDescriptorProto::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name)
+}
+#if LANG_CXX11
+void FileDescriptorProto::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.name)
+}
+#endif
+void FileDescriptorProto::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.name)
+}
+void FileDescriptorProto::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.name)
+}
+::std::string* FileDescriptorProto::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileDescriptorProto::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileDescriptorProto::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
+ } else {
+ clear_has_name();
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name)
+}
-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());
+// optional string package = 2;
+bool FileDescriptorProto::has_package() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void FileDescriptorProto::set_has_package() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void FileDescriptorProto::clear_has_package() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void FileDescriptorProto::clear_package() {
+ package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_package();
}
-void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options(
- ::google::protobuf::ExtensionRangeOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
+const ::std::string& FileDescriptorProto::package() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.package)
+ return package_.GetNoArena();
+}
+void FileDescriptorProto::set_package(const ::std::string& value) {
+ set_has_package();
+ package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package)
+}
+#if LANG_CXX11
+void FileDescriptorProto::set_package(::std::string&& value) {
+ set_has_package();
+ package_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.package)
+}
+#endif
+void FileDescriptorProto::set_package(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_package();
+ package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.package)
+}
+void FileDescriptorProto::set_package(const char* value, size_t size) {
+ set_has_package();
+ package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.package)
+}
+::std::string* FileDescriptorProto::mutable_package() {
+ set_has_package();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package)
+ return package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileDescriptorProto::release_package() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package)
+ clear_has_package();
+ return package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileDescriptorProto::set_allocated_package(::std::string* package) {
+ if (package != NULL) {
+ set_has_package();
+ } else {
+ clear_has_package();
}
+ package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), package);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package)
+}
+
+// repeated string dependency = 3;
+int FileDescriptorProto::dependency_size() const {
+ return dependency_.size();
+}
+void FileDescriptorProto::clear_dependency() {
+ dependency_.Clear();
+}
+const ::std::string& FileDescriptorProto::dependency(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.dependency)
+ return dependency_.Get(index);
+}
+::std::string* FileDescriptorProto::mutable_dependency(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.dependency)
+ return dependency_.Mutable(index);
+}
+void FileDescriptorProto::set_dependency(int index, const ::std::string& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency)
+ dependency_.Mutable(index)->assign(value);
+}
+#if LANG_CXX11
+void FileDescriptorProto::set_dependency(int index, ::std::string&& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency)
+ dependency_.Mutable(index)->assign(std::move(value));
+}
+#endif
+void FileDescriptorProto::set_dependency(int index, const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ dependency_.Mutable(index)->assign(value);
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.dependency)
+}
+void FileDescriptorProto::set_dependency(int index, const char* value, size_t size) {
+ dependency_.Mutable(index)->assign(
+ reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.dependency)
+}
+::std::string* FileDescriptorProto::add_dependency() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.dependency)
+ return dependency_.Add();
+}
+void FileDescriptorProto::add_dependency(const ::std::string& value) {
+ dependency_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency)
+}
+#if LANG_CXX11
+void FileDescriptorProto::add_dependency(::std::string&& value) {
+ dependency_.Add(std::move(value));
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency)
+}
+#endif
+void FileDescriptorProto::add_dependency(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ dependency_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add_char:google.protobuf.FileDescriptorProto.dependency)
+}
+void FileDescriptorProto::add_dependency(const char* value, size_t size) {
+ dependency_.Add()->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_add_pointer:google.protobuf.FileDescriptorProto.dependency)
+}
+const ::google::protobuf::RepeatedPtrField< ::std::string>&
+FileDescriptorProto::dependency() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.dependency)
+ return dependency_;
+}
+::google::protobuf::RepeatedPtrField< ::std::string>*
+FileDescriptorProto::mutable_dependency() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.dependency)
+ return &dependency_;
+}
+
+// repeated int32 public_dependency = 10;
+int FileDescriptorProto::public_dependency_size() const {
+ return public_dependency_.size();
+}
+void FileDescriptorProto::clear_public_dependency() {
+ public_dependency_.Clear();
+}
+::google::protobuf::int32 FileDescriptorProto::public_dependency(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.public_dependency)
+ return public_dependency_.Get(index);
+}
+void FileDescriptorProto::set_public_dependency(int index, ::google::protobuf::int32 value) {
+ public_dependency_.Set(index, value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.public_dependency)
+}
+void FileDescriptorProto::add_public_dependency(::google::protobuf::int32 value) {
+ public_dependency_.Add(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.public_dependency)
+}
+const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+FileDescriptorProto::public_dependency() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.public_dependency)
+ return public_dependency_;
+}
+::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+FileDescriptorProto::mutable_public_dependency() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.public_dependency)
+ return &public_dependency_;
+}
+
+// repeated int32 weak_dependency = 11;
+int FileDescriptorProto::weak_dependency_size() const {
+ return weak_dependency_.size();
+}
+void FileDescriptorProto::clear_weak_dependency() {
+ weak_dependency_.Clear();
+}
+::google::protobuf::int32 FileDescriptorProto::weak_dependency(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.weak_dependency)
+ return weak_dependency_.Get(index);
+}
+void FileDescriptorProto::set_weak_dependency(int index, ::google::protobuf::int32 value) {
+ weak_dependency_.Set(index, value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.weak_dependency)
+}
+void FileDescriptorProto::add_weak_dependency(::google::protobuf::int32 value) {
+ weak_dependency_.Add(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.weak_dependency)
+}
+const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+FileDescriptorProto::weak_dependency() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.weak_dependency)
+ return weak_dependency_;
+}
+::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+FileDescriptorProto::mutable_weak_dependency() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.weak_dependency)
+ return &weak_dependency_;
+}
+
+// repeated .google.protobuf.DescriptorProto message_type = 4;
+int FileDescriptorProto::message_type_size() const {
+ return message_type_.size();
+}
+void FileDescriptorProto::clear_message_type() {
+ message_type_.Clear();
+}
+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);
+}
+::google::protobuf::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.message_type)
+ return message_type_.Mutable(index);
+}
+::google::protobuf::DescriptorProto* FileDescriptorProto::add_message_type() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type)
+ return message_type_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >*
+FileDescriptorProto::mutable_message_type() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.message_type)
+ return &message_type_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >&
+FileDescriptorProto::message_type() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.message_type)
+ return message_type_;
+}
+
+// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
+int FileDescriptorProto::enum_type_size() const {
+ return enum_type_.size();
+}
+void FileDescriptorProto::clear_enum_type() {
+ enum_type_.Clear();
+}
+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);
+}
+::google::protobuf::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.enum_type)
+ return enum_type_.Mutable(index);
+}
+::google::protobuf::EnumDescriptorProto* FileDescriptorProto::add_enum_type() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type)
+ return enum_type_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >*
+FileDescriptorProto::mutable_enum_type() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.enum_type)
+ return &enum_type_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >&
+FileDescriptorProto::enum_type() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.enum_type)
+ return enum_type_;
+}
+
+// repeated .google.protobuf.ServiceDescriptorProto service = 6;
+int FileDescriptorProto::service_size() const {
+ return service_.size();
+}
+void FileDescriptorProto::clear_service() {
+ service_.Clear();
+}
+const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::service(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service)
+ return service_.Get(index);
+}
+::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.service)
+ return service_.Mutable(index);
+}
+::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::add_service() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service)
+ return service_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >*
+FileDescriptorProto::mutable_service() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.service)
+ return &service_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >&
+FileDescriptorProto::service() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.service)
+ return service_;
+}
+
+// repeated .google.protobuf.FieldDescriptorProto extension = 7;
+int FileDescriptorProto::extension_size() const {
+ return extension_.size();
+}
+void FileDescriptorProto::clear_extension() {
+ extension_.Clear();
+}
+const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::extension(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension)
+ return extension_.Get(index);
+}
+::google::protobuf::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.extension)
+ return extension_.Mutable(index);
+}
+::google::protobuf::FieldDescriptorProto* FileDescriptorProto::add_extension() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension)
+ return extension_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
+FileDescriptorProto::mutable_extension() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.extension)
+ return &extension_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
+FileDescriptorProto::extension() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.extension)
+ return extension_;
+}
+
+// optional .google.protobuf.FileOptions options = 8;
+bool FileDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+void FileDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000008u;
+}
+void FileDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+void FileDescriptorProto::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::FileOptions::Clear();
+ clear_has_options();
+}
+const ::google::protobuf::FileOptions& FileDescriptorProto::options() const {
+ const ::google::protobuf::FileOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::FileOptions*>(
+ &::google::protobuf::_FileOptions_default_instance_);
+}
+::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::FileOptions;
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options)
+ return options_;
+}
+::google::protobuf::FileOptions* FileDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::FileOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
+void FileDescriptorProto::set_allocated_options(::google::protobuf::FileOptions* options) {
+ delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.ExtensionRange.options)
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.options)
+}
+
+// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
+bool FileDescriptorProto::has_source_code_info() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+void FileDescriptorProto::set_has_source_code_info() {
+ _has_bits_[0] |= 0x00000010u;
+}
+void FileDescriptorProto::clear_has_source_code_info() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+void FileDescriptorProto::clear_source_code_info() {
+ if (source_code_info_ != NULL) source_code_info_->::google::protobuf::SourceCodeInfo::Clear();
+ clear_has_source_code_info();
+}
+const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_code_info() const {
+ const ::google::protobuf::SourceCodeInfo* p = source_code_info_;
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceCodeInfo*>(
+ &::google::protobuf::_SourceCodeInfo_default_instance_);
+}
+::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() {
+ set_has_source_code_info();
+ if (source_code_info_ == NULL) {
+ source_code_info_ = new ::google::protobuf::SourceCodeInfo;
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info)
+ return source_code_info_;
+}
+::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info)
+ clear_has_source_code_info();
+ ::google::protobuf::SourceCodeInfo* temp = source_code_info_;
+ source_code_info_ = NULL;
+ return temp;
+}
+void FileDescriptorProto::set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* source_code_info) {
+ delete source_code_info_;
+ source_code_info_ = source_code_info;
+ if (source_code_info) {
+ set_has_source_code_info();
+ } else {
+ clear_has_source_code_info();
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.source_code_info)
+}
+
+// optional string syntax = 12;
+bool FileDescriptorProto::has_syntax() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void FileDescriptorProto::set_has_syntax() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void FileDescriptorProto::clear_has_syntax() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void FileDescriptorProto::clear_syntax() {
+ syntax_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_syntax();
+}
+const ::std::string& FileDescriptorProto::syntax() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.syntax)
+ return syntax_.GetNoArena();
+}
+void FileDescriptorProto::set_syntax(const ::std::string& value) {
+ set_has_syntax();
+ syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax)
+}
+#if LANG_CXX11
+void FileDescriptorProto::set_syntax(::std::string&& value) {
+ set_has_syntax();
+ syntax_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.syntax)
+}
+#endif
+void FileDescriptorProto::set_syntax(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_syntax();
+ syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.syntax)
+}
+void FileDescriptorProto::set_syntax(const char* value, size_t size) {
+ set_has_syntax();
+ syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.syntax)
+}
+::std::string* FileDescriptorProto::mutable_syntax() {
+ set_has_syntax();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.syntax)
+ return syntax_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileDescriptorProto::release_syntax() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax)
+ clear_has_syntax();
+ return syntax_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileDescriptorProto::set_allocated_syntax(::std::string* syntax) {
+ if (syntax != NULL) {
+ set_has_syntax();
+ } else {
+ clear_has_syntax();
+ }
+ syntax_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), syntax);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int DescriptorProto_ExtensionRange::kStartFieldNumber;
const int DescriptorProto_ExtensionRange::kEndFieldNumber;
@@ -2593,23 +2693,17 @@ const int DescriptorProto_ExtensionRange::kOptionsFieldNumber;
DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto_ExtensionRange.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto.ExtensionRange)
}
-DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto_ExtensionRange.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto.ExtensionRange)
-}
DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorProto_ExtensionRange& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_options()) {
options_ = new ::google::protobuf::ExtensionRangeOptions(*from.options_);
@@ -2623,6 +2717,7 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP
}
void DescriptorProto_ExtensionRange::SharedCtor() {
+ _cached_size_ = 0;
::memset(&options_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&options_)) + sizeof(end_));
@@ -2634,29 +2729,31 @@ DescriptorProto_ExtensionRange::~DescriptorProto_ExtensionRange() {
}
void DescriptorProto_ExtensionRange::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
if (this != internal_default_instance()) delete options_;
}
-void DescriptorProto_ExtensionRange::ArenaDtor(void* object) {
- DescriptorProto_ExtensionRange* _this = reinterpret_cast< DescriptorProto_ExtensionRange* >(object);
- (void)_this;
-}
-void DescriptorProto_ExtensionRange::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void DescriptorProto_ExtensionRange::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DescriptorProto_ExtensionRange::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const DescriptorProto_ExtensionRange& DescriptorProto_ExtensionRange::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto_ExtensionRange.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::New(::google::protobuf::Arena* arena) const {
+ DescriptorProto_ExtensionRange* n = new DescriptorProto_ExtensionRange;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void DescriptorProto_ExtensionRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange)
@@ -2664,11 +2761,11 @@ void DescriptorProto_ExtensionRange::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- cached_has_bits = _has_bits_[0];
- if (cached_has_bits & 0x00000001u) {
+ if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::ExtensionRangeOptions::Clear();
}
+ cached_has_bits = _has_bits_[0];
if (cached_has_bits & 6u) {
::memset(&start_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&end_) -
@@ -2684,7 +2781,7 @@ bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto.ExtensionRange)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -2720,7 +2817,7 @@ bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -2768,7 +2865,7 @@ void DescriptorProto_ExtensionRange::SerializeWithCachedSizes(
// optional .google.protobuf.ExtensionRangeOptions options = 3;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, this->_internal_options(), output);
+ 3, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -2799,8 +2896,8 @@ void DescriptorProto_ExtensionRange::SerializeWithCachedSizes(
// optional .google.protobuf.ExtensionRangeOptions options = 3;
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 3, this->_internal_options(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 3, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -2824,8 +2921,8 @@ size_t DescriptorProto_ExtensionRange::ByteSizeLong() const {
// optional .google.protobuf.ExtensionRangeOptions options = 3;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
// optional int32 start = 1;
@@ -2844,7 +2941,9 @@ size_t DescriptorProto_ExtensionRange::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -2908,21 +3007,6 @@ bool DescriptorProto_ExtensionRange::IsInitialized() const {
void DescriptorProto_ExtensionRange::Swap(DescriptorProto_ExtensionRange* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- DescriptorProto_ExtensionRange* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void DescriptorProto_ExtensionRange::UnsafeArenaSwap(DescriptorProto_ExtensionRange* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange* other) {
@@ -2932,18 +3016,115 @@ void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange
swap(end_, other->end_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata DescriptorProto_ExtensionRange::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// DescriptorProto_ExtensionRange
-// ===================================================================
+// optional int32 start = 1;
+bool DescriptorProto_ExtensionRange::has_start() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void DescriptorProto_ExtensionRange::set_has_start() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void DescriptorProto_ExtensionRange::clear_has_start() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void DescriptorProto_ExtensionRange::clear_start() {
+ start_ = 0;
+ clear_has_start();
+}
+::google::protobuf::int32 DescriptorProto_ExtensionRange::start() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.start)
+ return start_;
+}
+void DescriptorProto_ExtensionRange::set_start(::google::protobuf::int32 value) {
+ set_has_start();
+ start_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.start)
+}
+
+// optional int32 end = 2;
+bool DescriptorProto_ExtensionRange::has_end() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void DescriptorProto_ExtensionRange::set_has_end() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void DescriptorProto_ExtensionRange::clear_has_end() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void DescriptorProto_ExtensionRange::clear_end() {
+ end_ = 0;
+ clear_has_end();
+}
+::google::protobuf::int32 DescriptorProto_ExtensionRange::end() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.end)
+ return end_;
+}
+void DescriptorProto_ExtensionRange::set_end(::google::protobuf::int32 value) {
+ set_has_end();
+ end_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.end)
+}
-void DescriptorProto_ReservedRange::InitAsDefaultInstance() {
+// optional .google.protobuf.ExtensionRangeOptions options = 3;
+bool DescriptorProto_ExtensionRange::has_options() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void DescriptorProto_ExtensionRange::set_has_options() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void DescriptorProto_ExtensionRange::clear_has_options() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void DescriptorProto_ExtensionRange::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::ExtensionRangeOptions::Clear();
+ clear_has_options();
+}
+const ::google::protobuf::ExtensionRangeOptions& DescriptorProto_ExtensionRange::options() const {
+ const ::google::protobuf::ExtensionRangeOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::ExtensionRangeOptions*>(
+ &::google::protobuf::_ExtensionRangeOptions_default_instance_);
+}
+::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::ExtensionRangeOptions;
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options)
+ return options_;
+}
+::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options)
+ clear_has_options();
+ ::google::protobuf::ExtensionRangeOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
+void DescriptorProto_ExtensionRange::set_allocated_options(::google::protobuf::ExtensionRangeOptions* options) {
+ delete options_;
+ options_ = options;
+ if (options) {
+ set_has_options();
+ } else {
+ clear_has_options();
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.ExtensionRange.options)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int DescriptorProto_ReservedRange::kStartFieldNumber;
const int DescriptorProto_ReservedRange::kEndFieldNumber;
@@ -2951,23 +3132,17 @@ const int DescriptorProto_ReservedRange::kEndFieldNumber;
DescriptorProto_ReservedRange::DescriptorProto_ReservedRange()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto_ReservedRange.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto.ReservedRange)
}
-DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto_ReservedRange.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto.ReservedRange)
-}
DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorProto_ReservedRange& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&start_, &from.start_,
static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@@ -2976,6 +3151,7 @@ DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorPro
}
void DescriptorProto_ReservedRange::SharedCtor() {
+ _cached_size_ = 0;
::memset(&start_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&start_)) + sizeof(end_));
@@ -2987,28 +3163,30 @@ DescriptorProto_ReservedRange::~DescriptorProto_ReservedRange() {
}
void DescriptorProto_ReservedRange::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void DescriptorProto_ReservedRange::ArenaDtor(void* object) {
- DescriptorProto_ReservedRange* _this = reinterpret_cast< DescriptorProto_ReservedRange* >(object);
- (void)_this;
-}
-void DescriptorProto_ReservedRange::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void DescriptorProto_ReservedRange::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DescriptorProto_ReservedRange::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const DescriptorProto_ReservedRange& DescriptorProto_ReservedRange::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto_ReservedRange.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+DescriptorProto_ReservedRange* DescriptorProto_ReservedRange::New(::google::protobuf::Arena* arena) const {
+ DescriptorProto_ReservedRange* n = new DescriptorProto_ReservedRange;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void DescriptorProto_ReservedRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange)
@@ -3032,7 +3210,7 @@ bool DescriptorProto_ReservedRange::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto.ReservedRange)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -3160,7 +3338,9 @@ size_t DescriptorProto_ReservedRange::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -3218,21 +3398,6 @@ bool DescriptorProto_ReservedRange::IsInitialized() const {
void DescriptorProto_ReservedRange::Swap(DescriptorProto_ReservedRange* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- DescriptorProto_ReservedRange* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void DescriptorProto_ReservedRange::UnsafeArenaSwap(DescriptorProto_ReservedRange* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange* other) {
@@ -3241,33 +3406,69 @@ void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange*
swap(end_, other->end_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata DescriptorProto_ReservedRange::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// DescriptorProto_ReservedRange
-// ===================================================================
+// optional int32 start = 1;
+bool DescriptorProto_ReservedRange::has_start() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void DescriptorProto_ReservedRange::set_has_start() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void DescriptorProto_ReservedRange::clear_has_start() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void DescriptorProto_ReservedRange::clear_start() {
+ start_ = 0;
+ clear_has_start();
+}
+::google::protobuf::int32 DescriptorProto_ReservedRange::start() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.start)
+ return start_;
+}
+void DescriptorProto_ReservedRange::set_start(::google::protobuf::int32 value) {
+ set_has_start();
+ start_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.start)
+}
-void DescriptorProto::InitAsDefaultInstance() {
- ::google::protobuf::_DescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MessageOptions*>(
- ::google::protobuf::MessageOptions::internal_default_instance());
+// optional int32 end = 2;
+bool DescriptorProto_ReservedRange::has_end() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
}
-void DescriptorProto::unsafe_arena_set_allocated_options(
- ::google::protobuf::MessageOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
- }
- options_ = options;
- if (options) {
- set_has_options();
- } else {
- clear_has_options();
- }
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.options)
+void DescriptorProto_ReservedRange::set_has_end() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void DescriptorProto_ReservedRange::clear_has_end() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void DescriptorProto_ReservedRange::clear_end() {
+ end_ = 0;
+ clear_has_end();
+}
+::google::protobuf::int32 DescriptorProto_ReservedRange::end() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.end)
+ return end_;
+}
+void DescriptorProto_ReservedRange::set_end(::google::protobuf::int32 value) {
+ set_has_end();
+ end_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.end)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int DescriptorProto::kNameFieldNumber;
const int DescriptorProto::kFieldFieldNumber;
@@ -3283,31 +3484,17 @@ const int DescriptorProto::kReservedNameFieldNumber;
DescriptorProto::DescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto)
}
-DescriptorProto::DescriptorProto(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- field_(arena),
- nested_type_(arena),
- enum_type_(arena),
- extension_range_(arena),
- extension_(arena),
- oneof_decl_(arena),
- reserved_range_(arena),
- reserved_name_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto)
-}
DescriptorProto::DescriptorProto(const DescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
field_(from.field_),
nested_type_(from.nested_type_),
enum_type_(from.enum_type_),
@@ -3319,8 +3506,7 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from)
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
- GetArenaNoVirtual());
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::MessageOptions(*from.options_);
@@ -3331,6 +3517,7 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from)
}
void DescriptorProto::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
}
@@ -3341,30 +3528,32 @@ DescriptorProto::~DescriptorProto() {
}
void DescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
-void DescriptorProto::ArenaDtor(void* object) {
- DescriptorProto* _this = reinterpret_cast< DescriptorProto* >(object);
- (void)_this;
-}
-void DescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void DescriptorProto::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DescriptorProto::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const DescriptorProto& DescriptorProto::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_DescriptorProto.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+DescriptorProto* DescriptorProto::New(::google::protobuf::Arena* arena) const {
+ DescriptorProto* n = new DescriptorProto;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void DescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto)
@@ -3383,11 +3572,12 @@ void DescriptorProto::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::MessageOptions::Clear();
}
}
_has_bits_.Clear();
@@ -3400,7 +3590,7 @@ bool DescriptorProto::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -3424,7 +3614,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_field()));
} else {
goto handle_unusual;
@@ -3436,7 +3626,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_nested_type()));
} else {
goto handle_unusual;
@@ -3448,7 +3638,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_enum_type()));
} else {
goto handle_unusual;
@@ -3460,7 +3650,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_extension_range()));
} else {
goto handle_unusual;
@@ -3472,7 +3662,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_extension()));
} else {
goto handle_unusual;
@@ -3484,7 +3674,7 @@ bool DescriptorProto::MergePartialFromCodedStream(
case 7: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 58 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -3496,7 +3686,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_oneof_decl()));
} else {
goto handle_unusual;
@@ -3508,7 +3698,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_reserved_range()));
} else {
goto handle_unusual;
@@ -3574,69 +3764,55 @@ 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->_internal_options(), output);
+ 7, *this->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;
@@ -3679,7 +3855,7 @@ void DescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->field_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
2, this->field(static_cast<int>(i)), deterministic, target);
}
@@ -3687,7 +3863,7 @@ void DescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->nested_type_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
3, this->nested_type(static_cast<int>(i)), deterministic, target);
}
@@ -3695,7 +3871,7 @@ void DescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->enum_type_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
4, this->enum_type(static_cast<int>(i)), deterministic, target);
}
@@ -3703,7 +3879,7 @@ void DescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->extension_range_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
5, this->extension_range(static_cast<int>(i)), deterministic, target);
}
@@ -3711,22 +3887,22 @@ void DescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->extension_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
6, this->extension(static_cast<int>(i)), deterministic, target);
}
// optional .google.protobuf.MessageOptions options = 7;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 7, this->_internal_options(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 7, *this->options_, deterministic, target);
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->oneof_decl_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
8, this->oneof_decl(static_cast<int>(i)), deterministic, target);
}
@@ -3734,7 +3910,7 @@ void DescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->reserved_range_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
9, this->reserved_range(static_cast<int>(i)), deterministic, target);
}
@@ -3771,7 +3947,7 @@ size_t DescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->field(static_cast<int>(i)));
}
}
@@ -3782,7 +3958,7 @@ size_t DescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->nested_type(static_cast<int>(i)));
}
}
@@ -3793,7 +3969,7 @@ size_t DescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->enum_type(static_cast<int>(i)));
}
}
@@ -3804,7 +3980,7 @@ size_t DescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->extension_range(static_cast<int>(i)));
}
}
@@ -3815,7 +3991,7 @@ size_t DescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->extension(static_cast<int>(i)));
}
}
@@ -3826,7 +4002,7 @@ size_t DescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->oneof_decl(static_cast<int>(i)));
}
}
@@ -3837,7 +4013,7 @@ size_t DescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->reserved_range(static_cast<int>(i)));
}
}
@@ -3861,13 +4037,15 @@ size_t DescriptorProto::ByteSizeLong() const {
// optional .google.protobuf.MessageOptions options = 7;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -3904,7 +4082,8 @@ void DescriptorProto::MergeFrom(const DescriptorProto& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ set_has_name();
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::MessageOptions::MergeFrom(from.options());
@@ -3941,75 +4120,442 @@ bool DescriptorProto::IsInitialized() const {
void DescriptorProto::Swap(DescriptorProto* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- DescriptorProto* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void DescriptorProto::UnsafeArenaSwap(DescriptorProto* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void DescriptorProto::InternalSwap(DescriptorProto* other) {
using std::swap;
- 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_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ 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_);
+ name_.Swap(&other->name_);
swap(options_, other->options_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata DescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// DescriptorProto
-// ===================================================================
+// optional string name = 1;
+bool DescriptorProto::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void DescriptorProto::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void DescriptorProto::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void DescriptorProto::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
+}
+const ::std::string& DescriptorProto::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.name)
+ return name_.GetNoArena();
+}
+void DescriptorProto::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name)
+}
+#if LANG_CXX11
+void DescriptorProto::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.DescriptorProto.name)
+}
+#endif
+void DescriptorProto::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.name)
+}
+void DescriptorProto::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.name)
+}
+::std::string* DescriptorProto::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* DescriptorProto::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void DescriptorProto::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
+ } else {
+ clear_has_name();
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name)
+}
+
+// repeated .google.protobuf.FieldDescriptorProto field = 2;
+int DescriptorProto::field_size() const {
+ return field_.size();
+}
+void DescriptorProto::clear_field() {
+ field_.Clear();
+}
+const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field)
+ return field_.Get(index);
+}
+::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_field(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.field)
+ return field_.Mutable(index);
+}
+::google::protobuf::FieldDescriptorProto* DescriptorProto::add_field() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field)
+ return field_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
+DescriptorProto::mutable_field() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.field)
+ return &field_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
+DescriptorProto::field() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.field)
+ return field_;
+}
+
+// repeated .google.protobuf.FieldDescriptorProto extension = 6;
+int DescriptorProto::extension_size() const {
+ return extension_.size();
+}
+void DescriptorProto::clear_extension() {
+ extension_.Clear();
+}
+const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extension(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension)
+ return extension_.Get(index);
+}
+::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension)
+ return extension_.Mutable(index);
+}
+::google::protobuf::FieldDescriptorProto* DescriptorProto::add_extension() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension)
+ return extension_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
+DescriptorProto::mutable_extension() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension)
+ return &extension_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
+DescriptorProto::extension() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension)
+ return extension_;
+}
+
+// repeated .google.protobuf.DescriptorProto nested_type = 3;
+int DescriptorProto::nested_type_size() const {
+ return nested_type_.size();
+}
+void DescriptorProto::clear_nested_type() {
+ nested_type_.Clear();
+}
+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);
+}
+::google::protobuf::DescriptorProto* DescriptorProto::mutable_nested_type(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.nested_type)
+ return nested_type_.Mutable(index);
+}
+::google::protobuf::DescriptorProto* DescriptorProto::add_nested_type() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type)
+ return nested_type_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >*
+DescriptorProto::mutable_nested_type() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.nested_type)
+ return &nested_type_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >&
+DescriptorProto::nested_type() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.nested_type)
+ return nested_type_;
+}
+
+// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
+int DescriptorProto::enum_type_size() const {
+ return enum_type_.size();
+}
+void DescriptorProto::clear_enum_type() {
+ enum_type_.Clear();
+}
+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);
+}
+::google::protobuf::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.enum_type)
+ return enum_type_.Mutable(index);
+}
+::google::protobuf::EnumDescriptorProto* DescriptorProto::add_enum_type() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type)
+ return enum_type_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >*
+DescriptorProto::mutable_enum_type() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.enum_type)
+ return &enum_type_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >&
+DescriptorProto::enum_type() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.enum_type)
+ return enum_type_;
+}
-void ExtensionRangeOptions::InitAsDefaultInstance() {
+// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
+int DescriptorProto::extension_range_size() const {
+ return extension_range_.size();
}
+void DescriptorProto::clear_extension_range() {
+ extension_range_.Clear();
+}
+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);
+}
+::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);
+}
+::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range)
+ return extension_range_.Add();
+}
+::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_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >&
+DescriptorProto::extension_range() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension_range)
+ return extension_range_;
+}
+
+// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
+int DescriptorProto::oneof_decl_size() const {
+ return oneof_decl_.size();
+}
+void DescriptorProto::clear_oneof_decl() {
+ oneof_decl_.Clear();
+}
+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);
+}
+::google::protobuf::OneofDescriptorProto* DescriptorProto::mutable_oneof_decl(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.oneof_decl)
+ return oneof_decl_.Mutable(index);
+}
+::google::protobuf::OneofDescriptorProto* DescriptorProto::add_oneof_decl() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl)
+ return oneof_decl_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >*
+DescriptorProto::mutable_oneof_decl() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.oneof_decl)
+ return &oneof_decl_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >&
+DescriptorProto::oneof_decl() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.oneof_decl)
+ return oneof_decl_;
+}
+
+// optional .google.protobuf.MessageOptions options = 7;
+bool DescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void DescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void DescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void DescriptorProto::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::MessageOptions::Clear();
+ clear_has_options();
+}
+const ::google::protobuf::MessageOptions& DescriptorProto::options() const {
+ const ::google::protobuf::MessageOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::MessageOptions*>(
+ &::google::protobuf::_MessageOptions_default_instance_);
+}
+::google::protobuf::MessageOptions* DescriptorProto::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::MessageOptions;
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options)
+ return options_;
+}
+::google::protobuf::MessageOptions* DescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::MessageOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
+void DescriptorProto::set_allocated_options(::google::protobuf::MessageOptions* options) {
+ delete options_;
+ options_ = options;
+ if (options) {
+ set_has_options();
+ } else {
+ clear_has_options();
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.options)
+}
+
+// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
+int DescriptorProto::reserved_range_size() const {
+ return reserved_range_.size();
+}
+void DescriptorProto::clear_reserved_range() {
+ reserved_range_.Clear();
+}
+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);
+}
+::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);
+}
+::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range)
+ return reserved_range_.Add();
+}
+::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_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >&
+DescriptorProto::reserved_range() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_range)
+ return reserved_range_;
+}
+
+// repeated string reserved_name = 10;
+int DescriptorProto::reserved_name_size() const {
+ return reserved_name_.size();
+}
+void DescriptorProto::clear_reserved_name() {
+ reserved_name_.Clear();
+}
+const ::std::string& DescriptorProto::reserved_name(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_name)
+ return reserved_name_.Get(index);
+}
+::std::string* DescriptorProto::mutable_reserved_name(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_name)
+ return reserved_name_.Mutable(index);
+}
+void DescriptorProto::set_reserved_name(int index, const ::std::string& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.reserved_name)
+ reserved_name_.Mutable(index)->assign(value);
+}
+#if LANG_CXX11
+void DescriptorProto::set_reserved_name(int index, ::std::string&& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.reserved_name)
+ reserved_name_.Mutable(index)->assign(std::move(value));
+}
+#endif
+void DescriptorProto::set_reserved_name(int index, const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ reserved_name_.Mutable(index)->assign(value);
+ // @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.reserved_name)
+}
+void DescriptorProto::set_reserved_name(int index, const char* value, size_t size) {
+ reserved_name_.Mutable(index)->assign(
+ reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.reserved_name)
+}
+::std::string* DescriptorProto::add_reserved_name() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.DescriptorProto.reserved_name)
+ return reserved_name_.Add();
+}
+void DescriptorProto::add_reserved_name(const ::std::string& value) {
+ reserved_name_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name)
+}
+#if LANG_CXX11
+void DescriptorProto::add_reserved_name(::std::string&& value) {
+ reserved_name_.Add(std::move(value));
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name)
+}
+#endif
+void DescriptorProto::add_reserved_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ reserved_name_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add_char:google.protobuf.DescriptorProto.reserved_name)
+}
+void DescriptorProto::add_reserved_name(const char* value, size_t size) {
+ reserved_name_.Add()->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_add_pointer:google.protobuf.DescriptorProto.reserved_name)
+}
+const ::google::protobuf::RepeatedPtrField< ::std::string>&
+DescriptorProto::reserved_name() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_name)
+ return reserved_name_;
+}
+::google::protobuf::RepeatedPtrField< ::std::string>*
+DescriptorProto::mutable_reserved_name() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_name)
+ return &reserved_name_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ExtensionRangeOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ExtensionRangeOptions::ExtensionRangeOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ExtensionRangeOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.ExtensionRangeOptions)
}
-ExtensionRangeOptions::ExtensionRangeOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ExtensionRangeOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.ExtensionRangeOptions)
-}
ExtensionRangeOptions::ExtensionRangeOptions(const ExtensionRangeOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
@@ -4017,6 +4563,7 @@ ExtensionRangeOptions::ExtensionRangeOptions(const ExtensionRangeOptions& from)
}
void ExtensionRangeOptions::SharedCtor() {
+ _cached_size_ = 0;
}
ExtensionRangeOptions::~ExtensionRangeOptions() {
@@ -4025,28 +4572,30 @@ ExtensionRangeOptions::~ExtensionRangeOptions() {
}
void ExtensionRangeOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void ExtensionRangeOptions::ArenaDtor(void* object) {
- ExtensionRangeOptions* _this = reinterpret_cast< ExtensionRangeOptions* >(object);
- (void)_this;
-}
-void ExtensionRangeOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void ExtensionRangeOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ExtensionRangeOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const ExtensionRangeOptions& ExtensionRangeOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ExtensionRangeOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+ExtensionRangeOptions* ExtensionRangeOptions::New(::google::protobuf::Arena* arena) const {
+ ExtensionRangeOptions* n = new ExtensionRangeOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void ExtensionRangeOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions)
@@ -4066,7 +4615,7 @@ bool ExtensionRangeOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.ExtensionRangeOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -4074,7 +4623,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -4118,9 +4667,7 @@ 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)
@@ -4145,7 +4692,7 @@ void ExtensionRangeOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -4178,13 +4725,15 @@ size_t ExtensionRangeOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -4239,56 +4788,59 @@ bool ExtensionRangeOptions::IsInitialized() const {
void ExtensionRangeOptions::Swap(ExtensionRangeOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- ExtensionRangeOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void ExtensionRangeOptions::UnsafeArenaSwap(ExtensionRangeOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void ExtensionRangeOptions::InternalSwap(ExtensionRangeOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata ExtensionRangeOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// ExtensionRangeOptions
-// ===================================================================
-
-void FieldDescriptorProto::InitAsDefaultInstance() {
- ::google::protobuf::_FieldDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FieldOptions*>(
- ::google::protobuf::FieldOptions::internal_default_instance());
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int ExtensionRangeOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
}
-void FieldDescriptorProto::unsafe_arena_set_allocated_options(
- ::google::protobuf::FieldOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
- }
- options_ = options;
- if (options) {
- set_has_options();
- } else {
- clear_has_options();
- }
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.options)
+void ExtensionRangeOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
}
+::google::protobuf::UninterpretedOption* ExtensionRangeOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* ExtensionRangeOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+ExtensionRangeOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
+ return &uninterpreted_option_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+ExtensionRangeOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
+ return uninterpreted_option_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FieldDescriptorProto::kNameFieldNumber;
const int FieldDescriptorProto::kNumberFieldNumber;
@@ -4304,48 +4856,37 @@ const int FieldDescriptorProto::kOptionsFieldNumber;
FieldDescriptorProto::FieldDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldDescriptorProto.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FieldDescriptorProto)
}
-FieldDescriptorProto::FieldDescriptorProto(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldDescriptorProto.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldDescriptorProto)
-}
FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
- GetArenaNoVirtual());
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
extendee_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_extendee()) {
- extendee_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.extendee(),
- GetArenaNoVirtual());
+ extendee_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.extendee_);
}
type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_type_name()) {
- type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_name(),
- GetArenaNoVirtual());
+ type_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_name_);
}
default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_default_value()) {
- default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.default_value(),
- GetArenaNoVirtual());
+ default_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.default_value_);
}
json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_json_name()) {
- json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name(),
- GetArenaNoVirtual());
+ json_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::FieldOptions(*from.options_);
@@ -4359,6 +4900,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
}
void FieldDescriptorProto::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
extendee_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -4377,7 +4919,6 @@ FieldDescriptorProto::~FieldDescriptorProto() {
}
void FieldDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
extendee_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
type_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -4386,25 +4927,28 @@ void FieldDescriptorProto::SharedDtor() {
if (this != internal_default_instance()) delete options_;
}
-void FieldDescriptorProto::ArenaDtor(void* object) {
- FieldDescriptorProto* _this = reinterpret_cast< FieldDescriptorProto* >(object);
- (void)_this;
-}
-void FieldDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void FieldDescriptorProto::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FieldDescriptorProto::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FieldDescriptorProto& FieldDescriptorProto::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldDescriptorProto.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+FieldDescriptorProto* FieldDescriptorProto::New(::google::protobuf::Arena* arena) const {
+ FieldDescriptorProto* n = new FieldDescriptorProto;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void FieldDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto)
@@ -4415,23 +4959,28 @@ void FieldDescriptorProto::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 63u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
- extendee_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!extendee_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*extendee_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000004u) {
- type_name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!type_name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*type_name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000008u) {
- default_value_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!default_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*default_value_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000010u) {
- json_name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!json_name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*json_name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000020u) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::FieldOptions::Clear();
}
}
if (cached_has_bits & 192u) {
@@ -4453,7 +5002,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FieldDescriptorProto)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -4579,7 +5128,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u /* 66 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -4704,7 +5253,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.FieldOptions options = 8;
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 8, this->_internal_options(), output);
+ 8, *this->options_, output);
}
// optional int32 oneof_index = 9;
@@ -4801,8 +5350,8 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.FieldOptions options = 8;
if (cached_has_bits & 0x00000020u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 8, this->_internal_options(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 8, *this->options_, deterministic, target);
}
// optional int32 oneof_index = 9;
@@ -4877,8 +5426,8 @@ size_t FieldDescriptorProto::ByteSizeLong() const {
// optional .google.protobuf.FieldOptions options = 8;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
// optional int32 number = 3;
@@ -4911,7 +5460,9 @@ size_t FieldDescriptorProto::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -4940,19 +5491,24 @@ void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 255u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ set_has_name();
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
- set_extendee(from.extendee());
+ set_has_extendee();
+ extendee_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.extendee_);
}
if (cached_has_bits & 0x00000004u) {
- set_type_name(from.type_name());
+ set_has_type_name();
+ type_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_name_);
}
if (cached_has_bits & 0x00000008u) {
- set_default_value(from.default_value());
+ set_has_default_value();
+ default_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.default_value_);
}
if (cached_has_bits & 0x00000010u) {
- set_json_name(from.json_name());
+ set_has_json_name();
+ json_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name_);
}
if (cached_has_bits & 0x00000020u) {
mutable_options()->::google::protobuf::FieldOptions::MergeFrom(from.options());
@@ -4999,35 +5555,15 @@ bool FieldDescriptorProto::IsInitialized() const {
void FieldDescriptorProto::Swap(FieldDescriptorProto* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- FieldDescriptorProto* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void FieldDescriptorProto::UnsafeArenaSwap(FieldDescriptorProto* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* other) {
using std::swap;
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- extendee_.Swap(&other->extendee_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- type_name_.Swap(&other->type_name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- default_value_.Swap(&other->default_value_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- json_name_.Swap(&other->json_name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.Swap(&other->name_);
+ extendee_.Swap(&other->extendee_);
+ type_name_.Swap(&other->type_name_);
+ default_value_.Swap(&other->default_value_);
+ json_name_.Swap(&other->json_name_);
swap(options_, other->options_);
swap(number_, other->number_);
swap(oneof_index_, other->oneof_index_);
@@ -5035,33 +5571,480 @@ void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* other) {
swap(type_, other->type_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata FieldDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// FieldDescriptorProto
-// ===================================================================
+// optional string name = 1;
+bool FieldDescriptorProto::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void FieldDescriptorProto::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void FieldDescriptorProto::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void FieldDescriptorProto::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
+}
+const ::std::string& FieldDescriptorProto::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.name)
+ return name_.GetNoArena();
+}
+void FieldDescriptorProto::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name)
+}
+#if LANG_CXX11
+void FieldDescriptorProto::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.name)
+}
+#endif
+void FieldDescriptorProto::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.name)
+}
+void FieldDescriptorProto::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.name)
+}
+::std::string* FieldDescriptorProto::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FieldDescriptorProto::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FieldDescriptorProto::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
+ } else {
+ clear_has_name();
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name)
+}
-void OneofDescriptorProto::InitAsDefaultInstance() {
- ::google::protobuf::_OneofDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::OneofOptions*>(
- ::google::protobuf::OneofOptions::internal_default_instance());
+// optional int32 number = 3;
+bool FieldDescriptorProto::has_number() const {
+ return (_has_bits_[0] & 0x00000040u) != 0;
+}
+void FieldDescriptorProto::set_has_number() {
+ _has_bits_[0] |= 0x00000040u;
+}
+void FieldDescriptorProto::clear_has_number() {
+ _has_bits_[0] &= ~0x00000040u;
+}
+void FieldDescriptorProto::clear_number() {
+ number_ = 0;
+ clear_has_number();
+}
+::google::protobuf::int32 FieldDescriptorProto::number() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.number)
+ return number_;
+}
+void FieldDescriptorProto::set_number(::google::protobuf::int32 value) {
+ set_has_number();
+ number_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.number)
+}
+
+// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
+bool FieldDescriptorProto::has_label() const {
+ return (_has_bits_[0] & 0x00000100u) != 0;
+}
+void FieldDescriptorProto::set_has_label() {
+ _has_bits_[0] |= 0x00000100u;
+}
+void FieldDescriptorProto::clear_has_label() {
+ _has_bits_[0] &= ~0x00000100u;
+}
+void FieldDescriptorProto::clear_label() {
+ label_ = 1;
+ clear_has_label();
+}
+::google::protobuf::FieldDescriptorProto_Label FieldDescriptorProto::label() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.label)
+ return static_cast< ::google::protobuf::FieldDescriptorProto_Label >(label_);
+}
+void FieldDescriptorProto::set_label(::google::protobuf::FieldDescriptorProto_Label value) {
+ assert(::google::protobuf::FieldDescriptorProto_Label_IsValid(value));
+ set_has_label();
+ label_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.label)
+}
+
+// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
+bool FieldDescriptorProto::has_type() const {
+ return (_has_bits_[0] & 0x00000200u) != 0;
+}
+void FieldDescriptorProto::set_has_type() {
+ _has_bits_[0] |= 0x00000200u;
+}
+void FieldDescriptorProto::clear_has_type() {
+ _has_bits_[0] &= ~0x00000200u;
}
-void OneofDescriptorProto::unsafe_arena_set_allocated_options(
- ::google::protobuf::OneofOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
+void FieldDescriptorProto::clear_type() {
+ type_ = 1;
+ clear_has_type();
+}
+::google::protobuf::FieldDescriptorProto_Type FieldDescriptorProto::type() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type)
+ return static_cast< ::google::protobuf::FieldDescriptorProto_Type >(type_);
+}
+void FieldDescriptorProto::set_type(::google::protobuf::FieldDescriptorProto_Type value) {
+ assert(::google::protobuf::FieldDescriptorProto_Type_IsValid(value));
+ set_has_type();
+ type_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type)
+}
+
+// optional string type_name = 6;
+bool FieldDescriptorProto::has_type_name() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void FieldDescriptorProto::set_has_type_name() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void FieldDescriptorProto::clear_has_type_name() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void FieldDescriptorProto::clear_type_name() {
+ type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_type_name();
+}
+const ::std::string& FieldDescriptorProto::type_name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type_name)
+ return type_name_.GetNoArena();
+}
+void FieldDescriptorProto::set_type_name(const ::std::string& value) {
+ set_has_type_name();
+ type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name)
+}
+#if LANG_CXX11
+void FieldDescriptorProto::set_type_name(::std::string&& value) {
+ set_has_type_name();
+ type_name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.type_name)
+}
+#endif
+void FieldDescriptorProto::set_type_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_type_name();
+ type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.type_name)
+}
+void FieldDescriptorProto::set_type_name(const char* value, size_t size) {
+ set_has_type_name();
+ type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.type_name)
+}
+::std::string* FieldDescriptorProto::mutable_type_name() {
+ set_has_type_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name)
+ return type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FieldDescriptorProto::release_type_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name)
+ clear_has_type_name();
+ return type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FieldDescriptorProto::set_allocated_type_name(::std::string* type_name) {
+ if (type_name != NULL) {
+ set_has_type_name();
+ } else {
+ clear_has_type_name();
+ }
+ type_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
+}
+
+// optional string extendee = 2;
+bool FieldDescriptorProto::has_extendee() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void FieldDescriptorProto::set_has_extendee() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void FieldDescriptorProto::clear_has_extendee() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void FieldDescriptorProto::clear_extendee() {
+ extendee_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_extendee();
+}
+const ::std::string& FieldDescriptorProto::extendee() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.extendee)
+ return extendee_.GetNoArena();
+}
+void FieldDescriptorProto::set_extendee(const ::std::string& value) {
+ set_has_extendee();
+ extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee)
+}
+#if LANG_CXX11
+void FieldDescriptorProto::set_extendee(::std::string&& value) {
+ set_has_extendee();
+ extendee_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.extendee)
+}
+#endif
+void FieldDescriptorProto::set_extendee(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_extendee();
+ extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.extendee)
+}
+void FieldDescriptorProto::set_extendee(const char* value, size_t size) {
+ set_has_extendee();
+ extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.extendee)
+}
+::std::string* FieldDescriptorProto::mutable_extendee() {
+ set_has_extendee();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee)
+ return extendee_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FieldDescriptorProto::release_extendee() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee)
+ clear_has_extendee();
+ return extendee_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee) {
+ if (extendee != NULL) {
+ set_has_extendee();
+ } else {
+ clear_has_extendee();
+ }
+ extendee_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), extendee);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
+}
+
+// optional string default_value = 7;
+bool FieldDescriptorProto::has_default_value() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+void FieldDescriptorProto::set_has_default_value() {
+ _has_bits_[0] |= 0x00000008u;
+}
+void FieldDescriptorProto::clear_has_default_value() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+void FieldDescriptorProto::clear_default_value() {
+ default_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_default_value();
+}
+const ::std::string& FieldDescriptorProto::default_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.default_value)
+ return default_value_.GetNoArena();
+}
+void FieldDescriptorProto::set_default_value(const ::std::string& value) {
+ set_has_default_value();
+ default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value)
+}
+#if LANG_CXX11
+void FieldDescriptorProto::set_default_value(::std::string&& value) {
+ set_has_default_value();
+ default_value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.default_value)
+}
+#endif
+void FieldDescriptorProto::set_default_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_default_value();
+ default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.default_value)
+}
+void FieldDescriptorProto::set_default_value(const char* value, size_t size) {
+ set_has_default_value();
+ default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.default_value)
+}
+::std::string* FieldDescriptorProto::mutable_default_value() {
+ set_has_default_value();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value)
+ return default_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FieldDescriptorProto::release_default_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value)
+ clear_has_default_value();
+ return default_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FieldDescriptorProto::set_allocated_default_value(::std::string* default_value) {
+ if (default_value != NULL) {
+ set_has_default_value();
+ } else {
+ clear_has_default_value();
+ }
+ default_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
+}
+
+// optional int32 oneof_index = 9;
+bool FieldDescriptorProto::has_oneof_index() const {
+ return (_has_bits_[0] & 0x00000080u) != 0;
+}
+void FieldDescriptorProto::set_has_oneof_index() {
+ _has_bits_[0] |= 0x00000080u;
+}
+void FieldDescriptorProto::clear_has_oneof_index() {
+ _has_bits_[0] &= ~0x00000080u;
+}
+void FieldDescriptorProto::clear_oneof_index() {
+ oneof_index_ = 0;
+ clear_has_oneof_index();
+}
+::google::protobuf::int32 FieldDescriptorProto::oneof_index() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.oneof_index)
+ return oneof_index_;
+}
+void FieldDescriptorProto::set_oneof_index(::google::protobuf::int32 value) {
+ set_has_oneof_index();
+ oneof_index_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index)
+}
+
+// optional string json_name = 10;
+bool FieldDescriptorProto::has_json_name() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+void FieldDescriptorProto::set_has_json_name() {
+ _has_bits_[0] |= 0x00000010u;
+}
+void FieldDescriptorProto::clear_has_json_name() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+void FieldDescriptorProto::clear_json_name() {
+ json_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_json_name();
+}
+const ::std::string& FieldDescriptorProto::json_name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name)
+ return json_name_.GetNoArena();
+}
+void FieldDescriptorProto::set_json_name(const ::std::string& value) {
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
+}
+#if LANG_CXX11
+void FieldDescriptorProto::set_json_name(::std::string&& value) {
+ set_has_json_name();
+ json_name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.json_name)
+}
+#endif
+void FieldDescriptorProto::set_json_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.json_name)
+}
+void FieldDescriptorProto::set_json_name(const char* value, size_t size) {
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.json_name)
+}
+::std::string* FieldDescriptorProto::mutable_json_name() {
+ set_has_json_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name)
+ return json_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FieldDescriptorProto::release_json_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name)
+ clear_has_json_name();
+ return json_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FieldDescriptorProto::set_allocated_json_name(::std::string* json_name) {
+ if (json_name != NULL) {
+ set_has_json_name();
+ } else {
+ clear_has_json_name();
+ }
+ json_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
+}
+
+// optional .google.protobuf.FieldOptions options = 8;
+bool FieldDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000020u) != 0;
+}
+void FieldDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000020u;
+}
+void FieldDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000020u;
+}
+void FieldDescriptorProto::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear();
+ clear_has_options();
+}
+const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() const {
+ const ::google::protobuf::FieldOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::FieldOptions*>(
+ &::google::protobuf::_FieldOptions_default_instance_);
+}
+::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::FieldOptions;
}
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options)
+ return options_;
+}
+::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::FieldOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
+void FieldDescriptorProto::set_allocated_options(::google::protobuf::FieldOptions* options) {
+ delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.OneofDescriptorProto.options)
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.options)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int OneofDescriptorProto::kNameFieldNumber;
const int OneofDescriptorProto::kOptionsFieldNumber;
@@ -5069,28 +6052,21 @@ const int OneofDescriptorProto::kOptionsFieldNumber;
OneofDescriptorProto::OneofDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_OneofDescriptorProto.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.OneofDescriptorProto)
}
-OneofDescriptorProto::OneofDescriptorProto(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_OneofDescriptorProto.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.OneofDescriptorProto)
-}
OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
- GetArenaNoVirtual());
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::OneofOptions(*from.options_);
@@ -5101,6 +6077,7 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from)
}
void OneofDescriptorProto::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
}
@@ -5111,30 +6088,32 @@ OneofDescriptorProto::~OneofDescriptorProto() {
}
void OneofDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
-void OneofDescriptorProto::ArenaDtor(void* object) {
- OneofDescriptorProto* _this = reinterpret_cast< OneofDescriptorProto* >(object);
- (void)_this;
-}
-void OneofDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void OneofDescriptorProto::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* OneofDescriptorProto::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const OneofDescriptorProto& OneofDescriptorProto::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_OneofDescriptorProto.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+OneofDescriptorProto* OneofDescriptorProto::New(::google::protobuf::Arena* arena) const {
+ OneofDescriptorProto* n = new OneofDescriptorProto;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void OneofDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto)
@@ -5145,11 +6124,12 @@ void OneofDescriptorProto::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::OneofOptions::Clear();
}
}
_has_bits_.Clear();
@@ -5162,7 +6142,7 @@ bool OneofDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.OneofDescriptorProto)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -5186,7 +6166,7 @@ bool OneofDescriptorProto::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -5234,7 +6214,7 @@ void OneofDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.OneofOptions options = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->_internal_options(), output);
+ 2, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -5266,8 +6246,8 @@ void OneofDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.OneofOptions options = 2;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 2, this->_internal_options(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 2, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -5298,13 +6278,15 @@ size_t OneofDescriptorProto::ByteSizeLong() const {
// optional .google.protobuf.OneofOptions options = 2;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -5333,7 +6315,8 @@ void OneofDescriptorProto::MergeFrom(const OneofDescriptorProto& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ set_has_name();
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::OneofOptions::MergeFrom(from.options());
@@ -5364,404 +6347,162 @@ bool OneofDescriptorProto::IsInitialized() const {
void OneofDescriptorProto::Swap(OneofDescriptorProto* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- OneofDescriptorProto* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void OneofDescriptorProto::UnsafeArenaSwap(OneofDescriptorProto* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* other) {
using std::swap;
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.Swap(&other->name_);
swap(options_, other->options_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata OneofDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
-}
-
-
-// ===================================================================
-
-void EnumDescriptorProto_EnumReservedRange::InitAsDefaultInstance() {
-}
-#if !defined(_MSC_VER) || _MSC_VER >= 1900
-const int EnumDescriptorProto_EnumReservedRange::kStartFieldNumber;
-const int EnumDescriptorProto_EnumReservedRange::kEndFieldNumber;
-#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
-
-EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange()
- : ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto_EnumReservedRange.base);
- SharedCtor();
- // @@protoc_insertion_point(constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange)
-}
-EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto_EnumReservedRange.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange)
-}
-EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(const EnumDescriptorProto_EnumReservedRange& from)
- : ::google::protobuf::Message(),
- _internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
- _internal_metadata_.MergeFrom(from._internal_metadata_);
- ::memcpy(&start_, &from.start_,
- static_cast<size_t>(reinterpret_cast<char*>(&end_) -
- reinterpret_cast<char*>(&start_)) + sizeof(end_));
- // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange)
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
-void EnumDescriptorProto_EnumReservedRange::SharedCtor() {
- ::memset(&start_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&end_) -
- reinterpret_cast<char*>(&start_)) + sizeof(end_));
-}
-
-EnumDescriptorProto_EnumReservedRange::~EnumDescriptorProto_EnumReservedRange() {
- // @@protoc_insertion_point(destructor:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- SharedDtor();
-}
-
-void EnumDescriptorProto_EnumReservedRange::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
-}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// OneofDescriptorProto
-void EnumDescriptorProto_EnumReservedRange::ArenaDtor(void* object) {
- EnumDescriptorProto_EnumReservedRange* _this = reinterpret_cast< EnumDescriptorProto_EnumReservedRange* >(object);
- (void)_this;
+// optional string name = 1;
+bool OneofDescriptorProto::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
}
-void EnumDescriptorProto_EnumReservedRange::RegisterArenaDtor(::google::protobuf::Arena* arena) {
+void OneofDescriptorProto::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
}
-void EnumDescriptorProto_EnumReservedRange::SetCachedSize(int size) const {
- _cached_size_.Set(size);
-}
-const ::google::protobuf::Descriptor* EnumDescriptorProto_EnumReservedRange::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
-}
-
-const EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto_EnumReservedRange::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto_EnumReservedRange.base);
- return *internal_default_instance();
-}
-
-
-void EnumDescriptorProto_EnumReservedRange::Clear() {
-// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- ::google::protobuf::uint32 cached_has_bits = 0;
- // Prevent compiler warnings about cached_has_bits being unused
- (void) cached_has_bits;
-
- cached_has_bits = _has_bits_[0];
- if (cached_has_bits & 3u) {
- ::memset(&start_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&end_) -
- reinterpret_cast<char*>(&start_)) + sizeof(end_));
- }
- _has_bits_.Clear();
- _internal_metadata_.Clear();
+void OneofDescriptorProto::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
}
-
-bool EnumDescriptorProto_EnumReservedRange::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
- ::google::protobuf::uint32 tag;
- // @@protoc_insertion_point(parse_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
- tag = p.first;
- if (!p.second) goto handle_unusual;
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // optional int32 start = 1;
- case 1: {
- if (static_cast< ::google::protobuf::uint8>(tag) ==
- static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
- set_has_start();
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &start_)));
- } else {
- goto handle_unusual;
- }
- break;
- }
-
- // optional int32 end = 2;
- case 2: {
- if (static_cast< ::google::protobuf::uint8>(tag) ==
- static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
- set_has_end();
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &end_)));
- } else {
- goto handle_unusual;
- }
- break;
- }
-
- default: {
- handle_unusual:
- if (tag == 0) {
- goto success;
- }
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, _internal_metadata_.mutable_unknown_fields()));
- break;
- }
- }
- }
-success:
- // @@protoc_insertion_point(parse_success:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- return true;
-failure:
- // @@protoc_insertion_point(parse_failure:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- return false;
-#undef DO_
+void OneofDescriptorProto::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
}
-
-void EnumDescriptorProto_EnumReservedRange::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // @@protoc_insertion_point(serialize_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- ::google::protobuf::uint32 cached_has_bits = 0;
- (void) cached_has_bits;
-
- cached_has_bits = _has_bits_[0];
- // optional int32 start = 1;
- if (cached_has_bits & 0x00000001u) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->start(), output);
- }
-
- // optional int32 end = 2;
- if (cached_has_bits & 0x00000002u) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->end(), output);
- }
-
- if (_internal_metadata_.have_unknown_fields()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
- _internal_metadata_.unknown_fields(), output);
- }
- // @@protoc_insertion_point(serialize_end:google.protobuf.EnumDescriptorProto.EnumReservedRange)
+const ::std::string& OneofDescriptorProto::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.name)
+ return name_.GetNoArena();
}
-
-::google::protobuf::uint8* EnumDescriptorProto_EnumReservedRange::InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const {
- (void)deterministic; // Unused
- // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- ::google::protobuf::uint32 cached_has_bits = 0;
- (void) cached_has_bits;
-
- cached_has_bits = _has_bits_[0];
- // optional int32 start = 1;
- if (cached_has_bits & 0x00000001u) {
- target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->start(), target);
- }
-
- // optional int32 end = 2;
- if (cached_has_bits & 0x00000002u) {
- target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->end(), target);
- }
-
- if (_internal_metadata_.have_unknown_fields()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
- _internal_metadata_.unknown_fields(), target);
- }
- // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- return target;
+void OneofDescriptorProto::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name)
}
-
-size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong() const {
-// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- size_t total_size = 0;
-
- if (_internal_metadata_.have_unknown_fields()) {
- total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
- _internal_metadata_.unknown_fields());
- }
- if (_has_bits_[0 / 32] & 3u) {
- // optional int32 start = 1;
- if (has_start()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->start());
- }
-
- // optional int32 end = 2;
- if (has_end()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->end());
- }
-
- }
- int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
- return total_size;
+#if LANG_CXX11
+void OneofDescriptorProto::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.OneofDescriptorProto.name)
}
-
-void EnumDescriptorProto_EnumReservedRange::MergeFrom(const ::google::protobuf::Message& from) {
-// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- GOOGLE_DCHECK_NE(&from, this);
- const EnumDescriptorProto_EnumReservedRange* source =
- ::google::protobuf::internal::DynamicCastToGenerated<const EnumDescriptorProto_EnumReservedRange>(
- &from);
- if (source == NULL) {
- // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+#endif
+void OneofDescriptorProto::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.OneofDescriptorProto.name)
+}
+void OneofDescriptorProto::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.OneofDescriptorProto.name)
+}
+::std::string* OneofDescriptorProto::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* OneofDescriptorProto::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void OneofDescriptorProto::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
} else {
- // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- MergeFrom(*source);
+ clear_has_name();
}
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name)
}
-void EnumDescriptorProto_EnumReservedRange::MergeFrom(const EnumDescriptorProto_EnumReservedRange& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- GOOGLE_DCHECK_NE(&from, this);
- _internal_metadata_.MergeFrom(from._internal_metadata_);
- ::google::protobuf::uint32 cached_has_bits = 0;
- (void) cached_has_bits;
-
- cached_has_bits = from._has_bits_[0];
- if (cached_has_bits & 3u) {
- if (cached_has_bits & 0x00000001u) {
- start_ = from.start_;
- }
- if (cached_has_bits & 0x00000002u) {
- end_ = from.end_;
- }
- _has_bits_[0] |= cached_has_bits;
- }
+// optional .google.protobuf.OneofOptions options = 2;
+bool OneofDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
}
-
-void EnumDescriptorProto_EnumReservedRange::CopyFrom(const ::google::protobuf::Message& from) {
-// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- if (&from == this) return;
- Clear();
- MergeFrom(from);
+void OneofDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000002u;
}
-
-void EnumDescriptorProto_EnumReservedRange::CopyFrom(const EnumDescriptorProto_EnumReservedRange& from) {
-// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- if (&from == this) return;
- Clear();
- MergeFrom(from);
+void OneofDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000002u;
}
-
-bool EnumDescriptorProto_EnumReservedRange::IsInitialized() const {
- return true;
+void OneofDescriptorProto::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::OneofOptions::Clear();
+ clear_has_options();
}
-
-void EnumDescriptorProto_EnumReservedRange::Swap(EnumDescriptorProto_EnumReservedRange* other) {
- if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- EnumDescriptorProto_EnumReservedRange* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void EnumDescriptorProto_EnumReservedRange::UnsafeArenaSwap(EnumDescriptorProto_EnumReservedRange* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
- InternalSwap(other);
-}
-void EnumDescriptorProto_EnumReservedRange::InternalSwap(EnumDescriptorProto_EnumReservedRange* other) {
- using std::swap;
- swap(start_, other->start_);
- swap(end_, other->end_);
- swap(_has_bits_[0], other->_has_bits_[0]);
- _internal_metadata_.Swap(&other->_internal_metadata_);
+const ::google::protobuf::OneofOptions& OneofDescriptorProto::options() const {
+ const ::google::protobuf::OneofOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::OneofOptions*>(
+ &::google::protobuf::_OneofOptions_default_instance_);
}
-
-::google::protobuf::Metadata EnumDescriptorProto_EnumReservedRange::GetMetadata() const {
- protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+::google::protobuf::OneofOptions* OneofDescriptorProto::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::OneofOptions;
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options)
+ return options_;
}
-
-
-// ===================================================================
-
-void EnumDescriptorProto::InitAsDefaultInstance() {
- ::google::protobuf::_EnumDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumOptions*>(
- ::google::protobuf::EnumOptions::internal_default_instance());
+::google::protobuf::OneofOptions* OneofDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::OneofOptions* temp = options_;
+ options_ = NULL;
+ return temp;
}
-void EnumDescriptorProto::unsafe_arena_set_allocated_options(
- ::google::protobuf::EnumOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
- }
+void OneofDescriptorProto::set_allocated_options(::google::protobuf::OneofOptions* options) {
+ delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumDescriptorProto.options)
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.options)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumDescriptorProto::kNameFieldNumber;
const int EnumDescriptorProto::kValueFieldNumber;
const int EnumDescriptorProto::kOptionsFieldNumber;
-const int EnumDescriptorProto::kReservedRangeFieldNumber;
-const int EnumDescriptorProto::kReservedNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
EnumDescriptorProto::EnumDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumDescriptorProto)
}
-EnumDescriptorProto::EnumDescriptorProto(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- value_(arena),
- reserved_range_(arena),
- reserved_name_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumDescriptorProto)
-}
EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
- value_(from.value_),
- reserved_range_(from.reserved_range_),
- reserved_name_(from.reserved_name_) {
+ _cached_size_(0),
+ value_(from.value_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
- GetArenaNoVirtual());
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::EnumOptions(*from.options_);
@@ -5772,6 +6513,7 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from)
}
void EnumDescriptorProto::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
}
@@ -5782,30 +6524,32 @@ EnumDescriptorProto::~EnumDescriptorProto() {
}
void EnumDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
-void EnumDescriptorProto::ArenaDtor(void* object) {
- EnumDescriptorProto* _this = reinterpret_cast< EnumDescriptorProto* >(object);
- (void)_this;
-}
-void EnumDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void EnumDescriptorProto::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumDescriptorProto::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumDescriptorProto& EnumDescriptorProto::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumDescriptorProto.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+EnumDescriptorProto* EnumDescriptorProto::New(::google::protobuf::Arena* arena) const {
+ EnumDescriptorProto* n = new EnumDescriptorProto;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void EnumDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto)
@@ -5814,16 +6558,15 @@ void EnumDescriptorProto::Clear() {
(void) cached_has_bits;
value_.Clear();
- reserved_range_.Clear();
- reserved_name_.Clear();
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::EnumOptions::Clear();
}
}
_has_bits_.Clear();
@@ -5836,7 +6579,7 @@ bool EnumDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumDescriptorProto)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -5860,7 +6603,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_value()));
} else {
goto handle_unusual;
@@ -5872,7 +6615,7 @@ bool EnumDescriptorProto::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -5880,35 +6623,6 @@ bool EnumDescriptorProto::MergePartialFromCodedStream(
break;
}
- // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
- 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()));
- } else {
- goto handle_unusual;
- }
- break;
- }
-
- // repeated string reserved_name = 5;
- case 5: {
- if (static_cast< ::google::protobuf::uint8>(tag) ==
- static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadString(
- input, this->add_reserved_name()));
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->reserved_name(this->reserved_name_size() - 1).data(),
- static_cast<int>(this->reserved_name(this->reserved_name_size() - 1).length()),
- ::google::protobuf::internal::WireFormat::PARSE,
- "google.protobuf.EnumDescriptorProto.reserved_name");
- } else {
- goto handle_unusual;
- }
- break;
- }
-
default: {
handle_unusual:
if (tag == 0) {
@@ -5950,34 +6664,13 @@ 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->_internal_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);
- }
-
- // repeated string reserved_name = 5;
- for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->reserved_name(i).data(), static_cast<int>(this->reserved_name(i).length()),
- ::google::protobuf::internal::WireFormat::SERIALIZE,
- "google.protobuf.EnumDescriptorProto.reserved_name");
- ::google::protobuf::internal::WireFormatLite::WriteString(
- 5, this->reserved_name(i), output);
+ 3, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -6010,33 +6703,15 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->value_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
2, this->value(static_cast<int>(i)), deterministic, target);
}
// optional .google.protobuf.EnumOptions options = 3;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 3, this->_internal_options(), deterministic, target);
- }
-
- // 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++) {
- target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 4, this->reserved_range(static_cast<int>(i)), deterministic, target);
- }
-
- // repeated string reserved_name = 5;
- for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->reserved_name(i).data(), static_cast<int>(this->reserved_name(i).length()),
- ::google::protobuf::internal::WireFormat::SERIALIZE,
- "google.protobuf.EnumDescriptorProto.reserved_name");
- target = ::google::protobuf::internal::WireFormatLite::
- WriteStringToArray(5, this->reserved_name(i), target);
+ InternalWriteMessageNoVirtualToArray(
+ 3, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -6062,30 +6737,11 @@ size_t EnumDescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->value(static_cast<int>(i)));
}
}
- // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
- {
- unsigned int count = static_cast<unsigned int>(this->reserved_range_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- this->reserved_range(static_cast<int>(i)));
- }
- }
-
- // repeated string reserved_name = 5;
- total_size += 1 *
- ::google::protobuf::internal::FromIntSize(this->reserved_name_size());
- for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
- total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
- this->reserved_name(i));
- }
-
if (_has_bits_[0 / 32] & 3u) {
// optional string name = 1;
if (has_name()) {
@@ -6097,13 +6753,15 @@ size_t EnumDescriptorProto::ByteSizeLong() const {
// optional .google.protobuf.EnumOptions options = 3;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -6130,12 +6788,11 @@ void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) {
(void) cached_has_bits;
value_.MergeFrom(from.value_);
- reserved_range_.MergeFrom(from.reserved_range_);
- reserved_name_.MergeFrom(from.reserved_name_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ set_has_name();
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::EnumOptions::MergeFrom(from.options());
@@ -6167,60 +6824,169 @@ bool EnumDescriptorProto::IsInitialized() const {
void EnumDescriptorProto::Swap(EnumDescriptorProto* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- EnumDescriptorProto* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void EnumDescriptorProto::UnsafeArenaSwap(EnumDescriptorProto* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) {
using std::swap;
- 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_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ value_.InternalSwap(&other->value_);
+ name_.Swap(&other->name_);
swap(options_, other->options_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata EnumDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// EnumDescriptorProto
-// ===================================================================
+// optional string name = 1;
+bool EnumDescriptorProto::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void EnumDescriptorProto::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void EnumDescriptorProto::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void EnumDescriptorProto::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
+}
+const ::std::string& EnumDescriptorProto::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.name)
+ return name_.GetNoArena();
+}
+void EnumDescriptorProto::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name)
+}
+#if LANG_CXX11
+void EnumDescriptorProto::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumDescriptorProto.name)
+}
+#endif
+void EnumDescriptorProto::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.EnumDescriptorProto.name)
+}
+void EnumDescriptorProto::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.name)
+}
+::std::string* EnumDescriptorProto::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* EnumDescriptorProto::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void EnumDescriptorProto::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
+ } else {
+ clear_has_name();
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name)
+}
-void EnumValueDescriptorProto::InitAsDefaultInstance() {
- ::google::protobuf::_EnumValueDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumValueOptions*>(
- ::google::protobuf::EnumValueOptions::internal_default_instance());
+// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
+int EnumDescriptorProto::value_size() const {
+ return value_.size();
}
-void EnumValueDescriptorProto::unsafe_arena_set_allocated_options(
- ::google::protobuf::EnumValueOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
+void EnumDescriptorProto::clear_value() {
+ value_.Clear();
+}
+const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value)
+ return value_.Get(index);
+}
+::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.value)
+ return value_.Mutable(index);
+}
+::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::add_value() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value)
+ return value_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >*
+EnumDescriptorProto::mutable_value() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.value)
+ return &value_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >&
+EnumDescriptorProto::value() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.value)
+ return value_;
+}
+
+// optional .google.protobuf.EnumOptions options = 3;
+bool EnumDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void EnumDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void EnumDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void EnumDescriptorProto::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::EnumOptions::Clear();
+ clear_has_options();
+}
+const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() const {
+ const ::google::protobuf::EnumOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::EnumOptions*>(
+ &::google::protobuf::_EnumOptions_default_instance_);
+}
+::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::EnumOptions;
}
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options)
+ return options_;
+}
+::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::EnumOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
+void EnumDescriptorProto::set_allocated_options(::google::protobuf::EnumOptions* options) {
+ delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueDescriptorProto.options)
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.options)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumValueDescriptorProto::kNameFieldNumber;
const int EnumValueDescriptorProto::kNumberFieldNumber;
@@ -6229,28 +6995,21 @@ const int EnumValueDescriptorProto::kOptionsFieldNumber;
EnumValueDescriptorProto::EnumValueDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumValueDescriptorProto.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumValueDescriptorProto)
}
-EnumValueDescriptorProto::EnumValueDescriptorProto(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumValueDescriptorProto.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValueDescriptorProto)
-}
EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
- GetArenaNoVirtual());
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::EnumValueOptions(*from.options_);
@@ -6262,6 +7021,7 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt
}
void EnumValueDescriptorProto::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&options_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&number_) -
@@ -6274,30 +7034,32 @@ EnumValueDescriptorProto::~EnumValueDescriptorProto() {
}
void EnumValueDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
-void EnumValueDescriptorProto::ArenaDtor(void* object) {
- EnumValueDescriptorProto* _this = reinterpret_cast< EnumValueDescriptorProto* >(object);
- (void)_this;
-}
-void EnumValueDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void EnumValueDescriptorProto::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumValueDescriptorProto::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumValueDescriptorProto& EnumValueDescriptorProto::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumValueDescriptorProto.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+EnumValueDescriptorProto* EnumValueDescriptorProto::New(::google::protobuf::Arena* arena) const {
+ EnumValueDescriptorProto* n = new EnumValueDescriptorProto;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void EnumValueDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto)
@@ -6308,11 +7070,12 @@ void EnumValueDescriptorProto::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::EnumValueOptions::Clear();
}
}
number_ = 0;
@@ -6326,7 +7089,7 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumValueDescriptorProto)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -6364,7 +7127,7 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -6417,7 +7180,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.EnumValueOptions options = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, this->_internal_options(), output);
+ 3, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -6454,8 +7217,8 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.EnumValueOptions options = 3;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 3, this->_internal_options(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 3, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -6486,8 +7249,8 @@ size_t EnumValueDescriptorProto::ByteSizeLong() const {
// optional .google.protobuf.EnumValueOptions options = 3;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
// optional int32 number = 2;
@@ -6499,7 +7262,9 @@ size_t EnumValueDescriptorProto::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -6528,7 +7293,8 @@ void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 7u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ set_has_name();
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::EnumValueOptions::MergeFrom(from.options());
@@ -6563,58 +7329,163 @@ bool EnumValueDescriptorProto::IsInitialized() const {
void EnumValueDescriptorProto::Swap(EnumValueDescriptorProto* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- EnumValueDescriptorProto* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void EnumValueDescriptorProto::UnsafeArenaSwap(EnumValueDescriptorProto* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* other) {
using std::swap;
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.Swap(&other->name_);
swap(options_, other->options_);
swap(number_, other->number_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata EnumValueDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// EnumValueDescriptorProto
-// ===================================================================
+// optional string name = 1;
+bool EnumValueDescriptorProto::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void EnumValueDescriptorProto::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void EnumValueDescriptorProto::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void EnumValueDescriptorProto::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
+}
+const ::std::string& EnumValueDescriptorProto::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.name)
+ return name_.GetNoArena();
+}
+void EnumValueDescriptorProto::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name)
+}
+#if LANG_CXX11
+void EnumValueDescriptorProto::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumValueDescriptorProto.name)
+}
+#endif
+void EnumValueDescriptorProto::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.EnumValueDescriptorProto.name)
+}
+void EnumValueDescriptorProto::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValueDescriptorProto.name)
+}
+::std::string* EnumValueDescriptorProto::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* EnumValueDescriptorProto::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void EnumValueDescriptorProto::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
+ } else {
+ clear_has_name();
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
+}
-void ServiceDescriptorProto::InitAsDefaultInstance() {
- ::google::protobuf::_ServiceDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ServiceOptions*>(
- ::google::protobuf::ServiceOptions::internal_default_instance());
+// optional int32 number = 2;
+bool EnumValueDescriptorProto::has_number() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void EnumValueDescriptorProto::set_has_number() {
+ _has_bits_[0] |= 0x00000004u;
}
-void ServiceDescriptorProto::unsafe_arena_set_allocated_options(
- ::google::protobuf::ServiceOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
+void EnumValueDescriptorProto::clear_has_number() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void EnumValueDescriptorProto::clear_number() {
+ number_ = 0;
+ clear_has_number();
+}
+::google::protobuf::int32 EnumValueDescriptorProto::number() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.number)
+ return number_;
+}
+void EnumValueDescriptorProto::set_number(::google::protobuf::int32 value) {
+ set_has_number();
+ number_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.number)
+}
+
+// optional .google.protobuf.EnumValueOptions options = 3;
+bool EnumValueDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void EnumValueDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void EnumValueDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void EnumValueDescriptorProto::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::EnumValueOptions::Clear();
+ clear_has_options();
+}
+const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::options() const {
+ const ::google::protobuf::EnumValueOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::EnumValueOptions*>(
+ &::google::protobuf::_EnumValueOptions_default_instance_);
+}
+::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::EnumValueOptions;
}
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options)
+ return options_;
+}
+::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::EnumValueOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
+void EnumValueDescriptorProto::set_allocated_options(::google::protobuf::EnumValueOptions* options) {
+ delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ServiceDescriptorProto.options)
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.options)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ServiceDescriptorProto::kNameFieldNumber;
const int ServiceDescriptorProto::kMethodFieldNumber;
@@ -6623,30 +7494,22 @@ const int ServiceDescriptorProto::kOptionsFieldNumber;
ServiceDescriptorProto::ServiceDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ServiceDescriptorProto.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.ServiceDescriptorProto)
}
-ServiceDescriptorProto::ServiceDescriptorProto(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- method_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ServiceDescriptorProto.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.ServiceDescriptorProto)
-}
ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
method_(from.method_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
- GetArenaNoVirtual());
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::ServiceOptions(*from.options_);
@@ -6657,6 +7520,7 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro
}
void ServiceDescriptorProto::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
}
@@ -6667,30 +7531,32 @@ ServiceDescriptorProto::~ServiceDescriptorProto() {
}
void ServiceDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
-void ServiceDescriptorProto::ArenaDtor(void* object) {
- ServiceDescriptorProto* _this = reinterpret_cast< ServiceDescriptorProto* >(object);
- (void)_this;
-}
-void ServiceDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void ServiceDescriptorProto::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ServiceDescriptorProto::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const ServiceDescriptorProto& ServiceDescriptorProto::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ServiceDescriptorProto.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+ServiceDescriptorProto* ServiceDescriptorProto::New(::google::protobuf::Arena* arena) const {
+ ServiceDescriptorProto* n = new ServiceDescriptorProto;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void ServiceDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto)
@@ -6702,11 +7568,12 @@ void ServiceDescriptorProto::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::ServiceOptions::Clear();
}
}
_has_bits_.Clear();
@@ -6719,7 +7586,7 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.ServiceDescriptorProto)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -6743,7 +7610,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_method()));
} else {
goto handle_unusual;
@@ -6755,7 +7622,7 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -6804,15 +7671,13 @@ 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->_internal_options(), output);
+ 3, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -6845,15 +7710,15 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->method_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
2, this->method(static_cast<int>(i)), deterministic, target);
}
// optional .google.protobuf.ServiceOptions options = 3;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 3, this->_internal_options(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 3, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -6879,7 +7744,7 @@ size_t ServiceDescriptorProto::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->method(static_cast<int>(i)));
}
}
@@ -6895,13 +7760,15 @@ size_t ServiceDescriptorProto::ByteSizeLong() const {
// optional .google.protobuf.ServiceOptions options = 3;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -6931,7 +7798,8 @@ void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ set_has_name();
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::ServiceOptions::MergeFrom(from.options());
@@ -6963,58 +7831,169 @@ bool ServiceDescriptorProto::IsInitialized() const {
void ServiceDescriptorProto::Swap(ServiceDescriptorProto* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- ServiceDescriptorProto* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void ServiceDescriptorProto::UnsafeArenaSwap(ServiceDescriptorProto* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* other) {
using std::swap;
- CastToBase(&method_)->InternalSwap(CastToBase(&other->method_));
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ method_.InternalSwap(&other->method_);
+ name_.Swap(&other->name_);
swap(options_, other->options_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ServiceDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// ServiceDescriptorProto
-// ===================================================================
+// optional string name = 1;
+bool ServiceDescriptorProto::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void ServiceDescriptorProto::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void ServiceDescriptorProto::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void ServiceDescriptorProto::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
+}
+const ::std::string& ServiceDescriptorProto::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.name)
+ return name_.GetNoArena();
+}
+void ServiceDescriptorProto::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name)
+}
+#if LANG_CXX11
+void ServiceDescriptorProto::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.ServiceDescriptorProto.name)
+}
+#endif
+void ServiceDescriptorProto::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.ServiceDescriptorProto.name)
+}
+void ServiceDescriptorProto::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.ServiceDescriptorProto.name)
+}
+::std::string* ServiceDescriptorProto::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* ServiceDescriptorProto::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void ServiceDescriptorProto::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
+ } else {
+ clear_has_name();
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name)
+}
-void MethodDescriptorProto::InitAsDefaultInstance() {
- ::google::protobuf::_MethodDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MethodOptions*>(
- ::google::protobuf::MethodOptions::internal_default_instance());
+// repeated .google.protobuf.MethodDescriptorProto method = 2;
+int ServiceDescriptorProto::method_size() const {
+ return method_.size();
+}
+void ServiceDescriptorProto::clear_method() {
+ method_.Clear();
+}
+const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method)
+ return method_.Get(index);
+}
+::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.method)
+ return method_.Mutable(index);
+}
+::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::add_method() {
+ // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method)
+ return method_.Add();
}
-void MethodDescriptorProto::unsafe_arena_set_allocated_options(
- ::google::protobuf::MethodOptions* options) {
- if (GetArenaNoVirtual() == NULL) {
- delete options_;
+::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >*
+ServiceDescriptorProto::mutable_method() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceDescriptorProto.method)
+ return &method_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >&
+ServiceDescriptorProto::method() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.ServiceDescriptorProto.method)
+ return method_;
+}
+
+// optional .google.protobuf.ServiceOptions options = 3;
+bool ServiceDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void ServiceDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void ServiceDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void ServiceDescriptorProto::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::ServiceOptions::Clear();
+ clear_has_options();
+}
+const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options() const {
+ const ::google::protobuf::ServiceOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::ServiceOptions*>(
+ &::google::protobuf::_ServiceOptions_default_instance_);
+}
+::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::ServiceOptions;
}
+ // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options)
+ return options_;
+}
+::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::ServiceOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
+void ServiceDescriptorProto::set_allocated_options(::google::protobuf::ServiceOptions* options) {
+ delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.options)
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.options)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MethodDescriptorProto::kNameFieldNumber;
const int MethodDescriptorProto::kInputTypeFieldNumber;
@@ -7026,38 +8005,29 @@ const int MethodDescriptorProto::kServerStreamingFieldNumber;
MethodDescriptorProto::MethodDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MethodDescriptorProto.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.MethodDescriptorProto)
}
-MethodDescriptorProto::MethodDescriptorProto(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MethodDescriptorProto.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.MethodDescriptorProto)
-}
MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
- GetArenaNoVirtual());
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
input_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_input_type()) {
- input_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.input_type(),
- GetArenaNoVirtual());
+ input_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.input_type_);
}
output_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_output_type()) {
- output_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_type(),
- GetArenaNoVirtual());
+ output_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_type_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::MethodOptions(*from.options_);
@@ -7071,6 +8041,7 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
}
void MethodDescriptorProto::SharedCtor() {
+ _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
input_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
output_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -7085,32 +8056,34 @@ MethodDescriptorProto::~MethodDescriptorProto() {
}
void MethodDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
input_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
output_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
-void MethodDescriptorProto::ArenaDtor(void* object) {
- MethodDescriptorProto* _this = reinterpret_cast< MethodDescriptorProto* >(object);
- (void)_this;
-}
-void MethodDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void MethodDescriptorProto::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MethodDescriptorProto::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const MethodDescriptorProto& MethodDescriptorProto::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MethodDescriptorProto.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+MethodDescriptorProto* MethodDescriptorProto::New(::google::protobuf::Arena* arena) const {
+ MethodDescriptorProto* n = new MethodDescriptorProto;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void MethodDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto)
@@ -7121,22 +8094,27 @@ void MethodDescriptorProto::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 15u) {
if (cached_has_bits & 0x00000001u) {
- name_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
- input_type_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!input_type_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*input_type_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000004u) {
- output_type_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!output_type_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*output_type_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000008u) {
GOOGLE_DCHECK(options_ != NULL);
- options_->Clear();
+ options_->::google::protobuf::MethodOptions::Clear();
}
}
- ::memset(&client_streaming_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&server_streaming_) -
- reinterpret_cast<char*>(&client_streaming_)) + sizeof(server_streaming_));
+ if (cached_has_bits & 48u) {
+ ::memset(&client_streaming_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&server_streaming_) -
+ reinterpret_cast<char*>(&client_streaming_)) + sizeof(server_streaming_));
+ }
_has_bits_.Clear();
_internal_metadata_.Clear();
}
@@ -7147,7 +8125,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.MethodDescriptorProto)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -7203,7 +8181,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream(
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
@@ -7299,7 +8277,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.MethodOptions options = 4;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 4, this->_internal_options(), output);
+ 4, *this->options_, output);
}
// optional bool client_streaming = 5 [default = false];
@@ -7363,8 +8341,8 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.MethodOptions options = 4;
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 4, this->_internal_options(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 4, *this->options_, deterministic, target);
}
// optional bool client_streaming = 5 [default = false];
@@ -7419,8 +8397,8 @@ size_t MethodDescriptorProto::ByteSizeLong() const {
// optional .google.protobuf.MethodOptions options = 4;
if (has_options()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *options_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
}
// optional bool client_streaming = 5 [default = false];
@@ -7435,7 +8413,9 @@ size_t MethodDescriptorProto::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -7464,13 +8444,16 @@ void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 63u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ set_has_name();
+ name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
- set_input_type(from.input_type());
+ set_has_input_type();
+ input_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.input_type_);
}
if (cached_has_bits & 0x00000004u) {
- set_output_type(from.output_type());
+ set_has_output_type();
+ output_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_type_);
}
if (cached_has_bits & 0x00000008u) {
mutable_options()->::google::protobuf::MethodOptions::MergeFrom(from.options());
@@ -7508,48 +8491,316 @@ bool MethodDescriptorProto::IsInitialized() const {
void MethodDescriptorProto::Swap(MethodDescriptorProto* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- MethodDescriptorProto* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void MethodDescriptorProto::UnsafeArenaSwap(MethodDescriptorProto* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* other) {
using std::swap;
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- input_type_.Swap(&other->input_type_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- output_type_.Swap(&other->output_type_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.Swap(&other->name_);
+ input_type_.Swap(&other->input_type_);
+ output_type_.Swap(&other->output_type_);
swap(options_, other->options_);
swap(client_streaming_, other->client_streaming_);
swap(server_streaming_, other->server_streaming_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata MethodDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// MethodDescriptorProto
-// ===================================================================
+// optional string name = 1;
+bool MethodDescriptorProto::has_name() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void MethodDescriptorProto::set_has_name() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void MethodDescriptorProto::clear_has_name() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void MethodDescriptorProto::clear_name() {
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name();
+}
+const ::std::string& MethodDescriptorProto::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.name)
+ return name_.GetNoArena();
+}
+void MethodDescriptorProto::set_name(const ::std::string& value) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name)
+}
+#if LANG_CXX11
+void MethodDescriptorProto::set_name(::std::string&& value) {
+ set_has_name();
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.name)
+}
+#endif
+void MethodDescriptorProto::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.name)
+}
+void MethodDescriptorProto::set_name(const char* value, size_t size) {
+ set_has_name();
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.name)
+}
+::std::string* MethodDescriptorProto::mutable_name() {
+ set_has_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name)
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* MethodDescriptorProto::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name)
+ clear_has_name();
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void MethodDescriptorProto::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+ set_has_name();
+ } else {
+ clear_has_name();
+ }
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name)
+}
+
+// optional string input_type = 2;
+bool MethodDescriptorProto::has_input_type() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void MethodDescriptorProto::set_has_input_type() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void MethodDescriptorProto::clear_has_input_type() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void MethodDescriptorProto::clear_input_type() {
+ input_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_input_type();
+}
+const ::std::string& MethodDescriptorProto::input_type() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.input_type)
+ return input_type_.GetNoArena();
+}
+void MethodDescriptorProto::set_input_type(const ::std::string& value) {
+ set_has_input_type();
+ input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type)
+}
+#if LANG_CXX11
+void MethodDescriptorProto::set_input_type(::std::string&& value) {
+ set_has_input_type();
+ input_type_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.input_type)
+}
+#endif
+void MethodDescriptorProto::set_input_type(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_input_type();
+ input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.input_type)
+}
+void MethodDescriptorProto::set_input_type(const char* value, size_t size) {
+ set_has_input_type();
+ input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.input_type)
+}
+::std::string* MethodDescriptorProto::mutable_input_type() {
+ set_has_input_type();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type)
+ return input_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* MethodDescriptorProto::release_input_type() {
+ // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type)
+ clear_has_input_type();
+ return input_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void MethodDescriptorProto::set_allocated_input_type(::std::string* input_type) {
+ if (input_type != NULL) {
+ set_has_input_type();
+ } else {
+ clear_has_input_type();
+ }
+ input_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), input_type);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
+}
+
+// optional string output_type = 3;
+bool MethodDescriptorProto::has_output_type() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void MethodDescriptorProto::set_has_output_type() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void MethodDescriptorProto::clear_has_output_type() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void MethodDescriptorProto::clear_output_type() {
+ output_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_output_type();
+}
+const ::std::string& MethodDescriptorProto::output_type() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.output_type)
+ return output_type_.GetNoArena();
+}
+void MethodDescriptorProto::set_output_type(const ::std::string& value) {
+ set_has_output_type();
+ output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type)
+}
+#if LANG_CXX11
+void MethodDescriptorProto::set_output_type(::std::string&& value) {
+ set_has_output_type();
+ output_type_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.output_type)
+}
+#endif
+void MethodDescriptorProto::set_output_type(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_output_type();
+ output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.output_type)
+}
+void MethodDescriptorProto::set_output_type(const char* value, size_t size) {
+ set_has_output_type();
+ output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.output_type)
+}
+::std::string* MethodDescriptorProto::mutable_output_type() {
+ set_has_output_type();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type)
+ return output_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* MethodDescriptorProto::release_output_type() {
+ // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type)
+ clear_has_output_type();
+ return output_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void MethodDescriptorProto::set_allocated_output_type(::std::string* output_type) {
+ if (output_type != NULL) {
+ set_has_output_type();
+ } else {
+ clear_has_output_type();
+ }
+ output_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), output_type);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
+}
-void FileOptions::InitAsDefaultInstance() {
+// optional .google.protobuf.MethodOptions options = 4;
+bool MethodDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
}
+void MethodDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000008u;
+}
+void MethodDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+void MethodDescriptorProto::clear_options() {
+ if (options_ != NULL) options_->::google::protobuf::MethodOptions::Clear();
+ clear_has_options();
+}
+const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() const {
+ const ::google::protobuf::MethodOptions* p = options_;
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::MethodOptions*>(
+ &::google::protobuf::_MethodOptions_default_instance_);
+}
+::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() {
+ set_has_options();
+ if (options_ == NULL) {
+ options_ = new ::google::protobuf::MethodOptions;
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options)
+ return options_;
+}
+::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::MethodOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
+void MethodDescriptorProto::set_allocated_options(::google::protobuf::MethodOptions* options) {
+ delete options_;
+ options_ = options;
+ if (options) {
+ set_has_options();
+ } else {
+ clear_has_options();
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.options)
+}
+
+// optional bool client_streaming = 5 [default = false];
+bool MethodDescriptorProto::has_client_streaming() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+void MethodDescriptorProto::set_has_client_streaming() {
+ _has_bits_[0] |= 0x00000010u;
+}
+void MethodDescriptorProto::clear_has_client_streaming() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+void MethodDescriptorProto::clear_client_streaming() {
+ client_streaming_ = false;
+ clear_has_client_streaming();
+}
+bool MethodDescriptorProto::client_streaming() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.client_streaming)
+ return client_streaming_;
+}
+void MethodDescriptorProto::set_client_streaming(bool value) {
+ set_has_client_streaming();
+ client_streaming_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.client_streaming)
+}
+
+// optional bool server_streaming = 6 [default = false];
+bool MethodDescriptorProto::has_server_streaming() const {
+ return (_has_bits_[0] & 0x00000020u) != 0;
+}
+void MethodDescriptorProto::set_has_server_streaming() {
+ _has_bits_[0] |= 0x00000020u;
+}
+void MethodDescriptorProto::clear_has_server_streaming() {
+ _has_bits_[0] &= ~0x00000020u;
+}
+void MethodDescriptorProto::clear_server_streaming() {
+ server_streaming_ = false;
+ clear_has_server_streaming();
+}
+bool MethodDescriptorProto::server_streaming() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.server_streaming)
+ return server_streaming_;
+}
+void MethodDescriptorProto::set_server_streaming(bool value) {
+ set_has_server_streaming();
+ server_streaming_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.server_streaming)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FileOptions::kJavaPackageFieldNumber;
const int FileOptions::kJavaOuterClassnameFieldNumber;
@@ -7569,84 +8820,56 @@ const int FileOptions::kCsharpNamespaceFieldNumber;
const int FileOptions::kSwiftPrefixFieldNumber;
const int FileOptions::kPhpClassPrefixFieldNumber;
const int FileOptions::kPhpNamespaceFieldNumber;
-const int FileOptions::kPhpMetadataNamespaceFieldNumber;
-const int FileOptions::kRubyPackageFieldNumber;
const int FileOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FileOptions::FileOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FileOptions)
}
-FileOptions::FileOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.FileOptions)
-}
FileOptions::FileOptions(const FileOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
java_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_java_package()) {
- java_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_package(),
- GetArenaNoVirtual());
+ java_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_package_);
}
java_outer_classname_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_java_outer_classname()) {
- java_outer_classname_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname(),
- GetArenaNoVirtual());
+ java_outer_classname_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname_);
}
go_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_go_package()) {
- go_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.go_package(),
- GetArenaNoVirtual());
+ go_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.go_package_);
}
objc_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_objc_class_prefix()) {
- objc_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix(),
- GetArenaNoVirtual());
+ objc_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix_);
}
csharp_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_csharp_namespace()) {
- csharp_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace(),
- GetArenaNoVirtual());
+ csharp_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace_);
}
swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_swift_prefix()) {
- swift_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.swift_prefix(),
- GetArenaNoVirtual());
+ swift_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.swift_prefix_);
}
php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_php_class_prefix()) {
- php_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix(),
- GetArenaNoVirtual());
+ php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_);
}
php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_php_namespace()) {
- php_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace(),
- GetArenaNoVirtual());
- }
- php_metadata_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- if (from.has_php_metadata_namespace()) {
- php_metadata_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_metadata_namespace(),
- GetArenaNoVirtual());
- }
- ruby_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- if (from.has_ruby_package()) {
- ruby_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.ruby_package(),
- GetArenaNoVirtual());
+ php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_);
}
::memcpy(&java_multiple_files_, &from.java_multiple_files_,
static_cast<size_t>(reinterpret_cast<char*>(&optimize_for_) -
@@ -7655,6 +8878,7 @@ FileOptions::FileOptions(const FileOptions& from)
}
void FileOptions::SharedCtor() {
+ _cached_size_ = 0;
java_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
java_outer_classname_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
go_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -7663,8 +8887,6 @@ void FileOptions::SharedCtor() {
swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- php_metadata_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- ruby_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&java_multiple_files_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&cc_enable_arenas_) -
reinterpret_cast<char*>(&java_multiple_files_)) + sizeof(cc_enable_arenas_));
@@ -7677,7 +8899,6 @@ FileOptions::~FileOptions() {
}
void FileOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
java_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
java_outer_classname_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
go_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -7686,29 +8907,30 @@ void FileOptions::SharedDtor() {
swift_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
php_class_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
php_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- php_metadata_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- ruby_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
-void FileOptions::ArenaDtor(void* object) {
- FileOptions* _this = reinterpret_cast< FileOptions* >(object);
- (void)_this;
-}
-void FileOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void FileOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FileOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FileOptions& FileOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FileOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+FileOptions* FileOptions::New(::google::protobuf::Arena* arena) const {
+ FileOptions* n = new FileOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void FileOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions)
@@ -7721,47 +8943,45 @@ void FileOptions::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 255u) {
if (cached_has_bits & 0x00000001u) {
- java_package_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!java_package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*java_package_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
- java_outer_classname_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!java_outer_classname_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*java_outer_classname_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000004u) {
- go_package_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!go_package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*go_package_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000008u) {
- objc_class_prefix_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!objc_class_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*objc_class_prefix_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000010u) {
- csharp_namespace_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!csharp_namespace_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*csharp_namespace_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000020u) {
- swift_prefix_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!swift_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*swift_prefix_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000040u) {
- php_class_prefix_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!php_class_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*php_class_prefix_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000080u) {
- php_namespace_.ClearNonDefaultToEmpty();
- }
- }
- if (cached_has_bits & 768u) {
- if (cached_has_bits & 0x00000100u) {
- php_metadata_namespace_.ClearNonDefaultToEmpty();
- }
- if (cached_has_bits & 0x00000200u) {
- ruby_package_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!php_namespace_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*php_namespace_.UnsafeRawStringPointer())->clear();
}
}
- if (cached_has_bits & 64512u) {
+ if (cached_has_bits & 65280u) {
::memset(&java_multiple_files_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&py_generic_services_) -
- reinterpret_cast<char*>(&java_multiple_files_)) + sizeof(py_generic_services_));
+ reinterpret_cast<char*>(&deprecated_) -
+ reinterpret_cast<char*>(&java_multiple_files_)) + sizeof(deprecated_));
}
- if (cached_has_bits & 983040u) {
- ::memset(&php_generic_services_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&cc_enable_arenas_) -
- reinterpret_cast<char*>(&php_generic_services_)) + sizeof(cc_enable_arenas_));
+ if (cached_has_bits & 196608u) {
+ cc_enable_arenas_ = false;
optimize_for_ = 1;
}
_has_bits_.Clear();
@@ -7774,7 +8994,7 @@ bool FileOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FileOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -7902,6 +9122,20 @@ bool FileOptions::MergePartialFromCodedStream(
break;
}
+ // optional bool php_generic_services = 19 [default = false];
+ case 19: {
+ if (static_cast< ::google::protobuf::uint8>(tag) ==
+ static_cast< ::google::protobuf::uint8>(152u /* 152 & 0xFF */)) {
+ set_has_php_generic_services();
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+ input, &php_generic_services_)));
+ } else {
+ goto handle_unusual;
+ }
+ break;
+ }
+
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
case 20: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
@@ -8038,57 +9272,11 @@ bool FileOptions::MergePartialFromCodedStream(
break;
}
- // optional bool php_generic_services = 42 [default = false];
- case 42: {
- if (static_cast< ::google::protobuf::uint8>(tag) ==
- static_cast< ::google::protobuf::uint8>(80u /* 336 & 0xFF */)) {
- set_has_php_generic_services();
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
- input, &php_generic_services_)));
- } else {
- goto handle_unusual;
- }
- break;
- }
-
- // optional string php_metadata_namespace = 44;
- case 44: {
- if (static_cast< ::google::protobuf::uint8>(tag) ==
- static_cast< ::google::protobuf::uint8>(98u /* 354 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadString(
- input, this->mutable_php_metadata_namespace()));
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_metadata_namespace().data(), static_cast<int>(this->php_metadata_namespace().length()),
- ::google::protobuf::internal::WireFormat::PARSE,
- "google.protobuf.FileOptions.php_metadata_namespace");
- } else {
- goto handle_unusual;
- }
- break;
- }
-
- // optional string ruby_package = 45;
- case 45: {
- if (static_cast< ::google::protobuf::uint8>(tag) ==
- static_cast< ::google::protobuf::uint8>(106u /* 362 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadString(
- input, this->mutable_ruby_package()));
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->ruby_package().data(), static_cast<int>(this->ruby_package().length()),
- ::google::protobuf::internal::WireFormat::PARSE,
- "google.protobuf.FileOptions.ruby_package");
- } else {
- goto handle_unusual;
- }
- break;
- }
-
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -8150,13 +9338,13 @@ void FileOptions::SerializeWithCachedSizes(
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
- if (cached_has_bits & 0x00080000u) {
+ if (cached_has_bits & 0x00020000u) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
9, this->optimize_for(), output);
}
// optional bool java_multiple_files = 10 [default = false];
- if (cached_has_bits & 0x00000400u) {
+ if (cached_has_bits & 0x00000100u) {
::google::protobuf::internal::WireFormatLite::WriteBool(10, this->java_multiple_files(), output);
}
@@ -8171,37 +9359,42 @@ void FileOptions::SerializeWithCachedSizes(
}
// optional bool cc_generic_services = 16 [default = false];
- if (cached_has_bits & 0x00002000u) {
+ if (cached_has_bits & 0x00000800u) {
::google::protobuf::internal::WireFormatLite::WriteBool(16, this->cc_generic_services(), output);
}
// optional bool java_generic_services = 17 [default = false];
- if (cached_has_bits & 0x00004000u) {
+ if (cached_has_bits & 0x00001000u) {
::google::protobuf::internal::WireFormatLite::WriteBool(17, this->java_generic_services(), output);
}
// optional bool py_generic_services = 18 [default = false];
- if (cached_has_bits & 0x00008000u) {
+ if (cached_has_bits & 0x00002000u) {
::google::protobuf::internal::WireFormatLite::WriteBool(18, this->py_generic_services(), output);
}
+ // optional bool php_generic_services = 19 [default = false];
+ if (cached_has_bits & 0x00004000u) {
+ ::google::protobuf::internal::WireFormatLite::WriteBool(19, this->php_generic_services(), output);
+ }
+
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
- if (cached_has_bits & 0x00000800u) {
+ if (cached_has_bits & 0x00000200u) {
::google::protobuf::internal::WireFormatLite::WriteBool(20, this->java_generate_equals_and_hash(), output);
}
// optional bool deprecated = 23 [default = false];
- if (cached_has_bits & 0x00020000u) {
+ if (cached_has_bits & 0x00008000u) {
::google::protobuf::internal::WireFormatLite::WriteBool(23, this->deprecated(), output);
}
// optional bool java_string_check_utf8 = 27 [default = false];
- if (cached_has_bits & 0x00001000u) {
+ if (cached_has_bits & 0x00000400u) {
::google::protobuf::internal::WireFormatLite::WriteBool(27, this->java_string_check_utf8(), output);
}
// optional bool cc_enable_arenas = 31 [default = false];
- if (cached_has_bits & 0x00040000u) {
+ if (cached_has_bits & 0x00010000u) {
::google::protobuf::internal::WireFormatLite::WriteBool(31, this->cc_enable_arenas(), output);
}
@@ -8255,38 +9448,11 @@ void FileOptions::SerializeWithCachedSizes(
41, this->php_namespace(), output);
}
- // optional bool php_generic_services = 42 [default = false];
- if (cached_has_bits & 0x00010000u) {
- ::google::protobuf::internal::WireFormatLite::WriteBool(42, this->php_generic_services(), output);
- }
-
- // optional string php_metadata_namespace = 44;
- if (cached_has_bits & 0x00000100u) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_metadata_namespace().data(), static_cast<int>(this->php_metadata_namespace().length()),
- ::google::protobuf::internal::WireFormat::SERIALIZE,
- "google.protobuf.FileOptions.php_metadata_namespace");
- ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
- 44, this->php_metadata_namespace(), output);
- }
-
- // optional string ruby_package = 45;
- if (cached_has_bits & 0x00000200u) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->ruby_package().data(), static_cast<int>(this->ruby_package().length()),
- ::google::protobuf::internal::WireFormat::SERIALIZE,
- "google.protobuf.FileOptions.ruby_package");
- ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
- 45, this->ruby_package(), output);
- }
-
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
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)
@@ -8331,13 +9497,13 @@ void FileOptions::SerializeWithCachedSizes(
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
- if (cached_has_bits & 0x00080000u) {
+ if (cached_has_bits & 0x00020000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
9, this->optimize_for(), target);
}
// optional bool java_multiple_files = 10 [default = false];
- if (cached_has_bits & 0x00000400u) {
+ if (cached_has_bits & 0x00000100u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->java_multiple_files(), target);
}
@@ -8353,37 +9519,42 @@ void FileOptions::SerializeWithCachedSizes(
}
// optional bool cc_generic_services = 16 [default = false];
- if (cached_has_bits & 0x00002000u) {
+ if (cached_has_bits & 0x00000800u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(16, this->cc_generic_services(), target);
}
// optional bool java_generic_services = 17 [default = false];
- if (cached_has_bits & 0x00004000u) {
+ if (cached_has_bits & 0x00001000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(17, this->java_generic_services(), target);
}
// optional bool py_generic_services = 18 [default = false];
- if (cached_has_bits & 0x00008000u) {
+ if (cached_has_bits & 0x00002000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(18, this->py_generic_services(), target);
}
+ // optional bool php_generic_services = 19 [default = false];
+ if (cached_has_bits & 0x00004000u) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(19, this->php_generic_services(), target);
+ }
+
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
- if (cached_has_bits & 0x00000800u) {
+ if (cached_has_bits & 0x00000200u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(20, this->java_generate_equals_and_hash(), target);
}
// optional bool deprecated = 23 [default = false];
- if (cached_has_bits & 0x00020000u) {
+ if (cached_has_bits & 0x00008000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(23, this->deprecated(), target);
}
// optional bool java_string_check_utf8 = 27 [default = false];
- if (cached_has_bits & 0x00001000u) {
+ if (cached_has_bits & 0x00000400u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(27, this->java_string_check_utf8(), target);
}
// optional bool cc_enable_arenas = 31 [default = false];
- if (cached_has_bits & 0x00040000u) {
+ if (cached_has_bits & 0x00010000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(31, this->cc_enable_arenas(), target);
}
@@ -8442,38 +9613,11 @@ void FileOptions::SerializeWithCachedSizes(
41, this->php_namespace(), target);
}
- // optional bool php_generic_services = 42 [default = false];
- if (cached_has_bits & 0x00010000u) {
- target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(42, this->php_generic_services(), target);
- }
-
- // optional string php_metadata_namespace = 44;
- if (cached_has_bits & 0x00000100u) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_metadata_namespace().data(), static_cast<int>(this->php_metadata_namespace().length()),
- ::google::protobuf::internal::WireFormat::SERIALIZE,
- "google.protobuf.FileOptions.php_metadata_namespace");
- target =
- ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
- 44, this->php_metadata_namespace(), target);
- }
-
- // optional string ruby_package = 45;
- if (cached_has_bits & 0x00000200u) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
- this->ruby_package().data(), static_cast<int>(this->ruby_package().length()),
- ::google::protobuf::internal::WireFormat::SERIALIZE,
- "google.protobuf.FileOptions.ruby_package");
- target =
- ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
- 45, this->ruby_package(), target);
- }
-
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -8506,7 +9650,7 @@ size_t FileOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
@@ -8570,20 +9714,6 @@ size_t FileOptions::ByteSizeLong() const {
}
if (_has_bits_[8 / 32] & 65280u) {
- // optional string php_metadata_namespace = 44;
- if (has_php_metadata_namespace()) {
- total_size += 2 +
- ::google::protobuf::internal::WireFormatLite::StringSize(
- this->php_metadata_namespace());
- }
-
- // optional string ruby_package = 45;
- if (has_ruby_package()) {
- total_size += 2 +
- ::google::protobuf::internal::WireFormatLite::StringSize(
- this->ruby_package());
- }
-
// optional bool java_multiple_files = 10 [default = false];
if (has_java_multiple_files()) {
total_size += 1 + 1;
@@ -8614,9 +9744,7 @@ size_t FileOptions::ByteSizeLong() const {
total_size += 2 + 1;
}
- }
- if (_has_bits_[16 / 32] & 983040u) {
- // optional bool php_generic_services = 42 [default = false];
+ // optional bool php_generic_services = 19 [default = false];
if (has_php_generic_services()) {
total_size += 2 + 1;
}
@@ -8626,6 +9754,8 @@ size_t FileOptions::ByteSizeLong() const {
total_size += 2 + 1;
}
+ }
+ if (_has_bits_[16 / 32] & 196608u) {
// optional bool cc_enable_arenas = 31 [default = false];
if (has_cc_enable_arenas()) {
total_size += 2 + 1;
@@ -8639,7 +9769,9 @@ size_t FileOptions::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -8670,68 +9802,70 @@ void FileOptions::MergeFrom(const FileOptions& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 255u) {
if (cached_has_bits & 0x00000001u) {
- set_java_package(from.java_package());
+ set_has_java_package();
+ java_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_package_);
}
if (cached_has_bits & 0x00000002u) {
- set_java_outer_classname(from.java_outer_classname());
+ set_has_java_outer_classname();
+ java_outer_classname_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname_);
}
if (cached_has_bits & 0x00000004u) {
- set_go_package(from.go_package());
+ set_has_go_package();
+ go_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.go_package_);
}
if (cached_has_bits & 0x00000008u) {
- set_objc_class_prefix(from.objc_class_prefix());
+ set_has_objc_class_prefix();
+ objc_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix_);
}
if (cached_has_bits & 0x00000010u) {
- set_csharp_namespace(from.csharp_namespace());
+ set_has_csharp_namespace();
+ csharp_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace_);
}
if (cached_has_bits & 0x00000020u) {
- set_swift_prefix(from.swift_prefix());
+ set_has_swift_prefix();
+ swift_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.swift_prefix_);
}
if (cached_has_bits & 0x00000040u) {
- set_php_class_prefix(from.php_class_prefix());
+ set_has_php_class_prefix();
+ php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_);
}
if (cached_has_bits & 0x00000080u) {
- set_php_namespace(from.php_namespace());
+ set_has_php_namespace();
+ php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_);
}
}
if (cached_has_bits & 65280u) {
if (cached_has_bits & 0x00000100u) {
- set_php_metadata_namespace(from.php_metadata_namespace());
+ java_multiple_files_ = from.java_multiple_files_;
}
if (cached_has_bits & 0x00000200u) {
- set_ruby_package(from.ruby_package());
+ java_generate_equals_and_hash_ = from.java_generate_equals_and_hash_;
}
if (cached_has_bits & 0x00000400u) {
- java_multiple_files_ = from.java_multiple_files_;
+ java_string_check_utf8_ = from.java_string_check_utf8_;
}
if (cached_has_bits & 0x00000800u) {
- java_generate_equals_and_hash_ = from.java_generate_equals_and_hash_;
+ cc_generic_services_ = from.cc_generic_services_;
}
if (cached_has_bits & 0x00001000u) {
- java_string_check_utf8_ = from.java_string_check_utf8_;
+ java_generic_services_ = from.java_generic_services_;
}
if (cached_has_bits & 0x00002000u) {
- cc_generic_services_ = from.cc_generic_services_;
+ py_generic_services_ = from.py_generic_services_;
}
if (cached_has_bits & 0x00004000u) {
- java_generic_services_ = from.java_generic_services_;
+ php_generic_services_ = from.php_generic_services_;
}
if (cached_has_bits & 0x00008000u) {
- py_generic_services_ = from.py_generic_services_;
+ deprecated_ = from.deprecated_;
}
_has_bits_[0] |= cached_has_bits;
}
- if (cached_has_bits & 983040u) {
+ if (cached_has_bits & 196608u) {
if (cached_has_bits & 0x00010000u) {
- php_generic_services_ = from.php_generic_services_;
- }
- if (cached_has_bits & 0x00020000u) {
- deprecated_ = from.deprecated_;
- }
- if (cached_has_bits & 0x00040000u) {
cc_enable_arenas_ = from.cc_enable_arenas_;
}
- if (cached_has_bits & 0x00080000u) {
+ if (cached_has_bits & 0x00020000u) {
optimize_for_ = from.optimize_for_;
}
_has_bits_[0] |= cached_has_bits;
@@ -8763,46 +9897,19 @@ bool FileOptions::IsInitialized() const {
void FileOptions::Swap(FileOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- FileOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void FileOptions::UnsafeArenaSwap(FileOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void FileOptions::InternalSwap(FileOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
- java_package_.Swap(&other->java_package_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- java_outer_classname_.Swap(&other->java_outer_classname_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- go_package_.Swap(&other->go_package_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- objc_class_prefix_.Swap(&other->objc_class_prefix_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- csharp_namespace_.Swap(&other->csharp_namespace_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- swift_prefix_.Swap(&other->swift_prefix_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- php_class_prefix_.Swap(&other->php_class_prefix_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- php_namespace_.Swap(&other->php_namespace_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- php_metadata_namespace_.Swap(&other->php_metadata_namespace_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- ruby_package_.Swap(&other->ruby_package_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ java_package_.Swap(&other->java_package_);
+ java_outer_classname_.Swap(&other->java_outer_classname_);
+ go_package_.Swap(&other->go_package_);
+ objc_class_prefix_.Swap(&other->objc_class_prefix_);
+ csharp_namespace_.Swap(&other->csharp_namespace_);
+ swift_prefix_.Swap(&other->swift_prefix_);
+ php_class_prefix_.Swap(&other->php_class_prefix_);
+ php_namespace_.Swap(&other->php_namespace_);
swap(java_multiple_files_, other->java_multiple_files_);
swap(java_generate_equals_and_hash_, other->java_generate_equals_and_hash_);
swap(java_string_check_utf8_, other->java_string_check_utf8_);
@@ -8815,19 +9922,797 @@ void FileOptions::InternalSwap(FileOptions* other) {
swap(optimize_for_, other->optimize_for_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata FileOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// FileOptions
-// ===================================================================
+// optional string java_package = 1;
+bool FileOptions::has_java_package() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void FileOptions::set_has_java_package() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void FileOptions::clear_has_java_package() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void FileOptions::clear_java_package() {
+ java_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_java_package();
+}
+const ::std::string& FileOptions::java_package() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_package)
+ return java_package_.GetNoArena();
+}
+void FileOptions::set_java_package(const ::std::string& value) {
+ set_has_java_package();
+ java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package)
+}
+#if LANG_CXX11
+void FileOptions::set_java_package(::std::string&& value) {
+ set_has_java_package();
+ java_package_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_package)
+}
+#endif
+void FileOptions::set_java_package(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_java_package();
+ java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_package)
+}
+void FileOptions::set_java_package(const char* value, size_t size) {
+ set_has_java_package();
+ java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_package)
+}
+::std::string* FileOptions::mutable_java_package() {
+ set_has_java_package();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package)
+ return java_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_java_package() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package)
+ clear_has_java_package();
+ return java_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_java_package(::std::string* java_package) {
+ if (java_package != NULL) {
+ set_has_java_package();
+ } else {
+ clear_has_java_package();
+ }
+ java_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_package);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package)
+}
-void MessageOptions::InitAsDefaultInstance() {
+// optional string java_outer_classname = 8;
+bool FileOptions::has_java_outer_classname() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void FileOptions::set_has_java_outer_classname() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void FileOptions::clear_has_java_outer_classname() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void FileOptions::clear_java_outer_classname() {
+ java_outer_classname_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_java_outer_classname();
+}
+const ::std::string& FileOptions::java_outer_classname() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_outer_classname)
+ return java_outer_classname_.GetNoArena();
+}
+void FileOptions::set_java_outer_classname(const ::std::string& value) {
+ set_has_java_outer_classname();
+ java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname)
+}
+#if LANG_CXX11
+void FileOptions::set_java_outer_classname(::std::string&& value) {
+ set_has_java_outer_classname();
+ java_outer_classname_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_outer_classname)
+}
+#endif
+void FileOptions::set_java_outer_classname(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_java_outer_classname();
+ java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_outer_classname)
+}
+void FileOptions::set_java_outer_classname(const char* value, size_t size) {
+ set_has_java_outer_classname();
+ java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_outer_classname)
+}
+::std::string* FileOptions::mutable_java_outer_classname() {
+ set_has_java_outer_classname();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname)
+ return java_outer_classname_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_java_outer_classname() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname)
+ clear_has_java_outer_classname();
+ return java_outer_classname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_java_outer_classname(::std::string* java_outer_classname) {
+ if (java_outer_classname != NULL) {
+ set_has_java_outer_classname();
+ } else {
+ clear_has_java_outer_classname();
+ }
+ java_outer_classname_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_outer_classname);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname)
+}
+
+// optional bool java_multiple_files = 10 [default = false];
+bool FileOptions::has_java_multiple_files() const {
+ return (_has_bits_[0] & 0x00000100u) != 0;
+}
+void FileOptions::set_has_java_multiple_files() {
+ _has_bits_[0] |= 0x00000100u;
+}
+void FileOptions::clear_has_java_multiple_files() {
+ _has_bits_[0] &= ~0x00000100u;
+}
+void FileOptions::clear_java_multiple_files() {
+ java_multiple_files_ = false;
+ clear_has_java_multiple_files();
+}
+bool FileOptions::java_multiple_files() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_multiple_files)
+ return java_multiple_files_;
+}
+void FileOptions::set_java_multiple_files(bool value) {
+ set_has_java_multiple_files();
+ java_multiple_files_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_multiple_files)
+}
+
+// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
+bool FileOptions::has_java_generate_equals_and_hash() const {
+ return (_has_bits_[0] & 0x00000200u) != 0;
+}
+void FileOptions::set_has_java_generate_equals_and_hash() {
+ _has_bits_[0] |= 0x00000200u;
+}
+void FileOptions::clear_has_java_generate_equals_and_hash() {
+ _has_bits_[0] &= ~0x00000200u;
+}
+void FileOptions::clear_java_generate_equals_and_hash() {
+ java_generate_equals_and_hash_ = false;
+ clear_has_java_generate_equals_and_hash();
+}
+bool FileOptions::java_generate_equals_and_hash() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generate_equals_and_hash)
+ return java_generate_equals_and_hash_;
+}
+void FileOptions::set_java_generate_equals_and_hash(bool value) {
+ set_has_java_generate_equals_and_hash();
+ java_generate_equals_and_hash_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generate_equals_and_hash)
+}
+
+// optional bool java_string_check_utf8 = 27 [default = false];
+bool FileOptions::has_java_string_check_utf8() const {
+ return (_has_bits_[0] & 0x00000400u) != 0;
+}
+void FileOptions::set_has_java_string_check_utf8() {
+ _has_bits_[0] |= 0x00000400u;
+}
+void FileOptions::clear_has_java_string_check_utf8() {
+ _has_bits_[0] &= ~0x00000400u;
+}
+void FileOptions::clear_java_string_check_utf8() {
+ java_string_check_utf8_ = false;
+ clear_has_java_string_check_utf8();
+}
+bool FileOptions::java_string_check_utf8() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_string_check_utf8)
+ return java_string_check_utf8_;
+}
+void FileOptions::set_java_string_check_utf8(bool value) {
+ set_has_java_string_check_utf8();
+ java_string_check_utf8_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_string_check_utf8)
+}
+
+// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
+bool FileOptions::has_optimize_for() const {
+ return (_has_bits_[0] & 0x00020000u) != 0;
+}
+void FileOptions::set_has_optimize_for() {
+ _has_bits_[0] |= 0x00020000u;
+}
+void FileOptions::clear_has_optimize_for() {
+ _has_bits_[0] &= ~0x00020000u;
+}
+void FileOptions::clear_optimize_for() {
+ optimize_for_ = 1;
+ clear_has_optimize_for();
+}
+::google::protobuf::FileOptions_OptimizeMode FileOptions::optimize_for() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.optimize_for)
+ return static_cast< ::google::protobuf::FileOptions_OptimizeMode >(optimize_for_);
+}
+void FileOptions::set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value) {
+ assert(::google::protobuf::FileOptions_OptimizeMode_IsValid(value));
+ set_has_optimize_for();
+ optimize_for_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.optimize_for)
+}
+
+// optional string go_package = 11;
+bool FileOptions::has_go_package() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void FileOptions::set_has_go_package() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void FileOptions::clear_has_go_package() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void FileOptions::clear_go_package() {
+ go_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_go_package();
+}
+const ::std::string& FileOptions::go_package() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.go_package)
+ return go_package_.GetNoArena();
+}
+void FileOptions::set_go_package(const ::std::string& value) {
+ set_has_go_package();
+ go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package)
+}
+#if LANG_CXX11
+void FileOptions::set_go_package(::std::string&& value) {
+ set_has_go_package();
+ go_package_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.go_package)
+}
+#endif
+void FileOptions::set_go_package(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_go_package();
+ go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.go_package)
+}
+void FileOptions::set_go_package(const char* value, size_t size) {
+ set_has_go_package();
+ go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.go_package)
+}
+::std::string* FileOptions::mutable_go_package() {
+ set_has_go_package();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package)
+ return go_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_go_package() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package)
+ clear_has_go_package();
+ return go_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_go_package(::std::string* go_package) {
+ if (go_package != NULL) {
+ set_has_go_package();
+ } else {
+ clear_has_go_package();
+ }
+ go_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), go_package);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package)
+}
+
+// optional bool cc_generic_services = 16 [default = false];
+bool FileOptions::has_cc_generic_services() const {
+ return (_has_bits_[0] & 0x00000800u) != 0;
+}
+void FileOptions::set_has_cc_generic_services() {
+ _has_bits_[0] |= 0x00000800u;
+}
+void FileOptions::clear_has_cc_generic_services() {
+ _has_bits_[0] &= ~0x00000800u;
+}
+void FileOptions::clear_cc_generic_services() {
+ cc_generic_services_ = false;
+ clear_has_cc_generic_services();
+}
+bool FileOptions::cc_generic_services() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_generic_services)
+ return cc_generic_services_;
+}
+void FileOptions::set_cc_generic_services(bool value) {
+ set_has_cc_generic_services();
+ cc_generic_services_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_generic_services)
+}
+
+// optional bool java_generic_services = 17 [default = false];
+bool FileOptions::has_java_generic_services() const {
+ return (_has_bits_[0] & 0x00001000u) != 0;
+}
+void FileOptions::set_has_java_generic_services() {
+ _has_bits_[0] |= 0x00001000u;
+}
+void FileOptions::clear_has_java_generic_services() {
+ _has_bits_[0] &= ~0x00001000u;
+}
+void FileOptions::clear_java_generic_services() {
+ java_generic_services_ = false;
+ clear_has_java_generic_services();
+}
+bool FileOptions::java_generic_services() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generic_services)
+ return java_generic_services_;
+}
+void FileOptions::set_java_generic_services(bool value) {
+ set_has_java_generic_services();
+ java_generic_services_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generic_services)
+}
+
+// optional bool py_generic_services = 18 [default = false];
+bool FileOptions::has_py_generic_services() const {
+ return (_has_bits_[0] & 0x00002000u) != 0;
+}
+void FileOptions::set_has_py_generic_services() {
+ _has_bits_[0] |= 0x00002000u;
+}
+void FileOptions::clear_has_py_generic_services() {
+ _has_bits_[0] &= ~0x00002000u;
+}
+void FileOptions::clear_py_generic_services() {
+ py_generic_services_ = false;
+ clear_has_py_generic_services();
+}
+bool FileOptions::py_generic_services() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.py_generic_services)
+ return py_generic_services_;
+}
+void FileOptions::set_py_generic_services(bool value) {
+ set_has_py_generic_services();
+ py_generic_services_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services)
+}
+
+// optional bool php_generic_services = 19 [default = false];
+bool FileOptions::has_php_generic_services() const {
+ return (_has_bits_[0] & 0x00004000u) != 0;
+}
+void FileOptions::set_has_php_generic_services() {
+ _has_bits_[0] |= 0x00004000u;
}
+void FileOptions::clear_has_php_generic_services() {
+ _has_bits_[0] &= ~0x00004000u;
+}
+void FileOptions::clear_php_generic_services() {
+ php_generic_services_ = false;
+ clear_has_php_generic_services();
+}
+bool FileOptions::php_generic_services() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_generic_services)
+ return php_generic_services_;
+}
+void FileOptions::set_php_generic_services(bool value) {
+ set_has_php_generic_services();
+ php_generic_services_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_generic_services)
+}
+
+// optional bool deprecated = 23 [default = false];
+bool FileOptions::has_deprecated() const {
+ return (_has_bits_[0] & 0x00008000u) != 0;
+}
+void FileOptions::set_has_deprecated() {
+ _has_bits_[0] |= 0x00008000u;
+}
+void FileOptions::clear_has_deprecated() {
+ _has_bits_[0] &= ~0x00008000u;
+}
+void FileOptions::clear_deprecated() {
+ deprecated_ = false;
+ clear_has_deprecated();
+}
+bool FileOptions::deprecated() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.deprecated)
+ return deprecated_;
+}
+void FileOptions::set_deprecated(bool value) {
+ set_has_deprecated();
+ deprecated_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.deprecated)
+}
+
+// optional bool cc_enable_arenas = 31 [default = false];
+bool FileOptions::has_cc_enable_arenas() const {
+ return (_has_bits_[0] & 0x00010000u) != 0;
+}
+void FileOptions::set_has_cc_enable_arenas() {
+ _has_bits_[0] |= 0x00010000u;
+}
+void FileOptions::clear_has_cc_enable_arenas() {
+ _has_bits_[0] &= ~0x00010000u;
+}
+void FileOptions::clear_cc_enable_arenas() {
+ cc_enable_arenas_ = false;
+ clear_has_cc_enable_arenas();
+}
+bool FileOptions::cc_enable_arenas() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_enable_arenas)
+ return cc_enable_arenas_;
+}
+void FileOptions::set_cc_enable_arenas(bool value) {
+ set_has_cc_enable_arenas();
+ cc_enable_arenas_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_enable_arenas)
+}
+
+// optional string objc_class_prefix = 36;
+bool FileOptions::has_objc_class_prefix() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+void FileOptions::set_has_objc_class_prefix() {
+ _has_bits_[0] |= 0x00000008u;
+}
+void FileOptions::clear_has_objc_class_prefix() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+void FileOptions::clear_objc_class_prefix() {
+ objc_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_objc_class_prefix();
+}
+const ::std::string& FileOptions::objc_class_prefix() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.objc_class_prefix)
+ return objc_class_prefix_.GetNoArena();
+}
+void FileOptions::set_objc_class_prefix(const ::std::string& value) {
+ set_has_objc_class_prefix();
+ objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix)
+}
+#if LANG_CXX11
+void FileOptions::set_objc_class_prefix(::std::string&& value) {
+ set_has_objc_class_prefix();
+ objc_class_prefix_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.objc_class_prefix)
+}
+#endif
+void FileOptions::set_objc_class_prefix(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_objc_class_prefix();
+ objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.objc_class_prefix)
+}
+void FileOptions::set_objc_class_prefix(const char* value, size_t size) {
+ set_has_objc_class_prefix();
+ objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.objc_class_prefix)
+}
+::std::string* FileOptions::mutable_objc_class_prefix() {
+ set_has_objc_class_prefix();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.objc_class_prefix)
+ return objc_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_objc_class_prefix() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix)
+ clear_has_objc_class_prefix();
+ return objc_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_class_prefix) {
+ if (objc_class_prefix != NULL) {
+ set_has_objc_class_prefix();
+ } else {
+ clear_has_objc_class_prefix();
+ }
+ objc_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), objc_class_prefix);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
+}
+
+// optional string csharp_namespace = 37;
+bool FileOptions::has_csharp_namespace() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+void FileOptions::set_has_csharp_namespace() {
+ _has_bits_[0] |= 0x00000010u;
+}
+void FileOptions::clear_has_csharp_namespace() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+void FileOptions::clear_csharp_namespace() {
+ csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_csharp_namespace();
+}
+const ::std::string& FileOptions::csharp_namespace() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace)
+ return csharp_namespace_.GetNoArena();
+}
+void FileOptions::set_csharp_namespace(const ::std::string& value) {
+ set_has_csharp_namespace();
+ csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace)
+}
+#if LANG_CXX11
+void FileOptions::set_csharp_namespace(::std::string&& value) {
+ set_has_csharp_namespace();
+ csharp_namespace_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.csharp_namespace)
+}
+#endif
+void FileOptions::set_csharp_namespace(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_csharp_namespace();
+ csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace)
+}
+void FileOptions::set_csharp_namespace(const char* value, size_t size) {
+ set_has_csharp_namespace();
+ csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace)
+}
+::std::string* FileOptions::mutable_csharp_namespace() {
+ set_has_csharp_namespace();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace)
+ return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_csharp_namespace() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace)
+ clear_has_csharp_namespace();
+ return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) {
+ if (csharp_namespace != NULL) {
+ set_has_csharp_namespace();
+ } else {
+ clear_has_csharp_namespace();
+ }
+ csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace)
+}
+
+// optional string swift_prefix = 39;
+bool FileOptions::has_swift_prefix() const {
+ return (_has_bits_[0] & 0x00000020u) != 0;
+}
+void FileOptions::set_has_swift_prefix() {
+ _has_bits_[0] |= 0x00000020u;
+}
+void FileOptions::clear_has_swift_prefix() {
+ _has_bits_[0] &= ~0x00000020u;
+}
+void FileOptions::clear_swift_prefix() {
+ swift_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_swift_prefix();
+}
+const ::std::string& FileOptions::swift_prefix() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.swift_prefix)
+ return swift_prefix_.GetNoArena();
+}
+void FileOptions::set_swift_prefix(const ::std::string& value) {
+ set_has_swift_prefix();
+ swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix)
+}
+#if LANG_CXX11
+void FileOptions::set_swift_prefix(::std::string&& value) {
+ set_has_swift_prefix();
+ swift_prefix_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.swift_prefix)
+}
+#endif
+void FileOptions::set_swift_prefix(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_swift_prefix();
+ swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.swift_prefix)
+}
+void FileOptions::set_swift_prefix(const char* value, size_t size) {
+ set_has_swift_prefix();
+ swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.swift_prefix)
+}
+::std::string* FileOptions::mutable_swift_prefix() {
+ set_has_swift_prefix();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.swift_prefix)
+ return swift_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_swift_prefix() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.swift_prefix)
+ clear_has_swift_prefix();
+ return swift_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_swift_prefix(::std::string* swift_prefix) {
+ if (swift_prefix != NULL) {
+ set_has_swift_prefix();
+ } else {
+ clear_has_swift_prefix();
+ }
+ swift_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), swift_prefix);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix)
+}
+
+// optional string php_class_prefix = 40;
+bool FileOptions::has_php_class_prefix() const {
+ return (_has_bits_[0] & 0x00000040u) != 0;
+}
+void FileOptions::set_has_php_class_prefix() {
+ _has_bits_[0] |= 0x00000040u;
+}
+void FileOptions::clear_has_php_class_prefix() {
+ _has_bits_[0] &= ~0x00000040u;
+}
+void FileOptions::clear_php_class_prefix() {
+ php_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_php_class_prefix();
+}
+const ::std::string& FileOptions::php_class_prefix() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_class_prefix)
+ return php_class_prefix_.GetNoArena();
+}
+void FileOptions::set_php_class_prefix(const ::std::string& value) {
+ set_has_php_class_prefix();
+ php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix)
+}
+#if LANG_CXX11
+void FileOptions::set_php_class_prefix(::std::string&& value) {
+ set_has_php_class_prefix();
+ php_class_prefix_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_class_prefix)
+}
+#endif
+void FileOptions::set_php_class_prefix(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_php_class_prefix();
+ php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_class_prefix)
+}
+void FileOptions::set_php_class_prefix(const char* value, size_t size) {
+ set_has_php_class_prefix();
+ php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_class_prefix)
+}
+::std::string* FileOptions::mutable_php_class_prefix() {
+ set_has_php_class_prefix();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_class_prefix)
+ return php_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_php_class_prefix() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_class_prefix)
+ clear_has_php_class_prefix();
+ return php_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_php_class_prefix(::std::string* php_class_prefix) {
+ if (php_class_prefix != NULL) {
+ set_has_php_class_prefix();
+ } else {
+ clear_has_php_class_prefix();
+ }
+ php_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_class_prefix);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
+}
+
+// optional string php_namespace = 41;
+bool FileOptions::has_php_namespace() const {
+ return (_has_bits_[0] & 0x00000080u) != 0;
+}
+void FileOptions::set_has_php_namespace() {
+ _has_bits_[0] |= 0x00000080u;
+}
+void FileOptions::clear_has_php_namespace() {
+ _has_bits_[0] &= ~0x00000080u;
+}
+void FileOptions::clear_php_namespace() {
+ php_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_php_namespace();
+}
+const ::std::string& FileOptions::php_namespace() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace)
+ return php_namespace_.GetNoArena();
+}
+void FileOptions::set_php_namespace(const ::std::string& value) {
+ set_has_php_namespace();
+ php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace)
+}
+#if LANG_CXX11
+void FileOptions::set_php_namespace(::std::string&& value) {
+ set_has_php_namespace();
+ php_namespace_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_namespace)
+}
+#endif
+void FileOptions::set_php_namespace(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_php_namespace();
+ php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_namespace)
+}
+void FileOptions::set_php_namespace(const char* value, size_t size) {
+ set_has_php_namespace();
+ php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace)
+}
+::std::string* FileOptions::mutable_php_namespace() {
+ set_has_php_namespace();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace)
+ return php_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_php_namespace() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace)
+ clear_has_php_namespace();
+ return php_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_php_namespace(::std::string* php_namespace) {
+ if (php_namespace != NULL) {
+ set_has_php_namespace();
+ } else {
+ clear_has_php_namespace();
+ }
+ php_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace)
+}
+
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int FileOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
+}
+void FileOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
+}
+::google::protobuf::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* FileOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+FileOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileOptions.uninterpreted_option)
+ return &uninterpreted_option_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+FileOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FileOptions.uninterpreted_option)
+ return uninterpreted_option_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MessageOptions::kMessageSetWireFormatFieldNumber;
const int MessageOptions::kNoStandardDescriptorAccessorFieldNumber;
@@ -8838,25 +10723,17 @@ const int MessageOptions::kUninterpretedOptionFieldNumber;
MessageOptions::MessageOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MessageOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.MessageOptions)
}
-MessageOptions::MessageOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MessageOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.MessageOptions)
-}
MessageOptions::MessageOptions(const MessageOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
@@ -8867,6 +10744,7 @@ MessageOptions::MessageOptions(const MessageOptions& from)
}
void MessageOptions::SharedCtor() {
+ _cached_size_ = 0;
::memset(&message_set_wire_format_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&map_entry_) -
reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_));
@@ -8878,28 +10756,30 @@ MessageOptions::~MessageOptions() {
}
void MessageOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void MessageOptions::ArenaDtor(void* object) {
- MessageOptions* _this = reinterpret_cast< MessageOptions* >(object);
- (void)_this;
-}
-void MessageOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void MessageOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MessageOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const MessageOptions& MessageOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MessageOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+MessageOptions* MessageOptions::New(::google::protobuf::Arena* arena) const {
+ MessageOptions* n = new MessageOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void MessageOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions)
@@ -8909,9 +10789,12 @@ void MessageOptions::Clear() {
_extensions_.Clear();
uninterpreted_option_.Clear();
- ::memset(&message_set_wire_format_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&map_entry_) -
- reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_));
+ cached_has_bits = _has_bits_[0];
+ if (cached_has_bits & 15u) {
+ ::memset(&message_set_wire_format_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&map_entry_) -
+ reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_));
+ }
_has_bits_.Clear();
_internal_metadata_.Clear();
}
@@ -8922,7 +10805,7 @@ bool MessageOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.MessageOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -8986,7 +10869,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -9051,9 +10934,7 @@ 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)
@@ -9099,7 +10980,7 @@ void MessageOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -9132,7 +11013,7 @@ size_t MessageOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
@@ -9160,7 +11041,9 @@ size_t MessageOptions::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -9231,45 +11114,159 @@ bool MessageOptions::IsInitialized() const {
void MessageOptions::Swap(MessageOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- MessageOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void MessageOptions::UnsafeArenaSwap(MessageOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void MessageOptions::InternalSwap(MessageOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&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_);
swap(map_entry_, other->map_entry_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata MessageOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// MessageOptions
-// ===================================================================
+// optional bool message_set_wire_format = 1 [default = false];
+bool MessageOptions::has_message_set_wire_format() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void MessageOptions::set_has_message_set_wire_format() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void MessageOptions::clear_has_message_set_wire_format() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void MessageOptions::clear_message_set_wire_format() {
+ message_set_wire_format_ = false;
+ clear_has_message_set_wire_format();
+}
+bool MessageOptions::message_set_wire_format() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.message_set_wire_format)
+ return message_set_wire_format_;
+}
+void MessageOptions::set_message_set_wire_format(bool value) {
+ set_has_message_set_wire_format();
+ message_set_wire_format_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.message_set_wire_format)
+}
+
+// optional bool no_standard_descriptor_accessor = 2 [default = false];
+bool MessageOptions::has_no_standard_descriptor_accessor() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void MessageOptions::set_has_no_standard_descriptor_accessor() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void MessageOptions::clear_has_no_standard_descriptor_accessor() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void MessageOptions::clear_no_standard_descriptor_accessor() {
+ no_standard_descriptor_accessor_ = false;
+ clear_has_no_standard_descriptor_accessor();
+}
+bool MessageOptions::no_standard_descriptor_accessor() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.no_standard_descriptor_accessor)
+ return no_standard_descriptor_accessor_;
+}
+void MessageOptions::set_no_standard_descriptor_accessor(bool value) {
+ set_has_no_standard_descriptor_accessor();
+ no_standard_descriptor_accessor_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.no_standard_descriptor_accessor)
+}
-void FieldOptions::InitAsDefaultInstance() {
+// optional bool deprecated = 3 [default = false];
+bool MessageOptions::has_deprecated() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void MessageOptions::set_has_deprecated() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void MessageOptions::clear_has_deprecated() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void MessageOptions::clear_deprecated() {
+ deprecated_ = false;
+ clear_has_deprecated();
+}
+bool MessageOptions::deprecated() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.deprecated)
+ return deprecated_;
+}
+void MessageOptions::set_deprecated(bool value) {
+ set_has_deprecated();
+ deprecated_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.deprecated)
+}
+
+// optional bool map_entry = 7;
+bool MessageOptions::has_map_entry() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+void MessageOptions::set_has_map_entry() {
+ _has_bits_[0] |= 0x00000008u;
+}
+void MessageOptions::clear_has_map_entry() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+void MessageOptions::clear_map_entry() {
+ map_entry_ = false;
+ clear_has_map_entry();
+}
+bool MessageOptions::map_entry() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.map_entry)
+ return map_entry_;
+}
+void MessageOptions::set_map_entry(bool value) {
+ set_has_map_entry();
+ map_entry_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.map_entry)
+}
+
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int MessageOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
+}
+void MessageOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
}
+::google::protobuf::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MessageOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* MessageOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+MessageOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.MessageOptions.uninterpreted_option)
+ return &uninterpreted_option_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+MessageOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.MessageOptions.uninterpreted_option)
+ return uninterpreted_option_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FieldOptions::kCtypeFieldNumber;
const int FieldOptions::kPackedFieldNumber;
@@ -9282,25 +11279,17 @@ const int FieldOptions::kUninterpretedOptionFieldNumber;
FieldOptions::FieldOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FieldOptions)
}
-FieldOptions::FieldOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldOptions)
-}
FieldOptions::FieldOptions(const FieldOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
@@ -9311,6 +11300,7 @@ FieldOptions::FieldOptions(const FieldOptions& from)
}
void FieldOptions::SharedCtor() {
+ _cached_size_ = 0;
::memset(&ctype_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&jstype_) -
reinterpret_cast<char*>(&ctype_)) + sizeof(jstype_));
@@ -9322,28 +11312,30 @@ FieldOptions::~FieldOptions() {
}
void FieldOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void FieldOptions::ArenaDtor(void* object) {
- FieldOptions* _this = reinterpret_cast< FieldOptions* >(object);
- (void)_this;
-}
-void FieldOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void FieldOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FieldOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FieldOptions& FieldOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_FieldOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+FieldOptions* FieldOptions::New(::google::protobuf::Arena* arena) const {
+ FieldOptions* n = new FieldOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void FieldOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions)
@@ -9369,7 +11361,7 @@ bool FieldOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FieldOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -9473,7 +11465,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -9550,9 +11542,7 @@ 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)
@@ -9610,7 +11600,7 @@ void FieldOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -9643,7 +11633,7 @@ size_t FieldOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
@@ -9683,7 +11673,9 @@ size_t FieldOptions::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -9760,26 +11752,11 @@ bool FieldOptions::IsInitialized() const {
void FieldOptions::Swap(FieldOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- FieldOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void FieldOptions::UnsafeArenaSwap(FieldOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void FieldOptions::InternalSwap(FieldOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(ctype_, other->ctype_);
swap(packed_, other->packed_);
swap(lazy_, other->lazy_);
@@ -9788,44 +11765,215 @@ void FieldOptions::InternalSwap(FieldOptions* other) {
swap(jstype_, other->jstype_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata FieldOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// FieldOptions
-// ===================================================================
+// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
+bool FieldOptions::has_ctype() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void FieldOptions::set_has_ctype() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void FieldOptions::clear_has_ctype() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void FieldOptions::clear_ctype() {
+ ctype_ = 0;
+ clear_has_ctype();
+}
+::google::protobuf::FieldOptions_CType FieldOptions::ctype() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.ctype)
+ return static_cast< ::google::protobuf::FieldOptions_CType >(ctype_);
+}
+void FieldOptions::set_ctype(::google::protobuf::FieldOptions_CType value) {
+ assert(::google::protobuf::FieldOptions_CType_IsValid(value));
+ set_has_ctype();
+ ctype_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.ctype)
+}
-void OneofOptions::InitAsDefaultInstance() {
+// optional bool packed = 2;
+bool FieldOptions::has_packed() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void FieldOptions::set_has_packed() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void FieldOptions::clear_has_packed() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void FieldOptions::clear_packed() {
+ packed_ = false;
+ clear_has_packed();
+}
+bool FieldOptions::packed() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.packed)
+ return packed_;
+}
+void FieldOptions::set_packed(bool value) {
+ set_has_packed();
+ packed_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.packed)
+}
+
+// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
+bool FieldOptions::has_jstype() const {
+ return (_has_bits_[0] & 0x00000020u) != 0;
+}
+void FieldOptions::set_has_jstype() {
+ _has_bits_[0] |= 0x00000020u;
}
+void FieldOptions::clear_has_jstype() {
+ _has_bits_[0] &= ~0x00000020u;
+}
+void FieldOptions::clear_jstype() {
+ jstype_ = 0;
+ clear_has_jstype();
+}
+::google::protobuf::FieldOptions_JSType FieldOptions::jstype() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.jstype)
+ return static_cast< ::google::protobuf::FieldOptions_JSType >(jstype_);
+}
+void FieldOptions::set_jstype(::google::protobuf::FieldOptions_JSType value) {
+ assert(::google::protobuf::FieldOptions_JSType_IsValid(value));
+ set_has_jstype();
+ jstype_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.jstype)
+}
+
+// optional bool lazy = 5 [default = false];
+bool FieldOptions::has_lazy() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+void FieldOptions::set_has_lazy() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void FieldOptions::clear_has_lazy() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void FieldOptions::clear_lazy() {
+ lazy_ = false;
+ clear_has_lazy();
+}
+bool FieldOptions::lazy() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.lazy)
+ return lazy_;
+}
+void FieldOptions::set_lazy(bool value) {
+ set_has_lazy();
+ lazy_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.lazy)
+}
+
+// optional bool deprecated = 3 [default = false];
+bool FieldOptions::has_deprecated() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+void FieldOptions::set_has_deprecated() {
+ _has_bits_[0] |= 0x00000008u;
+}
+void FieldOptions::clear_has_deprecated() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+void FieldOptions::clear_deprecated() {
+ deprecated_ = false;
+ clear_has_deprecated();
+}
+bool FieldOptions::deprecated() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.deprecated)
+ return deprecated_;
+}
+void FieldOptions::set_deprecated(bool value) {
+ set_has_deprecated();
+ deprecated_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.deprecated)
+}
+
+// optional bool weak = 10 [default = false];
+bool FieldOptions::has_weak() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+void FieldOptions::set_has_weak() {
+ _has_bits_[0] |= 0x00000010u;
+}
+void FieldOptions::clear_has_weak() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+void FieldOptions::clear_weak() {
+ weak_ = false;
+ clear_has_weak();
+}
+bool FieldOptions::weak() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.weak)
+ return weak_;
+}
+void FieldOptions::set_weak(bool value) {
+ set_has_weak();
+ weak_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.weak)
+}
+
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int FieldOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
+}
+void FieldOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
+}
+::google::protobuf::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* FieldOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+FieldOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.uninterpreted_option)
+ return &uninterpreted_option_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+FieldOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FieldOptions.uninterpreted_option)
+ return uninterpreted_option_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int OneofOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
OneofOptions::OneofOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_OneofOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.OneofOptions)
}
-OneofOptions::OneofOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_OneofOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.OneofOptions)
-}
OneofOptions::OneofOptions(const OneofOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
@@ -9833,6 +11981,7 @@ OneofOptions::OneofOptions(const OneofOptions& from)
}
void OneofOptions::SharedCtor() {
+ _cached_size_ = 0;
}
OneofOptions::~OneofOptions() {
@@ -9841,28 +11990,30 @@ OneofOptions::~OneofOptions() {
}
void OneofOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void OneofOptions::ArenaDtor(void* object) {
- OneofOptions* _this = reinterpret_cast< OneofOptions* >(object);
- (void)_this;
-}
-void OneofOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void OneofOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* OneofOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const OneofOptions& OneofOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_OneofOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+OneofOptions* OneofOptions::New(::google::protobuf::Arena* arena) const {
+ OneofOptions* n = new OneofOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void OneofOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions)
@@ -9882,7 +12033,7 @@ bool OneofOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.OneofOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -9890,7 +12041,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -9934,9 +12085,7 @@ 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)
@@ -9961,7 +12110,7 @@ void OneofOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -9994,13 +12143,15 @@ size_t OneofOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -10055,41 +12206,59 @@ bool OneofOptions::IsInitialized() const {
void OneofOptions::Swap(OneofOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- OneofOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void OneofOptions::UnsafeArenaSwap(OneofOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void OneofOptions::InternalSwap(OneofOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata OneofOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// OneofOptions
+
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int OneofOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
+}
+void OneofOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
+}
+::google::protobuf::UninterpretedOption* OneofOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.OneofOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* OneofOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+OneofOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.OneofOptions.uninterpreted_option)
+ return &uninterpreted_option_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+OneofOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.OneofOptions.uninterpreted_option)
+ return uninterpreted_option_;
}
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void EnumOptions::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumOptions::kAllowAliasFieldNumber;
const int EnumOptions::kDeprecatedFieldNumber;
@@ -10098,25 +12267,17 @@ const int EnumOptions::kUninterpretedOptionFieldNumber;
EnumOptions::EnumOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumOptions)
}
-EnumOptions::EnumOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumOptions)
-}
EnumOptions::EnumOptions(const EnumOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
@@ -10127,6 +12288,7 @@ EnumOptions::EnumOptions(const EnumOptions& from)
}
void EnumOptions::SharedCtor() {
+ _cached_size_ = 0;
::memset(&allow_alias_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&deprecated_) -
reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_));
@@ -10138,28 +12300,30 @@ EnumOptions::~EnumOptions() {
}
void EnumOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void EnumOptions::ArenaDtor(void* object) {
- EnumOptions* _this = reinterpret_cast< EnumOptions* >(object);
- (void)_this;
-}
-void EnumOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void EnumOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumOptions& EnumOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+EnumOptions* EnumOptions::New(::google::protobuf::Arena* arena) const {
+ EnumOptions* n = new EnumOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void EnumOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions)
@@ -10169,9 +12333,12 @@ void EnumOptions::Clear() {
_extensions_.Clear();
uninterpreted_option_.Clear();
- ::memset(&allow_alias_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&deprecated_) -
- reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_));
+ cached_has_bits = _has_bits_[0];
+ if (cached_has_bits & 3u) {
+ ::memset(&allow_alias_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&deprecated_) -
+ reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_));
+ }
_has_bits_.Clear();
_internal_metadata_.Clear();
}
@@ -10182,7 +12349,7 @@ bool EnumOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -10218,7 +12385,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -10273,9 +12440,7 @@ 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)
@@ -10311,7 +12476,7 @@ void EnumOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -10344,7 +12509,7 @@ size_t EnumOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
@@ -10362,7 +12527,9 @@ size_t EnumOptions::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -10427,43 +12594,109 @@ bool EnumOptions::IsInitialized() const {
void EnumOptions::Swap(EnumOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- EnumOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void EnumOptions::UnsafeArenaSwap(EnumOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void EnumOptions::InternalSwap(EnumOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(allow_alias_, other->allow_alias_);
swap(deprecated_, other->deprecated_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata EnumOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// EnumOptions
-// ===================================================================
+// optional bool allow_alias = 2;
+bool EnumOptions::has_allow_alias() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void EnumOptions::set_has_allow_alias() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void EnumOptions::clear_has_allow_alias() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void EnumOptions::clear_allow_alias() {
+ allow_alias_ = false;
+ clear_has_allow_alias();
+}
+bool EnumOptions::allow_alias() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.allow_alias)
+ return allow_alias_;
+}
+void EnumOptions::set_allow_alias(bool value) {
+ set_has_allow_alias();
+ allow_alias_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.allow_alias)
+}
+
+// optional bool deprecated = 3 [default = false];
+bool EnumOptions::has_deprecated() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void EnumOptions::set_has_deprecated() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void EnumOptions::clear_has_deprecated() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void EnumOptions::clear_deprecated() {
+ deprecated_ = false;
+ clear_has_deprecated();
+}
+bool EnumOptions::deprecated() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.deprecated)
+ return deprecated_;
+}
+void EnumOptions::set_deprecated(bool value) {
+ set_has_deprecated();
+ deprecated_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated)
+}
-void EnumValueOptions::InitAsDefaultInstance() {
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int EnumOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
}
+void EnumOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
+}
+::google::protobuf::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* EnumOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+EnumOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumOptions.uninterpreted_option)
+ return &uninterpreted_option_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+EnumOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.EnumOptions.uninterpreted_option)
+ return uninterpreted_option_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumValueOptions::kDeprecatedFieldNumber;
const int EnumValueOptions::kUninterpretedOptionFieldNumber;
@@ -10471,25 +12704,17 @@ const int EnumValueOptions::kUninterpretedOptionFieldNumber;
EnumValueOptions::EnumValueOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumValueOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumValueOptions)
}
-EnumValueOptions::EnumValueOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumValueOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValueOptions)
-}
EnumValueOptions::EnumValueOptions(const EnumValueOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
@@ -10498,6 +12723,7 @@ EnumValueOptions::EnumValueOptions(const EnumValueOptions& from)
}
void EnumValueOptions::SharedCtor() {
+ _cached_size_ = 0;
deprecated_ = false;
}
@@ -10507,28 +12733,30 @@ EnumValueOptions::~EnumValueOptions() {
}
void EnumValueOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void EnumValueOptions::ArenaDtor(void* object) {
- EnumValueOptions* _this = reinterpret_cast< EnumValueOptions* >(object);
- (void)_this;
-}
-void EnumValueOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void EnumValueOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumValueOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumValueOptions& EnumValueOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_EnumValueOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+EnumValueOptions* EnumValueOptions::New(::google::protobuf::Arena* arena) const {
+ EnumValueOptions* n = new EnumValueOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void EnumValueOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions)
@@ -10549,7 +12777,7 @@ bool EnumValueOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumValueOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -10571,7 +12799,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -10621,9 +12849,7 @@ 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)
@@ -10654,7 +12880,7 @@ void EnumValueOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -10687,7 +12913,7 @@ size_t EnumValueOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
@@ -10698,7 +12924,9 @@ size_t EnumValueOptions::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -10756,42 +12984,84 @@ bool EnumValueOptions::IsInitialized() const {
void EnumValueOptions::Swap(EnumValueOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- EnumValueOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void EnumValueOptions::UnsafeArenaSwap(EnumValueOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void EnumValueOptions::InternalSwap(EnumValueOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(deprecated_, other->deprecated_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata EnumValueOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// EnumValueOptions
-// ===================================================================
+// optional bool deprecated = 1 [default = false];
+bool EnumValueOptions::has_deprecated() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void EnumValueOptions::set_has_deprecated() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void EnumValueOptions::clear_has_deprecated() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void EnumValueOptions::clear_deprecated() {
+ deprecated_ = false;
+ clear_has_deprecated();
+}
+bool EnumValueOptions::deprecated() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.deprecated)
+ return deprecated_;
+}
+void EnumValueOptions::set_deprecated(bool value) {
+ set_has_deprecated();
+ deprecated_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumValueOptions.deprecated)
+}
-void ServiceOptions::InitAsDefaultInstance() {
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int EnumValueOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
+}
+void EnumValueOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
}
+::google::protobuf::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+EnumValueOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValueOptions.uninterpreted_option)
+ return &uninterpreted_option_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+EnumValueOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.EnumValueOptions.uninterpreted_option)
+ return uninterpreted_option_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ServiceOptions::kDeprecatedFieldNumber;
const int ServiceOptions::kUninterpretedOptionFieldNumber;
@@ -10799,25 +13069,17 @@ const int ServiceOptions::kUninterpretedOptionFieldNumber;
ServiceOptions::ServiceOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ServiceOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.ServiceOptions)
}
-ServiceOptions::ServiceOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ServiceOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.ServiceOptions)
-}
ServiceOptions::ServiceOptions(const ServiceOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
@@ -10826,6 +13088,7 @@ ServiceOptions::ServiceOptions(const ServiceOptions& from)
}
void ServiceOptions::SharedCtor() {
+ _cached_size_ = 0;
deprecated_ = false;
}
@@ -10835,28 +13098,30 @@ ServiceOptions::~ServiceOptions() {
}
void ServiceOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void ServiceOptions::ArenaDtor(void* object) {
- ServiceOptions* _this = reinterpret_cast< ServiceOptions* >(object);
- (void)_this;
-}
-void ServiceOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void ServiceOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ServiceOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const ServiceOptions& ServiceOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_ServiceOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+ServiceOptions* ServiceOptions::New(::google::protobuf::Arena* arena) const {
+ ServiceOptions* n = new ServiceOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void ServiceOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions)
@@ -10877,7 +13142,7 @@ bool ServiceOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.ServiceOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -10899,7 +13164,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -10949,9 +13214,7 @@ 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)
@@ -10982,7 +13245,7 @@ void ServiceOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -11015,7 +13278,7 @@ size_t ServiceOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
@@ -11026,7 +13289,9 @@ size_t ServiceOptions::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -11084,42 +13349,84 @@ bool ServiceOptions::IsInitialized() const {
void ServiceOptions::Swap(ServiceOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- ServiceOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void ServiceOptions::UnsafeArenaSwap(ServiceOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void ServiceOptions::InternalSwap(ServiceOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(deprecated_, other->deprecated_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata ServiceOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// ServiceOptions
-// ===================================================================
+// optional bool deprecated = 33 [default = false];
+bool ServiceOptions::has_deprecated() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void ServiceOptions::set_has_deprecated() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void ServiceOptions::clear_has_deprecated() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void ServiceOptions::clear_deprecated() {
+ deprecated_ = false;
+ clear_has_deprecated();
+}
+bool ServiceOptions::deprecated() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.deprecated)
+ return deprecated_;
+}
+void ServiceOptions::set_deprecated(bool value) {
+ set_has_deprecated();
+ deprecated_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.ServiceOptions.deprecated)
+}
-void MethodOptions::InitAsDefaultInstance() {
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int ServiceOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
+}
+void ServiceOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
+}
+::google::protobuf::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* ServiceOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+ServiceOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceOptions.uninterpreted_option)
+ return &uninterpreted_option_;
}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+ServiceOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.ServiceOptions.uninterpreted_option)
+ return uninterpreted_option_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MethodOptions::kDeprecatedFieldNumber;
const int MethodOptions::kIdempotencyLevelFieldNumber;
@@ -11128,25 +13435,17 @@ const int MethodOptions::kUninterpretedOptionFieldNumber;
MethodOptions::MethodOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MethodOptions.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.MethodOptions)
}
-MethodOptions::MethodOptions(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _extensions_(arena),
- _internal_metadata_(arena),
- uninterpreted_option_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MethodOptions.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.MethodOptions)
-}
MethodOptions::MethodOptions(const MethodOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
@@ -11157,6 +13456,7 @@ MethodOptions::MethodOptions(const MethodOptions& from)
}
void MethodOptions::SharedCtor() {
+ _cached_size_ = 0;
::memset(&deprecated_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&idempotency_level_) -
reinterpret_cast<char*>(&deprecated_)) + sizeof(idempotency_level_));
@@ -11168,28 +13468,30 @@ MethodOptions::~MethodOptions() {
}
void MethodOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void MethodOptions::ArenaDtor(void* object) {
- MethodOptions* _this = reinterpret_cast< MethodOptions* >(object);
- (void)_this;
-}
-void MethodOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void MethodOptions::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MethodOptions::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const MethodOptions& MethodOptions::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_MethodOptions.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+MethodOptions* MethodOptions::New(::google::protobuf::Arena* arena) const {
+ MethodOptions* n = new MethodOptions;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void MethodOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions)
@@ -11215,7 +13517,7 @@ bool MethodOptions::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.MethodOptions)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -11257,7 +13559,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
@@ -11313,9 +13615,7 @@ 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)
@@ -11352,7 +13652,7 @@ void MethodOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target);
}
@@ -11385,7 +13685,7 @@ size_t MethodOptions::ByteSizeLong() const {
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(static_cast<int>(i)));
}
}
@@ -11404,7 +13704,9 @@ size_t MethodOptions::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -11469,43 +13771,110 @@ bool MethodOptions::IsInitialized() const {
void MethodOptions::Swap(MethodOptions* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- MethodOptions* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void MethodOptions::UnsafeArenaSwap(MethodOptions* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void MethodOptions::InternalSwap(MethodOptions* other) {
using std::swap;
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(deprecated_, other->deprecated_);
swap(idempotency_level_, other->idempotency_level_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata MethodOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// MethodOptions
-// ===================================================================
+// optional bool deprecated = 33 [default = false];
+bool MethodOptions::has_deprecated() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void MethodOptions::set_has_deprecated() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void MethodOptions::clear_has_deprecated() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void MethodOptions::clear_deprecated() {
+ deprecated_ = false;
+ clear_has_deprecated();
+}
+bool MethodOptions::deprecated() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.deprecated)
+ return deprecated_;
+}
+void MethodOptions::set_deprecated(bool value) {
+ set_has_deprecated();
+ deprecated_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.deprecated)
+}
-void UninterpretedOption_NamePart::InitAsDefaultInstance() {
+// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
+bool MethodOptions::has_idempotency_level() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
}
+void MethodOptions::set_has_idempotency_level() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void MethodOptions::clear_has_idempotency_level() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void MethodOptions::clear_idempotency_level() {
+ idempotency_level_ = 0;
+ clear_has_idempotency_level();
+}
+::google::protobuf::MethodOptions_IdempotencyLevel MethodOptions::idempotency_level() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.idempotency_level)
+ return static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(idempotency_level_);
+}
+void MethodOptions::set_idempotency_level(::google::protobuf::MethodOptions_IdempotencyLevel value) {
+ assert(::google::protobuf::MethodOptions_IdempotencyLevel_IsValid(value));
+ set_has_idempotency_level();
+ idempotency_level_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.idempotency_level)
+}
+
+// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+int MethodOptions::uninterpreted_option_size() const {
+ return uninterpreted_option_.size();
+}
+void MethodOptions::clear_uninterpreted_option() {
+ uninterpreted_option_.Clear();
+}
+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);
+}
+::google::protobuf::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MethodOptions.uninterpreted_option)
+ return uninterpreted_option_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption* MethodOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
+MethodOptions::mutable_uninterpreted_option() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.MethodOptions.uninterpreted_option)
+ return &uninterpreted_option_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
+MethodOptions::uninterpreted_option() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.MethodOptions.uninterpreted_option)
+ return uninterpreted_option_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int UninterpretedOption_NamePart::kNamePartFieldNumber;
const int UninterpretedOption_NamePart::kIsExtensionFieldNumber;
@@ -11513,34 +13882,28 @@ const int UninterpretedOption_NamePart::kIsExtensionFieldNumber;
UninterpretedOption_NamePart::UninterpretedOption_NamePart()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption_NamePart.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.UninterpretedOption.NamePart)
}
-UninterpretedOption_NamePart::UninterpretedOption_NamePart(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption_NamePart.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.UninterpretedOption.NamePart)
-}
UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOption_NamePart& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- _has_bits_(from._has_bits_) {
+ _has_bits_(from._has_bits_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_part_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name_part()) {
- name_part_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_part(),
- GetArenaNoVirtual());
+ name_part_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_part_);
}
is_extension_ = from.is_extension_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart)
}
void UninterpretedOption_NamePart::SharedCtor() {
+ _cached_size_ = 0;
name_part_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
is_extension_ = false;
}
@@ -11551,29 +13914,31 @@ UninterpretedOption_NamePart::~UninterpretedOption_NamePart() {
}
void UninterpretedOption_NamePart::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
name_part_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
-void UninterpretedOption_NamePart::ArenaDtor(void* object) {
- UninterpretedOption_NamePart* _this = reinterpret_cast< UninterpretedOption_NamePart* >(object);
- (void)_this;
-}
-void UninterpretedOption_NamePart::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void UninterpretedOption_NamePart::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UninterpretedOption_NamePart::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const UninterpretedOption_NamePart& UninterpretedOption_NamePart::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption_NamePart.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+UninterpretedOption_NamePart* UninterpretedOption_NamePart::New(::google::protobuf::Arena* arena) const {
+ UninterpretedOption_NamePart* n = new UninterpretedOption_NamePart;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void UninterpretedOption_NamePart::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart)
@@ -11581,9 +13946,9 @@ void UninterpretedOption_NamePart::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- cached_has_bits = _has_bits_[0];
- if (cached_has_bits & 0x00000001u) {
- name_part_.ClearNonDefaultToEmpty();
+ if (has_name_part()) {
+ GOOGLE_DCHECK(!name_part_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*name_part_.UnsafeRawStringPointer())->clear();
}
is_extension_ = false;
_has_bits_.Clear();
@@ -11596,7 +13961,7 @@ bool UninterpretedOption_NamePart::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.UninterpretedOption.NamePart)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -11751,7 +14116,9 @@ size_t UninterpretedOption_NamePart::ByteSizeLong() const {
total_size += RequiredFieldsByteSizeFallback();
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -11780,7 +14147,8 @@ void UninterpretedOption_NamePart::MergeFrom(const UninterpretedOption_NamePart&
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- set_name_part(from.name_part());
+ set_has_name_part();
+ name_part_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_part_);
}
if (cached_has_bits & 0x00000002u) {
is_extension_ = from.is_extension_;
@@ -11810,42 +14178,116 @@ bool UninterpretedOption_NamePart::IsInitialized() const {
void UninterpretedOption_NamePart::Swap(UninterpretedOption_NamePart* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- UninterpretedOption_NamePart* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void UninterpretedOption_NamePart::UnsafeArenaSwap(UninterpretedOption_NamePart* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* other) {
using std::swap;
- name_part_.Swap(&other->name_part_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_part_.Swap(&other->name_part_);
swap(is_extension_, other->is_extension_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata UninterpretedOption_NamePart::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// UninterpretedOption_NamePart
-// ===================================================================
+// required string name_part = 1;
+bool UninterpretedOption_NamePart::has_name_part() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void UninterpretedOption_NamePart::set_has_name_part() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void UninterpretedOption_NamePart::clear_has_name_part() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void UninterpretedOption_NamePart::clear_name_part() {
+ name_part_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_name_part();
+}
+const ::std::string& UninterpretedOption_NamePart::name_part() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.name_part)
+ return name_part_.GetNoArena();
+}
+void UninterpretedOption_NamePart::set_name_part(const ::std::string& value) {
+ set_has_name_part();
+ name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part)
+}
+#if LANG_CXX11
+void UninterpretedOption_NamePart::set_name_part(::std::string&& value) {
+ set_has_name_part();
+ name_part_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.NamePart.name_part)
+}
+#endif
+void UninterpretedOption_NamePart::set_name_part(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_name_part();
+ name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.NamePart.name_part)
+}
+void UninterpretedOption_NamePart::set_name_part(const char* value, size_t size) {
+ set_has_name_part();
+ name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.NamePart.name_part)
+}
+::std::string* UninterpretedOption_NamePart::mutable_name_part() {
+ set_has_name_part();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part)
+ return name_part_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* UninterpretedOption_NamePart::release_name_part() {
+ // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part)
+ clear_has_name_part();
+ return name_part_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void UninterpretedOption_NamePart::set_allocated_name_part(::std::string* name_part) {
+ if (name_part != NULL) {
+ set_has_name_part();
+ } else {
+ clear_has_name_part();
+ }
+ name_part_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name_part);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
+}
-void UninterpretedOption::InitAsDefaultInstance() {
+// required bool is_extension = 2;
+bool UninterpretedOption_NamePart::has_is_extension() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void UninterpretedOption_NamePart::set_has_is_extension() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void UninterpretedOption_NamePart::clear_has_is_extension() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void UninterpretedOption_NamePart::clear_is_extension() {
+ is_extension_ = false;
+ clear_has_is_extension();
+}
+bool UninterpretedOption_NamePart::is_extension() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.is_extension)
+ return is_extension_;
+}
+void UninterpretedOption_NamePart::set_is_extension(bool value) {
+ set_has_is_extension();
+ is_extension_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.is_extension)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int UninterpretedOption::kNameFieldNumber;
const int UninterpretedOption::kIdentifierValueFieldNumber;
@@ -11858,40 +14300,30 @@ const int UninterpretedOption::kAggregateValueFieldNumber;
UninterpretedOption::UninterpretedOption()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.UninterpretedOption)
}
-UninterpretedOption::UninterpretedOption(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- name_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.UninterpretedOption)
-}
UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
name_(from.name_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
identifier_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_identifier_value()) {
- identifier_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.identifier_value(),
- GetArenaNoVirtual());
+ identifier_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.identifier_value_);
}
string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_string_value()) {
- string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_value(),
- GetArenaNoVirtual());
+ string_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_value_);
}
aggregate_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_aggregate_value()) {
- aggregate_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value(),
- GetArenaNoVirtual());
+ aggregate_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value_);
}
::memcpy(&positive_int_value_, &from.positive_int_value_,
static_cast<size_t>(reinterpret_cast<char*>(&double_value_) -
@@ -11900,6 +14332,7 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
}
void UninterpretedOption::SharedCtor() {
+ _cached_size_ = 0;
identifier_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
aggregate_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -11914,31 +14347,33 @@ UninterpretedOption::~UninterpretedOption() {
}
void UninterpretedOption::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
identifier_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
aggregate_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
-void UninterpretedOption::ArenaDtor(void* object) {
- UninterpretedOption* _this = reinterpret_cast< UninterpretedOption* >(object);
- (void)_this;
-}
-void UninterpretedOption::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void UninterpretedOption::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UninterpretedOption::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const UninterpretedOption& UninterpretedOption::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_UninterpretedOption.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+UninterpretedOption* UninterpretedOption::New(::google::protobuf::Arena* arena) const {
+ UninterpretedOption* n = new UninterpretedOption;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void UninterpretedOption::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption)
@@ -11950,13 +14385,16 @@ void UninterpretedOption::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 7u) {
if (cached_has_bits & 0x00000001u) {
- identifier_value_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!identifier_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*identifier_value_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
- string_value_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!string_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*string_value_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000004u) {
- aggregate_value_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!aggregate_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*aggregate_value_.UnsafeRawStringPointer())->clear();
}
}
if (cached_has_bits & 56u) {
@@ -11974,7 +14412,7 @@ bool UninterpretedOption::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.UninterpretedOption)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -11982,7 +14420,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_name()));
} else {
goto handle_unusual;
@@ -12106,9 +14544,7 @@ 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];
@@ -12171,7 +14607,7 @@ void UninterpretedOption::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->name_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
2, this->name(static_cast<int>(i)), deterministic, target);
}
@@ -12243,7 +14679,7 @@ size_t UninterpretedOption::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->name(static_cast<int>(i)));
}
}
@@ -12291,7 +14727,9 @@ size_t UninterpretedOption::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -12321,13 +14759,16 @@ void UninterpretedOption::MergeFrom(const UninterpretedOption& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 63u) {
if (cached_has_bits & 0x00000001u) {
- set_identifier_value(from.identifier_value());
+ set_has_identifier_value();
+ identifier_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.identifier_value_);
}
if (cached_has_bits & 0x00000002u) {
- set_string_value(from.string_value());
+ set_has_string_value();
+ string_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_value_);
}
if (cached_has_bits & 0x00000004u) {
- set_aggregate_value(from.aggregate_value());
+ set_has_aggregate_value();
+ aggregate_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value_);
}
if (cached_has_bits & 0x00000008u) {
positive_int_value_ = from.positive_int_value_;
@@ -12363,49 +14804,325 @@ bool UninterpretedOption::IsInitialized() const {
void UninterpretedOption::Swap(UninterpretedOption* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- UninterpretedOption* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void UninterpretedOption::UnsafeArenaSwap(UninterpretedOption* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void UninterpretedOption::InternalSwap(UninterpretedOption* other) {
using std::swap;
- CastToBase(&name_)->InternalSwap(CastToBase(&other->name_));
- identifier_value_.Swap(&other->identifier_value_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- string_value_.Swap(&other->string_value_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- aggregate_value_.Swap(&other->aggregate_value_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.InternalSwap(&other->name_);
+ identifier_value_.Swap(&other->identifier_value_);
+ string_value_.Swap(&other->string_value_);
+ aggregate_value_.Swap(&other->aggregate_value_);
swap(positive_int_value_, other->positive_int_value_);
swap(negative_int_value_, other->negative_int_value_);
swap(double_value_, other->double_value_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata UninterpretedOption::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// UninterpretedOption
-// ===================================================================
+// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
+int UninterpretedOption::name_size() const {
+ return name_.size();
+}
+void UninterpretedOption::clear_name() {
+ name_.Clear();
+}
+const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name)
+ return name_.Get(index);
+}
+::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.name)
+ return name_.Mutable(index);
+}
+::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::add_name() {
+ // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name)
+ return name_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >*
+UninterpretedOption::mutable_name() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.UninterpretedOption.name)
+ return &name_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >&
+UninterpretedOption::name() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.UninterpretedOption.name)
+ return name_;
+}
+
+// optional string identifier_value = 3;
+bool UninterpretedOption::has_identifier_value() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void UninterpretedOption::set_has_identifier_value() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void UninterpretedOption::clear_has_identifier_value() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void UninterpretedOption::clear_identifier_value() {
+ identifier_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_identifier_value();
+}
+const ::std::string& UninterpretedOption::identifier_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.identifier_value)
+ return identifier_value_.GetNoArena();
+}
+void UninterpretedOption::set_identifier_value(const ::std::string& value) {
+ set_has_identifier_value();
+ identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value)
+}
+#if LANG_CXX11
+void UninterpretedOption::set_identifier_value(::std::string&& value) {
+ set_has_identifier_value();
+ identifier_value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.identifier_value)
+}
+#endif
+void UninterpretedOption::set_identifier_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_identifier_value();
+ identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.identifier_value)
+}
+void UninterpretedOption::set_identifier_value(const char* value, size_t size) {
+ set_has_identifier_value();
+ identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.identifier_value)
+}
+::std::string* UninterpretedOption::mutable_identifier_value() {
+ set_has_identifier_value();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value)
+ return identifier_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* UninterpretedOption::release_identifier_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value)
+ clear_has_identifier_value();
+ return identifier_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void UninterpretedOption::set_allocated_identifier_value(::std::string* identifier_value) {
+ if (identifier_value != NULL) {
+ set_has_identifier_value();
+ } else {
+ clear_has_identifier_value();
+ }
+ identifier_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), identifier_value);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
+}
+
+// optional uint64 positive_int_value = 4;
+bool UninterpretedOption::has_positive_int_value() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+void UninterpretedOption::set_has_positive_int_value() {
+ _has_bits_[0] |= 0x00000008u;
+}
+void UninterpretedOption::clear_has_positive_int_value() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+void UninterpretedOption::clear_positive_int_value() {
+ positive_int_value_ = GOOGLE_ULONGLONG(0);
+ clear_has_positive_int_value();
+}
+::google::protobuf::uint64 UninterpretedOption::positive_int_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.positive_int_value)
+ return positive_int_value_;
+}
+void UninterpretedOption::set_positive_int_value(::google::protobuf::uint64 value) {
+ set_has_positive_int_value();
+ positive_int_value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.positive_int_value)
+}
+
+// optional int64 negative_int_value = 5;
+bool UninterpretedOption::has_negative_int_value() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+void UninterpretedOption::set_has_negative_int_value() {
+ _has_bits_[0] |= 0x00000010u;
+}
+void UninterpretedOption::clear_has_negative_int_value() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+void UninterpretedOption::clear_negative_int_value() {
+ negative_int_value_ = GOOGLE_LONGLONG(0);
+ clear_has_negative_int_value();
+}
+::google::protobuf::int64 UninterpretedOption::negative_int_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.negative_int_value)
+ return negative_int_value_;
+}
+void UninterpretedOption::set_negative_int_value(::google::protobuf::int64 value) {
+ set_has_negative_int_value();
+ negative_int_value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.negative_int_value)
+}
+
+// optional double double_value = 6;
+bool UninterpretedOption::has_double_value() const {
+ return (_has_bits_[0] & 0x00000020u) != 0;
+}
+void UninterpretedOption::set_has_double_value() {
+ _has_bits_[0] |= 0x00000020u;
+}
+void UninterpretedOption::clear_has_double_value() {
+ _has_bits_[0] &= ~0x00000020u;
+}
+void UninterpretedOption::clear_double_value() {
+ double_value_ = 0;
+ clear_has_double_value();
+}
+double UninterpretedOption::double_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.double_value)
+ return double_value_;
+}
+void UninterpretedOption::set_double_value(double value) {
+ set_has_double_value();
+ double_value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.double_value)
+}
+
+// optional bytes string_value = 7;
+bool UninterpretedOption::has_string_value() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void UninterpretedOption::set_has_string_value() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void UninterpretedOption::clear_has_string_value() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void UninterpretedOption::clear_string_value() {
+ string_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_string_value();
+}
+const ::std::string& UninterpretedOption::string_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.string_value)
+ return string_value_.GetNoArena();
+}
+void UninterpretedOption::set_string_value(const ::std::string& value) {
+ set_has_string_value();
+ string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value)
+}
+#if LANG_CXX11
+void UninterpretedOption::set_string_value(::std::string&& value) {
+ set_has_string_value();
+ string_value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.string_value)
+}
+#endif
+void UninterpretedOption::set_string_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_string_value();
+ string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.string_value)
+}
+void UninterpretedOption::set_string_value(const void* value, size_t size) {
+ set_has_string_value();
+ string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.string_value)
+}
+::std::string* UninterpretedOption::mutable_string_value() {
+ set_has_string_value();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value)
+ return string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* UninterpretedOption::release_string_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value)
+ clear_has_string_value();
+ return string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void UninterpretedOption::set_allocated_string_value(::std::string* string_value) {
+ if (string_value != NULL) {
+ set_has_string_value();
+ } else {
+ clear_has_string_value();
+ }
+ string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value)
+}
-void SourceCodeInfo_Location::InitAsDefaultInstance() {
+// optional string aggregate_value = 8;
+bool UninterpretedOption::has_aggregate_value() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
}
+void UninterpretedOption::set_has_aggregate_value() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void UninterpretedOption::clear_has_aggregate_value() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void UninterpretedOption::clear_aggregate_value() {
+ aggregate_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_aggregate_value();
+}
+const ::std::string& UninterpretedOption::aggregate_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.aggregate_value)
+ return aggregate_value_.GetNoArena();
+}
+void UninterpretedOption::set_aggregate_value(const ::std::string& value) {
+ set_has_aggregate_value();
+ aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value)
+}
+#if LANG_CXX11
+void UninterpretedOption::set_aggregate_value(::std::string&& value) {
+ set_has_aggregate_value();
+ aggregate_value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.aggregate_value)
+}
+#endif
+void UninterpretedOption::set_aggregate_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_aggregate_value();
+ aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.aggregate_value)
+}
+void UninterpretedOption::set_aggregate_value(const char* value, size_t size) {
+ set_has_aggregate_value();
+ aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.aggregate_value)
+}
+::std::string* UninterpretedOption::mutable_aggregate_value() {
+ set_has_aggregate_value();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value)
+ return aggregate_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* UninterpretedOption::release_aggregate_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value)
+ clear_has_aggregate_value();
+ return aggregate_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void UninterpretedOption::set_allocated_aggregate_value(::std::string* aggregate_value) {
+ if (aggregate_value != NULL) {
+ set_has_aggregate_value();
+ } else {
+ clear_has_aggregate_value();
+ }
+ aggregate_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), aggregate_value);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SourceCodeInfo_Location::kPathFieldNumber;
const int SourceCodeInfo_Location::kSpanFieldNumber;
@@ -12416,44 +15133,34 @@ const int SourceCodeInfo_Location::kLeadingDetachedCommentsFieldNumber;
SourceCodeInfo_Location::SourceCodeInfo_Location()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_SourceCodeInfo_Location.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.SourceCodeInfo.Location)
}
-SourceCodeInfo_Location::SourceCodeInfo_Location(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- path_(arena),
- span_(arena),
- leading_detached_comments_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_SourceCodeInfo_Location.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.SourceCodeInfo.Location)
-}
SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
path_(from.path_),
span_(from.span_),
leading_detached_comments_(from.leading_detached_comments_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
leading_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_leading_comments()) {
- leading_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.leading_comments(),
- GetArenaNoVirtual());
+ leading_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.leading_comments_);
}
trailing_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_trailing_comments()) {
- trailing_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.trailing_comments(),
- GetArenaNoVirtual());
+ trailing_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.trailing_comments_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location)
}
void SourceCodeInfo_Location::SharedCtor() {
+ _cached_size_ = 0;
leading_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
trailing_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
@@ -12464,30 +15171,32 @@ SourceCodeInfo_Location::~SourceCodeInfo_Location() {
}
void SourceCodeInfo_Location::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
leading_comments_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
trailing_comments_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
-void SourceCodeInfo_Location::ArenaDtor(void* object) {
- SourceCodeInfo_Location* _this = reinterpret_cast< SourceCodeInfo_Location* >(object);
- (void)_this;
-}
-void SourceCodeInfo_Location::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void SourceCodeInfo_Location::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SourceCodeInfo_Location::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const SourceCodeInfo_Location& SourceCodeInfo_Location::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_SourceCodeInfo_Location.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+SourceCodeInfo_Location* SourceCodeInfo_Location::New(::google::protobuf::Arena* arena) const {
+ SourceCodeInfo_Location* n = new SourceCodeInfo_Location;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void SourceCodeInfo_Location::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location)
@@ -12501,10 +15210,12 @@ void SourceCodeInfo_Location::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- leading_comments_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!leading_comments_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*leading_comments_.UnsafeRawStringPointer())->clear();
}
if (cached_has_bits & 0x00000002u) {
- trailing_comments_.ClearNonDefaultToEmpty();
+ GOOGLE_DCHECK(!trailing_comments_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*trailing_comments_.UnsafeRawStringPointer())->clear();
}
}
_has_bits_.Clear();
@@ -12517,7 +15228,7 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.SourceCodeInfo.Location)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -12708,7 +15419,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
- static_cast< ::google::protobuf::int32>(
+ static_cast< ::google::protobuf::uint32>(
_path_cached_byte_size_), target);
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32NoTagToArray(this->path_, target);
@@ -12721,7 +15432,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
- static_cast< ::google::protobuf::int32>(
+ static_cast< ::google::protobuf::uint32>(
_span_cached_byte_size_), target);
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32NoTagToArray(this->span_, target);
@@ -12834,7 +15545,9 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -12866,10 +15579,12 @@ void SourceCodeInfo_Location::MergeFrom(const SourceCodeInfo_Location& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
- set_leading_comments(from.leading_comments());
+ set_has_leading_comments();
+ leading_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.leading_comments_);
}
if (cached_has_bits & 0x00000002u) {
- set_trailing_comments(from.trailing_comments());
+ set_has_trailing_comments();
+ trailing_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.trailing_comments_);
}
}
}
@@ -12894,76 +15609,311 @@ bool SourceCodeInfo_Location::IsInitialized() const {
void SourceCodeInfo_Location::Swap(SourceCodeInfo_Location* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- SourceCodeInfo_Location* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void SourceCodeInfo_Location::UnsafeArenaSwap(SourceCodeInfo_Location* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) {
using std::swap;
path_.InternalSwap(&other->path_);
span_.InternalSwap(&other->span_);
- leading_detached_comments_.InternalSwap(CastToBase(&other->leading_detached_comments_));
- leading_comments_.Swap(&other->leading_comments_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- trailing_comments_.Swap(&other->trailing_comments_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ leading_detached_comments_.InternalSwap(&other->leading_detached_comments_);
+ leading_comments_.Swap(&other->leading_comments_);
+ trailing_comments_.Swap(&other->trailing_comments_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SourceCodeInfo_Location::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// SourceCodeInfo_Location
-// ===================================================================
+// repeated int32 path = 1 [packed = true];
+int SourceCodeInfo_Location::path_size() const {
+ return path_.size();
+}
+void SourceCodeInfo_Location::clear_path() {
+ path_.Clear();
+}
+::google::protobuf::int32 SourceCodeInfo_Location::path(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.path)
+ return path_.Get(index);
+}
+void SourceCodeInfo_Location::set_path(int index, ::google::protobuf::int32 value) {
+ path_.Set(index, value);
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.path)
+}
+void SourceCodeInfo_Location::add_path(::google::protobuf::int32 value) {
+ path_.Add(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.path)
+}
+const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+SourceCodeInfo_Location::path() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.path)
+ return path_;
+}
+::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+SourceCodeInfo_Location::mutable_path() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.path)
+ return &path_;
+}
+
+// repeated int32 span = 2 [packed = true];
+int SourceCodeInfo_Location::span_size() const {
+ return span_.size();
+}
+void SourceCodeInfo_Location::clear_span() {
+ span_.Clear();
+}
+::google::protobuf::int32 SourceCodeInfo_Location::span(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.span)
+ return span_.Get(index);
+}
+void SourceCodeInfo_Location::set_span(int index, ::google::protobuf::int32 value) {
+ span_.Set(index, value);
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.span)
+}
+void SourceCodeInfo_Location::add_span(::google::protobuf::int32 value) {
+ span_.Add(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.span)
+}
+const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+SourceCodeInfo_Location::span() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.span)
+ return span_;
+}
+::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+SourceCodeInfo_Location::mutable_span() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.span)
+ return &span_;
+}
+
+// optional string leading_comments = 3;
+bool SourceCodeInfo_Location::has_leading_comments() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void SourceCodeInfo_Location::set_has_leading_comments() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void SourceCodeInfo_Location::clear_has_leading_comments() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void SourceCodeInfo_Location::clear_leading_comments() {
+ leading_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_leading_comments();
+}
+const ::std::string& SourceCodeInfo_Location::leading_comments() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_comments)
+ return leading_comments_.GetNoArena();
+}
+void SourceCodeInfo_Location::set_leading_comments(const ::std::string& value) {
+ set_has_leading_comments();
+ leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments)
+}
+#if LANG_CXX11
+void SourceCodeInfo_Location::set_leading_comments(::std::string&& value) {
+ set_has_leading_comments();
+ leading_comments_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.leading_comments)
+}
+#endif
+void SourceCodeInfo_Location::set_leading_comments(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_leading_comments();
+ leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_comments)
+}
+void SourceCodeInfo_Location::set_leading_comments(const char* value, size_t size) {
+ set_has_leading_comments();
+ leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_comments)
+}
+::std::string* SourceCodeInfo_Location::mutable_leading_comments() {
+ set_has_leading_comments();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments)
+ return leading_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* SourceCodeInfo_Location::release_leading_comments() {
+ // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments)
+ clear_has_leading_comments();
+ return leading_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void SourceCodeInfo_Location::set_allocated_leading_comments(::std::string* leading_comments) {
+ if (leading_comments != NULL) {
+ set_has_leading_comments();
+ } else {
+ clear_has_leading_comments();
+ }
+ leading_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), leading_comments);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
+}
+
+// optional string trailing_comments = 4;
+bool SourceCodeInfo_Location::has_trailing_comments() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void SourceCodeInfo_Location::set_has_trailing_comments() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void SourceCodeInfo_Location::clear_has_trailing_comments() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void SourceCodeInfo_Location::clear_trailing_comments() {
+ trailing_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_trailing_comments();
+}
+const ::std::string& SourceCodeInfo_Location::trailing_comments() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+ return trailing_comments_.GetNoArena();
+}
+void SourceCodeInfo_Location::set_trailing_comments(const ::std::string& value) {
+ set_has_trailing_comments();
+ trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+}
+#if LANG_CXX11
+void SourceCodeInfo_Location::set_trailing_comments(::std::string&& value) {
+ set_has_trailing_comments();
+ trailing_comments_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+}
+#endif
+void SourceCodeInfo_Location::set_trailing_comments(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_trailing_comments();
+ trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+}
+void SourceCodeInfo_Location::set_trailing_comments(const char* value, size_t size) {
+ set_has_trailing_comments();
+ trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+}
+::std::string* SourceCodeInfo_Location::mutable_trailing_comments() {
+ set_has_trailing_comments();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+ return trailing_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* SourceCodeInfo_Location::release_trailing_comments() {
+ // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+ clear_has_trailing_comments();
+ return trailing_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::string* trailing_comments) {
+ if (trailing_comments != NULL) {
+ set_has_trailing_comments();
+ } else {
+ clear_has_trailing_comments();
+ }
+ trailing_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), trailing_comments);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+}
-void SourceCodeInfo::InitAsDefaultInstance() {
+// repeated string leading_detached_comments = 6;
+int SourceCodeInfo_Location::leading_detached_comments_size() const {
+ return leading_detached_comments_.size();
+}
+void SourceCodeInfo_Location::clear_leading_detached_comments() {
+ leading_detached_comments_.Clear();
}
+const ::std::string& SourceCodeInfo_Location::leading_detached_comments(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+ return leading_detached_comments_.Get(index);
+}
+::std::string* SourceCodeInfo_Location::mutable_leading_detached_comments(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+ return leading_detached_comments_.Mutable(index);
+}
+void SourceCodeInfo_Location::set_leading_detached_comments(int index, const ::std::string& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+ leading_detached_comments_.Mutable(index)->assign(value);
+}
+#if LANG_CXX11
+void SourceCodeInfo_Location::set_leading_detached_comments(int index, ::std::string&& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+ leading_detached_comments_.Mutable(index)->assign(std::move(value));
+}
+#endif
+void SourceCodeInfo_Location::set_leading_detached_comments(int index, const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ leading_detached_comments_.Mutable(index)->assign(value);
+ // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+}
+void SourceCodeInfo_Location::set_leading_detached_comments(int index, const char* value, size_t size) {
+ leading_detached_comments_.Mutable(index)->assign(
+ reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+}
+::std::string* SourceCodeInfo_Location::add_leading_detached_comments() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+ return leading_detached_comments_.Add();
+}
+void SourceCodeInfo_Location::add_leading_detached_comments(const ::std::string& value) {
+ leading_detached_comments_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+}
+#if LANG_CXX11
+void SourceCodeInfo_Location::add_leading_detached_comments(::std::string&& value) {
+ leading_detached_comments_.Add(std::move(value));
+ // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+}
+#endif
+void SourceCodeInfo_Location::add_leading_detached_comments(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ leading_detached_comments_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add_char:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+}
+void SourceCodeInfo_Location::add_leading_detached_comments(const char* value, size_t size) {
+ leading_detached_comments_.Add()->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_add_pointer:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+}
+const ::google::protobuf::RepeatedPtrField< ::std::string>&
+SourceCodeInfo_Location::leading_detached_comments() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+ return leading_detached_comments_;
+}
+::google::protobuf::RepeatedPtrField< ::std::string>*
+SourceCodeInfo_Location::mutable_leading_detached_comments() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+ return &leading_detached_comments_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SourceCodeInfo::kLocationFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SourceCodeInfo::SourceCodeInfo()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_SourceCodeInfo.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.SourceCodeInfo)
}
-SourceCodeInfo::SourceCodeInfo(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- location_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_SourceCodeInfo.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.SourceCodeInfo)
-}
SourceCodeInfo::SourceCodeInfo(const SourceCodeInfo& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
location_(from.location_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo)
}
void SourceCodeInfo::SharedCtor() {
+ _cached_size_ = 0;
}
SourceCodeInfo::~SourceCodeInfo() {
@@ -12972,28 +15922,30 @@ SourceCodeInfo::~SourceCodeInfo() {
}
void SourceCodeInfo::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void SourceCodeInfo::ArenaDtor(void* object) {
- SourceCodeInfo* _this = reinterpret_cast< SourceCodeInfo* >(object);
- (void)_this;
-}
-void SourceCodeInfo::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void SourceCodeInfo::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SourceCodeInfo::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const SourceCodeInfo& SourceCodeInfo::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_SourceCodeInfo.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+SourceCodeInfo* SourceCodeInfo::New(::google::protobuf::Arena* arena) const {
+ SourceCodeInfo* n = new SourceCodeInfo;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void SourceCodeInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo)
@@ -13012,7 +15964,7 @@ bool SourceCodeInfo::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.SourceCodeInfo)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -13020,7 +15972,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_location()));
} else {
goto handle_unusual;
@@ -13058,9 +16010,7 @@ 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()) {
@@ -13081,7 +16031,7 @@ void SourceCodeInfo::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->location_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
1, this->location(static_cast<int>(i)), deterministic, target);
}
@@ -13108,13 +16058,15 @@ size_t SourceCodeInfo::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->location(static_cast<int>(i)));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -13163,40 +16115,58 @@ bool SourceCodeInfo::IsInitialized() const {
void SourceCodeInfo::Swap(SourceCodeInfo* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- SourceCodeInfo* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void SourceCodeInfo::UnsafeArenaSwap(SourceCodeInfo* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void SourceCodeInfo::InternalSwap(SourceCodeInfo* other) {
using std::swap;
- CastToBase(&location_)->InternalSwap(CastToBase(&other->location_));
+ location_.InternalSwap(&other->location_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SourceCodeInfo::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// SourceCodeInfo
+
+// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
+int SourceCodeInfo::location_size() const {
+ return location_.size();
+}
+void SourceCodeInfo::clear_location() {
+ location_.Clear();
+}
+const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location)
+ return location_.Get(index);
+}
+::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.location)
+ return location_.Mutable(index);
+}
+::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::add_location() {
+ // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location)
+ return location_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >*
+SourceCodeInfo::mutable_location() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.location)
+ return &location_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >&
+SourceCodeInfo::location() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.location)
+ return location_;
}
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void GeneratedCodeInfo_Annotation::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GeneratedCodeInfo_Annotation::kPathFieldNumber;
const int GeneratedCodeInfo_Annotation::kSourceFileFieldNumber;
@@ -13206,30 +16176,22 @@ const int GeneratedCodeInfo_Annotation::kEndFieldNumber;
GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_GeneratedCodeInfo_Annotation.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo.Annotation)
}
-GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- path_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_GeneratedCodeInfo_Annotation.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.GeneratedCodeInfo.Annotation)
-}
GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
path_(from.path_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_source_file()) {
- source_file_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file(),
- GetArenaNoVirtual());
+ source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_);
}
::memcpy(&begin_, &from.begin_,
static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@@ -13238,6 +16200,7 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn
}
void GeneratedCodeInfo_Annotation::SharedCtor() {
+ _cached_size_ = 0;
source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&begin_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&end_) -
@@ -13250,29 +16213,31 @@ GeneratedCodeInfo_Annotation::~GeneratedCodeInfo_Annotation() {
}
void GeneratedCodeInfo_Annotation::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
source_file_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
-void GeneratedCodeInfo_Annotation::ArenaDtor(void* object) {
- GeneratedCodeInfo_Annotation* _this = reinterpret_cast< GeneratedCodeInfo_Annotation* >(object);
- (void)_this;
-}
-void GeneratedCodeInfo_Annotation::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void GeneratedCodeInfo_Annotation::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GeneratedCodeInfo_Annotation::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const GeneratedCodeInfo_Annotation& GeneratedCodeInfo_Annotation::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_GeneratedCodeInfo_Annotation.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+GeneratedCodeInfo_Annotation* GeneratedCodeInfo_Annotation::New(::google::protobuf::Arena* arena) const {
+ GeneratedCodeInfo_Annotation* n = new GeneratedCodeInfo_Annotation;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void GeneratedCodeInfo_Annotation::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo.Annotation)
@@ -13281,10 +16246,11 @@ void GeneratedCodeInfo_Annotation::Clear() {
(void) cached_has_bits;
path_.Clear();
- cached_has_bits = _has_bits_[0];
- if (cached_has_bits & 0x00000001u) {
- source_file_.ClearNonDefaultToEmpty();
+ if (has_source_file()) {
+ GOOGLE_DCHECK(!source_file_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+ (*source_file_.UnsafeRawStringPointer())->clear();
}
+ cached_has_bits = _has_bits_[0];
if (cached_has_bits & 6u) {
::memset(&begin_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&end_) -
@@ -13300,7 +16266,7 @@ bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo.Annotation)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -13446,7 +16412,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes(
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
- static_cast< ::google::protobuf::int32>(
+ static_cast< ::google::protobuf::uint32>(
_path_cached_byte_size_), target);
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32NoTagToArray(this->path_, target);
@@ -13531,7 +16497,9 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -13561,7 +16529,8 @@ void GeneratedCodeInfo_Annotation::MergeFrom(const GeneratedCodeInfo_Annotation&
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 7u) {
if (cached_has_bits & 0x00000001u) {
- set_source_file(from.source_file());
+ set_has_source_file();
+ source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_);
}
if (cached_has_bits & 0x00000002u) {
begin_ = from.begin_;
@@ -13593,74 +16562,196 @@ bool GeneratedCodeInfo_Annotation::IsInitialized() const {
void GeneratedCodeInfo_Annotation::Swap(GeneratedCodeInfo_Annotation* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- GeneratedCodeInfo_Annotation* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void GeneratedCodeInfo_Annotation::UnsafeArenaSwap(GeneratedCodeInfo_Annotation* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* other) {
using std::swap;
path_.InternalSwap(&other->path_);
- source_file_.Swap(&other->source_file_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ source_file_.Swap(&other->source_file_);
swap(begin_, other->begin_);
swap(end_, other->end_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GeneratedCodeInfo_Annotation::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// GeneratedCodeInfo_Annotation
-// ===================================================================
+// repeated int32 path = 1 [packed = true];
+int GeneratedCodeInfo_Annotation::path_size() const {
+ return path_.size();
+}
+void GeneratedCodeInfo_Annotation::clear_path() {
+ path_.Clear();
+}
+::google::protobuf::int32 GeneratedCodeInfo_Annotation::path(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path)
+ return path_.Get(index);
+}
+void GeneratedCodeInfo_Annotation::set_path(int index, ::google::protobuf::int32 value) {
+ path_.Set(index, value);
+ // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path)
+}
+void GeneratedCodeInfo_Annotation::add_path(::google::protobuf::int32 value) {
+ path_.Add(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path)
+}
+const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+GeneratedCodeInfo_Annotation::path() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path)
+ return path_;
+}
+::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+GeneratedCodeInfo_Annotation::mutable_path() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path)
+ return &path_;
+}
+
+// optional string source_file = 2;
+bool GeneratedCodeInfo_Annotation::has_source_file() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+void GeneratedCodeInfo_Annotation::set_has_source_file() {
+ _has_bits_[0] |= 0x00000001u;
+}
+void GeneratedCodeInfo_Annotation::clear_has_source_file() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+void GeneratedCodeInfo_Annotation::clear_source_file() {
+ source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_source_file();
+}
+const ::std::string& GeneratedCodeInfo_Annotation::source_file() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+ return source_file_.GetNoArena();
+}
+void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) {
+ set_has_source_file();
+ source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+}
+#if LANG_CXX11
+void GeneratedCodeInfo_Annotation::set_source_file(::std::string&& value) {
+ set_has_source_file();
+ source_file_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+}
+#endif
+void GeneratedCodeInfo_Annotation::set_source_file(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ set_has_source_file();
+ source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+}
+void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) {
+ set_has_source_file();
+ source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+}
+::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() {
+ set_has_source_file();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+ return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* GeneratedCodeInfo_Annotation::release_source_file() {
+ // @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+ clear_has_source_file();
+ return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) {
+ if (source_file != NULL) {
+ set_has_source_file();
+ } else {
+ clear_has_source_file();
+ }
+ source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+}
+
+// optional int32 begin = 3;
+bool GeneratedCodeInfo_Annotation::has_begin() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+void GeneratedCodeInfo_Annotation::set_has_begin() {
+ _has_bits_[0] |= 0x00000002u;
+}
+void GeneratedCodeInfo_Annotation::clear_has_begin() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+void GeneratedCodeInfo_Annotation::clear_begin() {
+ begin_ = 0;
+ clear_has_begin();
+}
+::google::protobuf::int32 GeneratedCodeInfo_Annotation::begin() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin)
+ return begin_;
+}
+void GeneratedCodeInfo_Annotation::set_begin(::google::protobuf::int32 value) {
+ set_has_begin();
+ begin_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin)
+}
-void GeneratedCodeInfo::InitAsDefaultInstance() {
+// optional int32 end = 4;
+bool GeneratedCodeInfo_Annotation::has_end() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
}
+void GeneratedCodeInfo_Annotation::set_has_end() {
+ _has_bits_[0] |= 0x00000004u;
+}
+void GeneratedCodeInfo_Annotation::clear_has_end() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+void GeneratedCodeInfo_Annotation::clear_end() {
+ end_ = 0;
+ clear_has_end();
+}
+::google::protobuf::int32 GeneratedCodeInfo_Annotation::end() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end)
+ return end_;
+}
+void GeneratedCodeInfo_Annotation::set_end(::google::protobuf::int32 value) {
+ set_has_end();
+ end_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GeneratedCodeInfo::kAnnotationFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GeneratedCodeInfo::GeneratedCodeInfo()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_GeneratedCodeInfo.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo)
}
-GeneratedCodeInfo::GeneratedCodeInfo(::google::protobuf::Arena* arena)
- : ::google::protobuf::Message(),
- _internal_metadata_(arena),
- annotation_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_GeneratedCodeInfo.base);
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:google.protobuf.GeneratedCodeInfo)
-}
GeneratedCodeInfo::GeneratedCodeInfo(const GeneratedCodeInfo& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
+ _cached_size_(0),
annotation_(from.annotation_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo)
}
void GeneratedCodeInfo::SharedCtor() {
+ _cached_size_ = 0;
}
GeneratedCodeInfo::~GeneratedCodeInfo() {
@@ -13669,28 +16760,30 @@ GeneratedCodeInfo::~GeneratedCodeInfo() {
}
void GeneratedCodeInfo::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}
-void GeneratedCodeInfo::ArenaDtor(void* object) {
- GeneratedCodeInfo* _this = reinterpret_cast< GeneratedCodeInfo* >(object);
- (void)_this;
-}
-void GeneratedCodeInfo::RegisterArenaDtor(::google::protobuf::Arena* arena) {
-}
void GeneratedCodeInfo::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GeneratedCodeInfo::descriptor() {
- ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const GeneratedCodeInfo& GeneratedCodeInfo::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fdescriptor_2eproto::scc_info_GeneratedCodeInfo.base);
+ protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
+GeneratedCodeInfo* GeneratedCodeInfo::New(::google::protobuf::Arena* arena) const {
+ GeneratedCodeInfo* n = new GeneratedCodeInfo;
+ if (arena != NULL) {
+ arena->Own(n);
+ }
+ return n;
+}
void GeneratedCodeInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo)
@@ -13709,7 +16802,7 @@ bool GeneratedCodeInfo::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -13717,7 +16810,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_annotation()));
} else {
goto handle_unusual;
@@ -13755,9 +16848,7 @@ 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()) {
@@ -13778,7 +16869,7 @@ void GeneratedCodeInfo::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->annotation_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
1, this->annotation(static_cast<int>(i)), deterministic, target);
}
@@ -13805,13 +16896,15 @@ size_t GeneratedCodeInfo::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->annotation(static_cast<int>(i)));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -13860,122 +16953,58 @@ bool GeneratedCodeInfo::IsInitialized() const {
void GeneratedCodeInfo::Swap(GeneratedCodeInfo* other) {
if (other == this) return;
- if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- InternalSwap(other);
- } else {
- GeneratedCodeInfo* temp = New(GetArenaNoVirtual());
- temp->MergeFrom(*other);
- other->CopyFrom(*this);
- InternalSwap(temp);
- if (GetArenaNoVirtual() == NULL) {
- delete temp;
- }
- }
-}
-void GeneratedCodeInfo::UnsafeArenaSwap(GeneratedCodeInfo* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) {
using std::swap;
- CastToBase(&annotation_)->InternalSwap(CastToBase(&other->annotation_));
+ annotation_.InternalSwap(&other->annotation_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GeneratedCodeInfo::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// GeneratedCodeInfo
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FileDescriptorSet* Arena::CreateMaybeMessage< ::google::protobuf::FileDescriptorSet >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::FileDescriptorSet >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FileDescriptorProto* Arena::CreateMaybeMessage< ::google::protobuf::FileDescriptorProto >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::FileDescriptorProto >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::DescriptorProto_ExtensionRange* Arena::CreateMaybeMessage< ::google::protobuf::DescriptorProto_ExtensionRange >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto_ExtensionRange >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::DescriptorProto_ReservedRange* Arena::CreateMaybeMessage< ::google::protobuf::DescriptorProto_ReservedRange >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto_ReservedRange >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::DescriptorProto* Arena::CreateMaybeMessage< ::google::protobuf::DescriptorProto >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ExtensionRangeOptions* Arena::CreateMaybeMessage< ::google::protobuf::ExtensionRangeOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::ExtensionRangeOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FieldDescriptorProto* Arena::CreateMaybeMessage< ::google::protobuf::FieldDescriptorProto >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::FieldDescriptorProto >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::OneofDescriptorProto* Arena::CreateMaybeMessage< ::google::protobuf::OneofDescriptorProto >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::OneofDescriptorProto >(arena);
+// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
+int GeneratedCodeInfo::annotation_size() const {
+ return annotation_.size();
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumDescriptorProto_EnumReservedRange* Arena::CreateMaybeMessage< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumDescriptorProto* Arena::CreateMaybeMessage< ::google::protobuf::EnumDescriptorProto >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::EnumDescriptorProto >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumValueDescriptorProto* Arena::CreateMaybeMessage< ::google::protobuf::EnumValueDescriptorProto >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::EnumValueDescriptorProto >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ServiceDescriptorProto* Arena::CreateMaybeMessage< ::google::protobuf::ServiceDescriptorProto >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::ServiceDescriptorProto >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::MethodDescriptorProto* Arena::CreateMaybeMessage< ::google::protobuf::MethodDescriptorProto >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::MethodDescriptorProto >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FileOptions* Arena::CreateMaybeMessage< ::google::protobuf::FileOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::FileOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::MessageOptions* Arena::CreateMaybeMessage< ::google::protobuf::MessageOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::MessageOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FieldOptions* Arena::CreateMaybeMessage< ::google::protobuf::FieldOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::FieldOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::OneofOptions* Arena::CreateMaybeMessage< ::google::protobuf::OneofOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::OneofOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumOptions* Arena::CreateMaybeMessage< ::google::protobuf::EnumOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::EnumOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumValueOptions* Arena::CreateMaybeMessage< ::google::protobuf::EnumValueOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::EnumValueOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ServiceOptions* Arena::CreateMaybeMessage< ::google::protobuf::ServiceOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::ServiceOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::MethodOptions* Arena::CreateMaybeMessage< ::google::protobuf::MethodOptions >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::MethodOptions >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::UninterpretedOption_NamePart* Arena::CreateMaybeMessage< ::google::protobuf::UninterpretedOption_NamePart >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::UninterpretedOption_NamePart >(arena);
+void GeneratedCodeInfo::clear_annotation() {
+ annotation_.Clear();
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::UninterpretedOption* Arena::CreateMaybeMessage< ::google::protobuf::UninterpretedOption >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::UninterpretedOption >(arena);
+const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation)
+ return annotation_.Get(index);
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::SourceCodeInfo_Location* Arena::CreateMaybeMessage< ::google::protobuf::SourceCodeInfo_Location >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::SourceCodeInfo_Location >(arena);
+::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation)
+ return annotation_.Mutable(index);
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::SourceCodeInfo* Arena::CreateMaybeMessage< ::google::protobuf::SourceCodeInfo >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::SourceCodeInfo >(arena);
+::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() {
+ // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation)
+ return annotation_.Add();
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::GeneratedCodeInfo_Annotation* Arena::CreateMaybeMessage< ::google::protobuf::GeneratedCodeInfo_Annotation >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::GeneratedCodeInfo_Annotation >(arena);
+::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >*
+GeneratedCodeInfo::mutable_annotation() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation)
+ return &annotation_;
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::GeneratedCodeInfo* Arena::CreateMaybeMessage< ::google::protobuf::GeneratedCodeInfo >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::GeneratedCodeInfo >(arena);
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >&
+GeneratedCodeInfo::annotation() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation)
+ return annotation_;
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.pb.h
index 7a8617a200..7ec516ab7d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/descriptor.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fdescriptor_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fdescriptor_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,7 +24,6 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
@@ -32,20 +31,6 @@
#include <google/protobuf/generated_enum_reflection.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fdescriptor_2eproto LIBPROTOBUF_EXPORT
-
-namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto {
-// Internal implementation detail -- do not use these members.
-struct LIBPROTOBUF_EXPORT TableStruct {
- static const ::google::protobuf::internal::ParseTableField entries[];
- static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[27];
- static const ::google::protobuf::internal::FieldMetadata field_metadata[];
- static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
-};
-void LIBPROTOBUF_EXPORT AddDescriptors();
-} // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto
namespace google {
namespace protobuf {
class DescriptorProto;
@@ -60,9 +45,6 @@ LIBPROTOBUF_EXPORT extern DescriptorProto_ReservedRangeDefaultTypeInternal _Desc
class EnumDescriptorProto;
class EnumDescriptorProtoDefaultTypeInternal;
LIBPROTOBUF_EXPORT extern EnumDescriptorProtoDefaultTypeInternal _EnumDescriptorProto_default_instance_;
-class EnumDescriptorProto_EnumReservedRange;
-class EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal _EnumDescriptorProto_EnumReservedRange_default_instance_;
class EnumOptions;
class EnumOptionsDefaultTypeInternal;
LIBPROTOBUF_EXPORT extern EnumOptionsDefaultTypeInternal _EnumOptions_default_instance_;
@@ -131,39 +113,24 @@ class UninterpretedOption_NamePartDefaultTypeInternal;
LIBPROTOBUF_EXPORT extern UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_;
} // namespace protobuf
} // namespace google
+
namespace google {
namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::DescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::DescriptorProto>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::DescriptorProto_ExtensionRange* Arena::CreateMaybeMessage<::google::protobuf::DescriptorProto_ExtensionRange>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::DescriptorProto_ReservedRange* Arena::CreateMaybeMessage<::google::protobuf::DescriptorProto_ReservedRange>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::EnumDescriptorProto>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumDescriptorProto_EnumReservedRange* Arena::CreateMaybeMessage<::google::protobuf::EnumDescriptorProto_EnumReservedRange>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumOptions* Arena::CreateMaybeMessage<::google::protobuf::EnumOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumValueDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::EnumValueDescriptorProto>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumValueOptions* Arena::CreateMaybeMessage<::google::protobuf::EnumValueOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::ExtensionRangeOptions* Arena::CreateMaybeMessage<::google::protobuf::ExtensionRangeOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::FieldDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::FieldDescriptorProto>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::FieldOptions* Arena::CreateMaybeMessage<::google::protobuf::FieldOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::FileDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::FileDescriptorProto>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::FileDescriptorSet* Arena::CreateMaybeMessage<::google::protobuf::FileDescriptorSet>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::FileOptions* Arena::CreateMaybeMessage<::google::protobuf::FileOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::GeneratedCodeInfo* Arena::CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::GeneratedCodeInfo_Annotation* Arena::CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo_Annotation>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::MessageOptions* Arena::CreateMaybeMessage<::google::protobuf::MessageOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::MethodDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::MethodDescriptorProto>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::MethodOptions* Arena::CreateMaybeMessage<::google::protobuf::MethodOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::OneofDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::OneofDescriptorProto>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::OneofOptions* Arena::CreateMaybeMessage<::google::protobuf::OneofOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::ServiceDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::ServiceDescriptorProto>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::ServiceOptions* Arena::CreateMaybeMessage<::google::protobuf::ServiceOptions>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::SourceCodeInfo* Arena::CreateMaybeMessage<::google::protobuf::SourceCodeInfo>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::SourceCodeInfo_Location* Arena::CreateMaybeMessage<::google::protobuf::SourceCodeInfo_Location>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::UninterpretedOption* Arena::CreateMaybeMessage<::google::protobuf::UninterpretedOption>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::UninterpretedOption_NamePart* Arena::CreateMaybeMessage<::google::protobuf::UninterpretedOption_NamePart>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
+
+namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto {
+// Internal implementation detail -- do not call these.
+struct LIBPROTOBUF_EXPORT TableStruct {
+ static const ::google::protobuf::internal::ParseTableField entries[];
+ static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
+ static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+ static const ::google::protobuf::internal::SerializationTable serialization_table[];
+ static void InitDefaultsImpl();
+};
+void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
+} // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto
enum FieldDescriptorProto_Type {
FieldDescriptorProto_Type_TYPE_DOUBLE = 1,
@@ -335,24 +302,16 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const FileDescriptorSet& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FileDescriptorSet* internal_default_instance() {
return reinterpret_cast<const FileDescriptorSet*>(
&_FileDescriptorSet_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
- void UnsafeArenaSwap(FileDescriptorSet* other);
void Swap(FileDescriptorSet* other);
friend void swap(FileDescriptorSet& a, FileDescriptorSet& b) {
a.Swap(&b);
@@ -360,49 +319,39 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message
// implements Message ----------------------------------------------
- inline FileDescriptorSet* New() const final {
- return CreateMaybeMessage<FileDescriptorSet>(NULL);
- }
+ inline FileDescriptorSet* New() const PROTOBUF_FINAL { return New(NULL); }
- FileDescriptorSet* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<FileDescriptorSet>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ FileDescriptorSet* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FileDescriptorSet& from);
void MergeFrom(const FileDescriptorSet& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(FileDescriptorSet* other);
- protected:
- explicit FileDescriptorSet(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -412,11 +361,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;
@@ -424,13 +373,10 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > file_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -467,24 +413,16 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const FileDescriptorProto& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FileDescriptorProto* internal_default_instance() {
return reinterpret_cast<const FileDescriptorProto*>(
&_FileDescriptorProto_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
1;
- void UnsafeArenaSwap(FileDescriptorProto* other);
void Swap(FileDescriptorProto* other);
friend void swap(FileDescriptorProto& a, FileDescriptorProto& b) {
a.Swap(&b);
@@ -492,49 +430,39 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
// implements Message ----------------------------------------------
- inline FileDescriptorProto* New() const final {
- return CreateMaybeMessage<FileDescriptorProto>(NULL);
- }
+ inline FileDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
- FileDescriptorProto* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<FileDescriptorProto>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ FileDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FileDescriptorProto& from);
void MergeFrom(const FileDescriptorProto& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(FileDescriptorProto* other);
- protected:
- explicit FileDescriptorProto(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -566,11 +494,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;
@@ -578,11 +506,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;
@@ -590,11 +518,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;
@@ -602,11 +530,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;
@@ -648,15 +576,6 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- ::std::string* name);
// optional string package = 2;
bool has_package() const;
@@ -672,15 +591,6 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
::std::string* mutable_package();
::std::string* release_package();
void set_allocated_package(::std::string* package);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_package();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_package(
- ::std::string* package);
// optional string syntax = 12;
bool has_syntax() const;
@@ -696,45 +606,24 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
::std::string* mutable_syntax();
::std::string* release_syntax();
void set_allocated_syntax(::std::string* syntax);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_syntax();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_syntax(
- ::std::string* syntax);
// optional .google.protobuf.FileOptions options = 8;
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 8;
- private:
- const ::google::protobuf::FileOptions& _internal_options() const;
- public:
const ::google::protobuf::FileOptions& options() const;
- ::google::protobuf::FileOptions* release_options();
::google::protobuf::FileOptions* mutable_options();
+ ::google::protobuf::FileOptions* release_options();
void set_allocated_options(::google::protobuf::FileOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::FileOptions* options);
- ::google::protobuf::FileOptions* unsafe_arena_release_options();
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
bool has_source_code_info() const;
void clear_source_code_info();
static const int kSourceCodeInfoFieldNumber = 9;
- private:
- const ::google::protobuf::SourceCodeInfo& _internal_source_code_info() const;
- public:
const ::google::protobuf::SourceCodeInfo& source_code_info() const;
- ::google::protobuf::SourceCodeInfo* release_source_code_info();
::google::protobuf::SourceCodeInfo* mutable_source_code_info();
+ ::google::protobuf::SourceCodeInfo* release_source_code_info();
void set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* source_code_info);
- void unsafe_arena_set_allocated_source_code_info(
- ::google::protobuf::SourceCodeInfo* source_code_info);
- ::google::protobuf::SourceCodeInfo* unsafe_arena_release_source_code_info();
// @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorProto)
private:
@@ -750,11 +639,8 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
void clear_has_syntax();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::std::string> dependency_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto > message_type_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto > enum_type_;
@@ -767,7 +653,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
::google::protobuf::internal::ArenaStringPtr syntax_;
::google::protobuf::FileOptions* options_;
::google::protobuf::SourceCodeInfo* source_code_info_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -804,24 +690,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const DescriptorProto_ExtensionRange& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const DescriptorProto_ExtensionRange* internal_default_instance() {
return reinterpret_cast<const DescriptorProto_ExtensionRange*>(
&_DescriptorProto_ExtensionRange_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
2;
- void UnsafeArenaSwap(DescriptorProto_ExtensionRange* other);
void Swap(DescriptorProto_ExtensionRange* other);
friend void swap(DescriptorProto_ExtensionRange& a, DescriptorProto_ExtensionRange& b) {
a.Swap(&b);
@@ -829,49 +707,39 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto
// implements Message ----------------------------------------------
- inline DescriptorProto_ExtensionRange* New() const final {
- return CreateMaybeMessage<DescriptorProto_ExtensionRange>(NULL);
- }
+ inline DescriptorProto_ExtensionRange* New() const PROTOBUF_FINAL { return New(NULL); }
- DescriptorProto_ExtensionRange* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<DescriptorProto_ExtensionRange>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ DescriptorProto_ExtensionRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const DescriptorProto_ExtensionRange& from);
void MergeFrom(const DescriptorProto_ExtensionRange& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(DescriptorProto_ExtensionRange* other);
- protected:
- explicit DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -881,16 +749,10 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- private:
- const ::google::protobuf::ExtensionRangeOptions& _internal_options() const;
- public:
const ::google::protobuf::ExtensionRangeOptions& options() const;
- ::google::protobuf::ExtensionRangeOptions* release_options();
::google::protobuf::ExtensionRangeOptions* mutable_options();
+ ::google::protobuf::ExtensionRangeOptions* release_options();
void set_allocated_options(::google::protobuf::ExtensionRangeOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::ExtensionRangeOptions* options);
- ::google::protobuf::ExtensionRangeOptions* unsafe_arena_release_options();
// optional int32 start = 1;
bool has_start() const;
@@ -916,15 +778,12 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto
void clear_has_options();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::ExtensionRangeOptions* options_;
::google::protobuf::int32 start_;
::google::protobuf::int32 end_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -961,24 +820,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ReservedRange : public ::google::protob
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const DescriptorProto_ReservedRange& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const DescriptorProto_ReservedRange* internal_default_instance() {
return reinterpret_cast<const DescriptorProto_ReservedRange*>(
&_DescriptorProto_ReservedRange_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
3;
- void UnsafeArenaSwap(DescriptorProto_ReservedRange* other);
void Swap(DescriptorProto_ReservedRange* other);
friend void swap(DescriptorProto_ReservedRange& a, DescriptorProto_ReservedRange& b) {
a.Swap(&b);
@@ -986,49 +837,39 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ReservedRange : public ::google::protob
// implements Message ----------------------------------------------
- inline DescriptorProto_ReservedRange* New() const final {
- return CreateMaybeMessage<DescriptorProto_ReservedRange>(NULL);
- }
+ inline DescriptorProto_ReservedRange* New() const PROTOBUF_FINAL { return New(NULL); }
- DescriptorProto_ReservedRange* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<DescriptorProto_ReservedRange>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ DescriptorProto_ReservedRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const DescriptorProto_ReservedRange& from);
void MergeFrom(const DescriptorProto_ReservedRange& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(DescriptorProto_ReservedRange* other);
- protected:
- explicit DescriptorProto_ReservedRange(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -1056,14 +897,11 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ReservedRange : public ::google::protob
void clear_has_end();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::int32 start_;
::google::protobuf::int32 end_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -1100,24 +938,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const DescriptorProto& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const DescriptorProto* internal_default_instance() {
return reinterpret_cast<const DescriptorProto*>(
&_DescriptorProto_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
4;
- void UnsafeArenaSwap(DescriptorProto* other);
void Swap(DescriptorProto* other);
friend void swap(DescriptorProto& a, DescriptorProto& b) {
a.Swap(&b);
@@ -1125,49 +955,39 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
// implements Message ----------------------------------------------
- inline DescriptorProto* New() const final {
- return CreateMaybeMessage<DescriptorProto>(NULL);
- }
+ inline DescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
- DescriptorProto* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<DescriptorProto>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ DescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const DescriptorProto& from);
void MergeFrom(const DescriptorProto& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(DescriptorProto* other);
- protected:
- explicit DescriptorProto(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -1180,11 +1000,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;
@@ -1192,11 +1012,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;
@@ -1204,11 +1024,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;
@@ -1216,11 +1036,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;
@@ -1228,11 +1048,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;
@@ -1240,11 +1060,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;
@@ -1252,11 +1072,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;
@@ -1296,30 +1116,15 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- ::std::string* name);
// optional .google.protobuf.MessageOptions options = 7;
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 7;
- private:
- const ::google::protobuf::MessageOptions& _internal_options() const;
- public:
const ::google::protobuf::MessageOptions& options() const;
- ::google::protobuf::MessageOptions* release_options();
::google::protobuf::MessageOptions* mutable_options();
+ ::google::protobuf::MessageOptions* release_options();
void set_allocated_options(::google::protobuf::MessageOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::MessageOptions* options);
- ::google::protobuf::MessageOptions* unsafe_arena_release_options();
// @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto)
private:
@@ -1329,11 +1134,8 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
void clear_has_options();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > field_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto > nested_type_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto > enum_type_;
@@ -1344,7 +1146,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
::google::protobuf::RepeatedPtrField< ::std::string> reserved_name_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::MessageOptions* options_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -1381,24 +1183,16 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const ExtensionRangeOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const ExtensionRangeOptions* internal_default_instance() {
return reinterpret_cast<const ExtensionRangeOptions*>(
&_ExtensionRangeOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
5;
- void UnsafeArenaSwap(ExtensionRangeOptions* other);
void Swap(ExtensionRangeOptions* other);
friend void swap(ExtensionRangeOptions& a, ExtensionRangeOptions& b) {
a.Swap(&b);
@@ -1406,49 +1200,39 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess
// implements Message ----------------------------------------------
- inline ExtensionRangeOptions* New() const final {
- return CreateMaybeMessage<ExtensionRangeOptions>(NULL);
- }
+ inline ExtensionRangeOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- ExtensionRangeOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<ExtensionRangeOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ ExtensionRangeOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const ExtensionRangeOptions& from);
void MergeFrom(const ExtensionRangeOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(ExtensionRangeOptions* other);
- protected:
- explicit ExtensionRangeOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -1458,11 +1242,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;
@@ -1473,13 +1257,10 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -1516,24 +1297,16 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const FieldDescriptorProto& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FieldDescriptorProto* internal_default_instance() {
return reinterpret_cast<const FieldDescriptorProto*>(
&_FieldDescriptorProto_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
6;
- void UnsafeArenaSwap(FieldDescriptorProto* other);
void Swap(FieldDescriptorProto* other);
friend void swap(FieldDescriptorProto& a, FieldDescriptorProto& b) {
a.Swap(&b);
@@ -1541,49 +1314,39 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
// implements Message ----------------------------------------------
- inline FieldDescriptorProto* New() const final {
- return CreateMaybeMessage<FieldDescriptorProto>(NULL);
- }
+ inline FieldDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
- FieldDescriptorProto* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<FieldDescriptorProto>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ FieldDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FieldDescriptorProto& from);
void MergeFrom(const FieldDescriptorProto& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(FieldDescriptorProto* other);
- protected:
- explicit FieldDescriptorProto(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -1689,15 +1452,6 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- ::std::string* name);
// optional string extendee = 2;
bool has_extendee() const;
@@ -1713,15 +1467,6 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
::std::string* mutable_extendee();
::std::string* release_extendee();
void set_allocated_extendee(::std::string* extendee);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_extendee();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_extendee(
- ::std::string* extendee);
// optional string type_name = 6;
bool has_type_name() const;
@@ -1737,15 +1482,6 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
::std::string* mutable_type_name();
::std::string* release_type_name();
void set_allocated_type_name(::std::string* type_name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_type_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_type_name(
- ::std::string* type_name);
// optional string default_value = 7;
bool has_default_value() const;
@@ -1761,15 +1497,6 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
::std::string* mutable_default_value();
::std::string* release_default_value();
void set_allocated_default_value(::std::string* default_value);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_default_value();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_default_value(
- ::std::string* default_value);
// optional string json_name = 10;
bool has_json_name() const;
@@ -1785,30 +1512,15 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
::std::string* mutable_json_name();
::std::string* release_json_name();
void set_allocated_json_name(::std::string* json_name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_json_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_json_name(
- ::std::string* json_name);
// optional .google.protobuf.FieldOptions options = 8;
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 8;
- private:
- const ::google::protobuf::FieldOptions& _internal_options() const;
- public:
const ::google::protobuf::FieldOptions& options() const;
- ::google::protobuf::FieldOptions* release_options();
::google::protobuf::FieldOptions* mutable_options();
+ ::google::protobuf::FieldOptions* release_options();
void set_allocated_options(::google::protobuf::FieldOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::FieldOptions* options);
- ::google::protobuf::FieldOptions* unsafe_arena_release_options();
// optional int32 number = 3;
bool has_number() const;
@@ -1862,11 +1574,8 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
void clear_has_options();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::internal::ArenaStringPtr extendee_;
::google::protobuf::internal::ArenaStringPtr type_name_;
@@ -1877,7 +1586,7 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
::google::protobuf::int32 oneof_index_;
int label_;
int type_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -1914,24 +1623,16 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const OneofDescriptorProto& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const OneofDescriptorProto* internal_default_instance() {
return reinterpret_cast<const OneofDescriptorProto*>(
&_OneofDescriptorProto_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
7;
- void UnsafeArenaSwap(OneofDescriptorProto* other);
void Swap(OneofDescriptorProto* other);
friend void swap(OneofDescriptorProto& a, OneofDescriptorProto& b) {
a.Swap(&b);
@@ -1939,49 +1640,39 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa
// implements Message ----------------------------------------------
- inline OneofDescriptorProto* New() const final {
- return CreateMaybeMessage<OneofDescriptorProto>(NULL);
- }
+ inline OneofDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
- OneofDescriptorProto* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<OneofDescriptorProto>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ OneofDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const OneofDescriptorProto& from);
void MergeFrom(const OneofDescriptorProto& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(OneofDescriptorProto* other);
- protected:
- explicit OneofDescriptorProto(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -2001,30 +1692,15 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- ::std::string* name);
// optional .google.protobuf.OneofOptions options = 2;
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 2;
- private:
- const ::google::protobuf::OneofOptions& _internal_options() const;
- public:
const ::google::protobuf::OneofOptions& options() const;
- ::google::protobuf::OneofOptions* release_options();
::google::protobuf::OneofOptions* mutable_options();
+ ::google::protobuf::OneofOptions* release_options();
void set_allocated_options(::google::protobuf::OneofOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::OneofOptions* options);
- ::google::protobuf::OneofOptions* unsafe_arena_release_options();
// @@protoc_insertion_point(class_scope:google.protobuf.OneofDescriptorProto)
private:
@@ -2034,153 +1710,11 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa
void clear_has_options();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::OneofOptions* options_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
-};
-// -------------------------------------------------------------------
-
-class LIBPROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumDescriptorProto.EnumReservedRange) */ {
- public:
- EnumDescriptorProto_EnumReservedRange();
- virtual ~EnumDescriptorProto_EnumReservedRange();
-
- EnumDescriptorProto_EnumReservedRange(const EnumDescriptorProto_EnumReservedRange& from);
-
- inline EnumDescriptorProto_EnumReservedRange& operator=(const EnumDescriptorProto_EnumReservedRange& from) {
- CopyFrom(from);
- return *this;
- }
- #if LANG_CXX11
- EnumDescriptorProto_EnumReservedRange(EnumDescriptorProto_EnumReservedRange&& from) noexcept
- : EnumDescriptorProto_EnumReservedRange() {
- *this = ::std::move(from);
- }
-
- inline EnumDescriptorProto_EnumReservedRange& operator=(EnumDescriptorProto_EnumReservedRange&& from) noexcept {
- if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
- if (this != &from) InternalSwap(&from);
- } else {
- CopyFrom(from);
- }
- return *this;
- }
- #endif
- inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
- return _internal_metadata_.unknown_fields();
- }
- inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
- return _internal_metadata_.mutable_unknown_fields();
- }
-
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
- static const ::google::protobuf::Descriptor* descriptor();
- static const EnumDescriptorProto_EnumReservedRange& default_instance();
-
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
- static inline const EnumDescriptorProto_EnumReservedRange* internal_default_instance() {
- return reinterpret_cast<const EnumDescriptorProto_EnumReservedRange*>(
- &_EnumDescriptorProto_EnumReservedRange_default_instance_);
- }
- static constexpr int kIndexInFileMessages =
- 8;
-
- void UnsafeArenaSwap(EnumDescriptorProto_EnumReservedRange* other);
- void Swap(EnumDescriptorProto_EnumReservedRange* other);
- friend void swap(EnumDescriptorProto_EnumReservedRange& a, EnumDescriptorProto_EnumReservedRange& b) {
- a.Swap(&b);
- }
-
- // implements Message ----------------------------------------------
-
- inline EnumDescriptorProto_EnumReservedRange* New() const final {
- return CreateMaybeMessage<EnumDescriptorProto_EnumReservedRange>(NULL);
- }
-
- EnumDescriptorProto_EnumReservedRange* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<EnumDescriptorProto_EnumReservedRange>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
- void CopyFrom(const EnumDescriptorProto_EnumReservedRange& from);
- void MergeFrom(const EnumDescriptorProto_EnumReservedRange& from);
- void Clear() final;
- bool IsInitialized() const final;
-
- size_t ByteSizeLong() const final;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
- ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const final;
- void InternalSwap(EnumDescriptorProto_EnumReservedRange* other);
- protected:
- explicit EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
- private:
- inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
- }
- inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
- }
- public:
-
- ::google::protobuf::Metadata GetMetadata() const final;
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- // optional int32 start = 1;
- bool has_start() const;
- void clear_start();
- static const int kStartFieldNumber = 1;
- ::google::protobuf::int32 start() const;
- void set_start(::google::protobuf::int32 value);
-
- // optional int32 end = 2;
- bool has_end() const;
- void clear_end();
- static const int kEndFieldNumber = 2;
- ::google::protobuf::int32 end() const;
- void set_end(::google::protobuf::int32 value);
-
- // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- private:
- void set_has_start();
- void clear_has_start();
- void set_has_end();
- void clear_has_end();
-
- ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
- ::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- ::google::protobuf::int32 start_;
- ::google::protobuf::int32 end_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -2217,24 +1751,16 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const EnumDescriptorProto& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const EnumDescriptorProto* internal_default_instance() {
return reinterpret_cast<const EnumDescriptorProto*>(
&_EnumDescriptorProto_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 9;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 8;
- void UnsafeArenaSwap(EnumDescriptorProto* other);
void Swap(EnumDescriptorProto* other);
friend void swap(EnumDescriptorProto& a, EnumDescriptorProto& b) {
a.Swap(&b);
@@ -2242,102 +1768,56 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
// implements Message ----------------------------------------------
- inline EnumDescriptorProto* New() const final {
- return CreateMaybeMessage<EnumDescriptorProto>(NULL);
- }
+ inline EnumDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
- EnumDescriptorProto* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<EnumDescriptorProto>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ EnumDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumDescriptorProto& from);
void MergeFrom(const EnumDescriptorProto& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(EnumDescriptorProto* other);
- protected:
- explicit EnumDescriptorProto(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
- typedef EnumDescriptorProto_EnumReservedRange EnumReservedRange;
-
// accessors -------------------------------------------------------
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
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;
- // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
- int reserved_range_size() const;
- void clear_reserved_range();
- static const int kReservedRangeFieldNumber = 4;
- ::google::protobuf::EnumDescriptorProto_EnumReservedRange* mutable_reserved_range(int index);
- ::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;
-
- // repeated string reserved_name = 5;
- int reserved_name_size() const;
- void clear_reserved_name();
- static const int kReservedNameFieldNumber = 5;
- const ::std::string& reserved_name(int index) const;
- ::std::string* mutable_reserved_name(int index);
- void set_reserved_name(int index, const ::std::string& value);
- #if LANG_CXX11
- void set_reserved_name(int index, ::std::string&& value);
- #endif
- void set_reserved_name(int index, const char* value);
- void set_reserved_name(int index, const char* value, size_t size);
- ::std::string* add_reserved_name();
- void add_reserved_name(const ::std::string& value);
- #if LANG_CXX11
- void add_reserved_name(::std::string&& value);
- #endif
- void add_reserved_name(const char* value);
- void add_reserved_name(const char* value, size_t size);
- const ::google::protobuf::RepeatedPtrField< ::std::string>& reserved_name() const;
- ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_reserved_name();
-
// optional string name = 1;
bool has_name() const;
void clear_name();
@@ -2352,30 +1832,15 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- ::std::string* name);
// optional .google.protobuf.EnumOptions options = 3;
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- private:
- const ::google::protobuf::EnumOptions& _internal_options() const;
- public:
const ::google::protobuf::EnumOptions& options() const;
- ::google::protobuf::EnumOptions* release_options();
::google::protobuf::EnumOptions* mutable_options();
+ ::google::protobuf::EnumOptions* release_options();
void set_allocated_options(::google::protobuf::EnumOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::EnumOptions* options);
- ::google::protobuf::EnumOptions* unsafe_arena_release_options();
// @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto)
private:
@@ -2385,17 +1850,12 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
void clear_has_options();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto > value_;
- ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange > reserved_range_;
- ::google::protobuf::RepeatedPtrField< ::std::string> reserved_name_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::EnumOptions* options_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -2432,24 +1892,16 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const EnumValueDescriptorProto& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const EnumValueDescriptorProto* internal_default_instance() {
return reinterpret_cast<const EnumValueDescriptorProto*>(
&_EnumValueDescriptorProto_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 10;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 9;
- void UnsafeArenaSwap(EnumValueDescriptorProto* other);
void Swap(EnumValueDescriptorProto* other);
friend void swap(EnumValueDescriptorProto& a, EnumValueDescriptorProto& b) {
a.Swap(&b);
@@ -2457,49 +1909,39 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M
// implements Message ----------------------------------------------
- inline EnumValueDescriptorProto* New() const final {
- return CreateMaybeMessage<EnumValueDescriptorProto>(NULL);
- }
+ inline EnumValueDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
- EnumValueDescriptorProto* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<EnumValueDescriptorProto>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ EnumValueDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumValueDescriptorProto& from);
void MergeFrom(const EnumValueDescriptorProto& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(EnumValueDescriptorProto* other);
- protected:
- explicit EnumValueDescriptorProto(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -2519,30 +1961,15 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- ::std::string* name);
// optional .google.protobuf.EnumValueOptions options = 3;
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- private:
- const ::google::protobuf::EnumValueOptions& _internal_options() const;
- public:
const ::google::protobuf::EnumValueOptions& options() const;
- ::google::protobuf::EnumValueOptions* release_options();
::google::protobuf::EnumValueOptions* mutable_options();
+ ::google::protobuf::EnumValueOptions* release_options();
void set_allocated_options(::google::protobuf::EnumValueOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::EnumValueOptions* options);
- ::google::protobuf::EnumValueOptions* unsafe_arena_release_options();
// optional int32 number = 2;
bool has_number() const;
@@ -2561,15 +1988,12 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M
void clear_has_options();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::EnumValueOptions* options_;
::google::protobuf::int32 number_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -2606,24 +2030,16 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const ServiceDescriptorProto& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const ServiceDescriptorProto* internal_default_instance() {
return reinterpret_cast<const ServiceDescriptorProto*>(
&_ServiceDescriptorProto_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 11;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 10;
- void UnsafeArenaSwap(ServiceDescriptorProto* other);
void Swap(ServiceDescriptorProto* other);
friend void swap(ServiceDescriptorProto& a, ServiceDescriptorProto& b) {
a.Swap(&b);
@@ -2631,49 +2047,39 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes
// implements Message ----------------------------------------------
- inline ServiceDescriptorProto* New() const final {
- return CreateMaybeMessage<ServiceDescriptorProto>(NULL);
- }
+ inline ServiceDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
- ServiceDescriptorProto* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<ServiceDescriptorProto>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ ServiceDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const ServiceDescriptorProto& from);
void MergeFrom(const ServiceDescriptorProto& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(ServiceDescriptorProto* other);
- protected:
- explicit ServiceDescriptorProto(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -2683,11 +2089,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;
@@ -2705,30 +2111,15 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- ::std::string* name);
// optional .google.protobuf.ServiceOptions options = 3;
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- private:
- const ::google::protobuf::ServiceOptions& _internal_options() const;
- public:
const ::google::protobuf::ServiceOptions& options() const;
- ::google::protobuf::ServiceOptions* release_options();
::google::protobuf::ServiceOptions* mutable_options();
+ ::google::protobuf::ServiceOptions* release_options();
void set_allocated_options(::google::protobuf::ServiceOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::ServiceOptions* options);
- ::google::protobuf::ServiceOptions* unsafe_arena_release_options();
// @@protoc_insertion_point(class_scope:google.protobuf.ServiceDescriptorProto)
private:
@@ -2738,15 +2129,12 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes
void clear_has_options();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto > method_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::ServiceOptions* options_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -2783,24 +2171,16 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const MethodDescriptorProto& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const MethodDescriptorProto* internal_default_instance() {
return reinterpret_cast<const MethodDescriptorProto*>(
&_MethodDescriptorProto_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 12;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 11;
- void UnsafeArenaSwap(MethodDescriptorProto* other);
void Swap(MethodDescriptorProto* other);
friend void swap(MethodDescriptorProto& a, MethodDescriptorProto& b) {
a.Swap(&b);
@@ -2808,49 +2188,39 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
// implements Message ----------------------------------------------
- inline MethodDescriptorProto* New() const final {
- return CreateMaybeMessage<MethodDescriptorProto>(NULL);
- }
+ inline MethodDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
- MethodDescriptorProto* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<MethodDescriptorProto>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ MethodDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const MethodDescriptorProto& from);
void MergeFrom(const MethodDescriptorProto& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(MethodDescriptorProto* other);
- protected:
- explicit MethodDescriptorProto(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -2870,15 +2240,6 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- ::std::string* name);
// optional string input_type = 2;
bool has_input_type() const;
@@ -2894,15 +2255,6 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
::std::string* mutable_input_type();
::std::string* release_input_type();
void set_allocated_input_type(::std::string* input_type);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_input_type();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_input_type(
- ::std::string* input_type);
// optional string output_type = 3;
bool has_output_type() const;
@@ -2918,30 +2270,15 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
::std::string* mutable_output_type();
::std::string* release_output_type();
void set_allocated_output_type(::std::string* output_type);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_output_type();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_output_type(
- ::std::string* output_type);
// optional .google.protobuf.MethodOptions options = 4;
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 4;
- private:
- const ::google::protobuf::MethodOptions& _internal_options() const;
- public:
const ::google::protobuf::MethodOptions& options() const;
- ::google::protobuf::MethodOptions* release_options();
::google::protobuf::MethodOptions* mutable_options();
+ ::google::protobuf::MethodOptions* release_options();
void set_allocated_options(::google::protobuf::MethodOptions* options);
- void unsafe_arena_set_allocated_options(
- ::google::protobuf::MethodOptions* options);
- ::google::protobuf::MethodOptions* unsafe_arena_release_options();
// optional bool client_streaming = 5 [default = false];
bool has_client_streaming() const;
@@ -2973,18 +2310,15 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
void clear_has_server_streaming();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::internal::ArenaStringPtr input_type_;
::google::protobuf::internal::ArenaStringPtr output_type_;
::google::protobuf::MethodOptions* options_;
bool client_streaming_;
bool server_streaming_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -3021,24 +2355,16 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const FileOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FileOptions* internal_default_instance() {
return reinterpret_cast<const FileOptions*>(
&_FileOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 13;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 12;
- void UnsafeArenaSwap(FileOptions* other);
void Swap(FileOptions* other);
friend void swap(FileOptions& a, FileOptions& b) {
a.Swap(&b);
@@ -3046,49 +2372,39 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline FileOptions* New() const final {
- return CreateMaybeMessage<FileOptions>(NULL);
- }
+ inline FileOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- FileOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<FileOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ FileOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FileOptions& from);
void MergeFrom(const FileOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(FileOptions* other);
- protected:
- explicit FileOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -3126,11 +2442,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;
@@ -3148,15 +2464,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::std::string* mutable_java_package();
::std::string* release_java_package();
void set_allocated_java_package(::std::string* java_package);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_java_package();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_java_package(
- ::std::string* java_package);
// optional string java_outer_classname = 8;
bool has_java_outer_classname() const;
@@ -3172,15 +2479,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::std::string* mutable_java_outer_classname();
::std::string* release_java_outer_classname();
void set_allocated_java_outer_classname(::std::string* java_outer_classname);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_java_outer_classname();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_java_outer_classname(
- ::std::string* java_outer_classname);
// optional string go_package = 11;
bool has_go_package() const;
@@ -3196,15 +2494,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::std::string* mutable_go_package();
::std::string* release_go_package();
void set_allocated_go_package(::std::string* go_package);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_go_package();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_go_package(
- ::std::string* go_package);
// optional string objc_class_prefix = 36;
bool has_objc_class_prefix() const;
@@ -3220,15 +2509,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::std::string* mutable_objc_class_prefix();
::std::string* release_objc_class_prefix();
void set_allocated_objc_class_prefix(::std::string* objc_class_prefix);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_objc_class_prefix();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_objc_class_prefix(
- ::std::string* objc_class_prefix);
// optional string csharp_namespace = 37;
bool has_csharp_namespace() const;
@@ -3244,15 +2524,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::std::string* mutable_csharp_namespace();
::std::string* release_csharp_namespace();
void set_allocated_csharp_namespace(::std::string* csharp_namespace);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_csharp_namespace();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_csharp_namespace(
- ::std::string* csharp_namespace);
// optional string swift_prefix = 39;
bool has_swift_prefix() const;
@@ -3268,15 +2539,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::std::string* mutable_swift_prefix();
::std::string* release_swift_prefix();
void set_allocated_swift_prefix(::std::string* swift_prefix);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_swift_prefix();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_swift_prefix(
- ::std::string* swift_prefix);
// optional string php_class_prefix = 40;
bool has_php_class_prefix() const;
@@ -3292,15 +2554,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::std::string* mutable_php_class_prefix();
::std::string* release_php_class_prefix();
void set_allocated_php_class_prefix(::std::string* php_class_prefix);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_php_class_prefix();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_php_class_prefix(
- ::std::string* php_class_prefix);
// optional string php_namespace = 41;
bool has_php_namespace() const;
@@ -3316,63 +2569,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::std::string* mutable_php_namespace();
::std::string* release_php_namespace();
void set_allocated_php_namespace(::std::string* php_namespace);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_php_namespace();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_php_namespace(
- ::std::string* php_namespace);
-
- // optional string php_metadata_namespace = 44;
- bool has_php_metadata_namespace() const;
- void clear_php_metadata_namespace();
- static const int kPhpMetadataNamespaceFieldNumber = 44;
- const ::std::string& php_metadata_namespace() const;
- void set_php_metadata_namespace(const ::std::string& value);
- #if LANG_CXX11
- void set_php_metadata_namespace(::std::string&& value);
- #endif
- void set_php_metadata_namespace(const char* value);
- void set_php_metadata_namespace(const char* value, size_t size);
- ::std::string* mutable_php_metadata_namespace();
- ::std::string* release_php_metadata_namespace();
- void set_allocated_php_metadata_namespace(::std::string* php_metadata_namespace);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_php_metadata_namespace();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_php_metadata_namespace(
- ::std::string* php_metadata_namespace);
-
- // optional string ruby_package = 45;
- bool has_ruby_package() const;
- void clear_ruby_package();
- static const int kRubyPackageFieldNumber = 45;
- const ::std::string& ruby_package() const;
- void set_ruby_package(const ::std::string& value);
- #if LANG_CXX11
- void set_ruby_package(::std::string&& value);
- #endif
- void set_ruby_package(const char* value);
- void set_ruby_package(const char* value, size_t size);
- ::std::string* mutable_ruby_package();
- ::std::string* release_ruby_package();
- void set_allocated_ruby_package(::std::string* ruby_package);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_ruby_package();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_ruby_package(
- ::std::string* ruby_package);
// optional bool java_multiple_files = 10 [default = false];
bool has_java_multiple_files() const;
@@ -3416,10 +2612,10 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
bool py_generic_services() const;
void set_py_generic_services(bool value);
- // optional bool php_generic_services = 42 [default = false];
+ // optional bool php_generic_services = 19 [default = false];
bool has_php_generic_services() const;
void clear_php_generic_services();
- static const int kPhpGenericServicesFieldNumber = 42;
+ static const int kPhpGenericServicesFieldNumber = 19;
bool php_generic_services() const;
void set_php_generic_services(bool value);
@@ -3483,19 +2679,12 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
void clear_has_php_class_prefix();
void set_has_php_namespace();
void clear_has_php_namespace();
- void set_has_php_metadata_namespace();
- void clear_has_php_metadata_namespace();
- void set_has_ruby_package();
- void clear_has_ruby_package();
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
::google::protobuf::internal::ArenaStringPtr java_package_;
::google::protobuf::internal::ArenaStringPtr java_outer_classname_;
@@ -3505,8 +2694,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
::google::protobuf::internal::ArenaStringPtr swift_prefix_;
::google::protobuf::internal::ArenaStringPtr php_class_prefix_;
::google::protobuf::internal::ArenaStringPtr php_namespace_;
- ::google::protobuf::internal::ArenaStringPtr php_metadata_namespace_;
- ::google::protobuf::internal::ArenaStringPtr ruby_package_;
bool java_multiple_files_;
bool java_generate_equals_and_hash_;
bool java_string_check_utf8_;
@@ -3517,7 +2704,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
bool deprecated_;
bool cc_enable_arenas_;
int optimize_for_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -3554,24 +2741,16 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /*
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const MessageOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const MessageOptions* internal_default_instance() {
return reinterpret_cast<const MessageOptions*>(
&_MessageOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 14;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 13;
- void UnsafeArenaSwap(MessageOptions* other);
void Swap(MessageOptions* other);
friend void swap(MessageOptions& a, MessageOptions& b) {
a.Swap(&b);
@@ -3579,49 +2758,39 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /*
// implements Message ----------------------------------------------
- inline MessageOptions* New() const final {
- return CreateMaybeMessage<MessageOptions>(NULL);
- }
+ inline MessageOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- MessageOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<MessageOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ MessageOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const MessageOptions& from);
void MergeFrom(const MessageOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(MessageOptions* other);
- protected:
- explicit MessageOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -3631,11 +2800,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;
@@ -3682,17 +2851,14 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /*
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
bool message_set_wire_format_;
bool no_standard_descriptor_accessor_;
bool deprecated_;
bool map_entry_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -3729,24 +2895,16 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const FieldOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FieldOptions* internal_default_instance() {
return reinterpret_cast<const FieldOptions*>(
&_FieldOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 15;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 14;
- void UnsafeArenaSwap(FieldOptions* other);
void Swap(FieldOptions* other);
friend void swap(FieldOptions& a, FieldOptions& b) {
a.Swap(&b);
@@ -3754,49 +2912,39 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@
// implements Message ----------------------------------------------
- inline FieldOptions* New() const final {
- return CreateMaybeMessage<FieldOptions>(NULL);
- }
+ inline FieldOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- FieldOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<FieldOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ FieldOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FieldOptions& from);
void MergeFrom(const FieldOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(FieldOptions* other);
- protected:
- explicit FieldOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -3862,11 +3010,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;
@@ -3931,11 +3079,8 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
int ctype_;
bool packed_;
@@ -3943,7 +3088,7 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@
bool deprecated_;
bool weak_;
int jstype_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -3980,24 +3125,16 @@ class LIBPROTOBUF_EXPORT OneofOptions : public ::google::protobuf::Message /* @@
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const OneofOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const OneofOptions* internal_default_instance() {
return reinterpret_cast<const OneofOptions*>(
&_OneofOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 16;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 15;
- void UnsafeArenaSwap(OneofOptions* other);
void Swap(OneofOptions* other);
friend void swap(OneofOptions& a, OneofOptions& b) {
a.Swap(&b);
@@ -4005,49 +3142,39 @@ class LIBPROTOBUF_EXPORT OneofOptions : public ::google::protobuf::Message /* @@
// implements Message ----------------------------------------------
- inline OneofOptions* New() const final {
- return CreateMaybeMessage<OneofOptions>(NULL);
- }
+ inline OneofOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- OneofOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<OneofOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ OneofOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const OneofOptions& from);
void MergeFrom(const OneofOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(OneofOptions* other);
- protected:
- explicit OneofOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -4057,11 +3184,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;
@@ -4072,13 +3199,10 @@ class LIBPROTOBUF_EXPORT OneofOptions : public ::google::protobuf::Message /* @@
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -4115,24 +3239,16 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message /* @@p
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const EnumOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const EnumOptions* internal_default_instance() {
return reinterpret_cast<const EnumOptions*>(
&_EnumOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 17;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 16;
- void UnsafeArenaSwap(EnumOptions* other);
void Swap(EnumOptions* other);
friend void swap(EnumOptions& a, EnumOptions& b) {
a.Swap(&b);
@@ -4140,49 +3256,39 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline EnumOptions* New() const final {
- return CreateMaybeMessage<EnumOptions>(NULL);
- }
+ inline EnumOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- EnumOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<EnumOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ EnumOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumOptions& from);
void MergeFrom(const EnumOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(EnumOptions* other);
- protected:
- explicit EnumOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -4192,11 +3298,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;
@@ -4225,15 +3331,12 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message /* @@p
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
bool allow_alias_;
bool deprecated_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -4270,24 +3373,16 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message /
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const EnumValueOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const EnumValueOptions* internal_default_instance() {
return reinterpret_cast<const EnumValueOptions*>(
&_EnumValueOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 18;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 17;
- void UnsafeArenaSwap(EnumValueOptions* other);
void Swap(EnumValueOptions* other);
friend void swap(EnumValueOptions& a, EnumValueOptions& b) {
a.Swap(&b);
@@ -4295,49 +3390,39 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message /
// implements Message ----------------------------------------------
- inline EnumValueOptions* New() const final {
- return CreateMaybeMessage<EnumValueOptions>(NULL);
- }
+ inline EnumValueOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- EnumValueOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<EnumValueOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ EnumValueOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumValueOptions& from);
void MergeFrom(const EnumValueOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(EnumValueOptions* other);
- protected:
- explicit EnumValueOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -4347,11 +3432,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;
@@ -4371,14 +3456,11 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message /
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
bool deprecated_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -4415,24 +3497,16 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message /*
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const ServiceOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const ServiceOptions* internal_default_instance() {
return reinterpret_cast<const ServiceOptions*>(
&_ServiceOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 19;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 18;
- void UnsafeArenaSwap(ServiceOptions* other);
void Swap(ServiceOptions* other);
friend void swap(ServiceOptions& a, ServiceOptions& b) {
a.Swap(&b);
@@ -4440,49 +3514,39 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message /*
// implements Message ----------------------------------------------
- inline ServiceOptions* New() const final {
- return CreateMaybeMessage<ServiceOptions>(NULL);
- }
+ inline ServiceOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- ServiceOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<ServiceOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ ServiceOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const ServiceOptions& from);
void MergeFrom(const ServiceOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(ServiceOptions* other);
- protected:
- explicit ServiceOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -4492,11 +3556,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;
@@ -4516,14 +3580,11 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message /*
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
bool deprecated_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -4560,24 +3621,16 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message /* @
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const MethodOptions& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const MethodOptions* internal_default_instance() {
return reinterpret_cast<const MethodOptions*>(
&_MethodOptions_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 20;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 19;
- void UnsafeArenaSwap(MethodOptions* other);
void Swap(MethodOptions* other);
friend void swap(MethodOptions& a, MethodOptions& b) {
a.Swap(&b);
@@ -4585,49 +3638,39 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message /* @
// implements Message ----------------------------------------------
- inline MethodOptions* New() const final {
- return CreateMaybeMessage<MethodOptions>(NULL);
- }
+ inline MethodOptions* New() const PROTOBUF_FINAL { return New(NULL); }
- MethodOptions* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<MethodOptions>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ MethodOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const MethodOptions& from);
void MergeFrom(const MethodOptions& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(MethodOptions* other);
- protected:
- explicit MethodOptions(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -4665,11 +3708,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;
@@ -4698,15 +3741,12 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message /* @
::google::protobuf::internal::ExtensionSet _extensions_;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
bool deprecated_;
int idempotency_level_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -4743,24 +3783,16 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const UninterpretedOption_NamePart& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const UninterpretedOption_NamePart* internal_default_instance() {
return reinterpret_cast<const UninterpretedOption_NamePart*>(
&_UninterpretedOption_NamePart_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 21;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 20;
- void UnsafeArenaSwap(UninterpretedOption_NamePart* other);
void Swap(UninterpretedOption_NamePart* other);
friend void swap(UninterpretedOption_NamePart& a, UninterpretedOption_NamePart& b) {
a.Swap(&b);
@@ -4768,49 +3800,39 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu
// implements Message ----------------------------------------------
- inline UninterpretedOption_NamePart* New() const final {
- return CreateMaybeMessage<UninterpretedOption_NamePart>(NULL);
- }
+ inline UninterpretedOption_NamePart* New() const PROTOBUF_FINAL { return New(NULL); }
- UninterpretedOption_NamePart* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<UninterpretedOption_NamePart>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ UninterpretedOption_NamePart* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const UninterpretedOption_NamePart& from);
void MergeFrom(const UninterpretedOption_NamePart& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(UninterpretedOption_NamePart* other);
- protected:
- explicit UninterpretedOption_NamePart(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -4830,15 +3852,6 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu
::std::string* mutable_name_part();
::std::string* release_name_part();
void set_allocated_name_part(::std::string* name_part);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_name_part();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name_part(
- ::std::string* name_part);
// required bool is_extension = 2;
bool has_is_extension() const;
@@ -4858,14 +3871,11 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu
size_t RequiredFieldsByteSizeFallback() const;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::internal::ArenaStringPtr name_part_;
bool is_extension_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -4902,24 +3912,16 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const UninterpretedOption& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const UninterpretedOption* internal_default_instance() {
return reinterpret_cast<const UninterpretedOption*>(
&_UninterpretedOption_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 22;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 21;
- void UnsafeArenaSwap(UninterpretedOption* other);
void Swap(UninterpretedOption* other);
friend void swap(UninterpretedOption& a, UninterpretedOption& b) {
a.Swap(&b);
@@ -4927,49 +3929,39 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
// implements Message ----------------------------------------------
- inline UninterpretedOption* New() const final {
- return CreateMaybeMessage<UninterpretedOption>(NULL);
- }
+ inline UninterpretedOption* New() const PROTOBUF_FINAL { return New(NULL); }
- UninterpretedOption* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<UninterpretedOption>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ UninterpretedOption* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const UninterpretedOption& from);
void MergeFrom(const UninterpretedOption& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(UninterpretedOption* other);
- protected:
- explicit UninterpretedOption(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -4981,11 +3973,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;
@@ -5003,15 +3995,6 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
::std::string* mutable_identifier_value();
::std::string* release_identifier_value();
void set_allocated_identifier_value(::std::string* identifier_value);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_identifier_value();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_identifier_value(
- ::std::string* identifier_value);
// optional bytes string_value = 7;
bool has_string_value() const;
@@ -5027,15 +4010,6 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
::std::string* mutable_string_value();
::std::string* release_string_value();
void set_allocated_string_value(::std::string* string_value);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_string_value();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_string_value(
- ::std::string* string_value);
// optional string aggregate_value = 8;
bool has_aggregate_value() const;
@@ -5051,15 +4025,6 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
::std::string* mutable_aggregate_value();
::std::string* release_aggregate_value();
void set_allocated_aggregate_value(::std::string* aggregate_value);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_aggregate_value();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_aggregate_value(
- ::std::string* aggregate_value);
// optional uint64 positive_int_value = 4;
bool has_positive_int_value() const;
@@ -5098,11 +4063,8 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
void clear_has_aggregate_value();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart > name_;
::google::protobuf::internal::ArenaStringPtr identifier_value_;
::google::protobuf::internal::ArenaStringPtr string_value_;
@@ -5110,7 +4072,7 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
::google::protobuf::uint64 positive_int_value_;
::google::protobuf::int64 negative_int_value_;
double double_value_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -5147,24 +4109,16 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const SourceCodeInfo_Location& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const SourceCodeInfo_Location* internal_default_instance() {
return reinterpret_cast<const SourceCodeInfo_Location*>(
&_SourceCodeInfo_Location_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 23;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 22;
- void UnsafeArenaSwap(SourceCodeInfo_Location* other);
void Swap(SourceCodeInfo_Location* other);
friend void swap(SourceCodeInfo_Location& a, SourceCodeInfo_Location& b) {
a.Swap(&b);
@@ -5172,49 +4126,39 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me
// implements Message ----------------------------------------------
- inline SourceCodeInfo_Location* New() const final {
- return CreateMaybeMessage<SourceCodeInfo_Location>(NULL);
- }
+ inline SourceCodeInfo_Location* New() const PROTOBUF_FINAL { return New(NULL); }
- SourceCodeInfo_Location* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<SourceCodeInfo_Location>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ SourceCodeInfo_Location* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const SourceCodeInfo_Location& from);
void MergeFrom(const SourceCodeInfo_Location& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(SourceCodeInfo_Location* other);
- protected:
- explicit SourceCodeInfo_Location(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -5280,15 +4224,6 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me
::std::string* mutable_leading_comments();
::std::string* release_leading_comments();
void set_allocated_leading_comments(::std::string* leading_comments);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_leading_comments();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_leading_comments(
- ::std::string* leading_comments);
// optional string trailing_comments = 4;
bool has_trailing_comments() const;
@@ -5304,15 +4239,6 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me
::std::string* mutable_trailing_comments();
::std::string* release_trailing_comments();
void set_allocated_trailing_comments(::std::string* trailing_comments);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_trailing_comments();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_trailing_comments(
- ::std::string* trailing_comments);
// @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo.Location)
private:
@@ -5322,11 +4248,8 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me
void clear_has_trailing_comments();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > path_;
mutable int _path_cached_byte_size_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > span_;
@@ -5334,7 +4257,7 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me
::google::protobuf::RepeatedPtrField< ::std::string> leading_detached_comments_;
::google::protobuf::internal::ArenaStringPtr leading_comments_;
::google::protobuf::internal::ArenaStringPtr trailing_comments_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -5371,24 +4294,16 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message /*
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const SourceCodeInfo& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const SourceCodeInfo* internal_default_instance() {
return reinterpret_cast<const SourceCodeInfo*>(
&_SourceCodeInfo_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 24;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 23;
- void UnsafeArenaSwap(SourceCodeInfo* other);
void Swap(SourceCodeInfo* other);
friend void swap(SourceCodeInfo& a, SourceCodeInfo& b) {
a.Swap(&b);
@@ -5396,49 +4311,39 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message /*
// implements Message ----------------------------------------------
- inline SourceCodeInfo* New() const final {
- return CreateMaybeMessage<SourceCodeInfo>(NULL);
- }
+ inline SourceCodeInfo* New() const PROTOBUF_FINAL { return New(NULL); }
- SourceCodeInfo* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<SourceCodeInfo>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ SourceCodeInfo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const SourceCodeInfo& from);
void MergeFrom(const SourceCodeInfo& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(SourceCodeInfo* other);
- protected:
- explicit SourceCodeInfo(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -5450,11 +4355,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;
@@ -5462,13 +4367,10 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message /*
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location > location_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -5505,24 +4407,16 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const GeneratedCodeInfo_Annotation& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const GeneratedCodeInfo_Annotation* internal_default_instance() {
return reinterpret_cast<const GeneratedCodeInfo_Annotation*>(
&_GeneratedCodeInfo_Annotation_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 25;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 24;
- void UnsafeArenaSwap(GeneratedCodeInfo_Annotation* other);
void Swap(GeneratedCodeInfo_Annotation* other);
friend void swap(GeneratedCodeInfo_Annotation& a, GeneratedCodeInfo_Annotation& b) {
a.Swap(&b);
@@ -5530,49 +4424,39 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu
// implements Message ----------------------------------------------
- inline GeneratedCodeInfo_Annotation* New() const final {
- return CreateMaybeMessage<GeneratedCodeInfo_Annotation>(NULL);
- }
+ inline GeneratedCodeInfo_Annotation* New() const PROTOBUF_FINAL { return New(NULL); }
- GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<GeneratedCodeInfo_Annotation>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const GeneratedCodeInfo_Annotation& from);
void MergeFrom(const GeneratedCodeInfo_Annotation& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(GeneratedCodeInfo_Annotation* other);
- protected:
- explicit GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -5604,15 +4488,6 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu
::std::string* mutable_source_file();
::std::string* release_source_file();
void set_allocated_source_file(::std::string* source_file);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- ::std::string* unsafe_arena_release_source_file();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_source_file(
- ::std::string* source_file);
// optional int32 begin = 3;
bool has_begin() const;
@@ -5638,17 +4513,14 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu
void clear_has_end();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > path_;
mutable int _path_cached_byte_size_;
::google::protobuf::internal::ArenaStringPtr source_file_;
::google::protobuf::int32 begin_;
::google::protobuf::int32 end_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -5685,24 +4557,16 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message
return _internal_metadata_.mutable_unknown_fields();
}
- inline ::google::protobuf::Arena* GetArena() const final {
- return GetArenaNoVirtual();
- }
- inline void* GetMaybeArenaPointer() const final {
- return MaybeArenaPtr();
- }
static const ::google::protobuf::Descriptor* descriptor();
static const GeneratedCodeInfo& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const GeneratedCodeInfo* internal_default_instance() {
return reinterpret_cast<const GeneratedCodeInfo*>(
&_GeneratedCodeInfo_default_instance_);
}
- static constexpr int kIndexInFileMessages =
- 26;
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+ 25;
- void UnsafeArenaSwap(GeneratedCodeInfo* other);
void Swap(GeneratedCodeInfo* other);
friend void swap(GeneratedCodeInfo& a, GeneratedCodeInfo& b) {
a.Swap(&b);
@@ -5710,49 +4574,39 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message
// implements Message ----------------------------------------------
- inline GeneratedCodeInfo* New() const final {
- return CreateMaybeMessage<GeneratedCodeInfo>(NULL);
- }
+ inline GeneratedCodeInfo* New() const PROTOBUF_FINAL { return New(NULL); }
- GeneratedCodeInfo* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<GeneratedCodeInfo>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ GeneratedCodeInfo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const GeneratedCodeInfo& from);
void MergeFrom(const GeneratedCodeInfo& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(GeneratedCodeInfo* other);
- protected:
- explicit GeneratedCodeInfo(::google::protobuf::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return _internal_metadata_.arena();
+ return NULL;
}
inline void* MaybeArenaPtr() const {
- return _internal_metadata_.raw_arena_ptr();
+ return NULL;
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -5764,11 +4618,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;
@@ -5776,19 +4630,17 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation > annotation_;
- friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -5802,23 +4654,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)
@@ -5840,52 +4692,47 @@ inline void FileDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void FileDescriptorProto::clear_name() {
- name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
inline const ::std::string& FileDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.name)
- return name_.Get();
+ return name_.GetNoArena();
}
inline void FileDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name)
}
#if LANG_CXX11
inline void FileDescriptorProto::set_name(::std::string&& value) {
set_has_name();
- name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.name)
}
#endif
inline void FileDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.name)
}
-inline void FileDescriptorProto::set_name(const char* value,
- size_t size) {
+inline void FileDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.name)
}
inline ::std::string* FileDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name)
- return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -5893,29 +4740,9 @@ inline void FileDescriptorProto::set_allocated_name(::std::string* name) {
} else {
clear_has_name();
}
- name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaNoVirtual());
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name)
}
-inline ::std::string* FileDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name();
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileDescriptorProto::unsafe_arena_set_allocated_name(
- ::std::string* name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name != NULL) {
- set_has_name();
- } else {
- clear_has_name();
- }
- name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.name)
-}
// optional string package = 2;
inline bool FileDescriptorProto::has_package() const {
@@ -5928,52 +4755,47 @@ inline void FileDescriptorProto::clear_has_package() {
_has_bits_[0] &= ~0x00000002u;
}
inline void FileDescriptorProto::clear_package() {
- package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_package();
}
inline const ::std::string& FileDescriptorProto::package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.package)
- return package_.Get();
+ return package_.GetNoArena();
}
inline void FileDescriptorProto::set_package(const ::std::string& value) {
set_has_package();
- package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package)
}
#if LANG_CXX11
inline void FileDescriptorProto::set_package(::std::string&& value) {
set_has_package();
- package_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ package_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.package)
}
#endif
inline void FileDescriptorProto::set_package(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_package();
- package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.package)
}
-inline void FileDescriptorProto::set_package(const char* value,
- size_t size) {
+inline void FileDescriptorProto::set_package(const char* value, size_t size) {
set_has_package();
- package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.package)
}
inline ::std::string* FileDescriptorProto::mutable_package() {
set_has_package();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package)
- return package_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileDescriptorProto::release_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package)
- if (!has_package()) {
- return NULL;
- }
clear_has_package();
- return package_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileDescriptorProto::set_allocated_package(::std::string* package) {
if (package != NULL) {
@@ -5981,29 +4803,9 @@ inline void FileDescriptorProto::set_allocated_package(::std::string* package) {
} else {
clear_has_package();
}
- package_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), package,
- GetArenaNoVirtual());
+ package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), package);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package)
}
-inline ::std::string* FileDescriptorProto::unsafe_arena_release_package() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.package)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_package();
- return package_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileDescriptorProto::unsafe_arena_set_allocated_package(
- ::std::string* package) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (package != NULL) {
- set_has_package();
- } else {
- clear_has_package();
- }
- package_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- package, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.package)
-}
// repeated string dependency = 3;
inline int FileDescriptorProto::dependency_size() const {
@@ -6141,23 +4943,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)
@@ -6171,23 +4973,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)
@@ -6201,23 +5003,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)
@@ -6231,23 +5033,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)
@@ -6265,61 +5067,38 @@ inline void FileDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000008u;
}
inline void FileDescriptorProto::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::FileOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::FileOptions& FileDescriptorProto::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::FileOptions& FileDescriptorProto::options() const {
const ::google::protobuf::FileOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::FileOptions*>(
&::google::protobuf::_FileOptions_default_instance_);
}
-inline ::google::protobuf::FileOptions* FileDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::FileOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::FileOptions* FileDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::FileOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::FileOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::FileOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options)
return options_;
}
+inline ::google::protobuf::FileOptions* FileDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::FileOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void FileDescriptorProto::set_allocated_options(::google::protobuf::FileOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.options)
}
@@ -6334,61 +5113,38 @@ inline void FileDescriptorProto::clear_has_source_code_info() {
_has_bits_[0] &= ~0x00000010u;
}
inline void FileDescriptorProto::clear_source_code_info() {
- if (source_code_info_ != NULL) source_code_info_->Clear();
+ if (source_code_info_ != NULL) source_code_info_->::google::protobuf::SourceCodeInfo::Clear();
clear_has_source_code_info();
}
-inline const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::_internal_source_code_info() const {
- return *source_code_info_;
-}
inline const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_code_info() const {
const ::google::protobuf::SourceCodeInfo* p = source_code_info_;
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceCodeInfo*>(
&::google::protobuf::_SourceCodeInfo_default_instance_);
}
-inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() {
- // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info)
- clear_has_source_code_info();
- ::google::protobuf::SourceCodeInfo* temp = source_code_info_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- source_code_info_ = NULL;
- return temp;
-}
-inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::unsafe_arena_release_source_code_info() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.source_code_info)
- clear_has_source_code_info();
- ::google::protobuf::SourceCodeInfo* temp = source_code_info_;
- source_code_info_ = NULL;
- return temp;
-}
inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() {
set_has_source_code_info();
if (source_code_info_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::SourceCodeInfo>(GetArenaNoVirtual());
- source_code_info_ = p;
+ source_code_info_ = new ::google::protobuf::SourceCodeInfo;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info)
return source_code_info_;
}
+inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info)
+ clear_has_source_code_info();
+ ::google::protobuf::SourceCodeInfo* temp = source_code_info_;
+ source_code_info_ = NULL;
+ return temp;
+}
inline void FileDescriptorProto::set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* source_code_info) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete source_code_info_;
- }
+ delete source_code_info_;
+ source_code_info_ = source_code_info;
if (source_code_info) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(source_code_info);
- if (message_arena != submessage_arena) {
- source_code_info = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, source_code_info, submessage_arena);
- }
set_has_source_code_info();
} else {
clear_has_source_code_info();
}
- source_code_info_ = source_code_info;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.source_code_info)
}
@@ -6403,52 +5159,47 @@ inline void FileDescriptorProto::clear_has_syntax() {
_has_bits_[0] &= ~0x00000004u;
}
inline void FileDescriptorProto::clear_syntax() {
- syntax_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ syntax_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_syntax();
}
inline const ::std::string& FileDescriptorProto::syntax() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.syntax)
- return syntax_.Get();
+ return syntax_.GetNoArena();
}
inline void FileDescriptorProto::set_syntax(const ::std::string& value) {
set_has_syntax();
- syntax_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax)
}
#if LANG_CXX11
inline void FileDescriptorProto::set_syntax(::std::string&& value) {
set_has_syntax();
- syntax_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ syntax_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.syntax)
}
#endif
inline void FileDescriptorProto::set_syntax(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_syntax();
- syntax_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.syntax)
}
-inline void FileDescriptorProto::set_syntax(const char* value,
- size_t size) {
+inline void FileDescriptorProto::set_syntax(const char* value, size_t size) {
set_has_syntax();
- syntax_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.syntax)
}
inline ::std::string* FileDescriptorProto::mutable_syntax() {
set_has_syntax();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.syntax)
- return syntax_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return syntax_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileDescriptorProto::release_syntax() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax)
- if (!has_syntax()) {
- return NULL;
- }
clear_has_syntax();
- return syntax_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return syntax_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileDescriptorProto::set_allocated_syntax(::std::string* syntax) {
if (syntax != NULL) {
@@ -6456,29 +5207,9 @@ inline void FileDescriptorProto::set_allocated_syntax(::std::string* syntax) {
} else {
clear_has_syntax();
}
- syntax_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), syntax,
- GetArenaNoVirtual());
+ syntax_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), syntax);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax)
}
-inline ::std::string* FileDescriptorProto::unsafe_arena_release_syntax() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.syntax)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_syntax();
- return syntax_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileDescriptorProto::unsafe_arena_set_allocated_syntax(
- ::std::string* syntax) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (syntax != NULL) {
- set_has_syntax();
- } else {
- clear_has_syntax();
- }
- syntax_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- syntax, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.syntax)
-}
// -------------------------------------------------------------------
@@ -6543,61 +5274,38 @@ inline void DescriptorProto_ExtensionRange::clear_has_options() {
_has_bits_[0] &= ~0x00000001u;
}
inline void DescriptorProto_ExtensionRange::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::ExtensionRangeOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::ExtensionRangeOptions& DescriptorProto_ExtensionRange::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::ExtensionRangeOptions& DescriptorProto_ExtensionRange::options() const {
const ::google::protobuf::ExtensionRangeOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::ExtensionRangeOptions*>(
&::google::protobuf::_ExtensionRangeOptions_default_instance_);
}
-inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options)
- clear_has_options();
- ::google::protobuf::ExtensionRangeOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.ExtensionRange.options)
- clear_has_options();
- ::google::protobuf::ExtensionRangeOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::ExtensionRangeOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::ExtensionRangeOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options)
return options_;
}
+inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options)
+ clear_has_options();
+ ::google::protobuf::ExtensionRangeOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void DescriptorProto_ExtensionRange::set_allocated_options(::google::protobuf::ExtensionRangeOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.ExtensionRange.options)
}
@@ -6668,52 +5376,47 @@ inline void DescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void DescriptorProto::clear_name() {
- name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
inline const ::std::string& DescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.name)
- return name_.Get();
+ return name_.GetNoArena();
}
inline void DescriptorProto::set_name(const ::std::string& value) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name)
}
#if LANG_CXX11
inline void DescriptorProto::set_name(::std::string&& value) {
set_has_name();
- name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.DescriptorProto.name)
}
#endif
inline void DescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.name)
}
-inline void DescriptorProto::set_name(const char* value,
- size_t size) {
+inline void DescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.name)
}
inline ::std::string* DescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name)
- return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* DescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void DescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -6721,29 +5424,9 @@ inline void DescriptorProto::set_allocated_name(::std::string* name) {
} else {
clear_has_name();
}
- name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaNoVirtual());
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name)
}
-inline ::std::string* DescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name();
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void DescriptorProto::unsafe_arena_set_allocated_name(
- ::std::string* name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name != NULL) {
- set_has_name();
- } else {
- clear_has_name();
- }
- name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.name)
-}
// repeated .google.protobuf.FieldDescriptorProto field = 2;
inline int DescriptorProto::field_size() const {
@@ -6752,23 +5435,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)
@@ -6782,23 +5465,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)
@@ -6812,23 +5495,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)
@@ -6842,23 +5525,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)
@@ -6872,23 +5555,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)
@@ -6902,23 +5585,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)
@@ -6936,61 +5619,38 @@ inline void DescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
inline void DescriptorProto::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::MessageOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::MessageOptions& DescriptorProto::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::MessageOptions& DescriptorProto::options() const {
const ::google::protobuf::MessageOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::MessageOptions*>(
&::google::protobuf::_MessageOptions_default_instance_);
}
-inline ::google::protobuf::MessageOptions* DescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options)
- clear_has_options();
- ::google::protobuf::MessageOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::MessageOptions* DescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.options)
- clear_has_options();
- ::google::protobuf::MessageOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::MessageOptions* DescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::MessageOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::MessageOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options)
return options_;
}
+inline ::google::protobuf::MessageOptions* DescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::MessageOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void DescriptorProto::set_allocated_options(::google::protobuf::MessageOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.options)
}
@@ -7001,23 +5661,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)
@@ -7104,23 +5764,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)
@@ -7142,52 +5802,47 @@ inline void FieldDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void FieldDescriptorProto::clear_name() {
- name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
inline const ::std::string& FieldDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.name)
- return name_.Get();
+ return name_.GetNoArena();
}
inline void FieldDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name)
}
#if LANG_CXX11
inline void FieldDescriptorProto::set_name(::std::string&& value) {
set_has_name();
- name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.name)
}
#endif
inline void FieldDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.name)
}
-inline void FieldDescriptorProto::set_name(const char* value,
- size_t size) {
+inline void FieldDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.name)
}
inline ::std::string* FieldDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name)
- return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FieldDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FieldDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -7195,29 +5850,9 @@ inline void FieldDescriptorProto::set_allocated_name(::std::string* name) {
} else {
clear_has_name();
}
- name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaNoVirtual());
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name)
}
-inline ::std::string* FieldDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name();
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_name(
- ::std::string* name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name != NULL) {
- set_has_name();
- } else {
- clear_has_name();
- }
- name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.name)
-}
// optional int32 number = 3;
inline bool FieldDescriptorProto::has_number() const {
@@ -7304,52 +5939,47 @@ inline void FieldDescriptorProto::clear_has_type_name() {
_has_bits_[0] &= ~0x00000004u;
}
inline void FieldDescriptorProto::clear_type_name() {
- type_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_type_name();
}
inline const ::std::string& FieldDescriptorProto::type_name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type_name)
- return type_name_.Get();
+ return type_name_.GetNoArena();
}
inline void FieldDescriptorProto::set_type_name(const ::std::string& value) {
set_has_type_name();
- type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name)
}
#if LANG_CXX11
inline void FieldDescriptorProto::set_type_name(::std::string&& value) {
set_has_type_name();
- type_name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ type_name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.type_name)
}
#endif
inline void FieldDescriptorProto::set_type_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_type_name();
- type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.type_name)
}
-inline void FieldDescriptorProto::set_type_name(const char* value,
- size_t size) {
+inline void FieldDescriptorProto::set_type_name(const char* value, size_t size) {
set_has_type_name();
- type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.type_name)
}
inline ::std::string* FieldDescriptorProto::mutable_type_name() {
set_has_type_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name)
- return type_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FieldDescriptorProto::release_type_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name)
- if (!has_type_name()) {
- return NULL;
- }
clear_has_type_name();
- return type_name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FieldDescriptorProto::set_allocated_type_name(::std::string* type_name) {
if (type_name != NULL) {
@@ -7357,29 +5987,9 @@ inline void FieldDescriptorProto::set_allocated_type_name(::std::string* type_na
} else {
clear_has_type_name();
}
- type_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_name,
- GetArenaNoVirtual());
+ type_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
}
-inline ::std::string* FieldDescriptorProto::unsafe_arena_release_type_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.type_name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_type_name();
- return type_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_type_name(
- ::std::string* type_name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (type_name != NULL) {
- set_has_type_name();
- } else {
- clear_has_type_name();
- }
- type_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- type_name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
-}
// optional string extendee = 2;
inline bool FieldDescriptorProto::has_extendee() const {
@@ -7392,52 +6002,47 @@ inline void FieldDescriptorProto::clear_has_extendee() {
_has_bits_[0] &= ~0x00000002u;
}
inline void FieldDescriptorProto::clear_extendee() {
- extendee_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ extendee_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_extendee();
}
inline const ::std::string& FieldDescriptorProto::extendee() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.extendee)
- return extendee_.Get();
+ return extendee_.GetNoArena();
}
inline void FieldDescriptorProto::set_extendee(const ::std::string& value) {
set_has_extendee();
- extendee_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee)
}
#if LANG_CXX11
inline void FieldDescriptorProto::set_extendee(::std::string&& value) {
set_has_extendee();
- extendee_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ extendee_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.extendee)
}
#endif
inline void FieldDescriptorProto::set_extendee(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_extendee();
- extendee_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.extendee)
}
-inline void FieldDescriptorProto::set_extendee(const char* value,
- size_t size) {
+inline void FieldDescriptorProto::set_extendee(const char* value, size_t size) {
set_has_extendee();
- extendee_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.extendee)
}
inline ::std::string* FieldDescriptorProto::mutable_extendee() {
set_has_extendee();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee)
- return extendee_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return extendee_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FieldDescriptorProto::release_extendee() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee)
- if (!has_extendee()) {
- return NULL;
- }
clear_has_extendee();
- return extendee_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return extendee_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee) {
if (extendee != NULL) {
@@ -7445,29 +6050,9 @@ inline void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee
} else {
clear_has_extendee();
}
- extendee_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), extendee,
- GetArenaNoVirtual());
+ extendee_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), extendee);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
}
-inline ::std::string* FieldDescriptorProto::unsafe_arena_release_extendee() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.extendee)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_extendee();
- return extendee_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_extendee(
- ::std::string* extendee) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (extendee != NULL) {
- set_has_extendee();
- } else {
- clear_has_extendee();
- }
- extendee_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- extendee, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
-}
// optional string default_value = 7;
inline bool FieldDescriptorProto::has_default_value() const {
@@ -7480,52 +6065,47 @@ inline void FieldDescriptorProto::clear_has_default_value() {
_has_bits_[0] &= ~0x00000008u;
}
inline void FieldDescriptorProto::clear_default_value() {
- default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ default_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_default_value();
}
inline const ::std::string& FieldDescriptorProto::default_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.default_value)
- return default_value_.Get();
+ return default_value_.GetNoArena();
}
inline void FieldDescriptorProto::set_default_value(const ::std::string& value) {
set_has_default_value();
- default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value)
}
#if LANG_CXX11
inline void FieldDescriptorProto::set_default_value(::std::string&& value) {
set_has_default_value();
- default_value_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ default_value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.default_value)
}
#endif
inline void FieldDescriptorProto::set_default_value(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_default_value();
- default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.default_value)
}
-inline void FieldDescriptorProto::set_default_value(const char* value,
- size_t size) {
+inline void FieldDescriptorProto::set_default_value(const char* value, size_t size) {
set_has_default_value();
- default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.default_value)
}
inline ::std::string* FieldDescriptorProto::mutable_default_value() {
set_has_default_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value)
- return default_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return default_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FieldDescriptorProto::release_default_value() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value)
- if (!has_default_value()) {
- return NULL;
- }
clear_has_default_value();
- return default_value_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return default_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FieldDescriptorProto::set_allocated_default_value(::std::string* default_value) {
if (default_value != NULL) {
@@ -7533,29 +6113,9 @@ inline void FieldDescriptorProto::set_allocated_default_value(::std::string* def
} else {
clear_has_default_value();
}
- default_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value,
- GetArenaNoVirtual());
+ default_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
}
-inline ::std::string* FieldDescriptorProto::unsafe_arena_release_default_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.default_value)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_default_value();
- return default_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_default_value(
- ::std::string* default_value) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (default_value != NULL) {
- set_has_default_value();
- } else {
- clear_has_default_value();
- }
- default_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- default_value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
-}
// optional int32 oneof_index = 9;
inline bool FieldDescriptorProto::has_oneof_index() const {
@@ -7592,52 +6152,47 @@ inline void FieldDescriptorProto::clear_has_json_name() {
_has_bits_[0] &= ~0x00000010u;
}
inline void FieldDescriptorProto::clear_json_name() {
- json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ json_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_json_name();
}
inline const ::std::string& FieldDescriptorProto::json_name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name)
- return json_name_.Get();
+ return json_name_.GetNoArena();
}
inline void FieldDescriptorProto::set_json_name(const ::std::string& value) {
set_has_json_name();
- json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
}
#if LANG_CXX11
inline void FieldDescriptorProto::set_json_name(::std::string&& value) {
set_has_json_name();
- json_name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ json_name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.json_name)
}
#endif
inline void FieldDescriptorProto::set_json_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_json_name();
- json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.json_name)
}
-inline void FieldDescriptorProto::set_json_name(const char* value,
- size_t size) {
+inline void FieldDescriptorProto::set_json_name(const char* value, size_t size) {
set_has_json_name();
- json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.json_name)
}
inline ::std::string* FieldDescriptorProto::mutable_json_name() {
set_has_json_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name)
- return json_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return json_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FieldDescriptorProto::release_json_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name)
- if (!has_json_name()) {
- return NULL;
- }
clear_has_json_name();
- return json_name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return json_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FieldDescriptorProto::set_allocated_json_name(::std::string* json_name) {
if (json_name != NULL) {
@@ -7645,29 +6200,9 @@ inline void FieldDescriptorProto::set_allocated_json_name(::std::string* json_na
} else {
clear_has_json_name();
}
- json_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name,
- GetArenaNoVirtual());
+ json_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
}
-inline ::std::string* FieldDescriptorProto::unsafe_arena_release_json_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.json_name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_json_name();
- return json_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_json_name(
- ::std::string* json_name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (json_name != NULL) {
- set_has_json_name();
- } else {
- clear_has_json_name();
- }
- json_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- json_name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
-}
// optional .google.protobuf.FieldOptions options = 8;
inline bool FieldDescriptorProto::has_options() const {
@@ -7680,61 +6215,38 @@ inline void FieldDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000020u;
}
inline void FieldDescriptorProto::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::FieldOptions& FieldDescriptorProto::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() const {
const ::google::protobuf::FieldOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::FieldOptions*>(
&::google::protobuf::_FieldOptions_default_instance_);
}
-inline ::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::FieldOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::FieldOptions* FieldDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::FieldOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::FieldOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::FieldOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options)
return options_;
}
+inline ::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::FieldOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void FieldDescriptorProto::set_allocated_options(::google::protobuf::FieldOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.options)
}
@@ -7753,52 +6265,47 @@ inline void OneofDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void OneofDescriptorProto::clear_name() {
- name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
inline const ::std::string& OneofDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.name)
- return name_.Get();
+ return name_.GetNoArena();
}
inline void OneofDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name)
}
#if LANG_CXX11
inline void OneofDescriptorProto::set_name(::std::string&& value) {
set_has_name();
- name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.OneofDescriptorProto.name)
}
#endif
inline void OneofDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.OneofDescriptorProto.name)
}
-inline void OneofDescriptorProto::set_name(const char* value,
- size_t size) {
+inline void OneofDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.OneofDescriptorProto.name)
}
inline ::std::string* OneofDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name)
- return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* OneofDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void OneofDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -7806,29 +6313,9 @@ inline void OneofDescriptorProto::set_allocated_name(::std::string* name) {
} else {
clear_has_name();
}
- name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaNoVirtual());
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name)
}
-inline ::std::string* OneofDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.OneofDescriptorProto.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name();
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void OneofDescriptorProto::unsafe_arena_set_allocated_name(
- ::std::string* name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name != NULL) {
- set_has_name();
- } else {
- clear_has_name();
- }
- name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.OneofDescriptorProto.name)
-}
// optional .google.protobuf.OneofOptions options = 2;
inline bool OneofDescriptorProto::has_options() const {
@@ -7841,118 +6328,43 @@ inline void OneofDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
inline void OneofDescriptorProto::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::OneofOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::OneofOptions& OneofDescriptorProto::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::OneofOptions& OneofDescriptorProto::options() const {
const ::google::protobuf::OneofOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::OneofOptions*>(
&::google::protobuf::_OneofOptions_default_instance_);
}
-inline ::google::protobuf::OneofOptions* OneofDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::OneofOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::OneofOptions* OneofDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.OneofDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::OneofOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::OneofOptions* OneofDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::OneofOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::OneofOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options)
return options_;
}
+inline ::google::protobuf::OneofOptions* OneofDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::OneofOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void OneofDescriptorProto::set_allocated_options(::google::protobuf::OneofOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.options)
}
// -------------------------------------------------------------------
-// EnumDescriptorProto_EnumReservedRange
-
-// optional int32 start = 1;
-inline bool EnumDescriptorProto_EnumReservedRange::has_start() const {
- return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void EnumDescriptorProto_EnumReservedRange::set_has_start() {
- _has_bits_[0] |= 0x00000001u;
-}
-inline void EnumDescriptorProto_EnumReservedRange::clear_has_start() {
- _has_bits_[0] &= ~0x00000001u;
-}
-inline void EnumDescriptorProto_EnumReservedRange::clear_start() {
- start_ = 0;
- clear_has_start();
-}
-inline ::google::protobuf::int32 EnumDescriptorProto_EnumReservedRange::start() const {
- // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.start)
- return start_;
-}
-inline void EnumDescriptorProto_EnumReservedRange::set_start(::google::protobuf::int32 value) {
- set_has_start();
- start_ = value;
- // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.start)
-}
-
-// optional int32 end = 2;
-inline bool EnumDescriptorProto_EnumReservedRange::has_end() const {
- return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void EnumDescriptorProto_EnumReservedRange::set_has_end() {
- _has_bits_[0] |= 0x00000002u;
-}
-inline void EnumDescriptorProto_EnumReservedRange::clear_has_end() {
- _has_bits_[0] &= ~0x00000002u;
-}
-inline void EnumDescriptorProto_EnumReservedRange::clear_end() {
- end_ = 0;
- clear_has_end();
-}
-inline ::google::protobuf::int32 EnumDescriptorProto_EnumReservedRange::end() const {
- // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.end)
- return end_;
-}
-inline void EnumDescriptorProto_EnumReservedRange::set_end(::google::protobuf::int32 value) {
- set_has_end();
- end_ = value;
- // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.end)
-}
-
-// -------------------------------------------------------------------
-
// EnumDescriptorProto
// optional string name = 1;
@@ -7966,52 +6378,47 @@ inline void EnumDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void EnumDescriptorProto::clear_name() {
- name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
inline const ::std::string& EnumDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.name)
- return name_.Get();
+ return name_.GetNoArena();
}
inline void EnumDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name)
}
#if LANG_CXX11
inline void EnumDescriptorProto::set_name(::std::string&& value) {
set_has_name();
- name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumDescriptorProto.name)
}
#endif
inline void EnumDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.EnumDescriptorProto.name)
}
-inline void EnumDescriptorProto::set_name(const char* value,
- size_t size) {
+inline void EnumDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.name)
}
inline ::std::string* EnumDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name)
- return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* EnumDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void EnumDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -8019,29 +6426,9 @@ inline void EnumDescriptorProto::set_allocated_name(::std::string* name) {
} else {
clear_has_name();
}
- name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaNoVirtual());
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name)
}
-inline ::std::string* EnumDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumDescriptorProto.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name();
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void EnumDescriptorProto::unsafe_arena_set_allocated_name(
- ::std::string* name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name != NULL) {
- set_has_name();
- } else {
- clear_has_name();
- }
- name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumDescriptorProto.name)
-}
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
inline int EnumDescriptorProto::value_size() const {
@@ -8050,23 +6437,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)
@@ -8084,163 +6471,41 @@ inline void EnumDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
inline void EnumDescriptorProto::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::EnumOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::EnumOptions& EnumDescriptorProto::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() const {
const ::google::protobuf::EnumOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::EnumOptions*>(
&::google::protobuf::_EnumOptions_default_instance_);
}
-inline ::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::EnumOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::EnumOptions* EnumDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::EnumOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::EnumOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::EnumOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options)
return options_;
}
+inline ::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::EnumOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void EnumDescriptorProto::set_allocated_options(::google::protobuf::EnumOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.options)
}
-// repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
-inline int EnumDescriptorProto::reserved_range_size() const {
- return reserved_range_.size();
-}
-inline void EnumDescriptorProto::clear_reserved_range() {
- reserved_range_.Clear();
-}
-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::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)
- return reserved_range_;
-}
-
-// repeated string reserved_name = 5;
-inline int EnumDescriptorProto::reserved_name_size() const {
- return reserved_name_.size();
-}
-inline void EnumDescriptorProto::clear_reserved_name() {
- reserved_name_.Clear();
-}
-inline const ::std::string& EnumDescriptorProto::reserved_name(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_name)
- return reserved_name_.Get(index);
-}
-inline ::std::string* EnumDescriptorProto::mutable_reserved_name(int index) {
- // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.reserved_name)
- return reserved_name_.Mutable(index);
-}
-inline void EnumDescriptorProto::set_reserved_name(int index, const ::std::string& value) {
- // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.reserved_name)
- reserved_name_.Mutable(index)->assign(value);
-}
-#if LANG_CXX11
-inline void EnumDescriptorProto::set_reserved_name(int index, ::std::string&& value) {
- // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.reserved_name)
- reserved_name_.Mutable(index)->assign(std::move(value));
-}
-#endif
-inline void EnumDescriptorProto::set_reserved_name(int index, const char* value) {
- GOOGLE_DCHECK(value != NULL);
- reserved_name_.Mutable(index)->assign(value);
- // @@protoc_insertion_point(field_set_char:google.protobuf.EnumDescriptorProto.reserved_name)
-}
-inline void EnumDescriptorProto::set_reserved_name(int index, const char* value, size_t size) {
- reserved_name_.Mutable(index)->assign(
- reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.reserved_name)
-}
-inline ::std::string* EnumDescriptorProto::add_reserved_name() {
- // @@protoc_insertion_point(field_add_mutable:google.protobuf.EnumDescriptorProto.reserved_name)
- return reserved_name_.Add();
-}
-inline void EnumDescriptorProto::add_reserved_name(const ::std::string& value) {
- reserved_name_.Add()->assign(value);
- // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_name)
-}
-#if LANG_CXX11
-inline void EnumDescriptorProto::add_reserved_name(::std::string&& value) {
- reserved_name_.Add(std::move(value));
- // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_name)
-}
-#endif
-inline void EnumDescriptorProto::add_reserved_name(const char* value) {
- GOOGLE_DCHECK(value != NULL);
- reserved_name_.Add()->assign(value);
- // @@protoc_insertion_point(field_add_char:google.protobuf.EnumDescriptorProto.reserved_name)
-}
-inline void EnumDescriptorProto::add_reserved_name(const char* value, size_t size) {
- reserved_name_.Add()->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_add_pointer:google.protobuf.EnumDescriptorProto.reserved_name)
-}
-inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
-EnumDescriptorProto::reserved_name() const {
- // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.reserved_name)
- return reserved_name_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::std::string>*
-EnumDescriptorProto::mutable_reserved_name() {
- // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.reserved_name)
- return &reserved_name_;
-}
-
// -------------------------------------------------------------------
// EnumValueDescriptorProto
@@ -8256,52 +6521,47 @@ inline void EnumValueDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void EnumValueDescriptorProto::clear_name() {
- name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
inline const ::std::string& EnumValueDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.name)
- return name_.Get();
+ return name_.GetNoArena();
}
inline void EnumValueDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name)
}
#if LANG_CXX11
inline void EnumValueDescriptorProto::set_name(::std::string&& value) {
set_has_name();
- name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumValueDescriptorProto.name)
}
#endif
inline void EnumValueDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.EnumValueDescriptorProto.name)
}
-inline void EnumValueDescriptorProto::set_name(const char* value,
- size_t size) {
+inline void EnumValueDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValueDescriptorProto.name)
}
inline ::std::string* EnumValueDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name)
- return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* EnumValueDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void EnumValueDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -8309,29 +6569,9 @@ inline void EnumValueDescriptorProto::set_allocated_name(::std::string* name) {
} else {
clear_has_name();
}
- name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaNoVirtual());
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
}
-inline ::std::string* EnumValueDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValueDescriptorProto.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name();
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_name(
- ::std::string* name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name != NULL) {
- set_has_name();
- } else {
- clear_has_name();
- }
- name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
-}
// optional int32 number = 2;
inline bool EnumValueDescriptorProto::has_number() const {
@@ -8368,61 +6608,38 @@ inline void EnumValueDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
inline void EnumValueDescriptorProto::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::EnumValueOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::options() const {
const ::google::protobuf::EnumValueOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::EnumValueOptions*>(
&::google::protobuf::_EnumValueOptions_default_instance_);
}
-inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::EnumValueOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValueDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::EnumValueOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::EnumValueOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::EnumValueOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options)
return options_;
}
+inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::EnumValueOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void EnumValueDescriptorProto::set_allocated_options(::google::protobuf::EnumValueOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.options)
}
@@ -8441,52 +6658,47 @@ inline void ServiceDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void ServiceDescriptorProto::clear_name() {
- name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
inline const ::std::string& ServiceDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.name)
- return name_.Get();
+ return name_.GetNoArena();
}
inline void ServiceDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name)
}
#if LANG_CXX11
inline void ServiceDescriptorProto::set_name(::std::string&& value) {
set_has_name();
- name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.ServiceDescriptorProto.name)
}
#endif
inline void ServiceDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.ServiceDescriptorProto.name)
}
-inline void ServiceDescriptorProto::set_name(const char* value,
- size_t size) {
+inline void ServiceDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.ServiceDescriptorProto.name)
}
inline ::std::string* ServiceDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name)
- return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* ServiceDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void ServiceDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -8494,29 +6706,9 @@ inline void ServiceDescriptorProto::set_allocated_name(::std::string* name) {
} else {
clear_has_name();
}
- name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaNoVirtual());
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name)
}
-inline ::std::string* ServiceDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.ServiceDescriptorProto.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name();
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void ServiceDescriptorProto::unsafe_arena_set_allocated_name(
- ::std::string* name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name != NULL) {
- set_has_name();
- } else {
- clear_has_name();
- }
- name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ServiceDescriptorProto.name)
-}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
inline int ServiceDescriptorProto::method_size() const {
@@ -8525,23 +6717,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)
@@ -8559,61 +6751,38 @@ inline void ServiceDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
inline void ServiceDescriptorProto::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::ServiceOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options() const {
const ::google::protobuf::ServiceOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::ServiceOptions*>(
&::google::protobuf::_ServiceOptions_default_instance_);
}
-inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::ServiceOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.ServiceDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::ServiceOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::ServiceOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::ServiceOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options)
return options_;
}
+inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::ServiceOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void ServiceDescriptorProto::set_allocated_options(::google::protobuf::ServiceOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.options)
}
@@ -8632,52 +6801,47 @@ inline void MethodDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void MethodDescriptorProto::clear_name() {
- name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
inline const ::std::string& MethodDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.name)
- return name_.Get();
+ return name_.GetNoArena();
}
inline void MethodDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name)
}
#if LANG_CXX11
inline void MethodDescriptorProto::set_name(::std::string&& value) {
set_has_name();
- name_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.name)
}
#endif
inline void MethodDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.name)
}
-inline void MethodDescriptorProto::set_name(const char* value,
- size_t size) {
+inline void MethodDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
- name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.name)
}
inline ::std::string* MethodDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name)
- return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* MethodDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name)
- if (!has_name()) {
- return NULL;
- }
clear_has_name();
- return name_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void MethodDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -8685,29 +6849,9 @@ inline void MethodDescriptorProto::set_allocated_name(::std::string* name) {
} else {
clear_has_name();
}
- name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaNoVirtual());
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name)
}
-inline ::std::string* MethodDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name();
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void MethodDescriptorProto::unsafe_arena_set_allocated_name(
- ::std::string* name) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name != NULL) {
- set_has_name();
- } else {
- clear_has_name();
- }
- name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.name)
-}
// optional string input_type = 2;
inline bool MethodDescriptorProto::has_input_type() const {
@@ -8720,52 +6864,47 @@ inline void MethodDescriptorProto::clear_has_input_type() {
_has_bits_[0] &= ~0x00000002u;
}
inline void MethodDescriptorProto::clear_input_type() {
- input_type_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ input_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_input_type();
}
inline const ::std::string& MethodDescriptorProto::input_type() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.input_type)
- return input_type_.Get();
+ return input_type_.GetNoArena();
}
inline void MethodDescriptorProto::set_input_type(const ::std::string& value) {
set_has_input_type();
- input_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type)
}
#if LANG_CXX11
inline void MethodDescriptorProto::set_input_type(::std::string&& value) {
set_has_input_type();
- input_type_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ input_type_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.input_type)
}
#endif
inline void MethodDescriptorProto::set_input_type(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_input_type();
- input_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.input_type)
}
-inline void MethodDescriptorProto::set_input_type(const char* value,
- size_t size) {
+inline void MethodDescriptorProto::set_input_type(const char* value, size_t size) {
set_has_input_type();
- input_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.input_type)
}
inline ::std::string* MethodDescriptorProto::mutable_input_type() {
set_has_input_type();
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type)
- return input_type_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return input_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* MethodDescriptorProto::release_input_type() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type)
- if (!has_input_type()) {
- return NULL;
- }
clear_has_input_type();
- return input_type_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return input_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void MethodDescriptorProto::set_allocated_input_type(::std::string* input_type) {
if (input_type != NULL) {
@@ -8773,29 +6912,9 @@ inline void MethodDescriptorProto::set_allocated_input_type(::std::string* input
} else {
clear_has_input_type();
}
- input_type_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), input_type,
- GetArenaNoVirtual());
+ input_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), input_type);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
}
-inline ::std::string* MethodDescriptorProto::unsafe_arena_release_input_type() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.input_type)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_input_type();
- return input_type_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void MethodDescriptorProto::unsafe_arena_set_allocated_input_type(
- ::std::string* input_type) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (input_type != NULL) {
- set_has_input_type();
- } else {
- clear_has_input_type();
- }
- input_type_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- input_type, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
-}
// optional string output_type = 3;
inline bool MethodDescriptorProto::has_output_type() const {
@@ -8808,52 +6927,47 @@ inline void MethodDescriptorProto::clear_has_output_type() {
_has_bits_[0] &= ~0x00000004u;
}
inline void MethodDescriptorProto::clear_output_type() {
- output_type_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ output_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_output_type();
}
inline const ::std::string& MethodDescriptorProto::output_type() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.output_type)
- return output_type_.Get();
+ return output_type_.GetNoArena();
}
inline void MethodDescriptorProto::set_output_type(const ::std::string& value) {
set_has_output_type();
- output_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type)
}
#if LANG_CXX11
inline void MethodDescriptorProto::set_output_type(::std::string&& value) {
set_has_output_type();
- output_type_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ output_type_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.output_type)
}
#endif
inline void MethodDescriptorProto::set_output_type(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_output_type();
- output_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.output_type)
}
-inline void MethodDescriptorProto::set_output_type(const char* value,
- size_t size) {
+inline void MethodDescriptorProto::set_output_type(const char* value, size_t size) {
set_has_output_type();
- output_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.output_type)
}
inline ::std::string* MethodDescriptorProto::mutable_output_type() {
set_has_output_type();
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type)
- return output_type_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return output_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* MethodDescriptorProto::release_output_type() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type)
- if (!has_output_type()) {
- return NULL;
- }
clear_has_output_type();
- return output_type_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return output_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void MethodDescriptorProto::set_allocated_output_type(::std::string* output_type) {
if (output_type != NULL) {
@@ -8861,29 +6975,9 @@ inline void MethodDescriptorProto::set_allocated_output_type(::std::string* outp
} else {
clear_has_output_type();
}
- output_type_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), output_type,
- GetArenaNoVirtual());
+ output_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), output_type);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
}
-inline ::std::string* MethodDescriptorProto::unsafe_arena_release_output_type() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.output_type)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_output_type();
- return output_type_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void MethodDescriptorProto::unsafe_arena_set_allocated_output_type(
- ::std::string* output_type) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (output_type != NULL) {
- set_has_output_type();
- } else {
- clear_has_output_type();
- }
- output_type_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- output_type, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
-}
// optional .google.protobuf.MethodOptions options = 4;
inline bool MethodDescriptorProto::has_options() const {
@@ -8896,61 +6990,38 @@ inline void MethodDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000008u;
}
inline void MethodDescriptorProto::clear_options() {
- if (options_ != NULL) options_->Clear();
+ if (options_ != NULL) options_->::google::protobuf::MethodOptions::Clear();
clear_has_options();
}
-inline const ::google::protobuf::MethodOptions& MethodDescriptorProto::_internal_options() const {
- return *options_;
-}
inline const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() const {
const ::google::protobuf::MethodOptions* p = options_;
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options)
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::MethodOptions*>(
&::google::protobuf::_MethodOptions_default_instance_);
}
-inline ::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::MethodOptions* temp = options_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- options_ = NULL;
- return temp;
-}
-inline ::google::protobuf::MethodOptions* MethodDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.options)
- clear_has_options();
- ::google::protobuf::MethodOptions* temp = options_;
- options_ = NULL;
- return temp;
-}
inline ::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::MethodOptions>(GetArenaNoVirtual());
- options_ = p;
+ options_ = new ::google::protobuf::MethodOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options)
return options_;
}
+inline ::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() {
+ // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options)
+ clear_has_options();
+ ::google::protobuf::MethodOptions* temp = options_;
+ options_ = NULL;
+ return temp;
+}
inline void MethodDescriptorProto::set_allocated_options(::google::protobuf::MethodOptions* options) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete options_;
- }
+ delete options_;
+ options_ = options;
if (options) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(options);
- if (message_arena != submessage_arena) {
- options = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, options, submessage_arena);
- }
set_has_options();
} else {
clear_has_options();
}
- options_ = options;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.options)
}
@@ -9017,52 +7088,47 @@ inline void FileOptions::clear_has_java_package() {
_has_bits_[0] &= ~0x00000001u;
}
inline void FileOptions::clear_java_package() {
- java_package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ java_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_java_package();
}
inline const ::std::string& FileOptions::java_package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_package)
- return java_package_.Get();
+ return java_package_.GetNoArena();
}
inline void FileOptions::set_java_package(const ::std::string& value) {
set_has_java_package();
- java_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package)
}
#if LANG_CXX11
inline void FileOptions::set_java_package(::std::string&& value) {
set_has_java_package();
- java_package_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ java_package_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_package)
}
#endif
inline void FileOptions::set_java_package(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_java_package();
- java_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_package)
}
-inline void FileOptions::set_java_package(const char* value,
- size_t size) {
+inline void FileOptions::set_java_package(const char* value, size_t size) {
set_has_java_package();
- java_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_package)
}
inline ::std::string* FileOptions::mutable_java_package() {
set_has_java_package();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package)
- return java_package_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return java_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileOptions::release_java_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package)
- if (!has_java_package()) {
- return NULL;
- }
clear_has_java_package();
- return java_package_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return java_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileOptions::set_allocated_java_package(::std::string* java_package) {
if (java_package != NULL) {
@@ -9070,29 +7136,9 @@ inline void FileOptions::set_allocated_java_package(::std::string* java_package)
} else {
clear_has_java_package();
}
- java_package_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_package,
- GetArenaNoVirtual());
+ java_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_package);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package)
}
-inline ::std::string* FileOptions::unsafe_arena_release_java_package() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.java_package)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_java_package();
- return java_package_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_java_package(
- ::std::string* java_package) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (java_package != NULL) {
- set_has_java_package();
- } else {
- clear_has_java_package();
- }
- java_package_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- java_package, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.java_package)
-}
// optional string java_outer_classname = 8;
inline bool FileOptions::has_java_outer_classname() const {
@@ -9105,52 +7151,47 @@ inline void FileOptions::clear_has_java_outer_classname() {
_has_bits_[0] &= ~0x00000002u;
}
inline void FileOptions::clear_java_outer_classname() {
- java_outer_classname_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ java_outer_classname_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_java_outer_classname();
}
inline const ::std::string& FileOptions::java_outer_classname() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_outer_classname)
- return java_outer_classname_.Get();
+ return java_outer_classname_.GetNoArena();
}
inline void FileOptions::set_java_outer_classname(const ::std::string& value) {
set_has_java_outer_classname();
- java_outer_classname_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname)
}
#if LANG_CXX11
inline void FileOptions::set_java_outer_classname(::std::string&& value) {
set_has_java_outer_classname();
- java_outer_classname_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ java_outer_classname_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_outer_classname)
}
#endif
inline void FileOptions::set_java_outer_classname(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_java_outer_classname();
- java_outer_classname_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_outer_classname)
}
-inline void FileOptions::set_java_outer_classname(const char* value,
- size_t size) {
+inline void FileOptions::set_java_outer_classname(const char* value, size_t size) {
set_has_java_outer_classname();
- java_outer_classname_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_outer_classname)
}
inline ::std::string* FileOptions::mutable_java_outer_classname() {
set_has_java_outer_classname();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname)
- return java_outer_classname_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return java_outer_classname_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileOptions::release_java_outer_classname() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname)
- if (!has_java_outer_classname()) {
- return NULL;
- }
clear_has_java_outer_classname();
- return java_outer_classname_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return java_outer_classname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileOptions::set_allocated_java_outer_classname(::std::string* java_outer_classname) {
if (java_outer_classname != NULL) {
@@ -9158,39 +7199,19 @@ inline void FileOptions::set_allocated_java_outer_classname(::std::string* java_
} else {
clear_has_java_outer_classname();
}
- java_outer_classname_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_outer_classname,
- GetArenaNoVirtual());
+ java_outer_classname_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_outer_classname);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname)
}
-inline ::std::string* FileOptions::unsafe_arena_release_java_outer_classname() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.java_outer_classname)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_java_outer_classname();
- return java_outer_classname_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_java_outer_classname(
- ::std::string* java_outer_classname) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (java_outer_classname != NULL) {
- set_has_java_outer_classname();
- } else {
- clear_has_java_outer_classname();
- }
- java_outer_classname_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- java_outer_classname, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.java_outer_classname)
-}
// optional bool java_multiple_files = 10 [default = false];
inline bool FileOptions::has_java_multiple_files() const {
- return (_has_bits_[0] & 0x00000400u) != 0;
+ return (_has_bits_[0] & 0x00000100u) != 0;
}
inline void FileOptions::set_has_java_multiple_files() {
- _has_bits_[0] |= 0x00000400u;
+ _has_bits_[0] |= 0x00000100u;
}
inline void FileOptions::clear_has_java_multiple_files() {
- _has_bits_[0] &= ~0x00000400u;
+ _has_bits_[0] &= ~0x00000100u;
}
inline void FileOptions::clear_java_multiple_files() {
java_multiple_files_ = false;
@@ -9208,13 +7229,13 @@ inline void FileOptions::set_java_multiple_files(bool value) {
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
inline bool FileOptions::has_java_generate_equals_and_hash() const {
- return (_has_bits_[0] & 0x00000800u) != 0;
+ return (_has_bits_[0] & 0x00000200u) != 0;
}
inline void FileOptions::set_has_java_generate_equals_and_hash() {
- _has_bits_[0] |= 0x00000800u;
+ _has_bits_[0] |= 0x00000200u;
}
inline void FileOptions::clear_has_java_generate_equals_and_hash() {
- _has_bits_[0] &= ~0x00000800u;
+ _has_bits_[0] &= ~0x00000200u;
}
inline void FileOptions::clear_java_generate_equals_and_hash() {
java_generate_equals_and_hash_ = false;
@@ -9232,13 +7253,13 @@ inline void FileOptions::set_java_generate_equals_and_hash(bool value) {
// optional bool java_string_check_utf8 = 27 [default = false];
inline bool FileOptions::has_java_string_check_utf8() const {
- return (_has_bits_[0] & 0x00001000u) != 0;
+ return (_has_bits_[0] & 0x00000400u) != 0;
}
inline void FileOptions::set_has_java_string_check_utf8() {
- _has_bits_[0] |= 0x00001000u;
+ _has_bits_[0] |= 0x00000400u;
}
inline void FileOptions::clear_has_java_string_check_utf8() {
- _has_bits_[0] &= ~0x00001000u;
+ _has_bits_[0] &= ~0x00000400u;
}
inline void FileOptions::clear_java_string_check_utf8() {
java_string_check_utf8_ = false;
@@ -9256,13 +7277,13 @@ inline void FileOptions::set_java_string_check_utf8(bool value) {
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
inline bool FileOptions::has_optimize_for() const {
- return (_has_bits_[0] & 0x00080000u) != 0;
+ return (_has_bits_[0] & 0x00020000u) != 0;
}
inline void FileOptions::set_has_optimize_for() {
- _has_bits_[0] |= 0x00080000u;
+ _has_bits_[0] |= 0x00020000u;
}
inline void FileOptions::clear_has_optimize_for() {
- _has_bits_[0] &= ~0x00080000u;
+ _has_bits_[0] &= ~0x00020000u;
}
inline void FileOptions::clear_optimize_for() {
optimize_for_ = 1;
@@ -9290,52 +7311,47 @@ inline void FileOptions::clear_has_go_package() {
_has_bits_[0] &= ~0x00000004u;
}
inline void FileOptions::clear_go_package() {
- go_package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ go_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_go_package();
}
inline const ::std::string& FileOptions::go_package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.go_package)
- return go_package_.Get();
+ return go_package_.GetNoArena();
}
inline void FileOptions::set_go_package(const ::std::string& value) {
set_has_go_package();
- go_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package)
}
#if LANG_CXX11
inline void FileOptions::set_go_package(::std::string&& value) {
set_has_go_package();
- go_package_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ go_package_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.go_package)
}
#endif
inline void FileOptions::set_go_package(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_go_package();
- go_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.go_package)
}
-inline void FileOptions::set_go_package(const char* value,
- size_t size) {
+inline void FileOptions::set_go_package(const char* value, size_t size) {
set_has_go_package();
- go_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.go_package)
}
inline ::std::string* FileOptions::mutable_go_package() {
set_has_go_package();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package)
- return go_package_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return go_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileOptions::release_go_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package)
- if (!has_go_package()) {
- return NULL;
- }
clear_has_go_package();
- return go_package_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return go_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileOptions::set_allocated_go_package(::std::string* go_package) {
if (go_package != NULL) {
@@ -9343,39 +7359,19 @@ inline void FileOptions::set_allocated_go_package(::std::string* go_package) {
} else {
clear_has_go_package();
}
- go_package_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), go_package,
- GetArenaNoVirtual());
+ go_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), go_package);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package)
}
-inline ::std::string* FileOptions::unsafe_arena_release_go_package() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.go_package)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_go_package();
- return go_package_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_go_package(
- ::std::string* go_package) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (go_package != NULL) {
- set_has_go_package();
- } else {
- clear_has_go_package();
- }
- go_package_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- go_package, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.go_package)
-}
// optional bool cc_generic_services = 16 [default = false];
inline bool FileOptions::has_cc_generic_services() const {
- return (_has_bits_[0] & 0x00002000u) != 0;
+ return (_has_bits_[0] & 0x00000800u) != 0;
}
inline void FileOptions::set_has_cc_generic_services() {
- _has_bits_[0] |= 0x00002000u;
+ _has_bits_[0] |= 0x00000800u;
}
inline void FileOptions::clear_has_cc_generic_services() {
- _has_bits_[0] &= ~0x00002000u;
+ _has_bits_[0] &= ~0x00000800u;
}
inline void FileOptions::clear_cc_generic_services() {
cc_generic_services_ = false;
@@ -9393,13 +7389,13 @@ inline void FileOptions::set_cc_generic_services(bool value) {
// optional bool java_generic_services = 17 [default = false];
inline bool FileOptions::has_java_generic_services() const {
- return (_has_bits_[0] & 0x00004000u) != 0;
+ return (_has_bits_[0] & 0x00001000u) != 0;
}
inline void FileOptions::set_has_java_generic_services() {
- _has_bits_[0] |= 0x00004000u;
+ _has_bits_[0] |= 0x00001000u;
}
inline void FileOptions::clear_has_java_generic_services() {
- _has_bits_[0] &= ~0x00004000u;
+ _has_bits_[0] &= ~0x00001000u;
}
inline void FileOptions::clear_java_generic_services() {
java_generic_services_ = false;
@@ -9417,13 +7413,13 @@ inline void FileOptions::set_java_generic_services(bool value) {
// optional bool py_generic_services = 18 [default = false];
inline bool FileOptions::has_py_generic_services() const {
- return (_has_bits_[0] & 0x00008000u) != 0;
+ return (_has_bits_[0] & 0x00002000u) != 0;
}
inline void FileOptions::set_has_py_generic_services() {
- _has_bits_[0] |= 0x00008000u;
+ _has_bits_[0] |= 0x00002000u;
}
inline void FileOptions::clear_has_py_generic_services() {
- _has_bits_[0] &= ~0x00008000u;
+ _has_bits_[0] &= ~0x00002000u;
}
inline void FileOptions::clear_py_generic_services() {
py_generic_services_ = false;
@@ -9439,15 +7435,15 @@ inline void FileOptions::set_py_generic_services(bool value) {
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services)
}
-// optional bool php_generic_services = 42 [default = false];
+// optional bool php_generic_services = 19 [default = false];
inline bool FileOptions::has_php_generic_services() const {
- return (_has_bits_[0] & 0x00010000u) != 0;
+ return (_has_bits_[0] & 0x00004000u) != 0;
}
inline void FileOptions::set_has_php_generic_services() {
- _has_bits_[0] |= 0x00010000u;
+ _has_bits_[0] |= 0x00004000u;
}
inline void FileOptions::clear_has_php_generic_services() {
- _has_bits_[0] &= ~0x00010000u;
+ _has_bits_[0] &= ~0x00004000u;
}
inline void FileOptions::clear_php_generic_services() {
php_generic_services_ = false;
@@ -9465,13 +7461,13 @@ inline void FileOptions::set_php_generic_services(bool value) {
// optional bool deprecated = 23 [default = false];
inline bool FileOptions::has_deprecated() const {
- return (_has_bits_[0] & 0x00020000u) != 0;
+ return (_has_bits_[0] & 0x00008000u) != 0;
}
inline void FileOptions::set_has_deprecated() {
- _has_bits_[0] |= 0x00020000u;
+ _has_bits_[0] |= 0x00008000u;
}
inline void FileOptions::clear_has_deprecated() {
- _has_bits_[0] &= ~0x00020000u;
+ _has_bits_[0] &= ~0x00008000u;
}
inline void FileOptions::clear_deprecated() {
deprecated_ = false;
@@ -9489,13 +7485,13 @@ inline void FileOptions::set_deprecated(bool value) {
// optional bool cc_enable_arenas = 31 [default = false];
inline bool FileOptions::has_cc_enable_arenas() const {
- return (_has_bits_[0] & 0x00040000u) != 0;
+ return (_has_bits_[0] & 0x00010000u) != 0;
}
inline void FileOptions::set_has_cc_enable_arenas() {
- _has_bits_[0] |= 0x00040000u;
+ _has_bits_[0] |= 0x00010000u;
}
inline void FileOptions::clear_has_cc_enable_arenas() {
- _has_bits_[0] &= ~0x00040000u;
+ _has_bits_[0] &= ~0x00010000u;
}
inline void FileOptions::clear_cc_enable_arenas() {
cc_enable_arenas_ = false;
@@ -9522,52 +7518,47 @@ inline void FileOptions::clear_has_objc_class_prefix() {
_has_bits_[0] &= ~0x00000008u;
}
inline void FileOptions::clear_objc_class_prefix() {
- objc_class_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ objc_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_objc_class_prefix();
}
inline const ::std::string& FileOptions::objc_class_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.objc_class_prefix)
- return objc_class_prefix_.Get();
+ return objc_class_prefix_.GetNoArena();
}
inline void FileOptions::set_objc_class_prefix(const ::std::string& value) {
set_has_objc_class_prefix();
- objc_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix)
}
#if LANG_CXX11
inline void FileOptions::set_objc_class_prefix(::std::string&& value) {
set_has_objc_class_prefix();
- objc_class_prefix_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ objc_class_prefix_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.objc_class_prefix)
}
#endif
inline void FileOptions::set_objc_class_prefix(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_objc_class_prefix();
- objc_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.objc_class_prefix)
}
-inline void FileOptions::set_objc_class_prefix(const char* value,
- size_t size) {
+inline void FileOptions::set_objc_class_prefix(const char* value, size_t size) {
set_has_objc_class_prefix();
- objc_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.objc_class_prefix)
}
inline ::std::string* FileOptions::mutable_objc_class_prefix() {
set_has_objc_class_prefix();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.objc_class_prefix)
- return objc_class_prefix_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return objc_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileOptions::release_objc_class_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix)
- if (!has_objc_class_prefix()) {
- return NULL;
- }
clear_has_objc_class_prefix();
- return objc_class_prefix_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return objc_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_class_prefix) {
if (objc_class_prefix != NULL) {
@@ -9575,29 +7566,9 @@ inline void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_cla
} else {
clear_has_objc_class_prefix();
}
- objc_class_prefix_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), objc_class_prefix,
- GetArenaNoVirtual());
+ objc_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), objc_class_prefix);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
}
-inline ::std::string* FileOptions::unsafe_arena_release_objc_class_prefix() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.objc_class_prefix)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_objc_class_prefix();
- return objc_class_prefix_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_objc_class_prefix(
- ::std::string* objc_class_prefix) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (objc_class_prefix != NULL) {
- set_has_objc_class_prefix();
- } else {
- clear_has_objc_class_prefix();
- }
- objc_class_prefix_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- objc_class_prefix, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
-}
// optional string csharp_namespace = 37;
inline bool FileOptions::has_csharp_namespace() const {
@@ -9610,52 +7581,47 @@ inline void FileOptions::clear_has_csharp_namespace() {
_has_bits_[0] &= ~0x00000010u;
}
inline void FileOptions::clear_csharp_namespace() {
- csharp_namespace_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_csharp_namespace();
}
inline const ::std::string& FileOptions::csharp_namespace() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace)
- return csharp_namespace_.Get();
+ return csharp_namespace_.GetNoArena();
}
inline void FileOptions::set_csharp_namespace(const ::std::string& value) {
set_has_csharp_namespace();
- csharp_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace)
}
#if LANG_CXX11
inline void FileOptions::set_csharp_namespace(::std::string&& value) {
set_has_csharp_namespace();
- csharp_namespace_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ csharp_namespace_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.csharp_namespace)
}
#endif
inline void FileOptions::set_csharp_namespace(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_csharp_namespace();
- csharp_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace)
}
-inline void FileOptions::set_csharp_namespace(const char* value,
- size_t size) {
+inline void FileOptions::set_csharp_namespace(const char* value, size_t size) {
set_has_csharp_namespace();
- csharp_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace)
}
inline ::std::string* FileOptions::mutable_csharp_namespace() {
set_has_csharp_namespace();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace)
- return csharp_namespace_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileOptions::release_csharp_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace)
- if (!has_csharp_namespace()) {
- return NULL;
- }
clear_has_csharp_namespace();
- return csharp_namespace_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) {
if (csharp_namespace != NULL) {
@@ -9663,29 +7629,9 @@ inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_na
} else {
clear_has_csharp_namespace();
}
- csharp_namespace_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace,
- GetArenaNoVirtual());
+ csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace)
}
-inline ::std::string* FileOptions::unsafe_arena_release_csharp_namespace() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.csharp_namespace)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_csharp_namespace();
- return csharp_namespace_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_csharp_namespace(
- ::std::string* csharp_namespace) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (csharp_namespace != NULL) {
- set_has_csharp_namespace();
- } else {
- clear_has_csharp_namespace();
- }
- csharp_namespace_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- csharp_namespace, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.csharp_namespace)
-}
// optional string swift_prefix = 39;
inline bool FileOptions::has_swift_prefix() const {
@@ -9698,52 +7644,47 @@ inline void FileOptions::clear_has_swift_prefix() {
_has_bits_[0] &= ~0x00000020u;
}
inline void FileOptions::clear_swift_prefix() {
- swift_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ swift_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_swift_prefix();
}
inline const ::std::string& FileOptions::swift_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.swift_prefix)
- return swift_prefix_.Get();
+ return swift_prefix_.GetNoArena();
}
inline void FileOptions::set_swift_prefix(const ::std::string& value) {
set_has_swift_prefix();
- swift_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix)
}
#if LANG_CXX11
inline void FileOptions::set_swift_prefix(::std::string&& value) {
set_has_swift_prefix();
- swift_prefix_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ swift_prefix_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.swift_prefix)
}
#endif
inline void FileOptions::set_swift_prefix(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_swift_prefix();
- swift_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.swift_prefix)
}
-inline void FileOptions::set_swift_prefix(const char* value,
- size_t size) {
+inline void FileOptions::set_swift_prefix(const char* value, size_t size) {
set_has_swift_prefix();
- swift_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.swift_prefix)
}
inline ::std::string* FileOptions::mutable_swift_prefix() {
set_has_swift_prefix();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.swift_prefix)
- return swift_prefix_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return swift_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileOptions::release_swift_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.swift_prefix)
- if (!has_swift_prefix()) {
- return NULL;
- }
clear_has_swift_prefix();
- return swift_prefix_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return swift_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileOptions::set_allocated_swift_prefix(::std::string* swift_prefix) {
if (swift_prefix != NULL) {
@@ -9751,29 +7692,9 @@ inline void FileOptions::set_allocated_swift_prefix(::std::string* swift_prefix)
} else {
clear_has_swift_prefix();
}
- swift_prefix_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), swift_prefix,
- GetArenaNoVirtual());
+ swift_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), swift_prefix);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix)
}
-inline ::std::string* FileOptions::unsafe_arena_release_swift_prefix() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.swift_prefix)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_swift_prefix();
- return swift_prefix_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_swift_prefix(
- ::std::string* swift_prefix) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (swift_prefix != NULL) {
- set_has_swift_prefix();
- } else {
- clear_has_swift_prefix();
- }
- swift_prefix_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- swift_prefix, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.swift_prefix)
-}
// optional string php_class_prefix = 40;
inline bool FileOptions::has_php_class_prefix() const {
@@ -9786,52 +7707,47 @@ inline void FileOptions::clear_has_php_class_prefix() {
_has_bits_[0] &= ~0x00000040u;
}
inline void FileOptions::clear_php_class_prefix() {
- php_class_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ php_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_php_class_prefix();
}
inline const ::std::string& FileOptions::php_class_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_class_prefix)
- return php_class_prefix_.Get();
+ return php_class_prefix_.GetNoArena();
}
inline void FileOptions::set_php_class_prefix(const ::std::string& value) {
set_has_php_class_prefix();
- php_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix)
}
#if LANG_CXX11
inline void FileOptions::set_php_class_prefix(::std::string&& value) {
set_has_php_class_prefix();
- php_class_prefix_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ php_class_prefix_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_class_prefix)
}
#endif
inline void FileOptions::set_php_class_prefix(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_php_class_prefix();
- php_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_class_prefix)
}
-inline void FileOptions::set_php_class_prefix(const char* value,
- size_t size) {
+inline void FileOptions::set_php_class_prefix(const char* value, size_t size) {
set_has_php_class_prefix();
- php_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_class_prefix)
}
inline ::std::string* FileOptions::mutable_php_class_prefix() {
set_has_php_class_prefix();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_class_prefix)
- return php_class_prefix_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return php_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileOptions::release_php_class_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_class_prefix)
- if (!has_php_class_prefix()) {
- return NULL;
- }
clear_has_php_class_prefix();
- return php_class_prefix_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return php_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileOptions::set_allocated_php_class_prefix(::std::string* php_class_prefix) {
if (php_class_prefix != NULL) {
@@ -9839,29 +7755,9 @@ inline void FileOptions::set_allocated_php_class_prefix(::std::string* php_class
} else {
clear_has_php_class_prefix();
}
- php_class_prefix_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_class_prefix,
- GetArenaNoVirtual());
+ php_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_class_prefix);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
}
-inline ::std::string* FileOptions::unsafe_arena_release_php_class_prefix() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.php_class_prefix)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_php_class_prefix();
- return php_class_prefix_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_php_class_prefix(
- ::std::string* php_class_prefix) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (php_class_prefix != NULL) {
- set_has_php_class_prefix();
- } else {
- clear_has_php_class_prefix();
- }
- php_class_prefix_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- php_class_prefix, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.php_class_prefix)
-}
// optional string php_namespace = 41;
inline bool FileOptions::has_php_namespace() const {
@@ -9874,52 +7770,47 @@ inline void FileOptions::clear_has_php_namespace() {
_has_bits_[0] &= ~0x00000080u;
}
inline void FileOptions::clear_php_namespace() {
- php_namespace_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ php_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_php_namespace();
}
inline const ::std::string& FileOptions::php_namespace() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace)
- return php_namespace_.Get();
+ return php_namespace_.GetNoArena();
}
inline void FileOptions::set_php_namespace(const ::std::string& value) {
set_has_php_namespace();
- php_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace)
}
#if LANG_CXX11
inline void FileOptions::set_php_namespace(::std::string&& value) {
set_has_php_namespace();
- php_namespace_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ php_namespace_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_namespace)
}
#endif
inline void FileOptions::set_php_namespace(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_php_namespace();
- php_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_namespace)
}
-inline void FileOptions::set_php_namespace(const char* value,
- size_t size) {
+inline void FileOptions::set_php_namespace(const char* value, size_t size) {
set_has_php_namespace();
- php_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace)
}
inline ::std::string* FileOptions::mutable_php_namespace() {
set_has_php_namespace();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace)
- return php_namespace_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return php_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* FileOptions::release_php_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace)
- if (!has_php_namespace()) {
- return NULL;
- }
clear_has_php_namespace();
- return php_namespace_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return php_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void FileOptions::set_allocated_php_namespace(::std::string* php_namespace) {
if (php_namespace != NULL) {
@@ -9927,205 +7818,9 @@ inline void FileOptions::set_allocated_php_namespace(::std::string* php_namespac
} else {
clear_has_php_namespace();
}
- php_namespace_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace,
- GetArenaNoVirtual());
+ php_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace)
}
-inline ::std::string* FileOptions::unsafe_arena_release_php_namespace() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.php_namespace)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_php_namespace();
- return php_namespace_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_php_namespace(
- ::std::string* php_namespace) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (php_namespace != NULL) {
- set_has_php_namespace();
- } else {
- clear_has_php_namespace();
- }
- php_namespace_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- php_namespace, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.php_namespace)
-}
-
-// optional string php_metadata_namespace = 44;
-inline bool FileOptions::has_php_metadata_namespace() const {
- return (_has_bits_[0] & 0x00000100u) != 0;
-}
-inline void FileOptions::set_has_php_metadata_namespace() {
- _has_bits_[0] |= 0x00000100u;
-}
-inline void FileOptions::clear_has_php_metadata_namespace() {
- _has_bits_[0] &= ~0x00000100u;
-}
-inline void FileOptions::clear_php_metadata_namespace() {
- php_metadata_namespace_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
- clear_has_php_metadata_namespace();
-}
-inline const ::std::string& FileOptions::php_metadata_namespace() const {
- // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_metadata_namespace)
- return php_metadata_namespace_.Get();
-}
-inline void FileOptions::set_php_metadata_namespace(const ::std::string& value) {
- set_has_php_metadata_namespace();
- php_metadata_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_metadata_namespace)
-}
-#if LANG_CXX11
-inline void FileOptions::set_php_metadata_namespace(::std::string&& value) {
- set_has_php_metadata_namespace();
- php_metadata_namespace_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_metadata_namespace)
-}
-#endif
-inline void FileOptions::set_php_metadata_namespace(const char* value) {
- GOOGLE_DCHECK(value != NULL);
- set_has_php_metadata_namespace();
- php_metadata_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_metadata_namespace)
-}
-inline void FileOptions::set_php_metadata_namespace(const char* value,
- size_t size) {
- set_has_php_metadata_namespace();
- php_metadata_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_metadata_namespace)
-}
-inline ::std::string* FileOptions::mutable_php_metadata_namespace() {
- set_has_php_metadata_namespace();
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_metadata_namespace)
- return php_metadata_namespace_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
-}
-inline ::std::string* FileOptions::release_php_metadata_namespace() {
- // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_metadata_namespace)
- if (!has_php_metadata_namespace()) {
- return NULL;
- }
- clear_has_php_metadata_namespace();
- return php_metadata_namespace_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
-}
-inline void FileOptions::set_allocated_php_metadata_namespace(::std::string* php_metadata_namespace) {
- if (php_metadata_namespace != NULL) {
- set_has_php_metadata_namespace();
- } else {
- clear_has_php_metadata_namespace();
- }
- php_metadata_namespace_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_metadata_namespace,
- GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_metadata_namespace)
-}
-inline ::std::string* FileOptions::unsafe_arena_release_php_metadata_namespace() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.php_metadata_namespace)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_php_metadata_namespace();
- return php_metadata_namespace_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_php_metadata_namespace(
- ::std::string* php_metadata_namespace) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (php_metadata_namespace != NULL) {
- set_has_php_metadata_namespace();
- } else {
- clear_has_php_metadata_namespace();
- }
- php_metadata_namespace_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- php_metadata_namespace, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.php_metadata_namespace)
-}
-
-// optional string ruby_package = 45;
-inline bool FileOptions::has_ruby_package() const {
- return (_has_bits_[0] & 0x00000200u) != 0;
-}
-inline void FileOptions::set_has_ruby_package() {
- _has_bits_[0] |= 0x00000200u;
-}
-inline void FileOptions::clear_has_ruby_package() {
- _has_bits_[0] &= ~0x00000200u;
-}
-inline void FileOptions::clear_ruby_package() {
- ruby_package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
- clear_has_ruby_package();
-}
-inline const ::std::string& FileOptions::ruby_package() const {
- // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.ruby_package)
- return ruby_package_.Get();
-}
-inline void FileOptions::set_ruby_package(const ::std::string& value) {
- set_has_ruby_package();
- ruby_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.ruby_package)
-}
-#if LANG_CXX11
-inline void FileOptions::set_ruby_package(::std::string&& value) {
- set_has_ruby_package();
- ruby_package_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.ruby_package)
-}
-#endif
-inline void FileOptions::set_ruby_package(const char* value) {
- GOOGLE_DCHECK(value != NULL);
- set_has_ruby_package();
- ruby_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.ruby_package)
-}
-inline void FileOptions::set_ruby_package(const char* value,
- size_t size) {
- set_has_ruby_package();
- ruby_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.ruby_package)
-}
-inline ::std::string* FileOptions::mutable_ruby_package() {
- set_has_ruby_package();
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.ruby_package)
- return ruby_package_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
-}
-inline ::std::string* FileOptions::release_ruby_package() {
- // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.ruby_package)
- if (!has_ruby_package()) {
- return NULL;
- }
- clear_has_ruby_package();
- return ruby_package_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
-}
-inline void FileOptions::set_allocated_ruby_package(::std::string* ruby_package) {
- if (ruby_package != NULL) {
- set_has_ruby_package();
- } else {
- clear_has_ruby_package();
- }
- ruby_package_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ruby_package,
- GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.ruby_package)
-}
-inline ::std::string* FileOptions::unsafe_arena_release_ruby_package() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.ruby_package)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_ruby_package();
- return ruby_package_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void FileOptions::unsafe_arena_set_allocated_ruby_package(
- ::std::string* ruby_package) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (ruby_package != NULL) {
- set_has_ruby_package();
- } else {
- clear_has_ruby_package();
- }
- ruby_package_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- ruby_package, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.ruby_package)
-}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
inline int FileOptions::uninterpreted_option_size() const {
@@ -10134,23 +7829,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)
@@ -10264,23 +7959,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)
@@ -10444,23 +8139,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)
@@ -10478,23 +8173,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)
@@ -10560,23 +8255,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)
@@ -10618,23 +8313,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)
@@ -10676,23 +8371,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)
@@ -10759,23 +8454,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)
@@ -10797,52 +8492,47 @@ inline void UninterpretedOption_NamePart::clear_has_name_part() {
_has_bits_[0] &= ~0x00000001u;
}
inline void UninterpretedOption_NamePart::clear_name_part() {
- name_part_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ name_part_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name_part();
}
inline const ::std::string& UninterpretedOption_NamePart::name_part() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.name_part)
- return name_part_.Get();
+ return name_part_.GetNoArena();
}
inline void UninterpretedOption_NamePart::set_name_part(const ::std::string& value) {
set_has_name_part();
- name_part_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part)
}
#if LANG_CXX11
inline void UninterpretedOption_NamePart::set_name_part(::std::string&& value) {
set_has_name_part();
- name_part_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ name_part_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.NamePart.name_part)
}
#endif
inline void UninterpretedOption_NamePart::set_name_part(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name_part();
- name_part_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.NamePart.name_part)
}
-inline void UninterpretedOption_NamePart::set_name_part(const char* value,
- size_t size) {
+inline void UninterpretedOption_NamePart::set_name_part(const char* value, size_t size) {
set_has_name_part();
- name_part_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.NamePart.name_part)
}
inline ::std::string* UninterpretedOption_NamePart::mutable_name_part() {
set_has_name_part();
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part)
- return name_part_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_part_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* UninterpretedOption_NamePart::release_name_part() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part)
- if (!has_name_part()) {
- return NULL;
- }
clear_has_name_part();
- return name_part_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return name_part_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void UninterpretedOption_NamePart::set_allocated_name_part(::std::string* name_part) {
if (name_part != NULL) {
@@ -10850,29 +8540,9 @@ inline void UninterpretedOption_NamePart::set_allocated_name_part(::std::string*
} else {
clear_has_name_part();
}
- name_part_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name_part,
- GetArenaNoVirtual());
+ name_part_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name_part);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
}
-inline ::std::string* UninterpretedOption_NamePart::unsafe_arena_release_name_part() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.NamePart.name_part)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_name_part();
- return name_part_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void UninterpretedOption_NamePart::unsafe_arena_set_allocated_name_part(
- ::std::string* name_part) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (name_part != NULL) {
- set_has_name_part();
- } else {
- clear_has_name_part();
- }
- name_part_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- name_part, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
-}
// required bool is_extension = 2;
inline bool UninterpretedOption_NamePart::has_is_extension() const {
@@ -10909,23 +8579,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)
@@ -10943,52 +8613,47 @@ inline void UninterpretedOption::clear_has_identifier_value() {
_has_bits_[0] &= ~0x00000001u;
}
inline void UninterpretedOption::clear_identifier_value() {
- identifier_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ identifier_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_identifier_value();
}
inline const ::std::string& UninterpretedOption::identifier_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.identifier_value)
- return identifier_value_.Get();
+ return identifier_value_.GetNoArena();
}
inline void UninterpretedOption::set_identifier_value(const ::std::string& value) {
set_has_identifier_value();
- identifier_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value)
}
#if LANG_CXX11
inline void UninterpretedOption::set_identifier_value(::std::string&& value) {
set_has_identifier_value();
- identifier_value_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ identifier_value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.identifier_value)
}
#endif
inline void UninterpretedOption::set_identifier_value(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_identifier_value();
- identifier_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.identifier_value)
}
-inline void UninterpretedOption::set_identifier_value(const char* value,
- size_t size) {
+inline void UninterpretedOption::set_identifier_value(const char* value, size_t size) {
set_has_identifier_value();
- identifier_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.identifier_value)
}
inline ::std::string* UninterpretedOption::mutable_identifier_value() {
set_has_identifier_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value)
- return identifier_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return identifier_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* UninterpretedOption::release_identifier_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value)
- if (!has_identifier_value()) {
- return NULL;
- }
clear_has_identifier_value();
- return identifier_value_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return identifier_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void UninterpretedOption::set_allocated_identifier_value(::std::string* identifier_value) {
if (identifier_value != NULL) {
@@ -10996,29 +8661,9 @@ inline void UninterpretedOption::set_allocated_identifier_value(::std::string* i
} else {
clear_has_identifier_value();
}
- identifier_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), identifier_value,
- GetArenaNoVirtual());
+ identifier_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), identifier_value);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
}
-inline ::std::string* UninterpretedOption::unsafe_arena_release_identifier_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.identifier_value)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_identifier_value();
- return identifier_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void UninterpretedOption::unsafe_arena_set_allocated_identifier_value(
- ::std::string* identifier_value) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (identifier_value != NULL) {
- set_has_identifier_value();
- } else {
- clear_has_identifier_value();
- }
- identifier_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- identifier_value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
-}
// optional uint64 positive_int_value = 4;
inline bool UninterpretedOption::has_positive_int_value() const {
@@ -11103,52 +8748,47 @@ inline void UninterpretedOption::clear_has_string_value() {
_has_bits_[0] &= ~0x00000002u;
}
inline void UninterpretedOption::clear_string_value() {
- string_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ string_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_string_value();
}
inline const ::std::string& UninterpretedOption::string_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.string_value)
- return string_value_.Get();
+ return string_value_.GetNoArena();
}
inline void UninterpretedOption::set_string_value(const ::std::string& value) {
set_has_string_value();
- string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value)
}
#if LANG_CXX11
inline void UninterpretedOption::set_string_value(::std::string&& value) {
set_has_string_value();
- string_value_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ string_value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.string_value)
}
#endif
inline void UninterpretedOption::set_string_value(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_string_value();
- string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.string_value)
}
-inline void UninterpretedOption::set_string_value(const void* value,
- size_t size) {
+inline void UninterpretedOption::set_string_value(const void* value, size_t size) {
set_has_string_value();
- string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.string_value)
}
inline ::std::string* UninterpretedOption::mutable_string_value() {
set_has_string_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value)
- return string_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* UninterpretedOption::release_string_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value)
- if (!has_string_value()) {
- return NULL;
- }
clear_has_string_value();
- return string_value_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void UninterpretedOption::set_allocated_string_value(::std::string* string_value) {
if (string_value != NULL) {
@@ -11156,29 +8796,9 @@ inline void UninterpretedOption::set_allocated_string_value(::std::string* strin
} else {
clear_has_string_value();
}
- string_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value,
- GetArenaNoVirtual());
+ string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value)
}
-inline ::std::string* UninterpretedOption::unsafe_arena_release_string_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.string_value)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_string_value();
- return string_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void UninterpretedOption::unsafe_arena_set_allocated_string_value(
- ::std::string* string_value) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (string_value != NULL) {
- set_has_string_value();
- } else {
- clear_has_string_value();
- }
- string_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- string_value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.string_value)
-}
// optional string aggregate_value = 8;
inline bool UninterpretedOption::has_aggregate_value() const {
@@ -11191,52 +8811,47 @@ inline void UninterpretedOption::clear_has_aggregate_value() {
_has_bits_[0] &= ~0x00000004u;
}
inline void UninterpretedOption::clear_aggregate_value() {
- aggregate_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ aggregate_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_aggregate_value();
}
inline const ::std::string& UninterpretedOption::aggregate_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.aggregate_value)
- return aggregate_value_.Get();
+ return aggregate_value_.GetNoArena();
}
inline void UninterpretedOption::set_aggregate_value(const ::std::string& value) {
set_has_aggregate_value();
- aggregate_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value)
}
#if LANG_CXX11
inline void UninterpretedOption::set_aggregate_value(::std::string&& value) {
set_has_aggregate_value();
- aggregate_value_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ aggregate_value_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.aggregate_value)
}
#endif
inline void UninterpretedOption::set_aggregate_value(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_aggregate_value();
- aggregate_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.aggregate_value)
}
-inline void UninterpretedOption::set_aggregate_value(const char* value,
- size_t size) {
+inline void UninterpretedOption::set_aggregate_value(const char* value, size_t size) {
set_has_aggregate_value();
- aggregate_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.aggregate_value)
}
inline ::std::string* UninterpretedOption::mutable_aggregate_value() {
set_has_aggregate_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value)
- return aggregate_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return aggregate_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* UninterpretedOption::release_aggregate_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value)
- if (!has_aggregate_value()) {
- return NULL;
- }
clear_has_aggregate_value();
- return aggregate_value_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return aggregate_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void UninterpretedOption::set_allocated_aggregate_value(::std::string* aggregate_value) {
if (aggregate_value != NULL) {
@@ -11244,29 +8859,9 @@ inline void UninterpretedOption::set_allocated_aggregate_value(::std::string* ag
} else {
clear_has_aggregate_value();
}
- aggregate_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), aggregate_value,
- GetArenaNoVirtual());
+ aggregate_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), aggregate_value);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
}
-inline ::std::string* UninterpretedOption::unsafe_arena_release_aggregate_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.aggregate_value)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_aggregate_value();
- return aggregate_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void UninterpretedOption::unsafe_arena_set_allocated_aggregate_value(
- ::std::string* aggregate_value) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (aggregate_value != NULL) {
- set_has_aggregate_value();
- } else {
- clear_has_aggregate_value();
- }
- aggregate_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- aggregate_value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
-}
// -------------------------------------------------------------------
@@ -11343,52 +8938,47 @@ inline void SourceCodeInfo_Location::clear_has_leading_comments() {
_has_bits_[0] &= ~0x00000001u;
}
inline void SourceCodeInfo_Location::clear_leading_comments() {
- leading_comments_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ leading_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_leading_comments();
}
inline const ::std::string& SourceCodeInfo_Location::leading_comments() const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_comments)
- return leading_comments_.Get();
+ return leading_comments_.GetNoArena();
}
inline void SourceCodeInfo_Location::set_leading_comments(const ::std::string& value) {
set_has_leading_comments();
- leading_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
#if LANG_CXX11
inline void SourceCodeInfo_Location::set_leading_comments(::std::string&& value) {
set_has_leading_comments();
- leading_comments_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ leading_comments_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
#endif
inline void SourceCodeInfo_Location::set_leading_comments(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_leading_comments();
- leading_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
-inline void SourceCodeInfo_Location::set_leading_comments(const char* value,
- size_t size) {
+inline void SourceCodeInfo_Location::set_leading_comments(const char* value, size_t size) {
set_has_leading_comments();
- leading_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
inline ::std::string* SourceCodeInfo_Location::mutable_leading_comments() {
set_has_leading_comments();
// @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments)
- return leading_comments_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return leading_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* SourceCodeInfo_Location::release_leading_comments() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments)
- if (!has_leading_comments()) {
- return NULL;
- }
clear_has_leading_comments();
- return leading_comments_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return leading_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void SourceCodeInfo_Location::set_allocated_leading_comments(::std::string* leading_comments) {
if (leading_comments != NULL) {
@@ -11396,29 +8986,9 @@ inline void SourceCodeInfo_Location::set_allocated_leading_comments(::std::strin
} else {
clear_has_leading_comments();
}
- leading_comments_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), leading_comments,
- GetArenaNoVirtual());
+ leading_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), leading_comments);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
-inline ::std::string* SourceCodeInfo_Location::unsafe_arena_release_leading_comments() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.SourceCodeInfo.Location.leading_comments)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_leading_comments();
- return leading_comments_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void SourceCodeInfo_Location::unsafe_arena_set_allocated_leading_comments(
- ::std::string* leading_comments) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (leading_comments != NULL) {
- set_has_leading_comments();
- } else {
- clear_has_leading_comments();
- }
- leading_comments_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- leading_comments, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
-}
// optional string trailing_comments = 4;
inline bool SourceCodeInfo_Location::has_trailing_comments() const {
@@ -11431,52 +9001,47 @@ inline void SourceCodeInfo_Location::clear_has_trailing_comments() {
_has_bits_[0] &= ~0x00000002u;
}
inline void SourceCodeInfo_Location::clear_trailing_comments() {
- trailing_comments_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ trailing_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_trailing_comments();
}
inline const ::std::string& SourceCodeInfo_Location::trailing_comments() const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.trailing_comments)
- return trailing_comments_.Get();
+ return trailing_comments_.GetNoArena();
}
inline void SourceCodeInfo_Location::set_trailing_comments(const ::std::string& value) {
set_has_trailing_comments();
- trailing_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
#if LANG_CXX11
inline void SourceCodeInfo_Location::set_trailing_comments(::std::string&& value) {
set_has_trailing_comments();
- trailing_comments_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ trailing_comments_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
#endif
inline void SourceCodeInfo_Location::set_trailing_comments(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_trailing_comments();
- trailing_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
-inline void SourceCodeInfo_Location::set_trailing_comments(const char* value,
- size_t size) {
+inline void SourceCodeInfo_Location::set_trailing_comments(const char* value, size_t size) {
set_has_trailing_comments();
- trailing_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
inline ::std::string* SourceCodeInfo_Location::mutable_trailing_comments() {
set_has_trailing_comments();
// @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments)
- return trailing_comments_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return trailing_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* SourceCodeInfo_Location::release_trailing_comments() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments)
- if (!has_trailing_comments()) {
- return NULL;
- }
clear_has_trailing_comments();
- return trailing_comments_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return trailing_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::string* trailing_comments) {
if (trailing_comments != NULL) {
@@ -11484,29 +9049,9 @@ inline void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::stri
} else {
clear_has_trailing_comments();
}
- trailing_comments_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), trailing_comments,
- GetArenaNoVirtual());
+ trailing_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), trailing_comments);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
-inline ::std::string* SourceCodeInfo_Location::unsafe_arena_release_trailing_comments() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.SourceCodeInfo.Location.trailing_comments)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_trailing_comments();
- return trailing_comments_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void SourceCodeInfo_Location::unsafe_arena_set_allocated_trailing_comments(
- ::std::string* trailing_comments) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (trailing_comments != NULL) {
- set_has_trailing_comments();
- } else {
- clear_has_trailing_comments();
- }
- trailing_comments_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- trailing_comments, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
-}
// repeated string leading_detached_comments = 6;
inline int SourceCodeInfo_Location::leading_detached_comments_size() const {
@@ -11588,23 +9133,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)
@@ -11656,52 +9201,47 @@ inline void GeneratedCodeInfo_Annotation::clear_has_source_file() {
_has_bits_[0] &= ~0x00000001u;
}
inline void GeneratedCodeInfo_Annotation::clear_source_file() {
- source_file_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_source_file();
}
inline const ::std::string& GeneratedCodeInfo_Annotation::source_file() const {
// @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
- return source_file_.Get();
+ return source_file_.GetNoArena();
}
inline void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) {
set_has_source_file();
- source_file_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
#if LANG_CXX11
inline void GeneratedCodeInfo_Annotation::set_source_file(::std::string&& value) {
set_has_source_file();
- source_file_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ source_file_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
#endif
inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_source_file();
- source_file_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
- GetArenaNoVirtual());
+ source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
-inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value,
- size_t size) {
+inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) {
set_has_source_file();
- source_file_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
inline ::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() {
set_has_source_file();
// @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
- return source_file_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* GeneratedCodeInfo_Annotation::release_source_file() {
// @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
- if (!has_source_file()) {
- return NULL;
- }
clear_has_source_file();
- return source_file_.ReleaseNonDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) {
if (source_file != NULL) {
@@ -11709,29 +9249,9 @@ inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::strin
} else {
clear_has_source_file();
}
- source_file_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file,
- GetArenaNoVirtual());
+ source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
-inline ::std::string* GeneratedCodeInfo_Annotation::unsafe_arena_release_source_file() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- clear_has_source_file();
- return source_file_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
-inline void GeneratedCodeInfo_Annotation::unsafe_arena_set_allocated_source_file(
- ::std::string* source_file) {
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (source_file != NULL) {
- set_has_source_file();
- } else {
- clear_has_source_file();
- }
- source_file_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- source_file, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
-}
// optional int32 begin = 3;
inline bool GeneratedCodeInfo_Annotation::has_begin() const {
@@ -11792,23 +9312,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)
@@ -11818,8 +9338,7 @@ GeneratedCodeInfo::annotation() const {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
-// -------------------------------------------------------------------
-
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// -------------------------------------------------------------------
// -------------------------------------------------------------------
@@ -11873,38 +9392,39 @@ GeneratedCodeInfo::annotation() const {
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
namespace google {
namespace protobuf {
-template <> struct is_proto_enum< ::google::protobuf::FieldDescriptorProto_Type> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::FieldDescriptorProto_Type> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldDescriptorProto_Type>() {
return ::google::protobuf::FieldDescriptorProto_Type_descriptor();
}
-template <> struct is_proto_enum< ::google::protobuf::FieldDescriptorProto_Label> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::FieldDescriptorProto_Label> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldDescriptorProto_Label>() {
return ::google::protobuf::FieldDescriptorProto_Label_descriptor();
}
-template <> struct is_proto_enum< ::google::protobuf::FileOptions_OptimizeMode> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::FileOptions_OptimizeMode> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FileOptions_OptimizeMode>() {
return ::google::protobuf::FileOptions_OptimizeMode_descriptor();
}
-template <> struct is_proto_enum< ::google::protobuf::FieldOptions_CType> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::FieldOptions_CType> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldOptions_CType>() {
return ::google::protobuf::FieldOptions_CType_descriptor();
}
-template <> struct is_proto_enum< ::google::protobuf::FieldOptions_JSType> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::FieldOptions_JSType> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldOptions_JSType>() {
return ::google::protobuf::FieldOptions_JSType_descriptor();
}
-template <> struct is_proto_enum< ::google::protobuf::MethodOptions_IdempotencyLevel> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::MethodOptions_IdempotencyLevel> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::MethodOptions_IdempotencyLevel>() {
return ::google::protobuf::MethodOptions_IdempotencyLevel_descriptor();
@@ -11915,4 +9435,4 @@ inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::MethodOption
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fdescriptor_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.proto b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.proto
new file mode 100644
index 0000000000..f1ec5735da
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor.proto
@@ -0,0 +1,849 @@
+// 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.
+//
+// The messages in this file describe the definitions found in .proto files.
+// A valid .proto file can be translated directly to a FileDescriptorProto
+// without any other information (e.g. without reading its imports).
+
+
+syntax = "proto2";
+
+package google.protobuf;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "DescriptorProtos";
+option csharp_namespace = "Google.Protobuf.Reflection";
+option objc_class_prefix = "GPB";
+
+// descriptor.proto must be optimized for speed because reflection-based
+// algorithms don't work during bootstrapping.
+option optimize_for = SPEED;
+
+// The protocol compiler can output a FileDescriptorSet containing the .proto
+// files it parses.
+message FileDescriptorSet {
+ repeated FileDescriptorProto file = 1;
+}
+
+// Describes a complete .proto file.
+message FileDescriptorProto {
+ optional string name = 1; // file name, relative to root of source tree
+ optional string package = 2; // e.g. "foo", "foo.bar", etc.
+
+ // Names of files imported by this file.
+ repeated string dependency = 3;
+ // Indexes of the public imported files in the dependency list above.
+ repeated int32 public_dependency = 10;
+ // Indexes of the weak imported files in the dependency list.
+ // For Google-internal migration only. Do not use.
+ repeated int32 weak_dependency = 11;
+
+ // All top-level definitions in this file.
+ repeated DescriptorProto message_type = 4;
+ repeated EnumDescriptorProto enum_type = 5;
+ repeated ServiceDescriptorProto service = 6;
+ repeated FieldDescriptorProto extension = 7;
+
+ optional FileOptions options = 8;
+
+ // This field contains optional information about the original source code.
+ // You may safely remove this entire field without harming runtime
+ // functionality of the descriptors -- the information is needed only by
+ // development tools.
+ optional SourceCodeInfo source_code_info = 9;
+
+ // The syntax of the proto file.
+ // The supported values are "proto2" and "proto3".
+ optional string syntax = 12;
+}
+
+// Describes a message type.
+message DescriptorProto {
+ optional string name = 1;
+
+ repeated FieldDescriptorProto field = 2;
+ repeated FieldDescriptorProto extension = 6;
+
+ repeated DescriptorProto nested_type = 3;
+ repeated EnumDescriptorProto enum_type = 4;
+
+ message ExtensionRange {
+ optional int32 start = 1;
+ optional int32 end = 2;
+
+ optional ExtensionRangeOptions options = 3;
+ }
+ repeated ExtensionRange extension_range = 5;
+
+ repeated OneofDescriptorProto oneof_decl = 8;
+
+ optional MessageOptions options = 7;
+
+ // Range of reserved tag numbers. Reserved tag numbers may not be used by
+ // fields or extension ranges in the same message. Reserved ranges may
+ // not overlap.
+ message ReservedRange {
+ optional int32 start = 1; // Inclusive.
+ optional int32 end = 2; // Exclusive.
+ }
+ repeated ReservedRange reserved_range = 9;
+ // Reserved field names, which may not be used by fields in the same message.
+ // A given name may only be reserved once.
+ repeated string reserved_name = 10;
+}
+
+message ExtensionRangeOptions {
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+}
+
+// Describes a field within a message.
+message FieldDescriptorProto {
+ enum Type {
+ // 0 is reserved for errors.
+ // Order is weird for historical reasons.
+ TYPE_DOUBLE = 1;
+ TYPE_FLOAT = 2;
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
+ // negative values are likely.
+ TYPE_INT64 = 3;
+ TYPE_UINT64 = 4;
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
+ // negative values are likely.
+ TYPE_INT32 = 5;
+ TYPE_FIXED64 = 6;
+ TYPE_FIXED32 = 7;
+ TYPE_BOOL = 8;
+ TYPE_STRING = 9;
+ // Tag-delimited aggregate.
+ // Group type is deprecated and not supported in proto3. However, Proto3
+ // implementations should still be able to parse the group wire format and
+ // treat group fields as unknown fields.
+ TYPE_GROUP = 10;
+ TYPE_MESSAGE = 11; // Length-delimited aggregate.
+
+ // New in version 2.
+ TYPE_BYTES = 12;
+ TYPE_UINT32 = 13;
+ TYPE_ENUM = 14;
+ TYPE_SFIXED32 = 15;
+ TYPE_SFIXED64 = 16;
+ TYPE_SINT32 = 17; // Uses ZigZag encoding.
+ TYPE_SINT64 = 18; // Uses ZigZag encoding.
+ };
+
+ enum Label {
+ // 0 is reserved for errors
+ LABEL_OPTIONAL = 1;
+ LABEL_REQUIRED = 2;
+ LABEL_REPEATED = 3;
+ };
+
+ optional string name = 1;
+ optional int32 number = 3;
+ optional Label label = 4;
+
+ // If type_name is set, this need not be set. If both this and type_name
+ // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
+ optional Type type = 5;
+
+ // For message and enum types, this is the name of the type. If the name
+ // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
+ // rules are used to find the type (i.e. first the nested types within this
+ // message are searched, then within the parent, on up to the root
+ // namespace).
+ optional string type_name = 6;
+
+ // For extensions, this is the name of the type being extended. It is
+ // resolved in the same manner as type_name.
+ optional string extendee = 2;
+
+ // For numeric types, contains the original text representation of the value.
+ // For booleans, "true" or "false".
+ // For strings, contains the default text contents (not escaped in any way).
+ // For bytes, contains the C escaped value. All bytes >= 128 are escaped.
+ // TODO(kenton): Base-64 encode?
+ optional string default_value = 7;
+
+ // If set, gives the index of a oneof in the containing type's oneof_decl
+ // list. This field is a member of that oneof.
+ optional int32 oneof_index = 9;
+
+ // JSON name of this field. The value is set by protocol compiler. If the
+ // user has set a "json_name" option on this field, that option's value
+ // will be used. Otherwise, it's deduced from the field's name by converting
+ // it to camelCase.
+ optional string json_name = 10;
+
+ optional FieldOptions options = 8;
+}
+
+// Describes a oneof.
+message OneofDescriptorProto {
+ optional string name = 1;
+ optional OneofOptions options = 2;
+}
+
+// Describes an enum type.
+message EnumDescriptorProto {
+ optional string name = 1;
+
+ repeated EnumValueDescriptorProto value = 2;
+
+ optional EnumOptions options = 3;
+}
+
+// Describes a value within an enum.
+message EnumValueDescriptorProto {
+ optional string name = 1;
+ optional int32 number = 2;
+
+ optional EnumValueOptions options = 3;
+}
+
+// Describes a service.
+message ServiceDescriptorProto {
+ optional string name = 1;
+ repeated MethodDescriptorProto method = 2;
+
+ optional ServiceOptions options = 3;
+}
+
+// Describes a method of a service.
+message MethodDescriptorProto {
+ optional string name = 1;
+
+ // Input and output type names. These are resolved in the same way as
+ // FieldDescriptorProto.type_name, but must refer to a message type.
+ optional string input_type = 2;
+ optional string output_type = 3;
+
+ optional MethodOptions options = 4;
+
+ // Identifies if client streams multiple client messages
+ optional bool client_streaming = 5 [default=false];
+ // Identifies if server streams multiple server messages
+ optional bool server_streaming = 6 [default=false];
+}
+
+
+// ===================================================================
+// Options
+
+// Each of the definitions above may have "options" attached. These are
+// just annotations which may cause code to be generated slightly differently
+// or may contain hints for code that manipulates protocol messages.
+//
+// Clients may define custom options as extensions of the *Options messages.
+// These extensions may not yet be known at parsing time, so the parser cannot
+// store the values in them. Instead it stores them in a field in the *Options
+// message called uninterpreted_option. This field must have the same name
+// across all *Options messages. We then use this field to populate the
+// extensions when we build a descriptor, at which point all protos have been
+// parsed and so all extensions are known.
+//
+// Extension numbers for custom options may be chosen as follows:
+// * For options which will only be used within a single application or
+// organization, or for experimental options, use field numbers 50000
+// through 99999. It is up to you to ensure that you do not use the
+// same number for multiple options.
+// * For options which will be published and used publicly by multiple
+// independent entities, e-mail protobuf-global-extension-registry@google.com
+// to reserve extension numbers. Simply provide your project name (e.g.
+// Objective-C plugin) and your project website (if available) -- there's no
+// need to explain how you intend to use them. Usually you only need one
+// extension number. You can declare multiple options with only one extension
+// number by putting them in a sub-message. See the Custom Options section of
+// the docs for examples:
+// https://developers.google.com/protocol-buffers/docs/proto#options
+// If this turns out to be popular, a web service will be set up
+// to automatically assign option numbers.
+
+
+message FileOptions {
+
+ // Sets the Java package where classes generated from this .proto will be
+ // placed. By default, the proto package is used, but this is often
+ // inappropriate because proto packages do not normally start with backwards
+ // domain names.
+ optional string java_package = 1;
+
+
+ // If set, all the classes from the .proto file are wrapped in a single
+ // outer class with the given name. This applies to both Proto1
+ // (equivalent to the old "--one_java_file" option) and Proto2 (where
+ // a .proto always translates to a single class, but you may want to
+ // explicitly choose the class name).
+ optional string java_outer_classname = 8;
+
+ // If set true, then the Java code generator will generate a separate .java
+ // file for each top-level message, enum, and service defined in the .proto
+ // file. Thus, these types will *not* be nested inside the outer class
+ // named by java_outer_classname. However, the outer class will still be
+ // generated to contain the file's getDescriptor() method as well as any
+ // top-level extensions defined in the file.
+ optional bool java_multiple_files = 10 [default=false];
+
+ // This option does nothing.
+ optional bool java_generate_equals_and_hash = 20 [deprecated=true];
+
+ // If set true, then the Java2 code generator will generate code that
+ // throws an exception whenever an attempt is made to assign a non-UTF-8
+ // byte sequence to a string field.
+ // Message reflection will do the same.
+ // However, an extension field still accepts non-UTF-8 byte sequences.
+ // This option has no effect on when used with the lite runtime.
+ optional bool java_string_check_utf8 = 27 [default=false];
+
+
+ // Generated classes can be optimized for speed or code size.
+ enum OptimizeMode {
+ SPEED = 1; // Generate complete code for parsing, serialization,
+ // etc.
+ CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
+ LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
+ }
+ optional OptimizeMode optimize_for = 9 [default=SPEED];
+
+ // Sets the Go package where structs generated from this .proto will be
+ // placed. If omitted, the Go package will be derived from the following:
+ // - The basename of the package import path, if provided.
+ // - Otherwise, the package statement in the .proto file, if present.
+ // - Otherwise, the basename of the .proto file, without extension.
+ optional string go_package = 11;
+
+
+
+ // Should generic services be generated in each language? "Generic" services
+ // are not specific to any particular RPC system. They are generated by the
+ // main code generators in each language (without additional plugins).
+ // Generic services were the only kind of service generation supported by
+ // early versions of google.protobuf.
+ //
+ // Generic services are now considered deprecated in favor of using plugins
+ // that generate code specific to your particular RPC system. Therefore,
+ // these default to false. Old code which depends on generic services should
+ // explicitly set them to true.
+ optional bool cc_generic_services = 16 [default=false];
+ optional bool java_generic_services = 17 [default=false];
+ optional bool py_generic_services = 18 [default=false];
+ optional bool php_generic_services = 19 [default=false];
+
+ // Is this file deprecated?
+ // Depending on the target platform, this can emit Deprecated annotations
+ // for everything in the file, or it will be completely ignored; in the very
+ // least, this is a formalization for deprecating files.
+ optional bool deprecated = 23 [default=false];
+
+ // Enables the use of arenas for the proto messages in this file. This applies
+ // only to generated classes for C++.
+ optional bool cc_enable_arenas = 31 [default=false];
+
+
+ // Sets the objective c class prefix which is prepended to all objective c
+ // generated classes from this .proto. There is no default.
+ optional string objc_class_prefix = 36;
+
+ // Namespace for generated classes; defaults to the package.
+ optional string csharp_namespace = 37;
+
+ // By default Swift generators will take the proto package and CamelCase it
+ // replacing '.' with underscore and use that to prefix the types/symbols
+ // defined. When this options is provided, they will use this value instead
+ // to prefix the types/symbols defined.
+ optional string swift_prefix = 39;
+
+ // Sets the php class prefix which is prepended to all php generated classes
+ // from this .proto. Default is empty.
+ optional string php_class_prefix = 40;
+
+ // Use this option to change the namespace of php generated classes. Default
+ // is empty. When this option is empty, the package name will be used for
+ // determining the namespace.
+ optional string php_namespace = 41;
+
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+
+ reserved 38;
+}
+
+message MessageOptions {
+ // Set true to use the old proto1 MessageSet wire format for extensions.
+ // This is provided for backwards-compatibility with the MessageSet wire
+ // format. You should not use this for any other reason: It's less
+ // efficient, has fewer features, and is more complicated.
+ //
+ // The message must be defined exactly as follows:
+ // message Foo {
+ // option message_set_wire_format = true;
+ // extensions 4 to max;
+ // }
+ // Note that the message cannot have any defined fields; MessageSets only
+ // have extensions.
+ //
+ // All extensions of your type must be singular messages; e.g. they cannot
+ // be int32s, enums, or repeated messages.
+ //
+ // Because this is an option, the above two restrictions are not enforced by
+ // the protocol compiler.
+ optional bool message_set_wire_format = 1 [default=false];
+
+ // Disables the generation of the standard "descriptor()" accessor, which can
+ // conflict with a field of the same name. This is meant to make migration
+ // from proto1 easier; new code should avoid fields named "descriptor".
+ optional bool no_standard_descriptor_accessor = 2 [default=false];
+
+ // Is this message deprecated?
+ // Depending on the target platform, this can emit Deprecated annotations
+ // for the message, or it will be completely ignored; in the very least,
+ // this is a formalization for deprecating messages.
+ optional bool deprecated = 3 [default=false];
+
+ // Whether the message is an automatically generated map entry type for the
+ // maps field.
+ //
+ // For maps fields:
+ // map<KeyType, ValueType> map_field = 1;
+ // The parsed descriptor looks like:
+ // message MapFieldEntry {
+ // option map_entry = true;
+ // optional KeyType key = 1;
+ // optional ValueType value = 2;
+ // }
+ // repeated MapFieldEntry map_field = 1;
+ //
+ // Implementations may choose not to generate the map_entry=true message, but
+ // use a native map in the target language to hold the keys and values.
+ // The reflection APIs in such implementions still need to work as
+ // if the field is a repeated message field.
+ //
+ // NOTE: Do not set the option in .proto files. Always use the maps syntax
+ // instead. The option should only be implicitly set by the proto compiler
+ // parser.
+ optional bool map_entry = 7;
+
+ reserved 8; // javalite_serializable
+ reserved 9; // javanano_as_lite
+
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+}
+
+message FieldOptions {
+ // The ctype option instructs the C++ code generator to use a different
+ // representation of the field than it normally would. See the specific
+ // options below. This option is not yet implemented in the open source
+ // release -- sorry, we'll try to include it in a future version!
+ optional CType ctype = 1 [default = STRING];
+ enum CType {
+ // Default mode.
+ STRING = 0;
+
+ CORD = 1;
+
+ STRING_PIECE = 2;
+ }
+ // The packed option can be enabled for repeated primitive fields to enable
+ // a more efficient representation on the wire. Rather than repeatedly
+ // writing the tag and type for each element, the entire array is encoded as
+ // a single length-delimited blob. In proto3, only explicit setting it to
+ // false will avoid using packed encoding.
+ optional bool packed = 2;
+
+ // The jstype option determines the JavaScript type used for values of the
+ // field. The option is permitted only for 64 bit integral and fixed types
+ // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
+ // is represented as JavaScript string, which avoids loss of precision that
+ // can happen when a large value is converted to a floating point JavaScript.
+ // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
+ // use the JavaScript "number" type. The behavior of the default option
+ // JS_NORMAL is implementation dependent.
+ //
+ // This option is an enum to permit additional types to be added, e.g.
+ // goog.math.Integer.
+ optional JSType jstype = 6 [default = JS_NORMAL];
+ enum JSType {
+ // Use the default type.
+ JS_NORMAL = 0;
+
+ // Use JavaScript strings.
+ JS_STRING = 1;
+
+ // Use JavaScript numbers.
+ JS_NUMBER = 2;
+ }
+
+ // Should this field be parsed lazily? Lazy applies only to message-type
+ // fields. It means that when the outer message is initially parsed, the
+ // inner message's contents will not be parsed but instead stored in encoded
+ // form. The inner message will actually be parsed when it is first accessed.
+ //
+ // This is only a hint. Implementations are free to choose whether to use
+ // eager or lazy parsing regardless of the value of this option. However,
+ // setting this option true suggests that the protocol author believes that
+ // using lazy parsing on this field is worth the additional bookkeeping
+ // overhead typically needed to implement it.
+ //
+ // This option does not affect the public interface of any generated code;
+ // all method signatures remain the same. Furthermore, thread-safety of the
+ // interface is not affected by this option; const methods remain safe to
+ // call from multiple threads concurrently, while non-const methods continue
+ // to require exclusive access.
+ //
+ //
+ // Note that implementations may choose not to check required fields within
+ // a lazy sub-message. That is, calling IsInitialized() on the outer message
+ // may return true even if the inner message has missing required fields.
+ // This is necessary because otherwise the inner message would have to be
+ // parsed in order to perform the check, defeating the purpose of lazy
+ // parsing. An implementation which chooses not to check required fields
+ // must be consistent about it. That is, for any particular sub-message, the
+ // implementation must either *always* check its required fields, or *never*
+ // check its required fields, regardless of whether or not the message has
+ // been parsed.
+ optional bool lazy = 5 [default=false];
+
+ // Is this field deprecated?
+ // Depending on the target platform, this can emit Deprecated annotations
+ // for accessors, or it will be completely ignored; in the very least, this
+ // is a formalization for deprecating fields.
+ optional bool deprecated = 3 [default=false];
+
+ // For Google-internal migration only. Do not use.
+ optional bool weak = 10 [default=false];
+
+
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+
+ reserved 4; // removed jtype
+}
+
+message OneofOptions {
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+}
+
+message EnumOptions {
+
+ // Set this option to true to allow mapping different tag names to the same
+ // value.
+ optional bool allow_alias = 2;
+
+ // Is this enum deprecated?
+ // Depending on the target platform, this can emit Deprecated annotations
+ // for the enum, or it will be completely ignored; in the very least, this
+ // is a formalization for deprecating enums.
+ optional bool deprecated = 3 [default=false];
+
+ reserved 5; // javanano_as_lite
+
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+}
+
+message EnumValueOptions {
+ // Is this enum value deprecated?
+ // Depending on the target platform, this can emit Deprecated annotations
+ // for the enum value, or it will be completely ignored; in the very least,
+ // this is a formalization for deprecating enum values.
+ optional bool deprecated = 1 [default=false];
+
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+}
+
+message ServiceOptions {
+
+ // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
+ // framework. We apologize for hoarding these numbers to ourselves, but
+ // we were already using them long before we decided to release Protocol
+ // Buffers.
+
+ // Is this service deprecated?
+ // Depending on the target platform, this can emit Deprecated annotations
+ // for the service, or it will be completely ignored; in the very least,
+ // this is a formalization for deprecating services.
+ optional bool deprecated = 33 [default=false];
+
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+}
+
+message MethodOptions {
+
+ // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
+ // framework. We apologize for hoarding these numbers to ourselves, but
+ // we were already using them long before we decided to release Protocol
+ // Buffers.
+
+ // Is this method deprecated?
+ // Depending on the target platform, this can emit Deprecated annotations
+ // for the method, or it will be completely ignored; in the very least,
+ // this is a formalization for deprecating methods.
+ optional bool deprecated = 33 [default=false];
+
+ // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
+ // or neither? HTTP based RPC implementation may choose GET verb for safe
+ // methods, and PUT verb for idempotent methods instead of the default POST.
+ enum IdempotencyLevel {
+ IDEMPOTENCY_UNKNOWN = 0;
+ NO_SIDE_EFFECTS = 1; // implies idempotent
+ IDEMPOTENT = 2; // idempotent, but may have side effects
+ }
+ optional IdempotencyLevel idempotency_level =
+ 34 [default=IDEMPOTENCY_UNKNOWN];
+
+ // The parser stores options it doesn't recognize here. See above.
+ repeated UninterpretedOption uninterpreted_option = 999;
+
+ // Clients can define custom options in extensions of this message. See above.
+ extensions 1000 to max;
+}
+
+
+// A message representing a option the parser does not recognize. This only
+// appears in options protos created by the compiler::Parser class.
+// DescriptorPool resolves these when building Descriptor objects. Therefore,
+// options protos in descriptor objects (e.g. returned by Descriptor::options(),
+// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
+// in them.
+message UninterpretedOption {
+ // The name of the uninterpreted option. Each string represents a segment in
+ // a dot-separated name. is_extension is true iff a segment represents an
+ // extension (denoted with parentheses in options specs in .proto files).
+ // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
+ // "foo.(bar.baz).qux".
+ message NamePart {
+ required string name_part = 1;
+ required bool is_extension = 2;
+ }
+ repeated NamePart name = 2;
+
+ // The value of the uninterpreted option, in whatever type the tokenizer
+ // identified it as during parsing. Exactly one of these should be set.
+ optional string identifier_value = 3;
+ optional uint64 positive_int_value = 4;
+ optional int64 negative_int_value = 5;
+ optional double double_value = 6;
+ optional bytes string_value = 7;
+ optional string aggregate_value = 8;
+}
+
+// ===================================================================
+// Optional source code info
+
+// Encapsulates information about the original source file from which a
+// FileDescriptorProto was generated.
+message SourceCodeInfo {
+ // A Location identifies a piece of source code in a .proto file which
+ // corresponds to a particular definition. This information is intended
+ // to be useful to IDEs, code indexers, documentation generators, and similar
+ // tools.
+ //
+ // For example, say we have a file like:
+ // message Foo {
+ // optional string foo = 1;
+ // }
+ // Let's look at just the field definition:
+ // optional string foo = 1;
+ // ^ ^^ ^^ ^ ^^^
+ // a bc de f ghi
+ // We have the following locations:
+ // span path represents
+ // [a,i) [ 4, 0, 2, 0 ] The whole field definition.
+ // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
+ // [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
+ // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
+ // [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
+ //
+ // Notes:
+ // - A location may refer to a repeated field itself (i.e. not to any
+ // particular index within it). This is used whenever a set of elements are
+ // logically enclosed in a single code segment. For example, an entire
+ // extend block (possibly containing multiple extension definitions) will
+ // have an outer location whose path refers to the "extensions" repeated
+ // field without an index.
+ // - Multiple locations may have the same path. This happens when a single
+ // logical declaration is spread out across multiple places. The most
+ // obvious example is the "extend" block again -- there may be multiple
+ // extend blocks in the same scope, each of which will have the same path.
+ // - A location's span is not always a subset of its parent's span. For
+ // example, the "extendee" of an extension declaration appears at the
+ // beginning of the "extend" block and is shared by all extensions within
+ // the block.
+ // - Just because a location's span is a subset of some other location's span
+ // does not mean that it is a descendent. For example, a "group" defines
+ // both a type and a field in a single declaration. Thus, the locations
+ // corresponding to the type and field and their components will overlap.
+ // - Code which tries to interpret locations should probably be designed to
+ // ignore those that it doesn't understand, as more types of locations could
+ // be recorded in the future.
+ repeated Location location = 1;
+ message Location {
+ // Identifies which part of the FileDescriptorProto was defined at this
+ // location.
+ //
+ // Each element is a field number or an index. They form a path from
+ // the root FileDescriptorProto to the place where the definition. For
+ // example, this path:
+ // [ 4, 3, 2, 7, 1 ]
+ // refers to:
+ // file.message_type(3) // 4, 3
+ // .field(7) // 2, 7
+ // .name() // 1
+ // This is because FileDescriptorProto.message_type has field number 4:
+ // repeated DescriptorProto message_type = 4;
+ // and DescriptorProto.field has field number 2:
+ // repeated FieldDescriptorProto field = 2;
+ // and FieldDescriptorProto.name has field number 1:
+ // optional string name = 1;
+ //
+ // Thus, the above path gives the location of a field name. If we removed
+ // the last element:
+ // [ 4, 3, 2, 7 ]
+ // this path refers to the whole field declaration (from the beginning
+ // of the label to the terminating semicolon).
+ repeated int32 path = 1 [packed=true];
+
+ // Always has exactly three or four elements: start line, start column,
+ // end line (optional, otherwise assumed same as start line), end column.
+ // These are packed into a single field for efficiency. Note that line
+ // and column numbers are zero-based -- typically you will want to add
+ // 1 to each before displaying to a user.
+ repeated int32 span = 2 [packed=true];
+
+ // If this SourceCodeInfo represents a complete declaration, these are any
+ // comments appearing before and after the declaration which appear to be
+ // attached to the declaration.
+ //
+ // A series of line comments appearing on consecutive lines, with no other
+ // tokens appearing on those lines, will be treated as a single comment.
+ //
+ // leading_detached_comments will keep paragraphs of comments that appear
+ // before (but not connected to) the current element. Each paragraph,
+ // separated by empty lines, will be one comment element in the repeated
+ // field.
+ //
+ // Only the comment content is provided; comment markers (e.g. //) are
+ // stripped out. For block comments, leading whitespace and an asterisk
+ // will be stripped from the beginning of each line other than the first.
+ // Newlines are included in the output.
+ //
+ // Examples:
+ //
+ // optional int32 foo = 1; // Comment attached to foo.
+ // // Comment attached to bar.
+ // optional int32 bar = 2;
+ //
+ // optional string baz = 3;
+ // // Comment attached to baz.
+ // // Another line attached to baz.
+ //
+ // // Comment attached to qux.
+ // //
+ // // Another line attached to qux.
+ // optional double qux = 4;
+ //
+ // // Detached comment for corge. This is not leading or trailing comments
+ // // to qux or corge because there are blank lines separating it from
+ // // both.
+ //
+ // // Detached comment for corge paragraph 2.
+ //
+ // optional string corge = 5;
+ // /* Block comment attached
+ // * to corge. Leading asterisks
+ // * will be removed. */
+ // /* Block comment attached to
+ // * grault. */
+ // optional int32 grault = 6;
+ //
+ // // ignored detached comments.
+ optional string leading_comments = 3;
+ optional string trailing_comments = 4;
+ repeated string leading_detached_comments = 6;
+ }
+}
+
+// Describes the relationship between generated code and its original source
+// file. A GeneratedCodeInfo message is associated with only one generated
+// source file, but may contain references to different source .proto files.
+message GeneratedCodeInfo {
+ // An Annotation connects some span of text in generated code to an element
+ // of its generating .proto file.
+ repeated Annotation annotation = 1;
+ message Annotation {
+ // Identifies the element in the original source .proto file. This field
+ // is formatted the same as SourceCodeInfo.Location.path.
+ repeated int32 path = 1 [packed=true];
+
+ // Identifies the filesystem path to the original source .proto.
+ optional string source_file = 2;
+
+ // Identifies the starting offset in bytes in the generated code
+ // that relates to the identified object.
+ optional int32 begin = 3;
+
+ // Identifies the ending offset in bytes in the generated code that
+ // relates to the identified offset. The end offset should be one past
+ // the last relevant byte (so the length of the text = end - begin).
+ optional int32 end = 4;
+ }
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database.cc b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database.cc
index ba85ef13aa..ba85ef13aa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database.h b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database.h
index d61f2a6a42..28f8af7a2d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database.h
@@ -214,7 +214,7 @@ class LIBPROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase {
// will find it. Proof:
// 1) Define the "search key" to be the key we are looking for, the "found
// key" to be the key found in step (1), and the "match key" to be the
- // key which actually matches the search key (i.e. the key we're trying
+ // key which actually matches the serach key (i.e. the key we're trying
// to find).
// 2) The found key must be less than or equal to the search key by
// definition.
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database_unittest.cc
index 083ef8f294..7e81d70af2 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor_database_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor_database_unittest.cc
@@ -36,10 +36,13 @@
#include <algorithm>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
-#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor_database.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/text_format.h>
#include <google/protobuf/stubs/logging.h>
@@ -176,7 +179,7 @@ class DescriptorDatabaseTest
EXPECT_FALSE(test_case_->AddToDatabase(file_proto));
}
- std::unique_ptr<DescriptorDatabaseTestCase> test_case_;
+ google::protobuf::scoped_ptr<DescriptorDatabaseTestCase> test_case_;
DescriptorDatabase* database_;
};
@@ -244,10 +247,6 @@ TEST_P(DescriptorDatabaseTest, FindFileContainingSymbol) {
FileDescriptorProto file;
EXPECT_TRUE(database_->FindFileContainingSymbol("Foo.qux", &file));
EXPECT_EQ("foo.proto", file.name());
- // Non-existent field under a valid top level symbol can also be
- // found.
- EXPECT_TRUE(database_->FindFileContainingSymbol("Foo.none_field.none",
- &file));
}
{
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor_unittest.cc
index 54da095a6b..7523893117 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/descriptor_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/descriptor_unittest.cc
@@ -34,8 +34,10 @@
//
// This file makes extensive use of RFC 3092. :)
-#include <limits>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/compiler/importer.h>
@@ -60,7 +62,6 @@
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
-
namespace google {
namespace protobuf {
@@ -156,14 +157,6 @@ DescriptorProto::ReservedRange* AddReservedRange(DescriptorProto* parent,
return result;
}
-EnumDescriptorProto::EnumReservedRange* AddReservedRange(
- EnumDescriptorProto* parent, int start, int end) {
- EnumDescriptorProto::EnumReservedRange* result = parent->add_reserved_range();
- result->set_start(start);
- result->set_end(end);
- return result;
-}
-
EnumValueDescriptorProto* AddEnumValue(EnumDescriptorProto* enum_proto,
const string& name, int number) {
EnumValueDescriptorProto* result = enum_proto->add_value();
@@ -428,7 +421,6 @@ 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.
@@ -971,7 +963,6 @@ TEST_F(DescriptorTest, FieldEnumType) {
EXPECT_EQ(enum_, bar_->enum_type());
}
-
// ===================================================================
// Test simple flat messages and fields.
@@ -1942,7 +1933,6 @@ TEST_F(ExtensionDescriptorTest, FindAllExtensions) {
EXPECT_EQ(39, extensions[3]->number());
}
-
TEST_F(ExtensionDescriptorTest, DuplicateFieldNumber) {
DescriptorPool pool;
FileDescriptorProto file_proto;
@@ -2057,137 +2047,6 @@ TEST_F(ReservedDescriptorTest, IsReservedName) {
// ===================================================================
-// Test reserved enum fields.
-class ReservedEnumDescriptorTest : public testing::Test {
- protected:
- virtual void SetUp() {
- // Build descriptors for the following definitions:
- //
- // enum Foo {
- // BAR = 1;
- // reserved 2, 9 to 11, 15;
- // reserved "foo", "bar";
- // }
-
- FileDescriptorProto foo_file;
- foo_file.set_name("foo.proto");
-
- EnumDescriptorProto* foo = AddEnum(&foo_file, "Foo");
- EnumDescriptorProto* edge1 = AddEnum(&foo_file, "Edge1");
- EnumDescriptorProto* edge2 = AddEnum(&foo_file, "Edge2");
-
- AddEnumValue(foo, "BAR", 4);
- AddReservedRange(foo, -5, -3);
- AddReservedRange(foo, -2, 1);
- AddReservedRange(foo, 2, 3);
- AddReservedRange(foo, 9, 12);
- AddReservedRange(foo, 15, 16);
-
- foo->add_reserved_name("foo");
- foo->add_reserved_name("bar");
-
- // Some additional edge cases that cover most or all of the range of enum
- // values
-
- // Note: We use INT_MAX as the maximum reserved range upper bound,
- // inclusive.
- AddEnumValue(edge1, "EDGE1", 1);
- AddReservedRange(edge1, 10, INT_MAX);
- AddEnumValue(edge2, "EDGE2", 15);
- AddReservedRange(edge2, INT_MIN, 10);
-
- // Build the descriptors and get the pointers.
- foo_file_ = pool_.BuildFile(foo_file);
- ASSERT_TRUE(foo_file_ != NULL);
-
- ASSERT_EQ(3, foo_file_->enum_type_count());
- foo_ = foo_file_->enum_type(0);
- edge1_ = foo_file_->enum_type(1);
- edge2_ = foo_file_->enum_type(2);
- }
-
- DescriptorPool pool_;
- const FileDescriptor* foo_file_;
- const EnumDescriptor* foo_;
- const EnumDescriptor* edge1_;
- const EnumDescriptor* edge2_;
-};
-
-TEST_F(ReservedEnumDescriptorTest, ReservedRanges) {
- ASSERT_EQ(5, foo_->reserved_range_count());
-
- EXPECT_EQ(-5, foo_->reserved_range(0)->start);
- EXPECT_EQ(-3, foo_->reserved_range(0)->end);
-
- EXPECT_EQ(-2, foo_->reserved_range(1)->start);
- EXPECT_EQ(1, foo_->reserved_range(1)->end);
-
- EXPECT_EQ(2, foo_->reserved_range(2)->start);
- EXPECT_EQ(3, foo_->reserved_range(2)->end);
-
- EXPECT_EQ(9, foo_->reserved_range(3)->start);
- EXPECT_EQ(12, foo_->reserved_range(3)->end);
-
- EXPECT_EQ(15, foo_->reserved_range(4)->start);
- EXPECT_EQ(16, foo_->reserved_range(4)->end);
-
- ASSERT_EQ(1, edge1_->reserved_range_count());
- EXPECT_EQ(10, edge1_->reserved_range(0)->start);
- EXPECT_EQ(INT_MAX, edge1_->reserved_range(0)->end);
-
- ASSERT_EQ(1, edge2_->reserved_range_count());
- EXPECT_EQ(INT_MIN, edge2_->reserved_range(0)->start);
- EXPECT_EQ(10, edge2_->reserved_range(0)->end);
-}
-
-TEST_F(ReservedEnumDescriptorTest, IsReservedNumber) {
- EXPECT_TRUE(foo_->IsReservedNumber(-5));
- EXPECT_TRUE(foo_->IsReservedNumber(-4));
- EXPECT_TRUE(foo_->IsReservedNumber(-3));
- EXPECT_TRUE(foo_->IsReservedNumber(-2));
- EXPECT_TRUE(foo_->IsReservedNumber(-1));
- EXPECT_TRUE(foo_->IsReservedNumber(0));
- EXPECT_TRUE(foo_->IsReservedNumber(1));
- EXPECT_TRUE (foo_->IsReservedNumber(2));
- EXPECT_TRUE(foo_->IsReservedNumber(3));
- EXPECT_FALSE(foo_->IsReservedNumber(8));
- EXPECT_TRUE (foo_->IsReservedNumber(9));
- EXPECT_TRUE (foo_->IsReservedNumber(10));
- EXPECT_TRUE (foo_->IsReservedNumber(11));
- EXPECT_TRUE(foo_->IsReservedNumber(12));
- EXPECT_FALSE(foo_->IsReservedNumber(13));
- EXPECT_FALSE(foo_->IsReservedNumber(13));
- EXPECT_FALSE(foo_->IsReservedNumber(14));
- EXPECT_TRUE (foo_->IsReservedNumber(15));
- EXPECT_TRUE(foo_->IsReservedNumber(16));
- EXPECT_FALSE(foo_->IsReservedNumber(17));
-
- EXPECT_FALSE(edge1_->IsReservedNumber(9));
- EXPECT_TRUE(edge1_->IsReservedNumber(10));
- EXPECT_TRUE(edge1_->IsReservedNumber(INT_MAX - 1));
- EXPECT_TRUE(edge1_->IsReservedNumber(INT_MAX));
-
- EXPECT_TRUE(edge2_->IsReservedNumber(INT_MIN));
- EXPECT_TRUE(edge2_->IsReservedNumber(9));
- EXPECT_TRUE(edge2_->IsReservedNumber(10));
- EXPECT_FALSE(edge2_->IsReservedNumber(11));
-}
-
-TEST_F(ReservedEnumDescriptorTest, ReservedNames) {
- ASSERT_EQ(2, foo_->reserved_name_count());
-
- EXPECT_EQ("foo", foo_->reserved_name(0));
- EXPECT_EQ("bar", foo_->reserved_name(1));
-}
-
-TEST_F(ReservedEnumDescriptorTest, IsReservedName) {
- EXPECT_TRUE (foo_->IsReservedName("foo"));
- EXPECT_TRUE (foo_->IsReservedName("bar"));
- EXPECT_FALSE(foo_->IsReservedName("baz"));
-}
-
-// ===================================================================
-
class MiscTest : public testing::Test {
protected:
// Function which makes a field descriptor of the given type.
@@ -2249,7 +2108,7 @@ class MiscTest : public testing::Test {
return field != NULL ? field->enum_type() : NULL;
}
- std::unique_ptr<DescriptorPool> pool_;
+ google::protobuf::scoped_ptr<DescriptorPool> pool_;
};
TEST_F(MiscTest, TypeNames) {
@@ -2679,7 +2538,7 @@ class AllowUnknownDependenciesTest
const FieldDescriptor* qux_field_;
SimpleDescriptorDatabase db_; // used if in FALLBACK_DATABASE mode.
- std::unique_ptr<DescriptorPool> pool_;
+ google::protobuf::scoped_ptr<DescriptorPool> pool_;
};
TEST_P(AllowUnknownDependenciesTest, PlaceholderFile) {
@@ -3915,166 +3774,6 @@ TEST_F(ValidationErrorTest, ReservedFieldsDebugString) {
file->DebugString());
}
-TEST_F(ValidationErrorTest, EnumReservedFieldError) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"BAR\" number:15 }"
- " reserved_range { start: 10 end: 20 }"
- "}",
-
- "foo.proto: BAR: NUMBER: Enum value \"BAR\" uses reserved number 15.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumNegativeReservedFieldError) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"BAR\" number:-15 }"
- " reserved_range { start: -20 end: -10 }"
- "}",
-
- "foo.proto: BAR: NUMBER: Enum value \"BAR\" uses reserved number -15.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumReservedRangeOverlap) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"BAR\" number:0 }"
- " reserved_range { start: 10 end: 20 }"
- " reserved_range { start: 5 end: 15 }"
- "}",
-
- "foo.proto: Foo: NUMBER: Reserved range 5 to 15"
- " overlaps with already-defined range 10 to 20.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumReservedRangeOverlapByOne) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"BAR\" number:0 }"
- " reserved_range { start: 10 end: 20 }"
- " reserved_range { start: 5 end: 10 }"
- "}",
-
- "foo.proto: Foo: NUMBER: Reserved range 5 to 10"
- " overlaps with already-defined range 10 to 20.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumNegativeReservedRangeOverlap) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"BAR\" number:0 }"
- " reserved_range { start: -20 end: -10 }"
- " reserved_range { start: -15 end: -5 }"
- "}",
-
- "foo.proto: Foo: NUMBER: Reserved range -15 to -5"
- " overlaps with already-defined range -20 to -10.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumMixedReservedRangeOverlap) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"BAR\" number:20 }"
- " reserved_range { start: -20 end: 10 }"
- " reserved_range { start: -15 end: 5 }"
- "}",
-
- "foo.proto: Foo: NUMBER: Reserved range -15 to 5"
- " overlaps with already-defined range -20 to 10.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumMixedReservedRangeOverlap2) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"BAR\" number:20 }"
- " reserved_range { start: -20 end: 10 }"
- " reserved_range { start: 10 end: 10 }"
- "}",
-
- "foo.proto: Foo: NUMBER: Reserved range 10 to 10"
- " overlaps with already-defined range -20 to 10.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumReservedRangeStartGreaterThanEnd) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"BAR\" number:20 }"
- " reserved_range { start: 11 end: 10 }"
- "}",
-
- "foo.proto: Foo: NUMBER: Reserved range end number must be greater"
- " than start number.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumReservedNameError) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"FOO\" number:15 }"
- " value { name:\"BAR\" number:15 }"
- " reserved_name: \"FOO\""
- " reserved_name: \"BAR\""
- "}",
-
- "foo.proto: FOO: NAME: Enum value \"FOO\" is reserved.\n"
- "foo.proto: BAR: NAME: Enum value \"BAR\" is reserved.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumReservedNameRedundant) {
- BuildFileWithErrors(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"FOO\" number:15 }"
- " reserved_name: \"foo\""
- " reserved_name: \"foo\""
- "}",
-
- "foo.proto: foo: NAME: Enum value \"foo\" is reserved multiple times.\n");
-}
-
-TEST_F(ValidationErrorTest, EnumReservedFieldsDebugString) {
- const FileDescriptor* file = BuildFile(
- "name: \"foo.proto\" "
- "enum_type {"
- " name: \"Foo\""
- " value { name:\"FOO\" number:3 }"
- " reserved_name: \"foo\""
- " reserved_name: \"bar\""
- " reserved_range { start: -6 end: -6 }"
- " reserved_range { start: -5 end: -4 }"
- " reserved_range { start: -1 end: 1 }"
- " reserved_range { start: 5 end: 5 }"
- " reserved_range { start: 10 end: 19 }"
- "}");
-
- ASSERT_EQ(
- "syntax = \"proto2\";\n\n"
- "enum Foo {\n"
- " FOO = 3;\n"
- " reserved -6, -5 to -4, -1 to 1, 5, 10 to 19;\n"
- " reserved \"foo\", \"bar\";\n"
- "}\n\n",
- file->DebugString());
-}
-
TEST_F(ValidationErrorTest, InvalidDefaults) {
BuildFileWithErrors(
"name: \"foo.proto\" "
@@ -6918,95 +6617,40 @@ class SingletonSourceTree : public compiler::SourceTree {
const char *const kSourceLocationTestInput =
"syntax = \"proto2\";\n"
- "option java_package = \"com.foo.bar\";\n"
- "option (test_file_opt) = \"foobar\";\n"
"message A {\n"
- " option (test_msg_opt) = \"foobar\";\n"
- " optional int32 a = 1 [deprecated = true];\n"
+ " optional int32 a = 1;\n"
" message B {\n"
- " required double b = 1 [(test_field_opt) = \"foobar\"];\n"
- " }\n"
- " oneof c {\n"
- " option (test_oneof_opt) = \"foobar\";\n"
- " string d = 2;\n"
- " string e = 3;\n"
- " string f = 4;\n"
+ " required double b = 1;\n"
" }\n"
"}\n"
"enum Indecision {\n"
- " option (test_enum_opt) = 21;\n"
- " option (test_enum_opt) = 42;\n"
- " option (test_enum_opt) = 63;\n"
- " YES = 1 [(test_enumval_opt).a = 100];\n"
- " NO = 2 [(test_enumval_opt) = {a:200}];\n"
+ " YES = 1;\n"
+ " NO = 2;\n"
" MAYBE = 3;\n"
"}\n"
"service S {\n"
- " option (test_svc_opt) = {a:100};\n"
- " option (test_svc_opt) = {a:200};\n"
- " option (test_svc_opt) = {a:300};\n"
" rpc Method(A) returns (A.B);\n"
// Put an empty line here to make the source location range match.
"\n"
- " rpc OtherMethod(A) returns (A) {\n"
- " option deprecated = true;\n"
- " option (test_method_opt) = \"foobar\";\n"
- " }\n"
"}\n"
"message MessageWithExtensions {\n"
- " extensions 1000 to 2000, 2001 to max [(test_ext_opt) = \"foobar\"];\n"
+ " extensions 1000 to max;\n"
"}\n"
"extend MessageWithExtensions {\n"
- " repeated int32 int32_extension = 1001 [packed=true];\n"
+ " optional int32 int32_extension = 1001;\n"
"}\n"
"message C {\n"
" extend MessageWithExtensions {\n"
" optional C message_extension = 1002;\n"
" }\n"
- "}\n"
- "import \"google/protobuf/descriptor.proto\";\n"
- "extend google.protobuf.FileOptions {\n"
- " optional string test_file_opt = 10101;\n"
- "}\n"
- "extend google.protobuf.MessageOptions {\n"
- " optional string test_msg_opt = 10101;\n"
- "}\n"
- "extend google.protobuf.FieldOptions {\n"
- " optional string test_field_opt = 10101;\n"
- "}\n"
- "extend google.protobuf.EnumOptions {\n"
- " repeated int32 test_enum_opt = 10101;\n"
- "}\n"
- "extend google.protobuf.EnumValueOptions {\n"
- " optional A test_enumval_opt = 10101;\n"
- "}\n"
- "extend google.protobuf.ServiceOptions {\n"
- " repeated A test_svc_opt = 10101;\n"
- "}\n"
- "extend google.protobuf.MethodOptions {\n"
- " optional string test_method_opt = 10101;\n"
- "}\n"
- "extend google.protobuf.OneofOptions {\n"
- " optional string test_oneof_opt = 10101;\n"
- "}\n"
- "extend google.protobuf.ExtensionRangeOptions {\n"
- " optional string test_ext_opt = 10101;\n"
- "}\n"
- ;
+ "}\n";
class SourceLocationTest : public testing::Test {
public:
SourceLocationTest()
: source_tree_("/test/test.proto", kSourceLocationTestInput),
- simple_db_(),
- source_tree_db_(&source_tree_),
- merged_db_(&simple_db_, &source_tree_db_),
- pool_(&merged_db_, &collector_) {
- // we need descriptor.proto to be accessible by the pool
- // since our test file imports it
- FileDescriptorProto::descriptor()->file()->CopyTo(&file_proto_);
- simple_db_.Add(file_proto_);
- }
+ db_(&source_tree_),
+ pool_(&db_, &collector_) {}
static string PrintSourceLocation(const SourceLocation &loc) {
return strings::Substitute("$0:$1-$2:$3",
@@ -7017,20 +6661,12 @@ class SourceLocationTest : public testing::Test {
}
private:
- FileDescriptorProto file_proto_;
AbortingErrorCollector collector_;
SingletonSourceTree source_tree_;
- SimpleDescriptorDatabase simple_db_; // contains descriptor.proto
- compiler::SourceTreeDescriptorDatabase source_tree_db_; // loads test.proto
- MergedDescriptorDatabase merged_db_; // combines above two dbs
+ compiler::SourceTreeDescriptorDatabase db_;
protected:
DescriptorPool pool_;
-
- // tag number of all custom options in above test file
- static const int kCustomOptionFieldNumber = 10101;
- // tag number of field "a" in message type "A" in above test file
- static const int kA_aFieldNumber = 1;
};
// TODO(adonovan): implement support for option fields and for
@@ -7044,27 +6680,27 @@ TEST_F(SourceLocationTest, GetSourceLocation) {
const Descriptor *a_desc = file_desc->FindMessageTypeByName("A");
EXPECT_TRUE(a_desc->GetSourceLocation(&loc));
- EXPECT_EQ("4:1-16:2", PrintSourceLocation(loc));
+ EXPECT_EQ("2:1-7:2", PrintSourceLocation(loc));
const Descriptor *a_b_desc = a_desc->FindNestedTypeByName("B");
EXPECT_TRUE(a_b_desc->GetSourceLocation(&loc));
- EXPECT_EQ("7:3-9:4", PrintSourceLocation(loc));
+ EXPECT_EQ("4:3-6:4", PrintSourceLocation(loc));
const EnumDescriptor *e_desc = file_desc->FindEnumTypeByName("Indecision");
EXPECT_TRUE(e_desc->GetSourceLocation(&loc));
- EXPECT_EQ("17:1-24:2", PrintSourceLocation(loc));
+ EXPECT_EQ("8:1-12:2", PrintSourceLocation(loc));
const EnumValueDescriptor *yes_desc = e_desc->FindValueByName("YES");
EXPECT_TRUE(yes_desc->GetSourceLocation(&loc));
- EXPECT_EQ("21:3-21:42", PrintSourceLocation(loc));
+ EXPECT_EQ("9:3-9:13", PrintSourceLocation(loc));
const ServiceDescriptor *s_desc = file_desc->FindServiceByName("S");
EXPECT_TRUE(s_desc->GetSourceLocation(&loc));
- EXPECT_EQ("25:1-35:2", PrintSourceLocation(loc));
+ EXPECT_EQ("13:1-16:2", PrintSourceLocation(loc));
const MethodDescriptor *m_desc = s_desc->FindMethodByName("Method");
EXPECT_TRUE(m_desc->GetSourceLocation(&loc));
- EXPECT_EQ("29:3-29:31", PrintSourceLocation(loc));
+ EXPECT_EQ("14:3-14:31", PrintSourceLocation(loc));
}
@@ -7077,426 +6713,16 @@ TEST_F(SourceLocationTest, ExtensionSourceLocation) {
const FieldDescriptor *int32_extension_desc =
file_desc->FindExtensionByName("int32_extension");
EXPECT_TRUE(int32_extension_desc->GetSourceLocation(&loc));
- EXPECT_EQ("40:3-40:55", PrintSourceLocation(loc));
+ EXPECT_EQ("21:3-21:41", PrintSourceLocation(loc));
const Descriptor *c_desc = file_desc->FindMessageTypeByName("C");
EXPECT_TRUE(c_desc->GetSourceLocation(&loc));
- EXPECT_EQ("42:1-46:2", PrintSourceLocation(loc));
+ EXPECT_EQ("23:1-27:2", PrintSourceLocation(loc));
const FieldDescriptor *message_extension_desc =
c_desc->FindExtensionByName("message_extension");
EXPECT_TRUE(message_extension_desc->GetSourceLocation(&loc));
- EXPECT_EQ("44:5-44:41", PrintSourceLocation(loc));
-}
-
-TEST_F(SourceLocationTest, InterpretedOptionSourceLocation) {
- // This one's a doozy. It checks every kind of option, including
- // extension range options.
-
- // We are verifying that the file's source info contains correct
- // info for interpreted options and that it does *not* contain
- // any info for corresponding uninterpreted option path.
-
- SourceLocation loc;
-
- const FileDescriptor *file_desc =
- GOOGLE_CHECK_NOTNULL(pool_.FindFileByName("/test/test.proto"));
-
- // File options
- {
- int path[] = {FileDescriptorProto::kOptionsFieldNumber,
- FileOptions::kJavaPackageFieldNumber};
- int unint[] = {FileDescriptorProto::kOptionsFieldNumber,
- FileOptions::kUninterpretedOptionFieldNumber,
- 0};
-
- std::vector<int> vpath(path, path + 2);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("2:1-2:37", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 3);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
- {
- int path[] = {FileDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber};
- int unint[] = {FileDescriptorProto::kOptionsFieldNumber,
- FileOptions::kUninterpretedOptionFieldNumber,
- 1};
- std::vector<int> vpath(path, path + 2);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("3:1-3:35", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 3);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Message option
- {
- int path[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 0,
- DescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber};
- int unint[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 0,
- DescriptorProto::kOptionsFieldNumber,
- MessageOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 4);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("5:3-5:36", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 5);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Field option
- {
- int path[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 0,
- DescriptorProto::kFieldFieldNumber,
- 0,
- FieldDescriptorProto::kOptionsFieldNumber,
- FieldOptions::kDeprecatedFieldNumber};
- int unint[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 0,
- DescriptorProto::kFieldFieldNumber,
- 0,
- FieldDescriptorProto::kOptionsFieldNumber,
- FieldOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 6);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("6:25-6:42", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 7);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Nested message option
- {
- int path[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 0,
- DescriptorProto::kNestedTypeFieldNumber,
- 0,
- DescriptorProto::kFieldFieldNumber,
- 0,
- FieldDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber};
- int unint[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 0,
- DescriptorProto::kNestedTypeFieldNumber,
- 0,
- DescriptorProto::kFieldFieldNumber,
- 0,
- FieldDescriptorProto::kOptionsFieldNumber,
- FieldOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 8);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("8:28-8:55", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 9);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // One-of option
- {
- int path[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 0,
- DescriptorProto::kOneofDeclFieldNumber,
- 0,
- OneofDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber};
- int unint[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 0,
- DescriptorProto::kOneofDeclFieldNumber,
- 0,
- OneofDescriptorProto::kOptionsFieldNumber,
- OneofOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 6);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("11:5-11:40", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 7);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Enum option, repeated options
- {
- int path[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber,
- 0};
- int unint[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kOptionsFieldNumber,
- EnumOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 5);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("18:3-18:31", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 5);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
- {
- int path[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber,
- 1};
- int unint[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kOptionsFieldNumber,
- EnumOptions::kUninterpretedOptionFieldNumber,
- 1};
- std::vector<int> vpath(path, path + 5);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("19:3-19:31", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 5);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
- {
- int path[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber,
- 2};
- int unint[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kOptionsFieldNumber,
- OneofOptions::kUninterpretedOptionFieldNumber,
- 2};
- std::vector<int> vpath(path, path + 5);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("20:3-20:31", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 5);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Enum value options
- {
- // option w/ message type that directly sets field
- int path[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kValueFieldNumber,
- 0,
- EnumValueDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber,
- kA_aFieldNumber};
- int unint[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kValueFieldNumber,
- 0,
- EnumValueDescriptorProto::kOptionsFieldNumber,
- EnumValueOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 7);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("21:14-21:40", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 7);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
- {
- int path[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kValueFieldNumber,
- 1,
- EnumValueDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber};
- int unint[] = {FileDescriptorProto::kEnumTypeFieldNumber,
- 0,
- EnumDescriptorProto::kValueFieldNumber,
- 1,
- EnumValueDescriptorProto::kOptionsFieldNumber,
- EnumValueOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 6);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("22:14-22:42", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 7);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Service option, repeated options
- {
- int path[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber,
- 0};
- int unint[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kOptionsFieldNumber,
- ServiceOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 5);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("26:3-26:35", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 5);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
- {
- int path[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber,
- 1};
- int unint[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kOptionsFieldNumber,
- ServiceOptions::kUninterpretedOptionFieldNumber,
- 1};
- std::vector<int> vpath(path, path + 5);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("27:3-27:35", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 5);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
- {
- int path[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber,
- 2};
- int unint[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kOptionsFieldNumber,
- ServiceOptions::kUninterpretedOptionFieldNumber,
- 2};
- std::vector<int> vpath(path, path + 5);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("28:3-28:35", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 5);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Method options
- {
- int path[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kMethodFieldNumber,
- 1,
- MethodDescriptorProto::kOptionsFieldNumber,
- MethodOptions::kDeprecatedFieldNumber};
- int unint[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kMethodFieldNumber,
- 1,
- MethodDescriptorProto::kOptionsFieldNumber,
- MethodOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 6);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("32:5-32:30", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 7);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
- {
- int path[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kMethodFieldNumber,
- 1,
- MethodDescriptorProto::kOptionsFieldNumber,
- kCustomOptionFieldNumber};
- int unint[] = {FileDescriptorProto::kServiceFieldNumber,
- 0,
- ServiceDescriptorProto::kMethodFieldNumber,
- 1,
- MethodDescriptorProto::kOptionsFieldNumber,
- MethodOptions::kUninterpretedOptionFieldNumber,
- 1};
- std::vector<int> vpath(path, path + 6);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("33:5-33:41", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 7);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Extension range options
- {
- int path[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 1,
- DescriptorProto::kExtensionRangeFieldNumber,
- 0,
- DescriptorProto_ExtensionRange::kOptionsFieldNumber};
- std::vector<int> vpath(path, path + 5);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("37:40-37:67", PrintSourceLocation(loc));
- }
- {
- int path[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 1,
- DescriptorProto::kExtensionRangeFieldNumber,
- 0,
- DescriptorProto_ExtensionRange::kOptionsFieldNumber,
- kCustomOptionFieldNumber};
- int unint[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 1,
- DescriptorProto::kExtensionRangeFieldNumber,
- 0,
- DescriptorProto_ExtensionRange::kOptionsFieldNumber,
- ExtensionRangeOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 6);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("37:41-37:66", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 7);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
- {
- int path[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 1,
- DescriptorProto::kExtensionRangeFieldNumber,
- 1,
- DescriptorProto_ExtensionRange::kOptionsFieldNumber,
- kCustomOptionFieldNumber};
- int unint[] = {FileDescriptorProto::kMessageTypeFieldNumber,
- 1,
- DescriptorProto::kExtensionRangeFieldNumber,
- 1,
- DescriptorProto_ExtensionRange::kOptionsFieldNumber,
- ExtensionRangeOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 6);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("37:41-37:66", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 7);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
-
- // Field option on extension
- {
- int path[] = {FileDescriptorProto::kExtensionFieldNumber,
- 0,
- FieldDescriptorProto::kOptionsFieldNumber,
- FieldOptions::kPackedFieldNumber};
- int unint[] = {FileDescriptorProto::kExtensionFieldNumber,
- 0,
- FieldDescriptorProto::kOptionsFieldNumber,
- FieldOptions::kUninterpretedOptionFieldNumber,
- 0};
- std::vector<int> vpath(path, path + 4);
- EXPECT_TRUE(file_desc->GetSourceLocation(vpath, &loc));
- EXPECT_EQ("40:42-40:53", PrintSourceLocation(loc));
-
- std::vector<int> vunint(unint, unint + 5);
- EXPECT_FALSE(file_desc->GetSourceLocation(vunint, &loc));
- }
+ EXPECT_EQ("25:5-25:41", PrintSourceLocation(loc));
}
// Missing SourceCodeInfo doesn't cause crash:
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/drop_unknown_fields_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/drop_unknown_fields_test.cc
index 437a04e773..f2f2f749e0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/drop_unknown_fields_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/drop_unknown_fields_test.cc
@@ -29,6 +29,9 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/unittest_drop_unknown_fields.pb.h>
#include <google/protobuf/dynamic_message.h>
@@ -91,7 +94,7 @@ TEST(DropUnknownFieldsTest, DynamicMessageDefaultDrop) {
foo_with_extra_fields.set_extra_int32_value(2);
google::protobuf::DynamicMessageFactory factory;
- std::unique_ptr<google::protobuf::Message> foo(
+ google::protobuf::scoped_ptr<google::protobuf::Message> foo(
factory.GetPrototype(Foo::descriptor())->New());
ASSERT_TRUE(foo->ParseFromString(foo_with_extra_fields.SerializeAsString()));
EXPECT_TRUE(foo->GetReflection()->GetUnknownFields(*foo).empty());
@@ -111,7 +114,7 @@ TEST(DropUnknownFieldsTest, DynamicMessageDefaultPreserve) {
foo_with_extra_fields.set_extra_int32_value(2);
google::protobuf::DynamicMessageFactory factory;
- std::unique_ptr<google::protobuf::Message> foo(
+ google::protobuf::scoped_ptr<google::protobuf::Message> foo(
factory.GetPrototype(Foo::descriptor())->New());
ASSERT_TRUE(foo->ParseFromString(foo_with_extra_fields.SerializeAsString()));
EXPECT_FALSE(foo->GetReflection()->GetUnknownFields(*foo).empty());
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/duration.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/duration.pb.cc
index ddc063db12..ad0eeb45da 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/duration.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/duration.pb.cc
@@ -1,92 +1,108 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/duration.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/duration.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
class DurationDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Duration>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Duration>
+ _instance;
} _Duration_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2fduration_2eproto {
-static void InitDefaultsDuration() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::_Duration_default_instance_;
- new (ptr) ::google::protobuf::Duration();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Duration::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2fduration_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Duration =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsDuration}, {}};
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_Duration.base);
-}
+namespace {
::google::protobuf::Metadata file_level_metadata[1];
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+} // namespace
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Duration, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Duration, seconds_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Duration, nanos_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, seconds_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, nanos_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::Duration)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(Duration)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Duration_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Duration_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/duration.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/duration.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _Duration_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Duration_default_instance_);}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\036google/protobuf/duration.proto\022\017google"
".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r"
"\n\005nanos\030\002 \001(\005B|\n\023com.google.protobufB\rDu"
@@ -99,10 +115,11 @@ void AddDescriptorsImpl() {
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/duration.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -110,14 +127,12 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fduration_2eproto
-namespace google {
-namespace protobuf {
+
// ===================================================================
-void Duration::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Duration::kSecondsFieldNumber;
const int Duration::kNanosFieldNumber;
@@ -125,22 +140,24 @@ const int Duration::kNanosFieldNumber;
Duration::Duration()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fduration_2eproto::scc_info_Duration.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Duration)
}
Duration::Duration(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fduration_2eproto::scc_info_Duration.base);
+ protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Duration)
}
Duration::Duration(const Duration& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&seconds_, &from.seconds_,
static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -
@@ -152,6 +169,7 @@ void Duration::SharedCtor() {
::memset(&seconds_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&nanos_) -
reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
+ _cached_size_ = 0;
}
Duration::~Duration() {
@@ -160,7 +178,12 @@ Duration::~Duration() {
}
void Duration::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void Duration::ArenaDtor(void* object) {
@@ -170,18 +193,23 @@ void Duration::ArenaDtor(void* object) {
void Duration::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Duration::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Duration::descriptor() {
- ::protobuf_google_2fprotobuf_2fduration_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fduration_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fduration_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fduration_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Duration& Duration::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fduration_2eproto::scc_info_Duration.base);
+ protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaults();
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)
@@ -201,7 +229,7 @@ bool Duration::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Duration)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -325,7 +353,9 @@ size_t Duration::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -401,22 +431,49 @@ void Duration::InternalSwap(Duration* other) {
swap(seconds_, other->seconds_);
swap(nanos_, other->nanos_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Duration::GetMetadata() const {
protobuf_google_2fprotobuf_2fduration_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fduration_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fduration_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Duration
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Duration* Arena::CreateMaybeMessage< ::google::protobuf::Duration >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Duration >(arena);
+// int64 seconds = 1;
+void Duration::clear_seconds() {
+ seconds_ = GOOGLE_LONGLONG(0);
+}
+::google::protobuf::int64 Duration::seconds() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds)
+ return seconds_;
+}
+void Duration::set_seconds(::google::protobuf::int64 value) {
+
+ seconds_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds)
+}
+
+// int32 nanos = 2;
+void Duration::clear_nanos() {
+ nanos_ = 0;
+}
+::google::protobuf::int32 Duration::nanos() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos)
+ return nanos_;
}
+void Duration::set_nanos(::google::protobuf::int32 value) {
+
+ nanos_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/duration.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/duration.pb.h
index 751edbefc1..bed112b507 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/duration.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/duration.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/duration.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fduration_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fduration_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,41 +24,37 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fduration_2eproto LIBPROTOBUF_EXPORT
+namespace google {
+namespace protobuf {
+class Duration;
+class DurationDefaultTypeInternal;
+LIBPROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_;
+} // namespace protobuf
+} // namespace google
+
+namespace google {
+namespace protobuf {
namespace protobuf_google_2fprotobuf_2fduration_2eproto {
-// Internal implementation detail -- do not use these members.
+// Internal implementation detail -- do not call these.
struct LIBPROTOBUF_EXPORT TableStruct {
static const ::google::protobuf::internal::ParseTableField entries[];
static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[1];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
+ static void InitDefaultsImpl();
};
void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
} // namespace protobuf_google_2fprotobuf_2fduration_2eproto
-namespace google {
-namespace protobuf {
-class Duration;
-class DurationDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Duration* Arena::CreateMaybeMessage<::google::protobuf::Duration>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
// ===================================================================
@@ -88,21 +84,20 @@ class LIBPROTOBUF_EXPORT Duration : public ::google::protobuf::Message /* @@prot
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Duration& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Duration* internal_default_instance() {
return reinterpret_cast<const Duration*>(
&_Duration_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void UnsafeArenaSwap(Duration* other);
@@ -113,33 +108,28 @@ class LIBPROTOBUF_EXPORT Duration : public ::google::protobuf::Message /* @@prot
// implements Message ----------------------------------------------
- inline Duration* New() const final {
- return CreateMaybeMessage<Duration>(NULL);
- }
+ inline Duration* New() const PROTOBUF_FINAL { return New(NULL); }
- Duration* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Duration>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Duration* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Duration& from);
void MergeFrom(const Duration& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Duration* other);
protected:
explicit Duration(::google::protobuf::Arena* arena);
@@ -155,7 +145,7 @@ class LIBPROTOBUF_EXPORT Duration : public ::google::protobuf::Message /* @@prot
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -182,14 +172,15 @@ class LIBPROTOBUF_EXPORT Duration : public ::google::protobuf::Message /* @@prot
typedef void DestructorSkippable_;
::google::protobuf::int64 seconds_;
::google::protobuf::int32 nanos_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fduration_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fduration_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -227,12 +218,14 @@ inline void Duration::set_nanos(::google::protobuf::int32 value) {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fduration_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/duration.proto b/third_party/protobuf/3.4.0/src/google/protobuf/duration.proto
new file mode 100644
index 0000000000..975fce41aa
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/duration.proto
@@ -0,0 +1,117 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option cc_enable_arenas = true;
+option go_package = "github.com/golang/protobuf/ptypes/duration";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "DurationProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+
+// A Duration represents a signed, fixed-length span of time represented
+// as a count of seconds and fractions of seconds at nanosecond
+// resolution. It is independent of any calendar and concepts like "day"
+// or "month". It is related to Timestamp in that the difference between
+// two Timestamp values is a Duration and it can be added or subtracted
+// from a Timestamp. Range is approximately +-10,000 years.
+//
+// # Examples
+//
+// Example 1: Compute Duration from two Timestamps in pseudo code.
+//
+// Timestamp start = ...;
+// Timestamp end = ...;
+// Duration duration = ...;
+//
+// duration.seconds = end.seconds - start.seconds;
+// duration.nanos = end.nanos - start.nanos;
+//
+// if (duration.seconds < 0 && duration.nanos > 0) {
+// duration.seconds += 1;
+// duration.nanos -= 1000000000;
+// } else if (durations.seconds > 0 && duration.nanos < 0) {
+// duration.seconds -= 1;
+// duration.nanos += 1000000000;
+// }
+//
+// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
+//
+// Timestamp start = ...;
+// Duration duration = ...;
+// Timestamp end = ...;
+//
+// end.seconds = start.seconds + duration.seconds;
+// end.nanos = start.nanos + duration.nanos;
+//
+// if (end.nanos < 0) {
+// end.seconds -= 1;
+// end.nanos += 1000000000;
+// } else if (end.nanos >= 1000000000) {
+// end.seconds += 1;
+// end.nanos -= 1000000000;
+// }
+//
+// Example 3: Compute Duration from datetime.timedelta in Python.
+//
+// td = datetime.timedelta(days=3, minutes=10)
+// duration = Duration()
+// duration.FromTimedelta(td)
+//
+// # JSON Mapping
+//
+// In JSON format, the Duration type is encoded as a string rather than an
+// object, where the string ends in the suffix "s" (indicating seconds) and
+// is preceded by the number of seconds, with nanoseconds expressed as
+// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
+// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
+// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
+// microsecond should be expressed in JSON format as "3.000001s".
+//
+//
+message Duration {
+
+ // Signed seconds of the span of time. Must be from -315,576,000,000
+ // to +315,576,000,000 inclusive. Note: these bounds are computed from:
+ // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
+ int64 seconds = 1;
+
+ // Signed fractions of a second at nanosecond resolution of the span
+ // of time. Durations less than one second are represented with a 0
+ // `seconds` field and a positive or negative `nanos` field. For durations
+ // of one second or more, a non-zero value for the `nanos` field must be
+ // of the same sign as the `seconds` field. Must be from -999,999,999
+ // to +999,999,999 inclusive.
+ int32 nanos = 2;
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message.cc b/third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message.cc
index ceedf5003c..cdd4324362 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message.cc
@@ -65,6 +65,9 @@
#include <algorithm>
#include <google/protobuf/stubs/hash.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/common.h>
@@ -229,13 +232,13 @@ class DynamicMessage : public Message {
// Warning: The order in which the following pointers are defined is
// important (the prototype must be deleted *before* the offsets).
- std::unique_ptr<uint32[]> offsets;
- std::unique_ptr<uint32[]> has_bits_indices;
- std::unique_ptr<const GeneratedMessageReflection> reflection;
- // Don't use a unique_ptr to hold the prototype: the destructor for
+ google::protobuf::scoped_array<uint32> offsets;
+ google::protobuf::scoped_array<uint32> has_bits_indices;
+ google::protobuf::scoped_ptr<const GeneratedMessageReflection> reflection;
+ // Don't use a scoped_ptr to hold the prototype: the destructor for
// DynamicMessage needs to know whether it is the prototype, and does so by
// looking back at this field. This would assume details about the
- // implementation of unique_ptr.
+ // implementation of scoped_ptr.
const DynamicMessage* prototype;
int weak_field_map_offset; // The offset for the weak_field_map;
@@ -260,7 +263,7 @@ class DynamicMessage : public Message {
Message* New() const;
Message* New(::google::protobuf::Arena* arena) const;
- ::google::protobuf::Arena* GetArena() const { return arena_; }
+ ::google::protobuf::Arena* GetArena() const { return NULL; };
int GetCachedSize() const;
void SetCachedSize(int size) const;
@@ -279,6 +282,7 @@ 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);
@@ -298,25 +302,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), arena_(NULL), cached_byte_size_(0) {
+ : type_info_(type_info),
+ cached_byte_size_(0) {
SharedCtor(true);
}
DynamicMessage::DynamicMessage(const TypeInfo* type_info,
::google::protobuf::Arena* arena)
- : type_info_(type_info), arena_(arena), cached_byte_size_(0) {
+ : type_info_(type_info),
+ cached_byte_size_(0) {
SharedCtor(true);
}
DynamicMessage::DynamicMessage(const TypeInfo* type_info, bool lock_factory)
- : type_info_(type_info), arena_(NULL), cached_byte_size_(0) {
+ : type_info_(type_info), cached_byte_size_(0) {
SharedCtor(lock_factory);
}
@@ -338,10 +342,10 @@ void DynamicMessage::SharedCtor(bool lock_factory) {
}
new (OffsetToPointer(type_info_->internal_metadata_offset))
- InternalMetadataWithArena(arena_);
+ InternalMetadataWithArena;
if (type_info_->extensions_offset != -1) {
- new (OffsetToPointer(type_info_->extensions_offset)) ExtensionSet(arena_);
+ new (OffsetToPointer(type_info_->extensions_offset)) ExtensionSet;
}
for (int i = 0; i < descriptor->field_count(); i++) {
const FieldDescriptor* field = descriptor->field(i);
@@ -350,14 +354,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>(arena_); \
- } \
- 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>(); \
+ } \
+ break;
HANDLE_TYPE(INT32 , int32 );
HANDLE_TYPE(INT64 , int64 );
@@ -372,7 +376,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>(arena_);
+ new(field_ptr) RepeatedField<int>();
}
break;
@@ -393,7 +397,7 @@ void DynamicMessage::SharedCtor(bool lock_factory) {
ArenaStringPtr* asp = new(field_ptr) ArenaStringPtr();
asp->UnsafeSetDefault(default_value);
} else {
- new (field_ptr) RepeatedPtrField<string>(arena_);
+ new(field_ptr) RepeatedPtrField<string>();
}
break;
}
@@ -408,28 +412,15 @@ 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) {
- 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()));
- }
+ new (field_ptr) DynamicMapField(
+ type_info_->factory->GetPrototype(field->message_type()));
} else {
- 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()));
- }
+ new (field_ptr)
+ DynamicMapField(type_info_->factory->GetPrototypeNoLock(
+ field->message_type()));
}
} else {
- new (field_ptr) RepeatedPtrField<Message>(arena_);
+ new (field_ptr) RepeatedPtrField<Message>();
}
}
break;
@@ -577,17 +568,19 @@ void DynamicMessage::CrossLinkPrototypes() {
}
}
-Message* DynamicMessage::New() const { return New(NULL); }
+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(::google::protobuf::Arena* arena) const {
if (arena != NULL) {
- 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);
+ Message* message = New();
+ arena->Own(message);
+ return message;
} else {
- void* new_base = operator new(type_info_->size);
- memset(new_base, 0, type_info_->size);
- return new (new_base) DynamicMessage(type_info_);
+ return New();
}
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message.h b/third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message.h
index d84cc8af47..e29b148d6a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message.h
@@ -40,6 +40,9 @@
#include <algorithm>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/message.h>
@@ -127,7 +130,7 @@ class LIBPROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory {
// public header (for good reason), but dynamic_message.h is, and public
// headers may only #include other public headers.
struct PrototypeMap;
- std::unique_ptr<PrototypeMap> prototypes_;
+ google::protobuf::scoped_ptr<PrototypeMap> prototypes_;
mutable Mutex prototypes_mutex_;
friend class DynamicMessage;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message_unittest.cc
index 94446b08f7..fe51d8cfdc 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/dynamic_message_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/dynamic_message_unittest.cc
@@ -41,13 +41,16 @@
// DynamicMessage.
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
+#include <google/protobuf/dynamic_message.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/test_util.h>
#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/unittest_no_field_presence.pb.h>
-#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/descriptor.h>
-#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -57,7 +60,7 @@
namespace google {
namespace protobuf {
-class DynamicMessageTest : public ::testing::TestWithParam<bool> {
+class DynamicMessageTest : public testing::Test {
protected:
DescriptorPool pool_;
DynamicMessageFactory factory_;
@@ -141,54 +144,38 @@ TEST_F(DynamicMessageTest, Defaults) {
reflection_tester.ExpectClearViaReflection(*prototype_);
}
-TEST_P(DynamicMessageTest, IndependentOffsets) {
+TEST_F(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).
- Arena arena;
- Message* message = prototype_->New(GetParam()? &arena : NULL);
+ google::protobuf::scoped_ptr<Message> message(prototype_->New());
TestUtil::ReflectionTester reflection_tester(descriptor_);
- reflection_tester.SetAllFieldsViaReflection(message);
+ reflection_tester.SetAllFieldsViaReflection(message.get());
reflection_tester.ExpectAllFieldsSetViaReflection(*message);
-
- if (!GetParam()) {
- delete message;
- }
}
-TEST_P(DynamicMessageTest, Extensions) {
+TEST_F(DynamicMessageTest, Extensions) {
// Check that extensions work.
- Arena arena;
- Message* message = extensions_prototype_->New(GetParam()? &arena : NULL);
+ google::protobuf::scoped_ptr<Message> message(extensions_prototype_->New());
TestUtil::ReflectionTester reflection_tester(extensions_descriptor_);
- reflection_tester.SetAllFieldsViaReflection(message);
+ reflection_tester.SetAllFieldsViaReflection(message.get());
reflection_tester.ExpectAllFieldsSetViaReflection(*message);
-
- if (!GetParam()) {
- delete message;
- }
}
-TEST_P(DynamicMessageTest, PackedFields) {
+TEST_F(DynamicMessageTest, PackedFields) {
// Check that packed fields work properly.
- Arena arena;
- Message* message = packed_prototype_->New(GetParam()? &arena : NULL);
+ google::protobuf::scoped_ptr<Message> message(packed_prototype_->New());
TestUtil::ReflectionTester reflection_tester(packed_descriptor_);
- reflection_tester.SetPackedFieldsViaReflection(message);
+ reflection_tester.SetPackedFieldsViaReflection(message.get());
reflection_tester.ExpectPackedFieldsSetViaReflection(*message);
-
- if (!GetParam()) {
- delete message;
- }
}
-TEST_P(DynamicMessageTest, Oneof) {
+TEST_F(DynamicMessageTest, Oneof) {
// Check that oneof fields work properly.
- Arena arena;
- Message* message = oneof_prototype_->New(GetParam()? &arena : NULL);
+ google::protobuf::scoped_ptr<Message> message(oneof_prototype_->New());
// Check default values.
const Descriptor* descriptor = message->GetDescriptor();
@@ -239,46 +226,29 @@ TEST_P(DynamicMessageTest, Oneof) {
// Check set functions.
TestUtil::ReflectionTester reflection_tester(oneof_descriptor_);
- reflection_tester.SetOneofViaReflection(message);
+ reflection_tester.SetOneofViaReflection(message.get());
reflection_tester.ExpectOneofSetViaReflection(*message);
-
- if (!GetParam()) {
- delete message;
- }
}
-TEST_P(DynamicMessageTest, SpaceUsed) {
+TEST_F(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.
- Arena arena;
- Message* message = prototype_->New(GetParam()? &arena : NULL);
+ google::protobuf::scoped_ptr<Message> message(prototype_->New());
TestUtil::ReflectionTester reflection_tester(descriptor_);
int initial_space_used = message->SpaceUsed();
- reflection_tester.SetAllFieldsViaReflection(message);
+ reflection_tester.SetAllFieldsViaReflection(message.get());
EXPECT_LT(initial_space_used, message->SpaceUsed());
-
- if (!GetParam()) {
- delete message;
- }
}
TEST_F(DynamicMessageTest, Arena) {
Arena arena;
Message* message = prototype_->New(&arena);
- 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;
+ (void)message; // avoid unused-variable error.
// Return without freeing: should not leak.
}
@@ -316,7 +286,6 @@ TEST_F(DynamicMessageTest, Proto3) {
delete message;
}
-INSTANTIATE_TEST_CASE_P(UseArena, DynamicMessageTest, ::testing::Bool());
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/empty.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/empty.pb.cc
index 9b53c54672..6d2ea338aa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/empty.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/empty.pb.cc
@@ -1,90 +1,106 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/empty.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/empty.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
class EmptyDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Empty>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Empty>
+ _instance;
} _Empty_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2fempty_2eproto {
-static void InitDefaultsEmpty() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::_Empty_default_instance_;
- new (ptr) ::google::protobuf::Empty();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Empty::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2fempty_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Empty =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsEmpty}, {}};
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_Empty.base);
-}
+namespace {
::google::protobuf::Metadata file_level_metadata[1];
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+} // namespace
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Empty, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Empty, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::Empty)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(Empty)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Empty_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Empty_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/empty.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/empty.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _Empty_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Empty_default_instance_);}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\033google/protobuf/empty.proto\022\017google.pr"
"otobuf\"\007\n\005EmptyBv\n\023com.google.protobufB\n"
"EmptyProtoP\001Z\'github.com/golang/protobuf"
@@ -96,10 +112,11 @@ void AddDescriptorsImpl() {
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/empty.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -107,40 +124,41 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fempty_2eproto
-namespace google {
-namespace protobuf {
+
// ===================================================================
-void Empty::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
Empty::Empty()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fempty_2eproto::scc_info_Empty.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Empty)
}
Empty::Empty(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fempty_2eproto::scc_info_Empty.base);
+ protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Empty)
}
Empty::Empty(const Empty& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.Empty)
}
void Empty::SharedCtor() {
+ _cached_size_ = 0;
}
Empty::~Empty() {
@@ -149,7 +167,12 @@ Empty::~Empty() {
}
void Empty::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void Empty::ArenaDtor(void* object) {
@@ -159,18 +182,23 @@ void Empty::ArenaDtor(void* object) {
void Empty::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Empty::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Empty::descriptor() {
- ::protobuf_google_2fprotobuf_2fempty_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fempty_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fempty_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fempty_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Empty& Empty::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fempty_2eproto::scc_info_Empty.base);
+ protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaults();
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)
@@ -187,7 +215,7 @@ bool Empty::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Empty)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
handle_unusual:
@@ -244,7 +272,9 @@ size_t Empty::ByteSizeLong() const {
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -312,22 +342,21 @@ void Empty::UnsafeArenaSwap(Empty* other) {
void Empty::InternalSwap(Empty* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Empty::GetMetadata() const {
protobuf_google_2fprotobuf_2fempty_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fempty_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fempty_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Empty
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Empty* Arena::CreateMaybeMessage< ::google::protobuf::Empty >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Empty >(arena);
-}
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/empty.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/empty.pb.h
index c3da4fa8b7..1c6e53e6d4 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/empty.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/empty.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/empty.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fempty_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fempty_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,41 +24,37 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fempty_2eproto LIBPROTOBUF_EXPORT
+namespace google {
+namespace protobuf {
+class Empty;
+class EmptyDefaultTypeInternal;
+LIBPROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_;
+} // namespace protobuf
+} // namespace google
+
+namespace google {
+namespace protobuf {
namespace protobuf_google_2fprotobuf_2fempty_2eproto {
-// Internal implementation detail -- do not use these members.
+// Internal implementation detail -- do not call these.
struct LIBPROTOBUF_EXPORT TableStruct {
static const ::google::protobuf::internal::ParseTableField entries[];
static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[1];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
+ static void InitDefaultsImpl();
};
void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
} // namespace protobuf_google_2fprotobuf_2fempty_2eproto
-namespace google {
-namespace protobuf {
-class Empty;
-class EmptyDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Empty* Arena::CreateMaybeMessage<::google::protobuf::Empty>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
// ===================================================================
@@ -88,21 +84,20 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Empty& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Empty* internal_default_instance() {
return reinterpret_cast<const Empty*>(
&_Empty_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void UnsafeArenaSwap(Empty* other);
@@ -113,33 +108,28 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Empty* New() const final {
- return CreateMaybeMessage<Empty>(NULL);
- }
+ inline Empty* New() const PROTOBUF_FINAL { return New(NULL); }
- Empty* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Empty>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Empty* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Empty& from);
void MergeFrom(const Empty& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Empty* other);
protected:
explicit Empty(::google::protobuf::Arena* arena);
@@ -155,7 +145,7 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -168,14 +158,15 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_
template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fempty_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fempty_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -185,12 +176,14 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fempty_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Android.java b/third_party/protobuf/3.4.0/src/google/protobuf/empty.proto
index cad547839a..03cacd2330 100644
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/Android.java
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/empty.proto
@@ -28,30 +28,25 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-package com.google.protobuf;
+syntax = "proto3";
-final class Android {
+package google.protobuf;
- private static final Class<?> MEMORY_CLASS = getClassForName("libcore.io.Memory");
- private static final boolean IS_ROBOLECTRIC =
- getClassForName("org.robolectric.Robolectric") != null;
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option go_package = "github.com/golang/protobuf/ptypes/empty";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "EmptyProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+option cc_enable_arenas = true;
- /** Returns {@code true} if running on an Android device. */
- static boolean isOnAndroidDevice() {
- return MEMORY_CLASS != null && !IS_ROBOLECTRIC;
- }
-
- /** 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;
- }
- }
-}
+// A generic empty message that you can re-use to avoid defining duplicated
+// empty messages in your APIs. A typical example is to use it as the request
+// or the response type of an API method. For instance:
+//
+// service Foo {
+// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
+// }
+//
+// The JSON representation for `Empty` is empty JSON object `{}`.
+message Empty {}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/extension_set.cc b/third_party/protobuf/3.4.0/src/google/protobuf/extension_set.cc
index b587b38f16..955c079bdd 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/extension_set.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/extension_set.cc
@@ -33,8 +33,6 @@
// Sanjay Ghemawat, Jeff Dean, and others.
#include <google/protobuf/stubs/hash.h>
-#include <tuple>
-#include <utility>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/extension_set.h>
@@ -180,29 +178,20 @@ void ExtensionSet::RegisterMessageExtension(const MessageLite* containing_type,
// Constructors and basic methods.
ExtensionSet::ExtensionSet(::google::protobuf::Arena* arena)
- : arena_(arena),
- flat_capacity_(0),
- flat_size_(0),
- map_{flat_capacity_ == 0 ? NULL
- : ::google::protobuf::Arena::CreateArray<KeyValue>(
- arena_, flat_capacity_)} {}
-
-ExtensionSet::ExtensionSet()
- : arena_(NULL),
- flat_capacity_(0),
- flat_size_(0),
- map_{flat_capacity_ == 0 ? NULL
- : ::google::protobuf::Arena::CreateArray<KeyValue>(
- arena_, flat_capacity_)} {}
+ : arena_(arena) {
+ if (arena_ != NULL) {
+ arena_->OwnDestructor(&extensions_);
+ }
+}
+
+ExtensionSet::ExtensionSet() : arena_(NULL) {}
ExtensionSet::~ExtensionSet() {
// Deletes all allocated extensions.
if (arena_ == NULL) {
- ForEach([](int /* number */, Extension& ext) { ext.Free(); });
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- delete map_.large;
- } else {
- delete[] map_.flat;
+ for (ExtensionMap::iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ iter->second.Free();
}
}
}
@@ -213,43 +202,45 @@ ExtensionSet::~ExtensionSet() {
// vector<const FieldDescriptor*>* output) const
bool ExtensionSet::Has(int number) const {
- const Extension* ext = FindOrNull(number);
- if (ext == NULL) return false;
- GOOGLE_DCHECK(!ext->is_repeated);
- return !ext->is_cleared;
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ if (iter == extensions_.end()) return false;
+ GOOGLE_DCHECK(!iter->second.is_repeated);
+ return !iter->second.is_cleared;
}
int ExtensionSet::NumExtensions() const {
int result = 0;
- ForEach([&result](int /* number */, const Extension& ext) {
- if (!ext.is_cleared) {
+ for (ExtensionMap::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ if (!iter->second.is_cleared) {
++result;
}
- });
+ }
return result;
}
int ExtensionSet::ExtensionSize(int number) const {
- const Extension* ext = FindOrNull(number);
- return ext == NULL ? 0 : ext->GetSize();
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ if (iter == extensions_.end()) return false;
+ return iter->second.GetSize();
}
FieldType ExtensionSet::ExtensionType(int number) const {
- const Extension* ext = FindOrNull(number);
- if (ext == NULL) {
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ if (iter == extensions_.end()) {
GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (1). ";
return 0;
}
- if (ext->is_cleared) {
+ if (iter->second.is_cleared) {
GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (2). ";
}
- return ext->type;
+ return iter->second.type;
}
void ExtensionSet::ClearExtension(int number) {
- Extension* ext = FindOrNull(number);
- if (ext == NULL) return;
- ext->Clear();
+ ExtensionMap::iterator iter = extensions_.find(number);
+ if (iter == extensions_.end()) return;
+ iter->second.Clear();
}
// ===================================================================
@@ -275,12 +266,12 @@ enum Cardinality {
\
LOWERCASE ExtensionSet::Get##CAMELCASE(int number, \
LOWERCASE default_value) const { \
- const Extension* extension = FindOrNull(number); \
- if (extension == NULL || extension->is_cleared) { \
+ ExtensionMap::const_iterator iter = extensions_.find(number); \
+ if (iter == extensions_.end() || iter->second.is_cleared) { \
return default_value; \
} else { \
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, UPPERCASE); \
- return extension->LOWERCASE##_value; \
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, UPPERCASE); \
+ return iter->second.LOWERCASE##_value; \
} \
} \
\
@@ -300,18 +291,18 @@ void ExtensionSet::Set##CAMELCASE(int number, FieldType type, \
} \
\
LOWERCASE ExtensionSet::GetRepeated##CAMELCASE(int number, int index) const { \
- const Extension* extension = FindOrNull(number); \
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty)."; \
- GOOGLE_DCHECK_TYPE(*extension, REPEATED, UPPERCASE); \
- return extension->repeated_##LOWERCASE##_value->Get(index); \
+ ExtensionMap::const_iterator iter = extensions_.find(number); \
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; \
+ GOOGLE_DCHECK_TYPE(iter->second, REPEATED, UPPERCASE); \
+ return iter->second.repeated_##LOWERCASE##_value->Get(index); \
} \
\
void ExtensionSet::SetRepeated##CAMELCASE( \
int number, int index, LOWERCASE value) { \
- Extension* extension = FindOrNull(number); \
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty)."; \
- GOOGLE_DCHECK_TYPE(*extension, REPEATED, UPPERCASE); \
- extension->repeated_##LOWERCASE##_value->Set(index, value); \
+ ExtensionMap::iterator iter = extensions_.find(number); \
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; \
+ GOOGLE_DCHECK_TYPE(iter->second, REPEATED, UPPERCASE); \
+ iter->second.repeated_##LOWERCASE##_value->Set(index, value); \
} \
\
void ExtensionSet::Add##CAMELCASE(int number, FieldType type, \
@@ -344,13 +335,13 @@ PRIMITIVE_ACCESSORS( BOOL, bool, Bool)
const void* ExtensionSet::GetRawRepeatedField(int number,
const void* default_value) const {
- const Extension* extension = FindOrNull(number);
- if (extension == NULL) {
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ if (iter == extensions_.end()) {
return default_value;
}
// We assume that all the RepeatedField<>* pointers have the same
// size and alignment within the anonymous union in Extension.
- return extension->repeated_int32_value;
+ return iter->second.repeated_int32_value;
}
void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type,
@@ -401,7 +392,7 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type,
break;
case WireFormatLite::CPPTYPE_STRING:
extension->repeated_string_value =
- Arena::CreateMessage<RepeatedPtrField<::std::string> >(arena_);
+ Arena::CreateMessage<RepeatedPtrField< ::std::string> >(arena_);
break;
case WireFormatLite::CPPTYPE_MESSAGE:
extension->repeated_message_value =
@@ -418,11 +409,11 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type,
// Compatible version using old call signature. Does not create extensions when
// the don't already exist; instead, just GOOGLE_CHECK-fails.
void* ExtensionSet::MutableRawRepeatedField(int number) {
- Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Extension not found.";
+ ExtensionMap::iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter == extensions_.end()) << "Extension not found.";
// We assume that all the RepeatedField<>* pointers have the same
// size and alignment within the anonymous union in Extension.
- return extension->repeated_int32_value;
+ return iter->second.repeated_int32_value;
}
@@ -430,13 +421,13 @@ void* ExtensionSet::MutableRawRepeatedField(int number) {
// Enums
int ExtensionSet::GetEnum(int number, int default_value) const {
- const Extension* extension = FindOrNull(number);
- if (extension == NULL || extension->is_cleared) {
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ if (iter == extensions_.end() || iter->second.is_cleared) {
// Not present. Return the default value.
return default_value;
} else {
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, ENUM);
- return extension->enum_value;
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, ENUM);
+ return iter->second.enum_value;
}
}
@@ -455,17 +446,17 @@ void ExtensionSet::SetEnum(int number, FieldType type, int value,
}
int ExtensionSet::GetRepeatedEnum(int number, int index) const {
- const Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
- GOOGLE_DCHECK_TYPE(*extension, REPEATED, ENUM);
- return extension->repeated_enum_value->Get(index);
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+ GOOGLE_DCHECK_TYPE(iter->second, REPEATED, ENUM);
+ return iter->second.repeated_enum_value->Get(index);
}
void ExtensionSet::SetRepeatedEnum(int number, int index, int value) {
- Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
- GOOGLE_DCHECK_TYPE(*extension, REPEATED, ENUM);
- extension->repeated_enum_value->Set(index, value);
+ ExtensionMap::iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+ GOOGLE_DCHECK_TYPE(iter->second, REPEATED, ENUM);
+ iter->second.repeated_enum_value->Set(index, value);
}
void ExtensionSet::AddEnum(int number, FieldType type,
@@ -491,13 +482,13 @@ void ExtensionSet::AddEnum(int number, FieldType type,
const string& ExtensionSet::GetString(int number,
const string& default_value) const {
- const Extension* extension = FindOrNull(number);
- if (extension == NULL || extension->is_cleared) {
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ if (iter == extensions_.end() || iter->second.is_cleared) {
// Not present. Return the default value.
return default_value;
} else {
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, STRING);
- return *extension->string_value;
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, STRING);
+ return *iter->second.string_value;
}
}
@@ -517,17 +508,17 @@ string* ExtensionSet::MutableString(int number, FieldType type,
}
const string& ExtensionSet::GetRepeatedString(int number, int index) const {
- const Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
- GOOGLE_DCHECK_TYPE(*extension, REPEATED, STRING);
- return extension->repeated_string_value->Get(index);
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+ GOOGLE_DCHECK_TYPE(iter->second, REPEATED, STRING);
+ return iter->second.repeated_string_value->Get(index);
}
string* ExtensionSet::MutableRepeatedString(int number, int index) {
- Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
- GOOGLE_DCHECK_TYPE(*extension, REPEATED, STRING);
- return extension->repeated_string_value->Mutable(index);
+ ExtensionMap::iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+ GOOGLE_DCHECK_TYPE(iter->second, REPEATED, STRING);
+ return iter->second.repeated_string_value->Mutable(index);
}
string* ExtensionSet::AddString(int number, FieldType type,
@@ -551,16 +542,16 @@ string* ExtensionSet::AddString(int number, FieldType type,
const MessageLite& ExtensionSet::GetMessage(
int number, const MessageLite& default_value) const {
- const Extension* extension = FindOrNull(number);
- if (extension == NULL) {
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ if (iter == extensions_.end()) {
// Not present. Return the default value.
return default_value;
} else {
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
- if (extension->is_lazy) {
- return extension->lazymessage_value->GetMessage(default_value);
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, MESSAGE);
+ if (iter->second.is_lazy) {
+ return iter->second.lazymessage_value->GetMessage(default_value);
} else {
- return *extension->message_value;
+ return *iter->second.message_value;
}
}
}
@@ -671,53 +662,55 @@ void ExtensionSet::UnsafeArenaSetAllocatedMessage(
extension->is_cleared = false;
}
+
MessageLite* ExtensionSet::ReleaseMessage(int number,
const MessageLite& prototype) {
- Extension* extension = FindOrNull(number);
- if (extension == NULL) {
+ ExtensionMap::iterator iter = extensions_.find(number);
+ if (iter == extensions_.end()) {
// Not present. Return NULL.
return NULL;
} else {
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, MESSAGE);
MessageLite* ret = NULL;
- if (extension->is_lazy) {
- ret = extension->lazymessage_value->ReleaseMessage(prototype);
+ if (iter->second.is_lazy) {
+ ret = iter->second.lazymessage_value->ReleaseMessage(prototype);
if (arena_ == NULL) {
- delete extension->lazymessage_value;
+ delete iter->second.lazymessage_value;
}
} else {
if (arena_ == NULL) {
- ret = extension->message_value;
+ ret = iter->second.message_value;
} else {
// ReleaseMessage() always returns a heap-allocated message, and we are
// on an arena, so we need to make a copy of this message to return.
- ret = extension->message_value->New();
- ret->CheckTypeAndMergeFrom(*extension->message_value);
+ ret = (iter->second.message_value)->New();
+ ret->CheckTypeAndMergeFrom(*iter->second.message_value);
}
}
- Erase(number);
+ extensions_.erase(number);
return ret;
}
}
MessageLite* ExtensionSet::UnsafeArenaReleaseMessage(
int number, const MessageLite& prototype) {
- Extension* extension = FindOrNull(number);
- if (extension == NULL) {
+ ExtensionMap::iterator iter = extensions_.find(number);
+ if (iter == extensions_.end()) {
// Not present. Return NULL.
return NULL;
} else {
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, MESSAGE);
MessageLite* ret = NULL;
- if (extension->is_lazy) {
- ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(prototype);
+ if (iter->second.is_lazy) {
+ ret =
+ iter->second.lazymessage_value->UnsafeArenaReleaseMessage(prototype);
if (arena_ == NULL) {
- delete extension->lazymessage_value;
+ delete iter->second.lazymessage_value;
}
} else {
- ret = extension->message_value;
+ ret = iter->second.message_value;
}
- Erase(number);
+ extensions_.erase(number);
return ret;
}
}
@@ -728,17 +721,17 @@ MessageLite* ExtensionSet::UnsafeArenaReleaseMessage(
const MessageLite& ExtensionSet::GetRepeatedMessage(
int number, int index) const {
- const Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
- GOOGLE_DCHECK_TYPE(*extension, REPEATED, MESSAGE);
- return extension->repeated_message_value->Get(index);
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+ GOOGLE_DCHECK_TYPE(iter->second, REPEATED, MESSAGE);
+ return iter->second.repeated_message_value->Get(index);
}
MessageLite* ExtensionSet::MutableRepeatedMessage(int number, int index) {
- Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
- GOOGLE_DCHECK_TYPE(*extension, REPEATED, MESSAGE);
- return extension->repeated_message_value->Mutable(index);
+ ExtensionMap::iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+ GOOGLE_DCHECK_TYPE(iter->second, REPEATED, MESSAGE);
+ return iter->second.repeated_message_value->Mutable(index);
}
MessageLite* ExtensionSet::AddMessage(int number, FieldType type,
@@ -757,10 +750,8 @@ 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 =
- reinterpret_cast<::google::protobuf::internal::RepeatedPtrFieldBase*>(
- extension->repeated_message_value)
- ->AddFromCleared<GenericTypeHandler<MessageLite> >();
+ MessageLite* result = extension->repeated_message_value
+ ->AddFromCleared<GenericTypeHandler<MessageLite> >();
if (result == NULL) {
result = prototype.New(arena_);
extension->repeated_message_value->AddAllocated(result);
@@ -776,8 +767,10 @@ MessageLite* ExtensionSet::AddMessage(int number, FieldType type,
#undef GOOGLE_DCHECK_TYPE
void ExtensionSet::RemoveLast(int number) {
- Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+ ExtensionMap::iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+
+ Extension* extension = &iter->second;
GOOGLE_DCHECK(extension->is_repeated);
switch(cpp_type(extension->type)) {
@@ -815,16 +808,20 @@ void ExtensionSet::RemoveLast(int number) {
}
MessageLite* ExtensionSet::ReleaseLast(int number) {
- Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+ ExtensionMap::iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+
+ Extension* extension = &iter->second;
GOOGLE_DCHECK(extension->is_repeated);
GOOGLE_DCHECK(cpp_type(extension->type) == WireFormatLite::CPPTYPE_MESSAGE);
return extension->repeated_message_value->ReleaseLast();
}
void ExtensionSet::SwapElements(int number, int index1, int index2) {
- Extension* extension = FindOrNull(number);
- GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+ ExtensionMap::iterator iter = extensions_.find(number);
+ GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty).";
+
+ Extension* extension = &iter->second;
GOOGLE_DCHECK(extension->is_repeated);
switch(cpp_type(extension->type)) {
@@ -864,45 +861,18 @@ void ExtensionSet::SwapElements(int number, int index1, int index2) {
// ===================================================================
void ExtensionSet::Clear() {
- ForEach([](int /* number */, Extension& ext) { ext.Clear(); });
-}
-
-namespace {
-// Computes the size of a std::set_union without constructing the union.
-template <typename ItX, typename ItY>
-size_t SizeOfUnion(ItX it_xs, ItX end_xs, ItY it_ys, ItY end_ys) {
- size_t result = 0;
- while (it_xs != end_xs && it_ys != end_ys) {
- ++result;
- if (it_xs->first < it_ys->first) {
- ++it_xs;
- } else if (it_xs->first == it_ys->first) {
- ++it_xs;
- ++it_ys;
- } else {
- ++it_ys;
- }
+ for (ExtensionMap::iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ iter->second.Clear();
}
- result += std::distance(it_xs, end_xs);
- result += std::distance(it_ys, end_ys);
- return result;
}
-} // namespace
void ExtensionSet::MergeFrom(const ExtensionSet& other) {
- if (GOOGLE_PREDICT_TRUE(!is_large())) {
- if (GOOGLE_PREDICT_TRUE(!other.is_large())) {
- GrowCapacity(SizeOfUnion(flat_begin(), flat_end(), other.flat_begin(),
- other.flat_end()));
- } else {
- GrowCapacity(SizeOfUnion(flat_begin(), flat_end(),
- other.map_.large->begin(),
- other.map_.large->end()));
- }
+ for (ExtensionMap::const_iterator iter = other.extensions_.begin();
+ iter != other.extensions_.end(); ++iter) {
+ const Extension& other_extension = iter->second;
+ InternalExtensionMergeFrom(iter->first, other_extension);
}
- other.ForEach([this](int number, const Extension& ext) {
- this->InternalExtensionMergeFrom(number, ext);
- });
}
void ExtensionSet::InternalExtensionMergeFrom(
@@ -955,10 +925,8 @@ 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 =
- reinterpret_cast<::google::protobuf::internal::RepeatedPtrFieldBase*>(
- extension->repeated_message_value)
- ->AddFromCleared<GenericTypeHandler<MessageLite> >();
+ MessageLite* target = extension->repeated_message_value
+ ->AddFromCleared<GenericTypeHandler<MessageLite> >();
if (target == NULL) {
target = other_message.New(arena_);
extension->repeated_message_value->AddAllocated(target);
@@ -1047,10 +1015,7 @@ void ExtensionSet::InternalExtensionMergeFrom(
void ExtensionSet::Swap(ExtensionSet* x) {
if (GetArenaNoVirtual() == x->GetArenaNoVirtual()) {
- using std::swap;
- swap(flat_capacity_, x->flat_capacity_);
- swap(flat_size_, x->flat_size_);
- swap(map_, x->map_);
+ extensions_.swap(x->extensions_);
} else {
// TODO(cfallin, rohananil): We maybe able to optimize a case where we are
// swapping from heap to arena-allocated extension set, by just Own()'ing
@@ -1067,17 +1032,19 @@ void ExtensionSet::Swap(ExtensionSet* x) {
void ExtensionSet::SwapExtension(ExtensionSet* other,
int number) {
if (this == other) return;
- Extension* this_ext = FindOrNull(number);
- Extension* other_ext = other->FindOrNull(number);
+ ExtensionMap::iterator this_iter = extensions_.find(number);
+ ExtensionMap::iterator other_iter = other->extensions_.find(number);
- if (this_ext == NULL && other_ext == NULL) {
+ if (this_iter == extensions_.end() &&
+ other_iter == other->extensions_.end()) {
return;
}
- if (this_ext != NULL && other_ext != NULL) {
+ if (this_iter != extensions_.end() &&
+ other_iter != other->extensions_.end()) {
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
using std::swap;
- swap(*this_ext, *other_ext);
+ swap(this_iter->second, other_iter->second);
} else {
// TODO(cfallin, rohananil): We could further optimize these cases,
// especially avoid creation of ExtensionSet, and move MergeFrom logic
@@ -1085,33 +1052,33 @@ void ExtensionSet::SwapExtension(ExtensionSet* other,
// We do it this way to reuse the copy-across-arenas logic already
// implemented in ExtensionSet's MergeFrom.
ExtensionSet temp;
- temp.InternalExtensionMergeFrom(number, *other_ext);
- Extension* temp_ext = temp.FindOrNull(number);
- other_ext->Clear();
- other->InternalExtensionMergeFrom(number, *this_ext);
- this_ext->Clear();
- InternalExtensionMergeFrom(number, *temp_ext);
+ temp.InternalExtensionMergeFrom(number, other_iter->second);
+ ExtensionMap::iterator temp_iter = temp.extensions_.find(number);
+ other_iter->second.Clear();
+ other->InternalExtensionMergeFrom(number, this_iter->second);
+ this_iter->second.Clear();
+ InternalExtensionMergeFrom(number, temp_iter->second);
}
return;
}
- if (this_ext == NULL) {
+ if (this_iter == extensions_.end()) {
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- *Insert(number).first = *other_ext;
+ extensions_.insert(std::make_pair(number, other_iter->second));
} else {
- InternalExtensionMergeFrom(number, *other_ext);
+ InternalExtensionMergeFrom(number, other_iter->second);
}
- other->Erase(number);
+ other->extensions_.erase(number);
return;
}
- if (other_ext == NULL) {
+ if (other_iter == other->extensions_.end()) {
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
- *other->Insert(number).first = *this_ext;
+ other->extensions_.insert(std::make_pair(number, this_iter->second));
} else {
- other->InternalExtensionMergeFrom(number, *this_ext);
+ other->InternalExtensionMergeFrom(number, this_iter->second);
}
- Erase(number);
+ extensions_.erase(number);
return;
}
}
@@ -1119,15 +1086,28 @@ void ExtensionSet::SwapExtension(ExtensionSet* other,
bool ExtensionSet::IsInitialized() const {
// Extensions are never required. However, we need to check that all
// embedded messages are initialized.
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- for (const auto& kv : *map_.large) {
- if (!kv.second.IsInitialized()) return false;
+ for (ExtensionMap::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ const Extension& extension = iter->second;
+ if (cpp_type(extension.type) == WireFormatLite::CPPTYPE_MESSAGE) {
+ if (extension.is_repeated) {
+ for (int i = 0; i < extension.repeated_message_value->size(); i++) {
+ if (!extension.repeated_message_value->Get(i).IsInitialized()) {
+ return false;
+ }
+ }
+ } else {
+ if (!extension.is_cleared) {
+ if (extension.is_lazy) {
+ if (!extension.lazymessage_value->IsInitialized()) return false;
+ } else {
+ if (!extension.message_value->IsInitialized()) return false;
+ }
+ }
+ }
}
- return true;
- }
- for (const KeyValue* it = flat_begin(); it != flat_end(); ++it) {
- if (!it->second.IsInitialized()) return false;
}
+
return true;
}
@@ -1366,27 +1346,22 @@ bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input,
void ExtensionSet::SerializeWithCachedSizes(
int start_field_number, int end_field_number,
io::CodedOutputStream* output) const {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- const auto& end = map_.large->end();
- for (auto it = map_.large->lower_bound(start_field_number);
- it != end && it->first < end_field_number; ++it) {
- it->second.SerializeFieldWithCachedSizes(it->first, output);
- }
- return;
- }
- const KeyValue* end = flat_end();
- for (const KeyValue* it = std::lower_bound(
- flat_begin(), end, start_field_number, KeyValue::FirstComparator());
- it != end && it->first < end_field_number; ++it) {
- it->second.SerializeFieldWithCachedSizes(it->first, output);
+ ExtensionMap::const_iterator iter;
+ for (iter = extensions_.lower_bound(start_field_number);
+ iter != extensions_.end() && iter->first < end_field_number;
+ ++iter) {
+ iter->second.SerializeFieldWithCachedSizes(iter->first, output);
}
}
size_t ExtensionSet::ByteSize() const {
size_t total_size = 0;
- ForEach([&total_size](int number, const Extension& ext) {
- total_size += ext.ByteSize(number);
- });
+
+ for (ExtensionMap::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ total_size += iter->second.ByteSize(iter->first);
+ }
+
return total_size;
}
@@ -1396,10 +1371,11 @@ size_t ExtensionSet::ByteSize() const {
bool ExtensionSet::MaybeNewExtension(int number,
const FieldDescriptor* descriptor,
Extension** result) {
- bool extension_is_new = false;
- std::tie(*result, extension_is_new) = Insert(number);
+ std::pair<ExtensionMap::iterator, bool> insert_result =
+ extensions_.insert(std::make_pair(number, Extension()));
+ *result = &insert_result.first->second;
(*result)->descriptor = descriptor;
- return extension_is_new;
+ return insert_result.second;
}
// ===================================================================
@@ -1771,143 +1747,6 @@ void ExtensionSet::Extension::Free() {
// Defined in extension_set_heavy.cc.
// int ExtensionSet::Extension::SpaceUsedExcludingSelf() const
-bool ExtensionSet::Extension::IsInitialized() const {
- if (cpp_type(type) == WireFormatLite::CPPTYPE_MESSAGE) {
- if (is_repeated) {
- for (int i = 0; i < repeated_message_value->size(); i++) {
- if (!repeated_message_value->Get(i).IsInitialized()) {
- return false;
- }
- }
- } else {
- if (!is_cleared) {
- if (is_lazy) {
- if (!lazymessage_value->IsInitialized()) return false;
- } else {
- if (!message_value->IsInitialized()) return false;
- }
- }
- }
- }
- return true;
-}
-
-// Dummy key method to avoid weak vtable.
-void ExtensionSet::LazyMessageExtension::UnusedKeyMethod() {}
-
-const ExtensionSet::Extension* ExtensionSet::FindOrNull(int key) const {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- return FindOrNullInLargeMap(key);
- }
- const KeyValue* end = flat_end();
- const KeyValue* it =
- std::lower_bound(flat_begin(), end, key, KeyValue::FirstComparator());
- if (it != end && it->first == key) {
- return &it->second;
- }
- return NULL;
-}
-
-const ExtensionSet::Extension* ExtensionSet::FindOrNullInLargeMap(
- int key) const {
- assert(is_large());
- LargeMap::const_iterator it = map_.large->find(key);
- if (it != map_.large->end()) {
- return &it->second;
- }
- return NULL;
-}
-
-ExtensionSet::Extension* ExtensionSet::FindOrNull(int key) {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- return FindOrNullInLargeMap(key);
- }
- KeyValue* end = flat_end();
- KeyValue* it =
- std::lower_bound(flat_begin(), end, key, KeyValue::FirstComparator());
- if (it != end && it->first == key) {
- return &it->second;
- }
- return NULL;
-}
-
-ExtensionSet::Extension* ExtensionSet::FindOrNullInLargeMap(int key) {
- assert(is_large());
- LargeMap::iterator it = map_.large->find(key);
- if (it != map_.large->end()) {
- return &it->second;
- }
- return NULL;
-}
-
-std::pair<ExtensionSet::Extension*, bool> ExtensionSet::Insert(int key) {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- auto maybe = map_.large->insert({key, Extension()});
- return {&maybe.first->second, maybe.second};
- }
- KeyValue* end = flat_end();
- KeyValue* it =
- std::lower_bound(flat_begin(), end, key, KeyValue::FirstComparator());
- if (it != end && it->first == key) {
- return {&it->second, false};
- }
- if (flat_size_ < flat_capacity_) {
- std::copy_backward(it, end, end + 1);
- ++flat_size_;
- it->first = key;
- it->second = Extension();
- return {&it->second, true};
- }
- GrowCapacity(flat_size_ + 1);
- return Insert(key);
-}
-
-void ExtensionSet::GrowCapacity(size_t minimum_new_capacity) {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- return; // LargeMap does not have a "reserve" method.
- }
- if (flat_capacity_ >= minimum_new_capacity) {
- return;
- }
-
- do {
- flat_capacity_ = flat_capacity_ == 0 ? 1 : flat_capacity_ * 4;
- } while (flat_capacity_ < minimum_new_capacity);
-
- const KeyValue* begin = flat_begin();
- const KeyValue* end = flat_end();
- if (flat_capacity_ > kMaximumFlatCapacity) {
- // Switch to LargeMap
- map_.large = ::google::protobuf::Arena::Create<LargeMap>(arena_);
- LargeMap::iterator hint = map_.large->begin();
- for (const KeyValue* it = begin; it != end; ++it) {
- hint = map_.large->insert(hint, {it->first, it->second});
- }
- flat_size_ = 0;
- } else {
- map_.flat = ::google::protobuf::Arena::CreateArray<KeyValue>(arena_, flat_capacity_);
- std::copy(begin, end, map_.flat);
- }
- if (arena_ == NULL) delete[] begin;
-}
-
-// static
-constexpr uint16 ExtensionSet::kMaximumFlatCapacity;
-
-void ExtensionSet::Erase(int key) {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- map_.large->erase(key);
- return;
- }
- KeyValue* end = flat_end();
- KeyValue* it =
- std::lower_bound(flat_begin(), end, key, KeyValue::FirstComparator());
- if (it != end && it->first == key) {
- std::copy(it + 1, end, it);
- --flat_size_;
- }
-}
-
// ==================================================================
// Default repeated field instances for iterator-compatible accessors
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/extension_set.h b/third_party/protobuf/3.4.0/src/google/protobuf/extension_set.h
index c4796629a9..6f47c4a678 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/extension_set.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/extension_set.h
@@ -38,16 +38,16 @@
#ifndef GOOGLE_PROTOBUF_EXTENSION_SET_H__
#define GOOGLE_PROTOBUF_EXTENSION_SET_H__
-#include <algorithm>
-#include <cassert>
+#include <vector>
#include <map>
-#include <string>
#include <utility>
-#include <vector>
+#include <string>
+
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/once.h>
+
#include <google/protobuf/repeated_field.h>
namespace google {
@@ -464,12 +464,7 @@ class LIBPROTOBUF_EXPORT ExtensionSet {
const MessageLite& prototype) = 0;
virtual bool IsInitialized() const = 0;
-
- PROTOBUF_RUNTIME_DEPRECATED("Please use ByteSizeLong() instead")
- virtual int ByteSize() const {
- return internal::ToIntSize(ByteSizeLong());
- }
- virtual size_t ByteSizeLong() const = 0;
+ virtual int ByteSize() const = 0;
virtual size_t SpaceUsedLong() const = 0;
virtual void MergeFrom(const LazyMessageExtension& other) = 0;
@@ -488,8 +483,6 @@ class LIBPROTOBUF_EXPORT ExtensionSet {
}
private:
- virtual void UnusedKeyMethod(); // Dummy key method to avoid weak vtable.
-
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyMessageExtension);
};
struct Extension {
@@ -572,89 +565,9 @@ class LIBPROTOBUF_EXPORT ExtensionSet {
int GetSize() const;
void Free();
size_t SpaceUsedExcludingSelfLong() const;
- bool IsInitialized() const;
- };
-
- // The Extension struct is small enough to be passed by value, so we use it
- // directly as the value type in mappings rather than use pointers. We use
- // sorted maps rather than hash-maps because we expect most ExtensionSets will
- // only contain a small number of extension. Also, we want AppendToList and
- // deterministic serialization to order fields by field number.
-
- struct KeyValue {
- int first;
- Extension second;
-
- struct FirstComparator {
- bool operator()(const KeyValue& lhs, const KeyValue& rhs) const {
- return lhs.first < rhs.first;
- }
- bool operator()(const KeyValue& lhs, int key) const {
- return lhs.first < key;
- }
- bool operator()(int key, const KeyValue& rhs) const {
- return key < rhs.first;
- }
- };
};
+ typedef std::map<int, Extension> ExtensionMap;
- typedef std::map<int, Extension> LargeMap;
-
- // Wrapper API that switches between flat-map and LargeMap.
-
- // Finds a key (if present) in the ExtensionSet.
- const Extension* FindOrNull(int key) const;
- Extension* FindOrNull(int key);
-
- // Helper-functions that only inspect the LargeMap.
- const Extension* FindOrNullInLargeMap(int key) const;
- Extension* FindOrNullInLargeMap(int key);
-
- // Inserts a new (key, Extension) into the ExtensionSet (and returns true), or
- // finds the already-existing Extension for that key (returns false).
- // The Extension* will point to the new-or-found Extension.
- std::pair<Extension*, bool> Insert(int key);
-
- // Grows the flat_capacity_.
- // If flat_capacity_ > kMaximumFlatCapacity, converts to LargeMap.
- void GrowCapacity(size_t minimum_new_capacity);
- static constexpr uint16 kMaximumFlatCapacity = 256;
- bool is_large() const { return flat_capacity_ > kMaximumFlatCapacity; }
-
- // Removes a key from the ExtensionSet.
- void Erase(int key);
-
- size_t Size() const {
- return GOOGLE_PREDICT_FALSE(is_large()) ? map_.large->size() : flat_size_;
- }
-
- // Similar to std::for_each.
- // Each Iterator is decomposed into ->first and ->second fields, so
- // that the KeyValueFunctor can be agnostic vis-a-vis KeyValue-vs-std::pair.
- template <typename Iterator, typename KeyValueFunctor>
- static KeyValueFunctor ForEach(Iterator begin, Iterator end,
- KeyValueFunctor func) {
- for (Iterator it = begin; it != end; ++it) func(it->first, it->second);
- return std::move(func);
- }
-
- // Applies a functor to the <int, Extension&> pairs in sorted order.
- template <typename KeyValueFunctor>
- KeyValueFunctor ForEach(KeyValueFunctor func) {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- return ForEach(map_.large->begin(), map_.large->end(), std::move(func));
- }
- return ForEach(flat_begin(), flat_end(), std::move(func));
- }
-
- // Applies a functor to the <int, const Extension&> pairs in sorted order.
- template <typename KeyValueFunctor>
- KeyValueFunctor ForEach(KeyValueFunctor func) const {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- return ForEach(map_.large->begin(), map_.large->end(), std::move(func));
- }
- return ForEach(flat_begin(), flat_end(), std::move(func));
- }
// Merges existing Extension from other_extension
void InternalExtensionMergeFrom(int number, const Extension& other_extension);
@@ -718,38 +631,14 @@ class LIBPROTOBUF_EXPORT ExtensionSet {
static inline size_t RepeatedMessage_SpaceUsedExcludingSelfLong(
RepeatedPtrFieldBase* field);
- KeyValue* flat_begin() {
- assert(!is_large());
- return map_.flat;
- }
- const KeyValue* flat_begin() const {
- assert(!is_large());
- return map_.flat;
- }
- KeyValue* flat_end() {
- assert(!is_large());
- return map_.flat + flat_size_;
- }
- const KeyValue* flat_end() const {
- assert(!is_large());
- return map_.flat + flat_size_;
- }
-
+ // The Extension struct is small enough to be passed by value, so we use it
+ // directly as the value type in the map rather than use pointers. We use
+ // a map rather than hash_map here because we expect most ExtensionSets will
+ // only contain a small number of extensions whereas hash_map is optimized
+ // for 100 elements or more. Also, we want AppendToList() to order fields
+ // by field number.
+ ExtensionMap extensions_;
::google::protobuf::Arena* arena_;
-
- // Manual memory-management:
- // map_.flat is an allocated array of flat_capacity_ elements.
- // [map_.flat, map_.flat + flat_size_) is the currently-in-use prefix.
- uint16 flat_capacity_;
- uint16 flat_size_;
- union AllocatedData {
- KeyValue* flat;
-
- // If flat_capacity_ > kMaximumFlatCapacity, switch to LargeMap,
- // which guarantees O(n lg n) CPU but larger constant factors.
- LargeMap* large;
- } map_;
-
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionSet);
};
@@ -808,10 +697,6 @@ inline void ExtensionSet::AddString(int number, FieldType type,
// ExtensionSet* set);
// static inline void Add(int number, ConstType value, ExtensionSet* set);
// static inline MutableType Add(int number, ExtensionSet* set);
-// This is used by the ExtensionIdentifier constructor to register
-// the extension at dynamic initialization.
-// template <typename ExtendeeT>
-// static void Register(int number, FieldType type, bool is_packed);
// };
//
// Not all of these methods make sense for all field types. For example, the
@@ -843,11 +728,6 @@ class PrimitiveTypeTraits {
ConstType default_value);
static inline void Set(int number, FieldType field_type,
ConstType value, ExtensionSet* set);
- template <typename ExtendeeT>
- static void Register(int number, FieldType type, bool is_packed) {
- ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number,
- type, false, is_packed);
- }
};
template <typename Type>
@@ -871,11 +751,6 @@ class RepeatedPrimitiveTypeTraits {
bool is_packed, ExtensionSet* set);
static const RepeatedFieldType* GetDefaultRepeatedField();
- template <typename ExtendeeT>
- static void Register(int number, FieldType type, bool is_packed) {
- ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number,
- type, true, is_packed);
- }
};
LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_primitive_generic_type_traits_once_init_;
@@ -973,11 +848,6 @@ class LIBPROTOBUF_EXPORT StringTypeTraits {
ExtensionSet* set) {
return set->MutableString(number, field_type, NULL);
}
- template <typename ExtendeeT>
- static void Register(int number, FieldType type, bool is_packed) {
- ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number,
- type, false, is_packed);
- }
};
LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_string_type_traits_once_init_;
@@ -1030,12 +900,6 @@ class LIBPROTOBUF_EXPORT RepeatedStringTypeTraits {
return default_repeated_field_;
}
- template <typename ExtendeeT>
- static void Register(int number, FieldType type, bool is_packed) {
- ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number,
- type, true, is_packed);
- }
-
private:
static void InitializeDefaultRepeatedFields();
static void DestroyDefaultRepeatedFields();
@@ -1063,11 +927,6 @@ class EnumTypeTraits {
GOOGLE_DCHECK(IsValid(value));
set->SetEnum(number, field_type, value, NULL);
}
- template <typename ExtendeeT>
- static void Register(int number, FieldType type, bool is_packed) {
- ExtensionSet::RegisterEnumExtension(&ExtendeeT::default_instance(), number,
- type, false, is_packed, IsValid);
- }
};
template <typename Type, bool IsValid(int)>
@@ -1121,11 +980,6 @@ class RepeatedEnumTypeTraits {
return reinterpret_cast<const RepeatedField<Type>*>(
RepeatedPrimitiveTypeTraits<int32>::GetDefaultRepeatedField());
}
- template <typename ExtendeeT>
- static void Register(int number, FieldType type, bool is_packed) {
- ExtensionSet::RegisterEnumExtension(&ExtendeeT::default_instance(), number,
- type, true, is_packed, IsValid);
- }
};
// -------------------------------------------------------------------
@@ -1171,12 +1025,6 @@ class MessageTypeTraits {
return static_cast<Type*>(set->UnsafeArenaReleaseMessage(
number, Type::default_instance()));
}
- template <typename ExtendeeT>
- static void Register(int number, FieldType type, bool is_packed) {
- ExtensionSet::RegisterMessageExtension(&ExtendeeT::default_instance(),
- number, type, false, is_packed,
- &Type::default_instance());
- }
};
// forward declaration
@@ -1222,12 +1070,6 @@ class RepeatedMessageTypeTraits {
}
static const RepeatedFieldType* GetDefaultRepeatedField();
- template <typename ExtendeeT>
- static void Register(int number, FieldType type, bool is_packed) {
- ExtensionSet::RegisterMessageExtension(&ExtendeeT::default_instance(),
- number, type, true, is_packed,
- &Type::default_instance());
- }
};
LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_message_generic_type_traits_once_init_;
@@ -1236,7 +1078,7 @@ LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_message_generic_type_traits_
// message-type repeated field extensions.
class LIBPROTOBUF_EXPORT RepeatedMessageGenericTypeTraits {
public:
- typedef RepeatedPtrField<::google::protobuf::MessageLite*> RepeatedFieldType;
+ typedef RepeatedPtrField< ::google::protobuf::MessageLite*> RepeatedFieldType;
private:
template<typename Type> friend class RepeatedMessageTypeTraits;
static void InitializeDefaultRepeatedFields();
@@ -1279,18 +1121,12 @@ class ExtensionIdentifier {
typedef ExtendeeType Extendee;
ExtensionIdentifier(int number, typename TypeTraits::ConstType default_value)
- : number_(number), default_value_(default_value) {
- Register(number);
- }
+ : number_(number), default_value_(default_value) {}
inline int number() const { return number_; }
typename TypeTraits::ConstType default_value() const {
return default_value_;
}
- static void Register(int number) {
- TypeTraits::template Register<ExtendeeType>(number, field_type, is_packed);
- }
-
private:
const int number_;
typename TypeTraits::ConstType default_value_;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/extension_set_heavy.cc b/third_party/protobuf/3.4.0/src/google/protobuf/extension_set_heavy.cc
index a3c841671f..f545fe30f9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/extension_set_heavy.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/extension_set_heavy.cc
@@ -35,15 +35,12 @@
// Contains methods defined in extension_set.h which cannot be part of the
// lite library because they use descriptors or reflection.
-#include <google/protobuf/stubs/casts.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h>
-#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/wire_format_lite_inl.h>
@@ -96,14 +93,16 @@ class DescriptorPoolExtensionFinder : public ExtensionFinder {
};
void ExtensionSet::AppendToList(
- const Descriptor* containing_type, const DescriptorPool* pool,
+ const Descriptor* containing_type,
+ const DescriptorPool* pool,
std::vector<const FieldDescriptor*>* output) const {
- ForEach([containing_type, pool, &output](int number, const Extension& ext) {
+ for (ExtensionMap::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
bool has = false;
- if (ext.is_repeated) {
- has = ext.GetSize() > 0;
+ if (iter->second.is_repeated) {
+ has = iter->second.GetSize() > 0;
} else {
- has = !ext.is_cleared;
+ has = !iter->second.is_cleared;
}
if (has) {
@@ -112,13 +111,14 @@ void ExtensionSet::AppendToList(
// initialized, so they might not even be constructed until
// AppendToList() is called.
- if (ext.descriptor == NULL) {
- output->push_back(pool->FindExtensionByNumber(containing_type, number));
+ if (iter->second.descriptor == NULL) {
+ output->push_back(pool->FindExtensionByNumber(
+ containing_type, iter->first));
} else {
- output->push_back(ext.descriptor);
+ output->push_back(iter->second.descriptor);
}
}
- });
+ }
}
inline FieldDescriptor::Type real_type(FieldType type) {
@@ -145,17 +145,17 @@ inline WireFormatLite::FieldType field_type(FieldType type) {
const MessageLite& ExtensionSet::GetMessage(int number,
const Descriptor* message_type,
MessageFactory* factory) const {
- const Extension* extension = FindOrNull(number);
- if (extension == NULL || extension->is_cleared) {
+ ExtensionMap::const_iterator iter = extensions_.find(number);
+ if (iter == extensions_.end() || iter->second.is_cleared) {
// Not present. Return the default value.
return *factory->GetPrototype(message_type);
} else {
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
- if (extension->is_lazy) {
- return extension->lazymessage_value->GetMessage(
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, MESSAGE);
+ if (iter->second.is_lazy) {
+ return iter->second.lazymessage_value->GetMessage(
*factory->GetPrototype(message_type));
} else {
- return *extension->message_value;
+ return *iter->second.message_value;
}
}
}
@@ -188,51 +188,51 @@ MessageLite* ExtensionSet::MutableMessage(const FieldDescriptor* descriptor,
MessageLite* ExtensionSet::ReleaseMessage(const FieldDescriptor* descriptor,
MessageFactory* factory) {
- Extension* extension = FindOrNull(descriptor->number());
- if (extension == NULL) {
+ ExtensionMap::iterator iter = extensions_.find(descriptor->number());
+ if (iter == extensions_.end()) {
// Not present. Return NULL.
return NULL;
} else {
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, MESSAGE);
MessageLite* ret = NULL;
- if (extension->is_lazy) {
- ret = extension->lazymessage_value->ReleaseMessage(
+ if (iter->second.is_lazy) {
+ ret = iter->second.lazymessage_value->ReleaseMessage(
*factory->GetPrototype(descriptor->message_type()));
if (arena_ == NULL) {
- delete extension->lazymessage_value;
+ delete iter->second.lazymessage_value;
}
} else {
if (arena_ != NULL) {
- ret = extension->message_value->New();
- ret->CheckTypeAndMergeFrom(*extension->message_value);
+ ret = (iter->second.message_value)->New();
+ ret->CheckTypeAndMergeFrom(*(iter->second.message_value));
} else {
- ret = extension->message_value;
+ ret = iter->second.message_value;
}
}
- Erase(descriptor->number());
+ extensions_.erase(descriptor->number());
return ret;
}
}
MessageLite* ExtensionSet::UnsafeArenaReleaseMessage(
const FieldDescriptor* descriptor, MessageFactory* factory) {
- Extension* extension = FindOrNull(descriptor->number());
- if (extension == NULL) {
+ ExtensionMap::iterator iter = extensions_.find(descriptor->number());
+ if (iter == extensions_.end()) {
// Not present. Return NULL.
return NULL;
} else {
- GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
+ GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, MESSAGE);
MessageLite* ret = NULL;
- if (extension->is_lazy) {
- ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(
+ if (iter->second.is_lazy) {
+ ret = iter->second.lazymessage_value->UnsafeArenaReleaseMessage(
*factory->GetPrototype(descriptor->message_type()));
if (arena_ == NULL) {
- delete extension->lazymessage_value;
+ delete iter->second.lazymessage_value;
}
} else {
- ret = extension->message_value;
+ ret = iter->second.message_value;
}
- Erase(descriptor->number());
+ extensions_.erase(descriptor->number());
return ret;
}
}
@@ -257,10 +257,8 @@ 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 =
- reinterpret_cast<::google::protobuf::internal::RepeatedPtrFieldBase*>(
- extension->repeated_message_value)
- ->AddFromCleared<GenericTypeHandler<MessageLite> >();
+ MessageLite* result = extension->repeated_message_value
+ ->AddFromCleared<GenericTypeHandler<MessageLite> >();
if (result == NULL) {
const MessageLite* prototype;
if (extension->repeated_message_value->size() == 0) {
@@ -347,10 +345,14 @@ int ExtensionSet::SpaceUsedExcludingSelf() const {
}
size_t ExtensionSet::SpaceUsedExcludingSelfLong() const {
- size_t total_size = Size() * sizeof(KeyValue);
- ForEach([&total_size](int /* number */, const Extension& ext) {
- total_size += ext.SpaceUsedExcludingSelfLong();
- });
+ size_t total_size =
+ extensions_.size() * sizeof(ExtensionMap::value_type);
+ for (ExtensionMap::const_iterator iter = extensions_.begin(),
+ end = extensions_.end();
+ iter != end;
+ ++iter) {
+ total_size += iter->second.SpaceUsedExcludingSelfLong();
+ }
return total_size;
}
@@ -387,9 +389,7 @@ size_t ExtensionSet::Extension::SpaceUsedExcludingSelfLong() const {
// type handler.
total_size +=
sizeof(*repeated_message_value) +
- RepeatedMessage_SpaceUsedExcludingSelfLong(
- reinterpret_cast<::google::protobuf::internal::RepeatedPtrFieldBase*>(
- repeated_message_value));
+ RepeatedMessage_SpaceUsedExcludingSelfLong(repeated_message_value);
break;
}
} else {
@@ -432,33 +432,25 @@ uint8* ExtensionSet::SerializeMessageSetWithCachedSizesToArray(
}
uint8* ExtensionSet::InternalSerializeWithCachedSizesToArray(
- int start_field_number, int end_field_number, bool deterministic,
- uint8* target) const {
- if (GOOGLE_PREDICT_FALSE(is_large())) {
- const auto& end = map_.large->end();
- for (auto it = map_.large->lower_bound(start_field_number);
- it != end && it->first < end_field_number; ++it) {
- target = it->second.InternalSerializeFieldWithCachedSizesToArray(
- it->first, deterministic, target);
- }
- return target;
- }
- const KeyValue* end = flat_end();
- for (const KeyValue* it = std::lower_bound(
- flat_begin(), end, start_field_number, KeyValue::FirstComparator());
- it != end && it->first < end_field_number; ++it) {
- target = it->second.InternalSerializeFieldWithCachedSizesToArray(
- it->first, deterministic, target);
+ int start_field_number, int end_field_number,
+ bool deterministic, uint8* target) const {
+ ExtensionMap::const_iterator iter;
+ for (iter = extensions_.lower_bound(start_field_number);
+ iter != extensions_.end() && iter->first < end_field_number;
+ ++iter) {
+ target = iter->second.InternalSerializeFieldWithCachedSizesToArray(
+ iter->first, deterministic, target);
}
return target;
}
uint8* ExtensionSet::InternalSerializeMessageSetWithCachedSizesToArray(
bool deterministic, uint8* target) const {
- ForEach([deterministic, &target](int number, const Extension& ext) {
- target = ext.InternalSerializeMessageSetItemWithCachedSizesToArray(
- number, deterministic, target);
- });
+ ExtensionMap::const_iterator iter;
+ for (iter = extensions_.begin(); iter != extensions_.end(); ++iter) {
+ target = iter->second.InternalSerializeMessageSetItemWithCachedSizesToArray(
+ iter->first, deterministic, target);
+ }
return target;
}
@@ -497,10 +489,10 @@ uint8* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray(
HANDLE_TYPE( ENUM, Enum, enum);
#undef HANDLE_TYPE
- case FieldDescriptor::TYPE_STRING:
- case FieldDescriptor::TYPE_BYTES:
- case FieldDescriptor::TYPE_GROUP:
- case FieldDescriptor::TYPE_MESSAGE:
+ case WireFormatLite::TYPE_STRING:
+ case WireFormatLite::TYPE_BYTES:
+ case WireFormatLite::TYPE_GROUP:
+ case WireFormatLite::TYPE_MESSAGE:
GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed.";
break;
}
@@ -785,9 +777,9 @@ size_t ExtensionSet::Extension::MessageSetItemByteSize(int number) const {
// message
size_t message_size = 0;
if (is_lazy) {
- message_size = lazymessage_value->ByteSizeLong();
+ message_size = lazymessage_value->ByteSize();
} else {
- message_size = message_value->ByteSizeLong();
+ message_size = message_value->ByteSize();
}
our_size += io::CodedOutputStream::VarintSize32(message_size);
@@ -798,16 +790,20 @@ size_t ExtensionSet::Extension::MessageSetItemByteSize(int number) const {
void ExtensionSet::SerializeMessageSetWithCachedSizes(
io::CodedOutputStream* output) const {
- ForEach([output](int number, const Extension& ext) {
- ext.SerializeMessageSetItemWithCachedSizes(number, output);
- });
+ for (ExtensionMap::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ iter->second.SerializeMessageSetItemWithCachedSizes(iter->first, output);
+ }
}
size_t ExtensionSet::MessageSetByteSize() const {
size_t total_size = 0;
- ForEach([&total_size](int number, const Extension& ext) {
- total_size += ext.MessageSetItemByteSize(number);
- });
+
+ for (ExtensionMap::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ total_size += iter->second.MessageSetItemByteSize(iter->first);
+ }
+
return total_size;
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/extension_set_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/extension_set_unittest.cc
index bc65d29506..3e71b253b2 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/extension_set_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/extension_set_unittest.cc
@@ -32,20 +32,19 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
-#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/stubs/strutil.h>
-#include <google/protobuf/test_util.h>
+#include <google/protobuf/extension_set.h>
#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/unittest_mset.pb.h>
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/test_util.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/dynamic_message.h>
-#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -286,7 +285,7 @@ TEST(ExtensionSetTest, CopyFrom) {
TestUtil::ExpectAllExtensionsSet(message2);
}
-TEST(ExtensionSetTest, CopyFromPacked) {
+TEST(ExtensioSetTest, CopyFromPacked) {
unittest::TestPackedExtensions message1, message2;
TestUtil::SetPackedExtensions(&message1);
@@ -445,7 +444,7 @@ TEST(ExtensionSetTest, ArenaSetAllocatedMessageAndRelease) {
TEST(ExtensionSetTest, SwapExtensionBothFullWithArena) {
::google::protobuf::Arena arena1;
- std::unique_ptr<google::protobuf::Arena> arena2(new ::google::protobuf::Arena());
+ google::protobuf::scoped_ptr<google::protobuf::Arena> arena2(new ::google::protobuf::Arena());
unittest::TestAllExtensions* message1 =
Arena::CreateMessage<unittest::TestAllExtensions>(&arena1);
@@ -602,26 +601,6 @@ TEST(ExtensionSetTest, PackedSerializationToStream) {
TestUtil::ExpectPackedFieldsSet(destination);
}
-TEST(ExtensionSetTest, NestedExtensionGroup) {
- // Serialize as TestGroup and parse as TestGroupExtension.
- unittest::TestGroup source;
- unittest::TestGroupExtension destination;
- string data;
-
- source.mutable_optionalgroup()->set_a(117);
- source.set_optional_foreign_enum(unittest::FOREIGN_BAZ);
- source.SerializeToString(&data);
- EXPECT_TRUE(destination.ParseFromString(data));
- EXPECT_TRUE(destination.GetExtension(
- unittest::TestNestedExtension::optionalgroup_extension).has_a());
- EXPECT_EQ(117, destination.GetExtension(
- unittest::TestNestedExtension::optionalgroup_extension).a());
- EXPECT_TRUE(destination.HasExtension(
- unittest::TestNestedExtension::optional_foreign_enum_extension));
- EXPECT_EQ(unittest::FOREIGN_BAZ, destination.GetExtension(
- unittest::TestNestedExtension::optional_foreign_enum_extension));
-}
-
TEST(ExtensionSetTest, Parsing) {
// Serialize as TestAllTypes and parse as TestAllExtensions.
unittest::TestAllTypes source;
@@ -813,16 +792,11 @@ 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) * \
- (message.GetRepeatedExtension(unittest::repeated_##type##_extension) \
- .Capacity() - old_capacity) + empty_repeated_field_size; \
+ int expected_size = sizeof(cpptype) * (16 - \
+ kMinRepeatedFieldAllocationSize) + empty_repeated_field_size; \
EXPECT_LE(expected_size, message.SpaceUsed()) << #type; \
} while (0)
@@ -1019,8 +993,8 @@ TEST(ExtensionSetTest, RepeatedFields) {
ASSERT_EQ(110, SumAllExtensions<double>(
message, unittest::repeated_double_extension, 0));
- RepeatedPtrField<::std::string>::iterator string_iter;
- RepeatedPtrField<::std::string>::iterator string_end;
+ RepeatedPtrField< ::std::string>::iterator string_iter;
+ RepeatedPtrField< ::std::string>::iterator string_end;
for (string_iter = message.MutableRepeatedExtension(
unittest::repeated_string_extension)->begin(),
string_end = message.MutableRepeatedExtension(
@@ -1028,8 +1002,8 @@ TEST(ExtensionSetTest, RepeatedFields) {
string_iter != string_end; ++string_iter) {
*string_iter += "test";
}
- RepeatedPtrField<::std::string>::const_iterator string_const_iter;
- RepeatedPtrField<::std::string>::const_iterator string_const_end;
+ RepeatedPtrField< ::std::string>::const_iterator string_const_iter;
+ RepeatedPtrField< ::std::string>::const_iterator string_const_end;
for (string_const_iter = message.GetRepeatedExtension(
unittest::repeated_string_extension).begin(),
string_const_end = message.GetRepeatedExtension(
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/field_mask.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/field_mask.pb.cc
index 000fa8d33a..afc3db56e7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/field_mask.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/field_mask.pb.cc
@@ -1,91 +1,107 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/field_mask.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/field_mask.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
class FieldMaskDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<FieldMask>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<FieldMask>
+ _instance;
} _FieldMask_default_instance_;
-} // namespace protobuf
-} // namespace google
+
namespace protobuf_google_2fprotobuf_2ffield_5fmask_2eproto {
-static void InitDefaultsFieldMask() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::_FieldMask_default_instance_;
- new (ptr) ::google::protobuf::FieldMask();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::FieldMask::InitAsDefaultInstance();
-}
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_FieldMask =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsFieldMask}, {}};
-
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_FieldMask.base);
-}
+namespace {
::google::protobuf::Metadata file_level_metadata[1];
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+} // namespace
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldMask, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldMask, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldMask, paths_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldMask, paths_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::FieldMask)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(FieldMask)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FieldMask_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_FieldMask_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/field_mask.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/field_mask.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _FieldMask_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_FieldMask_default_instance_);}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n google/protobuf/field_mask.proto\022\017goog"
"le.protobuf\"\032\n\tFieldMask\022\r\n\005paths\030\001 \003(\tB"
"\211\001\n\023com.google.protobufB\016FieldMaskProtoP"
@@ -98,10 +114,11 @@ void AddDescriptorsImpl() {
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/field_mask.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -109,34 +126,35 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2ffield_5fmask_2eproto
-namespace google {
-namespace protobuf {
+
// ===================================================================
-void FieldMask::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FieldMask::kPathsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FieldMask::FieldMask()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::scc_info_FieldMask.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FieldMask)
}
FieldMask::FieldMask(const FieldMask& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- paths_(from.paths_) {
+ paths_(from.paths_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.FieldMask)
}
void FieldMask::SharedCtor() {
+ _cached_size_ = 0;
}
FieldMask::~FieldMask() {
@@ -148,18 +166,27 @@ void FieldMask::SharedDtor() {
}
void FieldMask::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FieldMask::descriptor() {
- ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FieldMask& FieldMask::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::scc_info_FieldMask.base);
+ protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::InitDefaults();
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)
@@ -177,7 +204,7 @@ bool FieldMask::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FieldMask)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -284,7 +311,9 @@ size_t FieldMask::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -337,24 +366,92 @@ void FieldMask::Swap(FieldMask* other) {
}
void FieldMask::InternalSwap(FieldMask* other) {
using std::swap;
- paths_.InternalSwap(CastToBase(&other->paths_));
+ paths_.InternalSwap(&other->paths_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata FieldMask::GetMetadata() const {
protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// FieldMask
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FieldMask* Arena::CreateMaybeMessage< ::google::protobuf::FieldMask >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::FieldMask >(arena);
+// repeated string paths = 1;
+int FieldMask::paths_size() const {
+ return paths_.size();
+}
+void FieldMask::clear_paths() {
+ paths_.Clear();
+}
+const ::std::string& FieldMask::paths(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldMask.paths)
+ return paths_.Get(index);
+}
+::std::string* FieldMask::mutable_paths(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldMask.paths)
+ return paths_.Mutable(index);
+}
+void FieldMask::set_paths(int index, const ::std::string& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldMask.paths)
+ paths_.Mutable(index)->assign(value);
+}
+#if LANG_CXX11
+void FieldMask::set_paths(int index, ::std::string&& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldMask.paths)
+ paths_.Mutable(index)->assign(std::move(value));
+}
+#endif
+void FieldMask::set_paths(int index, const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ paths_.Mutable(index)->assign(value);
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FieldMask.paths)
+}
+void FieldMask::set_paths(int index, const char* value, size_t size) {
+ paths_.Mutable(index)->assign(
+ reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldMask.paths)
+}
+::std::string* FieldMask::add_paths() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.FieldMask.paths)
+ return paths_.Add();
+}
+void FieldMask::add_paths(const ::std::string& value) {
+ paths_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.FieldMask.paths)
+}
+#if LANG_CXX11
+void FieldMask::add_paths(::std::string&& value) {
+ paths_.Add(std::move(value));
+ // @@protoc_insertion_point(field_add:google.protobuf.FieldMask.paths)
+}
+#endif
+void FieldMask::add_paths(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ paths_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add_char:google.protobuf.FieldMask.paths)
}
+void FieldMask::add_paths(const char* value, size_t size) {
+ paths_.Add()->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_add_pointer:google.protobuf.FieldMask.paths)
+}
+const ::google::protobuf::RepeatedPtrField< ::std::string>&
+FieldMask::paths() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.FieldMask.paths)
+ return paths_;
+}
+::google::protobuf::RepeatedPtrField< ::std::string>*
+FieldMask::mutable_paths() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldMask.paths)
+ return &paths_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/field_mask.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/field_mask.pb.h
index 7550f7a97f..b8f10389d3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/field_mask.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/field_mask.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/field_mask.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2ffield_5fmask_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2ffield_5fmask_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,41 +24,37 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2ffield_5fmask_2eproto LIBPROTOBUF_EXPORT
+namespace google {
+namespace protobuf {
+class FieldMask;
+class FieldMaskDefaultTypeInternal;
+LIBPROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_;
+} // namespace protobuf
+} // namespace google
+
+namespace google {
+namespace protobuf {
namespace protobuf_google_2fprotobuf_2ffield_5fmask_2eproto {
-// Internal implementation detail -- do not use these members.
+// Internal implementation detail -- do not call these.
struct LIBPROTOBUF_EXPORT TableStruct {
static const ::google::protobuf::internal::ParseTableField entries[];
static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[1];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
+ static void InitDefaultsImpl();
};
void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
} // namespace protobuf_google_2fprotobuf_2ffield_5fmask_2eproto
-namespace google {
-namespace protobuf {
-class FieldMask;
-class FieldMaskDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::FieldMask* Arena::CreateMaybeMessage<::google::protobuf::FieldMask>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
// ===================================================================
@@ -91,12 +87,11 @@ class LIBPROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message /* @@pro
static const ::google::protobuf::Descriptor* descriptor();
static const FieldMask& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FieldMask* internal_default_instance() {
return reinterpret_cast<const FieldMask*>(
&_FieldMask_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void Swap(FieldMask* other);
@@ -106,33 +101,28 @@ class LIBPROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline FieldMask* New() const final {
- return CreateMaybeMessage<FieldMask>(NULL);
- }
+ inline FieldMask* New() const PROTOBUF_FINAL { return New(NULL); }
- FieldMask* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<FieldMask>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ FieldMask* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FieldMask& from);
void MergeFrom(const FieldMask& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(FieldMask* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -143,7 +133,7 @@ class LIBPROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message /* @@pro
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -176,14 +166,15 @@ class LIBPROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message /* @@pro
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::RepeatedPtrField< ::std::string> paths_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -262,12 +253,14 @@ FieldMask::mutable_paths() {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2ffield_5fmask_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/field_mask.proto b/third_party/protobuf/3.4.0/src/google/protobuf/field_mask.proto
new file mode 100644
index 0000000000..c68d247c8a
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/field_mask.proto
@@ -0,0 +1,246 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "FieldMaskProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";
+
+// `FieldMask` represents a set of symbolic field paths, for example:
+//
+// paths: "f.a"
+// paths: "f.b.d"
+//
+// Here `f` represents a field in some root message, `a` and `b`
+// fields in the message found in `f`, and `d` a field found in the
+// message in `f.b`.
+//
+// Field masks are used to specify a subset of fields that should be
+// returned by a get operation or modified by an update operation.
+// Field masks also have a custom JSON encoding (see below).
+//
+// # Field Masks in Projections
+//
+// When used in the context of a projection, a response message or
+// sub-message is filtered by the API to only contain those fields as
+// specified in the mask. For example, if the mask in the previous
+// example is applied to a response message as follows:
+//
+// f {
+// a : 22
+// b {
+// d : 1
+// x : 2
+// }
+// y : 13
+// }
+// z: 8
+//
+// The result will not contain specific values for fields x,y and z
+// (their value will be set to the default, and omitted in proto text
+// output):
+//
+//
+// f {
+// a : 22
+// b {
+// d : 1
+// }
+// }
+//
+// A repeated field is not allowed except at the last position of a
+// paths string.
+//
+// If a FieldMask object is not present in a get operation, the
+// operation applies to all fields (as if a FieldMask of all fields
+// had been specified).
+//
+// Note that a field mask does not necessarily apply to the
+// top-level response message. In case of a REST get operation, the
+// field mask applies directly to the response, but in case of a REST
+// list operation, the mask instead applies to each individual message
+// in the returned resource list. In case of a REST custom method,
+// other definitions may be used. Where the mask applies will be
+// clearly documented together with its declaration in the API. In
+// any case, the effect on the returned resource/resources is required
+// behavior for APIs.
+//
+// # Field Masks in Update Operations
+//
+// A field mask in update operations specifies which fields of the
+// targeted resource are going to be updated. The API is required
+// to only change the values of the fields as specified in the mask
+// and leave the others untouched. If a resource is passed in to
+// describe the updated values, the API ignores the values of all
+// fields not covered by the mask.
+//
+// If a repeated field is specified for an update operation, the existing
+// repeated values in the target resource will be overwritten by the new values.
+// Note that a repeated field is only allowed in the last position of a `paths`
+// string.
+//
+// If a sub-message is specified in the last position of the field mask for an
+// update operation, then the existing sub-message in the target resource is
+// overwritten. Given the target message:
+//
+// f {
+// b {
+// d : 1
+// x : 2
+// }
+// c : 1
+// }
+//
+// And an update message:
+//
+// f {
+// b {
+// d : 10
+// }
+// }
+//
+// then if the field mask is:
+//
+// paths: "f.b"
+//
+// then the result will be:
+//
+// f {
+// b {
+// d : 10
+// }
+// c : 1
+// }
+//
+// However, if the update mask was:
+//
+// paths: "f.b.d"
+//
+// then the result would be:
+//
+// f {
+// b {
+// d : 10
+// x : 2
+// }
+// c : 1
+// }
+//
+// In order to reset a field's value to the default, the field must
+// be in the mask and set to the default value in the provided resource.
+// Hence, in order to reset all fields of a resource, provide a default
+// instance of the resource and set all fields in the mask, or do
+// not provide a mask as described below.
+//
+// If a field mask is not present on update, the operation applies to
+// all fields (as if a field mask of all fields has been specified).
+// Note that in the presence of schema evolution, this may mean that
+// fields the client does not know and has therefore not filled into
+// the request will be reset to their default. If this is unwanted
+// behavior, a specific service may require a client to always specify
+// a field mask, producing an error if not.
+//
+// As with get operations, the location of the resource which
+// describes the updated values in the request message depends on the
+// operation kind. In any case, the effect of the field mask is
+// required to be honored by the API.
+//
+// ## Considerations for HTTP REST
+//
+// The HTTP kind of an update operation which uses a field mask must
+// be set to PATCH instead of PUT in order to satisfy HTTP semantics
+// (PUT must only be used for full updates).
+//
+// # JSON Encoding of Field Masks
+//
+// In JSON, a field mask is encoded as a single string where paths are
+// separated by a comma. Fields name in each path are converted
+// to/from lower-camel naming conventions.
+//
+// As an example, consider the following message declarations:
+//
+// message Profile {
+// User user = 1;
+// Photo photo = 2;
+// }
+// message User {
+// string display_name = 1;
+// string address = 2;
+// }
+//
+// In proto a field mask for `Profile` may look as such:
+//
+// mask {
+// paths: "user.display_name"
+// paths: "photo"
+// }
+//
+// In JSON, the same mask is represented as below:
+//
+// {
+// mask: "user.displayName,photo"
+// }
+//
+// # Field Masks and Oneof Fields
+//
+// Field masks treat fields in oneofs just as regular fields. Consider the
+// following message:
+//
+// message SampleMessage {
+// oneof test_oneof {
+// string name = 4;
+// SubMessage sub_message = 9;
+// }
+// }
+//
+// The field mask can be:
+//
+// mask {
+// paths: "name"
+// }
+//
+// Or:
+//
+// mask {
+// paths: "sub_message"
+// }
+//
+// Note that oneof type names ("test_oneof" in this case) cannot be used in
+// paths.
+message FieldMask {
+ // The set of field mask paths.
+ repeated string paths = 1;
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_enum_reflection.h b/third_party/protobuf/3.4.0/src/google/protobuf/generated_enum_reflection.h
index 983d3185b9..fdcdc27790 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_enum_reflection.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_enum_reflection.h
@@ -41,6 +41,7 @@
#include <string>
+#include <google/protobuf/stubs/template_util.h>
#include <google/protobuf/generated_enum_util.h>
namespace google {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_enum_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/generated_enum_util.h
index 96b03cc916..e4242055e9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_enum_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_enum_util.h
@@ -31,14 +31,14 @@
#ifndef GOOGLE_PROTOBUF_GENERATED_ENUM_UTIL_H__
#define GOOGLE_PROTOBUF_GENERATED_ENUM_UTIL_H__
-#include <type_traits>
+#include <google/protobuf/stubs/template_util.h>
namespace google {
namespace protobuf {
// This type trait can be used to cause templates to only match proto2 enum
// types.
-template <typename T> struct is_proto_enum : ::std::false_type {};
+template <typename T> struct is_proto_enum : ::google::protobuf::internal::false_type {};
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection.cc b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection.cc
index 247f772c04..263d52ab0c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection.cc
@@ -42,7 +42,6 @@
#include <google/protobuf/extension_set.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/map_field.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/wire_format.h>
@@ -291,13 +290,6 @@ size_t GeneratedMessageReflection::SpaceUsedLong(const Message& message) const {
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
case FieldOptions::STRING: {
- if (IsInlined(field)) {
- const string* ptr =
- &GetField<InlinedStringField>(message, field).GetNoArena();
- total_size += StringSpaceUsedExcludingSelfLong(*ptr);
- break;
- }
-
// Initially, the string points to the default value stored in
// the prototype. Only count the string if it has been changed
// from the default value.
@@ -432,25 +424,15 @@ void GeneratedMessageReflection::SwapField(
{
Arena* arena1 = GetArena(message1);
Arena* arena2 = GetArena(message2);
-
- if (IsInlined(field)) {
- InlinedStringField* string1 =
- MutableRaw<InlinedStringField>(message1, field);
- InlinedStringField* string2 =
- MutableRaw<InlinedStringField>(message2, field);
- string1->Swap(string2);
- break;
- }
-
ArenaStringPtr* string1 =
MutableRaw<ArenaStringPtr>(message1, field);
ArenaStringPtr* string2 =
MutableRaw<ArenaStringPtr>(message2, field);
- const string* default_ptr =
- &DefaultRaw<ArenaStringPtr>(field).Get();
if (arena1 == arena2) {
- string1->Swap(string2, default_ptr, arena1);
+ string1->Swap(string2);
} else {
+ const string* default_ptr =
+ &DefaultRaw<ArenaStringPtr>(field).Get();
const string temp = string1->Get();
string1->Set(default_ptr, string2->Get(), arena1);
string2->Set(default_ptr, temp, arena2);
@@ -756,15 +738,7 @@ int GeneratedMessageReflection::FieldSize(const Message& message,
case FieldDescriptor::CPPTYPE_STRING:
case FieldDescriptor::CPPTYPE_MESSAGE:
if (IsMapFieldInApi(field)) {
- const internal::MapFieldBase& map =
- GetRaw<MapFieldBase>(message, field);
- if (map.IsRepeatedFieldValid()) {
- return map.GetRepeatedField().size();
- } else {
- // No need to materialize the repeated field if it is out of sync:
- // its size will be the same as the map's size.
- return map.size();
- }
+ return GetRaw<MapFieldBase>(message, field).GetRepeatedField().size();
} else {
return GetRaw<RepeatedPtrFieldBase>(message, field).size();
}
@@ -815,14 +789,6 @@ void GeneratedMessageReflection::ClearField(
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
case FieldOptions::STRING: {
- if (IsInlined(field)) {
- const string* default_ptr =
- &DefaultRaw<InlinedStringField>(field).GetNoArena();
- MutableRaw<InlinedStringField>(message, field)->SetNoArena(
- default_ptr, *default_ptr);
- break;
- }
-
const string* default_ptr =
&DefaultRaw<ArenaStringPtr>(field).Get();
MutableRaw<ArenaStringPtr>(message, field)->SetAllocated(
@@ -1155,13 +1121,12 @@ string GeneratedMessageReflection::GetString(
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
case FieldOptions::STRING: {
- if (IsInlined(field)) {
- return GetField<InlinedStringField>(message, field).GetNoArena();
- }
-
return GetField<ArenaStringPtr>(message, field).Get();
}
}
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return GetEmptyString(); // Make compiler happy.
}
}
@@ -1176,13 +1141,12 @@ const string& GeneratedMessageReflection::GetStringReference(
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
case FieldOptions::STRING: {
- if (IsInlined(field)) {
- return GetField<InlinedStringField>(message, field).GetNoArena();
- }
-
return GetField<ArenaStringPtr>(message, field).Get();
}
}
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return GetEmptyString(); // Make compiler happy.
}
}
@@ -1198,12 +1162,6 @@ void GeneratedMessageReflection::SetString(
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
case FieldOptions::STRING: {
- if (IsInlined(field)) {
- MutableField<InlinedStringField>(message, field)->SetNoArena(
- NULL, value);
- break;
- }
-
const string* default_ptr = &DefaultRaw<ArenaStringPtr>(field).Get();
if (field->containing_oneof() && !HasOneofField(*message, field)) {
ClearOneof(message, field->containing_oneof());
@@ -1230,6 +1188,9 @@ string GeneratedMessageReflection::GetRepeatedString(
case FieldOptions::STRING:
return GetRepeatedPtrField<string>(message, field, index);
}
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return GetEmptyString(); // Make compiler happy.
}
}
@@ -1245,6 +1206,9 @@ 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.
}
}
@@ -1916,10 +1880,6 @@ const Type& GeneratedMessageReflection::GetRaw(
return GetConstRefAtOffset<Type>(message, schema_.GetFieldOffset(field));
}
-bool GeneratedMessageReflection::IsInlined(const FieldDescriptor* field) const {
- return schema_.IsFieldInlined(field);
-}
-
template <typename Type>
Type* GeneratedMessageReflection::MutableRaw(Message* message,
const FieldDescriptor* field) const {
@@ -2015,10 +1975,6 @@ inline bool GeneratedMessageReflection::HasBit(
case FieldDescriptor::CPPTYPE_STRING:
switch (field->options().ctype()) {
default: {
- if (IsInlined(field)) {
- return !GetField<InlinedStringField>(message, field)
- .GetNoArena().empty();
- }
return GetField<ArenaStringPtr>(message, field).Get().size() > 0;
}
}
@@ -2294,15 +2250,17 @@ class AssignDescriptorsHelper {
file_level_metadata_->descriptor = descriptor;
- file_level_metadata_->reflection = new GeneratedMessageReflection(
- descriptor,
- MigrationToReflectionSchema(default_instance_data_, offsets_,
- *schemas_),
- ::google::protobuf::DescriptorPool::generated_pool(), factory_);
- for (int i = 0; i < descriptor->enum_type_count(); i++) {
- AssignEnumDescriptor(descriptor->enum_type(i));
+ if (!descriptor->options().map_entry()) {
+ // Only set reflection for non map types.
+ file_level_metadata_->reflection = new GeneratedMessageReflection(
+ descriptor, MigrationToReflectionSchema(default_instance_data_,
+ offsets_, *schemas_),
+ ::google::protobuf::DescriptorPool::generated_pool(), factory_);
+ for (int i = 0; i < descriptor->enum_type_count(); i++) {
+ AssignEnumDescriptor(descriptor->enum_type(i));
+ }
+ schemas_++;
}
- schemas_++;
default_instance_data_++;
file_level_metadata_++;
}
@@ -2363,6 +2321,7 @@ struct MetadataOwner {
void AssignDescriptors(
const string& filename, const MigrationSchema* schemas,
const Message* const* default_instances_, const uint32* offsets,
+ MessageFactory* factory,
// update the following descriptor arrays.
Metadata* file_level_metadata,
const EnumDescriptor** file_level_enum_descriptors,
@@ -2371,7 +2330,7 @@ void AssignDescriptors(
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(filename);
GOOGLE_CHECK(file != NULL);
- MessageFactory* factory = MessageFactory::generated_factory();
+ if (!factory) factory = MessageFactory::generated_factory();
AssignDescriptorsHelper<MigrationSchema> helper(factory, file_level_metadata,
file_level_enum_descriptors, schemas,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection.h b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection.h
index 31f249b6b4..f6ce16a7a7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection.h
@@ -45,6 +45,7 @@
// TODO(jasonh): Remove this once the compiler change to directly include this
// is released to components.
#include <google/protobuf/generated_enum_reflection.h>
+#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/message.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/unknown_field_set.h>
@@ -94,7 +95,7 @@ class WeakFieldMap; // weak_field_map.h
// For each oneof or weak field, the offset is relative to the
// default_instance. These can be computed at compile time
// using the
-// PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET()
+// GOOGLE_PROTOBUF_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET()
// macro. For each none oneof field, the offset is related to
// the start of the message object. These can be computed at
// compile time using the
@@ -134,7 +135,7 @@ struct ReflectionSchema {
// efficient when we know statically that it is not a oneof field.
uint32 GetFieldOffsetNonOneof(const FieldDescriptor* field) const {
GOOGLE_DCHECK(!field->containing_oneof());
- return OffsetValue(offsets_[field->index()], field->type());
+ return offsets_[field->index()];
}
// Offset of any field.
@@ -143,23 +144,12 @@ struct ReflectionSchema {
size_t offset =
static_cast<size_t>(field->containing_type()->field_count() +
field->containing_oneof()->index());
- return OffsetValue(offsets_[offset], field->type());
+ return offsets_[offset];
} else {
return GetFieldOffsetNonOneof(field);
}
}
- bool IsFieldInlined(const FieldDescriptor* field) const {
- if (field->containing_oneof()) {
- size_t offset =
- static_cast<size_t>(field->containing_type()->field_count() +
- field->containing_oneof()->index());
- return Inlined(offsets_[offset], field->type());
- } else {
- return Inlined(offsets_[field->index()], field->type());
- }
- }
-
uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const {
return static_cast<uint32>(oneof_case_offset_) +
static_cast<uint32>(
@@ -209,7 +199,7 @@ struct ReflectionSchema {
// of the underlying data depends on the field's type.
const void *GetFieldDefault(const FieldDescriptor* field) const {
return reinterpret_cast<const uint8*>(default_instance_) +
- OffsetValue(offsets_[field->index()], field->type());
+ offsets_[field->index()];
}
@@ -230,27 +220,6 @@ struct ReflectionSchema {
int oneof_case_offset_;
int object_size_;
int weak_field_map_offset_;
-
- // We tag offset values to provide additional data about fields (such as
- // inlined).
- static uint32 OffsetValue(uint32 v, FieldDescriptor::Type type) {
- if (type == FieldDescriptor::TYPE_STRING ||
- type == FieldDescriptor::TYPE_BYTES) {
- return v & ~1u;
- } else {
- return v;
- }
- }
-
- static bool Inlined(uint32 v, FieldDescriptor::Type type) {
- if (type == FieldDescriptor::TYPE_STRING ||
- type == FieldDescriptor::TYPE_BYTES) {
- return v & 1u;
- } else {
- // Non string/byte fields are not inlined.
- return false;
- }
- }
};
// Structs that the code generator emits directly to describe a message.
@@ -289,7 +258,7 @@ struct MigrationSchema {
// of whatever type the individual field would be. Strings and
// Messages use RepeatedPtrFields while everything else uses
// RepeatedFields.
-class GeneratedMessageReflection final : public Reflection {
+class LIBPROTOBUF_EXPORT GeneratedMessageReflection PROTOBUF_FINAL : public Reflection {
public:
// Constructs a GeneratedMessageReflection.
// Parameters:
@@ -575,8 +544,6 @@ class GeneratedMessageReflection final : public Reflection {
inline InternalMetadataWithArena*
MutableInternalMetadataWithArena(Message* message) const;
- inline bool IsInlined(const FieldDescriptor* field) const;
-
inline bool HasBit(const Message& message,
const FieldDescriptor* field) const;
inline void SetBit(Message* message,
@@ -689,9 +656,12 @@ class GeneratedMessageReflection final : public Reflection {
// 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) {
-#ifdef GOOGLE_PROTOBUF_NO_RTTI
+#if defined(GOOGLE_PROTOBUF_NO_RTTI) || (defined(_MSC_VER)&&!defined(_CPPRTTI))
// Avoid the compiler warning about unused variables.
(void)from;
return NULL;
@@ -719,7 +689,8 @@ T* DynamicCastToGenerated(const Message* from) {
const Message* unused = static_cast<T*>(NULL);
(void)unused;
-#ifdef GOOGLE_PROTOBUF_NO_RTTI
+#if defined(GOOGLE_PROTOBUF_NO_RTTI) || \
+ (defined(_MSC_VER) && !defined(_CPPRTTI))
bool ok = &T::default_instance() ==
from->GetReflection()->GetMessageFactory()->GetPrototype(
from->GetDescriptor());
@@ -738,6 +709,7 @@ T* DynamicCastToGenerated(Message* from) {
LIBPROTOBUF_EXPORT void AssignDescriptors(
const string& filename, const MigrationSchema* schemas,
const Message* const* default_instances_, const uint32* offsets,
+ MessageFactory* factory,
// update the following descriptor arrays.
Metadata* file_level_metadata,
const EnumDescriptor** file_level_enum_descriptors,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection_unittest.cc
index 61eb6603ca..242cc4a1b7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_reflection_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_reflection_unittest.cc
@@ -44,6 +44,9 @@
#include <google/protobuf/generated_message_reflection.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/test_util.h>
#include <google/protobuf/unittest.pb.h>
@@ -357,7 +360,7 @@ TEST(GeneratedMessageReflectionTest, ReleaseLast) {
ASSERT_EQ(2, message.repeated_foreign_message_size());
const protobuf_unittest::ForeignMessage* expected =
message.mutable_repeated_foreign_message(1);
- std::unique_ptr<Message> released(message.GetReflection()->ReleaseLast(
+ google::protobuf::scoped_ptr<Message> released(message.GetReflection()->ReleaseLast(
&message, descriptor->FindFieldByName("repeated_foreign_message")));
EXPECT_EQ(expected, released.get());
}
@@ -380,7 +383,7 @@ TEST(GeneratedMessageReflectionTest, ReleaseLastExtensions) {
unittest::repeated_foreign_message_extension));
const protobuf_unittest::ForeignMessage* expected = message.MutableExtension(
unittest::repeated_foreign_message_extension, 1);
- std::unique_ptr<Message> released(message.GetReflection()->ReleaseLast(
+ google::protobuf::scoped_ptr<Message> released(message.GetReflection()->ReleaseLast(
&message, descriptor->file()->FindExtensionByName(
"repeated_foreign_message_extension")));
EXPECT_EQ(expected, released.get());
@@ -743,10 +746,6 @@ TEST(GeneratedMessageReflectionTest, Oneof) {
"change_spiece");
EXPECT_EQ("change_spiece", reflection->GetString(
message, descriptor->FindFieldByName("bar_string_piece")));
-
- message.clear_foo();
- message.clear_bar();
- TestUtil::ExpectOneofClear(message);
}
TEST(GeneratedMessageReflectionTest, SetAllocatedOneofMessageTest) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven.cc b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven.cc
index d4450a6cd5..29af1ef692 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven.cc
@@ -30,9 +30,8 @@
#include <google/protobuf/generated_message_table_driven.h>
-#include <type_traits>
+#include <google/protobuf/stubs/type_traits.h>
-#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/generated_message_table_driven_lite.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/metadata.h>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven.h b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven.h
index 10ca3aaa36..5eb63dbd27 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven.h
@@ -33,43 +33,53 @@
#include <google/protobuf/map.h>
#include <google/protobuf/map_entry_lite.h>
-#include <google/protobuf/map_field_lite.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/wire_format_lite_inl.h>
+#if LANG_CXX11
+#define PROTOBUF_CONSTEXPR constexpr
+
// We require C++11 and Clang to use constexpr for variables, as GCC 4.8
// requires constexpr to be consistent between declarations of variables
// unnecessarily (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58541).
-// VS 2017 Update 3 also supports this usage of constexpr.
-#if defined(__clang__) || (defined(_MSC_VER) && _MSC_VER >= 1911)
+#ifdef __clang__
#define PROTOBUF_CONSTEXPR_VAR constexpr
#else // !__clang__
#define PROTOBUF_CONSTEXPR_VAR
#endif // !_clang
+#else
+#define PROTOBUF_CONSTEXPR
+#define PROTOBUF_CONSTEXPR_VAR
+#endif
+
namespace google {
namespace protobuf {
namespace internal {
// Processing-type masks.
-static constexpr const unsigned char kOneofMask = 0x40;
-static constexpr const unsigned char kRepeatedMask = 0x20;
+static PROTOBUF_CONSTEXPR const unsigned char kOneofMask = 0x40;
+static PROTOBUF_CONSTEXPR const unsigned char kRepeatedMask = 0x20;
// Mask for the raw type: either a WireFormatLite::FieldType or one of the
// ProcessingTypes below, without the oneof or repeated flag.
-static constexpr const unsigned char kTypeMask = 0x1f;
+static PROTOBUF_CONSTEXPR const unsigned char kTypeMask = 0x1f;
// Wire type masks.
-static constexpr const unsigned char kNotPackedMask = 0x10;
-static constexpr const unsigned char kInvalidMask = 0x20;
+static PROTOBUF_CONSTEXPR const unsigned char kNotPackedMask = 0x10;
+static PROTOBUF_CONSTEXPR const unsigned char kInvalidMask = 0x20;
enum ProcessingTypes {
- TYPE_STRING_INLINED = 23,
- TYPE_BYTES_INLINED = 24,
- TYPE_MAP = 25,
+ TYPE_STRING_CORD = 19,
+ TYPE_STRING_STRING_PIECE = 20,
+ TYPE_BYTES_CORD = 21,
+ TYPE_BYTES_STRING_PIECE = 22,
+ TYPE_MAP = 23,
};
+#if LANG_CXX11
static_assert(TYPE_MAP < kRepeatedMask, "Invalid enum");
+#endif
// TODO(ckennelly): Add a static assertion to ensure that these masks do not
// conflict with wiretypes.
@@ -112,6 +122,7 @@ union AuxillaryParseTableField {
const MessageLite* default_message() const {
return static_cast<const MessageLite*>(default_message_void);
}
+ const ParseTable* parse_table;
};
message_aux messages;
// Strings
@@ -126,14 +137,19 @@ union AuxillaryParseTableField {
};
map_aux maps;
+#if LANG_CXX11
AuxillaryParseTableField() = default;
- constexpr AuxillaryParseTableField(AuxillaryParseTableField::enum_aux e)
- : enums(e) {}
- constexpr AuxillaryParseTableField(AuxillaryParseTableField::message_aux m)
- : messages(m) {}
- constexpr AuxillaryParseTableField(AuxillaryParseTableField::string_aux s)
- : strings(s) {}
- constexpr AuxillaryParseTableField(AuxillaryParseTableField::map_aux m)
+#else
+ AuxillaryParseTableField() { }
+#endif
+ PROTOBUF_CONSTEXPR AuxillaryParseTableField(
+ AuxillaryParseTableField::enum_aux e) : enums(e) {}
+ PROTOBUF_CONSTEXPR AuxillaryParseTableField(
+ AuxillaryParseTableField::message_aux m) : messages(m) {}
+ PROTOBUF_CONSTEXPR AuxillaryParseTableField(
+ AuxillaryParseTableField::string_aux s) : strings(s) {}
+ PROTOBUF_CONSTEXPR AuxillaryParseTableField(
+ AuxillaryParseTableField::map_aux m)
: maps(m) {}
};
@@ -160,17 +176,18 @@ struct ParseTable {
bool unknown_field_set;
};
+// TODO(jhen): Remove the __NVCC__ check when we get a version of nvcc that
+// supports these checks.
+#if LANG_CXX11 && !defined(__NVCC__)
static_assert(sizeof(ParseTableField) <= 16, "ParseTableField is too large");
// The tables must be composed of POD components to ensure link-time
// initialization.
static_assert(std::is_pod<ParseTableField>::value, "");
+static_assert(std::is_pod<AuxillaryParseTableField>::value, "");
static_assert(std::is_pod<AuxillaryParseTableField::enum_aux>::value, "");
static_assert(std::is_pod<AuxillaryParseTableField::message_aux>::value, "");
static_assert(std::is_pod<AuxillaryParseTableField::string_aux>::value, "");
static_assert(std::is_pod<ParseTable>::value, "");
-
-#ifndef __NVCC__ // This assertion currently fails under NVCC.
-static_assert(std::is_pod<AuxillaryParseTableField>::value, "");
#endif
// TODO(ckennelly): Consolidate these implementations into a single one, using
@@ -180,6 +197,20 @@ bool MergePartialFromCodedStream(MessageLite* msg, const ParseTable& table,
bool MergePartialFromCodedStreamLite(MessageLite* msg, const ParseTable& table,
io::CodedInputStream* input);
+template <typename MEntry>
+struct MapEntryToMapField;
+
+template <typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType,
+ WireFormatLite::FieldType kValueFieldType, int default_enum_value>
+struct MapEntryToMapField<MapEntryLite<Key, Value, kKeyFieldType,
+ kValueFieldType, default_enum_value> > {
+ typedef MapFieldLite<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType,
+ default_enum_value>,
+ Key, Value, kKeyFieldType, kValueFieldType,
+ default_enum_value>
+ MapFieldType;
+};
+
template <typename Entry>
bool ParseMap(io::CodedInputStream* input, void* map_field) {
typedef typename MapEntryToMapField<Entry>::MapFieldType MapFieldType;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven_lite.cc
index 961329f367..90a5050553 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven_lite.cc
@@ -30,7 +30,7 @@
#include <google/protobuf/generated_message_table_driven_lite.h>
-#include <type_traits>
+#include <google/protobuf/stubs/type_traits.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/metadata_lite.h>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven_lite.h
index 0d90fe33a6..20b4da218a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_table_driven_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_table_driven_lite.h
@@ -33,15 +33,14 @@
#include <google/protobuf/generated_message_table_driven.h>
+#include <google/protobuf/stubs/type_traits.h>
+
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/extension_set.h>
-#include <google/protobuf/implicit_weak_message.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata_lite.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/wire_format_lite_inl.h>
-#include <type_traits>
namespace google {
@@ -51,7 +50,8 @@ namespace internal {
enum StringType {
StringType_STRING = 0,
- StringType_INLINED = 3
+ StringType_CORD = 1,
+ StringType_STRING_PIECE = 2
};
// Logically a superset of StringType, consisting of all field types that
@@ -60,8 +60,7 @@ enum ProcessingType {
ProcessingType_STRING = 0,
ProcessingType_CORD = 1,
ProcessingType_STRING_PIECE = 2,
- ProcessingType_INLINED = 3,
- ProcessingType_MESSAGE = 4,
+ ProcessingType_MESSAGE = 3
};
enum Cardinality {
@@ -100,9 +99,10 @@ inline ExtensionSet* GetExtensionSet(MessageLite* msg, int64 extension_offset) {
template <typename Type>
inline Type* AddField(MessageLite* msg, int64 offset) {
- static_assert(std::is_pod<Type>::value ||
- std::is_same<Type, InlinedStringField>::value,
+#if LANG_CXX11
+ static_assert(has_trivial_copy<Type>::value,
"Do not assign");
+#endif
google::protobuf::RepeatedField<Type>* repeated =
Raw<google::protobuf::RepeatedField<Type> >(msg, offset);
@@ -119,13 +119,15 @@ inline string* AddField<string>(MessageLite* msg, int64 offset) {
template <typename Type>
inline void AddField(MessageLite* msg, int64 offset, Type value) {
- static_assert(std::is_pod<Type>::value,
+#if LANG_CXX11
+ static_assert(has_trivial_copy<Type>::value,
"Do not assign");
+#endif
*AddField<Type>(msg, offset) = value;
}
inline void SetBit(uint32* has_bits, uint32 has_bit_index) {
- GOOGLE_DCHECK(has_bits != nullptr);
+ GOOGLE_DCHECK(has_bits != NULL);
uint32 mask = static_cast<uint32>(1u) << (has_bit_index % 32);
has_bits[has_bit_index / 32u] |= mask;
@@ -141,8 +143,10 @@ inline Type* MutableField(MessageLite* msg, uint32* has_bits,
template <typename Type>
inline void SetField(MessageLite* msg, uint32* has_bits, uint32 has_bit_index,
int64 offset, Type value) {
- static_assert(std::is_pod<Type>::value,
+#if LANG_CXX11
+ static_assert(has_trivial_copy<Type>::value,
"Do not assign");
+#endif
*MutableField<Type>(msg, has_bits, has_bit_index, offset) = value;
}
@@ -171,11 +175,6 @@ inline void ClearOneofField(const ParseTableField& field, Arena* arena,
->Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
break;
- case TYPE_STRING_INLINED:
- case TYPE_BYTES_INLINED:
- Raw<InlinedStringField>(msg, field.offset)->DestroyNoArena(NULL);
- break;
-
default:
// No cleanup needed.
break;
@@ -208,10 +207,6 @@ inline void ResetOneofField(const ParseTable& table, int field_number,
Raw<ArenaStringPtr>(msg, offset)
->UnsafeSetDefault(static_cast<const string*>(default_ptr));
break;
- case ProcessingType_INLINED:
- new (Raw<InlinedStringField>(msg, offset))
- InlinedStringField(*static_cast<const string*>(default_ptr));
- break;
case ProcessingType_MESSAGE:
MessageLite** submessage = Raw<MessageLite*>(msg, offset);
const MessageLite* prototype =
@@ -232,65 +227,32 @@ static inline bool HandleString(io::CodedInputStream* input, MessageLite* msg,
size_t size;
#endif
- switch (ctype) {
- case StringType_INLINED: {
- InlinedStringField* s;
- switch (cardinality) {
- case Cardinality_SINGULAR:
- // TODO(ckennelly): Is this optimal?
- s = MutableField<InlinedStringField>(
- msg, has_bits, has_bit_index, offset);
- break;
- case Cardinality_REPEATED:
- s = AddField<InlinedStringField>(msg, offset);
- break;
- case Cardinality_ONEOF:
- s = Raw<InlinedStringField>(msg, offset);
- break;
- }
- GOOGLE_DCHECK(s != nullptr);
- ::std::string* value = s->MutableNoArena(NULL);
-
- if (GOOGLE_PREDICT_FALSE(!WireFormatLite::ReadString(input, value))) {
- return false;
- }
-
-#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
- sdata = value->data();
- size = value->size();
-#endif
- break;
+ string* value;
+ switch (cardinality) {
+ case Cardinality_SINGULAR:
+ // TODO(ckennelly): Is this optimal?
+ value =
+ MutableField<ArenaStringPtr>(msg, has_bits, has_bit_index, offset)
+ ->Mutable(static_cast<const string*>(default_ptr), arena);
+ break;
+ case Cardinality_REPEATED:
+ value = AddField<string>(msg, offset);
+ break;
+ case Cardinality_ONEOF:
+ value = Raw<ArenaStringPtr>(msg, offset)
+ ->Mutable(static_cast<const string*>(default_ptr), arena);
+ break;
}
- case StringType_STRING: {
- string* value;
- switch (cardinality) {
- case Cardinality_SINGULAR:
- // TODO(ckennelly): Is this optimal?
- value =
- MutableField<ArenaStringPtr>(msg, has_bits, has_bit_index, offset)
- ->Mutable(static_cast<const string*>(default_ptr), arena);
- break;
- case Cardinality_REPEATED:
- value = AddField<string>(msg, offset);
- break;
- case Cardinality_ONEOF:
- value = Raw<ArenaStringPtr>(msg, offset)
- ->Mutable(static_cast<const string*>(default_ptr), arena);
- break;
- }
- GOOGLE_DCHECK(value != nullptr);
+ GOOGLE_DCHECK(value != NULL);
- if (GOOGLE_PREDICT_FALSE(!WireFormatLite::ReadString(input, value))) {
- return false;
- }
+ if (GOOGLE_PREDICT_FALSE(!WireFormatLite::ReadString(input, value))) {
+ return false;
+ }
#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
- sdata = value->data();
- size = value->size();
+ sdata = value->data();
+ size = value->size();
#endif
- break;
- }
- }
#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
if (validate) {
@@ -345,7 +307,6 @@ 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();
@@ -361,6 +322,44 @@ class RepeatedMessageTypeHandler {
}
};
+inline bool ReadGroup(int field_number, io::CodedInputStream* input,
+ MessageLite* value) {
+ if (GOOGLE_PREDICT_FALSE(!input->IncrementRecursionDepth())) {
+ return false;
+ }
+
+ if (GOOGLE_PREDICT_FALSE(!value->MergePartialFromCodedStream(input))) {
+ return false;
+ }
+
+ input->DecrementRecursionDepth();
+ // Make sure the last thing read was an end tag for this group.
+ if (GOOGLE_PREDICT_FALSE(!input->LastTagWas(WireFormatLite::MakeTag(
+ field_number, WireFormatLite::WIRETYPE_END_GROUP)))) {
+ return false;
+ }
+
+ return true;
+}
+
+inline bool ReadMessage(io::CodedInputStream* input, MessageLite* value) {
+ int length;
+ if (GOOGLE_PREDICT_FALSE(!input->ReadVarintSizeAsInt(&length))) {
+ return false;
+ }
+
+ std::pair<io::CodedInputStream::Limit, int> p =
+ input->IncrementRecursionDepthAndPushLimit(length);
+ if (GOOGLE_PREDICT_FALSE(p.second < 0 ||
+ !value->MergePartialFromCodedStream(input))) {
+ return false;
+ }
+
+ // Make sure that parsing stopped when the limit was hit, not at an endgroup
+ // tag.
+ return input->DecrementRecursionDepthAndPopLimit(p.first);
+}
+
class MergePartialFromCodedStreamHelper {
public:
static MessageLite* Add(RepeatedPtrFieldBase* field,
@@ -395,8 +394,7 @@ 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;
}
@@ -423,7 +421,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; \
@@ -434,8 +432,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; \
} \
@@ -444,7 +442,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; \
@@ -490,23 +488,6 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
}
break;
}
- case TYPE_BYTES_INLINED:
-#ifndef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
- case TYPE_STRING_INLINED:
-#endif
- {
- Arena* const arena =
- GetArena<InternalMetadata>(msg, table.arena_offset);
- const void* default_ptr = table.aux[field_number].strings.default_ptr;
-
- if (GOOGLE_PREDICT_FALSE((!HandleString<Cardinality_SINGULAR, false,
- StringType_INLINED>(
- input, msg, arena, has_bits, presence_index, offset,
- default_ptr, NULL)))) {
- return false;
- }
- break;
- }
case WireFormatLite::TYPE_BYTES | kOneofMask:
#ifndef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
case WireFormatLite::TYPE_STRING | kOneofMask:
@@ -530,10 +511,8 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
break;
}
case (WireFormatLite::TYPE_BYTES) | kRepeatedMask:
- case TYPE_BYTES_INLINED | kRepeatedMask:
#ifndef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
case (WireFormatLite::TYPE_STRING) | kRepeatedMask:
- case TYPE_STRING_INLINED | kRepeatedMask:
#endif
{
Arena* const arena =
@@ -564,7 +543,6 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
}
break;
}
- case TYPE_STRING_INLINED | kRepeatedMask:
case (WireFormatLite::TYPE_STRING) | kRepeatedMask: {
Arena* const arena =
GetArena<InternalMetadata>(msg, table.arena_offset);
@@ -600,32 +578,29 @@ 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;
@@ -644,8 +619,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;
}
@@ -660,8 +635,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;
}
@@ -677,10 +652,6 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
GetArena<InternalMetadata>(msg, table.arena_offset);
const MessageLite* prototype =
table.aux[field_number].messages.default_message();
- if (prototype == NULL) {
- prototype =
- ::google::protobuf::internal::ImplicitWeakMessage::default_instance();
- }
submsg = prototype->New(arena);
*submsg_holder = submsg;
}
@@ -697,10 +668,7 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
RepeatedPtrFieldBase* field = Raw<RepeatedPtrFieldBase>(msg, offset);
const MessageLite* prototype =
table.aux[field_number].messages.default_message();
- if (prototype == NULL) {
- prototype =
- ::google::protobuf::internal::ImplicitWeakMessage::default_instance();
- }
+ GOOGLE_DCHECK(prototype != NULL);
MessageLite* submsg =
MergePartialFromCodedStreamHelper::Add(field, prototype);
@@ -727,22 +695,6 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
break;
}
-#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
- case TYPE_STRING_INLINED: {
- Arena* const arena =
- GetArena<InternalMetadata>(msg, table.arena_offset);
- const void* default_ptr = table.aux[field_number].strings.default_ptr;
- const char* field_name = table.aux[field_number].strings.field_name;
-
- if (GOOGLE_PREDICT_FALSE((
- !HandleString<Cardinality_SINGULAR, true, StringType_INLINED>(
- input, msg, arena, has_bits, presence_index, offset,
- default_ptr, field_name)))) {
- return false;
- }
- break;
- }
-#endif // GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
case TYPE_MAP: {
if (GOOGLE_PREDICT_FALSE(!(*table.aux[field_number].maps.parse_map)(
input, Raw<void>(msg, offset)))) {
@@ -764,8 +716,7 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
GOOGLE_DCHECK_NE(processing_type, kRepeatedMask);
GOOGLE_DCHECK_EQ(0, processing_type & kOneofMask);
- GOOGLE_DCHECK_NE(TYPE_BYTES_INLINED | kRepeatedMask, processing_type);
- GOOGLE_DCHECK_NE(TYPE_STRING_INLINED | kRepeatedMask, processing_type);
+
// TODO(ckennelly): Use a computed goto on GCC/LLVM.
//
@@ -776,7 +727,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; \
@@ -858,8 +809,7 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_util.cc
index dac8ca909a..c9dfe61ade 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_util.cc
@@ -35,9 +35,6 @@
#include <google/protobuf/generated_message_util.h>
#include <limits>
-// We're only using this as a standard way for getting the thread id.
-// We're not using any thread functionality.
-#include <thread> // NOLINT
#include <vector>
#include <google/protobuf/io/coded_stream_inl.h>
@@ -46,18 +43,14 @@
#include <google/protobuf/extension_set.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/metadata_lite.h>
-#include <google/protobuf/stubs/mutex.h>
-#include <google/protobuf/stubs/port.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/wire_format_lite_inl.h>
namespace google {
-
namespace protobuf {
namespace internal {
-
double Infinity() {
return std::numeric_limits<double>::infinity();
}
@@ -65,7 +58,7 @@ double NaN() {
return std::numeric_limits<double>::quiet_NaN();
}
-ExplicitlyConstructed<::std::string> fixed_address_empty_string;
+ExplicitlyConstructed< ::std::string> fixed_address_empty_string;
GOOGLE_PROTOBUF_DECLARE_ONCE(empty_string_once_init_);
void DeleteEmptyString() { fixed_address_empty_string.Destruct(); }
@@ -255,10 +248,6 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_BYTES>
: PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {};
-template <>
-struct PrimitiveTypeHelper<FieldMetadata::kInlinedType>
- : PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {};
-
// We want to serialize to both CodedOutputStream and directly into byte arrays
// without duplicating the code. In fact we might want extra output channels in
// the future.
@@ -282,7 +271,7 @@ void WriteLengthTo(uint32 length, O* output) {
// Specialization for coded output stream
template <int type>
-struct OutputHelper<::google::protobuf::io::CodedOutputStream, type> {
+struct OutputHelper< ::google::protobuf::io::CodedOutputStream, type> {
static void Serialize(const void* ptr,
::google::protobuf::io::CodedOutputStream* output) {
PrimitiveTypeHelper<type>::Serialize(ptr, output);
@@ -424,15 +413,6 @@ struct SingularFieldHelper<WireFormatLite::TYPE_MESSAGE> {
}
};
-template <>
-struct SingularFieldHelper<FieldMetadata::kInlinedType> {
- template <typename O>
- static void Serialize(const void* field, const FieldMetadata& md, O* output) {
- WriteTagTo(md.tag, output);
- SerializeTo<FieldMetadata::kInlinedType>(&Get<::std::string>(field), output);
- }
-};
-
template <int type>
struct RepeatedFieldHelper {
template <typename O>
@@ -505,10 +485,6 @@ struct RepeatedFieldHelper<WireFormatLite::TYPE_MESSAGE> {
};
-template <>
-struct RepeatedFieldHelper<FieldMetadata::kInlinedType>
- : RepeatedFieldHelper<WireFormatLite::TYPE_STRING> {};
-
template <int type>
struct PackedFieldHelper {
template <typename O>
@@ -544,9 +520,6 @@ struct PackedFieldHelper<WireFormatLite::TYPE_GROUP>
template <>
struct PackedFieldHelper<WireFormatLite::TYPE_MESSAGE>
: PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
-template <>
-struct PackedFieldHelper<FieldMetadata::kInlinedType>
- : PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
template <int type>
struct OneOfFieldHelper {
@@ -557,15 +530,6 @@ struct OneOfFieldHelper {
};
-template <>
-struct OneOfFieldHelper<FieldMetadata::kInlinedType> {
- template <typename O>
- static void Serialize(const void* field, const FieldMetadata& md, O* output) {
- SingularFieldHelper<FieldMetadata::kInlinedType>::Serialize(
- Get<const ::std::string*>(field), md, output);
- }
-};
-
void SerializeNotImplemented(int field) {
GOOGLE_LOG(FATAL) << "Not implemented field number " << field;
}
@@ -606,11 +570,6 @@ bool IsNull<WireFormatLite::TYPE_MESSAGE>(const void* ptr) {
}
-template <>
-bool IsNull<FieldMetadata::kInlinedType>(const void* ptr) {
- return static_cast<const ::std::string*>(ptr)->empty();
-}
-
#define SERIALIZERS_FOR_TYPE(type) \
case SERIALIZE_TABLE_OP(type, FieldMetadata::kPresence): \
if (!IsPresent(base, field_metadata.has_offset)) continue; \
@@ -658,7 +617,6 @@ void SerializeInternal(const uint8* base,
SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SFIXED64);
SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT32);
SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT64);
- SERIALIZERS_FOR_TYPE(FieldMetadata::kInlinedType);
// Special cases
case FieldMetadata::kSpecial:
@@ -702,7 +660,6 @@ uint8* SerializeInternalToArray(const uint8* base,
SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SFIXED64);
SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT32);
SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT64);
- SERIALIZERS_FOR_TYPE(FieldMetadata::kInlinedType);
// Special cases
case FieldMetadata::kSpecial: {
io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX);
@@ -738,76 +695,6 @@ void UnknownFieldSerializerLite(const uint8* ptr, uint32 offset, uint32 tag,
->unknown_fields());
}
-MessageLite* DuplicateIfNonNullInternal(MessageLite* message) {
- if (message) {
- MessageLite* ret = message->New();
- ret->CheckTypeAndMergeFrom(*message);
- return ret;
- } else {
- return NULL;
- }
-}
-
-// Returns a message owned by this Arena. This may require Own()ing or
-// duplicating the message.
-MessageLite* GetOwnedMessageInternal(Arena* message_arena,
- MessageLite* submessage,
- Arena* submessage_arena) {
- GOOGLE_DCHECK(submessage->GetArena() == submessage_arena);
- GOOGLE_DCHECK(message_arena != submessage_arena);
- if (message_arena != NULL && submessage_arena == NULL) {
- message_arena->Own(submessage);
- return submessage;
- } else {
- MessageLite* ret = submessage->New(message_arena);
- ret->CheckTypeAndMergeFrom(*submessage);
- return ret;
- }
-}
-
-namespace {
-
-void InitSCC_DFS(SCCInfoBase* scc) {
- if (scc->visit_status.load(std::memory_order_relaxed) !=
- SCCInfoBase::kUninitialized) return;
- scc->visit_status.store(SCCInfoBase::kRunning, std::memory_order_relaxed);
- // Each base is followed by an array of pointers to deps
- auto deps = reinterpret_cast<SCCInfoBase* const*>(scc + 1);
- for (int i = 0; i < scc->num_deps; i++) {
- if (deps[i]) InitSCC_DFS(deps[i]);
- }
- scc->init_func();
- // Mark done (note we use memory order release here), other threads could
- // now see this as initialized and thus the initialization must have happened
- // before.
- scc->visit_status.store(SCCInfoBase::kInitialized, std::memory_order_release);
-}
-
-} // namespace
-
-void InitSCCImpl(SCCInfoBase* scc) {
- static WrappedMutex mu{GOOGLE_PROTOBUF_LINKER_INITIALIZED};
- // Either the default in case no initialization is running or the id of the
- // thread that is currently initializing.
- static std::atomic<std::thread::id> runner;
- auto me = std::this_thread::get_id();
- // This will only happen because the constructor will call InitSCC while
- // constructing the default instance.
- if (runner.load(std::memory_order_relaxed) == me) {
- // Because we're in the process of constructing the default instance.
- // We can be assured that we're already exploring this SCC.
- GOOGLE_CHECK_EQ(scc->visit_status.load(std::memory_order_relaxed),
- SCCInfoBase::kRunning);
- return;
- }
- InitProtobufDefaults();
- mu.Lock();
- runner.store(me, std::memory_order_relaxed);
- InitSCC_DFS(scc);
- runner.store(std::thread::id{}, std::memory_order_relaxed);
- mu.Unlock();
-}
-
} // namespace internal
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_util.h
index c26e3e52cf..096a84cd8c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/generated_message_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/generated_message_util.h
@@ -39,16 +39,14 @@
#define GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__
#include <assert.h>
-#include <atomic>
#include <climits>
#include <string>
#include <vector>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/once.h> // Add direct dep on port for pb.cc
+#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>
@@ -122,21 +120,6 @@ 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 {
@@ -165,8 +148,7 @@ struct LIBPROTOBUF_EXPORT FieldMetadata {
enum {
kCordType = 19,
kStringPieceType = 20,
- kInlinedType = 21,
- kNumTypes = 21,
+ kNumTypes = 20,
kSpecial = kNumTypes * kNumTypeClasses,
};
@@ -175,7 +157,7 @@ struct LIBPROTOBUF_EXPORT FieldMetadata {
inline bool IsPresent(const void* base, uint32 hasbit) {
const uint32* has_bits_array = static_cast<const uint32*>(base);
- return (has_bits_array[hasbit / 32] & (1u << (hasbit & 31))) != 0;
+ return has_bits_array[hasbit / 32] & (1u << (hasbit & 31));
}
inline bool IsOneofPresent(const void* base, uint32 offset, uint32 tag) {
@@ -292,73 +274,6 @@ void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag,
}
}
-LIBPROTOBUF_EXPORT MessageLite* DuplicateIfNonNullInternal(MessageLite* message);
-LIBPROTOBUF_EXPORT MessageLite* GetOwnedMessageInternal(Arena* message_arena,
- MessageLite* submessage,
- Arena* submessage_arena);
-
-template <typename T>
-T* DuplicateIfNonNull(T* message) {
- // The casts must be reinterpret_cast<> because T might be a forward-declared
- // type that the compiler doesn't know is related to MessageLite.
- return reinterpret_cast<T*>(
- DuplicateIfNonNullInternal(reinterpret_cast<MessageLite*>(message)));
-}
-
-template <typename T>
-T* GetOwnedMessage(Arena* message_arena, T* submessage,
- Arena* submessage_arena) {
- // The casts must be reinterpret_cast<> because T might be a forward-declared
- // type that the compiler doesn't know is related to MessageLite.
- return reinterpret_cast<T*>(GetOwnedMessageInternal(
- message_arena, reinterpret_cast<MessageLite*>(submessage),
- submessage_arena));
-}
-
-// Hide atomic from the public header and allow easy change to regular int
-// on platforms where the atomic might have a perf impact.
-class LIBPROTOBUF_EXPORT CachedSize {
- public:
- int Get() const { return size_.load(std::memory_order_relaxed); }
- void Set(int size) { size_.store(size, std::memory_order_relaxed); }
- private:
- std::atomic<int> size_{0};
-};
-
-// SCCInfo represents information of a strongly connected component of
-// mutual dependent messages.
-struct LIBPROTOBUF_EXPORT SCCInfoBase {
- // We use 0 for the Initialized state, because test eax,eax, jnz is smaller
- // and is subject to macro fusion.
- enum {
- kInitialized = 0, // final state
- kRunning = 1,
- kUninitialized = -1, // initial state
- };
- std::atomic<int> visit_status;
- int num_deps;
- void (*init_func)();
- // This is followed by an array of num_deps
- // const SCCInfoBase* deps[];
-};
-
-template <int N>
-struct SCCInfo {
- SCCInfoBase base;
- // Semantically this is const SCCInfo<T>* which is is a templated type.
- // The obvious inheriting from SCCInfoBase mucks with struct initialization.
- // Attempts showed the compiler was generating dynamic initialization code.
- // Zero length arrays produce warnings with MSVC.
- SCCInfoBase* deps[N ? N : 1];
-};
-
-LIBPROTOBUF_EXPORT void InitSCCImpl(SCCInfoBase* scc);
-
-inline void InitSCC(SCCInfoBase* scc) {
- auto status = scc->visit_status.load(std::memory_order_acquire);
- if (GOOGLE_PREDICT_FALSE(status != SCCInfoBase::kInitialized)) InitSCCImpl(scc);
-}
-
} // namespace internal
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/has_bits.h b/third_party/protobuf/3.4.0/src/google/protobuf/has_bits.h
index e3a0149a47..cb1d7cccb6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/has_bits.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/has_bits.h
@@ -32,7 +32,6 @@
#define GOOGLE_PROTOBUF_HAS_BITS_H__
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/port.h>
namespace google {
namespace protobuf {
@@ -41,18 +40,17 @@ namespace internal {
template<size_t doublewords>
class HasBits {
public:
- HasBits() GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE { Clear(); }
+ HasBits() GOOGLE_ATTRIBUTE_ALWAYS_INLINE { Clear(); }
- void Clear() GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
+ void Clear() GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
memset(has_bits_, 0, sizeof(has_bits_));
}
- ::google::protobuf::uint32& operator[](int index) GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
+ ::google::protobuf::uint32& operator[](int index) GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
return has_bits_[index];
}
- const ::google::protobuf::uint32& operator[](int index) const
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
+ const ::google::protobuf::uint32& operator[](int index) const GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
return has_bits_[index];
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream.cc
index 0851ff0cb6..17eb0ffa2e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream.cc
+++ b/third_party/protobuf/3.4.0/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,7 +173,10 @@ int CodedInputStream::BytesUntilLimit() const {
return current_limit_ - current_position;
}
-void CodedInputStream::SetTotalBytesLimit(int total_bytes_limit) {
+void CodedInputStream::SetTotalBytesLimit(
+ int total_bytes_limit, int warning_threshold) {
+ (void) warning_threshold;
+
// Make sure the limit isn't already past, since this could confuse other
// code.
int current_position = CurrentPosition();
@@ -217,12 +220,8 @@ bool CodedInputStream::SkipFallback(int count, int original_buffer_size) {
return false;
}
- if (!input_->Skip(count)) {
- total_bytes_read_ = input_->ByteCount();
- return false;
- }
total_bytes_read_ += count;
- return true;
+ return input_->Skip(count);
}
bool CodedInputStream::GetDirectBufferPointer(const void** data, int* size) {
@@ -316,8 +315,7 @@ namespace {
// The first part of the pair is true iff the read was successful. The second
// part is buffer + (number of bytes read). This function is always inlined,
// so returning a pair is costless.
-GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
-::std::pair<bool, const uint8*> ReadVarint32FromArray(
+GOOGLE_ATTRIBUTE_ALWAYS_INLINE ::std::pair<bool, const uint8*> ReadVarint32FromArray(
uint32 first_byte, const uint8* buffer,
uint32* value);
inline ::std::pair<bool, const uint8*> ReadVarint32FromArray(
@@ -354,8 +352,8 @@ inline ::std::pair<bool, const uint8*> ReadVarint32FromArray(
return std::make_pair(true, ptr);
}
-GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE::std::pair<bool, const uint8*>
-ReadVarint64FromArray(const uint8* buffer, uint64* value);
+GOOGLE_ATTRIBUTE_ALWAYS_INLINE::std::pair<bool, const uint8*> ReadVarint64FromArray(
+ const uint8* buffer, uint64* value);
inline ::std::pair<bool, const uint8*> ReadVarint64FromArray(
const uint8* buffer, uint64* value) {
const uint8* ptr = buffer;
@@ -619,11 +617,23 @@ bool CodedInputStream::Refresh() {
// CodedOutputStream =================================================
-std::atomic<bool> CodedOutputStream::default_serialization_deterministic_{
- false};
+google::protobuf::internal::AtomicWord CodedOutputStream::default_serialization_deterministic_ = 0;
CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output)
- : CodedOutputStream(output, true) {}
+ : output_(output),
+ buffer_(NULL),
+ buffer_size_(0),
+ total_bytes_(0),
+ had_error_(false),
+ aliasing_enabled_(false),
+ serialization_deterministic_is_overridden_(false) {
+ // Eagerly Refresh() so buffer space is immediately available.
+ Refresh();
+ // The Refresh() may have failed. If the client doesn't write any data,
+ // though, don't consider this an error. If the client does write data, then
+ // another Refresh() will be attempted and it will set the error once again.
+ had_error_ = false;
+}
CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output,
bool do_eager_refresh)
@@ -633,7 +643,7 @@ CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output,
total_bytes_(0),
had_error_(false),
aliasing_enabled_(false),
- is_serialization_deterministic_(IsDefaultSerializationDeterministic()) {
+ serialization_deterministic_is_overridden_(false) {
if (do_eager_refresh) {
// Eagerly Refresh() so buffer space is immediately available.
Refresh();
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream.h
index 0f70ecde4c..6d2599fba0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream.h
@@ -110,7 +110,6 @@
#define GOOGLE_PROTOBUF_IO_CODED_STREAM_H__
#include <assert.h>
-#include <atomic>
#include <climits>
#include <string>
#include <utility>
@@ -132,9 +131,9 @@
#define PROTOBUF_LITTLE_ENDIAN 1
#endif
#endif
+#include <google/protobuf/stubs/atomicops.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
-#include <google/protobuf/stubs/port.h>
namespace google {
@@ -198,23 +197,28 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// Like GetDirectBufferPointer, but this method is inlined, and does not
// attempt to Refresh() if the buffer is currently empty.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- void GetDirectBufferPointerInline(const void** data, int* size);
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE void GetDirectBufferPointerInline(const void** data,
+ int* size);
// Read raw bytes, copying them into the given buffer.
bool ReadRaw(void* buffer, int size);
// Like the above, with inlined optimizations. This should only be used
// by the protobuf implementation.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- bool InternalReadRawInline(void* buffer, int size);
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InternalReadRawInline(void* buffer, int size);
// Like ReadRaw, but reads into a string.
+ //
+ // Implementation Note: ReadString() grows the string gradually as it
+ // reads in the data, rather than allocating the entire requested size
+ // upfront. This prevents denial-of-service attacks in which a client
+ // could claim that a string is going to be MAX_INT bytes long in order to
+ // crash the server because it can't allocate this much space at once.
bool ReadString(string* buffer, int size);
// Like the above, with inlined optimizations. This should only be used
// by the protobuf implementation.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- bool InternalReadStringInline(string* buffer, int size);
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InternalReadStringInline(string* buffer,
+ int size);
// Read a 32-bit little-endian integer.
@@ -257,11 +261,11 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// Always inline because this is only called in one place per parse loop
// but it is called for every iteration of said loop, so it should be fast.
// GCC doesn't want to inline this by default.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTag() {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTag() {
return last_tag_ = ReadTagNoLastTag();
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTagNoLastTag();
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTagNoLastTag();
// This usually a faster alternative to ReadTag() when cutoff is a manifest
@@ -272,15 +276,15 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// above cutoff or is 0. (There's intentional wiggle room when tag is 0,
// because that can arise in several ways, and for best performance we want
// to avoid an extra "is tag == 0?" check here.)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- std::pair<uint32, bool> ReadTagWithCutoff(uint32 cutoff) {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE std::pair<uint32, bool> ReadTagWithCutoff(
+ uint32 cutoff) {
std::pair<uint32, bool> result = ReadTagWithCutoffNoLastTag(cutoff);
last_tag_ = result.first;
return result;
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- std::pair<uint32, bool> ReadTagWithCutoffNoLastTag(uint32 cutoff);
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE std::pair<uint32, bool> ReadTagWithCutoffNoLastTag(
+ uint32 cutoff);
// Usually returns true if calling ReadVarint32() now would produce the given
// value. Will always return false if ReadVarint32() would not return the
@@ -289,7 +293,7 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// parameter.
// Always inline because this collapses to a small number of instructions
// when given a constant parameter, but GCC doesn't want to inline by default.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool ExpectTag(uint32 expected);
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool ExpectTag(uint32 expected);
// Like above, except this reads from the specified buffer. The caller is
// responsible for ensuring that the buffer is large enough to read a varint
@@ -298,8 +302,9 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
//
// Returns a pointer beyond the expected tag if it was found, or NULL if it
// was not.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- static const uint8* ExpectTagFromArray(const uint8* buffer, uint32 expected);
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static const uint8* ExpectTagFromArray(
+ const uint8* buffer,
+ uint32 expected);
// Usually returns true if no more bytes can be read. Always returns false
// if more bytes can be read. If ExpectAtEnd() returns true, a subsequent
@@ -367,32 +372,42 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// Total Bytes Limit -----------------------------------------------
// To prevent malicious users from sending excessively large messages
- // and causing memory exhaustion, CodedInputStream imposes a hard limit on
- // the total number of bytes it will read.
+ // and causing integer overflows or 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 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.
- //
- // Note: setting a limit less than the current read position is interpreted
- // as a limit on the current position.
+ // 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.
//
// 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.
+ //
+ // 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 call Message::ParseFromCodedStream() instead. Then
+ // you can adjust the limit. 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.
int BytesUntilTotalBytesLimit() const;
// Recursion Limit -------------------------------------------------
@@ -570,6 +585,8 @@ 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_;
@@ -782,8 +799,8 @@ class LIBPROTOBUF_EXPORT CodedOutputStream {
// but GCC by default doesn't want to inline this.
void WriteTag(uint32 value);
// Like WriteTag() but writing directly to the target array.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- static uint8* WriteTagToArray(uint32 value, uint8* target);
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static uint8* WriteTagToArray(uint32 value,
+ uint8* target);
// Returns the number of bytes needed to encode the given value as a varint.
static size_t VarintSize32(uint32 value);
@@ -829,7 +846,7 @@ class LIBPROTOBUF_EXPORT CodedOutputStream {
// canonicalization specification and implement the serializer using
// reflection APIs rather than relying on this API.
//
- // If deterministic serialization is requested, the serializer will
+ // If determinisitc serialization is requested, the serializer will
// sort map entries by keys in lexicographical order or numerical order.
// (This is an implementation detail and may subject to change.)
//
@@ -840,18 +857,21 @@ class LIBPROTOBUF_EXPORT CodedOutputStream {
// Otherwise, SetSerializationDeterministic has been called, and the last
// value passed to it is all that matters.
void SetSerializationDeterministic(bool value) {
- is_serialization_deterministic_ = value;
+ serialization_deterministic_is_overridden_ = true;
+ serialization_deterministic_override_ = value;
}
// See above. Also, note that users of this CodedOutputStream may need to
// call IsSerializationDeterministic() to serialize in the intended way. This
// CodedOutputStream cannot enforce a desire for deterministic serialization
// by itself.
bool IsSerializationDeterministic() const {
- return is_serialization_deterministic_;
+ return serialization_deterministic_is_overridden_ ?
+ serialization_deterministic_override_ :
+ default_serialization_deterministic_;
}
static bool IsDefaultSerializationDeterministic() {
- return default_serialization_deterministic_.load(std::memory_order_relaxed) != 0;
+ return google::protobuf::internal::Acquire_Load(&default_serialization_deterministic_);
}
private:
@@ -863,8 +883,11 @@ class LIBPROTOBUF_EXPORT CodedOutputStream {
int total_bytes_; // Sum of sizes of all buffers seen so far.
bool had_error_; // Whether an error occurred during output.
bool aliasing_enabled_; // See EnableAliasing().
- bool is_serialization_deterministic_;
- static std::atomic<bool> default_serialization_deterministic_;
+ // See SetSerializationDeterministic() regarding these three fields.
+ bool serialization_deterministic_is_overridden_;
+ bool serialization_deterministic_override_;
+ // Conceptually, default_serialization_deterministic_ is an atomic bool.
+ static google::protobuf::internal::AtomicWord default_serialization_deterministic_;
// Advance the buffer by a given number of bytes.
void Advance(int amount);
@@ -891,7 +914,7 @@ class LIBPROTOBUF_EXPORT CodedOutputStream {
// thread has done so.
friend void ::google::protobuf::internal::MapTestForceDeterministic();
static void SetDefaultSerializationDeterministic() {
- default_serialization_deterministic_.store(true, std::memory_order_relaxed);
+ google::protobuf::internal::Release_Store(&default_serialization_deterministic_, 1);
}
};
@@ -1034,7 +1057,8 @@ 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);
@@ -1344,6 +1368,7 @@ 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.
@@ -1364,6 +1389,7 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream_inl.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream_inl.h
index d95b06e04e..d95b06e04e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream_inl.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream_inl.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream_unittest.cc
index 1c8d327260..96f91ae91c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/coded_stream_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/coded_stream_unittest.cc
@@ -35,6 +35,9 @@
// This file contains tests and benchmarks.
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/io/coded_stream.h>
@@ -734,7 +737,7 @@ TEST_F(CodedStreamTest, ReadStringImpossiblyLargeFromStringOnStack) {
}
TEST_F(CodedStreamTest, ReadStringImpossiblyLargeFromStringOnHeap) {
- std::unique_ptr<uint8[]> buffer(new uint8[8]);
+ google::protobuf::scoped_array<uint8> buffer(new uint8[8]);
CodedInputStream coded_input(buffer.get(), 8);
string str;
EXPECT_FALSE(coded_input.ReadString(&str, 1 << 30));
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream.cc
index a569eff0a7..a569eff0a7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream.h
index 15b02fe3d7..15b02fe3d7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream_unittest.sh b/third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream_unittest.sh
index 16251a94d3..16251a94d3 100644..100755
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/gzip_stream_unittest.sh
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/gzip_stream_unittest.sh
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/package_info.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/package_info.h
index dc1fc91e5b..dc1fc91e5b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/package_info.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/package_info.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/printer.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/printer.cc
index de67cef134..8493268dad 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/printer.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/printer.cc
@@ -350,12 +350,10 @@ void Printer::CopyToBuffer(const char* data, int size) {
while (size > buffer_size_) {
// Data exceeds space in the buffer. Copy what we can and request a
// new buffer.
- if (buffer_size_ > 0) {
- memcpy(buffer_, data, buffer_size_);
- offset_ += buffer_size_;
- data += buffer_size_;
- size -= buffer_size_;
- }
+ memcpy(buffer_, data, buffer_size_);
+ offset_ += buffer_size_;
+ data += buffer_size_;
+ size -= buffer_size_;
void* void_buffer;
failed_ = !output_->Next(&void_buffer, &buffer_size_);
if (failed_) return;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/printer.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/printer.h
index d11745ce97..d11745ce97 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/printer.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/printer.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/printer_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/printer_unittest.cc
index d0a0ebeea2..d0a0ebeea2 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/printer_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/printer_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/strtod.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/strtod.cc
index a90bb9a31e..a90bb9a31e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/strtod.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/strtod.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/strtod.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/strtod.h
index f56e41c840..f56e41c840 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/strtod.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/strtod.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer.cc
index 916d1606b7..916d1606b7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer.h
index e80d564cd5..e80d564cd5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer_unittest.cc
index e55288e2ff..e55288e2ff 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/tokenizer_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/tokenizer_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream.cc
index f81555e554..f81555e554 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream.h
index 62ace7ae33..62ace7ae33 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl.cc
index dd92113573..81fb50335b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl.cc
@@ -43,9 +43,9 @@
#include <algorithm>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/io_win32.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/stl_util.h>
-#include <google/protobuf/stubs/io_win32.h>
namespace google {
@@ -56,6 +56,9 @@ namespace io {
// Win32 lseek is broken: If invoked on a non-seekable file descriptor, its
// return value is undefined. We re-define it to always produce an error.
#define lseek(fd, offset, origin) ((off_t)-1)
+#endif
+
+#ifdef _MSC_VER
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
using google::protobuf::internal::win32::access;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl.h
index ea978bfbb7..ea978bfbb7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
index 66ad49bcc0..60c71c8027 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
@@ -196,6 +196,27 @@ void StringOutputStream::SetString(string* target) {
// ===================================================================
+LazyStringOutputStream::LazyStringOutputStream(
+ ResultCallback<string*>* callback)
+ : StringOutputStream(NULL),
+ callback_(GOOGLE_CHECK_NOTNULL(callback)),
+ string_is_set_(false) {
+}
+
+bool LazyStringOutputStream::Next(void** data, int* size) {
+ if (!string_is_set_) {
+ SetString(callback_->Run());
+ string_is_set_ = true;
+ }
+ return StringOutputStream::Next(data, size);
+}
+
+int64 LazyStringOutputStream::ByteCount() const {
+ return string_is_set_ ? StringOutputStream::ByteCount() : 0;
+}
+
+// ===================================================================
+
int CopyingInputStream::Skip(int count) {
char junk[4096];
int skipped = 0;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h
index 29f63bf04a..a7bbc625ff 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h
@@ -45,6 +45,9 @@
#define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <iosfwd>
#include <google/protobuf/io/zero_copy_stream.h>
@@ -153,6 +156,26 @@ class LIBPROTOBUF_EXPORT StringOutputStream : public ZeroCopyOutputStream {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOutputStream);
};
+// LazyStringOutputStream is a StringOutputStream with lazy acquisition of
+// the output string from a callback. The string is owned externally, and not
+// deleted in the stream destructor.
+class LIBPROTOBUF_EXPORT LazyStringOutputStream : public StringOutputStream {
+ public:
+ // Callback should be permanent (non-self-deleting). Ownership is transferred
+ // to the LazyStringOutputStream.
+ explicit LazyStringOutputStream(ResultCallback<string*>* callback);
+
+ // implements ZeroCopyOutputStream, overriding StringOutputStream -----------
+ bool Next(void** data, int* size);
+ int64 ByteCount() const;
+
+ private:
+ const google::protobuf::scoped_ptr<ResultCallback<string*> > callback_;
+ bool string_is_set_;
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyStringOutputStream);
+};
+
// Note: There is no StringInputStream. Instead, just create an
// ArrayInputStream as follows:
// ArrayInputStream input(str.data(), str.size());
@@ -236,7 +259,7 @@ class LIBPROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream
// Data is read into this buffer. It may be NULL if no buffer is currently
// in use. Otherwise, it points to an array of size buffer_size_.
- std::unique_ptr<uint8[]> buffer_;
+ google::protobuf::scoped_array<uint8> buffer_;
const int buffer_size_;
// Number of valid bytes currently in the buffer (i.e. the size last
@@ -325,7 +348,7 @@ class LIBPROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStrea
// Data is written from this buffer. It may be NULL if no buffer is
// currently in use. Otherwise, it points to an array of size buffer_size_.
- std::unique_ptr<uint8[]> buffer_;
+ google::protobuf::scoped_array<uint8> buffer_;
const int buffer_size_;
// Number of valid bytes currently in the buffer (i.e. the size last
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_unittest.cc
index 08de8cb1ce..2bca6a9088 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/io/zero_copy_stream_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/io/zero_copy_stream_unittest.cc
@@ -56,6 +56,9 @@
#include <fcntl.h>
#include <errno.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <sstream>
#include <google/protobuf/testing/file.h>
@@ -67,11 +70,11 @@
#endif
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/io_win32.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/testing/googletest.h>
#include <google/protobuf/testing/file.h>
#include <gtest/gtest.h>
-#include <google/protobuf/stubs/io_win32.h>
namespace google {
namespace protobuf {
@@ -80,6 +83,9 @@ namespace {
#ifdef _WIN32
#define pipe(fds) _pipe(fds, 4096, O_BINARY)
+#endif
+
+#ifdef _MSC_VER
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
using google::protobuf::internal::win32::access;
@@ -203,7 +209,7 @@ void IoTest::WriteString(ZeroCopyOutputStream* output, const string& str) {
}
void IoTest::ReadString(ZeroCopyInputStream* input, const string& str) {
- std::unique_ptr<char[]> buffer(new char[str.size() + 1]);
+ google::protobuf::scoped_array<char> buffer(new char[str.size() + 1]);
buffer[str.size()] = '\0';
EXPECT_EQ(ReadFromInput(input, buffer.get(), str.size()), str.size());
EXPECT_STREQ(str.c_str(), buffer.get());
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/lite_arena_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/lite_arena_unittest.cc
index 3e88314d61..f0bee880aa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/lite_arena_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/lite_arena_unittest.cc
@@ -30,28 +30,20 @@
#include <google/protobuf/arena_test_util.h>
#include <google/protobuf/map_lite_test_util.h>
+#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
namespace google {
namespace protobuf {
namespace {
-class LiteArenaTest : public testing::Test {
- protected:
- LiteArenaTest() {
- ArenaOptions options;
- options.start_block_size = 128 * 1024;
- options.max_block_size = 128 * 1024;
- arena_.reset(new Arena(options));
- // Trigger the allocation of the first arena block, so that further use of
- // the arena will not require any heap allocations.
- google::protobuf::Arena::CreateArray<char>(arena_.get(), 1);
- }
-
- std::unique_ptr<Arena> arena_;
-};
-
-TEST_F(LiteArenaTest, MapNoHeapAllocation) {
+TEST(LiteArenaTest, MapNoHeapAllocation) {
+ // Allocate a large initial block to avoid mallocs during hooked test.
+ std::vector<char> arena_block(128 * 1024);
+ google::protobuf::ArenaOptions options;
+ options.initial_block = &arena_block[0];
+ options.initial_block_size = arena_block.size();
+ google::protobuf::Arena arena(options);
string data;
data.reserve(128 * 1024);
@@ -61,21 +53,22 @@ TEST_F(LiteArenaTest, MapNoHeapAllocation) {
// google::protobuf::internal::NoHeapChecker no_heap;
protobuf_unittest::TestArenaMapLite* from =
- Arena::CreateMessage<protobuf_unittest::TestArenaMapLite>(arena_.get());
+ google::protobuf::Arena::CreateMessage<protobuf_unittest::TestArenaMapLite>(&arena);
google::protobuf::MapLiteTestUtil::SetArenaMapFields(from);
from->SerializeToString(&data);
protobuf_unittest::TestArenaMapLite* to =
- Arena::CreateMessage<protobuf_unittest::TestArenaMapLite>(arena_.get());
+ google::protobuf::Arena::CreateMessage<protobuf_unittest::TestArenaMapLite>(&arena);
to->ParseFromString(data);
google::protobuf::MapLiteTestUtil::ExpectArenaMapFieldsSet(*to);
}
}
-TEST_F(LiteArenaTest, UnknownFieldMemLeak) {
+TEST(LiteArenaTest, UnknownFieldMemLeak) {
+ google::protobuf::Arena arena;
protobuf_unittest::ForeignMessageArenaLite* message =
google::protobuf::Arena::CreateMessage<protobuf_unittest::ForeignMessageArenaLite>(
- arena_.get());
+ &arena);
string data = "\012\000";
int original_capacity = data.capacity();
while (data.capacity() <= original_capacity) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/lite_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/lite_unittest.cc
index b42a7b1466..6cf1662919 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/lite_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/lite_unittest.cc
@@ -621,7 +621,7 @@ TEST(Lite, AllLite28) {
google::protobuf::MapLiteTestUtil::SetMapFields(&message1);
int size = message1.ByteSize();
data.resize(size);
- ::google::protobuf::uint8* start = reinterpret_cast<::google::protobuf::uint8*>(::google::protobuf::string_as_array(&data));
+ ::google::protobuf::uint8* start = reinterpret_cast< ::google::protobuf::uint8*>(::google::protobuf::string_as_array(&data));
::google::protobuf::uint8* end = message1.SerializeWithCachedSizesToArray(start);
EXPECT_EQ(size, end - start);
EXPECT_TRUE(message2.ParseFromString(data));
@@ -988,49 +988,3 @@ TEST(Lite, AllLite44) {
std::cout << "PASS" << std::endl;
}
-
-TEST(Lite, AllLite45) {
- // Test unknown fields are not discarded upon parsing.
- string data = "\20\1"; // varint 1 with field number 2
-
- protobuf_unittest::ForeignMessageLite a;
- EXPECT_TRUE(a.ParseFromString(data));
- google::protobuf::io::CodedInputStream input_stream(
- reinterpret_cast<const ::google::protobuf::uint8*>(data.data()), data.size());
- EXPECT_TRUE(a.MergePartialFromCodedStream(&input_stream));
-
- string serialized = a.SerializeAsString();
- EXPECT_EQ(serialized.substr(0, 2), data);
- EXPECT_EQ(serialized.substr(2), data);
-}
-
-// The following two tests check for wire compatibility between packed and
-// unpacked repeated fields. There used to be a bug in the generated parsing
-// code that caused us to calculate the highest possible tag number without
-// taking into account that a repeated field might not be in the packed (or
-// unpacked) state we expect. These tests specifically check for that issue by
-// making sure we can parse repeated fields when the tag is higher than we would
-// expect.
-TEST(Lite, AllLite46) {
- protobuf_unittest::PackedInt32 packed;
- packed.add_repeated_int32(42);
- string serialized;
- ASSERT_TRUE(packed.SerializeToString(&serialized));
-
- protobuf_unittest::NonPackedInt32 non_packed;
- ASSERT_TRUE(non_packed.ParseFromString(serialized));
- ASSERT_EQ(1, non_packed.repeated_int32_size());
- EXPECT_EQ(42, non_packed.repeated_int32(0));
-}
-
-TEST(Lite, AllLite47) {
- protobuf_unittest::NonPackedFixed32 non_packed;
- non_packed.add_repeated_fixed32(42);
- string serialized;
- ASSERT_TRUE(non_packed.SerializeToString(&serialized));
-
- protobuf_unittest::PackedFixed32 packed;
- ASSERT_TRUE(packed.ParseFromString(serialized));
- ASSERT_EQ(1, packed.repeated_fixed32_size());
- EXPECT_EQ(42, packed.repeated_fixed32(0));
-}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map.h b/third_party/protobuf/3.4.0/src/google/protobuf/map.h
index 6463ac2e02..6514a0cc6d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map.h
@@ -37,7 +37,6 @@
#ifndef GOOGLE_PROTOBUF_MAP_H__
#define GOOGLE_PROTOBUF_MAP_H__
-#include <initializer_list>
#include <iterator>
#include <limits> // To support Visual Studio 2008
#include <set>
@@ -143,24 +142,6 @@ class Map {
insert(other.begin(), other.end());
}
- Map(Map&& other) noexcept : Map() {
- if (other.arena_) {
- *this = other;
- } else {
- swap(other);
- }
- }
- Map& operator=(Map&& other) noexcept {
- if (this != &other) {
- if (arena_ != other.arena_) {
- *this = other;
- } else {
- swap(other);
- }
- }
- return *this;
- }
-
template <class InputIt>
Map(const InputIt& first, const InputIt& last)
: arena_(NULL), default_enum_value_(0) {
@@ -200,7 +181,7 @@ class Map {
MapAllocator(const MapAllocator<X>& allocator)
: arena_(allocator.arena()) {}
- pointer allocate(size_type n, const void* /* hint */ = 0) {
+ pointer allocate(size_type n, const void* hint = 0) {
// If arena is not given, malloc needs to be called which doesn't
// construct element object.
if (arena_ == NULL) {
@@ -216,7 +197,6 @@ class Map {
#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
::operator delete(p, n * sizeof(value_type));
#else
- (void)n;
::operator delete(p);
#endif
}
@@ -740,7 +720,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
@@ -1055,12 +1035,12 @@ class Map {
}
const T& at(const key_type& key) const {
const_iterator it = find(key);
- GOOGLE_CHECK(it != end()) << "key not found: " << key;
+ GOOGLE_CHECK(it != end());
return it->second;
}
T& at(const key_type& key) {
iterator it = find(key);
- GOOGLE_CHECK(it != end()) << "key not found: " << key;
+ GOOGLE_CHECK(it != end());
return it->second;
}
@@ -1112,9 +1092,6 @@ class Map {
}
}
}
- void insert(std::initializer_list<value_type> values) {
- insert(values.begin(), values.end());
- }
// Erase and clear
size_type erase(const key_type& key) {
@@ -1164,7 +1141,9 @@ class Map {
// Access to hasher. Currently this returns a copy, but it may
// be modified to return a const reference in the future.
- hasher hash_function() const { return elements_->hash_function(); }
+ hasher hash_function() const {
+ return elements_->hash_function();
+ }
private:
// Set default enum value only for proto2 map field whose value is enum type.
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_entry.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_entry.h
index 801def9784..afe809b28a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_entry.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_entry.h
@@ -87,6 +87,29 @@ class MapEntry
: public MapEntryImpl<Derived, Message, Key, Value, kKeyFieldType,
kValueFieldType, default_enum_value> {
public:
+ // Create default MapEntry instance for given descriptor. Descriptor has to be
+ // given when creating default MapEntry instance because different map field
+ // may have the same type and MapEntry class. The given descriptor is needed
+ // to distinguish instances of the same MapEntry class.
+ static const Reflection* CreateReflection(const Descriptor* descriptor,
+ const Derived* entry) {
+ ReflectionSchema schema = {
+ entry,
+ offsets_,
+ has_bits_,
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, _has_bits_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, _internal_metadata_),
+ -1,
+ -1,
+ sizeof(MapEntry),
+ -1,
+ };
+ const Reflection* reflection = new GeneratedMessageReflection(
+ descriptor, schema, DescriptorPool::generated_pool(),
+ MessageFactory::generated_factory());
+ return reflection;
+ }
+
MapEntry() : _internal_metadata_(NULL) {}
explicit MapEntry(Arena* arena)
: MapEntryImpl<Derived, Message, Key, Value, kKeyFieldType,
@@ -95,9 +118,11 @@ class MapEntry
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
+ private:
+ static uint32 offsets_[2];
+ static uint32 has_bits_[2];
InternalMetadataWithArena _internal_metadata_;
- private:
friend class ::google::protobuf::Arena;
template <typename C, typename K, typename V,
WireFormatLite::FieldType k_wire_type, WireFormatLite::FieldType,
@@ -108,18 +133,32 @@ class MapEntry
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapEntry);
};
+template <typename Derived, typename Key, typename Value,
+ WireFormatLite::FieldType kKeyFieldType,
+ WireFormatLite::FieldType kValueFieldType, int default_enum_value>
+uint32 MapEntry<Derived, Key, Value, kKeyFieldType, kValueFieldType,
+ default_enum_value>::offsets_[2] = {
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, key_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, value_),
+};
+
+template <typename Derived, typename Key, typename Value,
+ WireFormatLite::FieldType kKeyFieldType,
+ WireFormatLite::FieldType kValueFieldType, int default_enum_value>
+uint32 MapEntry<Derived, Key, Value, kKeyFieldType, kValueFieldType,
+ default_enum_value>::has_bits_[2] = {0, 1};
+
// Specialization for the full runtime
template <typename Derived, typename Key, typename Value,
WireFormatLite::FieldType kKeyFieldType,
WireFormatLite::FieldType kValueFieldType, int default_enum_value>
struct MapEntryHelper<MapEntry<Derived, Key, Value, kKeyFieldType,
kValueFieldType, default_enum_value> >
- : MapEntryHelper<MapEntryLite<Derived, Key, Value, kKeyFieldType,
- kValueFieldType, default_enum_value> > {
+ : MapEntryHelper<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType,
+ default_enum_value> > {
explicit MapEntryHelper(const MapPair<Key, Value>& map_pair)
- : MapEntryHelper<MapEntryLite<Derived, Key, Value, kKeyFieldType,
- kValueFieldType, default_enum_value> >(
- map_pair) {}
+ : MapEntryHelper<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType,
+ default_enum_value> >(map_pair) {}
};
template <typename Derived, typename K, typename V,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_entry_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_entry_lite.h
index 85a0bed713..0bccf4d2fd 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_entry_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_entry_lite.h
@@ -33,12 +33,9 @@
#include <assert.h>
-#include <google/protobuf/stubs/casts.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>
#include <google/protobuf/wire_format_lite_inl.h>
namespace google {
@@ -135,14 +132,14 @@ class MapEntryImpl : public Base {
static const WireFormatLite::FieldType kEntryValueFieldType = kValueFieldType;
static const int kEntryDefaultEnumValue = default_enum_value;
- MapEntryImpl() : arena_(NULL) {
+ MapEntryImpl() : default_instance_(NULL), arena_(NULL) {
KeyTypeHandler::Initialize(&key_, NULL);
ValueTypeHandler::InitializeMaybeByDefaultEnum(&value_, default_enum_value,
NULL);
_has_bits_[0] = 0;
}
- explicit MapEntryImpl(Arena* arena) : arena_(arena) {
+ explicit MapEntryImpl(Arena* arena) : default_instance_(NULL), arena_(arena) {
KeyTypeHandler::Initialize(&key_, arena);
ValueTypeHandler::InitializeMaybeByDefaultEnum(&value_, default_enum_value,
arena);
@@ -150,9 +147,11 @@ class MapEntryImpl : public Base {
}
~MapEntryImpl() {
- if (GetArenaNoVirtual() != NULL) return;
- KeyTypeHandler::DeleteNoArena(key_);
- ValueTypeHandler::DeleteNoArena(value_);
+ if (this != default_instance_) {
+ if (GetArenaNoVirtual() != NULL) return;
+ KeyTypeHandler::DeleteNoArena(key_);
+ ValueTypeHandler::DeleteNoArena(value_);
+ }
}
// accessors ======================================================
@@ -161,8 +160,9 @@ class MapEntryImpl : public Base {
return KeyTypeHandler::GetExternalReference(key_);
}
virtual inline const ValueMapEntryAccessorType& value() const {
- return ValueTypeHandler::DefaultIfNotInitialized(
- value_, Derived::internal_default_instance()->value_);
+ GOOGLE_CHECK(default_instance_ != NULL);
+ return ValueTypeHandler::DefaultIfNotInitialized(value_,
+ default_instance_->value_);
}
inline KeyMapEntryAccessorType* mutable_key() {
set_has_key();
@@ -202,7 +202,8 @@ class MapEntryImpl : public Base {
return false;
}
set_has_key();
- break;
+ if (!input->ExpectTag(kValueTag)) break;
+ GOOGLE_FALLTHROUGH_INTENDED;
case kValueTag:
if (!ValueTypeHandler::Read(input, mutable_value())) {
@@ -264,11 +265,13 @@ class MapEntryImpl : public Base {
Base* New() const {
Derived* entry = new Derived;
+ entry->default_instance_ = default_instance_;
return entry;
}
Base* New(Arena* arena) const {
Derived* entry = Arena::CreateMessage<Derived>(arena);
+ entry->default_instance_ = default_instance_;
return entry;
}
@@ -306,10 +309,13 @@ class MapEntryImpl : public Base {
clear_has_value();
}
- static void InitAsDefaultInstance() {
- Derived* d = const_cast<Derived*>(Derived::internal_default_instance());
- KeyTypeHandler::AssignDefaultValue(&d->key_);
- ValueTypeHandler::AssignDefaultValue(&d->value_);
+ void set_default_instance(MapEntryImpl* default_instance) {
+ default_instance_ = default_instance;
+ }
+
+ void InitAsDefaultInstance() {
+ KeyTypeHandler::AssignDefaultValue(&key_);
+ ValueTypeHandler::AssignDefaultValue(&value_);
}
Arena* GetArena() const {
@@ -355,9 +361,9 @@ class MapEntryImpl : public Base {
// We could use memcmp here, but we don't bother. The tag is one byte.
GOOGLE_COMPILE_ASSERT(kTagSize == 1, tag_size_error);
if (size > 0 && *reinterpret_cast<const char*>(data) == kValueTag) {
- typename Map::size_type map_size = map_->size();
+ typename Map::size_type size = map_->size();
value_ptr_ = &(*map_)[key_];
- if (GOOGLE_PREDICT_TRUE(map_size != map_->size())) {
+ if (GOOGLE_PREDICT_TRUE(size != map_->size())) {
// We created a new key-value pair. Fill in the value.
typedef
typename MapIf<ValueTypeHandler::kIsEnum, int*, Value*>::type T;
@@ -387,7 +393,7 @@ class MapEntryImpl : public Base {
const Value& value() const { return *value_ptr_; }
private:
- void UseKeyAndValueFromEntry() GOOGLE_PROTOBUF_ATTRIBUTE_COLD {
+ void UseKeyAndValueFromEntry() GOOGLE_ATTRIBUTE_COLD {
// Update key_ in case we need it later (because key() is called).
// This is potentially inefficient, especially if the key is
// expensive to copy (e.g., a long string), but this is a cold
@@ -405,7 +411,7 @@ class MapEntryImpl : public Base {
// into map_, we are not at the end of the input. This is unusual, but
// allowed by the spec.
bool ReadBeyondKeyValuePair(::google::protobuf::io::CodedInputStream* input)
- GOOGLE_PROTOBUF_ATTRIBUTE_COLD {
+ GOOGLE_ATTRIBUTE_COLD {
typedef MoveHelper<KeyTypeHandler::kIsEnum,
KeyTypeHandler::kIsMessage,
KeyTypeHandler::kWireType ==
@@ -432,7 +438,7 @@ class MapEntryImpl : public Base {
Value* value_ptr_;
// On the fast path entry_ is not used. And, when entry_ is used, it's set
// to mf_->NewEntry(), so in the arena case we must call entry_.release.
- std::unique_ptr<MapEntryImpl> entry_;
+ google::protobuf::scoped_ptr<MapEntryImpl> entry_;
};
protected:
@@ -511,13 +517,13 @@ class MapEntryImpl : public Base {
return arena_;
}
- public: // Needed for constructing tables
+ MapEntryImpl* default_instance_;
+
KeyOnMemory key_;
ValueOnMemory value_;
Arena* arena_;
uint32 _has_bits_[1];
- private:
friend class ::google::protobuf::Arena;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
@@ -531,20 +537,23 @@ class MapEntryImpl : public Base {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapEntryImpl);
};
-template <typename T, typename Key, typename Value,
- WireFormatLite::FieldType kKeyFieldType,
+template <typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType,
WireFormatLite::FieldType kValueFieldType, int default_enum_value>
class MapEntryLite
- : public MapEntryImpl<T, MessageLite, Key, Value, kKeyFieldType,
+ : public MapEntryImpl<MapEntryLite<Key, Value, kKeyFieldType,
+ kValueFieldType, default_enum_value>,
+ MessageLite, Key, Value, kKeyFieldType,
kValueFieldType, default_enum_value> {
public:
- typedef MapEntryImpl<T, MessageLite, Key, Value, kKeyFieldType,
+ typedef MapEntryImpl<MapEntryLite, MessageLite, Key, Value, kKeyFieldType,
kValueFieldType, default_enum_value>
SuperType;
MapEntryLite() {}
explicit MapEntryLite(Arena* arena) : SuperType(arena) {}
- void MergeFrom(const MapEntryLite& other) { MergeFromInternal(other); }
-
+ void MergeFrom(const MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType,
+ default_enum_value>& other) {
+ MergeFromInternal(other);
+ }
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapEntryLite);
};
@@ -554,9 +563,9 @@ class MapEntryLite
template <typename Derived>
struct DeconstructMapEntry;
-template <typename T, typename K, typename V, WireFormatLite::FieldType key,
+template <typename K, typename V, WireFormatLite::FieldType key,
WireFormatLite::FieldType value, int default_enum>
-struct DeconstructMapEntry<MapEntryLite<T, K, V, key, value, default_enum> > {
+struct DeconstructMapEntry<MapEntryLite<K, V, key, value, default_enum> > {
typedef K Key;
typedef V Value;
static const WireFormatLite::FieldType kKeyFieldType = key;
@@ -604,9 +613,7 @@ template <>
struct FromHelper<WireFormatLite::TYPE_STRING> {
static ArenaStringPtr From(const string& x) {
ArenaStringPtr res;
- TaggedPtr<::std::string> ptr;
- ptr.Set(const_cast<string*>(&x));
- res.UnsafeSetTaggedPointer(ptr);
+ res.UnsafeArenaSetAllocated(NULL, const_cast<string*>(&x), NULL);
return res;
}
};
@@ -614,9 +621,7 @@ template <>
struct FromHelper<WireFormatLite::TYPE_BYTES> {
static ArenaStringPtr From(const string& x) {
ArenaStringPtr res;
- TaggedPtr<::std::string> ptr;
- ptr.Set(const_cast<string*>(&x));
- res.UnsafeSetTaggedPointer(ptr);
+ res.UnsafeArenaSetAllocated(NULL, const_cast<string*>(&x), NULL);
return res;
}
};
@@ -631,11 +636,10 @@ struct FromHelper<WireFormatLite::TYPE_MESSAGE> {
template <typename MapEntryType>
struct MapEntryHelper;
-template <typename T, typename Key, typename Value,
- WireFormatLite::FieldType kKeyFieldType,
+template <typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType,
WireFormatLite::FieldType kValueFieldType, int default_enum_value>
-struct MapEntryHelper<MapEntryLite<T, Key, Value, kKeyFieldType,
- kValueFieldType, default_enum_value> > {
+struct MapEntryHelper<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType,
+ default_enum_value> > {
// Provide utilities to parse/serialize key/value. Provide utilities to
// manipulate internal stored type.
typedef MapTypeHandler<kKeyFieldType, Key> KeyTypeHandler;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/map_field.cc
index ac29c7e952..64dcc990ff 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_field.cc
@@ -43,15 +43,13 @@ MapFieldBase::~MapFieldBase() {
const RepeatedPtrFieldBase& MapFieldBase::GetRepeatedField() const {
SyncRepeatedFieldWithMap();
- return *reinterpret_cast<::google::protobuf::internal::RepeatedPtrFieldBase*>(
- repeated_field_);
+ return *repeated_field_;
}
RepeatedPtrFieldBase* MapFieldBase::MutableRepeatedField() {
SyncRepeatedFieldWithMap();
SetRepeatedDirty();
- return reinterpret_cast<::google::protobuf::internal::RepeatedPtrFieldBase*>(
- repeated_field_);
+ return repeated_field_;
}
size_t MapFieldBase::SpaceUsedExcludingSelfLong() const {
@@ -72,39 +70,29 @@ size_t MapFieldBase::SpaceUsedExcludingSelfNoLock() const {
bool MapFieldBase::IsMapValid() const {
// "Acquire" insures the operation after SyncRepeatedFieldWithMap won't get
// executed before state_ is checked.
- int state = state_.load(std::memory_order_acquire);
+ Atomic32 state = google::protobuf::internal::Acquire_Load(&state_);
return state != STATE_MODIFIED_REPEATED;
}
-bool MapFieldBase::IsRepeatedFieldValid() const {
- int state = state_.load(std::memory_order_acquire);
- return state != STATE_MODIFIED_MAP;
-}
-
-void MapFieldBase::SetMapDirty() {
- // These are called by (non-const) mutator functions. So by our API it's the
- // callers responsibility to have these calls properly ordered.
- state_.store(STATE_MODIFIED_MAP, std::memory_order_relaxed);
-}
+void MapFieldBase::SetMapDirty() { state_ = STATE_MODIFIED_MAP; }
-void MapFieldBase::SetRepeatedDirty() {
- // These are called by (non-const) mutator functions. So by our API it's the
- // callers responsibility to have these calls properly ordered.
- state_.store(STATE_MODIFIED_REPEATED, std::memory_order_relaxed);
-}
+void MapFieldBase::SetRepeatedDirty() { state_ = STATE_MODIFIED_REPEATED; }
void* MapFieldBase::MutableRepeatedPtrField() const { return repeated_field_; }
void MapFieldBase::SyncRepeatedFieldWithMap() const {
- // acquire here matches with release below to ensure that we can only see a
- // value of CLEAN after all previous changes have been synced.
- if (state_.load(std::memory_order_acquire) == STATE_MODIFIED_MAP) {
+ // "Acquire" insures the operation after SyncRepeatedFieldWithMap won't get
+ // executed before state_ is checked.
+ Atomic32 state = google::protobuf::internal::Acquire_Load(&state_);
+ if (state == STATE_MODIFIED_MAP) {
mutex_.Lock();
// Double check state, because another thread may have seen the same state
// and done the synchronization before the current thread.
- if (state_.load(std::memory_order_relaxed) == STATE_MODIFIED_MAP) {
+ if (state_ == STATE_MODIFIED_MAP) {
SyncRepeatedFieldWithMapNoLock();
- state_.store(CLEAN, std::memory_order_release);
+ // "Release" insures state_ can only be changed "after"
+ // SyncRepeatedFieldWithMapNoLock is finished.
+ google::protobuf::internal::Release_Store(&state_, CLEAN);
}
mutex_.Unlock();
}
@@ -117,15 +105,18 @@ void MapFieldBase::SyncRepeatedFieldWithMapNoLock() const {
}
void MapFieldBase::SyncMapWithRepeatedField() const {
- // acquire here matches with release below to ensure that we can only see a
- // value of CLEAN after all previous changes have been synced.
- if (state_.load(std::memory_order_acquire) == STATE_MODIFIED_REPEATED) {
+ // "Acquire" insures the operation after SyncMapWithRepeatedField won't get
+ // executed before state_ is checked.
+ Atomic32 state = google::protobuf::internal::Acquire_Load(&state_);
+ if (state == STATE_MODIFIED_REPEATED) {
mutex_.Lock();
// Double check state, because another thread may have seen the same state
// and done the synchronization before the current thread.
- if (state_.load(std::memory_order_relaxed) == STATE_MODIFIED_REPEATED) {
+ if (state_ == STATE_MODIFIED_REPEATED) {
SyncMapWithRepeatedFieldNoLock();
- state_.store(CLEAN, std::memory_order_release);
+ // "Release" insures state_ can only be changed "after"
+ // SyncRepeatedFieldWithMapNoLock is finished.
+ google::protobuf::internal::Release_Store(&state_, CLEAN);
}
mutex_.Unlock();
}
@@ -139,7 +130,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/map_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_field.h
index 494401e129..bd47890166 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_field.h
@@ -31,8 +31,7 @@
#ifndef GOOGLE_PROTOBUF_MAP_FIELD_H__
#define GOOGLE_PROTOBUF_MAP_FIELD_H__
-#include <atomic>
-
+#include <google/protobuf/stubs/atomicops.h>
#include <google/protobuf/stubs/mutex.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/generated_message_reflection.h>
@@ -87,8 +86,6 @@ class LIBPROTOBUF_EXPORT MapFieldBase {
virtual bool ContainsMapKey(const MapKey& map_key) const = 0;
virtual bool InsertOrLookupMapValue(
const MapKey& map_key, MapValueRef* val) = 0;
- // Returns whether changes to the map are reflected in the repeated field.
- bool IsRepeatedFieldValid() const;
// Insures operations after won't get executed before calling this.
bool IsMapValid() const;
virtual bool DeleteMapValue(const MapKey& map_key) = 0;
@@ -143,7 +140,9 @@ class LIBPROTOBUF_EXPORT MapFieldBase {
mutable Mutex mutex_; // The thread to synchronize map and repeated field
// needs to get lock first;
- mutable std::atomic<State> state_;
+ mutable volatile Atomic32 state_; // 0: STATE_MODIFIED_MAP
+ // 1: STATE_MODIFIED_REPEATED
+ // 2: CLEAN
private:
friend class ContendedMapCleanTest;
@@ -218,9 +217,8 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> {
// Define message type for internal repeated field.
typedef Derived EntryType;
- typedef MapEntryLite<Derived, Key, T, kKeyFieldType, kValueFieldType,
- default_enum_value>
- EntryLiteType;
+ typedef MapEntryLite<Key, T, kKeyFieldType, kValueFieldType,
+ default_enum_value> EntryLiteType;
// Define abbreviation for parent MapFieldLite
typedef MapFieldLite<Derived, Key, T, kKeyFieldType, kValueFieldType,
@@ -297,13 +295,11 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapField);
};
-template <typename T, typename Key, typename Value,
- WireFormatLite::FieldType kKeyFieldType,
- WireFormatLite::FieldType kValueFieldType, int default_enum_value>
-struct MapEntryToMapField<MapEntry<T, Key, Value, kKeyFieldType,
- kValueFieldType, default_enum_value> > {
- typedef MapField<T, Key, Value, kKeyFieldType, kValueFieldType,
- default_enum_value>
+template <typename MEntry>
+struct MapEntryToMapField {
+ typedef DeconstructMapEntry<typename MEntry::SuperType> T;
+ typedef MapField<MEntry, typename T::Key, typename T::Value, T::kKeyFieldType,
+ T::kValueFieldType, T::default_enum_value>
MapFieldType;
};
@@ -815,13 +811,13 @@ struct hash<google::protobuf::MapKey> {
case google::protobuf::FieldDescriptor::CPPTYPE_STRING:
return hash<string>()(map_key.GetStringValue());
case google::protobuf::FieldDescriptor::CPPTYPE_INT64:
- return hash<::google::protobuf::int64>()(map_key.GetInt64Value());
+ return hash< ::google::protobuf::int64>()(map_key.GetInt64Value());
case google::protobuf::FieldDescriptor::CPPTYPE_INT32:
- return hash<::google::protobuf::int32>()(map_key.GetInt32Value());
+ return hash< ::google::protobuf::int32>()(map_key.GetInt32Value());
case google::protobuf::FieldDescriptor::CPPTYPE_UINT64:
- return hash<::google::protobuf::uint64>()(map_key.GetUInt64Value());
+ return hash< ::google::protobuf::uint64>()(map_key.GetUInt64Value());
case google::protobuf::FieldDescriptor::CPPTYPE_UINT32:
- return hash<::google::protobuf::uint32>()(map_key.GetUInt32Value());
+ return hash< ::google::protobuf::uint32>()(map_key.GetUInt32Value());
case google::protobuf::FieldDescriptor::CPPTYPE_BOOL:
return hash<bool>()(map_key.GetBoolValue());
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_field_inl.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_field_inl.h
index d0517792f0..e317b5ed42 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_field_inl.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_field_inl.h
@@ -32,8 +32,10 @@
#define GOOGLE_PROTOBUF_MAP_FIELD_INL_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
-#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/map.h>
#include <google/protobuf/map_field.h>
#include <google/protobuf/map_type_handler.h>
@@ -252,11 +254,7 @@ void MapField<Derived, Key, T, kKeyFieldType, kValueFieldType,
default_enum_value>::Swap(MapField* other) {
std::swap(this->MapFieldBase::repeated_field_, other->repeated_field_);
impl_.Swap(&other->impl_);
- // a relaxed swap of the atomic
- auto other_state = other->state_.load(std::memory_order_relaxed);
- auto this_state = this->MapFieldBase::state_.load(std::memory_order_relaxed);
- other->state_.store(this_state, std::memory_order_relaxed);
- this->MapFieldBase::state_.store(other_state, std::memory_order_relaxed);
+ std::swap(this->MapFieldBase::state_, other->state_);
}
template <typename Derived, typename Key, typename T,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_field_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_field_lite.h
index f648b43034..12d4e6bae1 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_field_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_field_lite.h
@@ -121,21 +121,6 @@ bool AllAreInitialized(const Map<Key, T>& t) {
return true;
}
-template <typename MEntry>
-struct MapEntryToMapField : MapEntryToMapField<typename MEntry::SuperType> {};
-
-template <typename T, typename Key, typename Value,
- WireFormatLite::FieldType kKeyFieldType,
- WireFormatLite::FieldType kValueFieldType, int default_enum_value>
-struct MapEntryToMapField<MapEntryLite<T, Key, Value, kKeyFieldType,
- kValueFieldType, default_enum_value> > {
- typedef MapFieldLite<MapEntryLite<T, Key, Value, kKeyFieldType,
- kValueFieldType, default_enum_value>,
- Key, Value, kKeyFieldType, kValueFieldType,
- default_enum_value>
- MapFieldType;
-};
-
} // namespace internal
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_field_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/map_field_test.cc
index f58d59e5a7..8617a366af 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_field_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_field_test.cc
@@ -30,6 +30,9 @@
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -68,18 +71,10 @@ class MapFieldBaseStub : public MapFieldBase {
RepeatedPtrField<Message>* InternalRepeatedField() {
return repeated_field_;
}
- bool IsMapClean() {
- return state_.load(std::memory_order_relaxed) != STATE_MODIFIED_MAP;
- }
- bool IsRepeatedClean() {
- return state_.load(std::memory_order_relaxed) != STATE_MODIFIED_REPEATED;
- }
- void SetMapDirty() {
- state_.store(STATE_MODIFIED_MAP, std::memory_order_relaxed);
- }
- void SetRepeatedDirty() {
- state_.store(STATE_MODIFIED_REPEATED, std::memory_order_relaxed);
- }
+ bool IsMapClean() { return state_ != 0; }
+ bool IsRepeatedClean() { return state_ != 1; }
+ void SetMapDirty() { state_ = 0; }
+ void SetRepeatedDirty() { state_ = 1; }
bool ContainsMapKey(const MapKey& map_key) const {
return false;
}
@@ -106,7 +101,7 @@ class MapFieldBaseStub : public MapFieldBase {
class MapFieldBasePrimitiveTest : public ::testing::Test {
protected:
- typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType;
+ typedef unittest::TestMap::TestMap_MapInt32Int32Entry EntryType;
typedef MapField<EntryType, int32, int32, WireFormatLite::TYPE_INT32,
WireFormatLite::TYPE_INT32, false>
MapFieldType;
@@ -129,7 +124,7 @@ class MapFieldBasePrimitiveTest : public ::testing::Test {
EXPECT_EQ(2, map_->size());
}
- std::unique_ptr<MapFieldType> map_field_;
+ google::protobuf::scoped_ptr<MapFieldType> map_field_;
MapFieldBase* map_field_base_;
Map<int32, int32>* map_;
const Descriptor* map_descriptor_;
@@ -211,7 +206,7 @@ class MapFieldStateTest
: public testing::TestWithParam<State> {
public:
protected:
- typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType;
+ typedef unittest::TestMap::TestMap_MapInt32Int32Entry EntryType;
typedef MapField<EntryType, int32, int32, WireFormatLite::TYPE_INT32,
WireFormatLite::TYPE_INT32, false>
MapFieldType;
@@ -296,7 +291,7 @@ class MapFieldStateTest
}
}
- std::unique_ptr<MapFieldType> map_field_;
+ google::protobuf::scoped_ptr<MapFieldType> map_field_;
MapFieldBase* map_field_base_;
State state_;
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_lite_test_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/map_lite_test_util.cc
index b65b4d6301..b65b4d6301 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_lite_test_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_lite_test_util.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_lite_test_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_lite_test_util.h
index 66dedde5db..66dedde5db 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_lite_test_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_lite_test_util.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_lite_unittest.proto b/third_party/protobuf/3.4.0/src/google/protobuf/map_lite_unittest.proto
index 0135fff305..0135fff305 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_lite_unittest.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_lite_unittest.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_proto2_unittest.proto b/third_party/protobuf/3.4.0/src/google/protobuf/map_proto2_unittest.proto
index 20d58f903f..20d58f903f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_proto2_unittest.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_proto2_unittest.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/map_test.cc
index 829a60ff73..960589ce4f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_test.cc
@@ -40,6 +40,9 @@
#include <google/protobuf/stubs/hash.h>
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <set>
#include <sstream>
#include <vector>
@@ -127,7 +130,7 @@ class MapImplTest : public ::testing::Test {
EXPECT_EQ(value, map_.at(key));
Map<int32, int32>::iterator it = map_.find(key);
- // iterator dereferenceable
+ // interator dereferenceable
EXPECT_EQ(key, (*it).first);
EXPECT_EQ(value, (*it).second);
EXPECT_EQ(key, it->first);
@@ -155,7 +158,7 @@ class MapImplTest : public ::testing::Test {
EXPECT_EQ(value, const_map_.at(key));
Map<int32, int32>::const_iterator const_it = const_map_.find(key);
- // iterator dereferenceable
+ // interator dereferenceable
EXPECT_EQ(key, (*const_it).first);
EXPECT_EQ(value, (*const_it).second);
EXPECT_EQ(key, const_it->first);
@@ -167,7 +170,7 @@ class MapImplTest : public ::testing::Test {
EXPECT_EQ(value, const_it_copy->second);
}
- std::unique_ptr<Map<int32, int32> > map_ptr_;
+ google::protobuf::scoped_ptr<Map<int32, int32> > map_ptr_;
Map<int32, int32>& map_;
const Map<int32, int32>& const_map_;
};
@@ -555,7 +558,7 @@ TEST_F(MapImplTest, IteratorInvalidation) {
#endif
std::set<int> s;
int n = kMaxSizeToTest;
- unsigned int frog = k1 + n;
+ int frog = k1 + n;
while (n > 1 && s.size() < 25) {
s.insert(n);
n = static_cast<int>(n * 100 / (101.0 + (frog & 63)));
@@ -673,14 +676,6 @@ TEST_F(MapImplTest, InsertByIterator) {
ExpectElements(map1);
}
-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}});
-}
-
TEST_F(MapImplTest, EraseSingleByKey) {
int32 key = 0;
int32 value = 100;
@@ -1264,19 +1259,19 @@ TEST_F(MapFieldReflectionTest, RepeatedFieldRefForRegularFields) {
&message, fd_map_int32_foreign_message);
// Get entry default instances
- std::unique_ptr<Message> entry_int32_int32(
+ google::protobuf::scoped_ptr<Message> entry_int32_int32(
MessageFactory::generated_factory()
->GetPrototype(fd_map_int32_int32->message_type())
->New());
- std::unique_ptr<Message> entry_int32_double(
+ google::protobuf::scoped_ptr<Message> entry_int32_double(
MessageFactory::generated_factory()
->GetPrototype(fd_map_int32_double->message_type())
->New());
- std::unique_ptr<Message> entry_string_string(
+ google::protobuf::scoped_ptr<Message> entry_string_string(
MessageFactory::generated_factory()
->GetPrototype(fd_map_string_string->message_type())
->New());
- std::unique_ptr<Message> entry_int32_foreign_message(
+ google::protobuf::scoped_ptr<Message> entry_int32_foreign_message(
MessageFactory::generated_factory()
->GetPrototype(fd_map_int32_foreign_message->message_type())
->New());
@@ -1814,7 +1809,7 @@ TEST_F(MapFieldReflectionTest, MapSizeWithDuplicatedKey) {
// Dynamic Message
{
DynamicMessageFactory factory;
- std::unique_ptr<Message> message(
+ google::protobuf::scoped_ptr<Message> message(
factory.GetPrototype(unittest::TestMap::descriptor())->New());
const Reflection* reflection = message->GetReflection();
const FieldDescriptor* field =
@@ -1831,7 +1826,6 @@ TEST_F(MapFieldReflectionTest, MapSizeWithDuplicatedKey) {
EXPECT_EQ(2, reflection->FieldSize(*message, field));
EXPECT_EQ(1, MapSize(reflection, field, *message));
- EXPECT_EQ(2, reflection->FieldSize(*message, field));
}
// Generated Message
@@ -2000,7 +1994,7 @@ TEST(GeneratedMapFieldTest, CopyFromDynamicMessage) {
// Construct a new version of the dynamic message via the factory.
DynamicMessageFactory factory;
- std::unique_ptr<Message> message1;
+ google::protobuf::scoped_ptr<Message> message1;
message1.reset(
factory.GetPrototype(unittest::TestMap::descriptor())->New());
MapReflectionTester reflection_tester(
@@ -2017,7 +2011,7 @@ TEST(GeneratedMapFieldTest, CopyFromDynamicMessageMapReflection) {
// Construct a new version of the dynamic message via the factory.
DynamicMessageFactory factory;
- std::unique_ptr<Message> message1;
+ google::protobuf::scoped_ptr<Message> message1;
message1.reset(
factory.GetPrototype(unittest::TestMap::descriptor())->New());
MapReflectionTester reflection_tester(
@@ -2036,7 +2030,7 @@ TEST(GeneratedMapFieldTest, DynamicMessageCopyFrom) {
// Construct a new version of the dynamic message via the factory.
DynamicMessageFactory factory;
- std::unique_ptr<Message> message1;
+ google::protobuf::scoped_ptr<Message> message1;
message1.reset(
factory.GetPrototype(unittest::TestMap::descriptor())->New());
@@ -2055,7 +2049,7 @@ TEST(GeneratedMapFieldTest, DynamicMessageCopyFromMapReflection) {
// Construct a dynamic message via the factory.
DynamicMessageFactory factory;
- std::unique_ptr<Message> message1;
+ google::protobuf::scoped_ptr<Message> message1;
message1.reset(
factory.GetPrototype(unittest::TestMap::descriptor())->New());
@@ -2069,7 +2063,7 @@ TEST(GeneratedMapFieldTest, SyncDynamicMapWithRepeatedField) {
MapReflectionTester reflection_tester(
unittest::TestMap::descriptor());
DynamicMessageFactory factory;
- std::unique_ptr<Message> message;
+ google::protobuf::scoped_ptr<Message> message;
message.reset(
factory.GetPrototype(unittest::TestMap::descriptor())->New());
reflection_tester.SetMapFieldsViaReflection(message.get());
@@ -2721,7 +2715,7 @@ TEST_F(MapFieldInDynamicMessageTest, MapIndependentOffsets) {
// 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).
- std::unique_ptr<Message> message(map_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(map_prototype_->New());
MapReflectionTester reflection_tester(map_descriptor_);
reflection_tester.SetMapFieldsViaReflection(message.get());
@@ -2730,7 +2724,7 @@ TEST_F(MapFieldInDynamicMessageTest, MapIndependentOffsets) {
TEST_F(MapFieldInDynamicMessageTest, DynamicMapReflection) {
// Check that map fields work properly.
- std::unique_ptr<Message> message(map_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(map_prototype_->New());
// Check set functions.
MapReflectionTester reflection_tester(map_descriptor_);
@@ -2744,7 +2738,7 @@ TEST_F(MapFieldInDynamicMessageTest, MapSpaceUsed) {
// 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.
- std::unique_ptr<Message> message(map_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(map_prototype_->New());
MapReflectionTester reflection_tester(map_descriptor_);
int initial_space_used = message->SpaceUsed();
@@ -2757,13 +2751,13 @@ TEST_F(MapFieldInDynamicMessageTest, RecursiveMap) {
TestRecursiveMapMessage from;
(*from.mutable_a())[""];
string data = from.SerializeAsString();
- std::unique_ptr<Message> to(
+ google::protobuf::scoped_ptr<Message> to(
factory_.GetPrototype(recursive_map_descriptor_)->New());
ASSERT_TRUE(to->ParseFromString(data));
}
TEST_F(MapFieldInDynamicMessageTest, MapValueReferernceValidAfterSerialize) {
- std::unique_ptr<Message> message(map_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(map_prototype_->New());
MapReflectionTester reflection_tester(map_descriptor_);
reflection_tester.SetMapFieldsViaMapReflection(message.get());
@@ -2794,7 +2788,7 @@ TEST_F(MapFieldInDynamicMessageTest, MapValueReferernceValidAfterSerialize) {
}
TEST_F(MapFieldInDynamicMessageTest, MapEntryReferernceValidAfterSerialize) {
- std::unique_ptr<Message> message(map_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(map_prototype_->New());
MapReflectionTester reflection_tester(map_descriptor_);
reflection_tester.SetMapFieldsViaReflection(message.get());
@@ -2963,7 +2957,7 @@ TEST(WireFormatForMapFieldTest, SerializeMap) {
TEST(WireFormatForMapFieldTest, SerializeMapDynamicMessage) {
DynamicMessageFactory factory;
- std::unique_ptr<Message> dynamic_message;
+ google::protobuf::scoped_ptr<Message> dynamic_message;
dynamic_message.reset(
factory.GetPrototype(unittest::TestMap::descriptor())->New());
MapReflectionTester reflection_tester(
@@ -3289,42 +3283,6 @@ TEST(ArenaTest, IsInitialized) {
EXPECT_EQ(0, (*message->mutable_map_int32_int32())[0]);
}
-TEST(MoveTest, MoveConstructorWorks) {
- Map<int32, TestAllTypes> original_map;
- original_map[42].mutable_optional_nested_message()->set_bb(42);
- original_map[43].mutable_optional_nested_message()->set_bb(43);
- const auto* nested_msg42_ptr = &original_map[42].optional_nested_message();
- const auto* nested_msg43_ptr = &original_map[43].optional_nested_message();
-
- Map<int32, TestAllTypes> moved_to_map(std::move(original_map));
- EXPECT_TRUE(original_map.empty());
- EXPECT_EQ(2, moved_to_map.size());
- EXPECT_EQ(42, moved_to_map[42].optional_nested_message().bb());
- EXPECT_EQ(43, moved_to_map[43].optional_nested_message().bb());
- // This test takes advantage of the fact that pointers are swapped, so there
- // should be pointer stability.
- EXPECT_EQ(nested_msg42_ptr, &moved_to_map[42].optional_nested_message());
- EXPECT_EQ(nested_msg43_ptr, &moved_to_map[43].optional_nested_message());
-}
-
-TEST(MoveTest, MoveAssignmentWorks) {
- Map<int32, TestAllTypes> original_map;
- original_map[42].mutable_optional_nested_message()->set_bb(42);
- original_map[43].mutable_optional_nested_message()->set_bb(43);
- const auto* nested_msg42_ptr = &original_map[42].optional_nested_message();
- const auto* nested_msg43_ptr = &original_map[43].optional_nested_message();
-
- Map<int32, TestAllTypes> moved_to_map = std::move(original_map);
- EXPECT_TRUE(original_map.empty());
- EXPECT_EQ(2, moved_to_map.size());
- EXPECT_EQ(42, moved_to_map[42].optional_nested_message().bb());
- EXPECT_EQ(43, moved_to_map[43].optional_nested_message().bb());
- // This test takes advantage of the fact that pointers are swapped, so there
- // should be pointer stability.
- EXPECT_EQ(nested_msg42_ptr, &moved_to_map[42].optional_nested_message());
- EXPECT_EQ(nested_msg43_ptr, &moved_to_map[43].optional_nested_message());
-}
-
} // namespace internal
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_test_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/map_test_util.cc
index 31ac173633..31ac173633 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_test_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_test_util.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_test_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_test_util.h
index dd397619ba..dd397619ba 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_test_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_test_util.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_test_util_impl.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_test_util_impl.h
index ad4d1a3dd3..ad4d1a3dd3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_test_util_impl.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_test_util_impl.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_type_handler.h b/third_party/protobuf/3.4.0/src/google/protobuf/map_type_handler.h
index 7f7b1e0e1d..423c98f127 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_type_handler.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_type_handler.h
@@ -72,7 +72,7 @@ class MapValueInitializer<true, Type> {
template <typename Type>
class MapValueInitializer<false, Type> {
public:
- static inline void Initialize(Type& /* value */, int /* default_enum_value */) {}
+ static inline void Initialize(Type& value, int default_enum_value) {}
};
template <typename Type, bool is_arena_constructable>
@@ -301,7 +301,7 @@ GOOGLE_PROTOBUF_BYTE_SIZE(ENUM , Enum)
#define FIXED_BYTE_SIZE(FieldType, DeclaredType) \
template <typename Type> \
inline int MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::ByteSize( \
- const MapEntryAccessorType& /* value */) { \
+ const MapEntryAccessorType& value) { \
return WireFormatLite::k##DeclaredType##Size; \
}
@@ -348,7 +348,7 @@ GET_CACHED_SIZE(ENUM , Enum)
template <typename Type> \
inline int \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::GetCachedSize( \
- const MapEntryAccessorType& /* value */) { \
+ const MapEntryAccessorType& value) { \
return WireFormatLite::k##DeclaredType##Size; \
}
@@ -479,20 +479,20 @@ size_t MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::SpaceUsedInMapLong(
template <typename Type>
inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Clear(
- Type** value, Arena* /* arena */) {
+ Type** value, Arena* arena) {
if (*value != NULL) (*value)->Clear();
}
template <typename Type>
inline void
MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
Type>::ClearMaybeByDefaultEnum(Type** value,
- Arena* /* arena */,
- int /* default_enum_value */) {
+ Arena* arena,
+ int default_enum_value) {
if (*value != NULL) (*value)->Clear();
}
template <typename Type>
inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Merge(
- const Type& from, Type** to, Arena* /* arena */) {
+ const Type& from, Type** to, Arena* arena) {
(*to)->MergeFrom(from);
}
@@ -511,14 +511,14 @@ inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
template <typename Type>
inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
Type>::Initialize(Type** x,
- Arena* /* arena */) {
+ Arena* arena) {
*x = NULL;
}
template <typename Type>
inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::
- InitializeMaybeByDefaultEnum(Type** x, int /* default_enum_value */,
- Arena* /* arena */) {
+ InitializeMaybeByDefaultEnum(Type** x, int default_enum_value,
+ Arena* arena) {
*x = NULL;
}
@@ -583,7 +583,7 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \
- int /* default_enum */) { \
+ int default_enum) { \
Clear(value, arena); \
} \
template <typename Type> \
@@ -598,19 +598,18 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
- Type>::AssignDefaultValue(TypeOnMemory* /* value */) {} \
+ Type>::AssignDefaultValue(TypeOnMemory* value) {} \
template <typename Type> \
inline void \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \
- TypeOnMemory* value, Arena* /* arena */) { \
+ TypeOnMemory* value, Arena* arena) { \
value->UnsafeSetDefault( \
&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \
} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
InitializeMaybeByDefaultEnum(TypeOnMemory* value, \
- int /* default_enum_value */, \
- Arena* arena) { \
+ int default_enum_value, Arena* arena) { \
Initialize(value, arena); \
} \
template <typename Type> \
@@ -627,12 +626,12 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::DefaultIfNotInitialized(const TypeOnMemory& value, \
const TypeOnMemory& \
- /* default_value */) { \
+ default_value) { \
return value.Get(); \
} \
template <typename Type> \
inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
- Type>::IsInitialized(const TypeOnMemory& /* value */) { \
+ Type>::IsInitialized(const TypeOnMemory& value) { \
return true; \
}
STRING_OR_BYTES_HANDLER_FUNCTIONS(STRING)
@@ -650,56 +649,54 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES)
template <typename Type> \
inline size_t \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
- Type>::SpaceUsedInMapEntryLong(const TypeOnMemory& /* value */) { \
+ Type>::SpaceUsedInMapEntryLong(const TypeOnMemory& value) { \
return 0; \
} \
template <typename Type> \
inline size_t \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::SpaceUsedInMapLong( \
- const TypeOnMemory& /* value */) { \
+ const TypeOnMemory& value) { \
return sizeof(Type); \
} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Clear( \
- TypeOnMemory* value, Arena* /* arena */) { \
+ TypeOnMemory* value, Arena* arena) { \
*value = 0; \
} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
- ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* /* arena */, \
+ ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \
int default_enum_value) { \
*value = static_cast<TypeOnMemory>(default_enum_value); \
} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Merge( \
- const MapEntryAccessorType& from, TypeOnMemory* to, \
- Arena* /* arena */) { \
+ const MapEntryAccessorType& from, TypeOnMemory* to, Arena* arena) { \
*to = from; \
} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
- Type>::DeleteNoArena(TypeOnMemory& /* x */) {} \
+ Type>::DeleteNoArena(TypeOnMemory& x) {} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
- Type>::AssignDefaultValue(TypeOnMemory* /* value */) {} \
+ Type>::AssignDefaultValue(TypeOnMemory* value) {} \
template <typename Type> \
inline void \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \
- TypeOnMemory* value, Arena* /* arena */) { \
+ TypeOnMemory* value, Arena* arena) { \
*value = 0; \
} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
InitializeMaybeByDefaultEnum(TypeOnMemory* value, \
- int default_enum_value, \
- Arena* /* arena */) { \
+ int default_enum_value, Arena* arena) { \
*value = static_cast<TypeOnMemory>(default_enum_value); \
} \
template <typename Type> \
inline typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::MapEntryAccessorType* \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::EnsureMutable( \
- TypeOnMemory* value, Arena* /* arena */) { \
+ TypeOnMemory* value, Arena* arena) { \
return value; \
} \
template <typename Type> \
@@ -708,12 +705,12 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES)
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::DefaultIfNotInitialized(const TypeOnMemory& value, \
const TypeOnMemory& \
- /* default_value */) { \
+ default_value) { \
return value; \
} \
template <typename Type> \
inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
- Type>::IsInitialized(const TypeOnMemory& /* value */) { \
+ Type>::IsInitialized(const TypeOnMemory& value) { \
return true; \
}
PRIMITIVE_HANDLER_FUNCTIONS(INT64)
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/map_unittest.proto b/third_party/protobuf/3.4.0/src/google/protobuf/map_unittest.proto
index 836dc10b37..836dc10b37 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/map_unittest.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_unittest.proto
diff --git a/third_party/protobuf/3.6.0/csharp/protos/map_unittest_proto3.proto b/third_party/protobuf/3.4.0/src/google/protobuf/map_unittest_proto3.proto
index e43e858bc1..16be277304 100644
--- a/third_party/protobuf/3.6.0/csharp/protos/map_unittest_proto3.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/map_unittest_proto3.proto
@@ -36,11 +36,15 @@
// required fields in proto3.
syntax = "proto3";
+option cc_enable_arenas = true;
option csharp_namespace = "Google.Protobuf.TestProtos";
-import "unittest_proto3.proto";
+import "google/protobuf/unittest_proto3.proto";
-package protobuf_unittest3;
+// 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 {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/message.cc b/third_party/protobuf/3.4.0/src/google/protobuf/message.cc
index 810db233ba..c01d1974b0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/message.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/message.cc
@@ -38,22 +38,20 @@
#include <google/protobuf/message.h>
-#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/mutex.h>
#include <google/protobuf/stubs/once.h>
-#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/reflection_internal.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/map_field.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/singleton.h>
#include <google/protobuf/stubs/stl_util.h>
@@ -172,12 +170,12 @@ size_t Message::SpaceUsedLong() const {
bool Message::SerializeToFileDescriptor(int file_descriptor) const {
io::FileOutputStream output(file_descriptor);
- return SerializeToZeroCopyStream(&output) && output.Flush();
+ return SerializeToZeroCopyStream(&output);
}
bool Message::SerializePartialToFileDescriptor(int file_descriptor) const {
io::FileOutputStream output(file_descriptor);
- return SerializePartialToZeroCopyStream(&output) && output.Flush();
+ return SerializePartialToZeroCopyStream(&output);
}
bool Message::SerializeToOstream(std::ostream* output) const {
@@ -465,7 +463,7 @@ namespace internal {
template<>
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240
-GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+GOOGLE_ATTRIBUTE_NOINLINE
#endif
Message* GenericTypeHandler<Message>::NewFromPrototype(
const Message* prototype, google::protobuf::Arena* arena) {
@@ -474,7 +472,7 @@ Message* GenericTypeHandler<Message>::NewFromPrototype(
template<>
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240
-GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+GOOGLE_ATTRIBUTE_NOINLINE
#endif
google::protobuf::Arena* GenericTypeHandler<Message>::GetArena(
Message* value) {
@@ -483,7 +481,7 @@ google::protobuf::Arena* GenericTypeHandler<Message>::GetArena(
template<>
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240
-GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+GOOGLE_ATTRIBUTE_NOINLINE
#endif
void* GenericTypeHandler<Message>::GetMaybeArenaPointer(
Message* value) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/message.h b/third_party/protobuf/3.4.0/src/google/protobuf/message.h
index f3d1a58a92..44fe0fdef0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/message.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/message.h
@@ -112,7 +112,7 @@
#include <iosfwd>
#include <string>
-#include <type_traits>
+#include <google/protobuf/stubs/type_traits.h>
#include <vector>
#include <google/protobuf/arena.h>
@@ -152,9 +152,6 @@ class CodedOutputStream; // coded_stream.h
namespace python {
class MapReflectionFriend; // scalar_map_container.h
}
-namespace expr {
-class CelMapReflectionFriend; // field_backed_map_impl.cc
-}
namespace internal {
@@ -330,19 +327,18 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite {
// Typedef for backwards-compatibility.
typedef google::protobuf::Reflection Reflection;
- // Get a non-owning pointer to a Descriptor for this message's type. This
- // describes what fields the message contains, the types of those fields, etc.
- // This object remains property of the Message.
+ // Get a Descriptor for this message's type. This describes what
+ // fields the message contains, the types of those fields, etc.
const Descriptor* GetDescriptor() const { return GetMetadata().descriptor; }
- // Get a non-owning pointer to the Reflection interface for this Message,
- // which can be used to read and modify the fields of the Message dynamically
- // (in other words, without knowing the message type at compile time). This
- // object remains property of the Message.
+ // Get the Reflection interface for this Message, which can be used to
+ // read and modify the fields of the Message dynamically (in other words,
+ // without knowing the message type at compile time). This object remains
+ // property of the Message.
//
// This method remains virtual in case a subclass does not implement
// reflection and wants to override the default behavior.
- virtual const Reflection* GetReflection() const final {
+ virtual const Reflection* GetReflection() const {
return GetMetadata().reflection;
}
@@ -409,6 +405,9 @@ 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() {}
@@ -497,14 +496,11 @@ class LIBPROTOBUF_EXPORT Reflection {
int index1,
int index2) const = 0;
- // List all fields of the message which are currently set, except for unknown
- // fields, but including extension known to the parser (i.e. compiled in).
- // Singular fields will only be listed if HasField(field) would return true
- // and repeated fields will only be listed if FieldSize(field) would return
- // non-zero. Fields (both normal fields and extension fields) will be listed
- // ordered by field number.
- // Use Reflection::GetUnknownFields() or message.unknown_fields() to also get
- // access to fields/extensions unknown to the parser.
+ // List all fields of the message which are currently set. This includes
+ // extensions. Singular fields will only be listed if HasField(field) would
+ // return true and repeated fields will only be listed if FieldSize(field)
+ // would return non-zero. Fields (both normal fields and extension fields)
+ // will be listed ordered by field number.
virtual void ListFields(
const Message& message,
std::vector<const FieldDescriptor*>* output) const = 0;
@@ -815,7 +811,6 @@ 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;
@@ -823,7 +818,6 @@ 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;
@@ -832,7 +826,6 @@ 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;
@@ -841,7 +834,6 @@ 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;
@@ -930,7 +922,7 @@ class LIBPROTOBUF_EXPORT Reflection {
// Returns a raw pointer to the repeated field
//
- // "cpp_type" and "message_type" are deduced from the type parameter T passed
+ // "cpp_type" and "message_type" are decuded from the type parameter T passed
// to Get(Mutable)RepeatedFieldRef. If T is a generated message type,
// "message_type" should be set to its descriptor. Otherwise "message_type"
// should be set to NULL. Implementations of this method should check whether
@@ -953,8 +945,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/message_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/message_lite.cc
index 123b142d09..83a92d5a08 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/message_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/message_lite.cc
@@ -103,15 +103,15 @@ string InitializationErrorMessage(const char* action,
// call MergePartialFromCodedStream(). However, when parsing very small
// messages, every function call introduces significant overhead. To avoid
// this without reproducing code, we use these forced-inline helpers.
-GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineMergeFromCodedStream(
+GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineMergeFromCodedStream(
io::CodedInputStream* input, MessageLite* message);
-GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineParseFromCodedStream(
+GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineParseFromCodedStream(
io::CodedInputStream* input, MessageLite* message);
-GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineParsePartialFromCodedStream(
+GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineParsePartialFromCodedStream(
io::CodedInputStream* input, MessageLite* message);
-GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineParseFromArray(
+GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineParseFromArray(
const void* data, int size, MessageLite* message);
-GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineParsePartialFromArray(
+GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineParsePartialFromArray(
const void* data, int size, MessageLite* message);
inline bool InlineMergeFromCodedStream(io::CodedInputStream* input,
@@ -344,13 +344,10 @@ string MessageLite::SerializePartialAsString() const {
return output;
}
-void MessageLite::SerializeWithCachedSizes(
- io::CodedOutputStream* output) const {
+void MessageLite::SerializeWithCachedSizes(io::CodedOutputStream* output) const
+ {
GOOGLE_DCHECK(InternalGetTable());
- internal::TableSerialize(
- *this,
- static_cast<const internal::SerializationTable*>(InternalGetTable()),
- output);
+ internal::TableSerialize(*this, static_cast<const internal::SerializationTable*>(InternalGetTable()), output);
}
// The table driven code optimizes the case that the CodedOutputStream buffer
@@ -358,20 +355,20 @@ void MessageLite::SerializeWithCachedSizes(
// If the proto is optimized for speed, this method will be overridden by
// generated code for maximum speed. If the proto is optimized for size or
// is lite, then we need to specialize this to avoid infinite recursion.
-uint8* MessageLite::InternalSerializeWithCachedSizesToArray(
- bool deterministic, uint8* target) const {
+uint8* MessageLite::InternalSerializeWithCachedSizesToArray(bool deterministic,
+ uint8* target) const {
const internal::SerializationTable* table =
static_cast<const internal::SerializationTable*>(InternalGetTable());
if (table == NULL) {
// We only optimize this when using optimize_for = SPEED. In other cases
- // we just use the CodedOutputStream path.
- int size = GetCachedSize();
- io::ArrayOutputStream out(target, size);
- io::CodedOutputStream coded_out(&out);
- coded_out.SetSerializationDeterministic(deterministic);
- SerializeWithCachedSizes(&coded_out);
- GOOGLE_CHECK(!coded_out.HadError());
- return target + size;
+ // we just use the CodedOutputStream path.
+ int size = GetCachedSize();
+ io::ArrayOutputStream out(target, size);
+ io::CodedOutputStream coded_out(&out);
+ coded_out.SetSerializationDeterministic(deterministic);
+ SerializeWithCachedSizes(&coded_out);
+ GOOGLE_CHECK(!coded_out.HadError());
+ return target + size;
} else {
return internal::TableSerializeToArray(*this, table, deterministic, target);
}
@@ -394,8 +391,7 @@ void GenericTypeHandler<string>::Merge(const string& from,
*to = from;
}
-bool proto3_preserve_unknown_ = true;
-
+bool proto3_preserve_unknown_ = false;
void SetProto3PreserveUnknownsDefault(bool preserve) {
proto3_preserve_unknown_ = preserve;
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/message_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/message_lite.h
index 4cbec33081..2075f4b652 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/message_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/message_lite.h
@@ -43,13 +43,29 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/once.h>
-#include <google/protobuf/arena.h>
-#include <google/protobuf/stubs/port.h>
+
+
+#if LANG_CXX11 && !defined(__NVCC__)
+#define PROTOBUF_CXX11 1
+#else
+#define PROTOBUF_CXX11 0
+#endif
+
+#if PROTOBUF_CXX11
+#define PROTOBUF_FINAL final
+#else
+#define PROTOBUF_FINAL
+#endif
+
+#ifndef LIBPROTOBUF_EXPORT
+#define LIBPROTOBUF_EXPORT
+#endif
+
+#define PROTOBUF_RUNTIME_DEPRECATED(message)
namespace google {
namespace protobuf {
-template <typename T>
-class RepeatedPtrField;
+class Arena;
namespace io {
class CodedInputStream;
class CodedOutputStream;
@@ -58,9 +74,7 @@ class ZeroCopyOutputStream;
}
namespace internal {
-class RepeatedPtrFieldBase;
class WireFormatLite;
-class WeakFieldMap;
#ifndef SWIG
// We compute sizes as size_t but cache them as int. This function converts a
@@ -114,7 +128,13 @@ class ExplicitlyConstructed {
get_mutable()->~T();
}
- constexpr const T& get() const { return reinterpret_cast<const T&>(union_); }
+#if LANG_CXX11
+ constexpr
+#endif
+ const T&
+ get() const {
+ return reinterpret_cast<const T&>(union_);
+ }
T* get_mutable() { return reinterpret_cast<T*>(&union_); }
private:
@@ -128,7 +148,7 @@ class ExplicitlyConstructed {
// Default empty string object. Don't use this directly. Instead, call
// GetEmptyString() to get the reference.
-LIBPROTOBUF_EXPORT extern ExplicitlyConstructed<::std::string> fixed_address_empty_string;
+extern ExplicitlyConstructed< ::std::string> fixed_address_empty_string;
LIBPROTOBUF_EXPORT extern ProtobufOnceType empty_string_once_init_;
LIBPROTOBUF_EXPORT void InitEmptyString();
@@ -269,7 +289,7 @@ class LIBPROTOBUF_EXPORT MessageLite {
// Reads a protocol buffer from the stream and merges it into this
- // Message. Singular fields read from the what is
+ // Message. Singular fields read from the input overwrite what is
// already in the Message and repeated fields are appended to those
// already present.
//
@@ -378,34 +398,12 @@ 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;
- }
-
- template <typename T>
- static T* CreateMaybeMessage(Arena* arena) {
- return Arena::CreateMaybeMessage<T>(arena);
- }
-
private:
// TODO(gerbens) make this a pure abstract function
virtual const void* InternalGetTable() const { return NULL; }
friend class internal::WireFormatLite;
friend class Message;
- friend class internal::WeakFieldMap;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageLite);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/message_unittest.inc b/third_party/protobuf/3.4.0/src/google/protobuf/message_unittest.cc
index 6ffdcce09a..fe4566779b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/message_unittest.inc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/message_unittest.cc
@@ -31,21 +31,20 @@
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// This file needs to be included as .inc as it depends on certain macros being
-// defined prior to its inclusion.
#include <google/protobuf/message.h>
-#include <fcntl.h>
-#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
-#include <fstream>
#include <sstream>
+#include <fstream>
+#include <google/protobuf/test_util.h>
+#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
@@ -56,15 +55,15 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/io_win32.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
-#include <google/protobuf/stubs/io_win32.h>
namespace google {
namespace protobuf {
-#if defined(_WIN32)
+#if defined(_MSC_VER)
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
using google::protobuf::internal::win32::close;
@@ -75,15 +74,15 @@ using google::protobuf::internal::win32::open;
#ifdef _O_BINARY
#define O_BINARY _O_BINARY
#else
-#define O_BINARY 0 // If this isn't defined, the platform doesn't need it.
+#define O_BINARY 0 // If this isn't defined, the platform doesn't need it.
#endif
#endif
-TEST(MESSAGE_TEST_NAME, SerializeHelpers) {
+TEST(MessageTest, SerializeHelpers) {
// TODO(kenton): Test more helpers? They're all two-liners so it seems
// like a waste of time.
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
TestUtil::SetAllFields(&message);
std::stringstream stream;
@@ -108,63 +107,63 @@ TEST(MESSAGE_TEST_NAME, SerializeHelpers) {
}
-TEST(MESSAGE_TEST_NAME, SerializeToBrokenOstream) {
+TEST(MessageTest, SerializeToBrokenOstream) {
std::ofstream out;
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
message.set_optional_int32(123);
EXPECT_FALSE(message.SerializeToOstream(&out));
}
-TEST(MESSAGE_TEST_NAME, ParseFromFileDescriptor) {
+TEST(MessageTest, ParseFromFileDescriptor) {
string filename = TestSourceDir() +
"/google/protobuf/testdata/golden_message";
int file = open(filename.c_str(), O_RDONLY | O_BINARY);
ASSERT_GE(file, 0);
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
EXPECT_TRUE(message.ParseFromFileDescriptor(file));
TestUtil::ExpectAllFieldsSet(message);
EXPECT_GE(close(file), 0);
}
-TEST(MESSAGE_TEST_NAME, ParsePackedFromFileDescriptor) {
+TEST(MessageTest, ParsePackedFromFileDescriptor) {
string filename =
TestSourceDir() +
"/google/protobuf/testdata/golden_packed_fields_message";
int file = open(filename.c_str(), O_RDONLY | O_BINARY);
ASSERT_GE(file, 0);
- UNITTEST::TestPackedTypes message;
+ protobuf_unittest::TestPackedTypes message;
EXPECT_TRUE(message.ParseFromFileDescriptor(file));
TestUtil::ExpectPackedFieldsSet(message);
EXPECT_GE(close(file), 0);
}
-TEST(MESSAGE_TEST_NAME, ParseHelpers) {
+TEST(MessageTest, ParseHelpers) {
// TODO(kenton): Test more helpers? They're all two-liners so it seems
// like a waste of time.
string data;
{
// Set up.
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
TestUtil::SetAllFields(&message);
message.SerializeToString(&data);
}
{
// Test ParseFromString.
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
EXPECT_TRUE(message.ParseFromString(data));
TestUtil::ExpectAllFieldsSet(message);
}
{
// Test ParseFromIstream.
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
std::stringstream stream(data);
EXPECT_TRUE(message.ParseFromIstream(&stream));
EXPECT_TRUE(stream.eof());
@@ -176,7 +175,7 @@ TEST(MESSAGE_TEST_NAME, ParseHelpers) {
string data_with_junk(data);
data_with_junk.append("some junk on the end");
io::ArrayInputStream stream(data_with_junk.data(), data_with_junk.size());
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
EXPECT_TRUE(message.ParseFromBoundedZeroCopyStream(&stream, data.size()));
TestUtil::ExpectAllFieldsSet(message);
}
@@ -185,14 +184,14 @@ TEST(MESSAGE_TEST_NAME, ParseHelpers) {
// Test that ParseFromBoundedZeroCopyStream fails (but doesn't crash) if
// EOF is reached before the expected number of bytes.
io::ArrayInputStream stream(data.data(), data.size());
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
EXPECT_FALSE(
- message.ParseFromBoundedZeroCopyStream(&stream, data.size() + 1));
+ message.ParseFromBoundedZeroCopyStream(&stream, data.size() + 1));
}
}
-TEST(MESSAGE_TEST_NAME, ParseFailsIfNotInitialized) {
- UNITTEST::TestRequired message;
+TEST(MessageTest, ParseFailsIfNotInitialized) {
+ unittest::TestRequired message;
std::vector<string> errors;
{
@@ -202,65 +201,98 @@ TEST(MESSAGE_TEST_NAME, ParseFailsIfNotInitialized) {
}
ASSERT_EQ(1, errors.size());
- EXPECT_EQ(
- "Can't parse message of type \"" + string(UNITTEST_PACKAGE_NAME) +
- ".TestRequired\" because it is missing required fields: a, b, c",
- errors[0]);
+ EXPECT_EQ("Can't parse message of type \"protobuf_unittest.TestRequired\" "
+ "because it is missing required fields: a, b, c",
+ errors[0]);
}
-TEST(MESSAGE_TEST_NAME, BypassInitializationCheckOnParse) {
- UNITTEST::TestRequired message;
- io::ArrayInputStream raw_input(nullptr, 0);
+TEST(MessageTest, BypassInitializationCheckOnParse) {
+ unittest::TestRequired message;
+ io::ArrayInputStream raw_input(NULL, 0);
io::CodedInputStream input(&raw_input);
EXPECT_TRUE(message.MergePartialFromCodedStream(&input));
}
-TEST(MESSAGE_TEST_NAME, InitializationErrorString) {
- UNITTEST::TestRequired message;
+TEST(MessageTest, InitializationErrorString) {
+ unittest::TestRequired message;
EXPECT_EQ("a, b, c", message.InitializationErrorString());
}
-TEST(MESSAGE_TEST_NAME, DynamicCastToGenerated) {
- UNITTEST::TestAllTypes test_all_types;
+TEST(MessageTest, DynamicCastToGenerated) {
+ unittest::TestAllTypes test_all_types;
google::protobuf::Message* test_all_types_pointer = &test_all_types;
EXPECT_EQ(&test_all_types,
- google::protobuf::internal::DynamicCastToGenerated<UNITTEST::TestAllTypes>(
+ google::protobuf::internal::DynamicCastToGenerated<unittest::TestAllTypes>(
test_all_types_pointer));
- EXPECT_EQ(nullptr,
- google::protobuf::internal::DynamicCastToGenerated<UNITTEST::TestRequired>(
+ EXPECT_EQ(NULL,
+ google::protobuf::internal::DynamicCastToGenerated<unittest::TestRequired>(
test_all_types_pointer));
const google::protobuf::Message* test_all_types_pointer_const = &test_all_types;
EXPECT_EQ(
&test_all_types,
- google::protobuf::internal::DynamicCastToGenerated<const UNITTEST::TestAllTypes>(
+ google::protobuf::internal::DynamicCastToGenerated<const unittest::TestAllTypes>(
test_all_types_pointer_const));
EXPECT_EQ(
- nullptr,
- google::protobuf::internal::DynamicCastToGenerated<const UNITTEST::TestRequired>(
+ NULL,
+ google::protobuf::internal::DynamicCastToGenerated<const unittest::TestRequired>(
test_all_types_pointer_const));
}
#ifdef PROTOBUF_HAS_DEATH_TEST // death tests do not work on Windows yet.
-TEST(MESSAGE_TEST_NAME, SerializeFailsIfNotInitialized) {
- UNITTEST::TestRequired message;
+TEST(MessageTest, SerializeFailsIfNotInitialized) {
+ unittest::TestRequired message;
string data;
EXPECT_DEBUG_DEATH(EXPECT_TRUE(message.SerializeToString(&data)),
- "Can't serialize message of type \"" +
- string(UNITTEST_PACKAGE_NAME) +
- ".TestRequired\" because "
- "it is missing required fields: a, b, c");
+ "Can't serialize message of type \"protobuf_unittest.TestRequired\" because "
+ "it is missing required fields: a, b, c");
}
-TEST(MESSAGE_TEST_NAME, CheckInitialized) {
- UNITTEST::TestRequired message;
+TEST(MessageTest, CheckInitialized) {
+ unittest::TestRequired message;
EXPECT_DEATH(message.CheckInitialized(),
- "Message of type \"" +
- string(UNITTEST_PACKAGE_NAME) +
- ".TestRequired\" is missing required "
- "fields: a, b, c");
+ "Message of type \"protobuf_unittest.TestRequired\" is missing required "
+ "fields: a, b, c");
+}
+
+TEST(MessageTest, CheckOverflow) {
+ unittest::TestAllTypes message;
+ // Create a message with size just over 2GB. This triggers integer overflow
+ // when computing message size.
+ const string data(1024, 'x');
+ Cord one_megabyte;
+ for (int i = 0; i < 1024; i++) {
+ one_megabyte.Append(data);
+ }
+
+ for (int i = 0; i < 2 * 1024 + 1; ++i) {
+ message.add_repeated_cord()->CopyFrom(one_megabyte);
+ }
+
+ Cord serialized;
+ EXPECT_FALSE(message.AppendToCord(&serialized));
+}
+
+TEST(MessageTest, CheckBigOverflow) {
+ // Checking for 4GB buffers on 32 bit systems is problematic.
+ if (sizeof(void*) < 8) return;
+ unittest::TestAllTypes message;
+ // Create a message with size just over 4GB. We should be able to detect this
+ // too, even though it will make a plain "int" wrap back to a positive number.
+ const string data(1024, 'x');
+ Cord one_megabyte;
+ for (int i = 0; i < 1024; i++) {
+ one_megabyte.Append(data);
+ }
+
+ for (int i = 0; i < 4 * 1024 + 1; ++i) {
+ message.add_repeated_cord()->CopyFrom(one_megabyte);
+ }
+
+ Cord serialized;
+ EXPECT_FALSE(message.AppendToCord(&serialized));
}
#endif // PROTOBUF_HAS_DEATH_TEST
@@ -320,10 +352,10 @@ class RepeatedInputStream : public io::ZeroCopyInputStream {
};
} // namespace
-TEST(MESSAGE_TEST_NAME, TestParseMessagesCloseTo2G) {
+TEST(MessageTest, TestParseMessagesCloseTo2G) {
// Create a message with a large string field.
string value = string(64 * 1024 * 1024, 'x');
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
message.set_optional_string(value);
// Repeat this message in the input stream to make the total input size
@@ -333,7 +365,7 @@ TEST(MESSAGE_TEST_NAME, TestParseMessagesCloseTo2G) {
RepeatedInputStream input(data, count);
// The parsing should succeed.
- UNITTEST::TestAllTypes result;
+ protobuf_unittest::TestAllTypes result;
EXPECT_TRUE(result.ParseFromZeroCopyStream(&input));
// When there are multiple occurences of a singulr field, the last one
@@ -341,10 +373,10 @@ TEST(MESSAGE_TEST_NAME, TestParseMessagesCloseTo2G) {
EXPECT_EQ(value, result.optional_string());
}
-TEST(MESSAGE_TEST_NAME, TestParseMessagesOver2G) {
+TEST(MessageTest, TestParseMessagesOver2G) {
// Create a message with a large string field.
string value = string(64 * 1024 * 1024, 'x');
- UNITTEST::TestAllTypes message;
+ protobuf_unittest::TestAllTypes message;
message.set_optional_string(value);
// Repeat this message in the input stream to make the total input size
@@ -354,19 +386,19 @@ TEST(MESSAGE_TEST_NAME, TestParseMessagesOver2G) {
RepeatedInputStream input(data, count);
// The parsing should fail.
- UNITTEST::TestAllTypes result;
+ protobuf_unittest::TestAllTypes result;
EXPECT_FALSE(result.ParseFromZeroCopyStream(&input));
}
-TEST(MESSAGE_TEST_NAME, BypassInitializationCheckOnSerialize) {
- UNITTEST::TestRequired message;
- io::ArrayOutputStream raw_output(nullptr, 0);
+TEST(MessageTest, BypassInitializationCheckOnSerialize) {
+ unittest::TestRequired message;
+ io::ArrayOutputStream raw_output(NULL, 0);
io::CodedOutputStream output(&raw_output);
EXPECT_TRUE(message.SerializePartialToCodedStream(&output));
}
-TEST(MESSAGE_TEST_NAME, FindInitializationErrors) {
- UNITTEST::TestRequired message;
+TEST(MessageTest, FindInitializationErrors) {
+ unittest::TestRequired message;
std::vector<string> errors;
message.FindInitializationErrors(&errors);
ASSERT_EQ(3, errors.size());
@@ -375,8 +407,8 @@ TEST(MESSAGE_TEST_NAME, FindInitializationErrors) {
EXPECT_EQ("c", errors[2]);
}
-TEST(MESSAGE_TEST_NAME, ParseFailsOnInvalidMessageEnd) {
- UNITTEST::TestAllTypes message;
+TEST(MessageTest, ParseFailsOnInvalidMessageEnd) {
+ unittest::TestAllTypes message;
// Control case.
EXPECT_TRUE(message.ParseFromArray("", 0));
@@ -392,8 +424,8 @@ TEST(MESSAGE_TEST_NAME, ParseFailsOnInvalidMessageEnd) {
}
// Regression test for b/23630858
-TEST(MESSAGE_TEST_NAME, MessageIsStillValidAfterParseFails) {
- UNITTEST::TestAllTypes message;
+TEST(MessageTest, MessageIsStillValidAfterParseFails) {
+ unittest::TestAllTypes message;
// 9 0xFFs for the "optional_uint64" field.
string invalid_data = "\x20\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
@@ -407,26 +439,26 @@ TEST(MESSAGE_TEST_NAME, MessageIsStillValidAfterParseFails) {
string invalid_string_data = "\x72\x01";
{
google::protobuf::Arena arena;
- UNITTEST::TestAllTypes* arena_message =
- google::protobuf::Arena::CreateMessage<UNITTEST::TestAllTypes>(&arena);
+ unittest::TestAllTypes* arena_message =
+ google::protobuf::Arena::CreateMessage<unittest::TestAllTypes>(&arena);
EXPECT_FALSE(arena_message->ParseFromString(invalid_string_data));
arena_message->Clear();
EXPECT_EQ("", arena_message->optional_string());
}
}
-
namespace {
-void ExpectMessageMerged(const UNITTEST::TestAllTypes& message) {
+void ExpectMessageMerged(const unittest::TestAllTypes& message) {
EXPECT_EQ(3, message.optional_int32());
EXPECT_EQ(2, message.optional_int64());
EXPECT_EQ("hello", message.optional_string());
}
-void AssignParsingMergeMessages(UNITTEST::TestAllTypes* msg1,
- UNITTEST::TestAllTypes* msg2,
- UNITTEST::TestAllTypes* msg3) {
+void AssignParsingMergeMessages(
+ unittest::TestAllTypes* msg1,
+ unittest::TestAllTypes* msg2,
+ unittest::TestAllTypes* msg3) {
msg1->set_optional_int32(1);
msg2->set_optional_int64(2);
msg3->set_optional_int32(3);
@@ -437,16 +469,16 @@ void AssignParsingMergeMessages(UNITTEST::TestAllTypes* msg1,
// Test that if an optional or required message/group field appears multiple
// times in the input, they need to be merged.
-TEST(MESSAGE_TEST_NAME, ParsingMerge) {
- UNITTEST::TestParsingMerge::RepeatedFieldsGenerator generator;
- UNITTEST::TestAllTypes* msg1;
- UNITTEST::TestAllTypes* msg2;
- UNITTEST::TestAllTypes* msg3;
-
-#define ASSIGN_REPEATED_FIELD(FIELD) \
- msg1 = generator.add_##FIELD(); \
- msg2 = generator.add_##FIELD(); \
- msg3 = generator.add_##FIELD(); \
+TEST(MessageTest, ParsingMerge) {
+ unittest::TestParsingMerge::RepeatedFieldsGenerator generator;
+ unittest::TestAllTypes* msg1;
+ unittest::TestAllTypes* msg2;
+ unittest::TestAllTypes* msg3;
+
+#define ASSIGN_REPEATED_FIELD(FIELD) \
+ msg1 = generator.add_##FIELD(); \
+ msg2 = generator.add_##FIELD(); \
+ msg3 = generator.add_##FIELD(); \
AssignParsingMergeMessages(msg1, msg2, msg3)
ASSIGN_REPEATED_FIELD(field1);
@@ -469,37 +501,39 @@ TEST(MESSAGE_TEST_NAME, ParsingMerge) {
string buffer;
generator.SerializeToString(&buffer);
- UNITTEST::TestParsingMerge parsing_merge;
+ unittest::TestParsingMerge parsing_merge;
parsing_merge.ParseFromString(buffer);
// Required and optional fields should be merged.
ExpectMessageMerged(parsing_merge.required_all_types());
ExpectMessageMerged(parsing_merge.optional_all_types());
- ExpectMessageMerged(parsing_merge.optionalgroup().optional_group_all_types());
ExpectMessageMerged(
- parsing_merge.GetExtension(UNITTEST::TestParsingMerge::optional_ext));
+ parsing_merge.optionalgroup().optional_group_all_types());
+ ExpectMessageMerged(
+ parsing_merge.GetExtension(unittest::TestParsingMerge::optional_ext));
// Repeated fields should not be merged.
EXPECT_EQ(3, parsing_merge.repeated_all_types_size());
EXPECT_EQ(3, parsing_merge.repeatedgroup_size());
- EXPECT_EQ(
- 3, parsing_merge.ExtensionSize(UNITTEST::TestParsingMerge::repeated_ext));
+ EXPECT_EQ(3, parsing_merge.ExtensionSize(
+ unittest::TestParsingMerge::repeated_ext));
}
-TEST(MESSAGE_TEST_NAME, MergeFrom) {
- UNITTEST::TestAllTypes source, dest;
+TEST(MessageTest, MergeFrom) {
+ unittest::TestAllTypes source;
+ unittest::TestAllTypes dest;
// Optional fields
source.set_optional_int32(1); // only source
source.set_optional_int64(2); // both source and dest
dest.set_optional_int64(3);
- dest.set_optional_uint32(4); // only dest
+ dest.set_optional_uint32(4); // only dest
// Optional fields with defaults
source.set_default_int32(13); // only source
source.set_default_int64(14); // both source and dest
dest.set_default_int64(15);
- dest.set_default_uint32(16); // only dest
+ dest.set_default_uint32(16); // only dest
// Repeated fields
source.add_repeated_int32(5); // only source
@@ -514,14 +548,14 @@ TEST(MESSAGE_TEST_NAME, MergeFrom) {
dest.MergeFrom(source);
// Optional fields: source overwrites dest if source is specified
- EXPECT_EQ(1, dest.optional_int32()); // only source: use source
- EXPECT_EQ(2, dest.optional_int64()); // source and dest: use source
+ EXPECT_EQ(1, dest.optional_int32()); // only source: use source
+ EXPECT_EQ(2, dest.optional_int64()); // source and dest: use source
EXPECT_EQ(4, dest.optional_uint32()); // only dest: use dest
EXPECT_EQ(0, dest.optional_uint64()); // neither: use default
// Optional fields with defaults
- EXPECT_EQ(13, dest.default_int32()); // only source: use source
- EXPECT_EQ(14, dest.default_int64()); // source and dest: use source
+ EXPECT_EQ(13, dest.default_int32()); // only source: use source
+ EXPECT_EQ(14, dest.default_int64()); // source and dest: use source
EXPECT_EQ(16, dest.default_uint32()); // only dest: use dest
EXPECT_EQ(44, dest.default_uint64()); // neither: use default
@@ -530,36 +564,35 @@ TEST(MESSAGE_TEST_NAME, MergeFrom) {
EXPECT_EQ(5, dest.repeated_int32(0));
EXPECT_EQ(6, dest.repeated_int32(1));
ASSERT_EQ(4, dest.repeated_int64_size());
- EXPECT_EQ(9, dest.repeated_int64(0));
+ EXPECT_EQ(9, dest.repeated_int64(0));
EXPECT_EQ(10, dest.repeated_int64(1));
- EXPECT_EQ(7, dest.repeated_int64(2));
- EXPECT_EQ(8, dest.repeated_int64(3));
+ EXPECT_EQ(7, dest.repeated_int64(2));
+ EXPECT_EQ(8, dest.repeated_int64(3));
ASSERT_EQ(2, dest.repeated_uint32_size());
EXPECT_EQ(11, dest.repeated_uint32(0));
EXPECT_EQ(12, dest.repeated_uint32(1));
ASSERT_EQ(0, dest.repeated_uint64_size());
}
-TEST(MESSAGE_TEST_NAME, IsInitialized) {
- UNITTEST::TestIsInitialized msg;
+TEST(MessageTest, IsInitialized) {
+ protobuf_unittest::TestIsInitialized msg;
EXPECT_TRUE(msg.IsInitialized());
- UNITTEST::TestIsInitialized::SubMessage* sub_message =
- msg.mutable_sub_message();
+ protobuf_unittest::TestIsInitialized::SubMessage* sub_message = msg.mutable_sub_message();
EXPECT_TRUE(msg.IsInitialized());
- UNITTEST::TestIsInitialized::SubMessage::SubGroup* sub_group =
- sub_message->mutable_subgroup();
+ protobuf_unittest::TestIsInitialized::SubMessage::SubGroup* sub_group = sub_message->mutable_subgroup();
EXPECT_FALSE(msg.IsInitialized());
sub_group->set_i(1);
EXPECT_TRUE(msg.IsInitialized());
}
-TEST(MESSAGE_FACTORY_TEST_NAME, GeneratedFactoryLookup) {
- EXPECT_EQ(MessageFactory::generated_factory()->GetPrototype(
- UNITTEST::TestAllTypes::descriptor()),
- &UNITTEST::TestAllTypes::default_instance());
+TEST(MessageFactoryTest, GeneratedFactoryLookup) {
+ EXPECT_EQ(
+ MessageFactory::generated_factory()->GetPrototype(
+ protobuf_unittest::TestAllTypes::descriptor()),
+ &protobuf_unittest::TestAllTypes::default_instance());
}
-TEST(MESSAGE_FACTORY_TEST_NAME, GeneratedFactoryUnknownType) {
+TEST(MessageFactoryTest, GeneratedFactoryUnknownType) {
// Construct a new descriptor.
DescriptorPool pool;
FileDescriptorProto file;
@@ -567,9 +600,9 @@ TEST(MESSAGE_FACTORY_TEST_NAME, GeneratedFactoryUnknownType) {
file.add_message_type()->set_name("Foo");
const Descriptor* descriptor = pool.BuildFile(file)->message_type(0);
- // Trying to construct it should return nullptr.
- EXPECT_TRUE(MessageFactory::generated_factory()->GetPrototype(descriptor) ==
- nullptr);
+ // Trying to construct it should return NULL.
+ EXPECT_TRUE(
+ MessageFactory::generated_factory()->GetPrototype(descriptor) == NULL);
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/metadata.h b/third_party/protobuf/3.4.0/src/google/protobuf/metadata.h
index 0a6507c067..0a6507c067 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/metadata.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/metadata.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/metadata_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/metadata_lite.h
index 454d088c96..64fde0c6c6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/metadata_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/metadata_lite.h
@@ -33,8 +33,7 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/arena.h>
-#include <google/protobuf/message_lite.h>
-#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/generated_message_util.h>
namespace google {
namespace protobuf {
@@ -63,7 +62,7 @@ class InternalMetadataWithArenaBase {
ptr_ = NULL;
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE const T& unknown_fields() const {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE const T& unknown_fields() const {
if (GOOGLE_PREDICT_FALSE(have_unknown_fields())) {
return PtrValue<Container>()->unknown_fields;
} else {
@@ -71,7 +70,7 @@ class InternalMetadataWithArenaBase {
}
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* mutable_unknown_fields() {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* mutable_unknown_fields() {
if (GOOGLE_PREDICT_TRUE(have_unknown_fields())) {
return &PtrValue<Container>()->unknown_fields;
} else {
@@ -79,7 +78,7 @@ class InternalMetadataWithArenaBase {
}
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE Arena* arena() const {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE Arena* arena() const {
if (GOOGLE_PREDICT_FALSE(have_unknown_fields())) {
return PtrValue<Container>()->arena;
} else {
@@ -87,11 +86,11 @@ class InternalMetadataWithArenaBase {
}
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool have_unknown_fields() const {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool have_unknown_fields() const {
return PtrTag() == kTagContainer;
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Swap(Derived* other) {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE void Swap(Derived* other) {
// Semantics here are that we swap only the unknown fields, not the arena
// pointer. We cannot simply swap ptr_ with other->ptr_ because we need to
// maintain our own arena ptr. Also, our ptr_ and other's ptr_ may be in
@@ -103,19 +102,19 @@ class InternalMetadataWithArenaBase {
}
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void MergeFrom(const Derived& other) {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE void MergeFrom(const Derived& other) {
if (other.have_unknown_fields()) {
static_cast<Derived*>(this)->DoMergeFrom(other.unknown_fields());
}
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Clear() {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE void Clear() {
if (have_unknown_fields()) {
static_cast<Derived*>(this)->DoClear();
}
}
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void* raw_arena_ptr() const {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE void* raw_arena_ptr() const {
return ptr_;
}
@@ -133,7 +132,7 @@ class InternalMetadataWithArenaBase {
static const intptr_t kPtrValueMask = ~kPtrTagMask;
// Accessors for pointer tag and pointer value.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE int PtrTag() const {
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE int PtrTag() const {
return reinterpret_cast<intptr_t>(ptr_) & kPtrTagMask;
}
@@ -148,14 +147,11 @@ class InternalMetadataWithArenaBase {
Arena* arena;
};
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE T* mutable_unknown_fields_slow() {
+ GOOGLE_ATTRIBUTE_NOINLINE T* mutable_unknown_fields_slow() {
Arena* my_arena = arena();
Container* container = Arena::Create<Container>(my_arena);
- // Two-step assignment works around a bug in clang's static analyzer:
- // https://bugs.llvm.org/show_bug.cgi?id=34198.
- ptr_ = container;
ptr_ = reinterpret_cast<void*>(
- reinterpret_cast<intptr_t>(ptr_) | kTagContainer);
+ reinterpret_cast<intptr_t>(container) | kTagContainer);
container->arena = my_arena;
return &(container->unknown_fields);
}
@@ -191,32 +187,6 @@ class InternalMetadataWithArenaLite
}
};
-// This helper RAII class is needed to efficiently parse unknown fields. We
-// should only call mutable_unknown_fields if there are actual unknown fields.
-// The obvious thing to just use a stack string and swap it at the end of the
-// parse won't work, because the destructor of StringOutputStream needs to be
-// called before we can modify the string (it check-fails). Using
-// LiteUnknownFieldSetter setter(&_internal_metadata_);
-// StringOutputStream stream(setter.buffer());
-// guarantees that the string is only swapped after stream is destroyed.
-class LIBPROTOBUF_EXPORT LiteUnknownFieldSetter {
- public:
- explicit LiteUnknownFieldSetter(InternalMetadataWithArenaLite* metadata)
- : metadata_(metadata) {
- if (metadata->have_unknown_fields()) {
- buffer_.swap(*metadata->mutable_unknown_fields());
- }
- }
- ~LiteUnknownFieldSetter() {
- if (!buffer_.empty()) metadata_->mutable_unknown_fields()->swap(buffer_);
- }
- string* buffer() { return &buffer_; }
-
- private:
- InternalMetadataWithArenaLite* metadata_;
- string buffer_;
-};
-
} // namespace internal
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/no_field_presence_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/no_field_presence_test.cc
index bc41beec81..bc41beec81 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/no_field_presence_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/no_field_presence_test.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/package_info.h b/third_party/protobuf/3.4.0/src/google/protobuf/package_info.h
index 935e96396d..935e96396d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/package_info.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/package_info.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/preserve_unknown_enum_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/preserve_unknown_enum_test.cc
index e292199e80..1673e8afae 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/preserve_unknown_enum_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/preserve_unknown_enum_test.cc
@@ -120,7 +120,7 @@ TEST(PreserveUnknownEnumTest, PreserveParseAndSerializeDynamicMessage) {
string serialized = orig_message.SerializeAsString();
google::protobuf::DynamicMessageFactory factory;
- std::unique_ptr<google::protobuf::Message> message(factory.GetPrototype(
+ google::protobuf::scoped_ptr<google::protobuf::Message> message(factory.GetPrototype(
proto3_preserve_unknown_enum_unittest::MyMessage::descriptor())->New());
EXPECT_EQ(true, message->ParseFromString(serialized));
message->DiscardUnknownFields();
@@ -161,7 +161,7 @@ TEST(PreserveUnknownEnumTest, DynamicProto2HidesUnknownValues) {
orig_message.SerializeToString(&serialized);
google::protobuf::DynamicMessageFactory factory;
- std::unique_ptr<google::protobuf::Message> message(factory.GetPrototype(
+ google::protobuf::scoped_ptr<google::protobuf::Message> message(factory.GetPrototype(
proto2_preserve_unknown_enum_unittest::MyMessage::descriptor())->New());
EXPECT_EQ(true, message->ParseFromString(serialized));
// The intermediate message has everything in its "unknown fields".
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/proto3_arena_lite_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/proto3_arena_lite_unittest.cc
index 2ac775d7d9..0f18c027e8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/proto3_arena_lite_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/proto3_arena_lite_unittest.cc
@@ -30,15 +30,20 @@
#include <string>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
-#include <google/protobuf/unittest_proto3_arena.pb.h>
+#include <google/protobuf/test_util.h>
+#include <google/protobuf/unittest.pb.h>
+#include <google/protobuf/unittest_proto3_arena_lite.pb.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
namespace google {
-using proto3_arena_unittest::TestAllTypes;
+using proto3_arena_lite_unittest::TestAllTypes;
namespace protobuf {
namespace {
@@ -51,9 +56,9 @@ void SetAllFields(TestAllTypes* m) {
m->mutable_optional_nested_message()->set_bb(42);
m->mutable_optional_foreign_message()->set_c(43);
m->set_optional_nested_enum(
- proto3_arena_unittest::TestAllTypes_NestedEnum_BAZ);
+ proto3_arena_lite_unittest::TestAllTypes_NestedEnum_BAZ);
m->set_optional_foreign_enum(
- proto3_arena_unittest::FOREIGN_BAZ);
+ proto3_arena_lite_unittest::FOREIGN_BAZ);
m->mutable_optional_lazy_message()->set_bb(45);
m->add_repeated_int32(100);
m->add_repeated_string("asdf");
@@ -61,9 +66,9 @@ void SetAllFields(TestAllTypes* m) {
m->add_repeated_nested_message()->set_bb(46);
m->add_repeated_foreign_message()->set_c(47);
m->add_repeated_nested_enum(
- proto3_arena_unittest::TestAllTypes_NestedEnum_BAZ);
+ proto3_arena_lite_unittest::TestAllTypes_NestedEnum_BAZ);
m->add_repeated_foreign_enum(
- proto3_arena_unittest::FOREIGN_BAZ);
+ proto3_arena_lite_unittest::FOREIGN_BAZ);
m->add_repeated_lazy_message()->set_bb(49);
m->set_oneof_uint32(1);
@@ -79,9 +84,9 @@ void ExpectAllFieldsSet(const TestAllTypes& m) {
EXPECT_EQ(42, m.optional_nested_message().bb());
EXPECT_EQ(true, m.has_optional_foreign_message());
EXPECT_EQ(43, m.optional_foreign_message().c());
- EXPECT_EQ(proto3_arena_unittest::TestAllTypes_NestedEnum_BAZ,
+ EXPECT_EQ(proto3_arena_lite_unittest::TestAllTypes_NestedEnum_BAZ,
m.optional_nested_enum());
- EXPECT_EQ(proto3_arena_unittest::FOREIGN_BAZ,
+ EXPECT_EQ(proto3_arena_lite_unittest::FOREIGN_BAZ,
m.optional_foreign_enum());
EXPECT_EQ(true, m.has_optional_lazy_message());
EXPECT_EQ(45, m.optional_lazy_message().bb());
@@ -97,15 +102,15 @@ void ExpectAllFieldsSet(const TestAllTypes& m) {
EXPECT_EQ(1, m.repeated_foreign_message_size());
EXPECT_EQ(47, m.repeated_foreign_message(0).c());
EXPECT_EQ(1, m.repeated_nested_enum_size());
- EXPECT_EQ(proto3_arena_unittest::TestAllTypes_NestedEnum_BAZ,
+ EXPECT_EQ(proto3_arena_lite_unittest::TestAllTypes_NestedEnum_BAZ,
m.repeated_nested_enum(0));
EXPECT_EQ(1, m.repeated_foreign_enum_size());
- EXPECT_EQ(proto3_arena_unittest::FOREIGN_BAZ,
+ EXPECT_EQ(proto3_arena_lite_unittest::FOREIGN_BAZ,
m.repeated_foreign_enum(0));
EXPECT_EQ(1, m.repeated_lazy_message_size());
EXPECT_EQ(49, m.repeated_lazy_message(0).bb());
- EXPECT_EQ(proto3_arena_unittest::TestAllTypes::kOneofString,
+ EXPECT_EQ(proto3_arena_lite_unittest::TestAllTypes::kOneofString,
m.oneof_field_case());
EXPECT_EQ("test", m.oneof_string());
}
@@ -149,7 +154,7 @@ TEST(Proto3ArenaLiteTest, ReleaseMessage) {
Arena arena;
TestAllTypes* arena_message = Arena::CreateMessage<TestAllTypes>(&arena);
arena_message->mutable_optional_nested_message()->set_bb(118);
- std::unique_ptr<TestAllTypes::NestedMessage> nested(
+ google::protobuf::scoped_ptr<TestAllTypes::NestedMessage> nested(
arena_message->release_optional_nested_message());
EXPECT_EQ(118, nested->bb());
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/proto3_arena_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/proto3_arena_unittest.cc
index dac7378162..3a0fb804be 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/proto3_arena_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/proto3_arena_unittest.cc
@@ -30,6 +30,9 @@
#include <string>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/test_util.h>
@@ -195,7 +198,7 @@ TEST(Proto3ArenaTest, ReleaseMessage) {
Arena arena;
TestAllTypes* arena_message = Arena::CreateMessage<TestAllTypes>(&arena);
arena_message->mutable_optional_nested_message()->set_bb(118);
- std::unique_ptr<TestAllTypes::NestedMessage> nested(
+ google::protobuf::scoped_ptr<TestAllTypes::NestedMessage> nested(
arena_message->release_optional_nested_message());
EXPECT_EQ(118, nested->bb());
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/proto3_lite_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/proto3_lite_unittest.cc
index 8b2c574217..2e2beea909 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/proto3_lite_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/proto3_lite_unittest.cc
@@ -30,8 +30,13 @@
#include <string>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
+#include <google/protobuf/test_util.h>
+#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/unittest_proto3_lite.pb.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/testing/googletest.h>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/reflection.h b/third_party/protobuf/3.4.0/src/google/protobuf/reflection.h
index 5d0fc42b8e..fcb9a43559 100644..100755
--- a/third_party/protobuf/3.6.0/src/google/protobuf/reflection.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/reflection.h
@@ -34,6 +34,9 @@
#define GOOGLE_PROTOBUF_REFLECTION_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/message.h>
#include <google/protobuf/generated_enum_util.h>
@@ -60,7 +63,7 @@ MutableRepeatedFieldRef<T> Reflection::GetMutableRepeatedFieldRef(
// RepeatedFieldRef definition for non-message types.
template<typename T>
class RepeatedFieldRef<
- T, typename std::enable_if<!std::is_base_of<Message, T>::value>::type> {
+ T, typename internal::enable_if<!internal::is_base_of<Message, T>::value>::type> {
typedef typename internal::RefTypeTraits<T>::iterator IteratorType;
typedef typename internal::RefTypeTraits<T>::AccessorType AccessorType;
@@ -109,7 +112,7 @@ class RepeatedFieldRef<
// MutableRepeatedFieldRef definition for non-message types.
template<typename T>
class MutableRepeatedFieldRef<
- T, typename std::enable_if<!std::is_base_of<Message, T>::value>::type> {
+ T, typename internal::enable_if<!internal::is_base_of<Message, T>::value>::type> {
typedef typename internal::RefTypeTraits<T>::AccessorType AccessorType;
public:
@@ -174,7 +177,7 @@ class MutableRepeatedFieldRef<
// RepeatedFieldRef definition for message types.
template<typename T>
class RepeatedFieldRef<
- T, typename std::enable_if<std::is_base_of<Message, T>::value>::type> {
+ T, typename internal::enable_if<internal::is_base_of<Message, T>::value>::type> {
typedef typename internal::RefTypeTraits<T>::iterator IteratorType;
typedef typename internal::RefTypeTraits<T>::AccessorType AccessorType;
@@ -216,7 +219,7 @@ class RepeatedFieldRef<
}
iterator end() const {
// The end iterator must not be dereferenced, no need for scratch space.
- return iterator(data_, accessor_, false, nullptr);
+ return iterator(data_, accessor_, false, NULL);
}
private:
@@ -242,7 +245,7 @@ class RepeatedFieldRef<
// MutableRepeatedFieldRef definition for message types.
template<typename T>
class MutableRepeatedFieldRef<
- T, typename std::enable_if<std::is_base_of<Message, T>::value>::type> {
+ T, typename internal::enable_if<internal::is_base_of<Message, T>::value>::type> {
typedef typename internal::RefTypeTraits<T>::AccessorType AccessorType;
public:
@@ -444,7 +447,7 @@ class RepeatedFieldRefIterator
iterator_(begin ? accessor->BeginIterator(data)
: accessor->EndIterator(data)),
// The end iterator must not be dereferenced, no need for scratch space.
- scratch_space_(begin ? new AccessorValueType : nullptr) {}
+ scratch_space_(begin ? new AccessorValueType : NULL) {}
// Constructor for message fields.
RepeatedFieldRefIterator(const void* data,
const RepeatedFieldAccessor* accessor,
@@ -505,7 +508,7 @@ class RepeatedFieldRefIterator
const void* data_;
const RepeatedFieldAccessor* accessor_;
void* iterator_;
- std::unique_ptr<AccessorValueType> scratch_space_;
+ google::protobuf::scoped_ptr<AccessorValueType> scratch_space_;
};
// TypeTraits that maps the type parameter T of RepeatedFieldRef or
@@ -532,7 +535,7 @@ DEFINE_PRIMITIVE(BOOL, bool)
template<typename T>
struct RefTypeTraits<
- T, typename std::enable_if<PrimitiveTraits<T>::is_primitive>::type> {
+ T, typename internal::enable_if<PrimitiveTraits<T>::is_primitive>::type> {
typedef RepeatedFieldRefIterator<T> iterator;
typedef RepeatedFieldAccessor AccessorType;
typedef T AccessorValueType;
@@ -547,7 +550,7 @@ struct RefTypeTraits<
template<typename T>
struct RefTypeTraits<
- T, typename std::enable_if<is_proto_enum<T>::value>::type> {
+ T, typename internal::enable_if<is_proto_enum<T>::value>::type> {
typedef RepeatedFieldRefIterator<T> iterator;
typedef RepeatedFieldAccessor AccessorType;
// We use int32 for repeated enums in RepeatedFieldAccessor.
@@ -563,7 +566,7 @@ struct RefTypeTraits<
template<typename T>
struct RefTypeTraits<
- T, typename std::enable_if<std::is_same<string, T>::value>::type> {
+ T, typename internal::enable_if< ::google::protobuf::internal::is_same<string, T>::value>::type> {
typedef RepeatedFieldRefIterator<T> iterator;
typedef RepeatedFieldAccessor AccessorType;
typedef string AccessorValueType;
@@ -591,7 +594,7 @@ struct MessageDescriptorGetter<Message> {
template<typename T>
struct RefTypeTraits<
- T, typename std::enable_if<std::is_base_of<Message, T>::value>::type> {
+ T, typename internal::enable_if<internal::is_base_of<Message, T>::value>::type> {
typedef RepeatedFieldRefIterator<T> iterator;
typedef RepeatedFieldAccessor AccessorType;
typedef Message AccessorValueType;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/reflection_internal.h b/third_party/protobuf/3.4.0/src/google/protobuf/reflection_internal.h
index fcb424715c..fcb424715c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/reflection_internal.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/reflection_internal.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops.cc b/third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops.cc
index 3cd503404d..d186731184 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops.cc
@@ -31,15 +31,13 @@
// 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/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/descriptor.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/map_field.h>
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/stubs/strutil.h>
@@ -48,17 +46,6 @@ namespace google {
namespace protobuf {
namespace internal {
-static const Reflection* GetReflectionOrDie(const Message& m) {
- const Reflection* r = m.GetReflection();
- if (r == nullptr) {
- const Descriptor* d = m.GetDescriptor();
- const string& mtype = d ? d->name() : "unknown";
- // RawMessage is one known type for which GetReflection() returns nullptr.
- GOOGLE_LOG(FATAL) << "Message does not support reflection (type " << mtype << ").";
- }
- return r;
-}
-
void ReflectionOps::Copy(const Message& from, Message* to) {
if (&from == to) return;
Clear(to);
@@ -74,8 +61,8 @@ void ReflectionOps::Merge(const Message& from, Message* to) {
<< "(merge " << descriptor->full_name()
<< " to " << to->GetDescriptor()->full_name() << ")";
- const Reflection* from_reflection = GetReflectionOrDie(from);
- const Reflection* to_reflection = GetReflectionOrDie(*to);
+ const Reflection* from_reflection = from.GetReflection();
+ const Reflection* to_reflection = to->GetReflection();
std::vector<const FieldDescriptor*> fields;
from_reflection->ListFields(from, &fields);
@@ -141,7 +128,7 @@ void ReflectionOps::Merge(const Message& from, Message* to) {
}
void ReflectionOps::Clear(Message* message) {
- const Reflection* reflection = GetReflectionOrDie(*message);
+ const Reflection* reflection = message->GetReflection();
std::vector<const FieldDescriptor*> fields;
reflection->ListFields(*message, &fields);
@@ -154,7 +141,7 @@ void ReflectionOps::Clear(Message* message) {
bool ReflectionOps::IsInitialized(const Message& message) {
const Descriptor* descriptor = message.GetDescriptor();
- const Reflection* reflection = GetReflectionOrDie(message);
+ const Reflection* reflection = message.GetReflection();
// Check required fields of this message.
for (int i = 0; i < descriptor->field_count(); i++) {
@@ -214,7 +201,7 @@ bool ReflectionOps::IsInitialized(const Message& message) {
}
void ReflectionOps::DiscardUnknownFields(Message* message) {
- const Reflection* reflection = GetReflectionOrDie(*message);
+ const Reflection* reflection = message->GetReflection();
reflection->MutableUnknownFields(message)->Clear();
@@ -261,7 +248,7 @@ void ReflectionOps::FindInitializationErrors(
const string& prefix,
std::vector<string>* errors) {
const Descriptor* descriptor = message.GetDescriptor();
- const Reflection* reflection = GetReflectionOrDie(message);
+ const Reflection* reflection = message.GetReflection();
// Check required fields of this message.
for (int i = 0; i < descriptor->field_count(); i++) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops.h b/third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops.h
index 45d8c650ef..45d8c650ef 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops_unittest.cc
index 9cedb34229..9cedb34229 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/reflection_ops_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/reflection_ops_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/repeated_field.cc b/third_party/protobuf/3.4.0/src/google/protobuf/repeated_field.cc
index 310000aabb..5ca964c167 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/repeated_field.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/repeated_field.cc
@@ -103,22 +103,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/repeated_field.h b/third_party/protobuf/3.4.0/src/google/protobuf/repeated_field.h
index b47ea99484..d8003b8fa9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/repeated_field.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/repeated_field.h
@@ -57,11 +57,9 @@
#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>
-#include <type_traits>
// Forward-declare these so that we can make them friends.
@@ -87,7 +85,7 @@ void LogIndexOutOfBounds(int index, int size);
template <typename Iter>
inline int CalculateReserve(Iter begin, Iter end, std::forward_iterator_tag) {
- return static_cast<int>(std::distance(begin, end));
+ return std::distance(begin, end);
}
template <typename Iter>
@@ -109,7 +107,7 @@ inline int CalculateReserve(Iter begin, Iter end) {
// not ever use a RepeatedField directly; they will use the get-by-index,
// set-by-index, and add accessors that are generated for all repeated fields.
template <typename Element>
-class RepeatedField final {
+class RepeatedField PROTOBUF_FINAL {
public:
RepeatedField();
explicit RepeatedField(Arena* arena);
@@ -120,9 +118,6 @@ class RepeatedField final {
RepeatedField& operator=(const RepeatedField& other);
- RepeatedField(RepeatedField&& other) noexcept;
- RepeatedField& operator=(RepeatedField&& other) noexcept;
-
bool empty() const;
int size() const;
@@ -278,27 +273,13 @@ class RepeatedField 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;
-
- // 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;
- }
+ // Contains arena ptr and the elements array. We also keep the invariant that
+ // if rep_ is NULL, then arena is NULL.
+ Rep* rep_;
friend class Arena;
typedef void InternalArenaConstructable_;
-
- // Move the contents of |from| into |to|, possibly clobbering |from| in the
- // process. For primitive types this is just a memcpy(), but it could be
- // specialized for non-primitive types to, say, swap each element instead.
void MoveArray(Element* to, Element* from, int size);
// Copy the elements of |from| into |to|.
@@ -306,7 +287,7 @@ class RepeatedField final {
// Internal helper expected by Arena methods.
inline Arena* GetArenaNoVirtual() const {
- return (total_size_ == 0) ? ptr_.arena : ptr_.rep->arena;
+ return (rep_ == NULL) ? NULL : rep_->arena;
}
// Internal helper to delete all elements and deallocate the storage.
@@ -351,7 +332,7 @@ namespace internal {
// effectively.
template <typename Element,
bool HasTrivialCopy =
- std::is_pod<Element>::value>
+ has_trivial_copy<Element>::value>
struct ElementCopier {
void operator()(Element* to, const Element* from, int array_size);
};
@@ -385,8 +366,8 @@ struct TypeImplementsMergeBehaviorProbeForMergeFrom {
CheckType<U, bool, &U::MergeFrom>*);
template<typename U> static HasNoMerge Check(...);
- // Resolves to either std::true_type or std::false_type.
- typedef std::integral_constant<bool,
+ // Resovles to either google::protobuf::internal::true_type or google::protobuf::internal::false_type.
+ typedef google::protobuf::internal::integral_constant<bool,
(sizeof(Check<T>(0)) == sizeof(HasMerge))> type;
};
@@ -397,7 +378,7 @@ struct TypeImplementsMergeBehavior :
template <>
struct TypeImplementsMergeBehavior< ::std::string> {
- typedef std::true_type type;
+ typedef google::protobuf::internal::true_type type;
};
// This is the common base class for RepeatedPtrFields. It deals only in void*
@@ -408,12 +389,7 @@ 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);
@@ -423,6 +399,31 @@ 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() {}
@@ -435,41 +436,25 @@ 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.
-
+#if LANG_CXX11
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);
+ void Add(typename TypeHandler::Type&& value,
+ internal::enable_if<TypeHandler::Moveable>* dummy = NULL);
+#endif
template <typename TypeHandler>
+ void RemoveLast();
+ template <typename TypeHandler>
void Clear();
-
template <typename TypeHandler>
void MergeFrom(const RepeatedPtrFieldBase& other);
-
- inline void InternalSwap(RepeatedPtrFieldBase* other);
-
- protected:
- template <typename TypeHandler>
- void Add(typename TypeHandler::Type&& value,
- std::enable_if<TypeHandler::Moveable>* dummy = NULL);
-
- template <typename TypeHandler>
- void RemoveLast();
template <typename TypeHandler>
void CopyFrom(const RepeatedPtrFieldBase& other);
@@ -488,14 +473,15 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
template <typename TypeHandler>
const typename TypeHandler::Type* const* data() const;
- template <typename TypeHandler> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- void Swap(RepeatedPtrFieldBase* other);
+ template <typename TypeHandler>
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE void Swap(RepeatedPtrFieldBase* other);
void SwapElements(int index1, int index2);
template <typename TypeHandler>
size_t SpaceUsedExcludingSelfLong() const;
+
// Advanced memory management --------------------------------------
// Like Add(), but if there are no cleared objects to use, returns NULL.
@@ -528,24 +514,29 @@ 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, std::true_type);
+ void AddAllocatedInternal(typename TypeHandler::Type* value,
+ google::protobuf::internal::true_type);
template <typename TypeHandler>
- void AddAllocatedInternal(typename TypeHandler::Type* value, std::false_type);
+ void AddAllocatedInternal(typename TypeHandler::Type* value,
+ google::protobuf::internal::false_type);
- template <typename TypeHandler> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+ template <typename TypeHandler> GOOGLE_ATTRIBUTE_NOINLINE
void AddAllocatedSlowWithCopy(typename TypeHandler::Type* value,
Arena* value_arena,
Arena* my_arena);
- template <typename TypeHandler> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+ template <typename TypeHandler> GOOGLE_ATTRIBUTE_NOINLINE
void AddAllocatedSlowWithoutCopy(typename TypeHandler::Type* value);
template <typename TypeHandler>
- typename TypeHandler::Type* ReleaseLastInternal(std::true_type);
+ typename TypeHandler::Type* ReleaseLastInternal(google::protobuf::internal::true_type);
template <typename TypeHandler>
- typename TypeHandler::Type* ReleaseLastInternal(std::false_type);
+ typename TypeHandler::Type* ReleaseLastInternal(google::protobuf::internal::false_type);
- template<typename TypeHandler> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+ template<typename TypeHandler> GOOGLE_ATTRIBUTE_NOINLINE
void SwapFallback(RepeatedPtrFieldBase* other);
inline Arena* GetArenaNoVirtual() const {
@@ -602,33 +593,7 @@ 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);
};
@@ -636,8 +601,9 @@ template <typename GenericType>
class GenericTypeHandler {
public:
typedef GenericType Type;
- typedef GenericType WeakType;
+#if LANG_CXX11
static const bool Moveable = false;
+#endif
static inline GenericType* New(Arena* arena) {
return ::google::protobuf::Arena::CreateMaybeMessage<Type>(arena);
@@ -657,11 +623,14 @@ class GenericTypeHandler {
}
static inline void Clear(GenericType* value) { value->Clear(); }
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
- static void Merge(const GenericType& from, GenericType* to);
+ GOOGLE_ATTRIBUTE_NOINLINE static void Merge(const GenericType& from,
+ GenericType* to);
static inline size_t SpaceUsedLong(const GenericType& value) {
return value.SpaceUsedLong();
}
+ static inline const Type& default_instance() {
+ return Type::default_instance();
+ }
};
template <typename GenericType>
@@ -723,19 +692,42 @@ 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;
- static const bool Moveable = std::is_move_constructible<Type>::value &&
- std::is_move_assignable<Type>::value;
+#if LANG_CXX11
+ static const bool Moveable =
+ std::is_move_constructible<Type>::value &&
+ std::is_move_assignable<Type>::value;
+#endif
static inline string* New(Arena* arena) {
return Arena::Create<string>(arena);
}
+#if LANG_CXX11
static inline string* New(Arena* arena, string&& value) {
return Arena::Create<string>(arena, std::move(value));
}
+#endif
static inline string* NewFromPrototype(const string*,
::google::protobuf::Arena* arena) {
return New(arena);
@@ -753,6 +745,9 @@ 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);
}
@@ -763,7 +758,7 @@ class StringTypeHandler {
// RepeatedPtrField is like RepeatedField, but used for repeated strings or
// Messages.
template <typename Element>
-class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
+class RepeatedPtrField PROTOBUF_FINAL : public internal::RepeatedPtrFieldBase {
public:
RepeatedPtrField();
explicit RepeatedPtrField(::google::protobuf::Arena* arena);
@@ -775,16 +770,15 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
RepeatedPtrField& operator=(const RepeatedPtrField& other);
- RepeatedPtrField(RepeatedPtrField&& other) noexcept;
- RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept;
-
bool empty() const;
int size() const;
const Element& Get(int index) const;
Element* Mutable(int index);
Element* Add();
+#if LANG_CXX11
void Add(Element&& value);
+#endif
const Element& operator[](int index) const { return Get(index); }
Element& operator[](int index) { return *Mutable(index); }
@@ -914,7 +908,7 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// RepeatedPtrField<T> temp_field;
// temp_field.AddAllocated(new T);
// ... // Do something with temp_field
- // temp_field.ExtractSubrange(0, temp_field.size(), nullptr);
+ // temp_field.ExtractSubrange(0, temp_field.size(), NULL);
// If you put temp_field on the arena this fails, because the ownership
// transfers to the arena at the "AddAllocated" call and is not released
// anymore causing a double delete. UnsafeArenaAddAllocated prevents this.
@@ -1013,13 +1007,11 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// MergeFrom()), so we must resolve this at compile time. ExtractSubrange()
// uses SFINAE to choose one of the below implementations.
void ExtractSubrangeInternal(int start, int num, Element** elements,
- std::true_type);
+ google::protobuf::internal::true_type);
void ExtractSubrangeInternal(int start, int num, Element** elements,
- std::false_type);
+ google::protobuf::internal::false_type);
friend class Arena;
- friend class MessageLite;
-
typedef void InternalArenaConstructable_;
};
@@ -1030,25 +1022,33 @@ template <typename Element>
inline RepeatedField<Element>::RepeatedField()
: current_size_(0),
total_size_(0),
- ptr_(NULL) {
+ rep_(NULL) {
}
template <typename Element>
inline RepeatedField<Element>::RepeatedField(Arena* arena)
: current_size_(0),
total_size_(0),
- ptr_(arena) {
+ 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;
+ }
}
template <typename Element>
inline RepeatedField<Element>::RepeatedField(const RepeatedField& other)
: current_size_(0),
total_size_(0),
- ptr_(NULL) {
+ rep_(NULL) {
if (other.current_size_ != 0) {
- Reserve(other.size());
- AddNAlreadyReserved(other.size());
- CopyArray(Mutable(0), &other.Get(0), other.size());
+ Reserve(other.current_size_);
+ CopyArray(rep_->elements,
+ other.rep_->elements, other.current_size_);
+ current_size_ = other.current_size_;
}
}
@@ -1057,7 +1057,7 @@ template <typename Iter>
RepeatedField<Element>::RepeatedField(Iter begin, const Iter& end)
: current_size_(0),
total_size_(0),
- ptr_(NULL) {
+ rep_(NULL) {
int reserve = internal::CalculateReserve(begin, end);
if (reserve != -1) {
Reserve(reserve);
@@ -1073,9 +1073,9 @@ RepeatedField<Element>::RepeatedField(Iter begin, const Iter& end)
template <typename Element>
RepeatedField<Element>::~RepeatedField() {
- if (total_size_ > 0) {
- InternalDeallocate(rep(), total_size_);
- }
+ // See explanation in Reserve(): we need to invoke destructors here for the
+ // case that Element has a non-trivial destructor.
+ InternalDeallocate(rep_, total_size_);
}
template <typename Element>
@@ -1087,33 +1087,6 @@ RepeatedField<Element>::operator=(const RepeatedField& other) {
}
template <typename Element>
-inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept
- : RepeatedField() {
- // We don't just call Swap(&other) here because it would perform 3 copies if
- // the two fields are on different arenas.
- if (other.GetArenaNoVirtual()) {
- CopyFrom(other);
- } else {
- InternalSwap(&other);
- }
-}
-
-template <typename Element>
-inline RepeatedField<Element>& RepeatedField<Element>::operator=(
- RepeatedField&& other) noexcept {
- // We don't just call Swap(&other) here because it would perform 3 copies if
- // the two fields are on different arenas.
- if (this != &other) {
- if (this->GetArenaNoVirtual() != other.GetArenaNoVirtual()) {
- CopyFrom(other);
- } else {
- InternalSwap(&other);
- }
- }
- return *this;
-}
-
-template <typename Element>
inline bool RepeatedField<Element>::empty() const {
return current_size_ == 0;
}
@@ -1131,21 +1104,19 @@ 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_);
- // 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_];
+ Element* ret = &rep_->elements[current_size_];
current_size_ += elements;
return ret;
}
@@ -1155,8 +1126,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;
}
@@ -1165,33 +1136,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>
@@ -1230,10 +1201,10 @@ template <typename Element>
inline void RepeatedField<Element>::MergeFrom(const RepeatedField& other) {
GOOGLE_DCHECK_NE(&other, this);
if (other.current_size_ != 0) {
- int existing_size = size();
- Reserve(existing_size + other.size());
- AddNAlreadyReserved(other.size());
- CopyArray(Mutable(existing_size), &other.Get(0), other.size());
+ Reserve(current_size_ + other.current_size_);
+ CopyArray(rep_->elements + current_size_,
+ other.rep_->elements, other.current_size_);
+ current_size_ += other.current_size_;
}
}
@@ -1262,17 +1233,18 @@ inline typename RepeatedField<Element>::iterator RepeatedField<Element>::erase(
template <typename Element>
inline Element* RepeatedField<Element>::mutable_data() {
- return total_size_ > 0 ? rep()->elements : NULL;
+ return rep_ ? rep_->elements : NULL;
}
template <typename Element>
inline const Element* RepeatedField<Element>::data() const {
- return total_size_ > 0 ? rep()->elements : NULL;
+ return rep_ ? rep_->elements : NULL;
}
template <typename Element>
inline const Element* RepeatedField<Element>::unsafe_data() const {
- return rep()->elements;
+ GOOGLE_DCHECK(rep_);
+ return rep_->elements;
}
template <typename Element>
@@ -1280,7 +1252,7 @@ inline void RepeatedField<Element>::InternalSwap(RepeatedField* other) {
GOOGLE_DCHECK(this != other);
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
- std::swap(ptr_, other->ptr_);
+ std::swap(rep_, other->rep_);
std::swap(current_size_, other->current_size_);
std::swap(total_size_, other->total_size_);
}
@@ -1307,43 +1279,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 total_size_ > 0 ? rep()->elements : NULL;
+ return rep_ ? rep_->elements : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::const_iterator
RepeatedField<Element>::begin() const {
- return total_size_ > 0 ? rep()->elements : NULL;
+ return rep_ ? rep_->elements : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::const_iterator
RepeatedField<Element>::cbegin() const {
- return total_size_ > 0 ? rep()->elements : NULL;
+ return rep_ ? rep_->elements : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::iterator
RepeatedField<Element>::end() {
- return total_size_ > 0 ? rep()->elements + current_size_ : NULL;
+ return rep_ ? rep_->elements + current_size_ : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::const_iterator
RepeatedField<Element>::end() const {
- return total_size_ > 0 ? rep()->elements + current_size_ : NULL;
+ return rep_ ? rep_->elements + current_size_ : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::const_iterator
RepeatedField<Element>::cend() const {
- return total_size_ > 0 ? rep()->elements + current_size_ : NULL;
+ return rep_ ? rep_->elements + current_size_ : NULL;
}
template <typename Element>
inline size_t RepeatedField<Element>::SpaceUsedExcludingSelfLong() const {
- return total_size_ > 0 ? (total_size_ * sizeof(Element) + kRepHeaderSize) : 0;
+ return rep_ ? (total_size_ * sizeof(Element) + kRepHeaderSize) : 0;
}
// Avoid inlining of Reserve(): new, copy, and delete[] lead to a significant
@@ -1351,7 +1323,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 = total_size_ > 0 ? rep() : NULL;
+ Rep* old_rep = rep_;
Arena* arena = GetArenaNoVirtual();
new_size = std::max(google::protobuf::internal::kMinRepeatedFieldAllocationSize,
std::max(total_size_ * 2, new_size));
@@ -1361,12 +1333,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) {
- ptr_.rep = static_cast<Rep*>(::operator new(bytes));
+ rep_ = static_cast<Rep*>(::operator new(bytes));
} else {
- ptr_.rep = reinterpret_cast<Rep*>(
+ rep_ = reinterpret_cast<Rep*>(
::google::protobuf::Arena::CreateArray<char>(arena, bytes));
}
- ptr_.rep->arena = arena;
+ 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
@@ -1378,13 +1350,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 = e + total_size_;
+ Element* e = &rep_->elements[0];
+ Element* limit = &rep_->elements[total_size_];
for (; e < limit; e++) {
new (e) Element;
}
if (current_size_ > 0) {
- MoveArray(&rep()->elements[0], old_rep->elements, current_size_);
+ MoveArray(rep_->elements, old_rep->elements, current_size_);
}
// Likewise, we need to invoke destructors on the old array.
@@ -1500,13 +1472,14 @@ inline int RepeatedPtrFieldBase::size() const {
}
template <typename TypeHandler>
-inline const typename TypeHandler::WeakType&
+inline const typename TypeHandler::Type&
RepeatedPtrFieldBase::Get(int index) const {
GOOGLE_DCHECK_GE(index, 0);
GOOGLE_DCHECK_LT(index, current_size_);
return *cast<TypeHandler>(rep_->elements[index]);
}
+
template <typename TypeHandler>
inline typename TypeHandler::Type*
RepeatedPtrFieldBase::Mutable(int index) {
@@ -1538,10 +1511,11 @@ inline typename TypeHandler::Type* RepeatedPtrFieldBase::Add(
return result;
}
+#if LANG_CXX11
template <typename TypeHandler>
inline void RepeatedPtrFieldBase::Add(
typename TypeHandler::Type&& value,
- std::enable_if<TypeHandler::Moveable>*) {
+ internal::enable_if<TypeHandler::Moveable>*) {
if (rep_ != NULL && current_size_ < rep_->allocated_size) {
*cast<TypeHandler>(rep_->elements[current_size_++]) = std::move(value);
return;
@@ -1554,6 +1528,7 @@ inline void RepeatedPtrFieldBase::Add(
TypeHandler::New(arena_, std::move(value));
rep_->elements[current_size_++] = result;
}
+#endif
template <typename TypeHandler>
inline void RepeatedPtrFieldBase::RemoveLast() {
@@ -1613,18 +1588,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::WeakType* other_elem =
- reinterpret_cast<typename TypeHandler::WeakType*>(other_elems[i]);
- typename TypeHandler::WeakType* new_elem =
- reinterpret_cast<typename TypeHandler::WeakType*>(our_elems[i]);
+ typename TypeHandler::Type* other_elem =
+ reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]);
+ typename TypeHandler::Type* new_elem =
+ reinterpret_cast<typename TypeHandler::Type*>(our_elems[i]);
TypeHandler::Merge(*other_elem, new_elem);
}
Arena* arena = GetArenaNoVirtual();
for (int i = already_allocated; i < length; i++) {
// Not allocated: alloc a new element first, then merge it.
- typename TypeHandler::WeakType* other_elem =
- reinterpret_cast<typename TypeHandler::WeakType*>(other_elems[i]);
- typename TypeHandler::WeakType* new_elem =
+ typename TypeHandler::Type* other_elem =
+ reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]);
+ typename TypeHandler::Type* new_elem =
TypeHandler::NewFromPrototype(other_elem, arena);
TypeHandler::Merge(*other_elem, new_elem);
our_elems[i] = new_elem;
@@ -1696,7 +1671,7 @@ inline typename TypeHandler::Type* RepeatedPtrFieldBase::AddFromCleared() {
template <typename TypeHandler>
void RepeatedPtrFieldBase::AddAllocatedInternal(
typename TypeHandler::Type* value,
- std::true_type) {
+ google::protobuf::internal::true_type) {
Arena* element_arena = reinterpret_cast<Arena*>(
TypeHandler::GetMaybeArenaPointer(value));
Arena* arena = GetArenaNoVirtual();
@@ -1714,6 +1689,7 @@ void RepeatedPtrFieldBase::AddAllocatedInternal(
elems[current_size_] = value;
current_size_ = current_size_ + 1;
rep_->allocated_size = rep_->allocated_size + 1;
+ return;
} else {
AddAllocatedSlowWithCopy<TypeHandler>(
value, TypeHandler::GetArena(value), arena);
@@ -1746,7 +1722,7 @@ void RepeatedPtrFieldBase::AddAllocatedSlowWithCopy(
template <typename TypeHandler>
void RepeatedPtrFieldBase::AddAllocatedInternal(
typename TypeHandler::Type* value,
- std::false_type) {
+ google::protobuf::internal::false_type) {
if (rep_ && rep_->allocated_size < total_size_) {
// Fast path: underlying arena representation (tagged pointer) is equal to
// our arena pointer, and we can add to array without resizing it (at least
@@ -1760,6 +1736,7 @@ void RepeatedPtrFieldBase::AddAllocatedInternal(
elems[current_size_] = value;
current_size_ = current_size_ + 1;
++rep_->allocated_size;
+ return;
} else {
UnsafeArenaAddAllocated<TypeHandler>(value);
}
@@ -1796,7 +1773,7 @@ void RepeatedPtrFieldBase::UnsafeArenaAddAllocated(
// ReleaseLast() for types that implement merge/copy behavior.
template <typename TypeHandler>
inline typename TypeHandler::Type*
-RepeatedPtrFieldBase::ReleaseLastInternal(std::true_type) {
+RepeatedPtrFieldBase::ReleaseLastInternal(google::protobuf::internal::true_type) {
// First, release an element.
typename TypeHandler::Type* result = UnsafeArenaReleaseLast<TypeHandler>();
// Now perform a copy if we're on an arena.
@@ -1817,7 +1794,7 @@ RepeatedPtrFieldBase::ReleaseLastInternal(std::true_type) {
// case.
template <typename TypeHandler>
inline typename TypeHandler::Type*
-RepeatedPtrFieldBase::ReleaseLastInternal(std::false_type) {
+RepeatedPtrFieldBase::ReleaseLastInternal(google::protobuf::internal::false_type) {
GOOGLE_DCHECK(GetArenaNoVirtual() == NULL)
<< "ReleaseLast() called on a RepeatedPtrField that is on an arena, "
<< "with a type that does not implement MergeFrom. This is unsafe; "
@@ -1924,34 +1901,6 @@ inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=(
}
template <typename Element>
-inline RepeatedPtrField<Element>::RepeatedPtrField(
- RepeatedPtrField&& other) noexcept
- : RepeatedPtrField() {
- // We don't just call Swap(&other) here because it would perform 3 copies if
- // the two fields are on different arenas.
- if (other.GetArenaNoVirtual()) {
- CopyFrom(other);
- } else {
- InternalSwap(&other);
- }
-}
-
-template <typename Element>
-inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=(
- RepeatedPtrField&& other) noexcept {
- // We don't just call Swap(&other) here because it would perform 3 copies if
- // the two fields are on different arenas.
- if (this != &other) {
- if (this->GetArenaNoVirtual() != other.GetArenaNoVirtual()) {
- CopyFrom(other);
- } else {
- InternalSwap(&other);
- }
- }
- return *this;
-}
-
-template <typename Element>
inline bool RepeatedPtrField<Element>::empty() const {
return RepeatedPtrFieldBase::empty();
}
@@ -1977,10 +1926,12 @@ inline Element* RepeatedPtrField<Element>::Add() {
return RepeatedPtrFieldBase::Add<TypeHandler>();
}
+#if LANG_CXX11
template <typename Element>
inline void RepeatedPtrField<Element>::Add(Element&& value) {
RepeatedPtrFieldBase::Add<TypeHandler>(std::move(value));
}
+#endif
template <typename Element>
inline void RepeatedPtrField<Element>::RemoveLast() {
@@ -2010,7 +1961,7 @@ inline void RepeatedPtrField<Element>::ExtractSubrange(
// behavior.
template <typename Element>
inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
- int start, int num, Element** elements, std::true_type) {
+ int start, int num, Element** elements, google::protobuf::internal::true_type) {
GOOGLE_DCHECK_GE(start, 0);
GOOGLE_DCHECK_GE(num, 0);
GOOGLE_DCHECK_LE(start + num, size());
@@ -2043,7 +1994,7 @@ inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
// behavior.
template<typename Element>
inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
- int start, int num, Element** elements, std::false_type) {
+ int start, int num, Element** elements, google::protobuf::internal::false_type) {
// This case is identical to UnsafeArenaExtractSubrange(). However, since
// ExtractSubrange() must return heap-allocated objects by contract, and we
// cannot fulfill this contract if we are an on arena, we must GOOGLE_DCHECK() that
@@ -2215,7 +2166,7 @@ class RepeatedPtrIterator
// Shadow the value_type in std::iterator<> because const_iterator::value_type
// needs to be T, not const T.
- typedef typename std::remove_const<Element>::type value_type;
+ typedef typename remove_const<Element>::type value_type;
// Let the compiler know that these are type names, so we don't have to
// write "typename" in front of them everywhere.
@@ -2233,7 +2184,7 @@ class RepeatedPtrIterator
: it_(other.it_) {
// Force a compiler error if the other type is not convertible to ours.
if (false) {
- implicit_cast<Element*>(static_cast<OtherElement*>(nullptr));
+ implicit_cast<Element*, OtherElement*>(0);
}
}
@@ -2309,7 +2260,7 @@ class RepeatedPtrOverPtrsIterator
// Shadow the value_type in std::iterator<> because const_iterator::value_type
// needs to be T, not const T.
- typedef typename std::remove_const<Element>::type value_type;
+ typedef typename remove_const<Element>::type value_type;
// Let the compiler know that these are type names, so we don't have to
// write "typename" in front of them everywhere.
@@ -2494,10 +2445,12 @@ template<typename T> class RepeatedPtrFieldBackInsertIterator
*field_->Add() = *ptr_to_value;
return *this;
}
+#if LANG_CXX11
RepeatedPtrFieldBackInsertIterator<T>& operator=(T&& value) {
*field_->Add() = std::move(value);
return *this;
}
+#endif
RepeatedPtrFieldBackInsertIterator<T>& operator*() {
return *this;
}
@@ -2612,7 +2565,7 @@ AllocatedRepeatedPtrFieldBackInserter(
// RepeatedPtrField<T> temp_field;
// temp_field.AddAllocated(new T);
// ... // Do something with temp_field
-// temp_field.ExtractSubrange(0, temp_field.size(), nullptr);
+// temp_field.ExtractSubrange(0, temp_field.size(), NULL);
// If you put temp_field on the arena this fails, because the ownership
// transfers to the arena at the "AddAllocated" call and is not released anymore
// causing a double delete. Using UnsafeArenaAddAllocated prevents this.
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/repeated_field_reflection_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/repeated_field_reflection_unittest.cc
index 74ec83b050..fd46656540 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/repeated_field_reflection_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/repeated_field_reflection_unittest.cc
@@ -704,7 +704,7 @@ TEST(RepeatedFieldReflectionTest, RepeatedFieldRefDynamicMessage) {
desc->FindFieldByName("repeated_int32");
DynamicMessageFactory factory;
- std::unique_ptr<Message> dynamic_message(factory.GetPrototype(desc)->New());
+ google::protobuf::scoped_ptr<Message> dynamic_message(factory.GetPrototype(desc)->New());
const Reflection* refl = dynamic_message->GetReflection();
MutableRepeatedFieldRef<int32> rf_int32 =
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/repeated_field_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/repeated_field_unittest.cc
index 053a4d68f2..ae50146597 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/repeated_field_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/repeated_field_unittest.cc
@@ -45,19 +45,17 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/unittest.pb.h>
-#include <gmock/gmock.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/stl_util.h>
namespace google {
+using protobuf_unittest::TestAllTypes;
+
namespace protobuf {
namespace {
-using ::protobuf_unittest::TestAllTypes;
-using ::testing::ElementsAre;
-
// Test operations on a small RepeatedField.
TEST(RepeatedField, Small) {
RepeatedField<int> field;
@@ -269,6 +267,15 @@ TEST(RepeatedField, MergeFrom) {
EXPECT_EQ(5, destination.Get(4));
}
+#ifdef PROTOBUF_HAS_DEATH_TEST
+#ifndef NDEBUG
+TEST(RepeatedField, MergeFromSelf) {
+ RepeatedField<int> me;
+ me.Add(3);
+ EXPECT_DEATH(me.MergeFrom(me), "");
+}
+#endif // NDEBUG
+#endif // PROTOBUF_HAS_DEATH_TEST
TEST(RepeatedField, CopyFrom) {
RepeatedField<int> source, destination;
@@ -383,138 +390,6 @@ TEST(RepeatedField, SelfAssign) {
EXPECT_EQ(8, source.Get(1));
}
-TEST(RepeatedField, MoveConstruct) {
- {
- RepeatedField<int> source;
- source.Add(1);
- source.Add(2);
- const int* data = source.data();
- RepeatedField<int> destination = std::move(source);
- EXPECT_EQ(data, destination.data());
- EXPECT_THAT(destination, ElementsAre(1, 2));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_TRUE(source.empty());
- }
- {
- Arena arena;
- RepeatedField<int>* source =
- Arena::CreateMessage<RepeatedField<int>>(&arena);
- source->Add(1);
- source->Add(2);
- RepeatedField<int> destination = std::move(*source);
- EXPECT_EQ(nullptr, destination.GetArena());
- EXPECT_THAT(destination, ElementsAre(1, 2));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_THAT(*source, ElementsAre(1, 2));
- }
-}
-
-TEST(RepeatedField, MoveAssign) {
- {
- RepeatedField<int> source;
- source.Add(1);
- source.Add(2);
- RepeatedField<int> destination;
- destination.Add(3);
- const int* source_data = source.data();
- const int* destination_data = destination.data();
- destination = std::move(source);
- EXPECT_EQ(source_data, destination.data());
- EXPECT_THAT(destination, ElementsAre(1, 2));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_EQ(destination_data, source.data());
- EXPECT_THAT(source, ElementsAre(3));
- }
- {
- Arena arena;
- RepeatedField<int>* source =
- Arena::CreateMessage<RepeatedField<int>>(&arena);
- source->Add(1);
- source->Add(2);
- RepeatedField<int>* destination =
- Arena::CreateMessage<RepeatedField<int>>(&arena);
- destination->Add(3);
- const int* source_data = source->data();
- const int* destination_data = destination->data();
- *destination = std::move(*source);
- EXPECT_EQ(source_data, destination->data());
- EXPECT_THAT(*destination, ElementsAre(1, 2));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_EQ(destination_data, source->data());
- EXPECT_THAT(*source, ElementsAre(3));
- }
- {
- Arena source_arena;
- RepeatedField<int>* source =
- Arena::CreateMessage<RepeatedField<int>>(&source_arena);
- source->Add(1);
- source->Add(2);
- Arena destination_arena;
- RepeatedField<int>* destination =
- Arena::CreateMessage<RepeatedField<int>>(&destination_arena);
- destination->Add(3);
- *destination = std::move(*source);
- EXPECT_THAT(*destination, ElementsAre(1, 2));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_THAT(*source, ElementsAre(1, 2));
- }
- {
- Arena arena;
- RepeatedField<int>* source =
- Arena::CreateMessage<RepeatedField<int>>(&arena);
- source->Add(1);
- source->Add(2);
- RepeatedField<int> destination;
- destination.Add(3);
- destination = std::move(*source);
- EXPECT_THAT(destination, ElementsAre(1, 2));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_THAT(*source, ElementsAre(1, 2));
- }
- {
- RepeatedField<int> source;
- source.Add(1);
- source.Add(2);
- Arena arena;
- RepeatedField<int>* destination =
- Arena::CreateMessage<RepeatedField<int>>(&arena);
- destination->Add(3);
- *destination = std::move(source);
- EXPECT_THAT(*destination, ElementsAre(1, 2));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_THAT(source, ElementsAre(1, 2));
- }
- {
- RepeatedField<int> field;
- // An alias to defeat -Wself-move.
- RepeatedField<int>& alias = field;
- field.Add(1);
- field.Add(2);
- const int* data = field.data();
- field = std::move(alias);
- EXPECT_EQ(data, field.data());
- EXPECT_THAT(field, ElementsAre(1, 2));
- }
- {
- Arena arena;
- RepeatedField<int>* field =
- Arena::CreateMessage<RepeatedField<int>>(&arena);
- field->Add(1);
- field->Add(2);
- const int* data = field->data();
- *field = std::move(*field);
- EXPECT_EQ(data, field->data());
- EXPECT_THAT(*field, ElementsAre(1, 2));
- }
-}
-
TEST(RepeatedField, MutableDataIsMutable) {
RepeatedField<int> field;
field.Add(1);
@@ -908,6 +783,13 @@ TEST(RepeatedPtrField, MergeFrom) {
EXPECT_EQ("5", destination.Get(4));
}
+#ifdef PROTOBUF_HAS_DEATH_TEST
+TEST(RepeatedPtrField, MergeFromSelf) {
+ RepeatedPtrField<string> me;
+ me.Add()->assign("1");
+ EXPECT_DEATH(me.MergeFrom(me), "");
+}
+#endif // PROTOBUF_HAS_DEATH_TEST
TEST(RepeatedPtrField, CopyFrom) {
RepeatedPtrField<string> source, destination;
@@ -1041,138 +923,6 @@ TEST(RepeatedPtrField, SelfAssign) {
EXPECT_EQ("8", source.Get(1));
}
-TEST(RepeatedPtrField, MoveConstruct) {
- {
- RepeatedPtrField<string> source;
- *source.Add() = "1";
- *source.Add() = "2";
- const string* const* data = source.data();
- RepeatedPtrField<string> destination = std::move(source);
- EXPECT_EQ(data, destination.data());
- EXPECT_THAT(destination, ElementsAre("1", "2"));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_TRUE(source.empty());
- }
- {
- Arena arena;
- RepeatedPtrField<string>* source =
- Arena::CreateMessage<RepeatedPtrField<string>>(&arena);
- *source->Add() = "1";
- *source->Add() = "2";
- RepeatedPtrField<string> destination = std::move(*source);
- EXPECT_EQ(nullptr, destination.GetArena());
- EXPECT_THAT(destination, ElementsAre("1", "2"));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_THAT(*source, ElementsAre("1", "2"));
- }
-}
-
-TEST(RepeatedPtrField, MoveAssign) {
- {
- RepeatedPtrField<string> source;
- *source.Add() = "1";
- *source.Add() = "2";
- RepeatedPtrField<string> destination;
- *destination.Add() = "3";
- const string* const* source_data = source.data();
- const string* const* destination_data = destination.data();
- destination = std::move(source);
- EXPECT_EQ(source_data, destination.data());
- EXPECT_THAT(destination, ElementsAre("1", "2"));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_EQ(destination_data, source.data());
- EXPECT_THAT(source, ElementsAre("3"));
- }
- {
- Arena arena;
- RepeatedPtrField<string>* source =
- Arena::CreateMessage<RepeatedPtrField<string>>(&arena);
- *source->Add() = "1";
- *source->Add() = "2";
- RepeatedPtrField<string>* destination =
- Arena::CreateMessage<RepeatedPtrField<string>>(&arena);
- *destination->Add() = "3";
- const string* const* source_data = source->data();
- const string* const* destination_data = destination->data();
- *destination = std::move(*source);
- EXPECT_EQ(source_data, destination->data());
- EXPECT_THAT(*destination, ElementsAre("1", "2"));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_EQ(destination_data, source->data());
- EXPECT_THAT(*source, ElementsAre("3"));
- }
- {
- Arena source_arena;
- RepeatedPtrField<string>* source =
- Arena::CreateMessage<RepeatedPtrField<string>>(&source_arena);
- *source->Add() = "1";
- *source->Add() = "2";
- Arena destination_arena;
- RepeatedPtrField<string>* destination =
- Arena::CreateMessage<RepeatedPtrField<string>>(&destination_arena);
- *destination->Add() = "3";
- *destination = std::move(*source);
- EXPECT_THAT(*destination, ElementsAre("1", "2"));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_THAT(*source, ElementsAre("1", "2"));
- }
- {
- Arena arena;
- RepeatedPtrField<string>* source =
- Arena::CreateMessage<RepeatedPtrField<string>>(&arena);
- *source->Add() = "1";
- *source->Add() = "2";
- RepeatedPtrField<string> destination;
- *destination.Add() = "3";
- destination = std::move(*source);
- EXPECT_THAT(destination, ElementsAre("1", "2"));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_THAT(*source, ElementsAre("1", "2"));
- }
- {
- RepeatedPtrField<string> source;
- *source.Add() = "1";
- *source.Add() = "2";
- Arena arena;
- RepeatedPtrField<string>* destination =
- Arena::CreateMessage<RepeatedPtrField<string>>(&arena);
- *destination->Add() = "3";
- *destination = std::move(source);
- EXPECT_THAT(*destination, ElementsAre("1", "2"));
- // This property isn't guaranteed but it's useful to have a test that would
- // catch changes in this area.
- EXPECT_THAT(source, ElementsAre("1", "2"));
- }
- {
- RepeatedPtrField<string> field;
- // An alias to defeat -Wself-move.
- RepeatedPtrField<string>& alias = field;
- *field.Add() = "1";
- *field.Add() = "2";
- const string* const* data = field.data();
- field = std::move(alias);
- EXPECT_EQ(data, field.data());
- EXPECT_THAT(field, ElementsAre("1", "2"));
- }
- {
- Arena arena;
- RepeatedPtrField<string>* field =
- Arena::CreateMessage<RepeatedPtrField<string>>(&arena);
- *field->Add() = "1";
- *field->Add() = "2";
- const string* const* data = field->data();
- *field = std::move(*field);
- EXPECT_EQ(data, field->data());
- EXPECT_THAT(*field, ElementsAre("1", "2"));
- }
-}
-
TEST(RepeatedPtrField, MutableDataIsMutable) {
RepeatedPtrField<string> field;
*field.Add() = "1";
@@ -1836,6 +1586,7 @@ TEST_F(RepeatedFieldInsertionIteratorsTest,
EXPECT_EQ(testproto.DebugString(), goldenproto.DebugString());
}
+#if LANG_CXX11
TEST_F(RepeatedFieldInsertionIteratorsTest, MoveStrings) {
std::vector<string> src = {"a", "b", "c", "d"};
std::vector<string> copy = src; // copy since move leaves in undefined state
@@ -1865,6 +1616,7 @@ TEST_F(RepeatedFieldInsertionIteratorsTest, MoveProtos) {
testproto.repeated_nested_message(i).DebugString());
}
}
+#endif
} // namespace
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/service.cc b/third_party/protobuf/3.4.0/src/google/protobuf/service.cc
index ffa919daa7..ffa919daa7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/service.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/service.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/service.h b/third_party/protobuf/3.4.0/src/google/protobuf/service.h
index ad6f968548..ad6f968548 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/service.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/service.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/source_context.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/source_context.pb.cc
index 739172f844..a69739c493 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/source_context.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/source_context.pb.cc
@@ -1,91 +1,107 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/source_context.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/source_context.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
class SourceContextDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<SourceContext>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<SourceContext>
+ _instance;
} _SourceContext_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto {
-static void InitDefaultsSourceContext() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::_SourceContext_default_instance_;
- new (ptr) ::google::protobuf::SourceContext();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::SourceContext::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_SourceContext =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsSourceContext}, {}};
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_SourceContext.base);
-}
+namespace {
::google::protobuf::Metadata file_level_metadata[1];
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+} // namespace
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceContext, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceContext, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceContext, file_name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceContext, file_name_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::SourceContext)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(SourceContext)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_SourceContext_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_SourceContext_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/source_context.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/source_context.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _SourceContext_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_SourceContext_default_instance_);}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n$google/protobuf/source_context.proto\022\017"
"google.protobuf\"\"\n\rSourceContext\022\021\n\tfile"
"_name\030\001 \001(\tB\225\001\n\023com.google.protobufB\022Sou"
@@ -99,10 +115,11 @@ void AddDescriptorsImpl() {
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/source_context.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -110,28 +127,28 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto
-namespace google {
-namespace protobuf {
+
// ===================================================================
-void SourceContext::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SourceContext::kFileNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SourceContext::SourceContext()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::scc_info_SourceContext.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.SourceContext)
}
SourceContext::SourceContext(const SourceContext& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
file_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.file_name().size() > 0) {
@@ -142,6 +159,7 @@ SourceContext::SourceContext(const SourceContext& from)
void SourceContext::SharedCtor() {
file_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ _cached_size_ = 0;
}
SourceContext::~SourceContext() {
@@ -154,18 +172,27 @@ void SourceContext::SharedDtor() {
}
void SourceContext::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SourceContext::descriptor() {
- ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const SourceContext& SourceContext::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::scc_info_SourceContext.base);
+ protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults();
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)
@@ -183,7 +210,7 @@ bool SourceContext::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.SourceContext)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -289,7 +316,9 @@ size_t SourceContext::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -345,25 +374,76 @@ void SourceContext::Swap(SourceContext* other) {
}
void SourceContext::InternalSwap(SourceContext* other) {
using std::swap;
- file_name_.Swap(&other->file_name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ file_name_.Swap(&other->file_name_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SourceContext::GetMetadata() const {
protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// SourceContext
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::SourceContext* Arena::CreateMaybeMessage< ::google::protobuf::SourceContext >(Arena* arena) {
- return Arena::CreateInternal< ::google::protobuf::SourceContext >(arena);
+// string file_name = 1;
+void SourceContext::clear_file_name() {
+ file_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+const ::std::string& SourceContext::file_name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.SourceContext.file_name)
+ return file_name_.GetNoArena();
+}
+void SourceContext::set_file_name(const ::std::string& value) {
+
+ file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name)
}
+#if LANG_CXX11
+void SourceContext::set_file_name(::std::string&& value) {
+
+ file_name_.SetNoArena(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceContext.file_name)
+}
+#endif
+void SourceContext::set_file_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.SourceContext.file_name)
+}
+void SourceContext::set_file_name(const char* value, size_t size) {
+
+ file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceContext.file_name)
+}
+::std::string* SourceContext::mutable_file_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.SourceContext.file_name)
+ return file_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* SourceContext::release_file_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.SourceContext.file_name)
+
+ return file_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void SourceContext::set_allocated_file_name(::std::string* file_name) {
+ if (file_name != NULL) {
+
+ } else {
+
+ }
+ file_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), file_name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/source_context.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/source_context.pb.h
index eee1b73f44..b4617c5776 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/source_context.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/source_context.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/source_context.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fsource_5fcontext_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fsource_5fcontext_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,41 +24,37 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto LIBPROTOBUF_EXPORT
+namespace google {
+namespace protobuf {
+class SourceContext;
+class SourceContextDefaultTypeInternal;
+LIBPROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_;
+} // namespace protobuf
+} // namespace google
+
+namespace google {
+namespace protobuf {
namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto {
-// Internal implementation detail -- do not use these members.
+// Internal implementation detail -- do not call these.
struct LIBPROTOBUF_EXPORT TableStruct {
static const ::google::protobuf::internal::ParseTableField entries[];
static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[1];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
+ static void InitDefaultsImpl();
};
void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
} // namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto
-namespace google {
-namespace protobuf {
-class SourceContext;
-class SourceContextDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::SourceContext* Arena::CreateMaybeMessage<::google::protobuf::SourceContext>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
// ===================================================================
@@ -91,12 +87,11 @@ class LIBPROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message /* @
static const ::google::protobuf::Descriptor* descriptor();
static const SourceContext& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const SourceContext* internal_default_instance() {
return reinterpret_cast<const SourceContext*>(
&_SourceContext_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void Swap(SourceContext* other);
@@ -106,33 +101,28 @@ class LIBPROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message /* @
// implements Message ----------------------------------------------
- inline SourceContext* New() const final {
- return CreateMaybeMessage<SourceContext>(NULL);
- }
+ inline SourceContext* New() const PROTOBUF_FINAL { return New(NULL); }
- SourceContext* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<SourceContext>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ SourceContext* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const SourceContext& from);
void MergeFrom(const SourceContext& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(SourceContext* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
@@ -143,7 +133,7 @@ class LIBPROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message /* @
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -168,14 +158,15 @@ class LIBPROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message /* @
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::ArenaStringPtr file_name_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -238,12 +229,14 @@ inline void SourceContext::set_allocated_file_name(::std::string* file_name) {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fsource_5fcontext_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/source_context.proto b/third_party/protobuf/3.4.0/src/google/protobuf/source_context.proto
new file mode 100644
index 0000000000..f3b2c96681
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/source_context.proto
@@ -0,0 +1,48 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "SourceContextProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+option go_package = "google.golang.org/genproto/protobuf/source_context;source_context";
+
+// `SourceContext` represents information about the source of a
+// protobuf element, like the file in which it is defined.
+message SourceContext {
+ // The path-qualified name of the .proto file that contained the associated
+ // protobuf element. For example: `"google/protobuf/source_context.proto"`.
+ string file_name = 1;
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/struct.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/struct.pb.cc
index 8f2d484818..02d9306ed3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/struct.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/struct.pb.cc
@@ -1,43 +1,38 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/struct.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/struct.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
-namespace protobuf_google_2fprotobuf_2fstruct_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fstruct_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_ListValue;
-} // namespace protobuf_google_2fprotobuf_2fstruct_2eproto
namespace google {
namespace protobuf {
-class Struct_FieldsEntry_DoNotUseDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Struct_FieldsEntry_DoNotUse>
- _instance;
-} _Struct_FieldsEntry_DoNotUse_default_instance_;
+class Struct_FieldsEntryDefaultTypeInternal {
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Struct::Struct_FieldsEntry>
+ _instance;
+} _Struct_FieldsEntry_default_instance_;
class StructDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Struct>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Struct>
+ _instance;
} _Struct_default_instance_;
class ValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Value>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Value>
+ _instance;
int null_value_;
double number_value_;
::google::protobuf::internal::ArenaStringPtr string_value_;
@@ -46,121 +41,133 @@ class ValueDefaultTypeInternal {
const ::google::protobuf::ListValue* list_value_;
} _Value_default_instance_;
class ListValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<ListValue>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<ListValue>
+ _instance;
} _ListValue_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2fstruct_2eproto {
-static void InitDefaultsListValue() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::_Struct_FieldsEntry_DoNotUse_default_instance_;
- new (ptr) ::google::protobuf::Struct_FieldsEntry_DoNotUse();
- }
- {
- void* ptr = &::google::protobuf::_Struct_default_instance_;
- new (ptr) ::google::protobuf::Struct();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- {
- void* ptr = &::google::protobuf::_Value_default_instance_;
- new (ptr) ::google::protobuf::Value();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- {
- void* ptr = &::google::protobuf::_ListValue_default_instance_;
- new (ptr) ::google::protobuf::ListValue();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Struct_FieldsEntry_DoNotUse::InitAsDefaultInstance();
- ::google::protobuf::Struct::InitAsDefaultInstance();
- ::google::protobuf::Value::InitAsDefaultInstance();
- ::google::protobuf::ListValue::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2fstruct_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_ListValue =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsListValue}, {}};
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_ListValue.base);
-}
+namespace {
::google::protobuf::Metadata file_level_metadata[4];
const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _has_bits_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _internal_metadata_),
- ~0u, // no _extensions_
- ~0u, // no _oneof_case_
- ~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, key_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, value_),
- 0,
- 1,
+} // namespace
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct, fields_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, fields_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _internal_metadata_),
~0u, // no _extensions_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, _oneof_case_[0]),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _oneof_case_[0]),
~0u, // no _weak_field_map_
- offsetof(::google::protobuf::ValueDefaultTypeInternal, null_value_),
- offsetof(::google::protobuf::ValueDefaultTypeInternal, number_value_),
- offsetof(::google::protobuf::ValueDefaultTypeInternal, string_value_),
- offsetof(::google::protobuf::ValueDefaultTypeInternal, bool_value_),
- offsetof(::google::protobuf::ValueDefaultTypeInternal, struct_value_),
- offsetof(::google::protobuf::ValueDefaultTypeInternal, list_value_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, kind_),
+ offsetof(ValueDefaultTypeInternal, null_value_),
+ offsetof(ValueDefaultTypeInternal, number_value_),
+ offsetof(ValueDefaultTypeInternal, string_value_),
+ offsetof(ValueDefaultTypeInternal, bool_value_),
+ offsetof(ValueDefaultTypeInternal, struct_value_),
+ offsetof(ValueDefaultTypeInternal, list_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, kind_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ListValue, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ListValue, values_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, values_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, 7, sizeof(::google::protobuf::Struct_FieldsEntry_DoNotUse)},
- { 9, -1, sizeof(::google::protobuf::Struct)},
- { 15, -1, sizeof(::google::protobuf::Value)},
- { 27, -1, sizeof(::google::protobuf::ListValue)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(Struct)},
+ { 6, -1, sizeof(Value)},
+ { 18, -1, sizeof(ListValue)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Struct_FieldsEntry_DoNotUse_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Struct_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Value_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ListValue_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Struct_FieldsEntry_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Struct_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Value_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_ListValue_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/struct.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/struct.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, file_level_enum_descriptors, NULL);
+file_level_metadata[0].reflection = Struct::Struct_FieldsEntry::CreateReflection(file_level_metadata[0].descriptor, _Struct_FieldsEntry_default_instance_._instance.get_mutable());
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 4);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _Struct_FieldsEntry_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Struct_FieldsEntry_default_instance_);_Struct_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Struct_default_instance_);_Value_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Value_default_instance_);_ListValue_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_ListValue_default_instance_);_Struct_FieldsEntry_default_instance_._instance.get_mutable()->set_default_instance(_Struct_FieldsEntry_default_instance_._instance.get_mutable());
+ _Struct_FieldsEntry_default_instance_._instance.get_mutable()->InitAsDefaultInstance();
+ _Value_default_instance_.null_value_ = 0;
+ _Value_default_instance_.number_value_ = 0;
+ _Value_default_instance_.string_value_.UnsafeSetDefault(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ _Value_default_instance_.bool_value_ = false;
+ _Value_default_instance_.struct_value_ = const_cast< ::google::protobuf::Struct*>(
+ ::google::protobuf::Struct::internal_default_instance());
+ _Value_default_instance_.list_value_ = const_cast< ::google::protobuf::ListValue*>(
+ ::google::protobuf::ListValue::internal_default_instance());
+}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\034google/protobuf/struct.proto\022\017google.p"
"rotobuf\"\204\001\n\006Struct\0223\n\006fields\030\001 \003(\0132#.goo"
"gle.protobuf.Struct.FieldsEntry\032E\n\013Field"
@@ -184,10 +191,11 @@ void AddDescriptorsImpl() {
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/struct.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -195,9 +203,9 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fstruct_2eproto
-namespace google {
-namespace protobuf {
+
const ::google::protobuf::EnumDescriptor* NullValue_descriptor() {
protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_enum_descriptors[0];
@@ -214,33 +222,34 @@ bool NullValue_IsValid(int value) {
// ===================================================================
-Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse() {}
-Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* arena) : SuperType(arena) {}
-void Struct_FieldsEntry_DoNotUse::MergeFrom(const Struct_FieldsEntry_DoNotUse& other) {
- MergeFromInternal(other);
-}
-::google::protobuf::Metadata Struct_FieldsEntry_DoNotUse::GetMetadata() const {
- ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[0];
+Struct::Struct_FieldsEntry::Struct_FieldsEntry() {}
+Struct::Struct_FieldsEntry::Struct_FieldsEntry(::google::protobuf::Arena* arena) : SuperType(arena) {}
+::google::protobuf::Metadata Struct::Struct_FieldsEntry::GetMetadata() const {
+ protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[0];
}
-void Struct_FieldsEntry_DoNotUse::MergeFrom(
+void Struct::Struct_FieldsEntry::MergeFrom(
const ::google::protobuf::Message& other) {
::google::protobuf::Message::MergeFrom(other);
}
+void Struct::Struct_FieldsEntry::MergeFrom(const Struct_FieldsEntry& other) {
+ MergeFromInternal(other);
+}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void Struct::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Struct::kFieldsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
Struct::Struct()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Struct)
}
@@ -248,20 +257,22 @@ Struct::Struct(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
fields_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Struct)
}
Struct::Struct(const Struct& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
fields_.MergeFrom(from.fields_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.Struct)
}
void Struct::SharedCtor() {
+ _cached_size_ = 0;
}
Struct::~Struct() {
@@ -270,7 +281,12 @@ Struct::~Struct() {
}
void Struct::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void Struct::ArenaDtor(void* object) {
@@ -280,18 +296,23 @@ void Struct::ArenaDtor(void* object) {
void Struct::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Struct::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Struct::descriptor() {
- ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Struct& Struct::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
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)
@@ -309,7 +330,7 @@ bool Struct::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Struct)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -317,8 +338,8 @@ bool Struct::MergePartialFromCodedStream(
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
- Struct_FieldsEntry_DoNotUse::Parser< ::google::protobuf::internal::MapField<
- Struct_FieldsEntry_DoNotUse,
+ Struct_FieldsEntry::Parser< ::google::protobuf::internal::MapField<
+ Struct_FieldsEntry,
::std::string, ::google::protobuf::Value,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
@@ -379,7 +400,7 @@ void Struct::SerializeWithCachedSizes(
if (output->IsSerializationDeterministic() &&
this->fields().size() > 1) {
- ::std::unique_ptr<SortItem[]> items(
+ ::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->fields().size()]);
typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::size_type size_type;
size_type n = 0;
@@ -389,7 +410,7 @@ void Struct::SerializeWithCachedSizes(
items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
}
::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
- ::std::unique_ptr<Struct_FieldsEntry_DoNotUse> entry;
+ ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(fields_.NewEntryWrapper(
items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second));
@@ -401,7 +422,7 @@ void Struct::SerializeWithCachedSizes(
Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]);
}
} else {
- ::std::unique_ptr<Struct_FieldsEntry_DoNotUse> entry;
+ ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
it = this->fields().begin();
it != this->fields().end(); ++it) {
@@ -448,7 +469,7 @@ void Struct::SerializeWithCachedSizes(
if (deterministic &&
this->fields().size() > 1) {
- ::std::unique_ptr<SortItem[]> items(
+ ::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->fields().size()]);
typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::size_type size_type;
size_type n = 0;
@@ -458,7 +479,7 @@ void Struct::SerializeWithCachedSizes(
items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
}
::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
- ::std::unique_ptr<Struct_FieldsEntry_DoNotUse> entry;
+ ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(fields_.NewEntryWrapper(
items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second));
@@ -472,7 +493,7 @@ void Struct::SerializeWithCachedSizes(
Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]);
}
} else {
- ::std::unique_ptr<Struct_FieldsEntry_DoNotUse> entry;
+ ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
it = this->fields().begin();
it != this->fields().end(); ++it) {
@@ -511,7 +532,7 @@ size_t Struct::ByteSizeLong() const {
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->fields_size());
{
- ::std::unique_ptr<Struct_FieldsEntry_DoNotUse> entry;
+ ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
it = this->fields().begin();
it != this->fields().end(); ++it) {
@@ -528,7 +549,9 @@ size_t Struct::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -598,57 +621,39 @@ void Struct::InternalSwap(Struct* other) {
using std::swap;
fields_.Swap(&other->fields_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Struct::GetMetadata() const {
protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Struct
-// ===================================================================
-
-void Value::InitAsDefaultInstance() {
- ::google::protobuf::_Value_default_instance_.null_value_ = 0;
- ::google::protobuf::_Value_default_instance_.number_value_ = 0;
- ::google::protobuf::_Value_default_instance_.string_value_.UnsafeSetDefault(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited());
- ::google::protobuf::_Value_default_instance_.bool_value_ = false;
- ::google::protobuf::_Value_default_instance_.struct_value_ = const_cast< ::google::protobuf::Struct*>(
- ::google::protobuf::Struct::internal_default_instance());
- ::google::protobuf::_Value_default_instance_.list_value_ = const_cast< ::google::protobuf::ListValue*>(
- ::google::protobuf::ListValue::internal_default_instance());
+// map<string, .google.protobuf.Value> fields = 1;
+int Struct::fields_size() const {
+ return fields_.size();
}
-void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- clear_kind();
- if (struct_value) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(struct_value);
- if (message_arena != submessage_arena) {
- struct_value = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, struct_value, submessage_arena);
- }
- set_has_struct_value();
- kind_.struct_value_ = struct_value;
- }
- // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value)
+void Struct::clear_fields() {
+ fields_.Clear();
}
-void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- clear_kind();
- if (list_value) {
- ::google::protobuf::Arena* submessage_arena =
- ::google::protobuf::Arena::GetArena(list_value);
- if (message_arena != submessage_arena) {
- list_value = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, list_value, submessage_arena);
- }
- set_has_list_value();
- kind_.list_value_ = list_value;
- }
- // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value)
+ const ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >&
+Struct::fields() const {
+ // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields)
+ return fields_.GetMap();
+}
+ ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >*
+Struct::mutable_fields() {
+ // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields)
+ return fields_.MutableMap();
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Value::kNullValueFieldNumber;
const int Value::kNumberValueFieldNumber;
@@ -660,22 +665,24 @@ const int Value::kListValueFieldNumber;
Value::Value()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Value)
}
Value::Value(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Value)
}
Value::Value(const Value& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
clear_has_kind();
switch (from.kind_case()) {
@@ -712,6 +719,7 @@ Value::Value(const Value& from)
void Value::SharedCtor() {
clear_has_kind();
+ _cached_size_ = 0;
}
Value::~Value() {
@@ -720,7 +728,12 @@ Value::~Value() {
}
void Value::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
if (has_kind()) {
clear_kind();
}
@@ -733,18 +746,23 @@ void Value::ArenaDtor(void* object) {
void Value::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Value::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Value::descriptor() {
- ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Value& Value::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
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)
@@ -802,7 +820,7 @@ bool Value::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Value)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -871,7 +889,7 @@ bool Value::MergePartialFromCodedStream(
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_struct_value()));
} else {
goto handle_unusual;
@@ -883,7 +901,7 @@ bool Value::MergePartialFromCodedStream(
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_list_value()));
} else {
goto handle_unusual;
@@ -946,13 +964,13 @@ void Value::SerializeWithCachedSizes(
// .google.protobuf.Struct struct_value = 5;
if (has_struct_value()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 5, this->_internal_struct_value(), output);
+ 5, *kind_.struct_value_, output);
}
// .google.protobuf.ListValue list_value = 6;
if (has_list_value()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 6, this->_internal_list_value(), output);
+ 6, *kind_.list_value_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -999,15 +1017,15 @@ void Value::SerializeWithCachedSizes(
// .google.protobuf.Struct struct_value = 5;
if (has_struct_value()) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 5, this->_internal_struct_value(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 5, *kind_.struct_value_, deterministic, target);
}
// .google.protobuf.ListValue list_value = 6;
if (has_list_value()) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 6, this->_internal_list_value(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 6, *kind_.list_value_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -1054,14 +1072,14 @@ size_t Value::ByteSizeLong() const {
// .google.protobuf.Struct struct_value = 5;
case kStructValue: {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.struct_value_);
break;
}
// .google.protobuf.ListValue list_value = 6;
case kListValue: {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.list_value_);
break;
}
@@ -1070,7 +1088,9 @@ size_t Value::ByteSizeLong() const {
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1169,26 +1189,425 @@ void Value::InternalSwap(Value* other) {
swap(kind_, other->kind_);
swap(_oneof_case_[0], other->_oneof_case_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Value::GetMetadata() const {
protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Value
-// ===================================================================
+// .google.protobuf.NullValue null_value = 1;
+bool Value::has_null_value() const {
+ return kind_case() == kNullValue;
+}
+void Value::set_has_null_value() {
+ _oneof_case_[0] = kNullValue;
+}
+void Value::clear_null_value() {
+ if (has_null_value()) {
+ kind_.null_value_ = 0;
+ clear_has_kind();
+ }
+}
+::google::protobuf::NullValue Value::null_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value)
+ if (has_null_value()) {
+ return static_cast< ::google::protobuf::NullValue >(kind_.null_value_);
+ }
+ return static_cast< ::google::protobuf::NullValue >(0);
+}
+void Value::set_null_value(::google::protobuf::NullValue value) {
+ if (!has_null_value()) {
+ clear_kind();
+ set_has_null_value();
+ }
+ kind_.null_value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value)
+}
-void ListValue::InitAsDefaultInstance() {
+// double number_value = 2;
+bool Value::has_number_value() const {
+ return kind_case() == kNumberValue;
+}
+void Value::set_has_number_value() {
+ _oneof_case_[0] = kNumberValue;
+}
+void Value::clear_number_value() {
+ if (has_number_value()) {
+ kind_.number_value_ = 0;
+ clear_has_kind();
+ }
+}
+double Value::number_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Value.number_value)
+ if (has_number_value()) {
+ return kind_.number_value_;
+ }
+ return 0;
+}
+void Value::set_number_value(double value) {
+ if (!has_number_value()) {
+ clear_kind();
+ set_has_number_value();
+ }
+ kind_.number_value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Value.number_value)
+}
+
+// string string_value = 3;
+bool Value::has_string_value() const {
+ return kind_case() == kStringValue;
+}
+void Value::set_has_string_value() {
+ _oneof_case_[0] = kStringValue;
+}
+void Value::clear_string_value() {
+ if (has_string_value()) {
+ kind_.string_value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+ clear_has_kind();
+ }
+}
+const ::std::string& Value::string_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Value.string_value)
+ if (has_string_value()) {
+ return kind_.string_value_.Get();
+ }
+ return *&::google::protobuf::internal::GetEmptyStringAlreadyInited();
+}
+void Value::set_string_value(const ::std::string& value) {
+ if (!has_string_value()) {
+ clear_kind();
+ set_has_string_value();
+ kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ kind_.string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
+}
+#if LANG_CXX11
+void Value::set_string_value(::std::string&& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
+ if (!has_string_value()) {
+ clear_kind();
+ set_has_string_value();
+ kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ kind_.string_value_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Value.string_value)
+}
+#endif
+void Value::set_string_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ if (!has_string_value()) {
+ clear_kind();
+ set_has_string_value();
+ kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ kind_.string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Value.string_value)
+}
+void Value::set_string_value(const char* value,
+ size_t size) {
+ if (!has_string_value()) {
+ clear_kind();
+ set_has_string_value();
+ kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ kind_.string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value)
+}
+::std::string* Value::mutable_string_value() {
+ if (!has_string_value()) {
+ clear_kind();
+ set_has_string_value();
+ kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ return kind_.string_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value)
}
+::std::string* Value::release_string_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Value.string_value)
+ if (has_string_value()) {
+ clear_has_kind();
+ return kind_.string_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+ } else {
+ return NULL;
+ }
+}
+::std::string* Value::unsafe_arena_release_string_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.string_value)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (has_string_value()) {
+ clear_has_kind();
+ return kind_.string_value_.UnsafeArenaRelease(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ } else {
+ return NULL;
+ }
+}
+void Value::set_allocated_string_value(::std::string* string_value) {
+ if (!has_string_value()) {
+ kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ clear_kind();
+ if (string_value != NULL) {
+ set_has_string_value();
+ kind_.string_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value,
+ GetArenaNoVirtual());
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value)
+}
+void Value::unsafe_arena_set_allocated_string_value(::std::string* string_value) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (!has_string_value()) {
+ kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ clear_kind();
+ if (string_value) {
+ set_has_string_value();
+ kind_.string_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value, GetArenaNoVirtual());
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.string_value)
+}
+
+// bool bool_value = 4;
+bool Value::has_bool_value() const {
+ return kind_case() == kBoolValue;
+}
+void Value::set_has_bool_value() {
+ _oneof_case_[0] = kBoolValue;
+}
+void Value::clear_bool_value() {
+ if (has_bool_value()) {
+ kind_.bool_value_ = false;
+ clear_has_kind();
+ }
+}
+bool Value::bool_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Value.bool_value)
+ if (has_bool_value()) {
+ return kind_.bool_value_;
+ }
+ return false;
+}
+void Value::set_bool_value(bool value) {
+ if (!has_bool_value()) {
+ clear_kind();
+ set_has_bool_value();
+ }
+ kind_.bool_value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Value.bool_value)
+}
+
+// .google.protobuf.Struct struct_value = 5;
+bool Value::has_struct_value() const {
+ return kind_case() == kStructValue;
+}
+void Value::set_has_struct_value() {
+ _oneof_case_[0] = kStructValue;
+}
+void Value::clear_struct_value() {
+ if (has_struct_value()) {
+ if (GetArenaNoVirtual() == NULL) {
+ delete kind_.struct_value_;
+ }
+ clear_has_kind();
+ }
+}
+ const ::google::protobuf::Struct& Value::struct_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value)
+ return has_struct_value()
+ ? *kind_.struct_value_
+ : ::google::protobuf::Struct::default_instance();
+}
+::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());
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value)
+ return kind_.struct_value_;
+}
+::google::protobuf::Struct* Value::release_struct_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value)
+ if (has_struct_value()) {
+ clear_has_kind();
+ if (GetArenaNoVirtual() != NULL) {
+ ::google::protobuf::Struct* temp = new ::google::protobuf::Struct(*kind_.struct_value_);
+ kind_.struct_value_ = NULL;
+ return temp;
+ } else {
+ ::google::protobuf::Struct* temp = kind_.struct_value_;
+ kind_.struct_value_ = NULL;
+ return temp;
+ }
+ } else {
+ return NULL;
+ }
+}
+void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
+ clear_kind();
+ if (struct_value) {
+ if (GetArenaNoVirtual() != NULL &&
+ ::google::protobuf::Arena::GetArena(struct_value) == NULL) {
+ GetArenaNoVirtual()->Own(struct_value);
+ } else if (GetArenaNoVirtual() !=
+ ::google::protobuf::Arena::GetArena(struct_value)) {
+ ::google::protobuf::Struct* new_struct_value =
+ ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >(
+ GetArenaNoVirtual());
+ new_struct_value->CopyFrom(*struct_value);
+ struct_value = new_struct_value;
+ }
+ set_has_struct_value();
+ kind_.struct_value_ = struct_value;
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value)
+}
+ ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value)
+ if (has_struct_value()) {
+ clear_has_kind();
+ ::google::protobuf::Struct* temp = kind_.struct_value_;
+ kind_.struct_value_ = NULL;
+ return temp;
+ } else {
+ return NULL;
+ }
+}
+ void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
+ clear_kind();
+ if (struct_value) {
+ set_has_struct_value();
+ kind_.struct_value_ = struct_value;
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value)
+}
+
+// .google.protobuf.ListValue list_value = 6;
+bool Value::has_list_value() const {
+ return kind_case() == kListValue;
+}
+void Value::set_has_list_value() {
+ _oneof_case_[0] = kListValue;
+}
+void Value::clear_list_value() {
+ if (has_list_value()) {
+ if (GetArenaNoVirtual() == NULL) {
+ delete kind_.list_value_;
+ }
+ clear_has_kind();
+ }
+}
+ const ::google::protobuf::ListValue& Value::list_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value)
+ return has_list_value()
+ ? *kind_.list_value_
+ : ::google::protobuf::ListValue::default_instance();
+}
+::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());
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value)
+ return kind_.list_value_;
+}
+::google::protobuf::ListValue* Value::release_list_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Value.list_value)
+ if (has_list_value()) {
+ clear_has_kind();
+ if (GetArenaNoVirtual() != NULL) {
+ ::google::protobuf::ListValue* temp = new ::google::protobuf::ListValue(*kind_.list_value_);
+ kind_.list_value_ = NULL;
+ return temp;
+ } else {
+ ::google::protobuf::ListValue* temp = kind_.list_value_;
+ kind_.list_value_ = NULL;
+ return temp;
+ }
+ } else {
+ return NULL;
+ }
+}
+void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) {
+ clear_kind();
+ if (list_value) {
+ if (GetArenaNoVirtual() != NULL &&
+ ::google::protobuf::Arena::GetArena(list_value) == NULL) {
+ GetArenaNoVirtual()->Own(list_value);
+ } else if (GetArenaNoVirtual() !=
+ ::google::protobuf::Arena::GetArena(list_value)) {
+ ::google::protobuf::ListValue* new_list_value =
+ ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >(
+ GetArenaNoVirtual());
+ new_list_value->CopyFrom(*list_value);
+ list_value = new_list_value;
+ }
+ set_has_list_value();
+ kind_.list_value_ = list_value;
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value)
+}
+ ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value)
+ if (has_list_value()) {
+ clear_has_kind();
+ ::google::protobuf::ListValue* temp = kind_.list_value_;
+ kind_.list_value_ = NULL;
+ return temp;
+ } else {
+ return NULL;
+ }
+}
+ void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* list_value) {
+ clear_kind();
+ if (list_value) {
+ set_has_list_value();
+ kind_.list_value_ = list_value;
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value)
+}
+
+bool Value::has_kind() const {
+ return kind_case() != KIND_NOT_SET;
+}
+void Value::clear_has_kind() {
+ _oneof_case_[0] = KIND_NOT_SET;
+}
+Value::KindCase Value::kind_case() const {
+ return Value::KindCase(_oneof_case_[0]);
+}
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ListValue::kValuesFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ListValue::ListValue()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.ListValue)
}
@@ -1196,7 +1615,7 @@ ListValue::ListValue(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
values_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.ListValue)
@@ -1204,12 +1623,14 @@ ListValue::ListValue(::google::protobuf::Arena* arena)
ListValue::ListValue(const ListValue& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- values_(from.values_) {
+ values_(from.values_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue)
}
void ListValue::SharedCtor() {
+ _cached_size_ = 0;
}
ListValue::~ListValue() {
@@ -1218,7 +1639,12 @@ ListValue::~ListValue() {
}
void ListValue::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void ListValue::ArenaDtor(void* object) {
@@ -1228,18 +1654,23 @@ void ListValue::ArenaDtor(void* object) {
void ListValue::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void ListValue::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ListValue::descriptor() {
- ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const ListValue& ListValue::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fstruct_2eproto::scc_info_ListValue.base);
+ protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults();
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)
@@ -1257,7 +1688,7 @@ bool ListValue::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.ListValue)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1265,7 +1696,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_values()));
} else {
goto handle_unusual;
@@ -1303,9 +1734,7 @@ 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())) {
@@ -1326,7 +1755,7 @@ void ListValue::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->values_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
1, this->values(static_cast<int>(i)), deterministic, target);
}
@@ -1353,13 +1782,15 @@ size_t ListValue::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->values(static_cast<int>(i)));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1427,33 +1858,53 @@ void ListValue::UnsafeArenaSwap(ListValue* other) {
}
void ListValue::InternalSwap(ListValue* other) {
using std::swap;
- CastToBase(&values_)->InternalSwap(CastToBase(&other->values_));
+ values_.InternalSwap(&other->values_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ListValue::GetMetadata() const {
protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// ListValue
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(arena);
+// repeated .google.protobuf.Value values = 1;
+int ListValue::values_size() const {
+ return values_.size();
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Struct* Arena::CreateMaybeMessage< ::google::protobuf::Struct >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Struct >(arena);
+void ListValue::clear_values() {
+ values_.Clear();
+}
+const ::google::protobuf::Value& ListValue::values(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values)
+ return values_.Get(index);
+}
+::google::protobuf::Value* ListValue::mutable_values(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values)
+ return values_.Mutable(index);
+}
+::google::protobuf::Value* ListValue::add_values() {
+ // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values)
+ return values_.Add();
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Value* Arena::CreateMaybeMessage< ::google::protobuf::Value >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Value >(arena);
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >*
+ListValue::mutable_values() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values)
+ return &values_;
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ListValue* Arena::CreateMaybeMessage< ::google::protobuf::ListValue >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::ListValue >(arena);
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >&
+ListValue::values() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.ListValue.values)
+ return values_;
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/struct.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/struct.pb.h
index b2263435ae..57ae7d90e4 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/struct.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/struct.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/struct.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fstruct_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fstruct_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,7 +24,6 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
@@ -35,20 +34,6 @@
#include <google/protobuf/generated_enum_reflection.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fstruct_2eproto LIBPROTOBUF_EXPORT
-
-namespace protobuf_google_2fprotobuf_2fstruct_2eproto {
-// Internal implementation detail -- do not use these members.
-struct LIBPROTOBUF_EXPORT TableStruct {
- static const ::google::protobuf::internal::ParseTableField entries[];
- static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[4];
- static const ::google::protobuf::internal::FieldMetadata field_metadata[];
- static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
-};
-void LIBPROTOBUF_EXPORT AddDescriptors();
-} // namespace protobuf_google_2fprotobuf_2fstruct_2eproto
namespace google {
namespace protobuf {
class ListValue;
@@ -57,25 +42,33 @@ LIBPROTOBUF_EXPORT extern ListValueDefaultTypeInternal _ListValue_default_instan
class Struct;
class StructDefaultTypeInternal;
LIBPROTOBUF_EXPORT extern StructDefaultTypeInternal _Struct_default_instance_;
-class Struct_FieldsEntry_DoNotUse;
-class Struct_FieldsEntry_DoNotUseDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern Struct_FieldsEntry_DoNotUseDefaultTypeInternal _Struct_FieldsEntry_DoNotUse_default_instance_;
+class Struct_FieldsEntry;
+class Struct_FieldsEntryDefaultTypeInternal;
+LIBPROTOBUF_EXPORT extern Struct_FieldsEntryDefaultTypeInternal _Struct_FieldsEntry_default_instance_;
class Value;
class ValueDefaultTypeInternal;
LIBPROTOBUF_EXPORT extern ValueDefaultTypeInternal _Value_default_instance_;
} // namespace protobuf
} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::ListValue* Arena::CreateMaybeMessage<::google::protobuf::ListValue>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Struct* Arena::CreateMaybeMessage<::google::protobuf::Struct>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage<::google::protobuf::Struct_FieldsEntry_DoNotUse>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Value* Arena::CreateMaybeMessage<::google::protobuf::Value>(Arena*);
-} // namespace protobuf
-} // namespace google
+
namespace google {
namespace protobuf {
+namespace protobuf_google_2fprotobuf_2fstruct_2eproto {
+// Internal implementation detail -- do not call these.
+struct LIBPROTOBUF_EXPORT TableStruct {
+ static const ::google::protobuf::internal::ParseTableField entries[];
+ static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
+ static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+ static const ::google::protobuf::internal::SerializationTable serialization_table[];
+ static void InitDefaultsImpl();
+};
+void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
+} // namespace protobuf_google_2fprotobuf_2fstruct_2eproto
+
enum NullValue {
NULL_VALUE = 0,
NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min,
@@ -98,24 +91,6 @@ inline bool NullValue_Parse(
}
// ===================================================================
-class Struct_FieldsEntry_DoNotUse : public ::google::protobuf::internal::MapEntry<Struct_FieldsEntry_DoNotUse,
- ::std::string, ::google::protobuf::Value,
- ::google::protobuf::internal::WireFormatLite::TYPE_STRING,
- ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
- 0 > {
-public:
- typedef ::google::protobuf::internal::MapEntry<Struct_FieldsEntry_DoNotUse,
- ::std::string, ::google::protobuf::Value,
- ::google::protobuf::internal::WireFormatLite::TYPE_STRING,
- ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
- 0 > SuperType;
- Struct_FieldsEntry_DoNotUse();
- Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* arena);
- void MergeFrom(const Struct_FieldsEntry_DoNotUse& other);
- static const Struct_FieldsEntry_DoNotUse* internal_default_instance() { return reinterpret_cast<const Struct_FieldsEntry_DoNotUse*>(&_Struct_FieldsEntry_DoNotUse_default_instance_); }
- void MergeFrom(const ::google::protobuf::Message& other) final;
- ::google::protobuf::Metadata GetMetadata() const;
-};
// -------------------------------------------------------------------
@@ -145,21 +120,20 @@ class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Struct& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Struct* internal_default_instance() {
return reinterpret_cast<const Struct*>(
&_Struct_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
1;
void UnsafeArenaSwap(Struct* other);
@@ -170,33 +144,28 @@ class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc
// implements Message ----------------------------------------------
- inline Struct* New() const final {
- return CreateMaybeMessage<Struct>(NULL);
- }
+ inline Struct* New() const PROTOBUF_FINAL { return New(NULL); }
- Struct* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Struct>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Struct* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Struct& from);
void MergeFrom(const Struct& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Struct* other);
protected:
explicit Struct(::google::protobuf::Arena* arena);
@@ -212,7 +181,7 @@ class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -235,14 +204,35 @@ class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc
template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
+ public:
+ class Struct_FieldsEntry : public ::google::protobuf::internal::MapEntry<Struct_FieldsEntry,
+ ::std::string, ::google::protobuf::Value,
+ ::google::protobuf::internal::WireFormatLite::TYPE_STRING,
+ ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
+ 0 > {
+ public:
+ typedef ::google::protobuf::internal::MapEntry<Struct_FieldsEntry,
+ ::std::string, ::google::protobuf::Value,
+ ::google::protobuf::internal::WireFormatLite::TYPE_STRING,
+ ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
+ 0 > SuperType;
+ Struct_FieldsEntry();
+ Struct_FieldsEntry(::google::protobuf::Arena* arena);
+ void MergeFrom(const ::google::protobuf::Message& other) PROTOBUF_FINAL;
+ void MergeFrom(const Struct_FieldsEntry& other);
+ static const Message* internal_default_instance() { return reinterpret_cast<const Message*>(&_Struct_FieldsEntry_default_instance_); }
+ ::google::protobuf::Metadata GetMetadata() const;
+ };
+ private:
::google::protobuf::internal::MapField<
- Struct_FieldsEntry_DoNotUse,
+ Struct_FieldsEntry,
::std::string, ::google::protobuf::Value,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 > fields_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct;
+ private:
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -272,10 +262,10 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
@@ -291,12 +281,11 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
KIND_NOT_SET = 0,
};
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Value* internal_default_instance() {
return reinterpret_cast<const Value*>(
&_Value_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
2;
void UnsafeArenaSwap(Value* other);
@@ -307,33 +296,28 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Value* New() const final {
- return CreateMaybeMessage<Value>(NULL);
- }
+ inline Value* New() const PROTOBUF_FINAL { return New(NULL); }
- Value* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Value>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Value& from);
void MergeFrom(const Value& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Value* other);
protected:
explicit Value(::google::protobuf::Arena* arena);
@@ -349,7 +333,7 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -389,13 +373,7 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
::std::string* mutable_string_value();
::std::string* release_string_value();
void set_allocated_string_value(::std::string* string_value);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_string_value();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_string_value(
::std::string* string_value);
@@ -413,32 +391,37 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
void clear_struct_value();
static const int kStructValueFieldNumber = 5;
private:
- const ::google::protobuf::Struct& _internal_struct_value() const;
+ void _slow_mutable_struct_value();
+ void _slow_set_allocated_struct_value(
+ ::google::protobuf::Arena* message_arena, ::google::protobuf::Struct** struct_value);
+ ::google::protobuf::Struct* _slow_release_struct_value();
public:
const ::google::protobuf::Struct& struct_value() const;
- ::google::protobuf::Struct* release_struct_value();
::google::protobuf::Struct* mutable_struct_value();
+ ::google::protobuf::Struct* release_struct_value();
void set_allocated_struct_value(::google::protobuf::Struct* struct_value);
+ ::google::protobuf::Struct* unsafe_arena_release_struct_value();
void unsafe_arena_set_allocated_struct_value(
::google::protobuf::Struct* struct_value);
- ::google::protobuf::Struct* unsafe_arena_release_struct_value();
// .google.protobuf.ListValue list_value = 6;
bool has_list_value() const;
void clear_list_value();
static const int kListValueFieldNumber = 6;
private:
- const ::google::protobuf::ListValue& _internal_list_value() const;
+ void _slow_mutable_list_value();
+ void _slow_set_allocated_list_value(
+ ::google::protobuf::Arena* message_arena, ::google::protobuf::ListValue** list_value);
+ ::google::protobuf::ListValue* _slow_release_list_value();
public:
const ::google::protobuf::ListValue& list_value() const;
- ::google::protobuf::ListValue* release_list_value();
::google::protobuf::ListValue* mutable_list_value();
+ ::google::protobuf::ListValue* release_list_value();
void set_allocated_list_value(::google::protobuf::ListValue* list_value);
+ ::google::protobuf::ListValue* unsafe_arena_release_list_value();
void unsafe_arena_set_allocated_list_value(
::google::protobuf::ListValue* list_value);
- ::google::protobuf::ListValue* unsafe_arena_release_list_value();
- void clear_kind();
KindCase kind_case() const;
// @@protoc_insertion_point(class_scope:google.protobuf.Value)
private:
@@ -450,6 +433,7 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
void set_has_list_value();
inline bool has_kind() const;
+ void clear_kind();
inline void clear_has_kind();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
@@ -465,10 +449,10 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
::google::protobuf::Struct* struct_value_;
::google::protobuf::ListValue* list_value_;
} kind_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
+ mutable int _cached_size_;
::google::protobuf::uint32 _oneof_case_[1];
- friend struct ::protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct;
+ friend struct protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -498,21 +482,20 @@ class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@pro
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const ListValue& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const ListValue* internal_default_instance() {
return reinterpret_cast<const ListValue*>(
&_ListValue_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
3;
void UnsafeArenaSwap(ListValue* other);
@@ -523,33 +506,28 @@ class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline ListValue* New() const final {
- return CreateMaybeMessage<ListValue>(NULL);
- }
+ inline ListValue* New() const PROTOBUF_FINAL { return New(NULL); }
- ListValue* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<ListValue>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ ListValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const ListValue& from);
void MergeFrom(const ListValue& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(ListValue* other);
protected:
explicit ListValue(::google::protobuf::Arena* arena);
@@ -565,7 +543,7 @@ class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@pro
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -575,11 +553,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;
@@ -591,14 +569,15 @@ class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@pro
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::Value > values_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -749,8 +728,7 @@ inline void Value::set_string_value(const char* value,
set_has_string_value();
kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
- kind_.string_value_.Set(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ kind_.string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value)
@@ -775,6 +753,17 @@ inline ::std::string* Value::release_string_value() {
return NULL;
}
}
+inline ::std::string* Value::unsafe_arena_release_string_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.string_value)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (has_string_value()) {
+ clear_has_kind();
+ return kind_.string_value_.UnsafeArenaRelease(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+ } else {
+ return NULL;
+ }
+}
inline void Value::set_allocated_string_value(::std::string* string_value) {
if (!has_string_value()) {
kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
@@ -787,17 +776,6 @@ inline void Value::set_allocated_string_value(::std::string* string_value) {
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value)
}
-inline ::std::string* Value::unsafe_arena_release_string_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.string_value)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
- if (has_string_value()) {
- clear_has_kind();
- return kind_.string_value_.UnsafeArenaRelease(
- &::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
- } else {
- return NULL;
- }
-}
inline void Value::unsafe_arena_set_allocated_string_value(::std::string* string_value) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (!has_string_value()) {
@@ -855,30 +833,60 @@ inline void Value::clear_struct_value() {
clear_has_kind();
}
}
-inline const ::google::protobuf::Struct& Value::_internal_struct_value() const {
- return *kind_.struct_value_;
+inline const ::google::protobuf::Struct& Value::struct_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value)
+ return has_struct_value()
+ ? *kind_.struct_value_
+ : ::google::protobuf::Struct::default_instance();
+}
+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());
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value)
+ return kind_.struct_value_;
}
inline ::google::protobuf::Struct* Value::release_struct_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value)
if (has_struct_value()) {
clear_has_kind();
- ::google::protobuf::Struct* temp = kind_.struct_value_;
if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
+ ::google::protobuf::Struct* temp = new ::google::protobuf::Struct(*kind_.struct_value_);
+ kind_.struct_value_ = NULL;
+ return temp;
+ } else {
+ ::google::protobuf::Struct* temp = kind_.struct_value_;
+ kind_.struct_value_ = NULL;
+ return temp;
}
- kind_.struct_value_ = NULL;
- return temp;
} else {
return NULL;
}
}
-inline const ::google::protobuf::Struct& Value::struct_value() const {
- // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value)
- return has_struct_value()
- ? *kind_.struct_value_
- : *reinterpret_cast< ::google::protobuf::Struct*>(&::google::protobuf::_Struct_default_instance_);
+inline void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
+ clear_kind();
+ if (struct_value) {
+ if (GetArenaNoVirtual() != NULL &&
+ ::google::protobuf::Arena::GetArena(struct_value) == NULL) {
+ GetArenaNoVirtual()->Own(struct_value);
+ } else if (GetArenaNoVirtual() !=
+ ::google::protobuf::Arena::GetArena(struct_value)) {
+ ::google::protobuf::Struct* new_struct_value =
+ ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >(
+ GetArenaNoVirtual());
+ new_struct_value->CopyFrom(*struct_value);
+ struct_value = new_struct_value;
+ }
+ set_has_struct_value();
+ kind_.struct_value_ = struct_value;
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value)
}
-inline ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() {
+inline ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() {
// @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value)
if (has_struct_value()) {
clear_has_kind();
@@ -889,7 +897,7 @@ inline ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() {
return NULL;
}
}
-inline void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
+inline void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
clear_kind();
if (struct_value) {
set_has_struct_value();
@@ -897,16 +905,6 @@ inline void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::S
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value)
}
-inline ::google::protobuf::Struct* Value::mutable_struct_value() {
- if (!has_struct_value()) {
- clear_kind();
- set_has_struct_value();
- kind_.struct_value_ = CreateMaybeMessage< ::google::protobuf::Struct >(
- GetArenaNoVirtual());
- }
- // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value)
- return kind_.struct_value_;
-}
// .google.protobuf.ListValue list_value = 6;
inline bool Value::has_list_value() const {
@@ -923,30 +921,60 @@ inline void Value::clear_list_value() {
clear_has_kind();
}
}
-inline const ::google::protobuf::ListValue& Value::_internal_list_value() const {
- return *kind_.list_value_;
+inline const ::google::protobuf::ListValue& Value::list_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value)
+ return has_list_value()
+ ? *kind_.list_value_
+ : ::google::protobuf::ListValue::default_instance();
+}
+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());
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value)
+ return kind_.list_value_;
}
inline ::google::protobuf::ListValue* Value::release_list_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.list_value)
if (has_list_value()) {
clear_has_kind();
- ::google::protobuf::ListValue* temp = kind_.list_value_;
if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
+ ::google::protobuf::ListValue* temp = new ::google::protobuf::ListValue(*kind_.list_value_);
+ kind_.list_value_ = NULL;
+ return temp;
+ } else {
+ ::google::protobuf::ListValue* temp = kind_.list_value_;
+ kind_.list_value_ = NULL;
+ return temp;
}
- kind_.list_value_ = NULL;
- return temp;
} else {
return NULL;
}
}
-inline const ::google::protobuf::ListValue& Value::list_value() const {
- // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value)
- return has_list_value()
- ? *kind_.list_value_
- : *reinterpret_cast< ::google::protobuf::ListValue*>(&::google::protobuf::_ListValue_default_instance_);
+inline void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) {
+ clear_kind();
+ if (list_value) {
+ if (GetArenaNoVirtual() != NULL &&
+ ::google::protobuf::Arena::GetArena(list_value) == NULL) {
+ GetArenaNoVirtual()->Own(list_value);
+ } else if (GetArenaNoVirtual() !=
+ ::google::protobuf::Arena::GetArena(list_value)) {
+ ::google::protobuf::ListValue* new_list_value =
+ ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >(
+ GetArenaNoVirtual());
+ new_list_value->CopyFrom(*list_value);
+ list_value = new_list_value;
+ }
+ set_has_list_value();
+ kind_.list_value_ = list_value;
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value)
}
-inline ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() {
+inline ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() {
// @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value)
if (has_list_value()) {
clear_has_kind();
@@ -957,7 +985,7 @@ inline ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() {
return NULL;
}
}
-inline void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* list_value) {
+inline void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* list_value) {
clear_kind();
if (list_value) {
set_has_list_value();
@@ -965,16 +993,6 @@ inline void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::Lis
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value)
}
-inline ::google::protobuf::ListValue* Value::mutable_list_value() {
- if (!has_list_value()) {
- clear_kind();
- set_has_list_value();
- kind_.list_value_ = CreateMaybeMessage< ::google::protobuf::ListValue >(
- GetArenaNoVirtual());
- }
- // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value)
- return kind_.list_value_;
-}
inline bool Value::has_kind() const {
return kind_case() != KIND_NOT_SET;
@@ -996,23 +1014,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)
@@ -1022,6 +1040,7 @@ ListValue::values() const {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// -------------------------------------------------------------------
// -------------------------------------------------------------------
@@ -1031,13 +1050,14 @@ ListValue::values() const {
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
namespace google {
namespace protobuf {
-template <> struct is_proto_enum< ::google::protobuf::NullValue> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::NullValue> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::NullValue>() {
return ::google::protobuf::NullValue_descriptor();
@@ -1048,4 +1068,4 @@ inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::NullValue>()
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fstruct_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/struct.proto b/third_party/protobuf/3.4.0/src/google/protobuf/struct.proto
new file mode 100644
index 0000000000..7d7808e7fb
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/struct.proto
@@ -0,0 +1,96 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option cc_enable_arenas = true;
+option go_package = "github.com/golang/protobuf/ptypes/struct;structpb";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "StructProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+
+
+// `Struct` represents a structured data value, consisting of fields
+// which map to dynamically typed values. In some languages, `Struct`
+// might be supported by a native representation. For example, in
+// scripting languages like JS a struct is represented as an
+// object. The details of that representation are described together
+// with the proto support for the language.
+//
+// The JSON representation for `Struct` is JSON object.
+message Struct {
+ // Unordered map of dynamically typed values.
+ map<string, Value> fields = 1;
+}
+
+// `Value` represents a dynamically typed value which can be either
+// null, a number, a string, a boolean, a recursive struct value, or a
+// list of values. A producer of value is expected to set one of that
+// variants, absence of any variant indicates an error.
+//
+// The JSON representation for `Value` is JSON value.
+message Value {
+ // The kind of value.
+ oneof kind {
+ // Represents a null value.
+ NullValue null_value = 1;
+ // Represents a double value.
+ double number_value = 2;
+ // Represents a string value.
+ string string_value = 3;
+ // Represents a boolean value.
+ bool bool_value = 4;
+ // Represents a structured value.
+ Struct struct_value = 5;
+ // Represents a repeated `Value`.
+ ListValue list_value = 6;
+ }
+}
+
+// `NullValue` is a singleton enumeration to represent the null value for the
+// `Value` type union.
+//
+// The JSON representation for `NullValue` is JSON `null`.
+enum NullValue {
+ // Null value.
+ NULL_VALUE = 0;
+}
+
+// `ListValue` is a wrapper around a repeated field of values.
+//
+// The JSON representation for `ListValue` is JSON array.
+message ListValue {
+ // Repeated field of dynamically typed values.
+ repeated Value values = 1;
+}
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest13.m b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomic_sequence_num.h
index fef2af5f4a..bb20942f2f 100644
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest13.m
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomic_sequence_num.h
@@ -1,5 +1,5 @@
// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
+// Copyright 2014 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
@@ -27,14 +27,28 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifndef GOOGLE_PROTOBUF_ATOMIC_SEQUENCE_NUM_H_
+#define GOOGLE_PROTOBUF_ATOMIC_SEQUENCE_NUM_H_
+#include <google/protobuf/stubs/atomicops.h>
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
+namespace google {
+namespace protobuf {
+namespace internal {
-#import "GPBWireFormat.h"
+class SequenceNumber {
+ public:
+ SequenceNumber() : word_(0) {}
+ AtomicWord GetNext() {
+ return NoBarrier_AtomicIncrement(&word_, 1) - 1;
+ }
+ private:
+ AtomicWord word_;
+};
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_13 = 0;
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMIC_SEQUENCE_NUM_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops.h
new file mode 100644
index 0000000000..75aee30640
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops.h
@@ -0,0 +1,249 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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.
+
+// The routines exported by this module are subtle. If you use them, even if
+// you get the code right, it will depend on careful reasoning about atomicity
+// and memory ordering; it will be less readable, and harder to maintain. If
+// you plan to use these routines, you should have a good reason, such as solid
+// evidence that performance would otherwise suffer, or there being no
+// alternative. You should assume only properties explicitly guaranteed by the
+// specifications in this file. You are almost certainly _not_ writing code
+// just for the x86; if you assume x86 semantics, x86 hardware bugs and
+// implementations on other archtectures will cause your code to break. If you
+// do not know what you are doing, avoid these routines, and use a Mutex.
+//
+// It is incorrect to make direct assignments to/from an atomic variable.
+// You should use one of the Load or Store routines. The NoBarrier
+// versions are provided when no barriers are needed:
+// NoBarrier_Store()
+// NoBarrier_Load()
+// Although there are currently no compiler enforcement, you are encouraged
+// to use these.
+
+// This header and the implementations for each platform (located in
+// atomicops_internals_*) must be kept in sync with the upstream code (V8).
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_H_
+
+// Don't include this file for people not concerned about thread safety.
+#ifndef GOOGLE_PROTOBUF_NO_THREAD_SAFETY
+
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/platform_macros.h>
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+#if defined(GOOGLE_PROTOBUF_ARCH_POWER)
+#if defined(_LP64) || defined(__LP64__)
+typedef int32 Atomic32;
+typedef intptr_t Atomic64;
+#else
+typedef intptr_t Atomic32;
+typedef int64 Atomic64;
+#endif
+#else
+typedef int32 Atomic32;
+#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT
+// We need to be able to go between Atomic64 and AtomicWord implicitly. This
+// means Atomic64 and AtomicWord should be the same type on 64-bit.
+#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL)
+// NaCl's intptr_t is not actually 64-bits on 64-bit!
+// http://code.google.com/p/nativeclient/issues/detail?id=1162
+// sparcv9's pointer type is 32bits
+typedef int64 Atomic64;
+#else
+typedef intptr_t Atomic64;
+#endif
+#endif
+#endif
+
+// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
+// Atomic64 routines below, depending on your architecture.
+typedef intptr_t AtomicWord;
+
+// Atomically execute:
+// result = *ptr;
+// if (*ptr == old_value)
+// *ptr = new_value;
+// return result;
+//
+// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
+// Always return the old value of "*ptr"
+//
+// This routine implies no memory barriers.
+Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value);
+
+// Atomically store new_value into *ptr, returning the previous value held in
+// *ptr. This routine implies no memory barriers.
+Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value);
+
+// Atomically increment *ptr by "increment". Returns the new value of
+// *ptr with the increment applied. This routine implies no memory barriers.
+Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment);
+
+Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment);
+
+// These following lower-level operations are typically useful only to people
+// implementing higher-level synchronization operations like spinlocks,
+// mutexes, and condition-variables. They combine CompareAndSwap(), a load, or
+// a store with appropriate memory-ordering instructions. "Acquire" operations
+// ensure that no later memory access can be reordered ahead of the operation.
+// "Release" operations ensure that no previous memory access can be reordered
+// after the operation. "Barrier" operations have both "Acquire" and "Release"
+// semantics. A MemoryBarrierInternal() has "Barrier" semantics, but does no
+// memory access.
+Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value);
+Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value);
+
+// This function was renamed from MemoryBarrier to MemoryBarrierInternal
+// because MemoryBarrier is a define in Windows ARM builds and we do not
+// undefine it because we call it from this function.
+void MemoryBarrierInternal();
+void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value);
+void Acquire_Store(volatile Atomic32* ptr, Atomic32 value);
+void Release_Store(volatile Atomic32* ptr, Atomic32 value);
+
+Atomic32 NoBarrier_Load(volatile const Atomic32* ptr);
+Atomic32 Acquire_Load(volatile const Atomic32* ptr);
+Atomic32 Release_Load(volatile const Atomic32* ptr);
+
+// 64-bit atomic operations (only available on 64-bit processors).
+#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT
+Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value);
+Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value);
+Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
+Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
+
+Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value);
+Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value);
+void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value);
+void Acquire_Store(volatile Atomic64* ptr, Atomic64 value);
+void Release_Store(volatile Atomic64* ptr, Atomic64 value);
+Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
+Atomic64 Acquire_Load(volatile const Atomic64* ptr);
+Atomic64 Release_Load(volatile const Atomic64* ptr);
+#endif // GOOGLE_PROTOBUF_ARCH_64_BIT
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+// Include our platform specific implementation.
+#define GOOGLE_PROTOBUF_ATOMICOPS_ERROR \
+"Atomic operations are not supported on your platform"
+
+// ThreadSanitizer, http://clang.llvm.org/docs/ThreadSanitizer.html.
+#if defined(THREAD_SANITIZER)
+#include <google/protobuf/stubs/atomicops_internals_tsan.h>
+// MSVC.
+#elif defined(_MSC_VER)
+#if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64) || defined(GOOGLE_PROTOBUF_ARCH_ARM)
+#include <google/protobuf/stubs/atomicops_internals_x86_msvc.h>
+#else
+#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+#endif
+
+// Solaris
+#elif defined(GOOGLE_PROTOBUF_OS_SOLARIS)
+#include <google/protobuf/stubs/atomicops_internals_solaris.h>
+
+// AIX
+#elif defined(GOOGLE_PROTOBUF_OS_AIX)
+#include <google/protobuf/stubs/atomicops_internals_power.h>
+
+// GCC.
+#elif defined(__GNUC__)
+#if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64)
+#include <google/protobuf/stubs/atomicops_internals_x86_gcc.h>
+#elif defined(GOOGLE_PROTOBUF_ARCH_ARM) && defined(__linux__)
+#if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
+#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
+#else
+#include <google/protobuf/stubs/atomicops_internals_arm_gcc.h>
+#endif
+#elif defined(GOOGLE_PROTOBUF_ARCH_AARCH64)
+#include <google/protobuf/stubs/atomicops_internals_arm64_gcc.h>
+#elif defined(GOOGLE_PROTOBUF_ARCH_ARM_QNX)
+#include <google/protobuf/stubs/atomicops_internals_arm_qnx.h>
+#elif defined(GOOGLE_PROTOBUF_ARCH_MIPS) || defined(GOOGLE_PROTOBUF_ARCH_MIPS64)
+#include <google/protobuf/stubs/atomicops_internals_mips_gcc.h>
+#elif defined(GOOGLE_PROTOBUF_ARCH_POWER)
+#include <google/protobuf/stubs/atomicops_internals_power.h>
+#elif defined(__native_client__)
+// The static_asserts in the C++11 atomics implementation cause it to fail
+// with certain compilers, e.g. nvcc on macOS. Don't use elsewhere unless
+// the TODO in that file is addressed.
+#include <google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h>
+#elif defined(GOOGLE_PROTOBUF_ARCH_PPC)
+#include <google/protobuf/stubs/atomicops_internals_ppc_gcc.h>
+#elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
+#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
+#elif defined(__clang__)
+#if __has_extension(c_atomic)
+#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
+#else
+#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+#endif
+#else
+#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+#endif
+
+// Unknown.
+#else
+#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+#endif
+
+// On some platforms we need additional declarations to make AtomicWord
+// compatible with our other Atomic* types.
+#if defined(GOOGLE_PROTOBUF_OS_APPLE)
+#include <google/protobuf/stubs/atomicops_internals_atomicword_compat.h>
+#endif
+
+#undef GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+
+#endif // GOOGLE_PROTOBUF_NO_THREAD_SAFETY
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h
new file mode 100644
index 0000000000..9a69d21ad6
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h
@@ -0,0 +1,325 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM64_GCC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM64_GCC_H_
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline void MemoryBarrierInternal() {
+ __asm__ __volatile__ ("dmb ish" ::: "memory"); // NOLINT
+}
+
+// NoBarrier versions of the operation include "memory" in the clobber list.
+// This is not required for direct usage of the NoBarrier versions of the
+// operations. However this is required for correctness when they are used as
+// part of the Acquire or Release versions, to ensure that nothing from outside
+// the call is reordered between the operation and the memory barrier. This does
+// not change the code generated, so has no or minimal impact on the
+// NoBarrier operations.
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 prev;
+ int32_t temp;
+
+ __asm__ __volatile__ ( // NOLINT
+ "0: \n\t"
+ "ldxr %w[prev], %[ptr] \n\t" // Load the previous value.
+ "cmp %w[prev], %w[old_value] \n\t"
+ "bne 1f \n\t"
+ "stxr %w[temp], %w[new_value], %[ptr] \n\t" // Try to store the new value.
+ "cbnz %w[temp], 0b \n\t" // Retry if it did not work.
+ "1: \n\t"
+ : [prev]"=&r" (prev),
+ [temp]"=&r" (temp),
+ [ptr]"+Q" (*ptr)
+ : [old_value]"IJr" (old_value),
+ [new_value]"r" (new_value)
+ : "cc", "memory"
+ ); // NOLINT
+
+ return prev;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ Atomic32 result;
+ int32_t temp;
+
+ __asm__ __volatile__ ( // NOLINT
+ "0: \n\t"
+ "ldxr %w[result], %[ptr] \n\t" // Load the previous value.
+ "stxr %w[temp], %w[new_value], %[ptr] \n\t" // Try to store the new value.
+ "cbnz %w[temp], 0b \n\t" // Retry if it did not work.
+ : [result]"=&r" (result),
+ [temp]"=&r" (temp),
+ [ptr]"+Q" (*ptr)
+ : [new_value]"r" (new_value)
+ : "memory"
+ ); // NOLINT
+
+ return result;
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ Atomic32 result;
+ int32_t temp;
+
+ __asm__ __volatile__ ( // NOLINT
+ "0: \n\t"
+ "ldxr %w[result], %[ptr] \n\t" // Load the previous value.
+ "add %w[result], %w[result], %w[increment]\n\t"
+ "stxr %w[temp], %w[result], %[ptr] \n\t" // Try to store the result.
+ "cbnz %w[temp], 0b \n\t" // Retry on failure.
+ : [result]"=&r" (result),
+ [temp]"=&r" (temp),
+ [ptr]"+Q" (*ptr)
+ : [increment]"IJr" (increment)
+ : "memory"
+ ); // NOLINT
+
+ return result;
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ MemoryBarrierInternal();
+ Atomic32 result = NoBarrier_AtomicIncrement(ptr, increment);
+ MemoryBarrierInternal();
+
+ return result;
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ MemoryBarrierInternal();
+
+ return prev;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ MemoryBarrierInternal();
+ Atomic32 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+
+ return prev;
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ __asm__ __volatile__ ( // NOLINT
+ "stlr %w[value], %[ptr] \n\t"
+ : [ptr]"=Q" (*ptr)
+ : [value]"r" (value)
+ : "memory"
+ ); // NOLINT
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return *ptr;
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ Atomic32 value;
+
+ __asm__ __volatile__ ( // NOLINT
+ "ldar %w[value], %[ptr] \n\t"
+ : [value]"=r" (value)
+ : [ptr]"Q" (*ptr)
+ : "memory"
+ ); // NOLINT
+
+ return value;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+// 64-bit versions of the operations.
+// See the 32-bit versions for comments.
+
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 prev;
+ int32_t temp;
+
+ __asm__ __volatile__ ( // NOLINT
+ "0: \n\t"
+ "ldxr %[prev], %[ptr] \n\t"
+ "cmp %[prev], %[old_value] \n\t"
+ "bne 1f \n\t"
+ "stxr %w[temp], %[new_value], %[ptr] \n\t"
+ "cbnz %w[temp], 0b \n\t"
+ "1: \n\t"
+ : [prev]"=&r" (prev),
+ [temp]"=&r" (temp),
+ [ptr]"+Q" (*ptr)
+ : [old_value]"IJr" (old_value),
+ [new_value]"r" (new_value)
+ : "cc", "memory"
+ ); // NOLINT
+
+ return prev;
+}
+
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
+ Atomic64 new_value) {
+ Atomic64 result;
+ int32_t temp;
+
+ __asm__ __volatile__ ( // NOLINT
+ "0: \n\t"
+ "ldxr %[result], %[ptr] \n\t"
+ "stxr %w[temp], %[new_value], %[ptr] \n\t"
+ "cbnz %w[temp], 0b \n\t"
+ : [result]"=&r" (result),
+ [temp]"=&r" (temp),
+ [ptr]"+Q" (*ptr)
+ : [new_value]"r" (new_value)
+ : "memory"
+ ); // NOLINT
+
+ return result;
+}
+
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ Atomic64 result;
+ int32_t temp;
+
+ __asm__ __volatile__ ( // NOLINT
+ "0: \n\t"
+ "ldxr %[result], %[ptr] \n\t"
+ "add %[result], %[result], %[increment] \n\t"
+ "stxr %w[temp], %[result], %[ptr] \n\t"
+ "cbnz %w[temp], 0b \n\t"
+ : [result]"=&r" (result),
+ [temp]"=&r" (temp),
+ [ptr]"+Q" (*ptr)
+ : [increment]"IJr" (increment)
+ : "memory"
+ ); // NOLINT
+
+ return result;
+}
+
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ MemoryBarrierInternal();
+ Atomic64 result = NoBarrier_AtomicIncrement(ptr, increment);
+ MemoryBarrierInternal();
+
+ return result;
+}
+
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ MemoryBarrierInternal();
+
+ return prev;
+}
+
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ MemoryBarrierInternal();
+ Atomic64 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+
+ return prev;
+}
+
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
+ __asm__ __volatile__ ( // NOLINT
+ "stlr %x[value], %[ptr] \n\t"
+ : [ptr]"=Q" (*ptr)
+ : [value]"r" (value)
+ : "memory"
+ ); // NOLINT
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
+ return *ptr;
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
+ Atomic64 value;
+
+ __asm__ __volatile__ ( // NOLINT
+ "ldar %x[value], %[ptr] \n\t"
+ : [value]"=r" (value)
+ : [ptr]"Q" (*ptr)
+ : "memory"
+ ); // NOLINT
+
+ return value;
+}
+
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM64_GCC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h
new file mode 100644
index 0000000000..6e2de67fa5
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h
@@ -0,0 +1,151 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 an internal atomic implementation, use atomicops.h instead.
+//
+// LinuxKernelCmpxchg and Barrier_AtomicIncrement are from Google Gears.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_GCC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_GCC_H_
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+// 0xffff0fc0 is the hard coded address of a function provided by
+// the kernel which implements an atomic compare-exchange. On older
+// ARM architecture revisions (pre-v6) this may be implemented using
+// a syscall. This address is stable, and in active use (hard coded)
+// by at least glibc-2.7 and the Android C library.
+typedef Atomic32 (*LinuxKernelCmpxchgFunc)(Atomic32 old_value,
+ Atomic32 new_value,
+ volatile Atomic32* ptr);
+LinuxKernelCmpxchgFunc pLinuxKernelCmpxchg __attribute__((weak)) =
+ (LinuxKernelCmpxchgFunc) 0xffff0fc0;
+
+typedef void (*LinuxKernelMemoryBarrierFunc)(void);
+LinuxKernelMemoryBarrierFunc pLinuxKernelMemoryBarrier __attribute__((weak)) =
+ (LinuxKernelMemoryBarrierFunc) 0xffff0fa0;
+
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 prev_value = *ptr;
+ do {
+ if (!pLinuxKernelCmpxchg(old_value, new_value,
+ const_cast<Atomic32*>(ptr))) {
+ return old_value;
+ }
+ prev_value = *ptr;
+ } while (prev_value == old_value);
+ return prev_value;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ Atomic32 old_value;
+ do {
+ old_value = *ptr;
+ } while (pLinuxKernelCmpxchg(old_value, new_value,
+ const_cast<Atomic32*>(ptr)));
+ return old_value;
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return Barrier_AtomicIncrement(ptr, increment);
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ for (;;) {
+ // Atomic exchange the old value with an incremented one.
+ Atomic32 old_value = *ptr;
+ Atomic32 new_value = old_value + increment;
+ if (pLinuxKernelCmpxchg(old_value, new_value,
+ const_cast<Atomic32*>(ptr)) == 0) {
+ // The exchange took place as expected.
+ return new_value;
+ }
+ // Otherwise, *ptr changed mid-loop and we need to retry.
+ }
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+inline void MemoryBarrierInternal() {
+ pLinuxKernelMemoryBarrier();
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ MemoryBarrierInternal();
+ *ptr = value;
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return *ptr;
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ Atomic32 value = *ptr;
+ MemoryBarrierInternal();
+ return value;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_GCC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h
new file mode 100644
index 0000000000..cd97e0c994
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h
@@ -0,0 +1,146 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_QNX_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_QNX_H_
+
+// For _smp_cmpxchg()
+#include <pthread.h>
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline Atomic32 QNXCmpxchg(Atomic32 old_value,
+ Atomic32 new_value,
+ volatile Atomic32* ptr) {
+ return static_cast<Atomic32>(
+ _smp_cmpxchg((volatile unsigned *)ptr,
+ (unsigned)old_value,
+ (unsigned)new_value));
+}
+
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 prev_value = *ptr;
+ do {
+ if (!QNXCmpxchg(old_value, new_value,
+ const_cast<Atomic32*>(ptr))) {
+ return old_value;
+ }
+ prev_value = *ptr;
+ } while (prev_value == old_value);
+ return prev_value;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ Atomic32 old_value;
+ do {
+ old_value = *ptr;
+ } while (QNXCmpxchg(old_value, new_value,
+ const_cast<Atomic32*>(ptr)));
+ return old_value;
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return Barrier_AtomicIncrement(ptr, increment);
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ for (;;) {
+ // Atomic exchange the old value with an incremented one.
+ Atomic32 old_value = *ptr;
+ Atomic32 new_value = old_value + increment;
+ if (QNXCmpxchg(old_value, new_value,
+ const_cast<Atomic32*>(ptr)) == 0) {
+ // The exchange took place as expected.
+ return new_value;
+ }
+ // Otherwise, *ptr changed mid-loop and we need to retry.
+ }
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+inline void MemoryBarrierInternal() {
+ __sync_synchronize();
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ MemoryBarrierInternal();
+ *ptr = value;
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return *ptr;
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ Atomic32 value = *ptr;
+ MemoryBarrierInternal();
+ return value;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM_QNX_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h
new file mode 100644
index 0000000000..eb198ff5cc
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h
@@ -0,0 +1,122 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
+
+// AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32,
+// which in turn means int. On some LP32 platforms, intptr_t is an int, but
+// on others, it's a long. When AtomicWord and Atomic32 are based on different
+// fundamental types, their pointers are incompatible.
+//
+// This file defines function overloads to allow both AtomicWord and Atomic32
+// data to be used with this interface.
+//
+// On LP64 platforms, AtomicWord and Atomic64 are both always long,
+// so this problem doesn't occur.
+
+#if !defined(GOOGLE_PROTOBUF_ARCH_64_BIT)
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline AtomicWord NoBarrier_CompareAndSwap(volatile AtomicWord* ptr,
+ AtomicWord old_value,
+ AtomicWord new_value) {
+ return NoBarrier_CompareAndSwap(
+ reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
+}
+
+inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr,
+ AtomicWord new_value) {
+ return NoBarrier_AtomicExchange(
+ reinterpret_cast<volatile Atomic32*>(ptr), new_value);
+}
+
+inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr,
+ AtomicWord increment) {
+ return NoBarrier_AtomicIncrement(
+ reinterpret_cast<volatile Atomic32*>(ptr), increment);
+}
+
+inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr,
+ AtomicWord increment) {
+ return Barrier_AtomicIncrement(
+ reinterpret_cast<volatile Atomic32*>(ptr), increment);
+}
+
+inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr,
+ AtomicWord old_value,
+ AtomicWord new_value) {
+ return Acquire_CompareAndSwap(
+ reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
+}
+
+inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr,
+ AtomicWord old_value,
+ AtomicWord new_value) {
+ return Release_CompareAndSwap(
+ reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
+}
+
+inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) {
+ NoBarrier_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
+}
+
+inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) {
+ return Acquire_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
+}
+
+inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
+ return Release_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
+}
+
+inline AtomicWord NoBarrier_Load(volatile const AtomicWord *ptr) {
+ return NoBarrier_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
+}
+
+inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
+ return Acquire_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
+}
+
+inline AtomicWord Release_Load(volatile const AtomicWord* ptr) {
+ return Release_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
+}
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // !defined(GOOGLE_PROTOBUF_ARCH_64_BIT)
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h
new file mode 100644
index 0000000000..44ef9c9e03
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h
@@ -0,0 +1,231 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_C11_ATOMIC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_C11_ATOMIC_H_
+
+#include <atomic>
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+// This implementation is transitional and maintains the original API for
+// atomicops.h. This requires casting memory locations to the atomic types, and
+// assumes that the API and the C++11 implementation are layout-compatible,
+// which isn't true for all implementations or hardware platforms. The static
+// assertion should detect this issue, were it to fire then this header
+// shouldn't be used.
+//
+// TODO(jfb) If this header manages to stay committed then the API should be
+// modified, and all call sites updated.
+typedef volatile std::atomic<Atomic32>* AtomicLocation32;
+static_assert(sizeof(*(AtomicLocation32) nullptr) == sizeof(Atomic32),
+ "incompatible 32-bit atomic layout");
+
+inline void MemoryBarrierInternal() {
+#if defined(__GLIBCXX__)
+ // Work around libstdc++ bug 51038 where atomic_thread_fence was declared but
+ // not defined, leading to the linker complaining about undefined references.
+ __atomic_thread_fence(std::memory_order_seq_cst);
+#else
+ std::atomic_thread_fence(std::memory_order_seq_cst);
+#endif
+}
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ ((AtomicLocation32)ptr)
+ ->compare_exchange_strong(old_value,
+ new_value,
+ std::memory_order_relaxed,
+ std::memory_order_relaxed);
+ return old_value;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ return ((AtomicLocation32)ptr)
+ ->exchange(new_value, std::memory_order_relaxed);
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return increment +
+ ((AtomicLocation32)ptr)
+ ->fetch_add(increment, std::memory_order_relaxed);
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return increment + ((AtomicLocation32)ptr)->fetch_add(increment);
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ ((AtomicLocation32)ptr)
+ ->compare_exchange_strong(old_value,
+ new_value,
+ std::memory_order_acquire,
+ std::memory_order_acquire);
+ return old_value;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ ((AtomicLocation32)ptr)
+ ->compare_exchange_strong(old_value,
+ new_value,
+ std::memory_order_release,
+ std::memory_order_relaxed);
+ return old_value;
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ ((AtomicLocation32)ptr)->store(value, std::memory_order_relaxed);
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ ((AtomicLocation32)ptr)->store(value, std::memory_order_relaxed);
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ ((AtomicLocation32)ptr)->store(value, std::memory_order_release);
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return ((AtomicLocation32)ptr)->load(std::memory_order_relaxed);
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ return ((AtomicLocation32)ptr)->load(std::memory_order_acquire);
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ MemoryBarrierInternal();
+ return ((AtomicLocation32)ptr)->load(std::memory_order_relaxed);
+}
+
+#if defined(GOOGLE_PROTOBUF_ARCH_64_BIT)
+
+typedef volatile std::atomic<Atomic64>* AtomicLocation64;
+static_assert(sizeof(*(AtomicLocation64) nullptr) == sizeof(Atomic64),
+ "incompatible 64-bit atomic layout");
+
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ ((AtomicLocation64)ptr)
+ ->compare_exchange_strong(old_value,
+ new_value,
+ std::memory_order_relaxed,
+ std::memory_order_relaxed);
+ return old_value;
+}
+
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
+ Atomic64 new_value) {
+ return ((AtomicLocation64)ptr)
+ ->exchange(new_value, std::memory_order_relaxed);
+}
+
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ return increment +
+ ((AtomicLocation64)ptr)
+ ->fetch_add(increment, std::memory_order_relaxed);
+}
+
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ return increment + ((AtomicLocation64)ptr)->fetch_add(increment);
+}
+
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ ((AtomicLocation64)ptr)
+ ->compare_exchange_strong(old_value,
+ new_value,
+ std::memory_order_acquire,
+ std::memory_order_acquire);
+ return old_value;
+}
+
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ ((AtomicLocation64)ptr)
+ ->compare_exchange_strong(old_value,
+ new_value,
+ std::memory_order_release,
+ std::memory_order_relaxed);
+ return old_value;
+}
+
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
+ ((AtomicLocation64)ptr)->store(value, std::memory_order_relaxed);
+}
+
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
+ ((AtomicLocation64)ptr)->store(value, std::memory_order_relaxed);
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
+ ((AtomicLocation64)ptr)->store(value, std::memory_order_release);
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
+ return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed);
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
+ return ((AtomicLocation64)ptr)->load(std::memory_order_acquire);
+}
+
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
+ MemoryBarrierInternal();
+ return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed);
+}
+
+#endif // defined(GOOGLE_PROTOBUF_ARCH_64_BIT)
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_C11_ATOMIC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
new file mode 100644
index 0000000000..0b0b06ce6c
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
@@ -0,0 +1,155 @@
+// Copyright 2013 Red Hat Inc. All rights reserved.
+//
+// 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 Red Hat 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, false,
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+ return old_value;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ return __atomic_exchange_n(ptr, new_value, __ATOMIC_RELAXED);
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return __atomic_add_fetch(ptr, increment, __ATOMIC_RELAXED);
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return __atomic_add_fetch(ptr, increment, __ATOMIC_SEQ_CST);
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, false,
+ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
+ return old_value;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, false,
+ __ATOMIC_RELEASE, __ATOMIC_ACQUIRE);
+ return old_value;
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ __atomic_store_n(ptr, value, __ATOMIC_RELAXED);
+}
+
+inline void MemoryBarrierInternal() {
+ __sync_synchronize();
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST);
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ __atomic_store_n(ptr, value, __ATOMIC_RELEASE);
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return __atomic_load_n(ptr, __ATOMIC_RELAXED);
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+}
+
+#ifdef __LP64__
+
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
+ __atomic_store_n(ptr, value, __ATOMIC_RELEASE);
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
+ return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
+}
+
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, false,
+ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
+ return old_value;
+}
+
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, false,
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+ return old_value;
+}
+
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ return __atomic_add_fetch(ptr, increment, __ATOMIC_RELAXED);
+}
+
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
+ __atomic_store_n(ptr, value, __ATOMIC_RELAXED);
+}
+
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
+ Atomic64 new_value) {
+ return __atomic_exchange_n(ptr, new_value, __ATOMIC_RELAXED);
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
+ return __atomic_load_n(ptr, __ATOMIC_RELAXED);
+}
+
+#endif // defined(__LP64__)
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h
new file mode 100644
index 0000000000..6ce6820ec2
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h
@@ -0,0 +1,313 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_MIPS_GCC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_MIPS_GCC_H_
+
+#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+// Atomically execute:
+// result = *ptr;
+// if (*ptr == old_value)
+// *ptr = new_value;
+// return result;
+//
+// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
+// Always return the old value of "*ptr"
+//
+// This routine implies no memory barriers.
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 prev, tmp;
+ __asm__ __volatile__(".set push\n"
+ ".set noreorder\n"
+ "1:\n"
+ "ll %0, %5\n" // prev = *ptr
+ "bne %0, %3, 2f\n" // if (prev != old_value) goto 2
+ "move %2, %4\n" // tmp = new_value
+ "sc %2, %1\n" // *ptr = tmp (with atomic check)
+ "beqz %2, 1b\n" // start again on atomic error
+ "nop\n" // delay slot nop
+ "2:\n"
+ ".set pop\n"
+ : "=&r" (prev), "=m" (*ptr), "=&r" (tmp)
+ : "r" (old_value), "r" (new_value), "m" (*ptr)
+ : "memory");
+ return prev;
+}
+
+// Atomically store new_value into *ptr, returning the previous value held in
+// *ptr. This routine implies no memory barriers.
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ Atomic32 temp, old;
+ __asm__ __volatile__(".set push\n"
+ ".set noreorder\n"
+ "1:\n"
+ "ll %1, %4\n" // old = *ptr
+ "move %0, %3\n" // temp = new_value
+ "sc %0, %2\n" // *ptr = temp (with atomic check)
+ "beqz %0, 1b\n" // start again on atomic error
+ "nop\n" // delay slot nop
+ ".set pop\n"
+ : "=&r" (temp), "=&r" (old), "=m" (*ptr)
+ : "r" (new_value), "m" (*ptr)
+ : "memory");
+
+ return old;
+}
+
+// Atomically increment *ptr by "increment". Returns the new value of
+// *ptr with the increment applied. This routine implies no memory barriers.
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ Atomic32 temp, temp2;
+
+ __asm__ __volatile__(".set push\n"
+ ".set noreorder\n"
+ "1:\n"
+ "ll %0, %4\n" // temp = *ptr
+ "addu %1, %0, %3\n" // temp2 = temp + increment
+ "sc %1, %2\n" // *ptr = temp2 (with atomic check)
+ "beqz %1, 1b\n" // start again on atomic error
+ "addu %1, %0, %3\n" // temp2 = temp + increment
+ ".set pop\n"
+ : "=&r" (temp), "=&r" (temp2), "=m" (*ptr)
+ : "Ir" (increment), "m" (*ptr)
+ : "memory");
+ // temp2 now holds the final value.
+ return temp2;
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ ATOMICOPS_COMPILER_BARRIER();
+ Atomic32 res = NoBarrier_AtomicIncrement(ptr, increment);
+ ATOMICOPS_COMPILER_BARRIER();
+ return res;
+}
+
+// "Acquire" operations
+// ensure that no later memory access can be reordered ahead of the operation.
+// "Release" operations ensure that no previous memory access can be reordered
+// after the operation. "Barrier" operations have both "Acquire" and "Release"
+// semantics. A MemoryBarrierInternal() has "Barrier" semantics, but does no
+// memory access.
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ ATOMICOPS_COMPILER_BARRIER();
+ Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ ATOMICOPS_COMPILER_BARRIER();
+ return res;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ ATOMICOPS_COMPILER_BARRIER();
+ Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ ATOMICOPS_COMPILER_BARRIER();
+ return res;
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+inline void MemoryBarrierInternal() {
+ __asm__ __volatile__("sync" : : : "memory");
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ MemoryBarrierInternal();
+ *ptr = value;
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return *ptr;
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ Atomic32 value = *ptr;
+ MemoryBarrierInternal();
+ return value;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+#if defined(__LP64__)
+// 64-bit versions of the atomic ops.
+
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 prev, tmp;
+ __asm__ __volatile__(".set push\n"
+ ".set noreorder\n"
+ "1:\n"
+ "lld %0, %5\n" // prev = *ptr
+ "bne %0, %3, 2f\n" // if (prev != old_value) goto 2
+ "move %2, %4\n" // tmp = new_value
+ "scd %2, %1\n" // *ptr = tmp (with atomic check)
+ "beqz %2, 1b\n" // start again on atomic error
+ "nop\n" // delay slot nop
+ "2:\n"
+ ".set pop\n"
+ : "=&r" (prev), "=m" (*ptr), "=&r" (tmp)
+ : "r" (old_value), "r" (new_value), "m" (*ptr)
+ : "memory");
+ return prev;
+}
+
+// Atomically store new_value into *ptr, returning the previous value held in
+// *ptr. This routine implies no memory barriers.
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
+ Atomic64 new_value) {
+ Atomic64 temp, old;
+ __asm__ __volatile__(".set push\n"
+ ".set noreorder\n"
+ "1:\n"
+ "lld %1, %4\n" // old = *ptr
+ "move %0, %3\n" // temp = new_value
+ "scd %0, %2\n" // *ptr = temp (with atomic check)
+ "beqz %0, 1b\n" // start again on atomic error
+ "nop\n" // delay slot nop
+ ".set pop\n"
+ : "=&r" (temp), "=&r" (old), "=m" (*ptr)
+ : "r" (new_value), "m" (*ptr)
+ : "memory");
+
+ return old;
+}
+
+// Atomically increment *ptr by "increment". Returns the new value of
+// *ptr with the increment applied. This routine implies no memory barriers.
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ Atomic64 temp, temp2;
+
+ __asm__ __volatile__(".set push\n"
+ ".set noreorder\n"
+ "1:\n"
+ "lld %0, %4\n" // temp = *ptr
+ "daddu %1, %0, %3\n" // temp2 = temp + increment
+ "scd %1, %2\n" // *ptr = temp2 (with atomic check)
+ "beqz %1, 1b\n" // start again on atomic error
+ "daddu %1, %0, %3\n" // temp2 = temp + increment
+ ".set pop\n"
+ : "=&r" (temp), "=&r" (temp2), "=m" (*ptr)
+ : "Ir" (increment), "m" (*ptr)
+ : "memory");
+ // temp2 now holds the final value.
+ return temp2;
+}
+
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ MemoryBarrierInternal();
+ Atomic64 res = NoBarrier_AtomicIncrement(ptr, increment);
+ MemoryBarrierInternal();
+ return res;
+}
+
+// "Acquire" operations
+// ensure that no later memory access can be reordered ahead of the operation.
+// "Release" operations ensure that no previous memory access can be reordered
+// after the operation. "Barrier" operations have both "Acquire" and "Release"
+// semantics. A MemoryBarrierInternal() has "Barrier" semantics, but does no
+// memory access.
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ MemoryBarrierInternal();
+ return res;
+}
+
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ MemoryBarrierInternal();
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
+ MemoryBarrierInternal();
+ *ptr = value;
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
+ return *ptr;
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
+ Atomic64 value = *ptr;
+ MemoryBarrierInternal();
+ return value;
+}
+
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+#endif
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#undef ATOMICOPS_COMPILER_BARRIER
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_MIPS_GCC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_power.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_power.h
new file mode 100644
index 0000000000..cad9f1e354
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_power.h
@@ -0,0 +1,440 @@
+// Copyright 2014 Bloomberg Finance LP. All rights reserved.
+//
+// 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 Bloomberg Finance LP. 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_AIX_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_AIX_H_
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 result;
+
+ asm volatile (
+ "1: lwarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " cmpw %[cmp], %[res] \n\t" // compare values
+ " bne- 2f \n\t"
+ " stwcx. %[val], %[zero], %[obj] \n\t" // store new value
+ " bne- 1b \n\t"
+ "2: \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [cmp] "b" (old_value),
+ [val] "b" (new_value),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ Atomic32 result;
+
+ asm volatile (
+ "1: lwarx %[res], %[zero], %[obj] \n\t"
+ " stwcx. %[val], %[zero], %[obj] \n\t"
+ " bne- 1b \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [val] "b" (new_value),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ Atomic32 result;
+
+ asm volatile (
+ "1: lwarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " add %[res], %[val], %[res] \n\t" // add the operand
+ " stwcx. %[res], %[zero], %[obj] \n\t" // store old value
+ // if still reserved
+ " bne- 1b \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [val] "b" (increment),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline void MemoryBarrierInternal(void) {
+ asm volatile (
+ " lwsync \n\t"
+ " isync \n\t"
+ :
+ :
+ : "memory");
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ Atomic32 result;
+
+ asm volatile (
+ " lwsync \n\t"
+
+ "1: lwarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " add %[res], %[val], %[res] \n\t" // add the operand
+ " stwcx. %[res], %[zero], %[obj] \n\t" // store old value
+ // if still reserved
+ " bne- 1b \n\t"
+ " isync \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [val] "b" (increment),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 result;
+
+ asm volatile (
+ "1: lwarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " cmpw %[cmp], %[res] \n\t" // compare values
+ " bne- 2f \n\t"
+ " stwcx. %[val], %[zero], %[obj] \n\t" // store new value
+ " bne- 1b \n\t"
+
+ " isync \n\t"
+ "2: \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [cmp] "b" (old_value),
+ [val] "b" (new_value),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 result;
+
+ asm volatile (
+ " lwsync \n\t"
+
+ "1: lwarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " cmpw %[cmp], %[res] \n\t" // compare values
+ " bne- 2f \n\t"
+ " stwcx. %[val], %[zero], %[obj] \n\t" // store new value
+ " bne- 1b \n\t"
+
+ "2: \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [cmp] "b" (old_value),
+ [val] "b" (new_value),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ asm volatile (
+ " stw %[val], %[obj] \n\t"
+ " isync \n\t"
+ : [obj] "=m" (*ptr)
+ : [val] "b" (value));
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ asm volatile (
+ " lwsync \n\t"
+ " stw %[val], %[obj] \n\t"
+ : [obj] "=m" (*ptr)
+ : [val] "b" (value));
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return *ptr;
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ Atomic32 result;
+
+ asm volatile (
+ "1: lwz %[res], %[obj] \n\t"
+ " cmpw %[res], %[res] \n\t" // create data
+ // dependency for
+ // load/load ordering
+ " bne- 1b \n\t" // never taken
+
+ " isync \n\t"
+ : [res] "=b" (result)
+ : [obj] "m" (*ptr),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ Atomic32 result;
+
+ asm volatile (
+ " lwsync \n\t"
+
+ "1: lwz %[res], %[obj] \n\t"
+ " cmpw %[res], %[res] \n\t" // create data
+ // dependency for
+ // load/load ordering
+ " bne- 1b \n\t" // never taken
+ : [res] "=b" (result)
+ : [obj] "m" (*ptr),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 result;
+
+ asm volatile (
+ "1: ldarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " cmpd %[cmp], %[res] \n\t" // compare values
+ " bne- 2f \n\t"
+
+ " stdcx. %[val], %[zero], %[obj] \n\t" // store the new value
+ " bne- 1b \n\t"
+ "2: \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [cmp] "b" (old_value),
+ [val] "b" (new_value),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
+ Atomic64 new_value) {
+ Atomic64 result;
+
+ asm volatile (
+ "1: ldarx %[res], %[zero], %[obj] \n\t"
+ " stdcx. %[val], %[zero], %[obj] \n\t"
+ " bne- 1b \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [val] "b" (new_value),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ Atomic64 result;
+
+ asm volatile (
+ "1: ldarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " add %[res], %[res], %[val] \n\t" // add the operand
+ " stdcx. %[res], %[zero], %[obj] \n\t" // store old value if
+ // still reserved
+
+ " bne- 1b \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [val] "b" (increment),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+
+ Atomic64 result;
+
+ asm volatile (
+ " lwsync \n\t"
+
+ "1: ldarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " add %[res], %[res], %[val] \n\t" // add the operand
+ " stdcx. %[res], %[zero], %[obj] \n\t" // store old value if
+ // still reserved
+
+ " bne- 1b \n\t"
+
+ " isync \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [val] "b" (increment),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 result;
+
+ asm volatile (
+ "1: ldarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " cmpd %[cmp], %[res] \n\t" // compare values
+ " bne- 2f \n\t"
+
+ " stdcx. %[val], %[zero], %[obj] \n\t" // store the new value
+ " bne- 1b \n\t"
+ " isync \n\t"
+ "2: \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [cmp] "b" (old_value),
+ [val] "b" (new_value),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 result;
+
+ asm volatile (
+ " lwsync \n\t"
+
+ "1: ldarx %[res], %[zero], %[obj] \n\t" // load and reserve
+ " cmpd %[cmp], %[res] \n\t" // compare values
+ " bne- 2f \n\t"
+
+ " stdcx. %[val], %[zero], %[obj] \n\t" // store the new value
+ " bne- 1b \n\t"
+ "2: \n\t"
+ : [res] "=&b" (result)
+ : [obj] "b" (ptr),
+ [cmp] "b" (old_value),
+ [val] "b" (new_value),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
+ asm volatile (
+ " std %[val], %[obj] \n\t"
+ " isync \n\t"
+ : [obj] "=m" (*ptr)
+ : [val] "b" (value));
+}
+
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
+ asm volatile (
+ " lwsync \n\t"
+ " std %[val], %[obj] \n\t"
+ : [obj] "=m" (*ptr)
+ : [val] "b" (value));
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
+ return *ptr;
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
+ Atomic64 result;
+
+ asm volatile (
+ "1: ld %[res], %[obj] \n\t"
+ " cmpd %[res], %[res] \n\t" // create data
+ // dependency for
+ // load/load ordering
+ " bne- 1b \n\t" // never taken
+
+ " isync \n\t"
+ : [res] "=b" (result)
+ : [obj] "m" (*ptr),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
+ Atomic64 result;
+
+ asm volatile (
+ " lwsync \n\t"
+
+ "1: ld %[res], %[obj] \n\t"
+ " cmpd %[res], %[res] \n\t" // create data
+ // dependency for
+ // load/load ordering
+ " bne- 1b \n\t" // never taken
+ : [res] "=b" (result)
+ : [obj] "m" (*ptr),
+ [zero] "i" (0)
+ : "cr0", "ctr");
+
+ return result;
+}
+#endif
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_SPARC_GCC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h
new file mode 100644
index 0000000000..d477dc6dda
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h
@@ -0,0 +1,155 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 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: ogabbay@advaoptical.com (Oded Gabbay)
+// Cleaned up by: bsilver16384@gmail.com (Brian Silverman)
+//
+// This file is an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PPC_GCC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PPC_GCC_H_
+
+#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32 *ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 prev;
+
+ __asm__ __volatile__(
+ "0: \n\t"
+ "lwarx %[prev],0,%[ptr] \n\t"
+ "cmpw 0,%[prev],%[old_value] \n\t"
+ "bne- 1f \n\t"
+ "stwcx. %[new_value],0,%[ptr] \n\t"
+ "bne- 0b \n\t"
+ "1: \n\t"
+ : [prev] "=&r"(prev), "+m"(*ptr)
+ : [ptr] "r"(ptr), [old_value] "r"(old_value), [new_value] "r"(new_value)
+ : "cc", "memory");
+
+ return prev;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32 *ptr,
+ Atomic32 new_value) {
+ Atomic32 old;
+
+ __asm__ __volatile__(
+ "0: \n\t"
+ "lwarx %[old],0,%[ptr] \n\t"
+ "stwcx. %[new_value],0,%[ptr] \n\t"
+ "bne- 0b \n\t"
+ : [old] "=&r"(old), "+m"(*ptr)
+ : [ptr] "r"(ptr), [new_value] "r"(new_value)
+ : "cc", "memory");
+
+ return old;
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr,
+ Atomic32 increment) {
+ Atomic32 temp;
+
+ __asm__ __volatile__(
+ "0: \n\t"
+ "lwarx %[temp],0,%[ptr] \n\t"
+ "add %[temp],%[increment],%[temp] \n\t"
+ "stwcx. %[temp],0,%[ptr] \n\t"
+ "bne- 0b \n\t"
+ : [temp] "=&r"(temp)
+ : [increment] "r"(increment), [ptr] "r"(ptr)
+ : "cc", "memory");
+
+ return temp;
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32 *ptr,
+ Atomic32 increment) {
+ MemoryBarrierInternal();
+ Atomic32 res = NoBarrier_AtomicIncrement(ptr, increment);
+ MemoryBarrierInternal();
+ return res;
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32 *ptr,
+ Atomic32 old_value, Atomic32 new_value) {
+ Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ MemoryBarrierInternal();
+ return res;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32 *ptr,
+ Atomic32 old_value, Atomic32 new_value) {
+ MemoryBarrierInternal();
+ Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ return res;
+}
+
+inline void NoBarrier_Store(volatile Atomic32 *ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+inline void MemoryBarrierInternal() { __asm__ __volatile__("sync" : : : "memory"); }
+
+inline void Acquire_Store(volatile Atomic32 *ptr, Atomic32 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic32 *ptr, Atomic32 value) {
+ MemoryBarrierInternal();
+ *ptr = value;
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32 *ptr) { return *ptr; }
+
+inline Atomic32 Acquire_Load(volatile const Atomic32 *ptr) {
+ Atomic32 value = *ptr;
+ MemoryBarrierInternal();
+ return value;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32 *ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#undef ATOMICOPS_COMPILER_BARRIER
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PPC_GCC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_solaris.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_solaris.h
new file mode 100644
index 0000000000..baecb993bc
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_solaris.h
@@ -0,0 +1,188 @@
+// Copyright 2014 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_SPARC_GCC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_SPARC_GCC_H_
+
+#include <atomic.h>
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ return (Atomic32)atomic_cas_32((volatile uint32_t*)ptr, (uint32_t)old_value, (uint32_t)new_value);
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ return (Atomic32)atomic_swap_32((volatile uint32_t*)ptr, (uint32_t)new_value);
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return (Atomic32)atomic_add_32_nv((volatile uint32_t*)ptr, (uint32_t)increment);
+}
+
+inline void MemoryBarrierInternal(void) {
+ membar_producer();
+ membar_consumer();
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ MemoryBarrierInternal();
+ Atomic32 ret = NoBarrier_AtomicIncrement(ptr, increment);
+ MemoryBarrierInternal();
+
+ return ret;
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ MemoryBarrierInternal();
+
+ return ret;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ MemoryBarrierInternal();
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+ membar_producer();
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ membar_consumer();
+ *ptr = value;
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return *ptr;
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ Atomic32 val = *ptr;
+ membar_consumer();
+ return val;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ membar_producer();
+ return *ptr;
+}
+
+#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ return atomic_cas_64((volatile uint64_t*)ptr, (uint64_t)old_value, (uint64_t)new_value);
+}
+
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value) {
+ return atomic_swap_64((volatile uint64_t*)ptr, (uint64_t)new_value);
+}
+
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) {
+ return atomic_add_64_nv((volatile uint64_t*)ptr, increment);
+}
+
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) {
+ MemoryBarrierInternal();
+ Atomic64 ret = atomic_add_64_nv((volatile uint64_t*)ptr, increment);
+ MemoryBarrierInternal();
+ return ret;
+}
+
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ MemoryBarrierInternal();
+ return ret;
+}
+
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ MemoryBarrierInternal();
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+ membar_producer();
+}
+
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
+ membar_consumer();
+ *ptr = value;
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
+ return *ptr;
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
+ Atomic64 ret = *ptr;
+ membar_consumer();
+ return ret;
+}
+
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
+ membar_producer();
+ return *ptr;
+}
+#endif
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_SPARC_GCC_H_
+
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_tsan.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_tsan.h
new file mode 100644
index 0000000000..676380b1d5
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_tsan.h
@@ -0,0 +1,219 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2013 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 an internal atomic implementation for compiler-based
+// ThreadSanitizer (http://clang.llvm.org/docs/ThreadSanitizer.html).
+// Use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_TSAN_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_TSAN_H_
+
+#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
+
+#include <sanitizer/tsan_interface_atomic.h>
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32 *ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 cmp = old_value;
+ __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value,
+ __tsan_memory_order_relaxed, __tsan_memory_order_relaxed);
+ return cmp;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32 *ptr,
+ Atomic32 new_value) {
+ return __tsan_atomic32_exchange(ptr, new_value,
+ __tsan_memory_order_relaxed);
+}
+
+inline Atomic32 Acquire_AtomicExchange(volatile Atomic32 *ptr,
+ Atomic32 new_value) {
+ return __tsan_atomic32_exchange(ptr, new_value,
+ __tsan_memory_order_acquire);
+}
+
+inline Atomic32 Release_AtomicExchange(volatile Atomic32 *ptr,
+ Atomic32 new_value) {
+ return __tsan_atomic32_exchange(ptr, new_value,
+ __tsan_memory_order_release);
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr,
+ Atomic32 increment) {
+ return increment + __tsan_atomic32_fetch_add(ptr, increment,
+ __tsan_memory_order_relaxed);
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32 *ptr,
+ Atomic32 increment) {
+ return increment + __tsan_atomic32_fetch_add(ptr, increment,
+ __tsan_memory_order_acq_rel);
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32 *ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 cmp = old_value;
+ __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value,
+ __tsan_memory_order_acquire, __tsan_memory_order_acquire);
+ return cmp;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32 *ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 cmp = old_value;
+ __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value,
+ __tsan_memory_order_release, __tsan_memory_order_relaxed);
+ return cmp;
+}
+
+inline void NoBarrier_Store(volatile Atomic32 *ptr, Atomic32 value) {
+ __tsan_atomic32_store(ptr, value, __tsan_memory_order_relaxed);
+}
+
+inline void Acquire_Store(volatile Atomic32 *ptr, Atomic32 value) {
+ __tsan_atomic32_store(ptr, value, __tsan_memory_order_relaxed);
+ __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
+}
+
+inline void Release_Store(volatile Atomic32 *ptr, Atomic32 value) {
+ __tsan_atomic32_store(ptr, value, __tsan_memory_order_release);
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32 *ptr) {
+ return __tsan_atomic32_load(ptr, __tsan_memory_order_relaxed);
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32 *ptr) {
+ return __tsan_atomic32_load(ptr, __tsan_memory_order_acquire);
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32 *ptr) {
+ __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
+ return __tsan_atomic32_load(ptr, __tsan_memory_order_relaxed);
+}
+
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64 *ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 cmp = old_value;
+ __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value,
+ __tsan_memory_order_relaxed, __tsan_memory_order_relaxed);
+ return cmp;
+}
+
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64 *ptr,
+ Atomic64 new_value) {
+ return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_relaxed);
+}
+
+inline Atomic64 Acquire_AtomicExchange(volatile Atomic64 *ptr,
+ Atomic64 new_value) {
+ return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_acquire);
+}
+
+inline Atomic64 Release_AtomicExchange(volatile Atomic64 *ptr,
+ Atomic64 new_value) {
+ return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_release);
+}
+
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64 *ptr,
+ Atomic64 increment) {
+ return increment + __tsan_atomic64_fetch_add(ptr, increment,
+ __tsan_memory_order_relaxed);
+}
+
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64 *ptr,
+ Atomic64 increment) {
+ return increment + __tsan_atomic64_fetch_add(ptr, increment,
+ __tsan_memory_order_acq_rel);
+}
+
+inline void NoBarrier_Store(volatile Atomic64 *ptr, Atomic64 value) {
+ __tsan_atomic64_store(ptr, value, __tsan_memory_order_relaxed);
+}
+
+inline void Acquire_Store(volatile Atomic64 *ptr, Atomic64 value) {
+ __tsan_atomic64_store(ptr, value, __tsan_memory_order_relaxed);
+ __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
+}
+
+inline void Release_Store(volatile Atomic64 *ptr, Atomic64 value) {
+ __tsan_atomic64_store(ptr, value, __tsan_memory_order_release);
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64 *ptr) {
+ return __tsan_atomic64_load(ptr, __tsan_memory_order_relaxed);
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64 *ptr) {
+ return __tsan_atomic64_load(ptr, __tsan_memory_order_acquire);
+}
+
+inline Atomic64 Release_Load(volatile const Atomic64 *ptr) {
+ __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
+ return __tsan_atomic64_load(ptr, __tsan_memory_order_relaxed);
+}
+
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64 *ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 cmp = old_value;
+ __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value,
+ __tsan_memory_order_acquire, __tsan_memory_order_acquire);
+ return cmp;
+}
+
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64 *ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 cmp = old_value;
+ __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value,
+ __tsan_memory_order_release, __tsan_memory_order_relaxed);
+ return cmp;
+}
+
+inline void MemoryBarrierInternal() {
+ __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
+}
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#undef ATOMICOPS_COMPILER_BARRIER
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_TSAN_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
new file mode 100644
index 0000000000..53c9eae0fa
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
@@ -0,0 +1,137 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 module gets enough CPU information to optimize the
+// atomicops module on x86.
+
+#include <cstring>
+
+#include <google/protobuf/stubs/atomicops.h>
+
+// This file only makes sense with atomicops_internals_x86_gcc.h -- it
+// depends on structs that are defined in that file. If atomicops.h
+// doesn't sub-include that file, then we aren't needed, and shouldn't
+// try to do anything.
+#ifdef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_
+
+// Inline cpuid instruction. In PIC compilations, %ebx contains the address
+// of the global offset table. To avoid breaking such executables, this code
+// must preserve that register's value across cpuid instructions.
+#if defined(__i386__)
+#define cpuid(a, b, c, d, inp) \
+ asm("mov %%ebx, %%edi\n" \
+ "cpuid\n" \
+ "xchg %%edi, %%ebx\n" \
+ : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
+#elif defined(__x86_64__)
+#define cpuid(a, b, c, d, inp) \
+ asm("mov %%rbx, %%rdi\n" \
+ "cpuid\n" \
+ "xchg %%rdi, %%rbx\n" \
+ : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
+#endif
+
+#if defined(cpuid) // initialize the struct only on x86
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+// Set the flags so that code will run correctly and conservatively, so even
+// if we haven't been initialized yet, we're probably single threaded, and our
+// default values should hopefully be pretty safe.
+struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures = {
+ false, // bug can't exist before process spawns multiple threads
+ false, // no SSE2
+};
+
+namespace {
+
+// Initialize the AtomicOps_Internalx86CPUFeatures struct.
+void AtomicOps_Internalx86CPUFeaturesInit() {
+ uint32_t eax;
+ uint32_t ebx;
+ uint32_t ecx;
+ uint32_t edx;
+
+ // Get vendor string (issue CPUID with eax = 0)
+ cpuid(eax, ebx, ecx, edx, 0);
+ char vendor[13];
+ memcpy(vendor, &ebx, 4);
+ memcpy(vendor + 4, &edx, 4);
+ memcpy(vendor + 8, &ecx, 4);
+ vendor[12] = 0;
+
+ // get feature flags in ecx/edx, and family/model in eax
+ cpuid(eax, ebx, ecx, edx, 1);
+
+ int family = (eax >> 8) & 0xf; // family and model fields
+ int model = (eax >> 4) & 0xf;
+ if (family == 0xf) { // use extended family and model fields
+ family += (eax >> 20) & 0xff;
+ model += ((eax >> 16) & 0xf) << 4;
+ }
+
+ // Opteron Rev E has a bug in which on very rare occasions a locked
+ // instruction doesn't act as a read-acquire barrier if followed by a
+ // non-locked read-modify-write instruction. Rev F has this bug in
+ // pre-release versions, but not in versions released to customers,
+ // so we test only for Rev E, which is family 15, model 32..63 inclusive.
+ if (strcmp(vendor, "AuthenticAMD") == 0 && // AMD
+ family == 15 &&
+ 32 <= model && model <= 63) {
+ AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = true;
+ } else {
+ AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false;
+ }
+
+ // edx bit 26 is SSE2 which we use to tell use whether we can use mfence
+ AtomicOps_Internalx86CPUFeatures.has_sse2 = ((edx >> 26) & 1);
+}
+
+class AtomicOpsx86Initializer {
+ public:
+ AtomicOpsx86Initializer() {
+ AtomicOps_Internalx86CPUFeaturesInit();
+ }
+};
+
+// A global to get use initialized on startup via static initialization :/
+AtomicOpsx86Initializer g_initer;
+
+} // namespace
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // __i386__
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h
new file mode 100644
index 0000000000..e80121fdf8
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h
@@ -0,0 +1,293 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+// This struct is not part of the public API of this module; clients may not
+// use it.
+// Features of this x86. Values may not be correct before main() is run,
+// but are set conservatively.
+struct AtomicOps_x86CPUFeatureStruct {
+ bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence
+ // after acquire compare-and-swap.
+ bool has_sse2; // Processor has SSE2.
+};
+extern struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures;
+
+#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
+
+// 32-bit low-level operations on any platform.
+
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 prev;
+ __asm__ __volatile__("lock; cmpxchgl %1,%2"
+ : "=a" (prev)
+ : "q" (new_value), "m" (*ptr), "0" (old_value)
+ : "memory");
+ return prev;
+}
+
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ __asm__ __volatile__("xchgl %1,%0" // The lock prefix is implicit for xchg.
+ : "=r" (new_value)
+ : "m" (*ptr), "0" (new_value)
+ : "memory");
+ return new_value; // Now it's the previous value.
+}
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ Atomic32 temp = increment;
+ __asm__ __volatile__("lock; xaddl %0,%1"
+ : "+r" (temp), "+m" (*ptr)
+ : : "memory");
+ // temp now holds the old value of *ptr
+ return temp + increment;
+}
+
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ Atomic32 temp = increment;
+ __asm__ __volatile__("lock; xaddl %0,%1"
+ : "+r" (temp), "+m" (*ptr)
+ : : "memory");
+ // temp now holds the old value of *ptr
+ if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
+ __asm__ __volatile__("lfence" : : : "memory");
+ }
+ return temp + increment;
+}
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ Atomic32 x = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
+ __asm__ __volatile__("lfence" : : : "memory");
+ }
+ return x;
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+#if defined(__x86_64__)
+
+// 64-bit implementations of memory barrier can be simpler, because it
+// "mfence" is guaranteed to exist.
+inline void MemoryBarrierInternal() {
+ __asm__ __volatile__("mfence" : : : "memory");
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+#else
+
+inline void MemoryBarrierInternal() {
+ if (AtomicOps_Internalx86CPUFeatures.has_sse2) {
+ __asm__ __volatile__("mfence" : : : "memory");
+ } else { // mfence is faster but not present on PIII
+ Atomic32 x = 0;
+ NoBarrier_AtomicExchange(&x, 0); // acts as a barrier on PIII
+ }
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ if (AtomicOps_Internalx86CPUFeatures.has_sse2) {
+ *ptr = value;
+ __asm__ __volatile__("mfence" : : : "memory");
+ } else {
+ NoBarrier_AtomicExchange(ptr, value);
+ // acts as a barrier on PIII
+ }
+}
+#endif
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ ATOMICOPS_COMPILER_BARRIER();
+ *ptr = value; // An x86 store acts as a release barrier.
+ // See comments in Atomic64 version of Release_Store(), below.
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return *ptr;
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ Atomic32 value = *ptr; // An x86 load acts as a acquire barrier.
+ // See comments in Atomic64 version of Release_Store(), below.
+ ATOMICOPS_COMPILER_BARRIER();
+ return value;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+#if defined(__x86_64__)
+
+// 64-bit low-level operations on 64-bit platform.
+
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 prev;
+ __asm__ __volatile__("lock; cmpxchgq %1,%2"
+ : "=a" (prev)
+ : "q" (new_value), "m" (*ptr), "0" (old_value)
+ : "memory");
+ return prev;
+}
+
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
+ Atomic64 new_value) {
+ __asm__ __volatile__("xchgq %1,%0" // The lock prefix is implicit for xchg.
+ : "=r" (new_value)
+ : "m" (*ptr), "0" (new_value)
+ : "memory");
+ return new_value; // Now it's the previous value.
+}
+
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ Atomic64 temp = increment;
+ __asm__ __volatile__("lock; xaddq %0,%1"
+ : "+r" (temp), "+m" (*ptr)
+ : : "memory");
+ // temp now contains the previous value of *ptr
+ return temp + increment;
+}
+
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ Atomic64 temp = increment;
+ __asm__ __volatile__("lock; xaddq %0,%1"
+ : "+r" (temp), "+m" (*ptr)
+ : : "memory");
+ // temp now contains the previous value of *ptr
+ if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
+ __asm__ __volatile__("lfence" : : : "memory");
+ }
+ return temp + increment;
+}
+
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+ MemoryBarrierInternal();
+}
+
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
+ ATOMICOPS_COMPILER_BARRIER();
+
+ *ptr = value; // An x86 store acts as a release barrier
+ // for current AMD/Intel chips as of Jan 2008.
+ // See also Acquire_Load(), below.
+
+ // When new chips come out, check:
+ // IA-32 Intel Architecture Software Developer's Manual, Volume 3:
+ // System Programming Guide, Chatper 7: Multiple-processor management,
+ // Section 7.2, Memory Ordering.
+ // Last seen at:
+ // http://developer.intel.com/design/pentium4/manuals/index_new.htm
+ //
+ // x86 stores/loads fail to act as barriers for a few instructions (clflush
+ // maskmovdqu maskmovq movntdq movnti movntpd movntps movntq) but these are
+ // not generated by the compiler, and are rare. Users of these instructions
+ // need to know about cache behaviour in any case since all of these involve
+ // either flushing cache lines or non-temporal cache hints.
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
+ return *ptr;
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
+ Atomic64 value = *ptr; // An x86 load acts as a acquire barrier,
+ // for current AMD/Intel chips as of Jan 2008.
+ // See also Release_Store(), above.
+ ATOMICOPS_COMPILER_BARRIER();
+ return value;
+}
+
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ Atomic64 x = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+ if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
+ __asm__ __volatile__("lfence" : : : "memory");
+ }
+ return x;
+}
+
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+#endif // defined(__x86_64__)
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#undef ATOMICOPS_COMPILER_BARRIER
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
new file mode 100644
index 0000000000..74a1bd4e06
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
@@ -0,0 +1,113 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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.
+
+// The compilation of extension_set.cc fails when windows.h is included.
+// Therefore we move the code depending on windows.h to this separate cc file.
+
+// Don't compile this file for people not concerned about thread safety.
+#ifndef GOOGLE_PROTOBUF_NO_THREAD_SAFETY
+
+#include <google/protobuf/stubs/atomicops.h>
+
+#ifdef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_MSVC_H_
+
+#include <windows.h>
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline void MemoryBarrierInternal() {
+ // On ARM this is a define while on x86/x64 this is
+ // a function declared in WinNT.h
+ MemoryBarrier();
+}
+
+Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ LONG result = InterlockedCompareExchange(
+ reinterpret_cast<volatile LONG*>(ptr),
+ static_cast<LONG>(new_value),
+ static_cast<LONG>(old_value));
+ return static_cast<Atomic32>(result);
+}
+
+Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
+ Atomic32 new_value) {
+ LONG result = InterlockedExchange(
+ reinterpret_cast<volatile LONG*>(ptr),
+ static_cast<LONG>(new_value));
+ return static_cast<Atomic32>(result);
+}
+
+Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return InterlockedExchangeAdd(
+ reinterpret_cast<volatile LONG*>(ptr),
+ static_cast<LONG>(increment)) + increment;
+}
+
+#if defined(_WIN64)
+
+// 64-bit low-level operations on 64-bit platform.
+
+Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ PVOID result = InterlockedCompareExchangePointer(
+ reinterpret_cast<volatile PVOID*>(ptr),
+ reinterpret_cast<PVOID>(new_value), reinterpret_cast<PVOID>(old_value));
+ return reinterpret_cast<Atomic64>(result);
+}
+
+Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
+ Atomic64 new_value) {
+ PVOID result = InterlockedExchangePointer(
+ reinterpret_cast<volatile PVOID*>(ptr),
+ reinterpret_cast<PVOID>(new_value));
+ return reinterpret_cast<Atomic64>(result);
+}
+
+Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ return InterlockedExchangeAdd64(
+ reinterpret_cast<volatile LONGLONG*>(ptr),
+ static_cast<LONGLONG>(increment)) + increment;
+}
+
+#endif // defined(_WIN64)
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_MSVC_H_
+#endif // GOOGLE_PROTOBUF_NO_THREAD_SAFETY
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h
new file mode 100644
index 0000000000..34d60d98e0
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h
@@ -0,0 +1,150 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2012 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 an internal atomic implementation, use atomicops.h instead.
+
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_MSVC_H_
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_MSVC_H_
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
+ Atomic32 increment) {
+ return Barrier_AtomicIncrement(ptr, increment);
+}
+
+#if !(defined(_MSC_VER) && _MSC_VER >= 1400)
+#error "We require at least vs2005 for MemoryBarrier"
+#endif
+
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
+ NoBarrier_AtomicExchange(ptr, value);
+ // acts as a barrier in this implementation
+}
+
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
+ *ptr = value; // works w/o barrier for current Intel chips as of June 2005
+ // See comments in Atomic64 version of Release_Store() below.
+}
+
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
+ return *ptr;
+}
+
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
+ Atomic32 value = *ptr;
+ return value;
+}
+
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+#if defined(_WIN64)
+
+// 64-bit low-level operations on 64-bit platform.
+
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
+ Atomic64 increment) {
+ return Barrier_AtomicIncrement(ptr, increment);
+}
+
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value;
+}
+
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
+ NoBarrier_AtomicExchange(ptr, value);
+ // acts as a barrier in this implementation
+}
+
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
+ *ptr = value; // works w/o barrier for current Intel chips as of June 2005
+
+ // When new chips come out, check:
+ // IA-32 Intel Architecture Software Developer's Manual, Volume 3:
+ // System Programming Guide, Chatper 7: Multiple-processor management,
+ // Section 7.2, Memory Ordering.
+ // Last seen at:
+ // http://developer.intel.com/design/pentium4/manuals/index_new.htm
+}
+
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
+ return *ptr;
+}
+
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
+ Atomic64 value = *ptr;
+ return value;
+}
+
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
+ MemoryBarrierInternal();
+ return *ptr;
+}
+
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
+}
+
+#endif // defined(_WIN64)
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_MSVC_H_
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream.cc
index f4af6a50ab..f4af6a50ab 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream.h
index 86510d140b..86510d140b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream_unittest.cc
index 06f114abc7..06f114abc7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/bytestream_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/bytestream_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/callback.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/callback.h
index 6888f136dd..9ec0497955 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/callback.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/callback.h
@@ -1,9 +1,8 @@
#ifndef GOOGLE_PROTOBUF_STUBS_CALLBACK_H_
#define GOOGLE_PROTOBUF_STUBS_CALLBACK_H_
-#include <type_traits>
-
#include <google/protobuf/stubs/macros.h>
+#include <google/protobuf/stubs/type_traits.h>
// ===================================================================
// emulates google3/base/callback.h
@@ -343,7 +342,7 @@ class FunctionResultCallback_1_1 : public ResultCallback1<R, A1> {
template <typename T>
struct InternalConstRef {
- typedef typename std::remove_reference<T>::type base_type;
+ typedef typename remove_reference<T>::type base_type;
typedef const base_type& type;
};
@@ -398,11 +397,11 @@ class MethodResultCallback_5_2 : public ResultCallback2<R, A1, A2> {
T* object_;
MethodType method_;
bool self_deleting_;
- typename std::remove_reference<P1>::type p1_;
- typename std::remove_reference<P2>::type p2_;
- typename std::remove_reference<P3>::type p3_;
- typename std::remove_reference<P4>::type p4_;
- typename std::remove_reference<P5>::type p5_;
+ typename remove_reference<P1>::type p1_;
+ typename remove_reference<P2>::type p2_;
+ typename remove_reference<P3>::type p3_;
+ typename remove_reference<P4>::type p4_;
+ typename remove_reference<P5>::type p5_;
};
} // namespace internal
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/casts.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/casts.h
index 35e2dba058..be652849ef 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/casts.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/casts.h
@@ -31,9 +31,8 @@
#ifndef GOOGLE_PROTOBUF_CASTS_H__
#define GOOGLE_PROTOBUF_CASTS_H__
-#include <type_traits>
-
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/type_traits.h>
namespace google {
namespace protobuf {
@@ -96,7 +95,7 @@ inline To down_cast(From* f) { // so we only accept pointers
template<typename To, typename From> // use like this: down_cast<T&>(foo);
inline To down_cast(From& f) {
- typedef typename std::remove_reference<To>::type* ToAsPointer;
+ typedef typename remove_reference<To>::type* ToAsPointer;
// Ensures that To is a sub-type of From *. This test is here only
// for compile-time type checking, and has no overhead in an
// optimized build at run-time, as it will be optimized away
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/common.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/common.cc
index 33d24c57cb..73822168b6 100644..100755
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/common.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/common.cc
@@ -314,6 +314,86 @@ namespace internal { FunctionClosure0::~FunctionClosure0() {} }
void DoNothing() {}
// ===================================================================
+// emulates google3/base/mutex.cc
+
+#ifdef _WIN32
+
+struct Mutex::Internal {
+ CRITICAL_SECTION mutex;
+#ifndef NDEBUG
+ // Used only to implement AssertHeld().
+ DWORD thread_id;
+#endif
+};
+
+Mutex::Mutex()
+ : mInternal(new Internal) {
+ InitializeCriticalSection(&mInternal->mutex);
+}
+
+Mutex::~Mutex() {
+ DeleteCriticalSection(&mInternal->mutex);
+ delete mInternal;
+}
+
+void Mutex::Lock() {
+ EnterCriticalSection(&mInternal->mutex);
+#ifndef NDEBUG
+ mInternal->thread_id = GetCurrentThreadId();
+#endif
+}
+
+void Mutex::Unlock() {
+#ifndef NDEBUG
+ mInternal->thread_id = 0;
+#endif
+ LeaveCriticalSection(&mInternal->mutex);
+}
+
+void Mutex::AssertHeld() {
+#ifndef NDEBUG
+ GOOGLE_DCHECK_EQ(mInternal->thread_id, GetCurrentThreadId());
+#endif
+}
+
+#elif defined(HAVE_PTHREAD)
+
+struct Mutex::Internal {
+ pthread_mutex_t mutex;
+};
+
+Mutex::Mutex()
+ : mInternal(new Internal) {
+ pthread_mutex_init(&mInternal->mutex, NULL);
+}
+
+Mutex::~Mutex() {
+ pthread_mutex_destroy(&mInternal->mutex);
+ delete mInternal;
+}
+
+void Mutex::Lock() {
+ int result = pthread_mutex_lock(&mInternal->mutex);
+ if (result != 0) {
+ GOOGLE_LOG(FATAL) << "pthread_mutex_lock: " << strerror(result);
+ }
+}
+
+void Mutex::Unlock() {
+ int result = pthread_mutex_unlock(&mInternal->mutex);
+ if (result != 0) {
+ GOOGLE_LOG(FATAL) << "pthread_mutex_unlock: " << strerror(result);
+ }
+}
+
+void Mutex::AssertHeld() {
+ // pthreads dosn't provide a way to check which thread holds the mutex.
+ // TODO(kenton): Maybe keep track of locking thread ID like with WIN32?
+}
+
+#endif
+
+// ===================================================================
// emulates google3/util/endian/endian.h
//
// TODO(xiaofeng): PROTOBUF_LITTLE_ENDIAN is unfortunately defined in
@@ -350,9 +430,9 @@ struct ShutdownData {
}
}
- std::vector<void (*)()> functions;
- std::vector<const std::string*> strings;
- std::vector<const MessageLite*> messages;
+ vector<void (*)()> functions;
+ vector<const std::string*> strings;
+ vector<const MessageLite*> messages;
Mutex mutex;
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/common.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/common.h
index 5d320764d8..ff36348292 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/common.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/common.h
@@ -38,7 +38,6 @@
#include <algorithm>
#include <iostream>
#include <map>
-#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -49,6 +48,7 @@
// TODO(liujisi): Remove the following includes after the include clean-up.
#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/scoped_ptr.h>
#include <google/protobuf/stubs/mutex.h>
#include <google/protobuf/stubs/callback.h>
@@ -101,27 +101,27 @@ namespace internal {
// The current version, represented as a single integer to make comparison
// easier: major * 10^6 + minor * 10^3 + micro
-#define GOOGLE_PROTOBUF_VERSION 3006000
+#define GOOGLE_PROTOBUF_VERSION 3004000
// A suffix string for alpha, beta or rc releases. Empty for stable releases.
#define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
// The minimum library version which works with the current version of the
// headers.
-#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3006000
+#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3004000
// The minimum header version which works with the current version of
// the library. This constant should only be used by protoc's C++ code
// generator.
-static const int kMinHeaderVersionForLibrary = 3006000;
+static const int kMinHeaderVersionForLibrary = 3004000;
// The minimum protoc version which works with the current version of the
// headers.
-#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3006000
+#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3004000
// The minimum header version which works with the current version of
// protoc. This constant should only be used in VerifyVersion().
-static const int kMinHeaderVersionForProtoc = 3006000;
+static const int kMinHeaderVersionForProtoc = 3004000;
// Verifies that the headers and libraries are compatible. Use the macro
// below to call this.
@@ -229,7 +229,12 @@ class FatalException : public std::exception {
// This is at the end of the file instead of the beginning to work around a bug
// in some versions of MSVC.
+// TODO(acozzette): remove these using statements
+using std::istream;
+using std::ostream;
+using std::pair;
using std::string;
+using std::vector;
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/common_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/common_unittest.cc
index 798a2a27f1..f9e2cfd437 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/common_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/common_unittest.cc
@@ -75,7 +75,7 @@ TEST(CommonTest, IntMinMaxConstants) {
EXPECT_EQ(0, kuint64max + 1);
}
-std::vector<string> captured_messages_;
+vector<string> captured_messages_;
void CaptureLog(LogLevel level, const char* filename, int line,
const string& message) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/fastmem.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/fastmem.h
index 1f1f6ed3df..1f1f6ed3df 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/fastmem.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/fastmem.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/hash.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/hash.h
index fd8ba156ae..612b5861cc 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/hash.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/hash.h
@@ -93,10 +93,10 @@
# endif
// GCC <= 4.1 does not define std::tr1::hash for `long long int` or `long long unsigned int`
-# if __GNUC__ == 4 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ <= 1
-# undef GOOGLE_PROTOBUF_HAS_TR1
-# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP
-# undef GOOGLE_PROTOBUF_HAVE_HASH_SET
+# if __GNUC__ == 4 && __GNUC__MINOR__ <= 1
+# define GOOGLE_PROTOBUF_MISSING_HASH
+# include <map>
+# include <set>
# endif
// Version checks for MSC.
@@ -235,8 +235,7 @@ class hash_set : public std::set<Key, HashFcn> {
HashFcn hash_function() const { return HashFcn(); }
};
-#elif defined(_MSC_VER) && !defined(_STLPORT_VERSION) && \
- !(defined(_LIBCPP_STD_VER) && _LIBCPP_STD_VER >= 11)
+#elif defined(_MSC_VER) && !defined(_STLPORT_VERSION)
template <typename Key>
struct hash : public GOOGLE_PROTOBUF_HASH_COMPARE<Key> {
@@ -409,8 +408,8 @@ struct hash<string> {
};
template <typename First, typename Second>
-struct hash<std::pair<First, Second> > {
- inline size_t operator()(const std::pair<First, Second>& key) const {
+struct hash<pair<First, Second> > {
+ inline size_t operator()(const pair<First, Second>& key) const {
size_t first_hash = hash<First>()(key.first);
size_t second_hash = hash<Second>()(key.second);
@@ -421,8 +420,8 @@ struct hash<std::pair<First, Second> > {
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
- inline bool operator()(const std::pair<First, Second>& a,
- const std::pair<First, Second>& b) const {
+ inline bool operator()(const pair<First, Second>& a,
+ const pair<First, Second>& b) const {
return a < b;
}
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128.cc
index a509080148..a509080148 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128.h
index 1499bb76d5..1499bb76d5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128_unittest.cc
index 1ec899ad7b..1ec899ad7b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/int128_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/int128_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32.cc
index 4407facb40..b418986bce 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32.cc
@@ -30,17 +30,16 @@
// Author: laszlocsomor@google.com (Laszlo Csomor)
//
-// Implementation for long-path-aware open/mkdir/access/etc. on Windows, as well
-// as for the supporting utility functions.
+// Implementation for long-path-aware open/mkdir/etc. on Windows.
//
// These functions convert the input path to an absolute Windows path
-// with "\\?\" prefix, then pass that to _wopen/_wmkdir/_waccess/etc.
+// with "\\?\" prefix if necessary, then pass that to _wopen/_wmkdir/etc.
// (declared in <io.h>) respectively. This allows working with files/directories
// whose paths are longer than MAX_PATH (260 chars).
//
// This file is only used on Windows, it's empty on other platforms.
-#if defined(_WIN32)
+#if defined(_MSC_VER)
// Comment this out to fall back to using the ANSI versions (open, mkdir, ...)
// instead of the Unicode ones (_wopen, _wmkdir, ...). Doing so can be useful to
@@ -52,7 +51,6 @@
#include <errno.h>
#include <fcntl.h>
#include <io.h>
-#include <memory>
#include <sys/stat.h>
#include <sys/types.h>
#include <wctype.h>
@@ -60,6 +58,7 @@
#include <google/protobuf/stubs/io_win32.h>
+#include <cassert>
#include <memory>
#include <sstream>
#include <string>
@@ -72,6 +71,7 @@ namespace win32 {
namespace {
using std::string;
+using std::unique_ptr;
using std::wstring;
template <typename char_type>
@@ -89,11 +89,6 @@ struct CharTraits<wchar_t> {
static bool is_alpha(wchar_t ch) { return iswalpha(ch); }
};
-template <typename char_type>
-bool null_or_empty(const char_type* s) {
- return s == NULL || *s == 0;
-}
-
// Returns true if the path starts with a drive letter, e.g. "c:".
// Note that this won't check for the "\" after the drive letter, so this also
// returns true for "c:foo" (which is "c:\${PWD}\foo").
@@ -126,7 +121,16 @@ bool is_drive_relative(const char_type* path) {
return has_drive_letter(path) && (path[2] == 0 || !is_separator(path[2]));
}
-wstring join_paths(const wstring& path1, const wstring& path2) {
+template <typename char_type>
+void replace_directory_separators(char_type* p) {
+ for (; *p; ++p) {
+ if (*p == '/') {
+ *p = '\\';
+ }
+ }
+}
+
+string join_paths(const string& path1, const string& path2) {
if (path1.empty() || is_path_absolute(path2.c_str()) ||
has_longpath_prefix(path2.c_str())) {
return path2;
@@ -135,29 +139,28 @@ wstring join_paths(const wstring& path1, const wstring& path2) {
return path1;
}
- if (is_separator(path1[path1.size() - 1])) {
- return is_separator(path2[0]) ? (path1 + path2.substr(1))
+ if (is_separator(path1.back())) {
+ return is_separator(path2.front()) ? (path1 + path2.substr(1))
: (path1 + path2);
} else {
- return is_separator(path2[0]) ? (path1 + path2)
- : (path1 + L'\\' + path2);
+ return is_separator(path2.front()) ? (path1 + path2)
+ : (path1 + '\\' + path2);
}
}
-wstring normalize(wstring path) {
+string normalize(string path) {
if (has_longpath_prefix(path.c_str())) {
path = path.substr(4);
}
- static const wstring dot(L".");
- static const wstring dotdot(L"..");
- const WCHAR* p = path.c_str();
+ static const string dot(".");
+ static const string dotdot("..");
- std::vector<wstring> segments;
+ std::vector<string> segments;
int segment_start = -1;
// Find the path segments in `path` (separated by "/").
for (int i = 0;; ++i) {
- if (!is_separator(p[i]) && p[i] != L'\0') {
+ if (!is_separator(path[i]) && path[i] != '\0') {
// The current character does not end a segment, so start one unless it's
// already started.
if (segment_start < 0) {
@@ -166,7 +169,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(p, segment_start, i - segment_start);
+ string segment(path, segment_start, i - segment_start);
segment_start = -1;
if (segment == dotdot) {
if (!segments.empty() &&
@@ -177,7 +180,7 @@ wstring normalize(wstring path) {
segments.push_back(segment);
}
}
- if (p[i] == L'\0') {
+ if (path[i] == '\0') {
break;
}
}
@@ -186,62 +189,64 @@ wstring normalize(wstring path) {
// form of it, e.g. "c:\..").
if (segments.size() == 1 && segments[0].size() == 2 &&
has_drive_letter(segments[0].c_str())) {
- return segments[0] + L'\\';
+ return segments[0] + '\\';
}
// Join all segments.
bool first = true;
- std::wstringstream result;
- for (int i = 0; i < segments.size(); ++i) {
+ std::ostringstream result;
+ for (const auto& s : segments) {
if (!first) {
- result << L'\\';
+ result << '\\';
}
first = false;
- result << segments[i];
+ result << s;
}
// Preserve trailing separator if the input contained it.
- if (!path.empty() && is_separator(p[path.size() - 1])) {
- result << L'\\';
+ if (is_separator(path.back())) {
+ result << '\\';
}
return result.str();
}
-bool as_windows_path(const char* path, wstring* result) {
- if (null_or_empty(path)) {
+std::unique_ptr<WCHAR[]> as_wstring(const string& s) {
+ int len = ::MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s.size(), NULL, 0);
+ std::unique_ptr<WCHAR[]> result(new WCHAR[len + 1]);
+ ::MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s.size(), result.get(), len + 1);
+ result.get()[len] = 0;
+ return std::move(result);
+}
+
+wstring as_wchar_path(const string& path) {
+ std::unique_ptr<WCHAR[]> wbuf(as_wstring(path));
+ replace_directory_separators(wbuf.get());
+ return wstring(wbuf.get());
+}
+
+bool as_windows_path(const string& path, wstring* result) {
+ if (path.empty()) {
result->clear();
return true;
}
- wstring wpath;
- if (!strings::utf8_to_wcs(path, &wpath)) {
- return false;
- }
- if (has_longpath_prefix(wpath.c_str())) {
- *result = wpath;
- return true;
- }
- if (is_separator(path[0]) || is_drive_relative(path)) {
+ if (is_separator(path[0]) || is_drive_relative(path.c_str())) {
return false;
}
-
- if (!is_path_absolute(wpath.c_str())) {
- int size = ::GetCurrentDirectoryW(0, NULL);
- if (size == 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- return false;
- }
- std::unique_ptr<WCHAR[]> wcwd(new WCHAR[size]);
- ::GetCurrentDirectoryW(size, wcwd.get());
- wpath = join_paths(wcwd.get(), wpath);
+ string mutable_path = path;
+ if (!is_path_absolute(mutable_path.c_str()) &&
+ !has_longpath_prefix(mutable_path.c_str())) {
+ char cwd[MAX_PATH];
+ ::GetCurrentDirectoryA(MAX_PATH, cwd);
+ mutable_path = join_paths(cwd, mutable_path);
}
- wpath = normalize(wpath);
- if (!has_longpath_prefix(wpath.c_str())) {
+ *result = as_wchar_path(normalize(mutable_path));
+ if (!has_longpath_prefix(result->c_str())) {
// Add the "\\?\" prefix unconditionally. This way we prevent the Win32 API
// from processing the path and "helpfully" removing trailing dots from the
// path, for example.
// See https://github.com/bazelbuild/bazel/issues/2935
- wpath = wstring(L"\\\\?\\") + wpath;
+ *result = wstring(L"\\\\?\\") + *result;
}
- *result = wpath;
return true;
}
@@ -314,21 +319,13 @@ int stat(const char* path, struct _stat* buffer) {
FILE* fopen(const char* path, const char* mode) {
#ifdef SUPPORT_LONGPATHS
- if (null_or_empty(path)) {
- errno = EINVAL;
- return NULL;
- }
wstring wpath;
if (!as_windows_path(path, &wpath)) {
errno = ENOENT;
return NULL;
}
- wstring wmode;
- if (!strings::utf8_to_wcs(mode, &wmode)) {
- errno = EINVAL;
- return NULL;
- }
- return ::_wfopen(wpath.c_str(), wmode.c_str());
+ std::unique_ptr<WCHAR[]> wmode(as_wstring(mode));
+ return ::_wfopen(wpath.c_str(), wmode.get());
#else
return ::fopen(path, mode);
#endif
@@ -350,65 +347,16 @@ int write(int fd, const void* buffer, size_t size) {
return ::_write(fd, buffer, size);
}
-wstring testonly_utf8_to_winpath(const char* path) {
+wstring testonly_path_to_winpath(const string& path) {
wstring wpath;
- return as_windows_path(path, &wpath) ? wpath : wstring();
-}
-
-namespace strings {
-
-bool wcs_to_mbs(const WCHAR* s, string* out, bool outUtf8) {
- if (null_or_empty(s)) {
- out->clear();
- return true;
- }
- BOOL usedDefaultChar = FALSE;
- SetLastError(0);
- int size = WideCharToMultiByte(
- outUtf8 ? CP_UTF8 : CP_ACP, 0, s, -1, NULL, 0, NULL,
- outUtf8 ? NULL : &usedDefaultChar);
- if ((size == 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
- || usedDefaultChar) {
- return false;
- }
- std::unique_ptr<CHAR[]> astr(new CHAR[size]);
- WideCharToMultiByte(
- outUtf8 ? CP_UTF8 : CP_ACP, 0, s, -1, astr.get(), size, NULL, NULL);
- out->assign(astr.get());
- return true;
-}
-
-bool mbs_to_wcs(const char* s, wstring* out, bool inUtf8) {
- if (null_or_empty(s)) {
- out->clear();
- return true;
- }
-
- SetLastError(0);
- int size =
- MultiByteToWideChar(inUtf8 ? CP_UTF8 : CP_ACP, 0, s, -1, NULL, 0);
- if (size == 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- return false;
- }
- std::unique_ptr<WCHAR[]> wstr(new WCHAR[size]);
- MultiByteToWideChar(
- inUtf8 ? CP_UTF8 : CP_ACP, 0, s, -1, wstr.get(), size + 1);
- out->assign(wstr.get());
- return true;
+ as_windows_path(path, &wpath);
+ return wpath;
}
-bool utf8_to_wcs(const char* input, wstring* out) {
- return mbs_to_wcs(input, out, true);
-}
-
-bool wcs_to_utf8(const wchar_t* input, string* out) {
- return wcs_to_mbs(input, out, true);
-}
-
-} // namespace strings
} // namespace win32
} // namespace internal
} // namespace protobuf
} // namespace google
-#endif // defined(_WIN32)
+#endif // defined(_MSC_VER)
+
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32.h
index 9e17d25304..a20e64c716 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32.h
@@ -52,6 +52,7 @@
// Compilers on Windows other than MSVC (e.g. Cygwin, MinGW32) define the
// following functions already, except for mkdir.
+#ifdef _MSC_VER
namespace google {
namespace protobuf {
namespace internal {
@@ -69,30 +70,16 @@ LIBPROTOBUF_EXPORT int read(int fd, void* buffer, size_t size);
LIBPROTOBUF_EXPORT int setmode(int fd, int mode);
LIBPROTOBUF_EXPORT int stat(const char* path, struct _stat* buffer);
LIBPROTOBUF_EXPORT int write(int fd, const void* buffer, size_t size);
-LIBPROTOBUF_EXPORT std::wstring testonly_utf8_to_winpath(const char* path);
-
-namespace strings {
-
-// Convert from UTF-16 to Active-Code-Page-encoded or to UTF-8-encoded text.
-LIBPROTOBUF_EXPORT bool wcs_to_mbs(
- const wchar_t* s, std::string* out, bool outUtf8);
-
-// Convert from Active-Code-Page-encoded or UTF-8-encoded text to UTF-16.
-LIBPROTOBUF_EXPORT bool mbs_to_wcs(
- const char* s, std::wstring* out, bool inUtf8);
-
-// Convert from UTF-8-encoded text to UTF-16.
-LIBPROTOBUF_EXPORT bool utf8_to_wcs(const char* input, std::wstring* out);
-
-// Convert from UTF-16-encoded text to UTF-8.
-LIBPROTOBUF_EXPORT bool wcs_to_utf8(const wchar_t* input, std::string* out);
-
-} // namespace strings
+LIBPROTOBUF_EXPORT std::wstring testonly_path_to_winpath(
+ const std::string& path);
} // namespace win32
} // namespace internal
} // namespace protobuf
} // namespace google
+#else // _MSC_VER
+#define mkdir(name, mode) mkdir(name)
+#endif // !_MSC_VER
#ifndef W_OK
#define W_OK 02 // not defined by MSVC for whatever reason
@@ -113,3 +100,5 @@ LIBPROTOBUF_EXPORT bool wcs_to_utf8(const wchar_t* input, std::string* out);
#endif // defined(_WIN32)
#endif // GOOGLE_PROTOBUF_STUBS_IO_WIN32_H__
+
+
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32_unittest.cc
index c933757c77..90bd9c9601 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/io_win32_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/io_win32_unittest.cc
@@ -30,8 +30,7 @@
// Author: laszlocsomor@google.com (Laszlo Csomor)
//
-// Unit tests for long-path-aware open/mkdir/access/etc. on Windows, as well as
-// for the supporting utility functions.
+// Unit tests for long-path-aware open/mkdir/access on Windows.
//
// This file is only used on Windows, it's empty on other platforms.
@@ -48,6 +47,7 @@
#include <windows.h>
#include <google/protobuf/stubs/io_win32.h>
+#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
#include <memory>
@@ -60,40 +60,19 @@ namespace internal {
namespace win32 {
namespace {
-const char kUtf8Text[] = {
- 'h', 'i', ' ',
- // utf-8: 11010000 10011111, utf-16: 100 0001 1111 = 0x041F
- 0xd0, 0x9f,
- // utf-8: 11010001 10000000, utf-16: 100 0100 0000 = 0x0440
- 0xd1, 0x80,
- // utf-8: 11010000 10111000, utf-16: 100 0011 1000 = 0x0438
- 0xd0, 0xb8,
- // utf-8: 11010000 10110010, utf-16: 100 0011 0010 = 0x0432
- 0xd0, 0xb2,
- // utf-8: 11010000 10110101, utf-16: 100 0011 0101 = 0x0435
- 0xd0, 0xb5,
- // utf-8: 11010001 10000010, utf-16: 100 0100 0010 = 0x0442
- 0xd1, 0x82, 0
-};
-
-const wchar_t kUtf16Text[] = {
- L'h', L'i', L' ',
- L'\x41f', L'\x440', L'\x438', L'\x432', L'\x435', L'\x442', 0
-};
-
using std::string;
+using std::unique_ptr;
using std::wstring;
class IoWin32Test : public ::testing::Test {
public:
- void SetUp();
- void TearDown();
+ void SetUp() override;
+ void TearDown() override;
protected:
bool CreateAllUnder(wstring path);
bool DeleteAllUnder(wstring path);
- WCHAR working_directory[MAX_PATH];
string test_tmpdir;
wstring wtest_tmpdir;
};
@@ -104,94 +83,71 @@ class IoWin32Test : public ::testing::Test {
EXPECT_FALSE(wtest_tmpdir.empty()); \
}
-namespace {
-void StripTrailingSlashes(string* str) {
- int i = str->size() - 1;
- for (; i >= 0 && ((*str)[i] == '/' || (*str)[i] == '\\'); --i) {}
- str->resize(i+1);
-}
-
-bool GetEnvVarAsUtf8(const WCHAR* name, string* result) {
- DWORD size = ::GetEnvironmentVariableW(name, NULL, 0);
- if (size > 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
- std::unique_ptr<WCHAR[]> wcs(new WCHAR[size]);
- ::GetEnvironmentVariableW(name, wcs.get(), size);
- // GetEnvironmentVariableA retrieves an Active-Code-Page-encoded text which
- // we'd first need to convert to UTF-16 then to UTF-8, because there seems
- // to be no API function to do that conversion directly.
- // GetEnvironmentVariableW retrieves an UTF-16-encoded text, which we need
- // to convert to UTF-8.
- return strings::wcs_to_utf8(wcs.get(), result);
- } else {
- return false;
- }
-}
-
-bool GetCwdAsUtf8(string* result) {
- DWORD size = ::GetCurrentDirectoryW(0, NULL);
- if (size > 0) {
- std::unique_ptr<WCHAR[]> wcs(new WCHAR[size]);
- ::GetCurrentDirectoryW(size, wcs.get());
- // GetCurrentDirectoryA retrieves an Active-Code-Page-encoded text which
- // we'd first need to convert to UTF-16 then to UTF-8, because there seems
- // to be no API function to do that conversion directly.
- // GetCurrentDirectoryW retrieves an UTF-16-encoded text, which we need
- // to convert to UTF-8.
- return strings::wcs_to_utf8(wcs.get(), result);
- } else {
- return false;
- }
-}
-
-} // namespace
-
void IoWin32Test::SetUp() {
- test_tmpdir.clear();
+ test_tmpdir = string(TestTempDir());
wtest_tmpdir.clear();
- EXPECT_GT(::GetCurrentDirectoryW(MAX_PATH, working_directory), 0);
+ if (test_tmpdir.empty()) {
+ const char* test_tmpdir_env = getenv("TEST_TMPDIR");
+ if (test_tmpdir_env != nullptr && *test_tmpdir_env) {
+ test_tmpdir = string(test_tmpdir_env);
+ }
- string tmp;
- bool ok = false;
- if (!ok) {
- // Bazel sets this environment variable when it runs tests.
- ok = GetEnvVarAsUtf8(L"TEST_TMPDIR", &tmp);
- }
- if (!ok) {
- // Bazel 0.8.0 sets this environment for every build and test action.
- ok = GetEnvVarAsUtf8(L"TEMP", &tmp);
- }
- if (!ok) {
- // Bazel 0.8.0 sets this environment for every build and test action.
- ok = GetEnvVarAsUtf8(L"TMP", &tmp);
+ // Only Bazel defines TEST_TMPDIR, CMake does not, so look for other
+ // suitable environment variables.
+ if (test_tmpdir.empty()) {
+ for (const char* name : {"TEMP", "TMP"}) {
+ test_tmpdir_env = getenv(name);
+ if (test_tmpdir_env != nullptr && *test_tmpdir_env) {
+ test_tmpdir = string(test_tmpdir_env);
+ break;
+ }
+ }
+ }
+
+ // No other temp directory was found. Use the current director
+ if (test_tmpdir.empty()) {
+ char buffer[MAX_PATH];
+ // Use GetCurrentDirectoryA instead of GetCurrentDirectoryW, because the
+ // current working directory must always be shorter than MAX_PATH, even
+ // with
+ // "\\?\" prefix (except on Windows 10 version 1607 and beyond, after
+ // opting in to long paths by default [1]).
+ //
+ // [1] https://msdn.microsoft.com/en-us/library/windows/ \
+ // desktop/aa365247(v=vs.85).aspx#maxpath
+ DWORD result = ::GetCurrentDirectoryA(MAX_PATH, buffer);
+ if (result > 0) {
+ test_tmpdir = string(buffer);
+ } else {
+ // Using assertions in SetUp/TearDown seems to confuse the test
+ // framework, so just leave the member variables empty in case of
+ // failure.
+ GOOGLE_CHECK_OK(false);
+ return;
+ }
+ }
}
- if (!ok) {
- // Fall back to using the current directory.
- ok = GetCwdAsUtf8(&tmp);
+
+ while (test_tmpdir.back() == '/' || test_tmpdir.back() == '\\') {
+ test_tmpdir.pop_back();
}
- if (!ok || tmp.empty()) {
- FAIL() << "Cannot find a temp directory.";
+ test_tmpdir += "\\io_win32_unittest.tmp";
+
+ // CreateDirectoryA's limit is 248 chars, see MSDN.
+ // https://msdn.microsoft.com/en-us/library/windows/ \
+ // desktop/aa363855(v=vs.85).aspx
+ wtest_tmpdir = testonly_path_to_winpath(test_tmpdir);
+ if (!DeleteAllUnder(wtest_tmpdir) || !CreateAllUnder(wtest_tmpdir)) {
+ GOOGLE_CHECK_OK(false);
+ test_tmpdir.clear();
+ wtest_tmpdir.clear();
}
-
- StripTrailingSlashes(&tmp);
- std::stringstream result;
- // Deleting files and directories is asynchronous on Windows, and if TearDown
- // just deleted the previous temp directory, sometimes we cannot recreate the
- // same directory.
- // Use a counter so every test method gets its own temp directory.
- static unsigned int counter = 0;
- result << tmp << "\\w32tst" << counter++ << ".tmp";
- test_tmpdir = result.str();
- wtest_tmpdir = testonly_utf8_to_winpath(test_tmpdir.c_str());
- ASSERT_FALSE(wtest_tmpdir.empty());
- ASSERT_TRUE(DeleteAllUnder(wtest_tmpdir));
- ASSERT_TRUE(CreateAllUnder(wtest_tmpdir));
}
void IoWin32Test::TearDown() {
if (!wtest_tmpdir.empty()) {
DeleteAllUnder(wtest_tmpdir);
}
- ::SetCurrentDirectoryW(working_directory);
}
bool IoWin32Test::CreateAllUnder(wstring path) {
@@ -229,8 +185,8 @@ bool IoWin32Test::DeleteAllUnder(wstring path) {
path = wstring(L"\\\\?\\") + path;
}
// Append "\" if necessary.
- if (path[path.size() - 1] != L'\\') {
- path.push_back(L'\\');
+ if (path.back() != '\\') {
+ path.push_back('\\');
}
WIN32_FIND_DATAW metadata;
@@ -347,24 +303,13 @@ TEST_F(IoWin32Test, MkdirTest) {
ASSERT_EQ(errno, ENOENT);
}
-TEST_F(IoWin32Test, MkdirTestNonAscii) {
- ASSERT_INITIALIZED;
-
- // Create a non-ASCII path.
- // Ensure that we can create the directory using SetCurrentDirectoryW.
- EXPECT_TRUE(CreateDirectoryW((wtest_tmpdir + L"\\1").c_str(), NULL));
- EXPECT_TRUE(CreateDirectoryW((wtest_tmpdir + L"\\1\\" + kUtf16Text).c_str(), NULL));
- // Ensure that we can create a very similarly named directory using mkdir.
- // We don't attemp to delete and recreate the same directory, because on
- // Windows, deleting files and directories seems to be asynchronous.
- EXPECT_EQ(mkdir((test_tmpdir + "\\2").c_str(), 0644), 0);
- EXPECT_EQ(mkdir((test_tmpdir + "\\2\\" + kUtf8Text).c_str(), 0644), 0);
-}
-
TEST_F(IoWin32Test, ChdirTest) {
+ char owd[MAX_PATH];
+ EXPECT_GT(::GetCurrentDirectoryA(MAX_PATH, owd), 0);
string path("C:\\");
EXPECT_EQ(access(path.c_str(), F_OK), 0);
ASSERT_EQ(chdir(path.c_str()), 0);
+ EXPECT_TRUE(::SetCurrentDirectoryA(owd));
// Do not try to chdir into the test_tmpdir, it may already contain directory
// names with trailing dots.
@@ -379,37 +324,17 @@ TEST_F(IoWin32Test, ChdirTest) {
ASSERT_NE(chdir(path.c_str()), 0);
}
-TEST_F(IoWin32Test, ChdirTestNonAscii) {
- ASSERT_INITIALIZED;
-
- // Create a directory with a non-ASCII path and ensure we can cd into it.
- wstring wNonAscii(wtest_tmpdir + L"\\" + kUtf16Text);
- string nonAscii;
- EXPECT_TRUE(strings::wcs_to_utf8(wNonAscii.c_str(), &nonAscii));
- EXPECT_TRUE(CreateDirectoryW(wNonAscii.c_str(), NULL));
- WCHAR cwd[MAX_PATH];
- EXPECT_TRUE(GetCurrentDirectoryW(MAX_PATH, cwd));
- // Ensure that we can cd into the path using SetCurrentDirectoryW.
- EXPECT_TRUE(SetCurrentDirectoryW(wNonAscii.c_str()));
- EXPECT_TRUE(SetCurrentDirectoryW(cwd));
- // Ensure that we can cd into the path using chdir.
- ASSERT_EQ(chdir(nonAscii.c_str()), 0);
- // Ensure that the GetCurrentDirectoryW returns the desired path.
- EXPECT_TRUE(GetCurrentDirectoryW(MAX_PATH, cwd));
- ASSERT_EQ(wNonAscii, cwd);
-}
-
TEST_F(IoWin32Test, AsWindowsPathTest) {
DWORD size = GetCurrentDirectoryW(0, NULL);
- std::unique_ptr<wchar_t[]> cwd_str(new wchar_t[size]);
+ unique_ptr<wchar_t[]> cwd_str(new wchar_t[size]);
EXPECT_GT(GetCurrentDirectoryW(size, cwd_str.get()), 0);
wstring cwd = wstring(L"\\\\?\\") + cwd_str.get();
- ASSERT_EQ(testonly_utf8_to_winpath("relative_mkdirtest"),
+ ASSERT_EQ(testonly_path_to_winpath("relative_mkdirtest"),
cwd + L"\\relative_mkdirtest");
- ASSERT_EQ(testonly_utf8_to_winpath("preserve//\\trailing///"),
+ ASSERT_EQ(testonly_path_to_winpath("preserve//\\trailing///"),
cwd + L"\\preserve\\trailing\\");
- ASSERT_EQ(testonly_utf8_to_winpath("./normalize_me\\/../blah"),
+ ASSERT_EQ(testonly_path_to_winpath("./normalize_me\\/../blah"),
cwd + L"\\blah");
std::ostringstream relpath;
for (wchar_t* p = cwd_str.get(); *p; ++p) {
@@ -418,28 +343,18 @@ TEST_F(IoWin32Test, AsWindowsPathTest) {
}
}
relpath << ".\\/../\\./beyond-toplevel";
- ASSERT_EQ(testonly_utf8_to_winpath(relpath.str().c_str()),
+ ASSERT_EQ(testonly_path_to_winpath(relpath.str()),
wstring(L"\\\\?\\") + cwd_str.get()[0] + L":\\beyond-toplevel");
// Absolute unix paths lack drive letters, driveless absolute windows paths
// do too. Neither can be converted to a drive-specifying absolute Windows
// path.
- ASSERT_EQ(testonly_utf8_to_winpath("/absolute/unix/path"), L"");
+ ASSERT_EQ(testonly_path_to_winpath("/absolute/unix/path"), L"");
// Though valid on Windows, we also don't support UNC paths (\\UNC\\blah).
- ASSERT_EQ(testonly_utf8_to_winpath("\\driveless\\absolute"), L"");
+ ASSERT_EQ(testonly_path_to_winpath("\\driveless\\absolute"), L"");
// Though valid in cmd.exe, drive-relative paths are not supported.
- ASSERT_EQ(testonly_utf8_to_winpath("c:foo"), L"");
- ASSERT_EQ(testonly_utf8_to_winpath("c:/foo"), L"\\\\?\\c:\\foo");
- ASSERT_EQ(testonly_utf8_to_winpath("\\\\?\\C:\\foo"), L"\\\\?\\C:\\foo");
-}
-
-TEST_F(IoWin32Test, Utf8Utf16ConversionTest) {
- string mbs;
- wstring wcs;
- ASSERT_TRUE(strings::utf8_to_wcs(kUtf8Text, &wcs));
- ASSERT_TRUE(strings::wcs_to_utf8(kUtf16Text, &mbs));
- ASSERT_EQ(wcs, kUtf16Text);
- ASSERT_EQ(mbs, kUtf8Text);
+ ASSERT_EQ(testonly_path_to_winpath("c:foo"), L"");
+ ASSERT_EQ(testonly_path_to_winpath("c:/foo"), L"\\\\?\\c:\\foo");
}
} // namespace
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/logging.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/logging.h
index f69605d9f6..f69605d9f6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/logging.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/logging.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/macros.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/macros.h
index 0e9a9ec198..0e9a9ec198 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/macros.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/macros.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/map_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/map_util.h
index 3e6d381f4a..887f12a600 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/map_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/map_util.h
@@ -654,8 +654,7 @@ InsertOrReturnExisting(
// delete EraseKeyReturnValuePtr(&my_map, "abc");
//
// Use returned value:
-// std::unique_ptr<MyType> value_ptr(
-// EraseKeyReturnValuePtr(&my_map, "abc"));
+// scoped_ptr<MyType> value_ptr(EraseKeyReturnValuePtr(&my_map, "abc"));
// if (value_ptr.get())
// value_ptr->DoSomething();
//
@@ -709,7 +708,7 @@ void AppendKeysFromMap(const MapContainer& map_container,
// without the complexity of a SFINAE-based solution.)
template <class MapContainer, class KeyType>
void AppendKeysFromMap(const MapContainer& map_container,
- std::vector<KeyType>* key_container) {
+ vector<KeyType>* key_container) {
GOOGLE_CHECK(key_container != NULL);
// We now have the opportunity to call reserve(). Calling reserve() every
// time is a bad idea for some use cases: libstdc++'s implementation of
@@ -753,7 +752,7 @@ void AppendValuesFromMap(const MapContainer& map_container,
// without the complexity of a SFINAE-based solution.)
template <class MapContainer, class ValueType>
void AppendValuesFromMap(const MapContainer& map_container,
- std::vector<ValueType>* value_container) {
+ vector<ValueType>* value_container) {
GOOGLE_CHECK(value_container != NULL);
// See AppendKeysFromMap for why this is done.
if (value_container->empty()) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathlimits.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathlimits.cc
index 0373b2bb97..0373b2bb97 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathlimits.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathlimits.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathlimits.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathlimits.h
index 9c9d0e9a2b..2391ac4caa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathlimits.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathlimits.h
@@ -243,7 +243,7 @@ DECL_UNSIGNED_INT_LIMITS(unsigned long long int)
#endif
// ========================================================================= //
-#if WIN32 && !__MINGW32__ // Lacks built-in isnan() and isinf()
+#ifdef WIN32 // Lacks built-in isnan() and isinf()
#define DECL_FP_LIMIT_FUNCS \
static bool IsFinite(const Type x) { return _finite(x); } \
static bool IsNaN(const Type x) { return _isnan(x); } \
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathutil.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathutil.h
index 8a9f69a0b2..8a9f69a0b2 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/mathutil.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/mathutil.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/mutex.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/mutex.h
index b9b7d2e1be..174290f624 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/mutex.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/mutex.h
@@ -30,7 +30,9 @@
#ifndef GOOGLE_PROTOBUF_STUBS_MUTEX_H_
#define GOOGLE_PROTOBUF_STUBS_MUTEX_H_
-#include <mutex>
+#ifdef GOOGLE_PROTOBUF_NO_THREADLOCAL
+#include <pthread.h>
+#endif
#include <google/protobuf/stubs/macros.h>
@@ -40,25 +42,33 @@ namespace google {
namespace protobuf {
namespace internal {
-#define GOOGLE_PROTOBUF_LINKER_INITIALIZED
-
-// Mutex is a natural type to wrap. As both google and other organization have
-// specialized mutexes. gRPC also provides an injection mechanism for custom
-// mutexes.
-class LIBPROTOBUF_EXPORT WrappedMutex {
+// A Mutex is a non-reentrant (aka non-recursive) mutex. At most one thread T
+// may hold a mutex at a given time. If T attempts to Lock() the same Mutex
+// while holding it, T will deadlock.
+class LIBPROTOBUF_EXPORT Mutex {
public:
- WrappedMutex() = default;
- void Lock() { mu_.lock(); }
- void Unlock() { mu_.unlock(); }
+ // Create a Mutex that is not held by anybody.
+ Mutex();
+
+ // Destructor
+ ~Mutex();
+
+ // Block if necessary until this Mutex is free, then acquire it exclusively.
+ void Lock();
+
+ // Release this Mutex. Caller must hold it exclusively.
+ void Unlock();
+
// Crash if this Mutex is not held exclusively by this thread.
// May fail to crash when it should; will never crash when it should not.
- void AssertHeld() const {}
+ void AssertHeld();
private:
- std::mutex mu_;
-};
+ struct Internal;
+ Internal* mInternal;
-using Mutex = WrappedMutex;
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Mutex);
+};
// MutexLock(mu) acquires mu when constructed and releases it when destroyed.
class LIBPROTOBUF_EXPORT MutexLock {
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/once.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/once.cc
new file mode 100644
index 0000000000..889c647660
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/once.cc
@@ -0,0 +1,99 @@
+// 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)
+//
+// emulates google3/base/once.h
+//
+// This header is intended to be included only by internal .cc files and
+// generated .pb.cc files. Users should not use this directly.
+
+#include <google/protobuf/stubs/once.h>
+
+#ifndef GOOGLE_PROTOBUF_NO_THREAD_SAFETY
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <sched.h>
+#endif
+
+#include <google/protobuf/stubs/atomicops.h>
+
+namespace google {
+namespace protobuf {
+
+namespace {
+
+void SchedYield() {
+#ifdef _WIN32
+ Sleep(0);
+#else // POSIX
+ sched_yield();
+#endif
+}
+
+} // namespace
+
+void GoogleOnceInitImpl(ProtobufOnceType* once, Closure* closure) {
+ internal::AtomicWord state = internal::Acquire_Load(once);
+ // Fast path. The provided closure was already executed.
+ if (state == ONCE_STATE_DONE) {
+ return;
+ }
+ // The closure execution did not complete yet. The once object can be in one
+ // of the two following states:
+ // - UNINITIALIZED: We are the first thread calling this function.
+ // - EXECUTING_CLOSURE: Another thread is already executing the closure.
+ //
+ // First, try to change the state from UNINITIALIZED to EXECUTING_CLOSURE
+ // atomically.
+ state = internal::Acquire_CompareAndSwap(
+ once, ONCE_STATE_UNINITIALIZED, ONCE_STATE_EXECUTING_CLOSURE);
+ if (state == ONCE_STATE_UNINITIALIZED) {
+ // We are the first thread to call this function, so we have to call the
+ // closure.
+ closure->Run();
+ internal::Release_Store(once, ONCE_STATE_DONE);
+ } else {
+ // Another thread has already started executing the closure. We need to
+ // wait until it completes the initialization.
+ while (state == ONCE_STATE_EXECUTING_CLOSURE) {
+ // Note that futex() could be used here on Linux as an improvement.
+ SchedYield();
+ state = internal::Acquire_Load(once);
+ }
+ }
+}
+
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_NO_THREAD_SAFETY
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/once.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/once.h
index f3835ccd04..1f082c37e9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/once.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/once.h
@@ -78,51 +78,88 @@
#ifndef GOOGLE_PROTOBUF_STUBS_ONCE_H__
#define GOOGLE_PROTOBUF_STUBS_ONCE_H__
-#include <mutex>
-#include <utility>
+#include <google/protobuf/stubs/atomicops.h>
+#include <google/protobuf/stubs/callback.h>
+#include <google/protobuf/stubs/common.h>
namespace google {
namespace protobuf {
-namespace internal {
-using once_flag = std::once_flag;
-template <typename... Args>
-void call_once(Args&&... args ) {
- std::call_once(std::forward<Args>(args)...);
+#ifdef GOOGLE_PROTOBUF_NO_THREAD_SAFETY
+
+typedef bool ProtobufOnceType;
+
+#define GOOGLE_PROTOBUF_ONCE_INIT false
+
+inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) {
+ if (!*once) {
+ *once = true;
+ init_func();
+ }
}
-} // namespace internal
+template <typename Arg>
+inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)(Arg),
+ Arg arg) {
+ if (!*once) {
+ *once = true;
+ init_func(arg);
+ }
+}
-// TODO(gerbens) remove this once third_party is fully extracted
-using ProtobufOnceType = internal::once_flag;
+#else
+
+enum {
+ ONCE_STATE_UNINITIALIZED = 0,
+ ONCE_STATE_EXECUTING_CLOSURE = 1,
+ ONCE_STATE_DONE = 2
+};
+
+typedef internal::AtomicWord ProtobufOnceType;
+
+#define GOOGLE_PROTOBUF_ONCE_INIT ::google::protobuf::ONCE_STATE_UNINITIALIZED
+
+LIBPROTOBUF_EXPORT
+void GoogleOnceInitImpl(ProtobufOnceType* once, Closure* closure);
inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) {
- std::call_once(*once, init_func);
+ if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
+ internal::FunctionClosure0 func(init_func, false);
+ GoogleOnceInitImpl(once, &func);
+ }
}
template <typename Arg>
-inline void GoogleOnceInitArg(ProtobufOnceType* once, void (*init_func)(Arg*),
- Arg* arg) {
- std::call_once(*once, init_func, arg);
+inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)(Arg*),
+ Arg* arg) {
+ if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
+ internal::FunctionClosure1<Arg*> func(init_func, false, arg);
+ GoogleOnceInitImpl(once, &func);
+ }
}
+#endif // GOOGLE_PROTOBUF_NO_THREAD_SAFETY
+
class GoogleOnceDynamic {
public:
+ GoogleOnceDynamic() : state_(GOOGLE_PROTOBUF_ONCE_INIT) { }
+
// If this->Init() has not been called before by any thread,
// execute (*func_with_arg)(arg) then return.
// Otherwise, wait until that prior invocation has finished
// executing its function, then return.
template<typename T>
void Init(void (*func_with_arg)(T*), T* arg) {
- GoogleOnceInitArg<T>(&this->state_, func_with_arg, arg);
+ GoogleOnceInit<T>(&this->state_,
+ func_with_arg,
+ arg);
}
private:
ProtobufOnceType state_;
};
-#define GOOGLE_PROTOBUF_ONCE_TYPE ::google::protobuf::ProtobufOnceType
#define GOOGLE_PROTOBUF_DECLARE_ONCE(NAME) \
- ::google::protobuf::ProtobufOnceType NAME
+ ::google::protobuf::ProtobufOnceType NAME = GOOGLE_PROTOBUF_ONCE_INIT
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/once_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/once_unittest.cc
new file mode 100644
index 0000000000..d5f7779ec9
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/once_unittest.cc
@@ -0,0 +1,254 @@
+// 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)
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <unistd.h>
+#include <pthread.h>
+#endif
+
+#include <google/protobuf/stubs/once.h>
+#include <google/protobuf/testing/googletest.h>
+#include <gtest/gtest.h>
+
+namespace google {
+namespace protobuf {
+namespace {
+
+class OnceInitTest : public testing::Test {
+ protected:
+ void SetUp() {
+ state_ = INIT_NOT_STARTED;
+ current_test_ = this;
+ }
+
+ // Since ProtobufOnceType is only allowed to be allocated in static storage,
+ // each test must use a different pair of ProtobufOnceType objects which it
+ // must declare itself.
+ void SetOnces(ProtobufOnceType* once, ProtobufOnceType* recursive_once) {
+ once_ = once;
+ recursive_once_ = recursive_once;
+ }
+
+ void InitOnce() {
+ GoogleOnceInit(once_, &InitStatic);
+ }
+ void InitRecursiveOnce() {
+ GoogleOnceInit(recursive_once_, &InitRecursiveStatic);
+ }
+
+ void BlockInit() { init_blocker_.Lock(); }
+ void UnblockInit() { init_blocker_.Unlock(); }
+
+ class TestThread {
+ public:
+ TestThread(Closure* callback)
+ : done_(false), joined_(false), callback_(callback) {
+#ifdef _WIN32
+ thread_ = CreateThread(NULL, 0, &Start, this, 0, NULL);
+#else
+ pthread_create(&thread_, NULL, &Start, this);
+#endif
+ }
+ ~TestThread() {
+ if (!joined_) Join();
+ }
+
+ bool IsDone() {
+ MutexLock lock(&done_mutex_);
+ return done_;
+ }
+ void Join() {
+ joined_ = true;
+#ifdef _WIN32
+ WaitForSingleObject(thread_, INFINITE);
+ CloseHandle(thread_);
+#else
+ pthread_join(thread_, NULL);
+#endif
+ }
+
+ private:
+#ifdef _WIN32
+ HANDLE thread_;
+#else
+ pthread_t thread_;
+#endif
+
+ Mutex done_mutex_;
+ bool done_;
+ bool joined_;
+ Closure* callback_;
+
+#ifdef _WIN32
+ static DWORD WINAPI Start(LPVOID arg) {
+#else
+ static void* Start(void* arg) {
+#endif
+ reinterpret_cast<TestThread*>(arg)->Run();
+ return 0;
+ }
+
+ void Run() {
+ callback_->Run();
+ MutexLock lock(&done_mutex_);
+ done_ = true;
+ }
+ };
+
+ TestThread* RunInitOnceInNewThread() {
+ return new TestThread(NewCallback(this, &OnceInitTest::InitOnce));
+ }
+ TestThread* RunInitRecursiveOnceInNewThread() {
+ return new TestThread(
+ NewCallback(this, &OnceInitTest::InitRecursiveOnce));
+ }
+
+ enum State {
+ INIT_NOT_STARTED,
+ INIT_STARTED,
+ INIT_DONE
+ };
+ State CurrentState() {
+ MutexLock lock(&mutex_);
+ return state_;
+ }
+
+ void WaitABit() {
+#ifdef _WIN32
+ Sleep(1000);
+#else
+ sleep(1);
+#endif
+ }
+
+ private:
+ Mutex mutex_;
+ Mutex init_blocker_;
+ State state_;
+ ProtobufOnceType* once_;
+ ProtobufOnceType* recursive_once_;
+
+ void Init() {
+ MutexLock lock(&mutex_);
+ EXPECT_EQ(INIT_NOT_STARTED, state_);
+ state_ = INIT_STARTED;
+ mutex_.Unlock();
+ init_blocker_.Lock();
+ init_blocker_.Unlock();
+ mutex_.Lock();
+ state_ = INIT_DONE;
+ }
+
+ static OnceInitTest* current_test_;
+ static void InitStatic() { current_test_->Init(); }
+ static void InitRecursiveStatic() { current_test_->InitOnce(); }
+};
+
+OnceInitTest* OnceInitTest::current_test_ = NULL;
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(simple_once);
+
+TEST_F(OnceInitTest, Simple) {
+ SetOnces(&simple_once, NULL);
+
+ EXPECT_EQ(INIT_NOT_STARTED, CurrentState());
+ InitOnce();
+ EXPECT_EQ(INIT_DONE, CurrentState());
+
+ // Calling again has no effect.
+ InitOnce();
+ EXPECT_EQ(INIT_DONE, CurrentState());
+}
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(recursive_once1);
+GOOGLE_PROTOBUF_DECLARE_ONCE(recursive_once2);
+
+TEST_F(OnceInitTest, Recursive) {
+ SetOnces(&recursive_once1, &recursive_once2);
+
+ EXPECT_EQ(INIT_NOT_STARTED, CurrentState());
+ InitRecursiveOnce();
+ EXPECT_EQ(INIT_DONE, CurrentState());
+}
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(multiple_threads_once);
+
+TEST_F(OnceInitTest, MultipleThreads) {
+ SetOnces(&multiple_threads_once, NULL);
+
+ scoped_ptr<TestThread> threads[4];
+ EXPECT_EQ(INIT_NOT_STARTED, CurrentState());
+ for (int i = 0; i < 4; i++) {
+ threads[i].reset(RunInitOnceInNewThread());
+ }
+ for (int i = 0; i < 4; i++) {
+ threads[i]->Join();
+ }
+ EXPECT_EQ(INIT_DONE, CurrentState());
+}
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(multiple_threads_blocked_once1);
+GOOGLE_PROTOBUF_DECLARE_ONCE(multiple_threads_blocked_once2);
+
+TEST_F(OnceInitTest, MultipleThreadsBlocked) {
+ SetOnces(&multiple_threads_blocked_once1, &multiple_threads_blocked_once2);
+
+ scoped_ptr<TestThread> threads[8];
+ EXPECT_EQ(INIT_NOT_STARTED, CurrentState());
+
+ BlockInit();
+ for (int i = 0; i < 4; i++) {
+ threads[i].reset(RunInitOnceInNewThread());
+ }
+ for (int i = 4; i < 8; i++) {
+ threads[i].reset(RunInitRecursiveOnceInNewThread());
+ }
+
+ WaitABit();
+
+ // We should now have one thread blocked inside Init(), four blocked waiting
+ // for Init() to complete, and three blocked waiting for InitRecursive() to
+ // complete.
+ EXPECT_EQ(INIT_STARTED, CurrentState());
+ UnblockInit();
+
+ for (int i = 0; i < 8; i++) {
+ threads[i]->Join();
+ }
+ EXPECT_EQ(INIT_DONE, CurrentState());
+}
+
+} // anonymous namespace
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/platform_macros.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/platform_macros.h
index c3a64dd2b3..7a54060dfa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/platform_macros.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/platform_macros.h
@@ -50,9 +50,6 @@
#elif defined(_M_ARM) || defined(__ARMEL__)
#define GOOGLE_PROTOBUF_ARCH_ARM 1
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
-#elif defined(_M_ARM64)
-#define GOOGLE_PROTOBUF_ARCH_ARM 1
-#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
#elif defined(__aarch64__)
#define GOOGLE_PROTOBUF_ARCH_AARCH64 1
#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/port.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/port.h
index 6b52305f93..dbc29861a5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/port.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/port.h
@@ -91,15 +91,12 @@
// These #includes are for the byte swap functions declared later on.
#ifdef _MSC_VER
#include <stdlib.h> // NOLINT(build/include)
-#include <intrin.h>
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
-#elif defined(__GLIBC__) || defined(__BIONIC__) || defined(__CYGWIN__)
+#elif defined(__GLIBC__) || defined(__CYGWIN__)
#include <byteswap.h> // IWYU pragma: export
#endif
-#define PROTOBUF_RUNTIME_DEPRECATED(message)
-
// ===================================================================
// from google3/base/port.h
@@ -111,18 +108,6 @@
#define LANG_CXX11 1
#endif
-#if LANG_CXX11 && !defined(__NVCC__)
-#define PROTOBUF_CXX11 1
-#else
-#define PROTOBUF_CXX11 0
-#endif
-
-#if PROTOBUF_CXX11
-#define PROTOBUF_FINAL final
-#else
-#define PROTOBUF_FINAL
-#endif
-
namespace google {
namespace protobuf {
@@ -192,8 +177,6 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF);
#endif
#endif
-#define GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE GOOGLE_ATTRIBUTE_ALWAYS_INLINE
-
#ifndef GOOGLE_ATTRIBUTE_NOINLINE
#if defined(__GNUC__) && (__GNUC__ > 3 ||(__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
// For functions we want to force not inline.
@@ -208,20 +191,23 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF);
#endif
#endif
-#define GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE GOOGLE_ATTRIBUTE_NOINLINE
-
-#ifndef GOOGLE_ATTRIBUTE_FUNC_ALIGN
-#if defined(__clang__) || \
- defined(__GNUC__) && (__GNUC__ > 4 ||(__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-// Function alignment attribute introduced in gcc 4.3
-#define GOOGLE_ATTRIBUTE_FUNC_ALIGN(bytes) __attribute__ ((aligned(bytes)))
+#ifndef GOOGLE_ATTRIBUTE_NORETURN
+#ifdef __GNUC__
+// Tell the compiler that a given function never returns.
+#define GOOGLE_ATTRIBUTE_NORETURN __attribute__((noreturn))
#else
-#define GOOGLE_ATTRIBUTE_FUNC_ALIGN(bytes)
+#define GOOGLE_ATTRIBUTE_NORETURN
#endif
#endif
-#define GOOGLE_PROTOBUF_ATTRIBUTE_FUNC_ALIGN(bytes) \
- GOOGLE_ATTRIBUTE_FUNC_ALIGN(bytes)
+#ifndef GOOGLE_ATTRIBUTE_DEPRECATED
+#ifdef __GNUC__
+// If the method/variable/type is used anywhere, produce a warning.
+#define GOOGLE_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
+#else
+#define GOOGLE_ATTRIBUTE_DEPRECATED
+#endif
+#endif
#ifndef GOOGLE_PREDICT_TRUE
#ifdef __GNUC__
@@ -241,13 +227,6 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF);
#endif
#endif
-#ifndef GOOGLE_PROTOBUF_ATTRIBUTE_RETURNS_NONNULL
-#ifdef __GNUC__
-#define GOOGLE_PROTOBUF_ATTRIBUTE_RETURNS_NONNULL \
- __attribute__((returns_nonnull))
-#endif
-#endif
-
// Delimits a block of code which may write to memory which is simultaneously
// written by other threads, but which has been determined to be thread-safe
// (e.g. because it is an idempotent write).
@@ -258,62 +237,30 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF);
#define GOOGLE_SAFE_CONCURRENT_WRITES_END()
#endif
+#if defined(__clang__) && defined(__has_cpp_attribute) \
+ && !defined(GOOGLE_PROTOBUF_OS_APPLE)
+# if defined(GOOGLE_PROTOBUF_OS_NACL) || defined(EMSCRIPTEN) || \
+ __has_cpp_attribute(clang::fallthrough)
+# define GOOGLE_FALLTHROUGH_INTENDED [[clang::fallthrough]]
+# endif
+#endif
+
+#ifndef GOOGLE_FALLTHROUGH_INTENDED
+# define GOOGLE_FALLTHROUGH_INTENDED
+#endif
+
#define GOOGLE_GUARDED_BY(x)
#define GOOGLE_ATTRIBUTE_COLD
#ifdef GOOGLE_PROTOBUF_DONT_USE_UNALIGNED
# define GOOGLE_PROTOBUF_USE_UNALIGNED 0
#else
-# if defined(_M_X64) || defined(__x86_64__) || defined(_M_IX86) || defined(__i386__)
-# define GOOGLE_PROTOBUF_USE_UNALIGNED 1
-# else
-# define GOOGLE_PROTOBUF_USE_UNALIGNED 0
-# endif
+// x86 and x86-64 can perform unaligned loads/stores directly.
+# define GOOGLE_PROTOBUF_USE_UNALIGNED defined(_M_X64) || \
+ defined(__x86_64__) || defined(_M_IX86) || defined(__i386__)
#endif
-#define GOOGLE_PROTOBUF_ATTRIBUTE_COLD GOOGLE_ATTRIBUTE_COLD
-
-#if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) ||\
- defined(MEMORY_SANITIZER)
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-uint16_t __sanitizer_unaligned_load16(const void *p);
-uint32_t __sanitizer_unaligned_load32(const void *p);
-uint64_t __sanitizer_unaligned_load64(const void *p);
-void __sanitizer_unaligned_store16(void *p, uint16_t v);
-void __sanitizer_unaligned_store32(void *p, uint32_t v);
-void __sanitizer_unaligned_store64(void *p, uint64_t v);
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-inline uint16 GOOGLE_UNALIGNED_LOAD16(const void *p) {
- return __sanitizer_unaligned_load16(p);
-}
-
-inline uint32 GOOGLE_UNALIGNED_LOAD32(const void *p) {
- return __sanitizer_unaligned_load32(p);
-}
-
-inline uint64 GOOGLE_UNALIGNED_LOAD64(const void *p) {
- return __sanitizer_unaligned_load64(p);
-}
-
-inline void GOOGLE_UNALIGNED_STORE16(void *p, uint16 v) {
- __sanitizer_unaligned_store16(p, v);
-}
-
-inline void GOOGLE_UNALIGNED_STORE32(void *p, uint32 v) {
- __sanitizer_unaligned_store32(p, v);
-}
-
-inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64 v) {
- __sanitizer_unaligned_store64(p, v);
-}
-
-#elif GOOGLE_PROTOBUF_USE_UNALIGNED
+#if GOOGLE_PROTOBUF_USE_UNALIGNED
#define GOOGLE_UNALIGNED_LOAD16(_p) (*reinterpret_cast<const uint16 *>(_p))
#define GOOGLE_UNALIGNED_LOAD32(_p) (*reinterpret_cast<const uint32 *>(_p))
@@ -355,13 +302,6 @@ 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
@@ -380,7 +320,7 @@ inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64 v) {
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)
-#elif !defined(__GLIBC__) && !defined(__BIONIC__) && !defined(__CYGWIN__)
+#elif !defined(__GLIBC__) && !defined(__CYGWIN__)
static inline uint16 bswap_16(uint16 x) {
return static_cast<uint16>(((x & 0xFF) << 8) | ((x & 0xFF00) >> 8));
@@ -415,28 +355,25 @@ class Bits {
static uint32 Log2FloorNonZero(uint32 n) {
#if defined(__GNUC__)
return 31 ^ static_cast<uint32>(__builtin_clz(n));
-#elif defined(_MSC_VER)
- unsigned long where;
- _BitScanReverse(&where, n);
- return where;
+#elif defined(COMPILER_MSVC) && defined(_M_IX86)
+ _asm {
+ bsr ebx, n
+ mov n, ebx
+ }
+ return n;
#else
return Log2FloorNonZero_Portable(n);
#endif
}
static uint32 Log2FloorNonZero64(uint64 n) {
- // Older versions of clang run into an instruction-selection failure when
- // it encounters __builtin_clzll:
+ // arm-nacl-clang runs into an instruction-selection failure when it
+ // encounters __builtin_clzll:
// https://bugs.chromium.org/p/nativeclient/issues/detail?id=4395
- // 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
+ // To work around this, when we build for NaCl we use the portable
// implementation instead.
-#if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_USE_PORTABLE_LOG2)
+#if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_OS_NACL)
return 63 ^ static_cast<uint32>(__builtin_clzll(n));
-#elif defined(_MSC_VER) && defined(_M_X64)
- unsigned long where;
- _BitScanReverse64(&where, n);
- return where;
#else
return Log2FloorNonZero64_Portable(n);
#endif
@@ -534,8 +471,6 @@ class BigEndian {
#define GOOGLE_ATTRIBUTE_SECTION_VARIABLE(name)
#endif
-#define GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(name)
-
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/scoped_ptr.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/scoped_ptr.h
new file mode 100644
index 0000000000..4423c118c4
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/scoped_ptr.h
@@ -0,0 +1,236 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef GOOGLE_PROTOBUF_STUBS_SCOPED_PTR_H_
+#define GOOGLE_PROTOBUF_STUBS_SCOPED_PTR_H_
+
+#include <google/protobuf/stubs/port.h>
+
+namespace google {
+namespace protobuf {
+
+// ===================================================================
+// from google3/base/scoped_ptr.h
+
+namespace internal {
+
+// This is an implementation designed to match the anticipated future TR2
+// implementation of the scoped_ptr class, and its closely-related brethren,
+// scoped_array, scoped_ptr_malloc, and make_scoped_ptr.
+
+template <class C> class scoped_ptr;
+template <class C> class scoped_array;
+
+// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
+// automatically deletes the pointer it holds (if any).
+// That is, scoped_ptr<T> owns the T object that it points to.
+// Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
+//
+// The size of a scoped_ptr is small:
+// sizeof(scoped_ptr<C>) == sizeof(C*)
+template <class C>
+class scoped_ptr {
+ public:
+
+ // The element type
+ typedef C element_type;
+
+ // Constructor. Defaults to initializing with NULL.
+ // There is no way to create an uninitialized scoped_ptr.
+ // The input parameter must be allocated with new.
+ explicit scoped_ptr(C* p = NULL) : ptr_(p) { }
+
+ // Destructor. If there is a C object, delete it.
+ // We don't need to test ptr_ == NULL because C++ does that for us.
+ ~scoped_ptr() {
+ enum { type_must_be_complete = sizeof(C) };
+ delete ptr_;
+ }
+
+ // Reset. Deletes the current owned object, if any.
+ // Then takes ownership of a new object, if given.
+ // this->reset(this->get()) works.
+ void reset(C* p = NULL) {
+ if (p != ptr_) {
+ enum { type_must_be_complete = sizeof(C) };
+ delete ptr_;
+ ptr_ = p;
+ }
+ }
+
+ // Accessors to get the owned object.
+ // operator* and operator-> will assert() if there is no current object.
+ C& operator*() const {
+ assert(ptr_ != NULL);
+ return *ptr_;
+ }
+ C* operator->() const {
+ assert(ptr_ != NULL);
+ return ptr_;
+ }
+ C* get() const { return ptr_; }
+
+ // Comparison operators.
+ // These return whether two scoped_ptr refer to the same object, not just to
+ // two different but equal objects.
+ bool operator==(C* p) const { return ptr_ == p; }
+ bool operator!=(C* p) const { return ptr_ != p; }
+
+ // Swap two scoped pointers.
+ void swap(scoped_ptr& p2) {
+ C* tmp = ptr_;
+ ptr_ = p2.ptr_;
+ p2.ptr_ = tmp;
+ }
+
+ // Release a pointer.
+ // The return value is the current pointer held by this object.
+ // If this object holds a NULL pointer, the return value is NULL.
+ // After this operation, this object will hold a NULL pointer,
+ // and will not own the object any more.
+ C* release() {
+ C* retVal = ptr_;
+ ptr_ = NULL;
+ return retVal;
+ }
+
+ private:
+ C* ptr_;
+
+ // Forbid comparison of scoped_ptr types. If C2 != C, it totally doesn't
+ // make sense, and if C2 == C, it still doesn't make sense because you should
+ // never have the same object owned by two different scoped_ptrs.
+ template <class C2> bool operator==(scoped_ptr<C2> const& p2) const;
+ template <class C2> bool operator!=(scoped_ptr<C2> const& p2) const;
+
+ // Disallow evil constructors
+ scoped_ptr(const scoped_ptr&);
+ void operator=(const scoped_ptr&);
+};
+
+// scoped_array<C> is like scoped_ptr<C>, except that the caller must allocate
+// with new [] and the destructor deletes objects with delete [].
+//
+// As with scoped_ptr<C>, a scoped_array<C> either points to an object
+// or is NULL. A scoped_array<C> owns the object that it points to.
+//
+// Size: sizeof(scoped_array<C>) == sizeof(C*)
+template <class C>
+class scoped_array {
+ public:
+
+ // The element type
+ typedef C element_type;
+
+ // Constructor. Defaults to initializing with NULL.
+ // There is no way to create an uninitialized scoped_array.
+ // The input parameter must be allocated with new [].
+ explicit scoped_array(C* p = NULL) : array_(p) { }
+
+ // Destructor. If there is a C object, delete it.
+ // We don't need to test ptr_ == NULL because C++ does that for us.
+ ~scoped_array() {
+ enum { type_must_be_complete = sizeof(C) };
+ delete[] array_;
+ }
+
+ // Reset. Deletes the current owned object, if any.
+ // Then takes ownership of a new object, if given.
+ // this->reset(this->get()) works.
+ void reset(C* p = NULL) {
+ if (p != array_) {
+ enum { type_must_be_complete = sizeof(C) };
+ delete[] array_;
+ array_ = p;
+ }
+ }
+
+ // Get one element of the current object.
+ // Will assert() if there is no current object, or index i is negative.
+ C& operator[](std::ptrdiff_t i) const {
+ assert(i >= 0);
+ assert(array_ != NULL);
+ return array_[i];
+ }
+
+ // Get a pointer to the zeroth element of the current object.
+ // If there is no current object, return NULL.
+ C* get() const {
+ return array_;
+ }
+
+ // Comparison operators.
+ // These return whether two scoped_array refer to the same object, not just to
+ // two different but equal objects.
+ bool operator==(C* p) const { return array_ == p; }
+ bool operator!=(C* p) const { return array_ != p; }
+
+ // Swap two scoped arrays.
+ void swap(scoped_array& p2) {
+ C* tmp = array_;
+ array_ = p2.array_;
+ p2.array_ = tmp;
+ }
+
+ // Release an array.
+ // The return value is the current pointer held by this object.
+ // If this object holds a NULL pointer, the return value is NULL.
+ // After this operation, this object will hold a NULL pointer,
+ // and will not own the object any more.
+ C* release() {
+ C* retVal = array_;
+ array_ = NULL;
+ return retVal;
+ }
+
+ private:
+ C* array_;
+
+ // Forbid comparison of different scoped_array types.
+ template <class C2> bool operator==(scoped_array<C2> const& p2) const;
+ template <class C2> bool operator!=(scoped_array<C2> const& p2) const;
+
+ // Disallow evil constructors
+ scoped_array(const scoped_array&);
+ void operator=(const scoped_array&);
+};
+
+} // namespace internal
+
+// We made these internal so that they would show up as such in the docs,
+// but we don't want to stick "internal::" in front of them everywhere.
+using internal::scoped_ptr;
+using internal::scoped_array;
+
+
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_STUBS_SCOPED_PTR_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/shared_ptr.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/shared_ptr.h
new file mode 100644
index 0000000000..7da114e936
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/shared_ptr.h
@@ -0,0 +1,471 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2014 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.
+
+// from google3/util/gtl/shared_ptr.h
+
+#ifndef GOOGLE_PROTOBUF_STUBS_SHARED_PTR_H__
+#define GOOGLE_PROTOBUF_STUBS_SHARED_PTR_H__
+
+#include <google/protobuf/stubs/atomicops.h>
+
+#include <algorithm> // for swap
+#include <stddef.h>
+#include <memory>
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+// Alias to std::shared_ptr for any C++11 platform,
+// and for any supported MSVC compiler.
+#if !defined(UTIL_GTL_USE_STD_SHARED_PTR) && \
+ (defined(COMPILER_MSVC) || defined(LANG_CXX11))
+#define UTIL_GTL_USE_STD_SHARED_PTR 1
+#endif
+
+#if defined(UTIL_GTL_USE_STD_SHARED_PTR) && UTIL_GTL_USE_STD_SHARED_PTR
+
+// These are transitional. They will be going away soon.
+// Please just #include <memory> and just type std::shared_ptr yourself, instead
+// of relying on this file.
+//
+// Migration doc: http://go/std-shared-ptr-lsc
+using std::enable_shared_from_this;
+using std::shared_ptr;
+using std::static_pointer_cast;
+using std::weak_ptr;
+
+#else // below, UTIL_GTL_USE_STD_SHARED_PTR not set or set to 0.
+
+// For everything else there is the google3 implementation.
+inline bool RefCountDec(volatile Atomic32 *ptr) {
+ return Barrier_AtomicIncrement(ptr, -1) != 0;
+}
+
+inline void RefCountInc(volatile Atomic32 *ptr) {
+ NoBarrier_AtomicIncrement(ptr, 1);
+}
+
+template <typename T> class shared_ptr;
+template <typename T> class weak_ptr;
+
+// This class is an internal implementation detail for shared_ptr. If two
+// shared_ptrs point to the same object, they also share a control block.
+// An "empty" shared_pointer refers to NULL and also has a NULL control block.
+// It contains all of the state that's needed for reference counting or any
+// other kind of resource management. In this implementation the control block
+// happens to consist of two atomic words, the reference count (the number
+// of shared_ptrs that share ownership of the object) and the weak count
+// (the number of weak_ptrs that observe the object, plus 1 if the
+// refcount is nonzero).
+//
+// The "plus 1" is to prevent a race condition in the shared_ptr and
+// weak_ptr destructors. We need to make sure the control block is
+// only deleted once, so we need to make sure that at most one
+// object sees the weak count decremented from 1 to 0.
+class SharedPtrControlBlock {
+ template <typename T> friend class shared_ptr;
+ template <typename T> friend class weak_ptr;
+ private:
+ SharedPtrControlBlock() : refcount_(1), weak_count_(1) { }
+ Atomic32 refcount_;
+ Atomic32 weak_count_;
+};
+
+// Forward declaration. The class is defined below.
+template <typename T> class enable_shared_from_this;
+
+template <typename T>
+class shared_ptr {
+ template <typename U> friend class weak_ptr;
+ public:
+ typedef T element_type;
+
+ shared_ptr() : ptr_(NULL), control_block_(NULL) {}
+
+ explicit shared_ptr(T* ptr)
+ : ptr_(ptr),
+ control_block_(ptr != NULL ? new SharedPtrControlBlock : NULL) {
+ // If p is non-null and T inherits from enable_shared_from_this, we
+ // set up the data that shared_from_this needs.
+ MaybeSetupWeakThis(ptr);
+ }
+
+ // Copy constructor: makes this object a copy of ptr, and increments
+ // the reference count.
+ template <typename U>
+ shared_ptr(const shared_ptr<U>& ptr)
+ : ptr_(NULL),
+ control_block_(NULL) {
+ Initialize(ptr);
+ }
+ // Need non-templated version to prevent the compiler-generated default
+ shared_ptr(const shared_ptr<T>& ptr)
+ : ptr_(NULL),
+ control_block_(NULL) {
+ Initialize(ptr);
+ }
+
+ // Assignment operator. Replaces the existing shared_ptr with ptr.
+ // Increment ptr's reference count and decrement the one being replaced.
+ template <typename U>
+ shared_ptr<T>& operator=(const shared_ptr<U>& ptr) {
+ if (ptr_ != ptr.ptr_) {
+ shared_ptr<T> me(ptr); // will hold our previous state to be destroyed.
+ swap(me);
+ }
+ return *this;
+ }
+
+ // Need non-templated version to prevent the compiler-generated default
+ shared_ptr<T>& operator=(const shared_ptr<T>& ptr) {
+ if (ptr_ != ptr.ptr_) {
+ shared_ptr<T> me(ptr); // will hold our previous state to be destroyed.
+ swap(me);
+ }
+ return *this;
+ }
+
+ // TODO(austern): Consider providing this constructor. The draft C++ standard
+ // (20.8.10.2.1) includes it. However, it says that this constructor throws
+ // a bad_weak_ptr exception when ptr is expired. Is it better to provide this
+ // constructor and make it do something else, like fail with a CHECK, or to
+ // leave this constructor out entirely?
+ //
+ // template <typename U>
+ // shared_ptr(const weak_ptr<U>& ptr);
+
+ ~shared_ptr() {
+ if (ptr_ != NULL) {
+ if (!RefCountDec(&control_block_->refcount_)) {
+ delete ptr_;
+
+ // weak_count_ is defined as the number of weak_ptrs that observe
+ // ptr_, plus 1 if refcount_ is nonzero.
+ if (!RefCountDec(&control_block_->weak_count_)) {
+ delete control_block_;
+ }
+ }
+ }
+ }
+
+ // Replaces underlying raw pointer with the one passed in. The reference
+ // count is set to one (or zero if the pointer is NULL) for the pointer
+ // being passed in and decremented for the one being replaced.
+ //
+ // If you have a compilation error with this code, make sure you aren't
+ // passing NULL, nullptr, or 0 to this function. Call reset without an
+ // argument to reset to a null ptr.
+ template <typename Y>
+ void reset(Y* p) {
+ if (p != ptr_) {
+ shared_ptr<T> tmp(p);
+ tmp.swap(*this);
+ }
+ }
+
+ void reset() {
+ reset(static_cast<T*>(NULL));
+ }
+
+ // Exchanges the contents of this with the contents of r. This function
+ // supports more efficient swapping since it eliminates the need for a
+ // temporary shared_ptr object.
+ void swap(shared_ptr<T>& r) {
+ using std::swap; // http://go/using-std-swap
+ swap(ptr_, r.ptr_);
+ swap(control_block_, r.control_block_);
+ }
+
+ // The following function is useful for gaining access to the underlying
+ // pointer when a shared_ptr remains in scope so the reference-count is
+ // known to be > 0 (e.g. for parameter passing).
+ T* get() const {
+ return ptr_;
+ }
+
+ T& operator*() const {
+ return *ptr_;
+ }
+
+ T* operator->() const {
+ return ptr_;
+ }
+
+ long use_count() const {
+ return control_block_ ? control_block_->refcount_ : 1;
+ }
+
+ bool unique() const {
+ return use_count() == 1;
+ }
+
+ private:
+ // If r is non-empty, initialize *this to share ownership with r,
+ // increasing the underlying reference count.
+ // If r is empty, *this remains empty.
+ // Requires: this is empty, namely this->ptr_ == NULL.
+ template <typename U>
+ void Initialize(const shared_ptr<U>& r) {
+ // This performs a static_cast on r.ptr_ to U*, which is a no-op since it
+ // is already a U*. So initialization here requires that r.ptr_ is
+ // implicitly convertible to T*.
+ InitializeWithStaticCast<U>(r);
+ }
+
+ // Initializes *this as described in Initialize, but additionally performs a
+ // static_cast from r.ptr_ (V*) to U*.
+ // NOTE(gfc): We'd need a more general form to support const_pointer_cast and
+ // dynamic_pointer_cast, but those operations are sufficiently discouraged
+ // that supporting static_pointer_cast is sufficient.
+ template <typename U, typename V>
+ void InitializeWithStaticCast(const shared_ptr<V>& r) {
+ if (r.control_block_ != NULL) {
+ RefCountInc(&r.control_block_->refcount_);
+
+ ptr_ = static_cast<U*>(r.ptr_);
+ control_block_ = r.control_block_;
+ }
+ }
+
+ // Helper function for the constructor that takes a raw pointer. If T
+ // doesn't inherit from enable_shared_from_this<T> then we have nothing to
+ // do, so this function is trivial and inline. The other version is declared
+ // out of line, after the class definition of enable_shared_from_this.
+ void MaybeSetupWeakThis(enable_shared_from_this<T>* ptr);
+ void MaybeSetupWeakThis(...) { }
+
+ T* ptr_;
+ SharedPtrControlBlock* control_block_;
+
+#ifndef SWIG
+ template <typename U>
+ friend class shared_ptr;
+
+ template <typename U, typename V>
+ friend shared_ptr<U> static_pointer_cast(const shared_ptr<V>& rhs);
+#endif
+};
+
+// Matches the interface of std::swap as an aid to generic programming.
+template <typename T> void swap(shared_ptr<T>& r, shared_ptr<T>& s) {
+ r.swap(s);
+}
+
+template <typename T, typename U>
+shared_ptr<T> static_pointer_cast(const shared_ptr<U>& rhs) {
+ shared_ptr<T> lhs;
+ lhs.template InitializeWithStaticCast<T>(rhs);
+ return lhs;
+}
+
+// See comments at the top of the file for a description of why this
+// class exists, and the draft C++ standard (as of July 2009 the
+// latest draft is N2914) for the detailed specification.
+template <typename T>
+class weak_ptr {
+ template <typename U> friend class weak_ptr;
+ public:
+ typedef T element_type;
+
+ // Create an empty (i.e. already expired) weak_ptr.
+ weak_ptr() : ptr_(NULL), control_block_(NULL) { }
+
+ // Create a weak_ptr that observes the same object that ptr points
+ // to. Note that there is no race condition here: we know that the
+ // control block can't disappear while we're looking at it because
+ // it is owned by at least one shared_ptr, ptr.
+ template <typename U> weak_ptr(const shared_ptr<U>& ptr) {
+ CopyFrom(ptr.ptr_, ptr.control_block_);
+ }
+
+ // Copy a weak_ptr. The object it points to might disappear, but we
+ // don't care: we're only working with the control block, and it can't
+ // disappear while we're looking at because it's owned by at least one
+ // weak_ptr, ptr.
+ template <typename U> weak_ptr(const weak_ptr<U>& ptr) {
+ CopyFrom(ptr.ptr_, ptr.control_block_);
+ }
+
+ // Need non-templated version to prevent default copy constructor
+ weak_ptr(const weak_ptr& ptr) {
+ CopyFrom(ptr.ptr_, ptr.control_block_);
+ }
+
+ // Destroy the weak_ptr. If no shared_ptr owns the control block, and if
+ // we are the last weak_ptr to own it, then it can be deleted. Note that
+ // weak_count_ is defined as the number of weak_ptrs sharing this control
+ // block, plus 1 if there are any shared_ptrs. We therefore know that it's
+ // safe to delete the control block when weak_count_ reaches 0, without
+ // having to perform any additional tests.
+ ~weak_ptr() {
+ if (control_block_ != NULL &&
+ !RefCountDec(&control_block_->weak_count_)) {
+ delete control_block_;
+ }
+ }
+
+ weak_ptr& operator=(const weak_ptr& ptr) {
+ if (&ptr != this) {
+ weak_ptr tmp(ptr);
+ tmp.swap(*this);
+ }
+ return *this;
+ }
+ template <typename U> weak_ptr& operator=(const weak_ptr<U>& ptr) {
+ weak_ptr tmp(ptr);
+ tmp.swap(*this);
+ return *this;
+ }
+ template <typename U> weak_ptr& operator=(const shared_ptr<U>& ptr) {
+ weak_ptr tmp(ptr);
+ tmp.swap(*this);
+ return *this;
+ }
+
+ void swap(weak_ptr& ptr) {
+ using std::swap; // http://go/using-std-swap
+ swap(ptr_, ptr.ptr_);
+ swap(control_block_, ptr.control_block_);
+ }
+
+ void reset() {
+ weak_ptr tmp;
+ tmp.swap(*this);
+ }
+
+ // Return the number of shared_ptrs that own the object we are observing.
+ // Note that this number can be 0 (if this pointer has expired).
+ long use_count() const {
+ return control_block_ != NULL ? control_block_->refcount_ : 0;
+ }
+
+ bool expired() const { return use_count() == 0; }
+
+ // Return a shared_ptr that owns the object we are observing. If we
+ // have expired, the shared_ptr will be empty. We have to be careful
+ // about concurrency, though, since some other thread might be
+ // destroying the last owning shared_ptr while we're in this
+ // function. We want to increment the refcount only if it's nonzero
+ // and get the new value, and we want that whole operation to be
+ // atomic.
+ shared_ptr<T> lock() const {
+ shared_ptr<T> result;
+ if (control_block_ != NULL) {
+ Atomic32 old_refcount;
+ do {
+ old_refcount = control_block_->refcount_;
+ if (old_refcount == 0)
+ break;
+ } while (old_refcount !=
+ NoBarrier_CompareAndSwap(
+ &control_block_->refcount_, old_refcount,
+ old_refcount + 1));
+ if (old_refcount > 0) {
+ result.ptr_ = ptr_;
+ result.control_block_ = control_block_;
+ }
+ }
+
+ return result;
+ }
+
+ private:
+ void CopyFrom(T* ptr, SharedPtrControlBlock* control_block) {
+ ptr_ = ptr;
+ control_block_ = control_block;
+ if (control_block_ != NULL)
+ RefCountInc(&control_block_->weak_count_);
+ }
+
+ private:
+ element_type* ptr_;
+ SharedPtrControlBlock* control_block_;
+};
+
+template <typename T> void swap(weak_ptr<T>& r, weak_ptr<T>& s) {
+ r.swap(s);
+}
+
+// See comments at the top of the file for a description of why this class
+// exists, and section 20.8.10.5 of the draft C++ standard (as of July 2009
+// the latest draft is N2914) for the detailed specification.
+template <typename T>
+class enable_shared_from_this {
+ friend class shared_ptr<T>;
+ public:
+ // Precondition: there must be a shared_ptr that owns *this and that was
+ // created, directly or indirectly, from a raw pointer of type T*. (The
+ // latter part of the condition is technical but not quite redundant; it
+ // rules out some complicated uses involving inheritance hierarchies.)
+ shared_ptr<T> shared_from_this() {
+ // Behavior is undefined if the precondition isn't satisfied; we choose
+ // to die with a CHECK failure.
+ GOOGLE_CHECK(!weak_this_.expired()) << "No shared_ptr owns this object";
+ return weak_this_.lock();
+ }
+ shared_ptr<const T> shared_from_this() const {
+ GOOGLE_CHECK(!weak_this_.expired()) << "No shared_ptr owns this object";
+ return weak_this_.lock();
+ }
+
+ protected:
+ enable_shared_from_this() { }
+ enable_shared_from_this(const enable_shared_from_this& other) { }
+ enable_shared_from_this& operator=(const enable_shared_from_this& other) {
+ return *this;
+ }
+ ~enable_shared_from_this() { }
+
+ private:
+ weak_ptr<T> weak_this_;
+};
+
+// This is a helper function called by shared_ptr's constructor from a raw
+// pointer. If T inherits from enable_shared_from_this<T>, it sets up
+// weak_this_ so that shared_from_this works correctly. If T does not inherit
+// from weak_this we get a different overload, defined inline, which does
+// nothing.
+template<typename T>
+void shared_ptr<T>::MaybeSetupWeakThis(enable_shared_from_this<T>* ptr) {
+ if (ptr) {
+ GOOGLE_CHECK(ptr->weak_this_.expired())
+ << "Object already owned by a shared_ptr";
+ ptr->weak_this_ = *this;
+ }
+}
+
+#endif // UTIL_GTL_USE_STD_SHARED_PTR
+
+} // internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_STUBS_SHARED_PTR_H__
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/singleton.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/singleton.h
index 2e6ccbdb67..9301f549b1 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/singleton.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/singleton.h
@@ -30,6 +30,7 @@
#ifndef GOOGLE_PROTOBUF_STUBS_SINGLETON_H__
#define GOOGLE_PROTOBUF_STUBS_SINGLETON_H__
+#include <google/protobuf/stubs/atomicops.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/status.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/status.cc
index 2bfbe0b42b..dd1bd6141a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/status.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/status.cc
@@ -124,7 +124,7 @@ string Status::ToString() const {
}
}
-std::ostream& operator<<(std::ostream& os, const Status& x) {
+ostream& operator<<(ostream& os, const Status& x) {
os << x.ToString();
return os;
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/status.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/status.h
index c5d38f0b46..614ab9941a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/status.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/status.h
@@ -106,7 +106,7 @@ class LIBPROTOBUF_EXPORT Status {
};
// Prints a human-readable representation of 'x' to 'os'.
-LIBPROTOBUF_EXPORT std::ostream& operator<<(std::ostream& os, const Status& x);
+LIBPROTOBUF_EXPORT ostream& operator<<(ostream& os, const Status& x);
#define EXPECT_OK(value) EXPECT_TRUE((value).ok())
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/status_macros.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/status_macros.h
index 743e79a727..743e79a727 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/status_macros.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/status_macros.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/status_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/status_test.cc
index c70c33c474..c70c33c474 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/status_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/status_test.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor.cc
index 48d1402ae0..48d1402ae0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor.h
index 29f869ad5e..29f869ad5e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor_test.cc
index 6e2a9e5545..6e2a9e5545 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/statusor_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/statusor_test.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stl_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stl_util.h
index 9e4c82a4c3..9e4c82a4c3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stl_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stl_util.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece.cc
index 989474b747..989474b747 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece.h
index 563ff75dcf..563ff75dcf 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece_unittest.cc
index a6a8759547..a6a8759547 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringpiece_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringpiece_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf.cc
index d98b9b8744..83fdfe454e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf.cc
@@ -137,7 +137,7 @@ const int kStringPrintfVectorMaxArgs = 32;
// and we can fix the problem or protect against an attack.
static const char string_printf_empty_block[256] = { '\0' };
-string StringPrintfVector(const char* format, const std::vector<string>& v) {
+string StringPrintfVector(const char* format, const vector<string>& v) {
GOOGLE_CHECK_LE(v.size(), kStringPrintfVectorMaxArgs)
<< "StringPrintfVector currently only supports up to "
<< kStringPrintfVectorMaxArgs << " arguments. "
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf.h
index 7183ec6a07..ab1ab55832 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf.h
@@ -68,7 +68,7 @@ LIBPROTOBUF_EXPORT extern const int kStringPrintfVectorMaxArgs;
// You can use this version when all your arguments are strings, but
// you don't know how many arguments you'll have at compile time.
// StringPrintfVector will LOG(FATAL) if v.size() > kStringPrintfVectorMaxArgs
-LIBPROTOBUF_EXPORT extern string StringPrintfVector(const char* format, const std::vector<string>& v);
+LIBPROTOBUF_EXPORT extern string StringPrintfVector(const char* format, const vector<string>& v);
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf_unittest.cc
index 15895e596c..15895e596c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/stringprintf_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/stringprintf_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/structurally_valid.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/structurally_valid.cc
index b22396829c..d79a6ee450 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/structurally_valid.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/structurally_valid.cc
@@ -1,33 +1,4 @@
-// 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 2005-2008 Google Inc. All Rights Reserved.
// Author: jrm@google.com (Jim Meehan)
#include <google/protobuf/stubs/common.h>
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/structurally_valid_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/structurally_valid_unittest.cc
new file mode 100644
index 0000000000..90888885ad
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/structurally_valid_unittest.cc
@@ -0,0 +1,40 @@
+// Copyright 2008 Google Inc. All Rights Reserved.
+// Author: xpeng@google.com (Peter Peng)
+
+#include <google/protobuf/stubs/common.h>
+#include <gtest/gtest.h>
+
+namespace google {
+namespace protobuf {
+namespace internal {
+namespace {
+
+TEST(StructurallyValidTest, ValidUTF8String) {
+ // On GCC, this string can be written as:
+ // "abcd 1234 - \u2014\u2013\u2212"
+ // MSVC seems to interpret \u differently.
+ string valid_str("abcd 1234 - \342\200\224\342\200\223\342\210\222 - xyz789");
+ EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data(),
+ valid_str.size()));
+ // Additional check for pointer alignment
+ for (int i = 1; i < 8; ++i) {
+ EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data() + i,
+ valid_str.size() - i));
+ }
+}
+
+TEST(StructurallyValidTest, InvalidUTF8String) {
+ const string invalid_str("abcd\xA0\xB0\xA0\xB0\xA0\xB0 - xyz789");
+ EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data(),
+ invalid_str.size()));
+ // Additional check for pointer alignment
+ for (int i = 1; i < 8; ++i) {
+ EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data() + i,
+ invalid_str.size() - i));
+ }
+}
+
+} // namespace
+} // namespace internal
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil.cc
index 552d416f63..1a4d71c822 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil.cc
@@ -226,8 +226,8 @@ void SplitStringToIteratorUsing(const string& full,
void SplitStringUsing(const string& full,
const char* delim,
- std::vector<string>* result) {
- std::back_insert_iterator< std::vector<string> > it(*result);
+ vector<string>* result) {
+ std::back_insert_iterator< vector<string> > it(*result);
SplitStringToIteratorUsing(full, delim, it);
}
@@ -264,8 +264,8 @@ void SplitStringToIteratorAllowEmpty(const StringType& full,
}
void SplitStringAllowEmpty(const string& full, const char* delim,
- std::vector<string>* result) {
- std::back_insert_iterator<std::vector<string> > it(*result);
+ vector<string>* result) {
+ std::back_insert_iterator<vector<string> > it(*result);
SplitStringToIteratorAllowEmpty(full, delim, 0, it);
}
@@ -303,7 +303,7 @@ static void JoinStringsIterator(const ITERATOR& start,
}
}
-void JoinStrings(const std::vector<string>& components,
+void JoinStrings(const vector<string>& components,
const char* delim,
string * result) {
JoinStringsIterator(components.begin(), components.end(), delim, result);
@@ -332,7 +332,7 @@ int UnescapeCEscapeSequences(const char* source, char* dest) {
}
int UnescapeCEscapeSequences(const char* source, char* dest,
- std::vector<string> *errors) {
+ vector<string> *errors) {
GOOGLE_DCHECK(errors == NULL) << "Error reporting not implemented.";
char* d = dest;
@@ -468,8 +468,8 @@ int UnescapeCEscapeString(const string& src, string* dest) {
}
int UnescapeCEscapeString(const string& src, string* dest,
- std::vector<string> *errors) {
- std::unique_ptr<char[]> unescaped(new char[src.size() + 1]);
+ vector<string> *errors) {
+ scoped_array<char> unescaped(new char[src.size() + 1]);
int len = UnescapeCEscapeSequences(src.c_str(), unescaped.get(), errors);
GOOGLE_CHECK(dest);
dest->assign(unescaped.get(), len);
@@ -477,7 +477,7 @@ int UnescapeCEscapeString(const string& src, string* dest,
}
string UnescapeCEscapeString(const string& src) {
- std::unique_ptr<char[]> unescaped(new char[src.size() + 1]);
+ scoped_array<char> unescaped(new char[src.size() + 1]);
int len = UnescapeCEscapeSequences(src.c_str(), unescaped.get(), NULL);
return string(unescaped.get(), len);
}
@@ -620,7 +620,7 @@ namespace strings {
string Utf8SafeCEscape(const string& src) {
const int dest_length = src.size() * 4 + 1; // Maximum possible expansion
- std::unique_ptr<char[]> dest(new char[dest_length]);
+ scoped_array<char> dest(new char[dest_length]);
const int len = CEscapeInternal(src.data(), src.size(),
dest.get(), dest_length, false, true);
GOOGLE_DCHECK_GE(len, 0);
@@ -629,7 +629,7 @@ string Utf8SafeCEscape(const string& src) {
string CHexEscape(const string& src) {
const int dest_length = src.size() * 4 + 1; // Maximum possible expansion
- std::unique_ptr<char[]> dest(new char[dest_length]);
+ scoped_array<char> dest(new char[dest_length]);
const int len = CEscapeInternal(src.data(), src.size(),
dest.get(), dest_length, true, false);
GOOGLE_DCHECK_GE(len, 0);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil.h
index a839b8b3ed..df28c94da8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil.h
@@ -213,7 +213,7 @@ LIBPROTOBUF_EXPORT string StringReplace(const string& s, const string& oldsub,
// over all of them.
// ----------------------------------------------------------------------
LIBPROTOBUF_EXPORT void SplitStringUsing(const string& full, const char* delim,
- std::vector<string>* res);
+ vector<string>* res);
// Split a string using one or more byte delimiters, presented
// as a nul-terminated c string. Append the components to 'result'.
@@ -225,15 +225,15 @@ LIBPROTOBUF_EXPORT void SplitStringUsing(const string& full, const char* delim,
// ----------------------------------------------------------------------
LIBPROTOBUF_EXPORT void SplitStringAllowEmpty(const string& full,
const char* delim,
- std::vector<string>* result);
+ vector<string>* result);
// ----------------------------------------------------------------------
// Split()
// Split a string using a character delimiter.
// ----------------------------------------------------------------------
-inline std::vector<string> Split(
+inline vector<string> Split(
const string& full, const char* delim, bool skip_empty = true) {
- std::vector<string> result;
+ vector<string> result;
if (skip_empty) {
SplitStringUsing(full, delim, &result);
} else {
@@ -250,10 +250,10 @@ inline std::vector<string> Split(
// another takes a pointer to the target string. In the latter case the
// target string is cleared and overwritten.
// ----------------------------------------------------------------------
-LIBPROTOBUF_EXPORT void JoinStrings(const std::vector<string>& components,
+LIBPROTOBUF_EXPORT void JoinStrings(const vector<string>& components,
const char* delim, string* result);
-inline string JoinStrings(const std::vector<string>& components,
+inline string JoinStrings(const vector<string>& components,
const char* delim) {
string result;
JoinStrings(components, delim, &result);
@@ -285,15 +285,15 @@ inline string JoinStrings(const std::vector<string>& components,
//
// Errors: In the first form of the call, errors are reported with
// LOG(ERROR). The same is true for the second form of the call if
-// the pointer to the string std::vector is NULL; otherwise, error
-// messages are stored in the std::vector. In either case, the effect on
+// the pointer to the string vector is NULL; otherwise, error
+// messages are stored in the vector. In either case, the effect on
// the dest array is not defined, but rest of the source will be
// processed.
// ----------------------------------------------------------------------
LIBPROTOBUF_EXPORT int UnescapeCEscapeSequences(const char* source, char* dest);
LIBPROTOBUF_EXPORT int UnescapeCEscapeSequences(const char* source, char* dest,
- std::vector<string> *errors);
+ vector<string> *errors);
// ----------------------------------------------------------------------
// UnescapeCEscapeString()
@@ -312,7 +312,7 @@ LIBPROTOBUF_EXPORT int UnescapeCEscapeSequences(const char* source, char* dest,
LIBPROTOBUF_EXPORT int UnescapeCEscapeString(const string& src, string* dest);
LIBPROTOBUF_EXPORT int UnescapeCEscapeString(const string& src, string* dest,
- std::vector<string> *errors);
+ vector<string> *errors);
LIBPROTOBUF_EXPORT string UnescapeCEscapeString(const string& src);
// ----------------------------------------------------------------------
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil_unittest.cc
index 6bf0f5987b..5d62fc4adf 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/strutil_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/strutil_unittest.cc
@@ -782,7 +782,7 @@ TEST(Base64, EscapeAndUnescape) {
reinterpret_cast<const unsigned char*>(base64_strings[i].plaintext);
int plain_length = strlen(base64_strings[i].plaintext);
int cypher_length = strlen(base64_strings[i].cyphertext);
- std::vector<char> buffer(cypher_length+1);
+ vector<char> buffer(cypher_length+1);
int encode_length = WebSafeBase64Escape(unsigned_plaintext,
plain_length,
&buffer[0],
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/substitute.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/substitute.cc
index 7194a5b171..7194a5b171 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/substitute.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/substitute.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/substitute.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/substitute.h
index 7ee442af77..7ee442af77 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/substitute.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/substitute.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/template_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/template_util.h
index feef904bea..feef904bea 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/template_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/template_util.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/template_util_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/template_util_unittest.cc
index b1745e2bf7..b1745e2bf7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/template_util_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/template_util_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/time.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/time.cc
index 6def637ee0..49c0412c17 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/time.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/time.cc
@@ -80,9 +80,9 @@ bool ValidateDateTime(const DateTime& time) {
return false;
}
if (time.month == 2 && IsLeapYear(time.year)) {
- return time.day <= kDaysInMonth[time.month] + 1;
+ return time.month <= kDaysInMonth[time.month] + 1;
} else {
- return time.day <= kDaysInMonth[time.month];
+ return time.month <= kDaysInMonth[time.month];
}
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/time.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/time.h
index 45607ca9bb..45607ca9bb 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/time.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/time.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/time_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/time_test.cc
index 53da948049..59e9d1c73c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/stubs/time_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/time_test.cc
@@ -149,59 +149,6 @@ TEST(DateTimeTest, LeapYear) {
CreateTimestamp(2400, 3, 1) - CreateTimestamp(2400, 2, 29));
}
-TEST(DateTimeTest, WrongDays) {
- int64 seconds;
- DateTime time;
- time.hour = 0;
- time.minute = 0;
- time.second = 0;
- time.month = 2;
-
- // Non-leap year.
- time.year = 2015;
- time.day = 29;
- ASSERT_FALSE(DateTimeToSeconds(time, &seconds));
-
- // Leap year.
- time.year = 2016;
- time.day = 29;
- ASSERT_TRUE(DateTimeToSeconds(time, &seconds));
- time.day = 30;
- ASSERT_FALSE(DateTimeToSeconds(time, &seconds));
-
- // Non-leap year.
- time.year = 2100;
- time.day = 29;
- ASSERT_FALSE(DateTimeToSeconds(time, &seconds));
-
- // Leap year.
- time.year = 2400;
- time.day = 29;
- ASSERT_TRUE(DateTimeToSeconds(time, &seconds));
- time.day = 30;
- ASSERT_FALSE(DateTimeToSeconds(time, &seconds));
-
- // Non-february
- time.year = 2015;
- time.month = 1;
- time.day = 0;
- ASSERT_FALSE(DateTimeToSeconds(time, &seconds));
- time.day = 1;
- ASSERT_TRUE(DateTimeToSeconds(time, &seconds));
- time.day = 31;
- ASSERT_TRUE(DateTimeToSeconds(time, &seconds));
- time.day = 32;
- ASSERT_FALSE(DateTimeToSeconds(time, &seconds));
-
- // Bad month
- time.year = 2015;
- time.month = 0;
- time.day = 1;
- ASSERT_FALSE(DateTimeToSeconds(time, &seconds));
- time.month = 13;
- ASSERT_FALSE(DateTimeToSeconds(time, &seconds));
-}
-
TEST(DateTimeTest, StringFormat) {
DateTime start, end;
start.year = 1;
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/type_traits.h b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/type_traits.h
new file mode 100644
index 0000000000..3ab5ea7d4e
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/type_traits.h
@@ -0,0 +1,364 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// 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: Matt Austern
+//
+// This code is compiled directly on many platforms, including client
+// platforms like Windows, Mac, and embedded systems. Before making
+// any changes here, make sure that you're not breaking any platforms.
+//
+// Define a small subset of tr1 type traits. The traits we define are:
+// enable_if
+// is_integral
+// is_floating_point
+// is_pointer
+// is_enum
+// is_reference
+// is_pod
+// has_trivial_constructor
+// has_trivial_copy
+// has_trivial_assign
+// has_trivial_destructor
+// remove_const
+// remove_volatile
+// remove_cv
+// remove_reference
+// add_reference
+// remove_pointer
+// is_same
+// is_convertible
+// We can add more type traits as required.
+
+#ifndef GOOGLE_PROTOBUF_TYPE_TRAITS_H_
+#define GOOGLE_PROTOBUF_TYPE_TRAITS_H_
+
+#include <cstddef> // for NULL
+#include <utility> // For pair
+
+#include <google/protobuf/stubs/template_util.h> // For true_type and false_type
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+template<typename B, typename D>
+struct is_base_of {
+ typedef char (&yes)[1];
+ typedef char (&no)[2];
+
+ // BEGIN GOOGLE LOCAL MODIFICATION -- check is a #define on Mac.
+ #undef check
+ // END GOOGLE LOCAL MODIFICATION
+
+ static yes check(const B*);
+ static no check(const void*);
+
+ enum {
+ value = sizeof(check(static_cast<const D*>(NULL))) == sizeof(yes),
+ };
+};
+
+template <bool cond, class T = void> struct enable_if;
+template <class T> struct is_integral;
+template <class T> struct is_floating_point;
+template <class T> struct is_pointer;
+// MSVC can't compile this correctly, and neither can gcc 3.3.5 (at least)
+#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
+// is_enum uses is_convertible, which is not available on MSVC.
+template <class T> struct is_enum;
+#endif
+template <class T> struct is_reference;
+template <class T> struct is_pod;
+template <class T> struct has_trivial_constructor;
+template <class T> struct has_trivial_copy;
+template <class T> struct has_trivial_assign;
+template <class T> struct has_trivial_destructor;
+template <class T> struct remove_const;
+template <class T> struct remove_volatile;
+template <class T> struct remove_cv;
+template <class T> struct remove_reference;
+template <class T> struct add_reference;
+template <class T> struct remove_pointer;
+template <class T, class U> struct is_same;
+#if !(defined(__GNUC__) && __GNUC__ <= 3)
+template <class From, class To> struct is_convertible;
+#endif
+
+// enable_if, equivalent semantics to c++11 std::enable_if, specifically:
+// "If B is true, the member typedef type shall equal T; otherwise, there
+// shall be no member typedef type."
+// Specified by 20.9.7.6 [Other transformations]
+
+template<bool cond, class T> struct enable_if { typedef T type; };
+template<class T> struct enable_if<false, T> {};
+// is_integral is false except for the built-in integer types. A
+// cv-qualified type is integral if and only if the underlying type is.
+template <class T> struct is_integral : false_type { };
+template<> struct is_integral<bool> : true_type { };
+template<> struct is_integral<char> : true_type { };
+template<> struct is_integral<unsigned char> : true_type { };
+template<> struct is_integral<signed char> : true_type { };
+#if defined(_MSC_VER)
+// wchar_t is not by default a distinct type from unsigned short in
+// Microsoft C.
+// See http://msdn2.microsoft.com/en-us/library/dh8che7s(VS.80).aspx
+template<> struct is_integral<__wchar_t> : true_type { };
+#else
+template<> struct is_integral<wchar_t> : true_type { };
+#endif
+template<> struct is_integral<short> : true_type { };
+template<> struct is_integral<unsigned short> : true_type { };
+template<> struct is_integral<int> : true_type { };
+template<> struct is_integral<unsigned int> : true_type { };
+template<> struct is_integral<long> : true_type { };
+template<> struct is_integral<unsigned long> : true_type { };
+#if defined(HAVE_LONG_LONG) || defined(_MSC_VER)
+template<> struct is_integral<long long> : true_type { };
+template<> struct is_integral<unsigned long long> : true_type { };
+#endif
+template <class T> struct is_integral<const T> : is_integral<T> { };
+template <class T> struct is_integral<volatile T> : is_integral<T> { };
+template <class T> struct is_integral<const volatile T> : is_integral<T> { };
+
+// is_floating_point is false except for the built-in floating-point types.
+// A cv-qualified type is integral if and only if the underlying type is.
+template <class T> struct is_floating_point : false_type { };
+template<> struct is_floating_point<float> : true_type { };
+template<> struct is_floating_point<double> : true_type { };
+template<> struct is_floating_point<long double> : true_type { };
+template <class T> struct is_floating_point<const T>
+ : is_floating_point<T> { };
+template <class T> struct is_floating_point<volatile T>
+ : is_floating_point<T> { };
+template <class T> struct is_floating_point<const volatile T>
+ : is_floating_point<T> { };
+
+// is_pointer is false except for pointer types. A cv-qualified type (e.g.
+// "int* const", as opposed to "int const*") is cv-qualified if and only if
+// the underlying type is.
+template <class T> struct is_pointer : false_type { };
+template <class T> struct is_pointer<T*> : true_type { };
+template <class T> struct is_pointer<const T> : is_pointer<T> { };
+template <class T> struct is_pointer<volatile T> : is_pointer<T> { };
+template <class T> struct is_pointer<const volatile T> : is_pointer<T> { };
+
+#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
+
+namespace type_traits_internal {
+
+template <class T> struct is_class_or_union {
+ template <class U> static small_ tester(void (U::*)());
+ template <class U> static big_ tester(...);
+ static const bool value = sizeof(tester<T>(0)) == sizeof(small_);
+};
+
+// is_convertible chokes if the first argument is an array. That's why
+// we use add_reference here.
+template <bool NotUnum, class T> struct is_enum_impl
+ : is_convertible<typename add_reference<T>::type, int> { };
+
+template <class T> struct is_enum_impl<true, T> : false_type { };
+
+} // namespace type_traits_internal
+
+// Specified by TR1 [4.5.1] primary type categories.
+
+// Implementation note:
+//
+// Each type is either void, integral, floating point, array, pointer,
+// reference, member object pointer, member function pointer, enum,
+// union or class. Out of these, only integral, floating point, reference,
+// class and enum types are potentially convertible to int. Therefore,
+// if a type is not a reference, integral, floating point or class and
+// is convertible to int, it's a enum. Adding cv-qualification to a type
+// does not change whether it's an enum.
+//
+// Is-convertible-to-int check is done only if all other checks pass,
+// because it can't be used with some types (e.g. void or classes with
+// inaccessible conversion operators).
+template <class T> struct is_enum
+ : type_traits_internal::is_enum_impl<
+ is_same<T, void>::value ||
+ is_integral<T>::value ||
+ is_floating_point<T>::value ||
+ is_reference<T>::value ||
+ type_traits_internal::is_class_or_union<T>::value,
+ T> { };
+
+template <class T> struct is_enum<const T> : is_enum<T> { };
+template <class T> struct is_enum<volatile T> : is_enum<T> { };
+template <class T> struct is_enum<const volatile T> : is_enum<T> { };
+
+#endif
+
+// is_reference is false except for reference types.
+template<typename T> struct is_reference : false_type {};
+template<typename T> struct is_reference<T&> : true_type {};
+
+
+// We can't get is_pod right without compiler help, so fail conservatively.
+// We will assume it's false except for arithmetic types, enumerations,
+// pointers and cv-qualified versions thereof. Note that std::pair<T,U>
+// is not a POD even if T and U are PODs.
+template <class T> struct is_pod
+ : integral_constant<bool, (is_integral<T>::value ||
+ is_floating_point<T>::value ||
+#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
+ // is_enum is not available on MSVC.
+ is_enum<T>::value ||
+#endif
+ is_pointer<T>::value)> { };
+template <class T> struct is_pod<const T> : is_pod<T> { };
+template <class T> struct is_pod<volatile T> : is_pod<T> { };
+template <class T> struct is_pod<const volatile T> : is_pod<T> { };
+
+
+// We can't get has_trivial_constructor right without compiler help, so
+// fail conservatively. We will assume it's false except for: (1) types
+// for which is_pod is true. (2) std::pair of types with trivial
+// constructors. (3) array of a type with a trivial constructor.
+// (4) const versions thereof.
+template <class T> struct has_trivial_constructor : is_pod<T> { };
+template <class T, class U> struct has_trivial_constructor<std::pair<T, U> >
+ : integral_constant<bool,
+ (has_trivial_constructor<T>::value &&
+ has_trivial_constructor<U>::value)> { };
+template <class A, int N> struct has_trivial_constructor<A[N]>
+ : has_trivial_constructor<A> { };
+template <class T> struct has_trivial_constructor<const T>
+ : has_trivial_constructor<T> { };
+
+// We can't get has_trivial_copy right without compiler help, so fail
+// conservatively. We will assume it's false except for: (1) types
+// for which is_pod is true. (2) std::pair of types with trivial copy
+// constructors. (3) array of a type with a trivial copy constructor.
+// (4) const versions thereof.
+template <class T> struct has_trivial_copy : is_pod<T> { };
+template <class T, class U> struct has_trivial_copy<std::pair<T, U> >
+ : integral_constant<bool,
+ (has_trivial_copy<T>::value &&
+ has_trivial_copy<U>::value)> { };
+template <class A, int N> struct has_trivial_copy<A[N]>
+ : has_trivial_copy<A> { };
+template <class T> struct has_trivial_copy<const T> : has_trivial_copy<T> { };
+
+// We can't get has_trivial_assign right without compiler help, so fail
+// conservatively. We will assume it's false except for: (1) types
+// for which is_pod is true. (2) std::pair of types with trivial copy
+// constructors. (3) array of a type with a trivial assign constructor.
+template <class T> struct has_trivial_assign : is_pod<T> { };
+template <class T, class U> struct has_trivial_assign<std::pair<T, U> >
+ : integral_constant<bool,
+ (has_trivial_assign<T>::value &&
+ has_trivial_assign<U>::value)> { };
+template <class A, int N> struct has_trivial_assign<A[N]>
+ : has_trivial_assign<A> { };
+
+// We can't get has_trivial_destructor right without compiler help, so
+// fail conservatively. We will assume it's false except for: (1) types
+// for which is_pod is true. (2) std::pair of types with trivial
+// destructors. (3) array of a type with a trivial destructor.
+// (4) const versions thereof.
+template <class T> struct has_trivial_destructor : is_pod<T> { };
+template <class T, class U> struct has_trivial_destructor<std::pair<T, U> >
+ : integral_constant<bool,
+ (has_trivial_destructor<T>::value &&
+ has_trivial_destructor<U>::value)> { };
+template <class A, int N> struct has_trivial_destructor<A[N]>
+ : has_trivial_destructor<A> { };
+template <class T> struct has_trivial_destructor<const T>
+ : has_trivial_destructor<T> { };
+
+// Specified by TR1 [4.7.1]
+template<typename T> struct remove_const { typedef T type; };
+template<typename T> struct remove_const<T const> { typedef T type; };
+template<typename T> struct remove_volatile { typedef T type; };
+template<typename T> struct remove_volatile<T volatile> { typedef T type; };
+template<typename T> struct remove_cv {
+ typedef typename remove_const<typename remove_volatile<T>::type>::type type;
+};
+
+
+// Specified by TR1 [4.7.2] Reference modifications.
+template<typename T> struct remove_reference { typedef T type; };
+template<typename T> struct remove_reference<T&> { typedef T type; };
+
+template <typename T> struct add_reference { typedef T& type; };
+template <typename T> struct add_reference<T&> { typedef T& type; };
+
+// Specified by TR1 [4.7.4] Pointer modifications.
+template<typename T> struct remove_pointer { typedef T type; };
+template<typename T> struct remove_pointer<T*> { typedef T type; };
+template<typename T> struct remove_pointer<T* const> { typedef T type; };
+template<typename T> struct remove_pointer<T* volatile> { typedef T type; };
+template<typename T> struct remove_pointer<T* const volatile> {
+ typedef T type; };
+
+// Specified by TR1 [4.6] Relationships between types
+template<typename T, typename U> struct is_same : public false_type { };
+template<typename T> struct is_same<T, T> : public true_type { };
+
+// Specified by TR1 [4.6] Relationships between types
+#if !(defined(__GNUC__) && __GNUC__ <= 3)
+namespace type_traits_internal {
+
+// This class is an implementation detail for is_convertible, and you
+// don't need to know how it works to use is_convertible. For those
+// who care: we declare two different functions, one whose argument is
+// of type To and one with a variadic argument list. We give them
+// return types of different size, so we can use sizeof to trick the
+// compiler into telling us which function it would have chosen if we
+// had called it with an argument of type From. See Alexandrescu's
+// _Modern C++ Design_ for more details on this sort of trick.
+
+template <typename From, typename To>
+struct ConvertHelper {
+ static small_ Test(To);
+ static big_ Test(...);
+ static From Create();
+ enum {
+ value = sizeof(Test(Create())) == sizeof(small_)
+ };
+};
+} // namespace type_traits_internal
+
+// Inherits from true_type if From is convertible to To, false_type otherwise.
+template <typename From, typename To>
+struct is_convertible
+ : integral_constant<bool,
+ type_traits_internal::ConvertHelper<From, To>::value> {
+};
+#endif
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_TYPE_TRAITS_H_
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/stubs/type_traits_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/type_traits_unittest.cc
new file mode 100644
index 0000000000..49c10aced6
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/stubs/type_traits_unittest.cc
@@ -0,0 +1,631 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// 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: Matt Austern
+
+#include <google/protobuf/stubs/type_traits.h>
+
+#include <stdlib.h> // for exit()
+#include <stdio.h>
+#include <string>
+#include <vector>
+
+#include <google/protobuf/testing/googletest.h>
+#include <gtest/gtest.h>
+
+typedef int int32;
+// IBM AIX typedefs `int64` in `sys/inttypes.h`, included transitively above.
+#ifndef _AIX
+typedef long int64;
+#endif
+
+using std::string;
+using std::vector;
+using std::pair;
+
+
+// This assertion produces errors like "error: invalid use of
+// incomplete type 'struct <unnamed>::AssertTypesEq<const int, int>'"
+// when it fails.
+template<typename T, typename U> struct AssertTypesEq;
+template<typename T> struct AssertTypesEq<T, T> {};
+#define COMPILE_ASSERT_TYPES_EQ(T, U) static_cast<void>(AssertTypesEq<T, U>())
+
+// A user-defined POD type.
+struct A {
+ int n_;
+};
+
+// A user-defined non-POD type with a trivial copy constructor.
+class B {
+ public:
+ explicit B(int n) : n_(n) { }
+ private:
+ int n_;
+};
+
+// Another user-defined non-POD type with a trivial copy constructor.
+// We will explicitly declare C to have a trivial copy constructor
+// by specializing has_trivial_copy.
+class C {
+ public:
+ explicit C(int n) : n_(n) { }
+ private:
+ int n_;
+};
+
+namespace google {
+namespace protobuf {
+namespace internal {
+template<> struct has_trivial_copy<C> : true_type { };
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+// Another user-defined non-POD type with a trivial assignment operator.
+// We will explicitly declare C to have a trivial assignment operator
+// by specializing has_trivial_assign.
+class D {
+ public:
+ explicit D(int n) : n_(n) { }
+ private:
+ int n_;
+};
+
+namespace google {
+namespace protobuf {
+namespace internal {
+template<> struct has_trivial_assign<D> : true_type { };
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+// Another user-defined non-POD type with a trivial constructor.
+// We will explicitly declare E to have a trivial constructor
+// by specializing has_trivial_constructor.
+class E {
+ public:
+ int n_;
+};
+
+namespace google {
+namespace protobuf {
+namespace internal {
+template<> struct has_trivial_constructor<E> : true_type { };
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+// Another user-defined non-POD type with a trivial destructor.
+// We will explicitly declare E to have a trivial destructor
+// by specializing has_trivial_destructor.
+class F {
+ public:
+ explicit F(int n) : n_(n) { }
+ private:
+ int n_;
+};
+
+namespace google {
+namespace protobuf {
+namespace internal {
+template<> struct has_trivial_destructor<F> : true_type { };
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+enum G {};
+
+union H {};
+
+class I {
+ public:
+ operator int() const;
+};
+
+class J {
+ private:
+ operator int() const;
+};
+
+namespace google {
+namespace protobuf {
+namespace internal {
+namespace {
+
+// A base class and a derived class that inherits from it, used for
+// testing conversion type traits.
+class Base {
+ public:
+ virtual ~Base() { }
+};
+
+class Derived : public Base {
+};
+
+TEST(TypeTraitsTest, TestIsInteger) {
+ // Verify that is_integral is true for all integer types.
+ EXPECT_TRUE(is_integral<bool>::value);
+ EXPECT_TRUE(is_integral<char>::value);
+ EXPECT_TRUE(is_integral<unsigned char>::value);
+ EXPECT_TRUE(is_integral<signed char>::value);
+ EXPECT_TRUE(is_integral<wchar_t>::value);
+ EXPECT_TRUE(is_integral<int>::value);
+ EXPECT_TRUE(is_integral<unsigned int>::value);
+ EXPECT_TRUE(is_integral<short>::value);
+ EXPECT_TRUE(is_integral<unsigned short>::value);
+ EXPECT_TRUE(is_integral<long>::value);
+ EXPECT_TRUE(is_integral<unsigned long>::value);
+
+ // Verify that is_integral is false for a few non-integer types.
+ EXPECT_FALSE(is_integral<void>::value);
+ EXPECT_FALSE(is_integral<float>::value);
+ EXPECT_FALSE(is_integral<string>::value);
+ EXPECT_FALSE(is_integral<int*>::value);
+ EXPECT_FALSE(is_integral<A>::value);
+ EXPECT_FALSE((is_integral<pair<int, int> >::value));
+
+ // Verify that cv-qualified integral types are still integral, and
+ // cv-qualified non-integral types are still non-integral.
+ EXPECT_TRUE(is_integral<const char>::value);
+ EXPECT_TRUE(is_integral<volatile bool>::value);
+ EXPECT_TRUE(is_integral<const volatile unsigned int>::value);
+ EXPECT_FALSE(is_integral<const float>::value);
+ EXPECT_FALSE(is_integral<int* volatile>::value);
+ EXPECT_FALSE(is_integral<const volatile string>::value);
+}
+
+TEST(TypeTraitsTest, TestIsFloating) {
+ // Verify that is_floating_point is true for all floating-point types.
+ EXPECT_TRUE(is_floating_point<float>::value);
+ EXPECT_TRUE(is_floating_point<double>::value);
+ EXPECT_TRUE(is_floating_point<long double>::value);
+
+ // Verify that is_floating_point is false for a few non-float types.
+ EXPECT_FALSE(is_floating_point<void>::value);
+ EXPECT_FALSE(is_floating_point<long>::value);
+ EXPECT_FALSE(is_floating_point<string>::value);
+ EXPECT_FALSE(is_floating_point<float*>::value);
+ EXPECT_FALSE(is_floating_point<A>::value);
+ EXPECT_FALSE((is_floating_point<pair<int, int> >::value));
+
+ // Verify that cv-qualified floating point types are still floating, and
+ // cv-qualified non-floating types are still non-floating.
+ EXPECT_TRUE(is_floating_point<const float>::value);
+ EXPECT_TRUE(is_floating_point<volatile double>::value);
+ EXPECT_TRUE(is_floating_point<const volatile long double>::value);
+ EXPECT_FALSE(is_floating_point<const int>::value);
+ EXPECT_FALSE(is_floating_point<volatile string>::value);
+ EXPECT_FALSE(is_floating_point<const volatile char>::value);
+}
+
+TEST(TypeTraitsTest, TestIsPointer) {
+ // Verify that is_pointer is true for some pointer types.
+ EXPECT_TRUE(is_pointer<int*>::value);
+ EXPECT_TRUE(is_pointer<void*>::value);
+ EXPECT_TRUE(is_pointer<string*>::value);
+ EXPECT_TRUE(is_pointer<const void*>::value);
+ EXPECT_TRUE(is_pointer<volatile float* const*>::value);
+
+ // Verify that is_pointer is false for some non-pointer types.
+ EXPECT_FALSE(is_pointer<void>::value);
+ EXPECT_FALSE(is_pointer<float&>::value);
+ EXPECT_FALSE(is_pointer<long>::value);
+ EXPECT_FALSE(is_pointer<vector<int*> >::value);
+ EXPECT_FALSE(is_pointer<int[5]>::value);
+
+ // A function pointer is a pointer, but a function type, or a function
+ // reference type, is not.
+ EXPECT_TRUE(is_pointer<int (*)(int x)>::value);
+ EXPECT_FALSE(is_pointer<void(char x)>::value);
+ EXPECT_FALSE(is_pointer<double (&)(string x)>::value);
+
+ // Verify that is_pointer<T> is true for some cv-qualified pointer types,
+ // and false for some cv-qualified non-pointer types.
+ EXPECT_TRUE(is_pointer<int* const>::value);
+ EXPECT_TRUE(is_pointer<const void* volatile>::value);
+ EXPECT_TRUE(is_pointer<char** const volatile>::value);
+ EXPECT_FALSE(is_pointer<const int>::value);
+ EXPECT_FALSE(is_pointer<volatile vector<int*> >::value);
+ EXPECT_FALSE(is_pointer<const volatile double>::value);
+}
+
+TEST(TypeTraitsTest, TestIsEnum) {
+// is_enum isn't supported on MSVC or gcc 3.x
+#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
+ // Verify that is_enum is true for enum types.
+ EXPECT_TRUE(is_enum<G>::value);
+ EXPECT_TRUE(is_enum<const G>::value);
+ EXPECT_TRUE(is_enum<volatile G>::value);
+ EXPECT_TRUE(is_enum<const volatile G>::value);
+
+ // Verify that is_enum is false for a few non-enum types.
+ EXPECT_FALSE(is_enum<void>::value);
+ EXPECT_FALSE(is_enum<G&>::value);
+ EXPECT_FALSE(is_enum<G[1]>::value);
+ EXPECT_FALSE(is_enum<const G[1]>::value);
+ EXPECT_FALSE(is_enum<G[]>::value);
+ EXPECT_FALSE(is_enum<int>::value);
+ EXPECT_FALSE(is_enum<float>::value);
+ EXPECT_FALSE(is_enum<A>::value);
+ EXPECT_FALSE(is_enum<A*>::value);
+ EXPECT_FALSE(is_enum<const A>::value);
+ EXPECT_FALSE(is_enum<H>::value);
+ EXPECT_FALSE(is_enum<I>::value);
+ EXPECT_FALSE(is_enum<J>::value);
+ EXPECT_FALSE(is_enum<void()>::value);
+ EXPECT_FALSE(is_enum<void(*)()>::value);
+ EXPECT_FALSE(is_enum<int A::*>::value);
+ EXPECT_FALSE(is_enum<void (A::*)()>::value);
+#endif
+}
+
+TEST(TypeTraitsTest, TestIsReference) {
+ // Verifies that is_reference is true for all reference types.
+ typedef float& RefFloat;
+ EXPECT_TRUE(is_reference<float&>::value);
+ EXPECT_TRUE(is_reference<const int&>::value);
+ EXPECT_TRUE(is_reference<const int*&>::value);
+ EXPECT_TRUE(is_reference<int (&)(bool)>::value);
+ EXPECT_TRUE(is_reference<RefFloat>::value);
+ EXPECT_TRUE(is_reference<const RefFloat>::value);
+ EXPECT_TRUE(is_reference<volatile RefFloat>::value);
+ EXPECT_TRUE(is_reference<const volatile RefFloat>::value);
+
+
+ // Verifies that is_reference is false for all non-reference types.
+ EXPECT_FALSE(is_reference<float>::value);
+ EXPECT_FALSE(is_reference<const float>::value);
+ EXPECT_FALSE(is_reference<volatile float>::value);
+ EXPECT_FALSE(is_reference<const volatile float>::value);
+ EXPECT_FALSE(is_reference<const int*>::value);
+ EXPECT_FALSE(is_reference<int()>::value);
+ EXPECT_FALSE(is_reference<void(*)(const char&)>::value);
+}
+
+TEST(TypeTraitsTest, TestAddReference) {
+ COMPILE_ASSERT_TYPES_EQ(int&, add_reference<int>::type);
+ COMPILE_ASSERT_TYPES_EQ(const int&, add_reference<const int>::type);
+ COMPILE_ASSERT_TYPES_EQ(volatile int&,
+ add_reference<volatile int>::type);
+ COMPILE_ASSERT_TYPES_EQ(const volatile int&,
+ add_reference<const volatile int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int&, add_reference<int&>::type);
+ COMPILE_ASSERT_TYPES_EQ(const int&, add_reference<const int&>::type);
+ COMPILE_ASSERT_TYPES_EQ(volatile int&,
+ add_reference<volatile int&>::type);
+ COMPILE_ASSERT_TYPES_EQ(const volatile int&,
+ add_reference<const volatile int&>::type);
+}
+
+TEST(TypeTraitsTest, TestIsPod) {
+ // Verify that arithmetic types and pointers are marked as PODs.
+ EXPECT_TRUE(is_pod<bool>::value);
+ EXPECT_TRUE(is_pod<char>::value);
+ EXPECT_TRUE(is_pod<unsigned char>::value);
+ EXPECT_TRUE(is_pod<signed char>::value);
+ EXPECT_TRUE(is_pod<wchar_t>::value);
+ EXPECT_TRUE(is_pod<int>::value);
+ EXPECT_TRUE(is_pod<unsigned int>::value);
+ EXPECT_TRUE(is_pod<short>::value);
+ EXPECT_TRUE(is_pod<unsigned short>::value);
+ EXPECT_TRUE(is_pod<long>::value);
+ EXPECT_TRUE(is_pod<unsigned long>::value);
+ EXPECT_TRUE(is_pod<float>::value);
+ EXPECT_TRUE(is_pod<double>::value);
+ EXPECT_TRUE(is_pod<long double>::value);
+ EXPECT_TRUE(is_pod<string*>::value);
+ EXPECT_TRUE(is_pod<A*>::value);
+ EXPECT_TRUE(is_pod<const B*>::value);
+ EXPECT_TRUE(is_pod<C**>::value);
+ EXPECT_TRUE(is_pod<const int>::value);
+ EXPECT_TRUE(is_pod<char* volatile>::value);
+ EXPECT_TRUE(is_pod<const volatile double>::value);
+#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
+ EXPECT_TRUE(is_pod<G>::value);
+ EXPECT_TRUE(is_pod<const G>::value);
+ EXPECT_TRUE(is_pod<volatile G>::value);
+ EXPECT_TRUE(is_pod<const volatile G>::value);
+#endif
+
+ // Verify that some non-POD types are not marked as PODs.
+ EXPECT_FALSE(is_pod<void>::value);
+ EXPECT_FALSE(is_pod<string>::value);
+ EXPECT_FALSE((is_pod<pair<int, int> >::value));
+ EXPECT_FALSE(is_pod<A>::value);
+ EXPECT_FALSE(is_pod<B>::value);
+ EXPECT_FALSE(is_pod<C>::value);
+ EXPECT_FALSE(is_pod<const string>::value);
+ EXPECT_FALSE(is_pod<volatile A>::value);
+ EXPECT_FALSE(is_pod<const volatile B>::value);
+}
+
+TEST(TypeTraitsTest, TestHasTrivialConstructor) {
+ // Verify that arithmetic types and pointers have trivial constructors.
+ EXPECT_TRUE(has_trivial_constructor<bool>::value);
+ EXPECT_TRUE(has_trivial_constructor<char>::value);
+ EXPECT_TRUE(has_trivial_constructor<unsigned char>::value);
+ EXPECT_TRUE(has_trivial_constructor<signed char>::value);
+ EXPECT_TRUE(has_trivial_constructor<wchar_t>::value);
+ EXPECT_TRUE(has_trivial_constructor<int>::value);
+ EXPECT_TRUE(has_trivial_constructor<unsigned int>::value);
+ EXPECT_TRUE(has_trivial_constructor<short>::value);
+ EXPECT_TRUE(has_trivial_constructor<unsigned short>::value);
+ EXPECT_TRUE(has_trivial_constructor<long>::value);
+ EXPECT_TRUE(has_trivial_constructor<unsigned long>::value);
+ EXPECT_TRUE(has_trivial_constructor<float>::value);
+ EXPECT_TRUE(has_trivial_constructor<double>::value);
+ EXPECT_TRUE(has_trivial_constructor<long double>::value);
+ EXPECT_TRUE(has_trivial_constructor<string*>::value);
+ EXPECT_TRUE(has_trivial_constructor<A*>::value);
+ EXPECT_TRUE(has_trivial_constructor<const B*>::value);
+ EXPECT_TRUE(has_trivial_constructor<C**>::value);
+
+ // Verify that pairs and arrays of such types have trivial
+ // constructors.
+ typedef int int10[10];
+ EXPECT_TRUE((has_trivial_constructor<pair<int, char*> >::value));
+ EXPECT_TRUE(has_trivial_constructor<int10>::value);
+
+ // Verify that pairs of types without trivial constructors
+ // are not marked as trivial.
+ EXPECT_FALSE((has_trivial_constructor<pair<int, string> >::value));
+ EXPECT_FALSE((has_trivial_constructor<pair<string, int> >::value));
+
+ // Verify that types without trivial constructors are
+ // correctly marked as such.
+ EXPECT_FALSE(has_trivial_constructor<string>::value);
+ EXPECT_FALSE(has_trivial_constructor<vector<int> >::value);
+
+ // Verify that E, which we have declared to have a trivial
+ // constructor, is correctly marked as such.
+ EXPECT_TRUE(has_trivial_constructor<E>::value);
+}
+
+TEST(TypeTraitsTest, TestHasTrivialCopy) {
+ // Verify that arithmetic types and pointers have trivial copy
+ // constructors.
+ EXPECT_TRUE(has_trivial_copy<bool>::value);
+ EXPECT_TRUE(has_trivial_copy<char>::value);
+ EXPECT_TRUE(has_trivial_copy<unsigned char>::value);
+ EXPECT_TRUE(has_trivial_copy<signed char>::value);
+ EXPECT_TRUE(has_trivial_copy<wchar_t>::value);
+ EXPECT_TRUE(has_trivial_copy<int>::value);
+ EXPECT_TRUE(has_trivial_copy<unsigned int>::value);
+ EXPECT_TRUE(has_trivial_copy<short>::value);
+ EXPECT_TRUE(has_trivial_copy<unsigned short>::value);
+ EXPECT_TRUE(has_trivial_copy<long>::value);
+ EXPECT_TRUE(has_trivial_copy<unsigned long>::value);
+ EXPECT_TRUE(has_trivial_copy<float>::value);
+ EXPECT_TRUE(has_trivial_copy<double>::value);
+ EXPECT_TRUE(has_trivial_copy<long double>::value);
+ EXPECT_TRUE(has_trivial_copy<string*>::value);
+ EXPECT_TRUE(has_trivial_copy<A*>::value);
+ EXPECT_TRUE(has_trivial_copy<const B*>::value);
+ EXPECT_TRUE(has_trivial_copy<C**>::value);
+
+ // Verify that pairs and arrays of such types have trivial
+ // copy constructors.
+ typedef int int10[10];
+ EXPECT_TRUE((has_trivial_copy<pair<int, char*> >::value));
+ EXPECT_TRUE(has_trivial_copy<int10>::value);
+
+ // Verify that pairs of types without trivial copy constructors
+ // are not marked as trivial.
+ EXPECT_FALSE((has_trivial_copy<pair<int, string> >::value));
+ EXPECT_FALSE((has_trivial_copy<pair<string, int> >::value));
+
+ // Verify that types without trivial copy constructors are
+ // correctly marked as such.
+ EXPECT_FALSE(has_trivial_copy<string>::value);
+ EXPECT_FALSE(has_trivial_copy<vector<int> >::value);
+
+ // Verify that C, which we have declared to have a trivial
+ // copy constructor, is correctly marked as such.
+ EXPECT_TRUE(has_trivial_copy<C>::value);
+}
+
+TEST(TypeTraitsTest, TestHasTrivialAssign) {
+ // Verify that arithmetic types and pointers have trivial assignment
+ // operators.
+ EXPECT_TRUE(has_trivial_assign<bool>::value);
+ EXPECT_TRUE(has_trivial_assign<char>::value);
+ EXPECT_TRUE(has_trivial_assign<unsigned char>::value);
+ EXPECT_TRUE(has_trivial_assign<signed char>::value);
+ EXPECT_TRUE(has_trivial_assign<wchar_t>::value);
+ EXPECT_TRUE(has_trivial_assign<int>::value);
+ EXPECT_TRUE(has_trivial_assign<unsigned int>::value);
+ EXPECT_TRUE(has_trivial_assign<short>::value);
+ EXPECT_TRUE(has_trivial_assign<unsigned short>::value);
+ EXPECT_TRUE(has_trivial_assign<long>::value);
+ EXPECT_TRUE(has_trivial_assign<unsigned long>::value);
+ EXPECT_TRUE(has_trivial_assign<float>::value);
+ EXPECT_TRUE(has_trivial_assign<double>::value);
+ EXPECT_TRUE(has_trivial_assign<long double>::value);
+ EXPECT_TRUE(has_trivial_assign<string*>::value);
+ EXPECT_TRUE(has_trivial_assign<A*>::value);
+ EXPECT_TRUE(has_trivial_assign<const B*>::value);
+ EXPECT_TRUE(has_trivial_assign<C**>::value);
+
+ // Verify that pairs and arrays of such types have trivial
+ // assignment operators.
+ typedef int int10[10];
+ EXPECT_TRUE((has_trivial_assign<pair<int, char*> >::value));
+ EXPECT_TRUE(has_trivial_assign<int10>::value);
+
+ // Verify that pairs of types without trivial assignment operators
+ // are not marked as trivial.
+ EXPECT_FALSE((has_trivial_assign<pair<int, string> >::value));
+ EXPECT_FALSE((has_trivial_assign<pair<string, int> >::value));
+
+ // Verify that types without trivial assignment operators are
+ // correctly marked as such.
+ EXPECT_FALSE(has_trivial_assign<string>::value);
+ EXPECT_FALSE(has_trivial_assign<vector<int> >::value);
+
+ // Verify that D, which we have declared to have a trivial
+ // assignment operator, is correctly marked as such.
+ EXPECT_TRUE(has_trivial_assign<D>::value);
+}
+
+TEST(TypeTraitsTest, TestHasTrivialDestructor) {
+ // Verify that arithmetic types and pointers have trivial destructors.
+ EXPECT_TRUE(has_trivial_destructor<bool>::value);
+ EXPECT_TRUE(has_trivial_destructor<char>::value);
+ EXPECT_TRUE(has_trivial_destructor<unsigned char>::value);
+ EXPECT_TRUE(has_trivial_destructor<signed char>::value);
+ EXPECT_TRUE(has_trivial_destructor<wchar_t>::value);
+ EXPECT_TRUE(has_trivial_destructor<int>::value);
+ EXPECT_TRUE(has_trivial_destructor<unsigned int>::value);
+ EXPECT_TRUE(has_trivial_destructor<short>::value);
+ EXPECT_TRUE(has_trivial_destructor<unsigned short>::value);
+ EXPECT_TRUE(has_trivial_destructor<long>::value);
+ EXPECT_TRUE(has_trivial_destructor<unsigned long>::value);
+ EXPECT_TRUE(has_trivial_destructor<float>::value);
+ EXPECT_TRUE(has_trivial_destructor<double>::value);
+ EXPECT_TRUE(has_trivial_destructor<long double>::value);
+ EXPECT_TRUE(has_trivial_destructor<string*>::value);
+ EXPECT_TRUE(has_trivial_destructor<A*>::value);
+ EXPECT_TRUE(has_trivial_destructor<const B*>::value);
+ EXPECT_TRUE(has_trivial_destructor<C**>::value);
+
+ // Verify that pairs and arrays of such types have trivial
+ // destructors.
+ typedef int int10[10];
+ EXPECT_TRUE((has_trivial_destructor<pair<int, char*> >::value));
+ EXPECT_TRUE(has_trivial_destructor<int10>::value);
+
+ // Verify that pairs of types without trivial destructors
+ // are not marked as trivial.
+ EXPECT_FALSE((has_trivial_destructor<pair<int, string> >::value));
+ EXPECT_FALSE((has_trivial_destructor<pair<string, int> >::value));
+
+ // Verify that types without trivial destructors are
+ // correctly marked as such.
+ EXPECT_FALSE(has_trivial_destructor<string>::value);
+ EXPECT_FALSE(has_trivial_destructor<vector<int> >::value);
+
+ // Verify that F, which we have declared to have a trivial
+ // destructor, is correctly marked as such.
+ EXPECT_TRUE(has_trivial_destructor<F>::value);
+}
+
+// Tests remove_pointer.
+TEST(TypeTraitsTest, TestRemovePointer) {
+ COMPILE_ASSERT_TYPES_EQ(int, remove_pointer<int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int, remove_pointer<int*>::type);
+ COMPILE_ASSERT_TYPES_EQ(const int, remove_pointer<const int*>::type);
+ COMPILE_ASSERT_TYPES_EQ(int, remove_pointer<int* const>::type);
+ COMPILE_ASSERT_TYPES_EQ(int, remove_pointer<int* volatile>::type);
+}
+
+TEST(TypeTraitsTest, TestRemoveConst) {
+ COMPILE_ASSERT_TYPES_EQ(int, remove_const<int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int, remove_const<const int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int *, remove_const<int * const>::type);
+ // TR1 examples.
+ COMPILE_ASSERT_TYPES_EQ(const int *, remove_const<const int *>::type);
+ COMPILE_ASSERT_TYPES_EQ(volatile int,
+ remove_const<const volatile int>::type);
+}
+
+TEST(TypeTraitsTest, TestRemoveVolatile) {
+ COMPILE_ASSERT_TYPES_EQ(int, remove_volatile<int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int, remove_volatile<volatile int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int *, remove_volatile<int * volatile>::type);
+ // TR1 examples.
+ COMPILE_ASSERT_TYPES_EQ(volatile int *,
+ remove_volatile<volatile int *>::type);
+ COMPILE_ASSERT_TYPES_EQ(const int,
+ remove_volatile<const volatile int>::type);
+}
+
+TEST(TypeTraitsTest, TestRemoveCV) {
+ COMPILE_ASSERT_TYPES_EQ(int, remove_cv<int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int, remove_cv<volatile int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int, remove_cv<const int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int *, remove_cv<int * const volatile>::type);
+ // TR1 examples.
+ COMPILE_ASSERT_TYPES_EQ(const volatile int *,
+ remove_cv<const volatile int *>::type);
+ COMPILE_ASSERT_TYPES_EQ(int,
+ remove_cv<const volatile int>::type);
+}
+
+TEST(TypeTraitsTest, TestRemoveReference) {
+ COMPILE_ASSERT_TYPES_EQ(int, remove_reference<int>::type);
+ COMPILE_ASSERT_TYPES_EQ(int, remove_reference<int&>::type);
+ COMPILE_ASSERT_TYPES_EQ(const int, remove_reference<const int&>::type);
+ COMPILE_ASSERT_TYPES_EQ(int*, remove_reference<int * &>::type);
+}
+
+TEST(TypeTraitsTest, TestIsSame) {
+ EXPECT_TRUE((is_same<int32, int32>::value));
+ EXPECT_FALSE((is_same<int32, int64>::value));
+ EXPECT_FALSE((is_same<int64, int32>::value));
+ EXPECT_FALSE((is_same<int, const int>::value));
+
+ EXPECT_TRUE((is_same<void, void>::value));
+ EXPECT_FALSE((is_same<void, int>::value));
+ EXPECT_FALSE((is_same<int, void>::value));
+
+ EXPECT_TRUE((is_same<int*, int*>::value));
+ EXPECT_TRUE((is_same<void*, void*>::value));
+ EXPECT_FALSE((is_same<int*, void*>::value));
+ EXPECT_FALSE((is_same<void*, int*>::value));
+ EXPECT_FALSE((is_same<void*, const void*>::value));
+ EXPECT_FALSE((is_same<void*, void* const>::value));
+
+ EXPECT_TRUE((is_same<Base*, Base*>::value));
+ EXPECT_TRUE((is_same<Derived*, Derived*>::value));
+ EXPECT_FALSE((is_same<Base*, Derived*>::value));
+ EXPECT_FALSE((is_same<Derived*, Base*>::value));
+}
+
+TEST(TypeTraitsTest, TestConvertible) {
+#if !(defined(__GNUC__) && __GNUC__ <= 3)
+ EXPECT_TRUE((is_convertible<int, int>::value));
+ EXPECT_TRUE((is_convertible<int, long>::value));
+ EXPECT_TRUE((is_convertible<long, int>::value));
+
+ EXPECT_TRUE((is_convertible<int*, void*>::value));
+ EXPECT_FALSE((is_convertible<void*, int*>::value));
+
+ EXPECT_TRUE((is_convertible<Derived*, Base*>::value));
+ EXPECT_FALSE((is_convertible<Base*, Derived*>::value));
+ EXPECT_TRUE((is_convertible<Derived*, const Base*>::value));
+ EXPECT_FALSE((is_convertible<const Derived*, Base*>::value));
+#endif
+}
+
+} // anonymous namespace
+} // namespace internal
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/test_messages_proto2.proto b/third_party/protobuf/3.4.0/src/google/protobuf/test_messages_proto2.proto
index 60dbfc753a..cbe0d17085 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/test_messages_proto2.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/test_messages_proto2.proto
@@ -81,10 +81,10 @@ message TestAllTypesProto2 {
optional bytes optional_bytes = 15;
optional NestedMessage optional_nested_message = 18;
- optional ForeignMessageProto2 optional_foreign_message = 19;
+ optional ForeignMessage optional_foreign_message = 19;
optional NestedEnum optional_nested_enum = 21;
- optional ForeignEnumProto2 optional_foreign_enum = 22;
+ optional ForeignEnum optional_foreign_enum = 22;
optional string optional_string_piece = 24 [ctype=STRING_PIECE];
optional string optional_cord = 25 [ctype=CORD];
@@ -109,10 +109,10 @@ message TestAllTypesProto2 {
repeated bytes repeated_bytes = 45;
repeated NestedMessage repeated_nested_message = 48;
- repeated ForeignMessageProto2 repeated_foreign_message = 49;
+ repeated ForeignMessage repeated_foreign_message = 49;
repeated NestedEnum repeated_nested_enum = 51;
- repeated ForeignEnumProto2 repeated_foreign_enum = 52;
+ repeated ForeignEnum repeated_foreign_enum = 52;
repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
repeated string repeated_cord = 55 [ctype=CORD];
@@ -134,9 +134,9 @@ message TestAllTypesProto2 {
map < string, string> map_string_string = 69;
map < string, bytes> map_string_bytes = 70;
map < string, NestedMessage> map_string_nested_message = 71;
- map < string, ForeignMessageProto2> map_string_foreign_message = 72;
+ map < string, ForeignMessage> map_string_foreign_message = 72;
map < string, NestedEnum> map_string_nested_enum = 73;
- map < string, ForeignEnumProto2> map_string_foreign_enum = 74;
+ map < string, ForeignEnum> map_string_foreign_enum = 74;
oneof oneof_field {
uint32 oneof_uint32 = 111;
@@ -201,11 +201,11 @@ message TestAllTypesProto2 {
}
}
-message ForeignMessageProto2 {
+message ForeignMessage {
optional int32 c = 1;
}
-enum ForeignEnumProto2 {
+enum ForeignEnum {
FOREIGN_FOO = 0;
FOREIGN_BAR = 1;
FOREIGN_BAZ = 2;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/test_messages_proto3.proto b/third_party/protobuf/3.4.0/src/google/protobuf/test_messages_proto3.proto
index 4f295aac49..84b9da9922 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/test_messages_proto3.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/test_messages_proto3.proto
@@ -215,9 +215,6 @@ message TestAllTypesProto3 {
int32 field__Name16 = 416;
int32 field_name17__ = 417;
int32 Field_name18__ = 418;
-
- // Reserved for testing unknown fields
- reserved 501 to 510;
}
message ForeignMessage {
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/test_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/test_util.cc
new file mode 100644
index 0000000000..4e02a85d85
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/test_util.cc
@@ -0,0 +1,3350 @@
+// 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.
+
+#ifdef _WIN32
+// Verify that #including windows.h does not break anything (e.g. because
+// windows.h #defines GetMessage() as a macro).
+#include <windows.h>
+#endif
+
+#include <google/protobuf/test_util.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/message.h>
+
+#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/testing/googletest.h>
+#include <gtest/gtest.h>
+
+namespace google {
+namespace protobuf {
+
+void TestUtil::SetAllFields(unittest::TestAllTypes* message) {
+ SetOptionalFields(message);
+ AddRepeatedFields1(message);
+ AddRepeatedFields2(message);
+ SetDefaultFields(message);
+ SetOneofFields(message);
+}
+
+void TestUtil::SetOptionalFields(unittest::TestAllTypes* message) {
+ message->set_optional_int32 (101);
+ message->set_optional_int64 (102);
+ message->set_optional_uint32 (103);
+ message->set_optional_uint64 (104);
+ message->set_optional_sint32 (105);
+ message->set_optional_sint64 (106);
+ message->set_optional_fixed32 (107);
+ message->set_optional_fixed64 (108);
+ message->set_optional_sfixed32(109);
+ message->set_optional_sfixed64(110);
+ message->set_optional_float (111);
+ message->set_optional_double (112);
+ message->set_optional_bool (true);
+ message->set_optional_string ("115");
+ message->set_optional_bytes ("116");
+
+ message->mutable_optionalgroup ()->set_a(117);
+ message->mutable_optional_nested_message ()->set_bb(118);
+ message->mutable_optional_foreign_message ()->set_c(119);
+ message->mutable_optional_import_message ()->set_d(120);
+ message->mutable_optional_public_import_message()->set_e(126);
+ message->mutable_optional_lazy_message ()->set_bb(127);
+
+ message->set_optional_nested_enum (unittest::TestAllTypes::BAZ);
+ message->set_optional_foreign_enum(unittest::FOREIGN_BAZ );
+ message->set_optional_import_enum (unittest_import::IMPORT_BAZ);
+
+ // StringPiece and Cord fields are only accessible via reflection in the
+ // open source release; see comments in compiler/cpp/string_field.cc.
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ message->GetReflection()->SetString(
+ message,
+ message->GetDescriptor()->FindFieldByName("optional_string_piece"),
+ "124");
+ message->GetReflection()->SetString(
+ message,
+ message->GetDescriptor()->FindFieldByName("optional_cord"),
+ "125");
+#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::AddRepeatedFields1(unittest::TestAllTypes* message) {
+ message->add_repeated_int32 (201);
+ message->add_repeated_int64 (202);
+ message->add_repeated_uint32 (203);
+ message->add_repeated_uint64 (204);
+ message->add_repeated_sint32 (205);
+ message->add_repeated_sint64 (206);
+ message->add_repeated_fixed32 (207);
+ message->add_repeated_fixed64 (208);
+ message->add_repeated_sfixed32(209);
+ message->add_repeated_sfixed64(210);
+ message->add_repeated_float (211);
+ message->add_repeated_double (212);
+ message->add_repeated_bool (true);
+ message->add_repeated_string ("215");
+ message->add_repeated_bytes ("216");
+
+ message->add_repeatedgroup ()->set_a(217);
+ message->add_repeated_nested_message ()->set_bb(218);
+ message->add_repeated_foreign_message()->set_c(219);
+ message->add_repeated_import_message ()->set_d(220);
+ message->add_repeated_lazy_message ()->set_bb(227);
+
+ message->add_repeated_nested_enum (unittest::TestAllTypes::BAR);
+ message->add_repeated_foreign_enum(unittest::FOREIGN_BAR );
+ message->add_repeated_import_enum (unittest_import::IMPORT_BAR);
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ message->GetReflection()->AddString(
+ message,
+ message->GetDescriptor()->FindFieldByName("repeated_string_piece"),
+ "224");
+ message->GetReflection()->AddString(
+ message,
+ message->GetDescriptor()->FindFieldByName("repeated_cord"),
+ "225");
+#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
+}
+
+void TestUtil::AddRepeatedFields2(unittest::TestAllTypes* message) {
+ // Add a second one of each field.
+ message->add_repeated_int32 (301);
+ message->add_repeated_int64 (302);
+ message->add_repeated_uint32 (303);
+ message->add_repeated_uint64 (304);
+ message->add_repeated_sint32 (305);
+ message->add_repeated_sint64 (306);
+ message->add_repeated_fixed32 (307);
+ message->add_repeated_fixed64 (308);
+ message->add_repeated_sfixed32(309);
+ message->add_repeated_sfixed64(310);
+ message->add_repeated_float (311);
+ message->add_repeated_double (312);
+ message->add_repeated_bool (false);
+ message->add_repeated_string ("315");
+ message->add_repeated_bytes ("316");
+
+ message->add_repeatedgroup ()->set_a(317);
+ message->add_repeated_nested_message ()->set_bb(318);
+ message->add_repeated_foreign_message()->set_c(319);
+ message->add_repeated_import_message ()->set_d(320);
+ message->add_repeated_lazy_message ()->set_bb(327);
+
+ message->add_repeated_nested_enum (unittest::TestAllTypes::BAZ);
+ message->add_repeated_foreign_enum(unittest::FOREIGN_BAZ );
+ message->add_repeated_import_enum (unittest_import::IMPORT_BAZ);
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ message->GetReflection()->AddString(
+ message,
+ message->GetDescriptor()->FindFieldByName("repeated_string_piece"),
+ "324");
+ message->GetReflection()->AddString(
+ message,
+ message->GetDescriptor()->FindFieldByName("repeated_cord"),
+ "325");
+#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::SetDefaultFields(unittest::TestAllTypes* message) {
+ message->set_default_int32 (401);
+ message->set_default_int64 (402);
+ message->set_default_uint32 (403);
+ message->set_default_uint64 (404);
+ message->set_default_sint32 (405);
+ message->set_default_sint64 (406);
+ message->set_default_fixed32 (407);
+ message->set_default_fixed64 (408);
+ message->set_default_sfixed32(409);
+ message->set_default_sfixed64(410);
+ message->set_default_float (411);
+ message->set_default_double (412);
+ message->set_default_bool (false);
+ message->set_default_string ("415");
+ message->set_default_bytes ("416");
+
+ message->set_default_nested_enum (unittest::TestAllTypes::FOO);
+ message->set_default_foreign_enum(unittest::FOREIGN_FOO );
+ message->set_default_import_enum (unittest_import::IMPORT_FOO);
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ message->GetReflection()->SetString(
+ message,
+ message->GetDescriptor()->FindFieldByName("default_string_piece"),
+ "424");
+ message->GetReflection()->SetString(
+ message,
+ message->GetDescriptor()->FindFieldByName("default_cord"),
+ "425");
+#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ModifyRepeatedFields(unittest::TestAllTypes* message) {
+ message->set_repeated_int32 (1, 501);
+ message->set_repeated_int64 (1, 502);
+ message->set_repeated_uint32 (1, 503);
+ message->set_repeated_uint64 (1, 504);
+ message->set_repeated_sint32 (1, 505);
+ message->set_repeated_sint64 (1, 506);
+ message->set_repeated_fixed32 (1, 507);
+ message->set_repeated_fixed64 (1, 508);
+ message->set_repeated_sfixed32(1, 509);
+ message->set_repeated_sfixed64(1, 510);
+ message->set_repeated_float (1, 511);
+ message->set_repeated_double (1, 512);
+ message->set_repeated_bool (1, true);
+ message->set_repeated_string (1, "515");
+ message->set_repeated_bytes (1, "516");
+
+ message->mutable_repeatedgroup (1)->set_a(517);
+ message->mutable_repeated_nested_message (1)->set_bb(518);
+ message->mutable_repeated_foreign_message(1)->set_c(519);
+ message->mutable_repeated_import_message (1)->set_d(520);
+ message->mutable_repeated_lazy_message (1)->set_bb(527);
+
+ message->set_repeated_nested_enum (1, unittest::TestAllTypes::FOO);
+ message->set_repeated_foreign_enum(1, unittest::FOREIGN_FOO );
+ message->set_repeated_import_enum (1, unittest_import::IMPORT_FOO);
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ message->GetReflection()->SetRepeatedString(
+ message,
+ message->GetDescriptor()->FindFieldByName("repeated_string_piece"),
+ 1, "524");
+ message->GetReflection()->SetRepeatedString(
+ message,
+ message->GetDescriptor()->FindFieldByName("repeated_cord"),
+ 1, "525");
+#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
+}
+
+// ------------------------------------------------------------------
+void TestUtil::SetOneofFields(unittest::TestAllTypes* message) {
+ message->set_oneof_uint32(601);
+ message->mutable_oneof_nested_message()->set_bb(602);
+ message->set_oneof_string("603");
+ message->set_oneof_bytes("604");
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectAllFieldsSet(const unittest::TestAllTypes& message) {
+ EXPECT_TRUE(message.has_optional_int32 ());
+ EXPECT_TRUE(message.has_optional_int64 ());
+ EXPECT_TRUE(message.has_optional_uint32 ());
+ EXPECT_TRUE(message.has_optional_uint64 ());
+ EXPECT_TRUE(message.has_optional_sint32 ());
+ EXPECT_TRUE(message.has_optional_sint64 ());
+ EXPECT_TRUE(message.has_optional_fixed32 ());
+ EXPECT_TRUE(message.has_optional_fixed64 ());
+ EXPECT_TRUE(message.has_optional_sfixed32());
+ EXPECT_TRUE(message.has_optional_sfixed64());
+ EXPECT_TRUE(message.has_optional_float ());
+ EXPECT_TRUE(message.has_optional_double ());
+ EXPECT_TRUE(message.has_optional_bool ());
+ EXPECT_TRUE(message.has_optional_string ());
+ EXPECT_TRUE(message.has_optional_bytes ());
+
+ EXPECT_TRUE(message.has_optionalgroup ());
+ EXPECT_TRUE(message.has_optional_nested_message ());
+ EXPECT_TRUE(message.has_optional_foreign_message ());
+ EXPECT_TRUE(message.has_optional_import_message ());
+ EXPECT_TRUE(message.has_optional_public_import_message());
+ EXPECT_TRUE(message.has_optional_lazy_message ());
+
+ EXPECT_TRUE(message.optionalgroup ().has_a());
+ EXPECT_TRUE(message.optional_nested_message ().has_bb());
+ EXPECT_TRUE(message.optional_foreign_message ().has_c());
+ EXPECT_TRUE(message.optional_import_message ().has_d());
+ EXPECT_TRUE(message.optional_public_import_message().has_e());
+ EXPECT_TRUE(message.optional_lazy_message ().has_bb());
+
+ EXPECT_TRUE(message.has_optional_nested_enum ());
+ EXPECT_TRUE(message.has_optional_foreign_enum());
+ EXPECT_TRUE(message.has_optional_import_enum ());
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ EXPECT_TRUE(message.has_optional_string_piece());
+ EXPECT_TRUE(message.has_optional_cord());
+#endif
+
+ EXPECT_EQ(101 , message.optional_int32 ());
+ EXPECT_EQ(102 , message.optional_int64 ());
+ EXPECT_EQ(103 , message.optional_uint32 ());
+ EXPECT_EQ(104 , message.optional_uint64 ());
+ EXPECT_EQ(105 , message.optional_sint32 ());
+ EXPECT_EQ(106 , message.optional_sint64 ());
+ EXPECT_EQ(107 , message.optional_fixed32 ());
+ EXPECT_EQ(108 , message.optional_fixed64 ());
+ EXPECT_EQ(109 , message.optional_sfixed32());
+ EXPECT_EQ(110 , message.optional_sfixed64());
+ EXPECT_EQ(111 , message.optional_float ());
+ EXPECT_EQ(112 , message.optional_double ());
+ EXPECT_TRUE( message.optional_bool ());
+ EXPECT_EQ("115", message.optional_string ());
+ EXPECT_EQ("116", message.optional_bytes ());
+
+ EXPECT_EQ(117, message.optionalgroup ().a());
+ EXPECT_EQ(118, message.optional_nested_message ().bb());
+ EXPECT_EQ(119, message.optional_foreign_message ().c());
+ EXPECT_EQ(120, message.optional_import_message ().d());
+ EXPECT_EQ(126, message.optional_public_import_message ().e());
+ EXPECT_EQ(127, message.optional_lazy_message ().bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAZ, message.optional_nested_enum ());
+ EXPECT_EQ(unittest::FOREIGN_BAZ , message.optional_foreign_enum());
+ EXPECT_EQ(unittest_import::IMPORT_BAZ, message.optional_import_enum ());
+
+
+ // -----------------------------------------------------------------
+
+ ASSERT_EQ(2, message.repeated_int32_size ());
+ ASSERT_EQ(2, message.repeated_int64_size ());
+ ASSERT_EQ(2, message.repeated_uint32_size ());
+ ASSERT_EQ(2, message.repeated_uint64_size ());
+ ASSERT_EQ(2, message.repeated_sint32_size ());
+ ASSERT_EQ(2, message.repeated_sint64_size ());
+ ASSERT_EQ(2, message.repeated_fixed32_size ());
+ ASSERT_EQ(2, message.repeated_fixed64_size ());
+ ASSERT_EQ(2, message.repeated_sfixed32_size());
+ ASSERT_EQ(2, message.repeated_sfixed64_size());
+ ASSERT_EQ(2, message.repeated_float_size ());
+ ASSERT_EQ(2, message.repeated_double_size ());
+ ASSERT_EQ(2, message.repeated_bool_size ());
+ ASSERT_EQ(2, message.repeated_string_size ());
+ ASSERT_EQ(2, message.repeated_bytes_size ());
+
+ ASSERT_EQ(2, message.repeatedgroup_size ());
+ ASSERT_EQ(2, message.repeated_nested_message_size ());
+ ASSERT_EQ(2, message.repeated_foreign_message_size());
+ ASSERT_EQ(2, message.repeated_import_message_size ());
+ ASSERT_EQ(2, message.repeated_lazy_message_size ());
+ ASSERT_EQ(2, message.repeated_nested_enum_size ());
+ ASSERT_EQ(2, message.repeated_foreign_enum_size ());
+ ASSERT_EQ(2, message.repeated_import_enum_size ());
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ ASSERT_EQ(2, message.repeated_string_piece_size());
+ ASSERT_EQ(2, message.repeated_cord_size());
+#endif
+
+ EXPECT_EQ(201 , message.repeated_int32 (0));
+ EXPECT_EQ(202 , message.repeated_int64 (0));
+ EXPECT_EQ(203 , message.repeated_uint32 (0));
+ EXPECT_EQ(204 , message.repeated_uint64 (0));
+ EXPECT_EQ(205 , message.repeated_sint32 (0));
+ EXPECT_EQ(206 , message.repeated_sint64 (0));
+ EXPECT_EQ(207 , message.repeated_fixed32 (0));
+ EXPECT_EQ(208 , message.repeated_fixed64 (0));
+ EXPECT_EQ(209 , message.repeated_sfixed32(0));
+ EXPECT_EQ(210 , message.repeated_sfixed64(0));
+ EXPECT_EQ(211 , message.repeated_float (0));
+ EXPECT_EQ(212 , message.repeated_double (0));
+ EXPECT_TRUE( message.repeated_bool (0));
+ EXPECT_EQ("215", message.repeated_string (0));
+ EXPECT_EQ("216", message.repeated_bytes (0));
+
+ EXPECT_EQ(217, message.repeatedgroup (0).a());
+ EXPECT_EQ(218, message.repeated_nested_message (0).bb());
+ EXPECT_EQ(219, message.repeated_foreign_message(0).c());
+ EXPECT_EQ(220, message.repeated_import_message (0).d());
+ EXPECT_EQ(227, message.repeated_lazy_message (0).bb());
+
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.repeated_nested_enum (0));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.repeated_foreign_enum(0));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.repeated_import_enum (0));
+
+ EXPECT_EQ(301 , message.repeated_int32 (1));
+ EXPECT_EQ(302 , message.repeated_int64 (1));
+ EXPECT_EQ(303 , message.repeated_uint32 (1));
+ EXPECT_EQ(304 , message.repeated_uint64 (1));
+ EXPECT_EQ(305 , message.repeated_sint32 (1));
+ EXPECT_EQ(306 , message.repeated_sint64 (1));
+ EXPECT_EQ(307 , message.repeated_fixed32 (1));
+ EXPECT_EQ(308 , message.repeated_fixed64 (1));
+ EXPECT_EQ(309 , message.repeated_sfixed32(1));
+ EXPECT_EQ(310 , message.repeated_sfixed64(1));
+ EXPECT_EQ(311 , message.repeated_float (1));
+ EXPECT_EQ(312 , message.repeated_double (1));
+ EXPECT_FALSE( message.repeated_bool (1));
+ EXPECT_EQ("315", message.repeated_string (1));
+ EXPECT_EQ("316", message.repeated_bytes (1));
+
+ EXPECT_EQ(317, message.repeatedgroup (1).a());
+ EXPECT_EQ(318, message.repeated_nested_message (1).bb());
+ EXPECT_EQ(319, message.repeated_foreign_message(1).c());
+ EXPECT_EQ(320, message.repeated_import_message (1).d());
+ EXPECT_EQ(327, message.repeated_lazy_message (1).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAZ, message.repeated_nested_enum (1));
+ EXPECT_EQ(unittest::FOREIGN_BAZ , message.repeated_foreign_enum(1));
+ EXPECT_EQ(unittest_import::IMPORT_BAZ, message.repeated_import_enum (1));
+
+
+ // -----------------------------------------------------------------
+
+ EXPECT_TRUE(message.has_default_int32 ());
+ EXPECT_TRUE(message.has_default_int64 ());
+ EXPECT_TRUE(message.has_default_uint32 ());
+ EXPECT_TRUE(message.has_default_uint64 ());
+ EXPECT_TRUE(message.has_default_sint32 ());
+ EXPECT_TRUE(message.has_default_sint64 ());
+ EXPECT_TRUE(message.has_default_fixed32 ());
+ EXPECT_TRUE(message.has_default_fixed64 ());
+ EXPECT_TRUE(message.has_default_sfixed32());
+ EXPECT_TRUE(message.has_default_sfixed64());
+ EXPECT_TRUE(message.has_default_float ());
+ EXPECT_TRUE(message.has_default_double ());
+ EXPECT_TRUE(message.has_default_bool ());
+ EXPECT_TRUE(message.has_default_string ());
+ EXPECT_TRUE(message.has_default_bytes ());
+
+ EXPECT_TRUE(message.has_default_nested_enum ());
+ EXPECT_TRUE(message.has_default_foreign_enum());
+ EXPECT_TRUE(message.has_default_import_enum ());
+
+
+ EXPECT_EQ(401 , message.default_int32 ());
+ EXPECT_EQ(402 , message.default_int64 ());
+ EXPECT_EQ(403 , message.default_uint32 ());
+ EXPECT_EQ(404 , message.default_uint64 ());
+ EXPECT_EQ(405 , message.default_sint32 ());
+ EXPECT_EQ(406 , message.default_sint64 ());
+ EXPECT_EQ(407 , message.default_fixed32 ());
+ EXPECT_EQ(408 , message.default_fixed64 ());
+ EXPECT_EQ(409 , message.default_sfixed32());
+ EXPECT_EQ(410 , message.default_sfixed64());
+ EXPECT_EQ(411 , message.default_float ());
+ EXPECT_EQ(412 , message.default_double ());
+ EXPECT_FALSE( message.default_bool ());
+ EXPECT_EQ("415", message.default_string ());
+ EXPECT_EQ("416", message.default_bytes ());
+
+ EXPECT_EQ(unittest::TestAllTypes::FOO, message.default_nested_enum ());
+ EXPECT_EQ(unittest::FOREIGN_FOO , message.default_foreign_enum());
+ EXPECT_EQ(unittest_import::IMPORT_FOO, message.default_import_enum ());
+
+
+ EXPECT_FALSE(message.has_oneof_uint32 ());
+ EXPECT_FALSE(message.has_oneof_nested_message());
+ EXPECT_FALSE(message.has_oneof_string ());
+ EXPECT_TRUE(message.has_oneof_bytes ());
+
+ EXPECT_EQ("604", message.oneof_bytes());
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectClear(const unittest::TestAllTypes& message) {
+ // has_blah() should initially be false for all optional fields.
+ EXPECT_FALSE(message.has_optional_int32 ());
+ EXPECT_FALSE(message.has_optional_int64 ());
+ EXPECT_FALSE(message.has_optional_uint32 ());
+ EXPECT_FALSE(message.has_optional_uint64 ());
+ EXPECT_FALSE(message.has_optional_sint32 ());
+ EXPECT_FALSE(message.has_optional_sint64 ());
+ EXPECT_FALSE(message.has_optional_fixed32 ());
+ EXPECT_FALSE(message.has_optional_fixed64 ());
+ EXPECT_FALSE(message.has_optional_sfixed32());
+ EXPECT_FALSE(message.has_optional_sfixed64());
+ EXPECT_FALSE(message.has_optional_float ());
+ EXPECT_FALSE(message.has_optional_double ());
+ EXPECT_FALSE(message.has_optional_bool ());
+ EXPECT_FALSE(message.has_optional_string ());
+ EXPECT_FALSE(message.has_optional_bytes ());
+
+ EXPECT_FALSE(message.has_optionalgroup ());
+ EXPECT_FALSE(message.has_optional_nested_message ());
+ EXPECT_FALSE(message.has_optional_foreign_message ());
+ EXPECT_FALSE(message.has_optional_import_message ());
+ EXPECT_FALSE(message.has_optional_public_import_message());
+ EXPECT_FALSE(message.has_optional_lazy_message ());
+
+ EXPECT_FALSE(message.has_optional_nested_enum ());
+ EXPECT_FALSE(message.has_optional_foreign_enum());
+ EXPECT_FALSE(message.has_optional_import_enum ());
+
+ EXPECT_FALSE(message.has_optional_string_piece());
+ EXPECT_FALSE(message.has_optional_cord());
+
+ // Optional fields without defaults are set to zero or something like it.
+ EXPECT_EQ(0 , message.optional_int32 ());
+ EXPECT_EQ(0 , message.optional_int64 ());
+ EXPECT_EQ(0 , message.optional_uint32 ());
+ EXPECT_EQ(0 , message.optional_uint64 ());
+ EXPECT_EQ(0 , message.optional_sint32 ());
+ EXPECT_EQ(0 , message.optional_sint64 ());
+ EXPECT_EQ(0 , message.optional_fixed32 ());
+ EXPECT_EQ(0 , message.optional_fixed64 ());
+ EXPECT_EQ(0 , message.optional_sfixed32());
+ EXPECT_EQ(0 , message.optional_sfixed64());
+ EXPECT_EQ(0 , message.optional_float ());
+ EXPECT_EQ(0 , message.optional_double ());
+ EXPECT_FALSE( message.optional_bool ());
+ EXPECT_EQ("" , message.optional_string ());
+ EXPECT_EQ("" , message.optional_bytes ());
+
+ // Embedded messages should also be clear.
+ EXPECT_FALSE(message.optionalgroup ().has_a());
+ EXPECT_FALSE(message.optional_nested_message ().has_bb());
+ EXPECT_FALSE(message.optional_foreign_message ().has_c());
+ EXPECT_FALSE(message.optional_import_message ().has_d());
+ EXPECT_FALSE(message.optional_public_import_message().has_e());
+ EXPECT_FALSE(message.optional_lazy_message ().has_bb());
+
+ EXPECT_EQ(0, message.optionalgroup ().a());
+ EXPECT_EQ(0, message.optional_nested_message ().bb());
+ EXPECT_EQ(0, message.optional_foreign_message ().c());
+ EXPECT_EQ(0, message.optional_import_message ().d());
+ EXPECT_EQ(0, message.optional_public_import_message().e());
+ EXPECT_EQ(0, message.optional_lazy_message ().bb());
+
+ // Enums without defaults are set to the first value in the enum.
+ EXPECT_EQ(unittest::TestAllTypes::FOO, message.optional_nested_enum ());
+ EXPECT_EQ(unittest::FOREIGN_FOO , message.optional_foreign_enum());
+ EXPECT_EQ(unittest_import::IMPORT_FOO, message.optional_import_enum ());
+
+
+ // Repeated fields are empty.
+ EXPECT_EQ(0, message.repeated_int32_size ());
+ EXPECT_EQ(0, message.repeated_int64_size ());
+ EXPECT_EQ(0, message.repeated_uint32_size ());
+ EXPECT_EQ(0, message.repeated_uint64_size ());
+ EXPECT_EQ(0, message.repeated_sint32_size ());
+ EXPECT_EQ(0, message.repeated_sint64_size ());
+ EXPECT_EQ(0, message.repeated_fixed32_size ());
+ EXPECT_EQ(0, message.repeated_fixed64_size ());
+ EXPECT_EQ(0, message.repeated_sfixed32_size());
+ EXPECT_EQ(0, message.repeated_sfixed64_size());
+ EXPECT_EQ(0, message.repeated_float_size ());
+ EXPECT_EQ(0, message.repeated_double_size ());
+ EXPECT_EQ(0, message.repeated_bool_size ());
+ EXPECT_EQ(0, message.repeated_string_size ());
+ EXPECT_EQ(0, message.repeated_bytes_size ());
+
+ EXPECT_EQ(0, message.repeatedgroup_size ());
+ EXPECT_EQ(0, message.repeated_nested_message_size ());
+ EXPECT_EQ(0, message.repeated_foreign_message_size());
+ EXPECT_EQ(0, message.repeated_import_message_size ());
+ EXPECT_EQ(0, message.repeated_lazy_message_size ());
+ EXPECT_EQ(0, message.repeated_nested_enum_size ());
+ EXPECT_EQ(0, message.repeated_foreign_enum_size ());
+ EXPECT_EQ(0, message.repeated_import_enum_size ());
+
+ EXPECT_EQ(0, message.repeated_string_piece_size());
+ EXPECT_EQ(0, message.repeated_cord_size());
+
+ // has_blah() should also be false for all default fields.
+ EXPECT_FALSE(message.has_default_int32 ());
+ EXPECT_FALSE(message.has_default_int64 ());
+ EXPECT_FALSE(message.has_default_uint32 ());
+ EXPECT_FALSE(message.has_default_uint64 ());
+ EXPECT_FALSE(message.has_default_sint32 ());
+ EXPECT_FALSE(message.has_default_sint64 ());
+ EXPECT_FALSE(message.has_default_fixed32 ());
+ EXPECT_FALSE(message.has_default_fixed64 ());
+ EXPECT_FALSE(message.has_default_sfixed32());
+ EXPECT_FALSE(message.has_default_sfixed64());
+ EXPECT_FALSE(message.has_default_float ());
+ EXPECT_FALSE(message.has_default_double ());
+ EXPECT_FALSE(message.has_default_bool ());
+ EXPECT_FALSE(message.has_default_string ());
+ EXPECT_FALSE(message.has_default_bytes ());
+
+ EXPECT_FALSE(message.has_default_nested_enum ());
+ EXPECT_FALSE(message.has_default_foreign_enum());
+ EXPECT_FALSE(message.has_default_import_enum ());
+
+
+ // Fields with defaults have their default values (duh).
+ EXPECT_EQ( 41 , message.default_int32 ());
+ EXPECT_EQ( 42 , message.default_int64 ());
+ EXPECT_EQ( 43 , message.default_uint32 ());
+ EXPECT_EQ( 44 , message.default_uint64 ());
+ EXPECT_EQ(-45 , message.default_sint32 ());
+ EXPECT_EQ( 46 , message.default_sint64 ());
+ EXPECT_EQ( 47 , message.default_fixed32 ());
+ EXPECT_EQ( 48 , message.default_fixed64 ());
+ EXPECT_EQ( 49 , message.default_sfixed32());
+ EXPECT_EQ(-50 , message.default_sfixed64());
+ EXPECT_EQ( 51.5 , message.default_float ());
+ EXPECT_EQ( 52e3 , message.default_double ());
+ EXPECT_TRUE( message.default_bool ());
+ EXPECT_EQ("hello", message.default_string ());
+ EXPECT_EQ("world", message.default_bytes ());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.default_nested_enum ());
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.default_foreign_enum());
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.default_import_enum ());
+
+
+ EXPECT_FALSE(message.has_oneof_uint32 ());
+ EXPECT_FALSE(message.has_oneof_nested_message());
+ EXPECT_FALSE(message.has_oneof_string ());
+ EXPECT_FALSE(message.has_oneof_bytes ());
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectRepeatedFieldsModified(
+ const unittest::TestAllTypes& message) {
+ // ModifyRepeatedFields only sets the second repeated element of each
+ // field. In addition to verifying this, we also verify that the first
+ // element and size were *not* modified.
+ ASSERT_EQ(2, message.repeated_int32_size ());
+ ASSERT_EQ(2, message.repeated_int64_size ());
+ ASSERT_EQ(2, message.repeated_uint32_size ());
+ ASSERT_EQ(2, message.repeated_uint64_size ());
+ ASSERT_EQ(2, message.repeated_sint32_size ());
+ ASSERT_EQ(2, message.repeated_sint64_size ());
+ ASSERT_EQ(2, message.repeated_fixed32_size ());
+ ASSERT_EQ(2, message.repeated_fixed64_size ());
+ ASSERT_EQ(2, message.repeated_sfixed32_size());
+ ASSERT_EQ(2, message.repeated_sfixed64_size());
+ ASSERT_EQ(2, message.repeated_float_size ());
+ ASSERT_EQ(2, message.repeated_double_size ());
+ ASSERT_EQ(2, message.repeated_bool_size ());
+ ASSERT_EQ(2, message.repeated_string_size ());
+ ASSERT_EQ(2, message.repeated_bytes_size ());
+
+ ASSERT_EQ(2, message.repeatedgroup_size ());
+ ASSERT_EQ(2, message.repeated_nested_message_size ());
+ ASSERT_EQ(2, message.repeated_foreign_message_size());
+ ASSERT_EQ(2, message.repeated_import_message_size ());
+ ASSERT_EQ(2, message.repeated_lazy_message_size ());
+ ASSERT_EQ(2, message.repeated_nested_enum_size ());
+ ASSERT_EQ(2, message.repeated_foreign_enum_size ());
+ ASSERT_EQ(2, message.repeated_import_enum_size ());
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ ASSERT_EQ(2, message.repeated_string_piece_size());
+ ASSERT_EQ(2, message.repeated_cord_size());
+#endif
+
+ EXPECT_EQ(201 , message.repeated_int32 (0));
+ EXPECT_EQ(202 , message.repeated_int64 (0));
+ EXPECT_EQ(203 , message.repeated_uint32 (0));
+ EXPECT_EQ(204 , message.repeated_uint64 (0));
+ EXPECT_EQ(205 , message.repeated_sint32 (0));
+ EXPECT_EQ(206 , message.repeated_sint64 (0));
+ EXPECT_EQ(207 , message.repeated_fixed32 (0));
+ EXPECT_EQ(208 , message.repeated_fixed64 (0));
+ EXPECT_EQ(209 , message.repeated_sfixed32(0));
+ EXPECT_EQ(210 , message.repeated_sfixed64(0));
+ EXPECT_EQ(211 , message.repeated_float (0));
+ EXPECT_EQ(212 , message.repeated_double (0));
+ EXPECT_TRUE( message.repeated_bool (0));
+ EXPECT_EQ("215", message.repeated_string (0));
+ EXPECT_EQ("216", message.repeated_bytes (0));
+
+ EXPECT_EQ(217, message.repeatedgroup (0).a());
+ EXPECT_EQ(218, message.repeated_nested_message (0).bb());
+ EXPECT_EQ(219, message.repeated_foreign_message(0).c());
+ EXPECT_EQ(220, message.repeated_import_message (0).d());
+ EXPECT_EQ(227, message.repeated_lazy_message (0).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.repeated_nested_enum (0));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.repeated_foreign_enum(0));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.repeated_import_enum (0));
+
+
+ // Actually verify the second (modified) elements now.
+ EXPECT_EQ(501 , message.repeated_int32 (1));
+ EXPECT_EQ(502 , message.repeated_int64 (1));
+ EXPECT_EQ(503 , message.repeated_uint32 (1));
+ EXPECT_EQ(504 , message.repeated_uint64 (1));
+ EXPECT_EQ(505 , message.repeated_sint32 (1));
+ EXPECT_EQ(506 , message.repeated_sint64 (1));
+ EXPECT_EQ(507 , message.repeated_fixed32 (1));
+ EXPECT_EQ(508 , message.repeated_fixed64 (1));
+ EXPECT_EQ(509 , message.repeated_sfixed32(1));
+ EXPECT_EQ(510 , message.repeated_sfixed64(1));
+ EXPECT_EQ(511 , message.repeated_float (1));
+ EXPECT_EQ(512 , message.repeated_double (1));
+ EXPECT_TRUE( message.repeated_bool (1));
+ EXPECT_EQ("515", message.repeated_string (1));
+ EXPECT_EQ("516", message.repeated_bytes (1));
+
+ EXPECT_EQ(517, message.repeatedgroup (1).a());
+ EXPECT_EQ(518, message.repeated_nested_message (1).bb());
+ EXPECT_EQ(519, message.repeated_foreign_message(1).c());
+ EXPECT_EQ(520, message.repeated_import_message (1).d());
+ EXPECT_EQ(527, message.repeated_lazy_message (1).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::FOO, message.repeated_nested_enum (1));
+ EXPECT_EQ(unittest::FOREIGN_FOO , message.repeated_foreign_enum(1));
+ EXPECT_EQ(unittest_import::IMPORT_FOO, message.repeated_import_enum (1));
+
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::SetPackedFields(unittest::TestPackedTypes* message) {
+ message->add_packed_int32 (601);
+ message->add_packed_int64 (602);
+ message->add_packed_uint32 (603);
+ message->add_packed_uint64 (604);
+ message->add_packed_sint32 (605);
+ message->add_packed_sint64 (606);
+ message->add_packed_fixed32 (607);
+ message->add_packed_fixed64 (608);
+ message->add_packed_sfixed32(609);
+ message->add_packed_sfixed64(610);
+ message->add_packed_float (611);
+ message->add_packed_double (612);
+ message->add_packed_bool (true);
+ message->add_packed_enum (unittest::FOREIGN_BAR);
+ // add a second one of each field
+ message->add_packed_int32 (701);
+ message->add_packed_int64 (702);
+ message->add_packed_uint32 (703);
+ message->add_packed_uint64 (704);
+ message->add_packed_sint32 (705);
+ message->add_packed_sint64 (706);
+ message->add_packed_fixed32 (707);
+ message->add_packed_fixed64 (708);
+ message->add_packed_sfixed32(709);
+ message->add_packed_sfixed64(710);
+ message->add_packed_float (711);
+ message->add_packed_double (712);
+ message->add_packed_bool (false);
+ message->add_packed_enum (unittest::FOREIGN_BAZ);
+}
+
+void TestUtil::SetUnpackedFields(unittest::TestUnpackedTypes* message) {
+ // The values applied here must match those of SetPackedFields.
+
+ message->add_unpacked_int32 (601);
+ message->add_unpacked_int64 (602);
+ message->add_unpacked_uint32 (603);
+ message->add_unpacked_uint64 (604);
+ message->add_unpacked_sint32 (605);
+ message->add_unpacked_sint64 (606);
+ message->add_unpacked_fixed32 (607);
+ message->add_unpacked_fixed64 (608);
+ message->add_unpacked_sfixed32(609);
+ message->add_unpacked_sfixed64(610);
+ message->add_unpacked_float (611);
+ message->add_unpacked_double (612);
+ message->add_unpacked_bool (true);
+ message->add_unpacked_enum (unittest::FOREIGN_BAR);
+ // add a second one of each field
+ message->add_unpacked_int32 (701);
+ message->add_unpacked_int64 (702);
+ message->add_unpacked_uint32 (703);
+ message->add_unpacked_uint64 (704);
+ message->add_unpacked_sint32 (705);
+ message->add_unpacked_sint64 (706);
+ message->add_unpacked_fixed32 (707);
+ message->add_unpacked_fixed64 (708);
+ message->add_unpacked_sfixed32(709);
+ message->add_unpacked_sfixed64(710);
+ message->add_unpacked_float (711);
+ message->add_unpacked_double (712);
+ message->add_unpacked_bool (false);
+ message->add_unpacked_enum (unittest::FOREIGN_BAZ);
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ModifyPackedFields(unittest::TestPackedTypes* message) {
+ message->set_packed_int32 (1, 801);
+ message->set_packed_int64 (1, 802);
+ message->set_packed_uint32 (1, 803);
+ message->set_packed_uint64 (1, 804);
+ message->set_packed_sint32 (1, 805);
+ message->set_packed_sint64 (1, 806);
+ message->set_packed_fixed32 (1, 807);
+ message->set_packed_fixed64 (1, 808);
+ message->set_packed_sfixed32(1, 809);
+ message->set_packed_sfixed64(1, 810);
+ message->set_packed_float (1, 811);
+ message->set_packed_double (1, 812);
+ message->set_packed_bool (1, true);
+ message->set_packed_enum (1, unittest::FOREIGN_FOO);
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectPackedFieldsSet(const unittest::TestPackedTypes& message) {
+ ASSERT_EQ(2, message.packed_int32_size ());
+ ASSERT_EQ(2, message.packed_int64_size ());
+ ASSERT_EQ(2, message.packed_uint32_size ());
+ ASSERT_EQ(2, message.packed_uint64_size ());
+ ASSERT_EQ(2, message.packed_sint32_size ());
+ ASSERT_EQ(2, message.packed_sint64_size ());
+ ASSERT_EQ(2, message.packed_fixed32_size ());
+ ASSERT_EQ(2, message.packed_fixed64_size ());
+ ASSERT_EQ(2, message.packed_sfixed32_size());
+ ASSERT_EQ(2, message.packed_sfixed64_size());
+ ASSERT_EQ(2, message.packed_float_size ());
+ ASSERT_EQ(2, message.packed_double_size ());
+ ASSERT_EQ(2, message.packed_bool_size ());
+ ASSERT_EQ(2, message.packed_enum_size ());
+
+ EXPECT_EQ(601 , message.packed_int32 (0));
+ EXPECT_EQ(602 , message.packed_int64 (0));
+ EXPECT_EQ(603 , message.packed_uint32 (0));
+ EXPECT_EQ(604 , message.packed_uint64 (0));
+ EXPECT_EQ(605 , message.packed_sint32 (0));
+ EXPECT_EQ(606 , message.packed_sint64 (0));
+ EXPECT_EQ(607 , message.packed_fixed32 (0));
+ EXPECT_EQ(608 , message.packed_fixed64 (0));
+ EXPECT_EQ(609 , message.packed_sfixed32(0));
+ EXPECT_EQ(610 , message.packed_sfixed64(0));
+ EXPECT_EQ(611 , message.packed_float (0));
+ EXPECT_EQ(612 , message.packed_double (0));
+ EXPECT_TRUE( message.packed_bool (0));
+ EXPECT_EQ(unittest::FOREIGN_BAR, message.packed_enum(0));
+
+ EXPECT_EQ(701 , message.packed_int32 (1));
+ EXPECT_EQ(702 , message.packed_int64 (1));
+ EXPECT_EQ(703 , message.packed_uint32 (1));
+ EXPECT_EQ(704 , message.packed_uint64 (1));
+ EXPECT_EQ(705 , message.packed_sint32 (1));
+ EXPECT_EQ(706 , message.packed_sint64 (1));
+ EXPECT_EQ(707 , message.packed_fixed32 (1));
+ EXPECT_EQ(708 , message.packed_fixed64 (1));
+ EXPECT_EQ(709 , message.packed_sfixed32(1));
+ EXPECT_EQ(710 , message.packed_sfixed64(1));
+ EXPECT_EQ(711 , message.packed_float (1));
+ EXPECT_EQ(712 , message.packed_double (1));
+ EXPECT_FALSE( message.packed_bool (1));
+ EXPECT_EQ(unittest::FOREIGN_BAZ, message.packed_enum(1));
+}
+
+void TestUtil::ExpectUnpackedFieldsSet(
+ const unittest::TestUnpackedTypes& message) {
+ // The values expected here must match those of ExpectPackedFieldsSet.
+
+ ASSERT_EQ(2, message.unpacked_int32_size ());
+ ASSERT_EQ(2, message.unpacked_int64_size ());
+ ASSERT_EQ(2, message.unpacked_uint32_size ());
+ ASSERT_EQ(2, message.unpacked_uint64_size ());
+ ASSERT_EQ(2, message.unpacked_sint32_size ());
+ ASSERT_EQ(2, message.unpacked_sint64_size ());
+ ASSERT_EQ(2, message.unpacked_fixed32_size ());
+ ASSERT_EQ(2, message.unpacked_fixed64_size ());
+ ASSERT_EQ(2, message.unpacked_sfixed32_size());
+ ASSERT_EQ(2, message.unpacked_sfixed64_size());
+ ASSERT_EQ(2, message.unpacked_float_size ());
+ ASSERT_EQ(2, message.unpacked_double_size ());
+ ASSERT_EQ(2, message.unpacked_bool_size ());
+ ASSERT_EQ(2, message.unpacked_enum_size ());
+
+ EXPECT_EQ(601 , message.unpacked_int32 (0));
+ EXPECT_EQ(602 , message.unpacked_int64 (0));
+ EXPECT_EQ(603 , message.unpacked_uint32 (0));
+ EXPECT_EQ(604 , message.unpacked_uint64 (0));
+ EXPECT_EQ(605 , message.unpacked_sint32 (0));
+ EXPECT_EQ(606 , message.unpacked_sint64 (0));
+ EXPECT_EQ(607 , message.unpacked_fixed32 (0));
+ EXPECT_EQ(608 , message.unpacked_fixed64 (0));
+ EXPECT_EQ(609 , message.unpacked_sfixed32(0));
+ EXPECT_EQ(610 , message.unpacked_sfixed64(0));
+ EXPECT_EQ(611 , message.unpacked_float (0));
+ EXPECT_EQ(612 , message.unpacked_double (0));
+ EXPECT_TRUE( message.unpacked_bool (0));
+ EXPECT_EQ(unittest::FOREIGN_BAR, message.unpacked_enum(0));
+
+ EXPECT_EQ(701 , message.unpacked_int32 (1));
+ EXPECT_EQ(702 , message.unpacked_int64 (1));
+ EXPECT_EQ(703 , message.unpacked_uint32 (1));
+ EXPECT_EQ(704 , message.unpacked_uint64 (1));
+ EXPECT_EQ(705 , message.unpacked_sint32 (1));
+ EXPECT_EQ(706 , message.unpacked_sint64 (1));
+ EXPECT_EQ(707 , message.unpacked_fixed32 (1));
+ EXPECT_EQ(708 , message.unpacked_fixed64 (1));
+ EXPECT_EQ(709 , message.unpacked_sfixed32(1));
+ EXPECT_EQ(710 , message.unpacked_sfixed64(1));
+ EXPECT_EQ(711 , message.unpacked_float (1));
+ EXPECT_EQ(712 , message.unpacked_double (1));
+ EXPECT_FALSE( message.unpacked_bool (1));
+ EXPECT_EQ(unittest::FOREIGN_BAZ, message.unpacked_enum(1));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectPackedClear(
+ const unittest::TestPackedTypes& message) {
+ // Packed repeated fields are empty.
+ EXPECT_EQ(0, message.packed_int32_size ());
+ EXPECT_EQ(0, message.packed_int64_size ());
+ EXPECT_EQ(0, message.packed_uint32_size ());
+ EXPECT_EQ(0, message.packed_uint64_size ());
+ EXPECT_EQ(0, message.packed_sint32_size ());
+ EXPECT_EQ(0, message.packed_sint64_size ());
+ EXPECT_EQ(0, message.packed_fixed32_size ());
+ EXPECT_EQ(0, message.packed_fixed64_size ());
+ EXPECT_EQ(0, message.packed_sfixed32_size());
+ EXPECT_EQ(0, message.packed_sfixed64_size());
+ EXPECT_EQ(0, message.packed_float_size ());
+ EXPECT_EQ(0, message.packed_double_size ());
+ EXPECT_EQ(0, message.packed_bool_size ());
+ EXPECT_EQ(0, message.packed_enum_size ());
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectPackedFieldsModified(
+ const unittest::TestPackedTypes& message) {
+ // Do the same for packed repeated fields.
+ ASSERT_EQ(2, message.packed_int32_size ());
+ ASSERT_EQ(2, message.packed_int64_size ());
+ ASSERT_EQ(2, message.packed_uint32_size ());
+ ASSERT_EQ(2, message.packed_uint64_size ());
+ ASSERT_EQ(2, message.packed_sint32_size ());
+ ASSERT_EQ(2, message.packed_sint64_size ());
+ ASSERT_EQ(2, message.packed_fixed32_size ());
+ ASSERT_EQ(2, message.packed_fixed64_size ());
+ ASSERT_EQ(2, message.packed_sfixed32_size());
+ ASSERT_EQ(2, message.packed_sfixed64_size());
+ ASSERT_EQ(2, message.packed_float_size ());
+ ASSERT_EQ(2, message.packed_double_size ());
+ ASSERT_EQ(2, message.packed_bool_size ());
+ ASSERT_EQ(2, message.packed_enum_size ());
+
+ EXPECT_EQ(601 , message.packed_int32 (0));
+ EXPECT_EQ(602 , message.packed_int64 (0));
+ EXPECT_EQ(603 , message.packed_uint32 (0));
+ EXPECT_EQ(604 , message.packed_uint64 (0));
+ EXPECT_EQ(605 , message.packed_sint32 (0));
+ EXPECT_EQ(606 , message.packed_sint64 (0));
+ EXPECT_EQ(607 , message.packed_fixed32 (0));
+ EXPECT_EQ(608 , message.packed_fixed64 (0));
+ EXPECT_EQ(609 , message.packed_sfixed32(0));
+ EXPECT_EQ(610 , message.packed_sfixed64(0));
+ EXPECT_EQ(611 , message.packed_float (0));
+ EXPECT_EQ(612 , message.packed_double (0));
+ EXPECT_TRUE( message.packed_bool (0));
+ EXPECT_EQ(unittest::FOREIGN_BAR, message.packed_enum(0));
+ // Actually verify the second (modified) elements now.
+ EXPECT_EQ(801 , message.packed_int32 (1));
+ EXPECT_EQ(802 , message.packed_int64 (1));
+ EXPECT_EQ(803 , message.packed_uint32 (1));
+ EXPECT_EQ(804 , message.packed_uint64 (1));
+ EXPECT_EQ(805 , message.packed_sint32 (1));
+ EXPECT_EQ(806 , message.packed_sint64 (1));
+ EXPECT_EQ(807 , message.packed_fixed32 (1));
+ EXPECT_EQ(808 , message.packed_fixed64 (1));
+ EXPECT_EQ(809 , message.packed_sfixed32(1));
+ EXPECT_EQ(810 , message.packed_sfixed64(1));
+ EXPECT_EQ(811 , message.packed_float (1));
+ EXPECT_EQ(812 , message.packed_double (1));
+ EXPECT_TRUE( message.packed_bool (1));
+ EXPECT_EQ(unittest::FOREIGN_FOO, message.packed_enum(1));
+}
+
+// ===================================================================
+// Extensions
+//
+// All this code is exactly equivalent to the above code except that it's
+// manipulating extension fields instead of normal ones.
+//
+// I gave up on the 80-char limit here. Sorry.
+
+void TestUtil::SetAllExtensions(unittest::TestAllExtensions* message) {
+ message->SetExtension(unittest::optional_int32_extension , 101);
+ message->SetExtension(unittest::optional_int64_extension , 102);
+ message->SetExtension(unittest::optional_uint32_extension , 103);
+ message->SetExtension(unittest::optional_uint64_extension , 104);
+ message->SetExtension(unittest::optional_sint32_extension , 105);
+ message->SetExtension(unittest::optional_sint64_extension , 106);
+ message->SetExtension(unittest::optional_fixed32_extension , 107);
+ message->SetExtension(unittest::optional_fixed64_extension , 108);
+ message->SetExtension(unittest::optional_sfixed32_extension, 109);
+ message->SetExtension(unittest::optional_sfixed64_extension, 110);
+ message->SetExtension(unittest::optional_float_extension , 111);
+ message->SetExtension(unittest::optional_double_extension , 112);
+ message->SetExtension(unittest::optional_bool_extension , true);
+ message->SetExtension(unittest::optional_string_extension , "115");
+ message->SetExtension(unittest::optional_bytes_extension , "116");
+
+ message->MutableExtension(unittest::optionalgroup_extension )->set_a(117);
+ message->MutableExtension(unittest::optional_nested_message_extension )->set_bb(118);
+ message->MutableExtension(unittest::optional_foreign_message_extension)->set_c(119);
+ message->MutableExtension(unittest::optional_import_message_extension )->set_d(120);
+
+ message->SetExtension(unittest::optional_nested_enum_extension , unittest::TestAllTypes::BAZ);
+ message->SetExtension(unittest::optional_foreign_enum_extension, unittest::FOREIGN_BAZ );
+ message->SetExtension(unittest::optional_import_enum_extension , unittest_import::IMPORT_BAZ);
+
+ message->SetExtension(unittest::optional_string_piece_extension, "124");
+ message->SetExtension(unittest::optional_cord_extension, "125");
+
+ message->MutableExtension(unittest::optional_public_import_message_extension)->set_e(126);
+ message->MutableExtension(unittest::optional_lazy_message_extension)->set_bb(127);
+
+ // -----------------------------------------------------------------
+
+ message->AddExtension(unittest::repeated_int32_extension , 201);
+ message->AddExtension(unittest::repeated_int64_extension , 202);
+ message->AddExtension(unittest::repeated_uint32_extension , 203);
+ message->AddExtension(unittest::repeated_uint64_extension , 204);
+ message->AddExtension(unittest::repeated_sint32_extension , 205);
+ message->AddExtension(unittest::repeated_sint64_extension , 206);
+ message->AddExtension(unittest::repeated_fixed32_extension , 207);
+ message->AddExtension(unittest::repeated_fixed64_extension , 208);
+ message->AddExtension(unittest::repeated_sfixed32_extension, 209);
+ message->AddExtension(unittest::repeated_sfixed64_extension, 210);
+ message->AddExtension(unittest::repeated_float_extension , 211);
+ message->AddExtension(unittest::repeated_double_extension , 212);
+ message->AddExtension(unittest::repeated_bool_extension , true);
+ message->AddExtension(unittest::repeated_string_extension , "215");
+ message->AddExtension(unittest::repeated_bytes_extension , "216");
+
+ message->AddExtension(unittest::repeatedgroup_extension )->set_a(217);
+ message->AddExtension(unittest::repeated_nested_message_extension )->set_bb(218);
+ message->AddExtension(unittest::repeated_foreign_message_extension)->set_c(219);
+ message->AddExtension(unittest::repeated_import_message_extension )->set_d(220);
+ message->AddExtension(unittest::repeated_lazy_message_extension )->set_bb(227);
+
+ message->AddExtension(unittest::repeated_nested_enum_extension , unittest::TestAllTypes::BAR);
+ message->AddExtension(unittest::repeated_foreign_enum_extension, unittest::FOREIGN_BAR );
+ message->AddExtension(unittest::repeated_import_enum_extension , unittest_import::IMPORT_BAR);
+
+ message->AddExtension(unittest::repeated_string_piece_extension, "224");
+ message->AddExtension(unittest::repeated_cord_extension, "225");
+
+ // Add a second one of each field.
+ message->AddExtension(unittest::repeated_int32_extension , 301);
+ message->AddExtension(unittest::repeated_int64_extension , 302);
+ message->AddExtension(unittest::repeated_uint32_extension , 303);
+ message->AddExtension(unittest::repeated_uint64_extension , 304);
+ message->AddExtension(unittest::repeated_sint32_extension , 305);
+ message->AddExtension(unittest::repeated_sint64_extension , 306);
+ message->AddExtension(unittest::repeated_fixed32_extension , 307);
+ message->AddExtension(unittest::repeated_fixed64_extension , 308);
+ message->AddExtension(unittest::repeated_sfixed32_extension, 309);
+ message->AddExtension(unittest::repeated_sfixed64_extension, 310);
+ message->AddExtension(unittest::repeated_float_extension , 311);
+ message->AddExtension(unittest::repeated_double_extension , 312);
+ message->AddExtension(unittest::repeated_bool_extension , false);
+ message->AddExtension(unittest::repeated_string_extension , "315");
+ message->AddExtension(unittest::repeated_bytes_extension , "316");
+
+ message->AddExtension(unittest::repeatedgroup_extension )->set_a(317);
+ message->AddExtension(unittest::repeated_nested_message_extension )->set_bb(318);
+ message->AddExtension(unittest::repeated_foreign_message_extension)->set_c(319);
+ message->AddExtension(unittest::repeated_import_message_extension )->set_d(320);
+ message->AddExtension(unittest::repeated_lazy_message_extension )->set_bb(327);
+
+ message->AddExtension(unittest::repeated_nested_enum_extension , unittest::TestAllTypes::BAZ);
+ message->AddExtension(unittest::repeated_foreign_enum_extension, unittest::FOREIGN_BAZ );
+ message->AddExtension(unittest::repeated_import_enum_extension , unittest_import::IMPORT_BAZ);
+
+ message->AddExtension(unittest::repeated_string_piece_extension, "324");
+ message->AddExtension(unittest::repeated_cord_extension, "325");
+
+ // -----------------------------------------------------------------
+
+ message->SetExtension(unittest::default_int32_extension , 401);
+ message->SetExtension(unittest::default_int64_extension , 402);
+ message->SetExtension(unittest::default_uint32_extension , 403);
+ message->SetExtension(unittest::default_uint64_extension , 404);
+ message->SetExtension(unittest::default_sint32_extension , 405);
+ message->SetExtension(unittest::default_sint64_extension , 406);
+ message->SetExtension(unittest::default_fixed32_extension , 407);
+ message->SetExtension(unittest::default_fixed64_extension , 408);
+ message->SetExtension(unittest::default_sfixed32_extension, 409);
+ message->SetExtension(unittest::default_sfixed64_extension, 410);
+ message->SetExtension(unittest::default_float_extension , 411);
+ message->SetExtension(unittest::default_double_extension , 412);
+ message->SetExtension(unittest::default_bool_extension , false);
+ message->SetExtension(unittest::default_string_extension , "415");
+ message->SetExtension(unittest::default_bytes_extension , "416");
+
+ message->SetExtension(unittest::default_nested_enum_extension , unittest::TestAllTypes::FOO);
+ message->SetExtension(unittest::default_foreign_enum_extension, unittest::FOREIGN_FOO );
+ message->SetExtension(unittest::default_import_enum_extension , unittest_import::IMPORT_FOO);
+
+ message->SetExtension(unittest::default_string_piece_extension, "424");
+ message->SetExtension(unittest::default_cord_extension, "425");
+
+ SetOneofFields(message);
+}
+
+void TestUtil::SetOneofFields(unittest::TestAllExtensions* message) {
+ message->SetExtension(unittest::oneof_uint32_extension, 601);
+ message->MutableExtension(unittest::oneof_nested_message_extension)->set_bb(602);
+ message->SetExtension(unittest::oneof_string_extension, "603");
+ message->SetExtension(unittest::oneof_bytes_extension, "604");
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::SetAllFieldsAndExtensions(
+ unittest::TestFieldOrderings* message) {
+ GOOGLE_CHECK(message);
+ message->set_my_int(1);
+ message->set_my_string("foo");
+ message->set_my_float(1.0);
+ message->SetExtension(unittest::my_extension_int, 23);
+ message->SetExtension(unittest::my_extension_string, "bar");
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ModifyRepeatedExtensions(unittest::TestAllExtensions* message) {
+ message->SetExtension(unittest::repeated_int32_extension , 1, 501);
+ message->SetExtension(unittest::repeated_int64_extension , 1, 502);
+ message->SetExtension(unittest::repeated_uint32_extension , 1, 503);
+ message->SetExtension(unittest::repeated_uint64_extension , 1, 504);
+ message->SetExtension(unittest::repeated_sint32_extension , 1, 505);
+ message->SetExtension(unittest::repeated_sint64_extension , 1, 506);
+ message->SetExtension(unittest::repeated_fixed32_extension , 1, 507);
+ message->SetExtension(unittest::repeated_fixed64_extension , 1, 508);
+ message->SetExtension(unittest::repeated_sfixed32_extension, 1, 509);
+ message->SetExtension(unittest::repeated_sfixed64_extension, 1, 510);
+ message->SetExtension(unittest::repeated_float_extension , 1, 511);
+ message->SetExtension(unittest::repeated_double_extension , 1, 512);
+ message->SetExtension(unittest::repeated_bool_extension , 1, true);
+ message->SetExtension(unittest::repeated_string_extension , 1, "515");
+ message->SetExtension(unittest::repeated_bytes_extension , 1, "516");
+
+ message->MutableExtension(unittest::repeatedgroup_extension , 1)->set_a(517);
+ message->MutableExtension(unittest::repeated_nested_message_extension , 1)->set_bb(518);
+ message->MutableExtension(unittest::repeated_foreign_message_extension, 1)->set_c(519);
+ message->MutableExtension(unittest::repeated_import_message_extension , 1)->set_d(520);
+ message->MutableExtension(unittest::repeated_lazy_message_extension , 1)->set_bb(527);
+
+ message->SetExtension(unittest::repeated_nested_enum_extension , 1, unittest::TestAllTypes::FOO);
+ message->SetExtension(unittest::repeated_foreign_enum_extension, 1, unittest::FOREIGN_FOO );
+ message->SetExtension(unittest::repeated_import_enum_extension , 1, unittest_import::IMPORT_FOO);
+
+ message->SetExtension(unittest::repeated_string_piece_extension, 1, "524");
+ message->SetExtension(unittest::repeated_cord_extension, 1, "525");
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectAllExtensionsSet(
+ const unittest::TestAllExtensions& message) {
+ EXPECT_TRUE(message.HasExtension(unittest::optional_int32_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_int64_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_uint32_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_uint64_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_sint32_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_sint64_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_fixed32_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_fixed64_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_sfixed32_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_sfixed64_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_float_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_double_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_bool_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_string_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_bytes_extension ));
+
+ EXPECT_TRUE(message.HasExtension(unittest::optionalgroup_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_nested_message_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_foreign_message_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_import_message_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_public_import_message_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_lazy_message_extension ));
+
+ EXPECT_TRUE(message.GetExtension(unittest::optionalgroup_extension ).has_a());
+ EXPECT_TRUE(message.GetExtension(unittest::optional_nested_message_extension ).has_bb());
+ EXPECT_TRUE(message.GetExtension(unittest::optional_foreign_message_extension ).has_c());
+ EXPECT_TRUE(message.GetExtension(unittest::optional_import_message_extension ).has_d());
+ EXPECT_TRUE(message.GetExtension(unittest::optional_public_import_message_extension).has_e());
+ EXPECT_TRUE(message.GetExtension(unittest::optional_lazy_message_extension ).has_bb());
+
+ EXPECT_TRUE(message.HasExtension(unittest::optional_nested_enum_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_foreign_enum_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_import_enum_extension ));
+
+ EXPECT_TRUE(message.HasExtension(unittest::optional_string_piece_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::optional_cord_extension));
+
+ EXPECT_EQ(101 , message.GetExtension(unittest::optional_int32_extension ));
+ EXPECT_EQ(102 , message.GetExtension(unittest::optional_int64_extension ));
+ EXPECT_EQ(103 , message.GetExtension(unittest::optional_uint32_extension ));
+ EXPECT_EQ(104 , message.GetExtension(unittest::optional_uint64_extension ));
+ EXPECT_EQ(105 , message.GetExtension(unittest::optional_sint32_extension ));
+ EXPECT_EQ(106 , message.GetExtension(unittest::optional_sint64_extension ));
+ EXPECT_EQ(107 , message.GetExtension(unittest::optional_fixed32_extension ));
+ EXPECT_EQ(108 , message.GetExtension(unittest::optional_fixed64_extension ));
+ EXPECT_EQ(109 , message.GetExtension(unittest::optional_sfixed32_extension));
+ EXPECT_EQ(110 , message.GetExtension(unittest::optional_sfixed64_extension));
+ EXPECT_EQ(111 , message.GetExtension(unittest::optional_float_extension ));
+ EXPECT_EQ(112 , message.GetExtension(unittest::optional_double_extension ));
+ EXPECT_TRUE( message.GetExtension(unittest::optional_bool_extension ));
+ EXPECT_EQ("115", message.GetExtension(unittest::optional_string_extension ));
+ EXPECT_EQ("116", message.GetExtension(unittest::optional_bytes_extension ));
+
+ EXPECT_EQ(117, message.GetExtension(unittest::optionalgroup_extension ).a());
+ EXPECT_EQ(118, message.GetExtension(unittest::optional_nested_message_extension ).bb());
+ EXPECT_EQ(119, message.GetExtension(unittest::optional_foreign_message_extension).c());
+ EXPECT_EQ(120, message.GetExtension(unittest::optional_import_message_extension ).d());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAZ, message.GetExtension(unittest::optional_nested_enum_extension ));
+ EXPECT_EQ(unittest::FOREIGN_BAZ , message.GetExtension(unittest::optional_foreign_enum_extension));
+ EXPECT_EQ(unittest_import::IMPORT_BAZ, message.GetExtension(unittest::optional_import_enum_extension ));
+
+ EXPECT_EQ("124", message.GetExtension(unittest::optional_string_piece_extension));
+ EXPECT_EQ("125", message.GetExtension(unittest::optional_cord_extension));
+ EXPECT_EQ(126, message.GetExtension(unittest::optional_public_import_message_extension ).e());
+ EXPECT_EQ(127, message.GetExtension(unittest::optional_lazy_message_extension).bb());
+
+ // -----------------------------------------------------------------
+
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_int32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_int64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_uint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_uint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_fixed32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_fixed64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sfixed32_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sfixed64_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_float_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_double_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_bool_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_string_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_bytes_extension ));
+
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeatedgroup_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_nested_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_foreign_message_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_import_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_lazy_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_nested_enum_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_foreign_enum_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_import_enum_extension ));
+
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_string_piece_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_cord_extension));
+
+ EXPECT_EQ(201 , message.GetExtension(unittest::repeated_int32_extension , 0));
+ EXPECT_EQ(202 , message.GetExtension(unittest::repeated_int64_extension , 0));
+ EXPECT_EQ(203 , message.GetExtension(unittest::repeated_uint32_extension , 0));
+ EXPECT_EQ(204 , message.GetExtension(unittest::repeated_uint64_extension , 0));
+ EXPECT_EQ(205 , message.GetExtension(unittest::repeated_sint32_extension , 0));
+ EXPECT_EQ(206 , message.GetExtension(unittest::repeated_sint64_extension , 0));
+ EXPECT_EQ(207 , message.GetExtension(unittest::repeated_fixed32_extension , 0));
+ EXPECT_EQ(208 , message.GetExtension(unittest::repeated_fixed64_extension , 0));
+ EXPECT_EQ(209 , message.GetExtension(unittest::repeated_sfixed32_extension, 0));
+ EXPECT_EQ(210 , message.GetExtension(unittest::repeated_sfixed64_extension, 0));
+ EXPECT_EQ(211 , message.GetExtension(unittest::repeated_float_extension , 0));
+ EXPECT_EQ(212 , message.GetExtension(unittest::repeated_double_extension , 0));
+ EXPECT_TRUE( message.GetExtension(unittest::repeated_bool_extension , 0));
+ EXPECT_EQ("215", message.GetExtension(unittest::repeated_string_extension , 0));
+ EXPECT_EQ("216", message.GetExtension(unittest::repeated_bytes_extension , 0));
+
+ EXPECT_EQ(217, message.GetExtension(unittest::repeatedgroup_extension , 0).a());
+ EXPECT_EQ(218, message.GetExtension(unittest::repeated_nested_message_extension , 0).bb());
+ EXPECT_EQ(219, message.GetExtension(unittest::repeated_foreign_message_extension, 0).c());
+ EXPECT_EQ(220, message.GetExtension(unittest::repeated_import_message_extension , 0).d());
+ EXPECT_EQ(227, message.GetExtension(unittest::repeated_lazy_message_extension , 0).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.GetExtension(unittest::repeated_nested_enum_extension , 0));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.GetExtension(unittest::repeated_foreign_enum_extension, 0));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.GetExtension(unittest::repeated_import_enum_extension , 0));
+
+ EXPECT_EQ("224", message.GetExtension(unittest::repeated_string_piece_extension, 0));
+ EXPECT_EQ("225", message.GetExtension(unittest::repeated_cord_extension, 0));
+
+ EXPECT_EQ(301 , message.GetExtension(unittest::repeated_int32_extension , 1));
+ EXPECT_EQ(302 , message.GetExtension(unittest::repeated_int64_extension , 1));
+ EXPECT_EQ(303 , message.GetExtension(unittest::repeated_uint32_extension , 1));
+ EXPECT_EQ(304 , message.GetExtension(unittest::repeated_uint64_extension , 1));
+ EXPECT_EQ(305 , message.GetExtension(unittest::repeated_sint32_extension , 1));
+ EXPECT_EQ(306 , message.GetExtension(unittest::repeated_sint64_extension , 1));
+ EXPECT_EQ(307 , message.GetExtension(unittest::repeated_fixed32_extension , 1));
+ EXPECT_EQ(308 , message.GetExtension(unittest::repeated_fixed64_extension , 1));
+ EXPECT_EQ(309 , message.GetExtension(unittest::repeated_sfixed32_extension, 1));
+ EXPECT_EQ(310 , message.GetExtension(unittest::repeated_sfixed64_extension, 1));
+ EXPECT_EQ(311 , message.GetExtension(unittest::repeated_float_extension , 1));
+ EXPECT_EQ(312 , message.GetExtension(unittest::repeated_double_extension , 1));
+ EXPECT_FALSE( message.GetExtension(unittest::repeated_bool_extension , 1));
+ EXPECT_EQ("315", message.GetExtension(unittest::repeated_string_extension , 1));
+ EXPECT_EQ("316", message.GetExtension(unittest::repeated_bytes_extension , 1));
+
+ EXPECT_EQ(317, message.GetExtension(unittest::repeatedgroup_extension , 1).a());
+ EXPECT_EQ(318, message.GetExtension(unittest::repeated_nested_message_extension , 1).bb());
+ EXPECT_EQ(319, message.GetExtension(unittest::repeated_foreign_message_extension, 1).c());
+ EXPECT_EQ(320, message.GetExtension(unittest::repeated_import_message_extension , 1).d());
+ EXPECT_EQ(327, message.GetExtension(unittest::repeated_lazy_message_extension , 1).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAZ, message.GetExtension(unittest::repeated_nested_enum_extension , 1));
+ EXPECT_EQ(unittest::FOREIGN_BAZ , message.GetExtension(unittest::repeated_foreign_enum_extension, 1));
+ EXPECT_EQ(unittest_import::IMPORT_BAZ, message.GetExtension(unittest::repeated_import_enum_extension , 1));
+
+ EXPECT_EQ("324", message.GetExtension(unittest::repeated_string_piece_extension, 1));
+ EXPECT_EQ("325", message.GetExtension(unittest::repeated_cord_extension, 1));
+
+ // -----------------------------------------------------------------
+
+ EXPECT_TRUE(message.HasExtension(unittest::default_int32_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_int64_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_uint32_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_uint64_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_sint32_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_sint64_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_fixed32_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_fixed64_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_sfixed32_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::default_sfixed64_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::default_float_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_double_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_bool_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_string_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_bytes_extension ));
+
+ EXPECT_TRUE(message.HasExtension(unittest::default_nested_enum_extension ));
+ EXPECT_TRUE(message.HasExtension(unittest::default_foreign_enum_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::default_import_enum_extension ));
+
+ EXPECT_TRUE(message.HasExtension(unittest::default_string_piece_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::default_cord_extension));
+
+ EXPECT_EQ(401 , message.GetExtension(unittest::default_int32_extension ));
+ EXPECT_EQ(402 , message.GetExtension(unittest::default_int64_extension ));
+ EXPECT_EQ(403 , message.GetExtension(unittest::default_uint32_extension ));
+ EXPECT_EQ(404 , message.GetExtension(unittest::default_uint64_extension ));
+ EXPECT_EQ(405 , message.GetExtension(unittest::default_sint32_extension ));
+ EXPECT_EQ(406 , message.GetExtension(unittest::default_sint64_extension ));
+ EXPECT_EQ(407 , message.GetExtension(unittest::default_fixed32_extension ));
+ EXPECT_EQ(408 , message.GetExtension(unittest::default_fixed64_extension ));
+ EXPECT_EQ(409 , message.GetExtension(unittest::default_sfixed32_extension));
+ EXPECT_EQ(410 , message.GetExtension(unittest::default_sfixed64_extension));
+ EXPECT_EQ(411 , message.GetExtension(unittest::default_float_extension ));
+ EXPECT_EQ(412 , message.GetExtension(unittest::default_double_extension ));
+ EXPECT_FALSE( message.GetExtension(unittest::default_bool_extension ));
+ EXPECT_EQ("415", message.GetExtension(unittest::default_string_extension ));
+ EXPECT_EQ("416", message.GetExtension(unittest::default_bytes_extension ));
+
+ EXPECT_EQ(unittest::TestAllTypes::FOO, message.GetExtension(unittest::default_nested_enum_extension ));
+ EXPECT_EQ(unittest::FOREIGN_FOO , message.GetExtension(unittest::default_foreign_enum_extension));
+ EXPECT_EQ(unittest_import::IMPORT_FOO, message.GetExtension(unittest::default_import_enum_extension ));
+
+ EXPECT_EQ("424", message.GetExtension(unittest::default_string_piece_extension));
+ EXPECT_EQ("425", message.GetExtension(unittest::default_cord_extension));
+
+ EXPECT_TRUE(message.HasExtension(unittest::oneof_uint32_extension));
+ EXPECT_TRUE(message.GetExtension(unittest::oneof_nested_message_extension).has_bb());
+ EXPECT_TRUE(message.HasExtension(unittest::oneof_string_extension));
+ EXPECT_TRUE(message.HasExtension(unittest::oneof_bytes_extension));
+
+ EXPECT_EQ(601, message.GetExtension(unittest::oneof_uint32_extension));
+ EXPECT_EQ(602, message.GetExtension(unittest::oneof_nested_message_extension).bb());
+ EXPECT_EQ("603", message.GetExtension(unittest::oneof_string_extension));
+ EXPECT_EQ("604", message.GetExtension(unittest::oneof_bytes_extension));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectExtensionsClear(
+ const unittest::TestAllExtensions& message) {
+ string serialized;
+ ASSERT_TRUE(message.SerializeToString(&serialized));
+ EXPECT_EQ("", serialized);
+ EXPECT_EQ(0, message.ByteSize());
+
+ // has_blah() should initially be false for all optional fields.
+ EXPECT_FALSE(message.HasExtension(unittest::optional_int32_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_int64_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_uint32_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_uint64_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_sint32_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_sint64_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_fixed32_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_fixed64_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_sfixed32_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_sfixed64_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_float_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_double_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_bool_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_string_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_bytes_extension ));
+
+ EXPECT_FALSE(message.HasExtension(unittest::optionalgroup_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_nested_message_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_foreign_message_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_import_message_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_public_import_message_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_lazy_message_extension ));
+
+ EXPECT_FALSE(message.HasExtension(unittest::optional_nested_enum_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_foreign_enum_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_import_enum_extension ));
+
+ EXPECT_FALSE(message.HasExtension(unittest::optional_string_piece_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::optional_cord_extension));
+
+ // Optional fields without defaults are set to zero or something like it.
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_int32_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_int64_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_uint32_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_uint64_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_sint32_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_sint64_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_fixed32_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_fixed64_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_sfixed32_extension));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_sfixed64_extension));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_float_extension ));
+ EXPECT_EQ(0 , message.GetExtension(unittest::optional_double_extension ));
+ EXPECT_FALSE( message.GetExtension(unittest::optional_bool_extension ));
+ EXPECT_EQ("" , message.GetExtension(unittest::optional_string_extension ));
+ EXPECT_EQ("" , message.GetExtension(unittest::optional_bytes_extension ));
+
+ // Embedded messages should also be clear.
+ EXPECT_FALSE(message.GetExtension(unittest::optionalgroup_extension ).has_a());
+ EXPECT_FALSE(message.GetExtension(unittest::optional_nested_message_extension ).has_bb());
+ EXPECT_FALSE(message.GetExtension(unittest::optional_foreign_message_extension ).has_c());
+ EXPECT_FALSE(message.GetExtension(unittest::optional_import_message_extension ).has_d());
+ EXPECT_FALSE(message.GetExtension(unittest::optional_public_import_message_extension).has_e());
+ EXPECT_FALSE(message.GetExtension(unittest::optional_lazy_message_extension ).has_bb());
+
+ EXPECT_EQ(0, message.GetExtension(unittest::optionalgroup_extension ).a());
+ EXPECT_EQ(0, message.GetExtension(unittest::optional_nested_message_extension ).bb());
+ EXPECT_EQ(0, message.GetExtension(unittest::optional_foreign_message_extension ).c());
+ EXPECT_EQ(0, message.GetExtension(unittest::optional_import_message_extension ).d());
+ EXPECT_EQ(0, message.GetExtension(unittest::optional_public_import_message_extension).e());
+ EXPECT_EQ(0, message.GetExtension(unittest::optional_lazy_message_extension ).bb());
+
+ // Enums without defaults are set to the first value in the enum.
+ EXPECT_EQ(unittest::TestAllTypes::FOO, message.GetExtension(unittest::optional_nested_enum_extension ));
+ EXPECT_EQ(unittest::FOREIGN_FOO , message.GetExtension(unittest::optional_foreign_enum_extension));
+ EXPECT_EQ(unittest_import::IMPORT_FOO, message.GetExtension(unittest::optional_import_enum_extension ));
+
+ EXPECT_EQ("", message.GetExtension(unittest::optional_string_piece_extension));
+ EXPECT_EQ("", message.GetExtension(unittest::optional_cord_extension));
+
+ // Repeated fields are empty.
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_int32_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_int64_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_uint32_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_uint64_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_sint32_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_sint64_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_fixed32_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_fixed64_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_sfixed32_extension));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_sfixed64_extension));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_float_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_double_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_bool_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_string_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_bytes_extension ));
+
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeatedgroup_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_nested_message_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_foreign_message_extension));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_import_message_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_lazy_message_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_nested_enum_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_foreign_enum_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_import_enum_extension ));
+
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_string_piece_extension));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::repeated_cord_extension));
+
+ // has_blah() should also be false for all default fields.
+ EXPECT_FALSE(message.HasExtension(unittest::default_int32_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_int64_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_uint32_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_uint64_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_sint32_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_sint64_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_fixed32_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_fixed64_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_sfixed32_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::default_sfixed64_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::default_float_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_double_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_bool_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_string_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_bytes_extension ));
+
+ EXPECT_FALSE(message.HasExtension(unittest::default_nested_enum_extension ));
+ EXPECT_FALSE(message.HasExtension(unittest::default_foreign_enum_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::default_import_enum_extension ));
+
+ EXPECT_FALSE(message.HasExtension(unittest::default_string_piece_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::default_cord_extension));
+
+ // Fields with defaults have their default values (duh).
+ EXPECT_EQ( 41 , message.GetExtension(unittest::default_int32_extension ));
+ EXPECT_EQ( 42 , message.GetExtension(unittest::default_int64_extension ));
+ EXPECT_EQ( 43 , message.GetExtension(unittest::default_uint32_extension ));
+ EXPECT_EQ( 44 , message.GetExtension(unittest::default_uint64_extension ));
+ EXPECT_EQ(-45 , message.GetExtension(unittest::default_sint32_extension ));
+ EXPECT_EQ( 46 , message.GetExtension(unittest::default_sint64_extension ));
+ EXPECT_EQ( 47 , message.GetExtension(unittest::default_fixed32_extension ));
+ EXPECT_EQ( 48 , message.GetExtension(unittest::default_fixed64_extension ));
+ EXPECT_EQ( 49 , message.GetExtension(unittest::default_sfixed32_extension));
+ EXPECT_EQ(-50 , message.GetExtension(unittest::default_sfixed64_extension));
+ EXPECT_EQ( 51.5 , message.GetExtension(unittest::default_float_extension ));
+ EXPECT_EQ( 52e3 , message.GetExtension(unittest::default_double_extension ));
+ EXPECT_TRUE( message.GetExtension(unittest::default_bool_extension ));
+ EXPECT_EQ("hello", message.GetExtension(unittest::default_string_extension ));
+ EXPECT_EQ("world", message.GetExtension(unittest::default_bytes_extension ));
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.GetExtension(unittest::default_nested_enum_extension ));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.GetExtension(unittest::default_foreign_enum_extension));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.GetExtension(unittest::default_import_enum_extension ));
+
+ EXPECT_EQ("abc", message.GetExtension(unittest::default_string_piece_extension));
+ EXPECT_EQ("123", message.GetExtension(unittest::default_cord_extension));
+
+ EXPECT_FALSE(message.HasExtension(unittest::oneof_uint32_extension));
+ EXPECT_FALSE(message.GetExtension(unittest::oneof_nested_message_extension).has_bb());
+ EXPECT_FALSE(message.HasExtension(unittest::oneof_string_extension));
+ EXPECT_FALSE(message.HasExtension(unittest::oneof_bytes_extension));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectRepeatedExtensionsModified(
+ const unittest::TestAllExtensions& message) {
+ // ModifyRepeatedFields only sets the second repeated element of each
+ // field. In addition to verifying this, we also verify that the first
+ // element and size were *not* modified.
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_int32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_int64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_uint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_uint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_fixed32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_fixed64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sfixed32_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sfixed64_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_float_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_double_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_bool_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_string_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_bytes_extension ));
+
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeatedgroup_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_nested_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_foreign_message_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_import_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_lazy_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_nested_enum_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_foreign_enum_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_import_enum_extension ));
+
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_string_piece_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_cord_extension));
+
+ EXPECT_EQ(201 , message.GetExtension(unittest::repeated_int32_extension , 0));
+ EXPECT_EQ(202 , message.GetExtension(unittest::repeated_int64_extension , 0));
+ EXPECT_EQ(203 , message.GetExtension(unittest::repeated_uint32_extension , 0));
+ EXPECT_EQ(204 , message.GetExtension(unittest::repeated_uint64_extension , 0));
+ EXPECT_EQ(205 , message.GetExtension(unittest::repeated_sint32_extension , 0));
+ EXPECT_EQ(206 , message.GetExtension(unittest::repeated_sint64_extension , 0));
+ EXPECT_EQ(207 , message.GetExtension(unittest::repeated_fixed32_extension , 0));
+ EXPECT_EQ(208 , message.GetExtension(unittest::repeated_fixed64_extension , 0));
+ EXPECT_EQ(209 , message.GetExtension(unittest::repeated_sfixed32_extension, 0));
+ EXPECT_EQ(210 , message.GetExtension(unittest::repeated_sfixed64_extension, 0));
+ EXPECT_EQ(211 , message.GetExtension(unittest::repeated_float_extension , 0));
+ EXPECT_EQ(212 , message.GetExtension(unittest::repeated_double_extension , 0));
+ EXPECT_TRUE( message.GetExtension(unittest::repeated_bool_extension , 0));
+ EXPECT_EQ("215", message.GetExtension(unittest::repeated_string_extension , 0));
+ EXPECT_EQ("216", message.GetExtension(unittest::repeated_bytes_extension , 0));
+
+ EXPECT_EQ(217, message.GetExtension(unittest::repeatedgroup_extension , 0).a());
+ EXPECT_EQ(218, message.GetExtension(unittest::repeated_nested_message_extension , 0).bb());
+ EXPECT_EQ(219, message.GetExtension(unittest::repeated_foreign_message_extension, 0).c());
+ EXPECT_EQ(220, message.GetExtension(unittest::repeated_import_message_extension , 0).d());
+ EXPECT_EQ(227, message.GetExtension(unittest::repeated_lazy_message_extension , 0).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.GetExtension(unittest::repeated_nested_enum_extension , 0));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.GetExtension(unittest::repeated_foreign_enum_extension, 0));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.GetExtension(unittest::repeated_import_enum_extension , 0));
+
+ EXPECT_EQ("224", message.GetExtension(unittest::repeated_string_piece_extension, 0));
+ EXPECT_EQ("225", message.GetExtension(unittest::repeated_cord_extension, 0));
+
+ // Actually verify the second (modified) elements now.
+ EXPECT_EQ(501 , message.GetExtension(unittest::repeated_int32_extension , 1));
+ EXPECT_EQ(502 , message.GetExtension(unittest::repeated_int64_extension , 1));
+ EXPECT_EQ(503 , message.GetExtension(unittest::repeated_uint32_extension , 1));
+ EXPECT_EQ(504 , message.GetExtension(unittest::repeated_uint64_extension , 1));
+ EXPECT_EQ(505 , message.GetExtension(unittest::repeated_sint32_extension , 1));
+ EXPECT_EQ(506 , message.GetExtension(unittest::repeated_sint64_extension , 1));
+ EXPECT_EQ(507 , message.GetExtension(unittest::repeated_fixed32_extension , 1));
+ EXPECT_EQ(508 , message.GetExtension(unittest::repeated_fixed64_extension , 1));
+ EXPECT_EQ(509 , message.GetExtension(unittest::repeated_sfixed32_extension, 1));
+ EXPECT_EQ(510 , message.GetExtension(unittest::repeated_sfixed64_extension, 1));
+ EXPECT_EQ(511 , message.GetExtension(unittest::repeated_float_extension , 1));
+ EXPECT_EQ(512 , message.GetExtension(unittest::repeated_double_extension , 1));
+ EXPECT_TRUE( message.GetExtension(unittest::repeated_bool_extension , 1));
+ EXPECT_EQ("515", message.GetExtension(unittest::repeated_string_extension , 1));
+ EXPECT_EQ("516", message.GetExtension(unittest::repeated_bytes_extension , 1));
+
+ EXPECT_EQ(517, message.GetExtension(unittest::repeatedgroup_extension , 1).a());
+ EXPECT_EQ(518, message.GetExtension(unittest::repeated_nested_message_extension , 1).bb());
+ EXPECT_EQ(519, message.GetExtension(unittest::repeated_foreign_message_extension, 1).c());
+ EXPECT_EQ(520, message.GetExtension(unittest::repeated_import_message_extension , 1).d());
+ EXPECT_EQ(527, message.GetExtension(unittest::repeated_lazy_message_extension , 1).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::FOO, message.GetExtension(unittest::repeated_nested_enum_extension , 1));
+ EXPECT_EQ(unittest::FOREIGN_FOO , message.GetExtension(unittest::repeated_foreign_enum_extension, 1));
+ EXPECT_EQ(unittest_import::IMPORT_FOO, message.GetExtension(unittest::repeated_import_enum_extension , 1));
+
+ EXPECT_EQ("524", message.GetExtension(unittest::repeated_string_piece_extension, 1));
+ EXPECT_EQ("525", message.GetExtension(unittest::repeated_cord_extension, 1));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::SetPackedExtensions(unittest::TestPackedExtensions* message) {
+ message->AddExtension(unittest::packed_int32_extension , 601);
+ message->AddExtension(unittest::packed_int64_extension , 602);
+ message->AddExtension(unittest::packed_uint32_extension , 603);
+ message->AddExtension(unittest::packed_uint64_extension , 604);
+ message->AddExtension(unittest::packed_sint32_extension , 605);
+ message->AddExtension(unittest::packed_sint64_extension , 606);
+ message->AddExtension(unittest::packed_fixed32_extension , 607);
+ message->AddExtension(unittest::packed_fixed64_extension , 608);
+ message->AddExtension(unittest::packed_sfixed32_extension, 609);
+ message->AddExtension(unittest::packed_sfixed64_extension, 610);
+ message->AddExtension(unittest::packed_float_extension , 611);
+ message->AddExtension(unittest::packed_double_extension , 612);
+ message->AddExtension(unittest::packed_bool_extension , true);
+ message->AddExtension(unittest::packed_enum_extension, unittest::FOREIGN_BAR);
+ // add a second one of each field
+ message->AddExtension(unittest::packed_int32_extension , 701);
+ message->AddExtension(unittest::packed_int64_extension , 702);
+ message->AddExtension(unittest::packed_uint32_extension , 703);
+ message->AddExtension(unittest::packed_uint64_extension , 704);
+ message->AddExtension(unittest::packed_sint32_extension , 705);
+ message->AddExtension(unittest::packed_sint64_extension , 706);
+ message->AddExtension(unittest::packed_fixed32_extension , 707);
+ message->AddExtension(unittest::packed_fixed64_extension , 708);
+ message->AddExtension(unittest::packed_sfixed32_extension, 709);
+ message->AddExtension(unittest::packed_sfixed64_extension, 710);
+ message->AddExtension(unittest::packed_float_extension , 711);
+ message->AddExtension(unittest::packed_double_extension , 712);
+ message->AddExtension(unittest::packed_bool_extension , false);
+ message->AddExtension(unittest::packed_enum_extension, unittest::FOREIGN_BAZ);
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ModifyPackedExtensions(unittest::TestPackedExtensions* message) {
+ message->SetExtension(unittest::packed_int32_extension , 1, 801);
+ message->SetExtension(unittest::packed_int64_extension , 1, 802);
+ message->SetExtension(unittest::packed_uint32_extension , 1, 803);
+ message->SetExtension(unittest::packed_uint64_extension , 1, 804);
+ message->SetExtension(unittest::packed_sint32_extension , 1, 805);
+ message->SetExtension(unittest::packed_sint64_extension , 1, 806);
+ message->SetExtension(unittest::packed_fixed32_extension , 1, 807);
+ message->SetExtension(unittest::packed_fixed64_extension , 1, 808);
+ message->SetExtension(unittest::packed_sfixed32_extension, 1, 809);
+ message->SetExtension(unittest::packed_sfixed64_extension, 1, 810);
+ message->SetExtension(unittest::packed_float_extension , 1, 811);
+ message->SetExtension(unittest::packed_double_extension , 1, 812);
+ message->SetExtension(unittest::packed_bool_extension , 1, true);
+ message->SetExtension(unittest::packed_enum_extension , 1,
+ unittest::FOREIGN_FOO);
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectPackedExtensionsSet(
+ const unittest::TestPackedExtensions& message) {
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_int32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_int64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_uint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_uint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_sint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_sint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_fixed32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_fixed64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_sfixed32_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_sfixed64_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_float_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_double_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_bool_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_enum_extension ));
+
+ EXPECT_EQ(601 , message.GetExtension(unittest::packed_int32_extension , 0));
+ EXPECT_EQ(602 , message.GetExtension(unittest::packed_int64_extension , 0));
+ EXPECT_EQ(603 , message.GetExtension(unittest::packed_uint32_extension , 0));
+ EXPECT_EQ(604 , message.GetExtension(unittest::packed_uint64_extension , 0));
+ EXPECT_EQ(605 , message.GetExtension(unittest::packed_sint32_extension , 0));
+ EXPECT_EQ(606 , message.GetExtension(unittest::packed_sint64_extension , 0));
+ EXPECT_EQ(607 , message.GetExtension(unittest::packed_fixed32_extension , 0));
+ EXPECT_EQ(608 , message.GetExtension(unittest::packed_fixed64_extension , 0));
+ EXPECT_EQ(609 , message.GetExtension(unittest::packed_sfixed32_extension, 0));
+ EXPECT_EQ(610 , message.GetExtension(unittest::packed_sfixed64_extension, 0));
+ EXPECT_EQ(611 , message.GetExtension(unittest::packed_float_extension , 0));
+ EXPECT_EQ(612 , message.GetExtension(unittest::packed_double_extension , 0));
+ EXPECT_TRUE( message.GetExtension(unittest::packed_bool_extension , 0));
+ EXPECT_EQ(unittest::FOREIGN_BAR,
+ message.GetExtension(unittest::packed_enum_extension, 0));
+ EXPECT_EQ(701 , message.GetExtension(unittest::packed_int32_extension , 1));
+ EXPECT_EQ(702 , message.GetExtension(unittest::packed_int64_extension , 1));
+ EXPECT_EQ(703 , message.GetExtension(unittest::packed_uint32_extension , 1));
+ EXPECT_EQ(704 , message.GetExtension(unittest::packed_uint64_extension , 1));
+ EXPECT_EQ(705 , message.GetExtension(unittest::packed_sint32_extension , 1));
+ EXPECT_EQ(706 , message.GetExtension(unittest::packed_sint64_extension , 1));
+ EXPECT_EQ(707 , message.GetExtension(unittest::packed_fixed32_extension , 1));
+ EXPECT_EQ(708 , message.GetExtension(unittest::packed_fixed64_extension , 1));
+ EXPECT_EQ(709 , message.GetExtension(unittest::packed_sfixed32_extension, 1));
+ EXPECT_EQ(710 , message.GetExtension(unittest::packed_sfixed64_extension, 1));
+ EXPECT_EQ(711 , message.GetExtension(unittest::packed_float_extension , 1));
+ EXPECT_EQ(712 , message.GetExtension(unittest::packed_double_extension , 1));
+ EXPECT_FALSE( message.GetExtension(unittest::packed_bool_extension , 1));
+ EXPECT_EQ(unittest::FOREIGN_BAZ,
+ message.GetExtension(unittest::packed_enum_extension, 1));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectPackedExtensionsClear(
+ const unittest::TestPackedExtensions& message) {
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_int32_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_int64_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_uint32_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_uint64_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_sint32_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_sint64_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_fixed32_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_fixed64_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_sfixed32_extension));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_sfixed64_extension));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_float_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_double_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_bool_extension ));
+ EXPECT_EQ(0, message.ExtensionSize(unittest::packed_enum_extension ));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectPackedExtensionsModified(
+ const unittest::TestPackedExtensions& message) {
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_int32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_int64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_uint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_uint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_sint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_sint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_fixed32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_fixed64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_sfixed32_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_sfixed64_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_float_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_double_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_bool_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::packed_enum_extension ));
+ EXPECT_EQ(601 , message.GetExtension(unittest::packed_int32_extension , 0));
+ EXPECT_EQ(602 , message.GetExtension(unittest::packed_int64_extension , 0));
+ EXPECT_EQ(603 , message.GetExtension(unittest::packed_uint32_extension , 0));
+ EXPECT_EQ(604 , message.GetExtension(unittest::packed_uint64_extension , 0));
+ EXPECT_EQ(605 , message.GetExtension(unittest::packed_sint32_extension , 0));
+ EXPECT_EQ(606 , message.GetExtension(unittest::packed_sint64_extension , 0));
+ EXPECT_EQ(607 , message.GetExtension(unittest::packed_fixed32_extension , 0));
+ EXPECT_EQ(608 , message.GetExtension(unittest::packed_fixed64_extension , 0));
+ EXPECT_EQ(609 , message.GetExtension(unittest::packed_sfixed32_extension, 0));
+ EXPECT_EQ(610 , message.GetExtension(unittest::packed_sfixed64_extension, 0));
+ EXPECT_EQ(611 , message.GetExtension(unittest::packed_float_extension , 0));
+ EXPECT_EQ(612 , message.GetExtension(unittest::packed_double_extension , 0));
+ EXPECT_TRUE( message.GetExtension(unittest::packed_bool_extension , 0));
+ EXPECT_EQ(unittest::FOREIGN_BAR,
+ message.GetExtension(unittest::packed_enum_extension, 0));
+
+ // Actually verify the second (modified) elements now.
+ EXPECT_EQ(801 , message.GetExtension(unittest::packed_int32_extension , 1));
+ EXPECT_EQ(802 , message.GetExtension(unittest::packed_int64_extension , 1));
+ EXPECT_EQ(803 , message.GetExtension(unittest::packed_uint32_extension , 1));
+ EXPECT_EQ(804 , message.GetExtension(unittest::packed_uint64_extension , 1));
+ EXPECT_EQ(805 , message.GetExtension(unittest::packed_sint32_extension , 1));
+ EXPECT_EQ(806 , message.GetExtension(unittest::packed_sint64_extension , 1));
+ EXPECT_EQ(807 , message.GetExtension(unittest::packed_fixed32_extension , 1));
+ EXPECT_EQ(808 , message.GetExtension(unittest::packed_fixed64_extension , 1));
+ EXPECT_EQ(809 , message.GetExtension(unittest::packed_sfixed32_extension, 1));
+ EXPECT_EQ(810 , message.GetExtension(unittest::packed_sfixed64_extension, 1));
+ EXPECT_EQ(811 , message.GetExtension(unittest::packed_float_extension , 1));
+ EXPECT_EQ(812 , message.GetExtension(unittest::packed_double_extension , 1));
+ EXPECT_TRUE( message.GetExtension(unittest::packed_bool_extension , 1));
+ EXPECT_EQ(unittest::FOREIGN_FOO,
+ message.GetExtension(unittest::packed_enum_extension, 1));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectUnpackedExtensionsSet(
+ const unittest::TestUnpackedExtensions& message) {
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_int32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_int64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_uint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_uint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_sint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_sint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_fixed32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_fixed64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_sfixed32_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_sfixed64_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_float_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_double_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_bool_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::unpacked_enum_extension ));
+
+ EXPECT_EQ(601 , message.GetExtension(unittest::unpacked_int32_extension , 0));
+ EXPECT_EQ(602 , message.GetExtension(unittest::unpacked_int64_extension , 0));
+ EXPECT_EQ(603 , message.GetExtension(unittest::unpacked_uint32_extension , 0));
+ EXPECT_EQ(604 , message.GetExtension(unittest::unpacked_uint64_extension , 0));
+ EXPECT_EQ(605 , message.GetExtension(unittest::unpacked_sint32_extension , 0));
+ EXPECT_EQ(606 , message.GetExtension(unittest::unpacked_sint64_extension , 0));
+ EXPECT_EQ(607 , message.GetExtension(unittest::unpacked_fixed32_extension , 0));
+ EXPECT_EQ(608 , message.GetExtension(unittest::unpacked_fixed64_extension , 0));
+ EXPECT_EQ(609 , message.GetExtension(unittest::unpacked_sfixed32_extension, 0));
+ EXPECT_EQ(610 , message.GetExtension(unittest::unpacked_sfixed64_extension, 0));
+ EXPECT_EQ(611 , message.GetExtension(unittest::unpacked_float_extension , 0));
+ EXPECT_EQ(612 , message.GetExtension(unittest::unpacked_double_extension , 0));
+ EXPECT_EQ(true , message.GetExtension(unittest::unpacked_bool_extension , 0));
+ EXPECT_EQ(unittest::FOREIGN_BAR,
+ message.GetExtension(unittest::unpacked_enum_extension, 0));
+ EXPECT_EQ(701 , message.GetExtension(unittest::unpacked_int32_extension , 1));
+ EXPECT_EQ(702 , message.GetExtension(unittest::unpacked_int64_extension , 1));
+ EXPECT_EQ(703 , message.GetExtension(unittest::unpacked_uint32_extension , 1));
+ EXPECT_EQ(704 , message.GetExtension(unittest::unpacked_uint64_extension , 1));
+ EXPECT_EQ(705 , message.GetExtension(unittest::unpacked_sint32_extension , 1));
+ EXPECT_EQ(706 , message.GetExtension(unittest::unpacked_sint64_extension , 1));
+ EXPECT_EQ(707 , message.GetExtension(unittest::unpacked_fixed32_extension , 1));
+ EXPECT_EQ(708 , message.GetExtension(unittest::unpacked_fixed64_extension , 1));
+ EXPECT_EQ(709 , message.GetExtension(unittest::unpacked_sfixed32_extension, 1));
+ EXPECT_EQ(710 , message.GetExtension(unittest::unpacked_sfixed64_extension, 1));
+ EXPECT_EQ(711 , message.GetExtension(unittest::unpacked_float_extension , 1));
+ EXPECT_EQ(712 , message.GetExtension(unittest::unpacked_double_extension , 1));
+ EXPECT_EQ(false, message.GetExtension(unittest::unpacked_bool_extension , 1));
+ EXPECT_EQ(unittest::FOREIGN_BAZ,
+ message.GetExtension(unittest::unpacked_enum_extension, 1));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ExpectAllFieldsAndExtensionsInOrder(const string& serialized) {
+ // We set each field individually, serialize separately, and concatenate all
+ // the strings in canonical order to determine the expected serialization.
+ string expected;
+ unittest::TestFieldOrderings message;
+ message.set_my_int(1); // Field 1.
+ message.AppendToString(&expected);
+ message.Clear();
+ message.SetExtension(unittest::my_extension_int, 23); // Field 5.
+ message.AppendToString(&expected);
+ message.Clear();
+ message.set_my_string("foo"); // Field 11.
+ message.AppendToString(&expected);
+ message.Clear();
+ message.SetExtension(unittest::my_extension_string, "bar"); // Field 50.
+ message.AppendToString(&expected);
+ message.Clear();
+ message.set_my_float(1.0); // Field 101.
+ message.AppendToString(&expected);
+ message.Clear();
+
+ // We don't EXPECT_EQ() since we don't want to print raw bytes to stdout.
+ EXPECT_TRUE(serialized == expected);
+}
+
+void TestUtil::ExpectLastRepeatedsRemoved(
+ const unittest::TestAllTypes& message) {
+ ASSERT_EQ(1, message.repeated_int32_size ());
+ ASSERT_EQ(1, message.repeated_int64_size ());
+ ASSERT_EQ(1, message.repeated_uint32_size ());
+ ASSERT_EQ(1, message.repeated_uint64_size ());
+ ASSERT_EQ(1, message.repeated_sint32_size ());
+ ASSERT_EQ(1, message.repeated_sint64_size ());
+ ASSERT_EQ(1, message.repeated_fixed32_size ());
+ ASSERT_EQ(1, message.repeated_fixed64_size ());
+ ASSERT_EQ(1, message.repeated_sfixed32_size());
+ ASSERT_EQ(1, message.repeated_sfixed64_size());
+ ASSERT_EQ(1, message.repeated_float_size ());
+ ASSERT_EQ(1, message.repeated_double_size ());
+ ASSERT_EQ(1, message.repeated_bool_size ());
+ ASSERT_EQ(1, message.repeated_string_size ());
+ ASSERT_EQ(1, message.repeated_bytes_size ());
+
+ ASSERT_EQ(1, message.repeatedgroup_size ());
+ ASSERT_EQ(1, message.repeated_nested_message_size ());
+ ASSERT_EQ(1, message.repeated_foreign_message_size());
+ ASSERT_EQ(1, message.repeated_import_message_size ());
+ ASSERT_EQ(1, message.repeated_import_message_size ());
+ ASSERT_EQ(1, message.repeated_nested_enum_size ());
+ ASSERT_EQ(1, message.repeated_foreign_enum_size ());
+ ASSERT_EQ(1, message.repeated_import_enum_size ());
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ ASSERT_EQ(1, message.repeated_string_piece_size());
+ ASSERT_EQ(1, message.repeated_cord_size());
+#endif
+
+ // Test that the remaining element is the correct one.
+ EXPECT_EQ(201 , message.repeated_int32 (0));
+ EXPECT_EQ(202 , message.repeated_int64 (0));
+ EXPECT_EQ(203 , message.repeated_uint32 (0));
+ EXPECT_EQ(204 , message.repeated_uint64 (0));
+ EXPECT_EQ(205 , message.repeated_sint32 (0));
+ EXPECT_EQ(206 , message.repeated_sint64 (0));
+ EXPECT_EQ(207 , message.repeated_fixed32 (0));
+ EXPECT_EQ(208 , message.repeated_fixed64 (0));
+ EXPECT_EQ(209 , message.repeated_sfixed32(0));
+ EXPECT_EQ(210 , message.repeated_sfixed64(0));
+ EXPECT_EQ(211 , message.repeated_float (0));
+ EXPECT_EQ(212 , message.repeated_double (0));
+ EXPECT_TRUE( message.repeated_bool (0));
+ EXPECT_EQ("215", message.repeated_string (0));
+ EXPECT_EQ("216", message.repeated_bytes (0));
+
+ EXPECT_EQ(217, message.repeatedgroup (0).a());
+ EXPECT_EQ(218, message.repeated_nested_message (0).bb());
+ EXPECT_EQ(219, message.repeated_foreign_message(0).c());
+ EXPECT_EQ(220, message.repeated_import_message (0).d());
+ EXPECT_EQ(220, message.repeated_import_message (0).d());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.repeated_nested_enum (0));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.repeated_foreign_enum(0));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.repeated_import_enum (0));
+}
+
+void TestUtil::ExpectLastRepeatedExtensionsRemoved(
+ const unittest::TestAllExtensions& message) {
+
+ // Test that one element was removed.
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_int32_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_int64_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_uint32_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_uint64_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_sint32_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_sint64_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_fixed32_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_fixed64_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_sfixed32_extension));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_sfixed64_extension));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_float_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_double_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_bool_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_string_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_bytes_extension ));
+
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeatedgroup_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_nested_message_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_foreign_message_extension));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_import_message_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_lazy_message_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_nested_enum_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_foreign_enum_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_import_enum_extension ));
+
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_string_piece_extension));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_cord_extension));
+
+ // Test that the remaining element is the correct one.
+ EXPECT_EQ(201 , message.GetExtension(unittest::repeated_int32_extension , 0));
+ EXPECT_EQ(202 , message.GetExtension(unittest::repeated_int64_extension , 0));
+ EXPECT_EQ(203 , message.GetExtension(unittest::repeated_uint32_extension , 0));
+ EXPECT_EQ(204 , message.GetExtension(unittest::repeated_uint64_extension , 0));
+ EXPECT_EQ(205 , message.GetExtension(unittest::repeated_sint32_extension , 0));
+ EXPECT_EQ(206 , message.GetExtension(unittest::repeated_sint64_extension , 0));
+ EXPECT_EQ(207 , message.GetExtension(unittest::repeated_fixed32_extension , 0));
+ EXPECT_EQ(208 , message.GetExtension(unittest::repeated_fixed64_extension , 0));
+ EXPECT_EQ(209 , message.GetExtension(unittest::repeated_sfixed32_extension, 0));
+ EXPECT_EQ(210 , message.GetExtension(unittest::repeated_sfixed64_extension, 0));
+ EXPECT_EQ(211 , message.GetExtension(unittest::repeated_float_extension , 0));
+ EXPECT_EQ(212 , message.GetExtension(unittest::repeated_double_extension , 0));
+ EXPECT_TRUE( message.GetExtension(unittest::repeated_bool_extension , 0));
+ EXPECT_EQ("215", message.GetExtension(unittest::repeated_string_extension , 0));
+ EXPECT_EQ("216", message.GetExtension(unittest::repeated_bytes_extension , 0));
+
+ EXPECT_EQ(217, message.GetExtension(unittest::repeatedgroup_extension , 0).a());
+ EXPECT_EQ(218, message.GetExtension(unittest::repeated_nested_message_extension , 0).bb());
+ EXPECT_EQ(219, message.GetExtension(unittest::repeated_foreign_message_extension, 0).c());
+ EXPECT_EQ(220, message.GetExtension(unittest::repeated_import_message_extension , 0).d());
+ EXPECT_EQ(227, message.GetExtension(unittest::repeated_lazy_message_extension , 0).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.GetExtension(unittest::repeated_nested_enum_extension , 0));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.GetExtension(unittest::repeated_foreign_enum_extension, 0));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.GetExtension(unittest::repeated_import_enum_extension , 0));
+
+ EXPECT_EQ("224", message.GetExtension(unittest::repeated_string_piece_extension, 0));
+ EXPECT_EQ("225", message.GetExtension(unittest::repeated_cord_extension, 0));
+}
+
+void TestUtil::ExpectLastRepeatedsReleased(
+ const unittest::TestAllTypes& message) {
+ ASSERT_EQ(1, message.repeatedgroup_size ());
+ ASSERT_EQ(1, message.repeated_nested_message_size ());
+ ASSERT_EQ(1, message.repeated_foreign_message_size());
+ ASSERT_EQ(1, message.repeated_import_message_size ());
+ ASSERT_EQ(1, message.repeated_import_message_size ());
+
+ EXPECT_EQ(217, message.repeatedgroup (0).a());
+ EXPECT_EQ(218, message.repeated_nested_message (0).bb());
+ EXPECT_EQ(219, message.repeated_foreign_message(0).c());
+ EXPECT_EQ(220, message.repeated_import_message (0).d());
+ EXPECT_EQ(220, message.repeated_import_message (0).d());
+}
+
+void TestUtil::ExpectLastRepeatedExtensionsReleased(
+ const unittest::TestAllExtensions& message) {
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeatedgroup_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_nested_message_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_foreign_message_extension));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_import_message_extension ));
+ ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_lazy_message_extension ));
+
+ EXPECT_EQ(217, message.GetExtension(unittest::repeatedgroup_extension , 0).a());
+ EXPECT_EQ(218, message.GetExtension(unittest::repeated_nested_message_extension , 0).bb());
+ EXPECT_EQ(219, message.GetExtension(unittest::repeated_foreign_message_extension, 0).c());
+ EXPECT_EQ(220, message.GetExtension(unittest::repeated_import_message_extension , 0).d());
+ EXPECT_EQ(227, message.GetExtension(unittest::repeated_lazy_message_extension , 0).bb());
+}
+
+void TestUtil::ExpectRepeatedsSwapped(
+ const unittest::TestAllTypes& message) {
+ ASSERT_EQ(2, message.repeated_int32_size ());
+ ASSERT_EQ(2, message.repeated_int64_size ());
+ ASSERT_EQ(2, message.repeated_uint32_size ());
+ ASSERT_EQ(2, message.repeated_uint64_size ());
+ ASSERT_EQ(2, message.repeated_sint32_size ());
+ ASSERT_EQ(2, message.repeated_sint64_size ());
+ ASSERT_EQ(2, message.repeated_fixed32_size ());
+ ASSERT_EQ(2, message.repeated_fixed64_size ());
+ ASSERT_EQ(2, message.repeated_sfixed32_size());
+ ASSERT_EQ(2, message.repeated_sfixed64_size());
+ ASSERT_EQ(2, message.repeated_float_size ());
+ ASSERT_EQ(2, message.repeated_double_size ());
+ ASSERT_EQ(2, message.repeated_bool_size ());
+ ASSERT_EQ(2, message.repeated_string_size ());
+ ASSERT_EQ(2, message.repeated_bytes_size ());
+
+ ASSERT_EQ(2, message.repeatedgroup_size ());
+ ASSERT_EQ(2, message.repeated_nested_message_size ());
+ ASSERT_EQ(2, message.repeated_foreign_message_size());
+ ASSERT_EQ(2, message.repeated_import_message_size ());
+ ASSERT_EQ(2, message.repeated_import_message_size ());
+ ASSERT_EQ(2, message.repeated_nested_enum_size ());
+ ASSERT_EQ(2, message.repeated_foreign_enum_size ());
+ ASSERT_EQ(2, message.repeated_import_enum_size ());
+
+#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
+ ASSERT_EQ(2, message.repeated_string_piece_size());
+ ASSERT_EQ(2, message.repeated_cord_size());
+#endif
+
+ // Test that the first element and second element are flipped.
+ EXPECT_EQ(201 , message.repeated_int32 (1));
+ EXPECT_EQ(202 , message.repeated_int64 (1));
+ EXPECT_EQ(203 , message.repeated_uint32 (1));
+ EXPECT_EQ(204 , message.repeated_uint64 (1));
+ EXPECT_EQ(205 , message.repeated_sint32 (1));
+ EXPECT_EQ(206 , message.repeated_sint64 (1));
+ EXPECT_EQ(207 , message.repeated_fixed32 (1));
+ EXPECT_EQ(208 , message.repeated_fixed64 (1));
+ EXPECT_EQ(209 , message.repeated_sfixed32(1));
+ EXPECT_EQ(210 , message.repeated_sfixed64(1));
+ EXPECT_EQ(211 , message.repeated_float (1));
+ EXPECT_EQ(212 , message.repeated_double (1));
+ EXPECT_TRUE( message.repeated_bool (1));
+ EXPECT_EQ("215", message.repeated_string (1));
+ EXPECT_EQ("216", message.repeated_bytes (1));
+
+ EXPECT_EQ(217, message.repeatedgroup (1).a());
+ EXPECT_EQ(218, message.repeated_nested_message (1).bb());
+ EXPECT_EQ(219, message.repeated_foreign_message(1).c());
+ EXPECT_EQ(220, message.repeated_import_message (1).d());
+ EXPECT_EQ(220, message.repeated_import_message (1).d());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.repeated_nested_enum (1));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.repeated_foreign_enum(1));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.repeated_import_enum (1));
+
+ EXPECT_EQ(301 , message.repeated_int32 (0));
+ EXPECT_EQ(302 , message.repeated_int64 (0));
+ EXPECT_EQ(303 , message.repeated_uint32 (0));
+ EXPECT_EQ(304 , message.repeated_uint64 (0));
+ EXPECT_EQ(305 , message.repeated_sint32 (0));
+ EXPECT_EQ(306 , message.repeated_sint64 (0));
+ EXPECT_EQ(307 , message.repeated_fixed32 (0));
+ EXPECT_EQ(308 , message.repeated_fixed64 (0));
+ EXPECT_EQ(309 , message.repeated_sfixed32(0));
+ EXPECT_EQ(310 , message.repeated_sfixed64(0));
+ EXPECT_EQ(311 , message.repeated_float (0));
+ EXPECT_EQ(312 , message.repeated_double (0));
+ EXPECT_FALSE( message.repeated_bool (0));
+ EXPECT_EQ("315", message.repeated_string (0));
+ EXPECT_EQ("316", message.repeated_bytes (0));
+
+ EXPECT_EQ(317, message.repeatedgroup (0).a());
+ EXPECT_EQ(318, message.repeated_nested_message (0).bb());
+ EXPECT_EQ(319, message.repeated_foreign_message(0).c());
+ EXPECT_EQ(320, message.repeated_import_message (0).d());
+ EXPECT_EQ(320, message.repeated_import_message (0).d());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAZ, message.repeated_nested_enum (0));
+ EXPECT_EQ(unittest::FOREIGN_BAZ , message.repeated_foreign_enum(0));
+ EXPECT_EQ(unittest_import::IMPORT_BAZ, message.repeated_import_enum (0));
+}
+
+void TestUtil::ExpectRepeatedExtensionsSwapped(
+ const unittest::TestAllExtensions& message) {
+
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_int32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_int64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_uint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_uint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sint32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sint64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_fixed32_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_fixed64_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sfixed32_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_sfixed64_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_float_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_double_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_bool_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_string_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_bytes_extension ));
+
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeatedgroup_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_nested_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_foreign_message_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_import_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_lazy_message_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_nested_enum_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_foreign_enum_extension ));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_import_enum_extension ));
+
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_string_piece_extension));
+ ASSERT_EQ(2, message.ExtensionSize(unittest::repeated_cord_extension));
+
+ EXPECT_EQ(201 , message.GetExtension(unittest::repeated_int32_extension , 1));
+ EXPECT_EQ(202 , message.GetExtension(unittest::repeated_int64_extension , 1));
+ EXPECT_EQ(203 , message.GetExtension(unittest::repeated_uint32_extension , 1));
+ EXPECT_EQ(204 , message.GetExtension(unittest::repeated_uint64_extension , 1));
+ EXPECT_EQ(205 , message.GetExtension(unittest::repeated_sint32_extension , 1));
+ EXPECT_EQ(206 , message.GetExtension(unittest::repeated_sint64_extension , 1));
+ EXPECT_EQ(207 , message.GetExtension(unittest::repeated_fixed32_extension , 1));
+ EXPECT_EQ(208 , message.GetExtension(unittest::repeated_fixed64_extension , 1));
+ EXPECT_EQ(209 , message.GetExtension(unittest::repeated_sfixed32_extension, 1));
+ EXPECT_EQ(210 , message.GetExtension(unittest::repeated_sfixed64_extension, 1));
+ EXPECT_EQ(211 , message.GetExtension(unittest::repeated_float_extension , 1));
+ EXPECT_EQ(212 , message.GetExtension(unittest::repeated_double_extension , 1));
+ EXPECT_TRUE( message.GetExtension(unittest::repeated_bool_extension , 1));
+ EXPECT_EQ("215", message.GetExtension(unittest::repeated_string_extension , 1));
+ EXPECT_EQ("216", message.GetExtension(unittest::repeated_bytes_extension , 1));
+
+ EXPECT_EQ(217, message.GetExtension(unittest::repeatedgroup_extension , 1).a());
+ EXPECT_EQ(218, message.GetExtension(unittest::repeated_nested_message_extension , 1).bb());
+ EXPECT_EQ(219, message.GetExtension(unittest::repeated_foreign_message_extension, 1).c());
+ EXPECT_EQ(220, message.GetExtension(unittest::repeated_import_message_extension , 1).d());
+ EXPECT_EQ(227, message.GetExtension(unittest::repeated_lazy_message_extension , 1).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAR, message.GetExtension(unittest::repeated_nested_enum_extension , 1));
+ EXPECT_EQ(unittest::FOREIGN_BAR , message.GetExtension(unittest::repeated_foreign_enum_extension, 1));
+ EXPECT_EQ(unittest_import::IMPORT_BAR, message.GetExtension(unittest::repeated_import_enum_extension , 1));
+
+ EXPECT_EQ("224", message.GetExtension(unittest::repeated_string_piece_extension, 1));
+ EXPECT_EQ("225", message.GetExtension(unittest::repeated_cord_extension, 1));
+
+ EXPECT_EQ(301 , message.GetExtension(unittest::repeated_int32_extension , 0));
+ EXPECT_EQ(302 , message.GetExtension(unittest::repeated_int64_extension , 0));
+ EXPECT_EQ(303 , message.GetExtension(unittest::repeated_uint32_extension , 0));
+ EXPECT_EQ(304 , message.GetExtension(unittest::repeated_uint64_extension , 0));
+ EXPECT_EQ(305 , message.GetExtension(unittest::repeated_sint32_extension , 0));
+ EXPECT_EQ(306 , message.GetExtension(unittest::repeated_sint64_extension , 0));
+ EXPECT_EQ(307 , message.GetExtension(unittest::repeated_fixed32_extension , 0));
+ EXPECT_EQ(308 , message.GetExtension(unittest::repeated_fixed64_extension , 0));
+ EXPECT_EQ(309 , message.GetExtension(unittest::repeated_sfixed32_extension, 0));
+ EXPECT_EQ(310 , message.GetExtension(unittest::repeated_sfixed64_extension, 0));
+ EXPECT_EQ(311 , message.GetExtension(unittest::repeated_float_extension , 0));
+ EXPECT_EQ(312 , message.GetExtension(unittest::repeated_double_extension , 0));
+ EXPECT_FALSE( message.GetExtension(unittest::repeated_bool_extension , 0));
+ EXPECT_EQ("315", message.GetExtension(unittest::repeated_string_extension , 0));
+ EXPECT_EQ("316", message.GetExtension(unittest::repeated_bytes_extension , 0));
+
+ EXPECT_EQ(317, message.GetExtension(unittest::repeatedgroup_extension , 0).a());
+ EXPECT_EQ(318, message.GetExtension(unittest::repeated_nested_message_extension , 0).bb());
+ EXPECT_EQ(319, message.GetExtension(unittest::repeated_foreign_message_extension, 0).c());
+ EXPECT_EQ(320, message.GetExtension(unittest::repeated_import_message_extension , 0).d());
+ EXPECT_EQ(327, message.GetExtension(unittest::repeated_lazy_message_extension , 0).bb());
+
+ EXPECT_EQ(unittest::TestAllTypes::BAZ, message.GetExtension(unittest::repeated_nested_enum_extension , 0));
+ EXPECT_EQ(unittest::FOREIGN_BAZ , message.GetExtension(unittest::repeated_foreign_enum_extension, 0));
+ EXPECT_EQ(unittest_import::IMPORT_BAZ, message.GetExtension(unittest::repeated_import_enum_extension , 0));
+
+ EXPECT_EQ("324", message.GetExtension(unittest::repeated_string_piece_extension, 0));
+ EXPECT_EQ("325", message.GetExtension(unittest::repeated_cord_extension, 0));
+}
+
+void TestUtil::SetOneof1(unittest::TestOneof2* message) {
+ message->mutable_foo_lazy_message()->set_qux_int(100);
+ message->set_bar_string("101");
+ message->set_baz_int(102);
+ message->set_baz_string("103");
+}
+
+void TestUtil::SetOneof2(unittest::TestOneof2* message) {
+ message->set_foo_int(200);
+ message->set_bar_enum(unittest::TestOneof2::BAZ);
+ message->set_baz_int(202);
+ message->set_baz_string("203");
+}
+
+void TestUtil::ExpectOneofSet1(const unittest::TestOneof2& message) {
+ ExpectAtMostOneFieldSetInOneof(message);
+
+ EXPECT_TRUE(message.has_foo_lazy_message ());
+ EXPECT_TRUE(message.foo_lazy_message().has_qux_int());
+
+ EXPECT_TRUE(message.has_bar_string());
+ EXPECT_TRUE(message.has_baz_int ());
+ EXPECT_TRUE(message.has_baz_string());
+
+ ASSERT_EQ(0, message.foo_lazy_message().corge_int_size());
+
+ EXPECT_EQ(100 , message.foo_lazy_message().qux_int());
+ EXPECT_EQ("101", message.bar_string ());
+ EXPECT_EQ(102 , message.baz_int ());
+ EXPECT_EQ("103", message.baz_string ());
+}
+
+void TestUtil::ExpectOneofSet2(const unittest::TestOneof2& message) {
+ ExpectAtMostOneFieldSetInOneof(message);
+
+ EXPECT_TRUE(message.has_foo_int ());
+ EXPECT_TRUE(message.has_bar_enum ());
+ EXPECT_TRUE(message.has_baz_int ());
+ EXPECT_TRUE(message.has_baz_string());
+
+ EXPECT_EQ(200 , message.foo_int ());
+ EXPECT_EQ(unittest::TestOneof2::BAZ, message.bar_enum ());
+ EXPECT_EQ(202 , message.baz_int ());
+ EXPECT_EQ("203" , message.baz_string());
+}
+
+void TestUtil::ExpectOneofClear(const unittest::TestOneof2& message) {
+ EXPECT_FALSE(message.has_foo_int());
+ EXPECT_FALSE(message.has_foo_string());
+ EXPECT_FALSE(message.has_foo_bytes());
+ EXPECT_FALSE(message.has_foo_enum());
+ EXPECT_FALSE(message.has_foo_message());
+ EXPECT_FALSE(message.has_foogroup());
+ EXPECT_FALSE(message.has_foo_lazy_message());
+
+ EXPECT_FALSE(message.has_bar_int());
+ EXPECT_FALSE(message.has_bar_string());
+ EXPECT_FALSE(message.has_bar_bytes());
+ EXPECT_FALSE(message.has_bar_enum());
+
+ EXPECT_FALSE(message.has_baz_int());
+ EXPECT_FALSE(message.has_baz_string());
+
+ EXPECT_EQ(unittest::TestOneof2::FOO_NOT_SET, message.foo_case());
+ EXPECT_EQ(unittest::TestOneof2::BAR_NOT_SET, message.bar_case());
+}
+
+void TestUtil::ExpectAtMostOneFieldSetInOneof(
+ const unittest::TestOneof2& message) {
+ int count = 0;
+ if (message.has_foo_int()) count++;
+ if (message.has_foo_string()) count++;
+ if (message.has_foo_bytes()) count++;
+ if (message.has_foo_enum()) count++;
+ if (message.has_foo_message()) count++;
+ if (message.has_foogroup()) count++;
+ if (message.has_foo_lazy_message()) count++;
+ EXPECT_LE(count, 1);
+ count = 0;
+ if (message.has_bar_int()) count++;
+ if (message.has_bar_string()) count++;
+ if (message.has_bar_bytes()) count++;
+ if (message.has_bar_enum()) count++;
+ EXPECT_TRUE(count == 0 || count == 1);
+}
+
+// ===================================================================
+
+TestUtil::ReflectionTester::ReflectionTester(
+ const Descriptor* base_descriptor)
+ : base_descriptor_(base_descriptor) {
+
+ const DescriptorPool* pool = base_descriptor->file()->pool();
+
+ nested_b_ =
+ pool->FindFieldByName("protobuf_unittest.TestAllTypes.NestedMessage.bb");
+ foreign_c_ =
+ pool->FindFieldByName("protobuf_unittest.ForeignMessage.c");
+ import_d_ =
+ pool->FindFieldByName("protobuf_unittest_import.ImportMessage.d");
+ import_e_ =
+ pool->FindFieldByName("protobuf_unittest_import.PublicImportMessage.e");
+ nested_foo_ =
+ pool->FindEnumValueByName("protobuf_unittest.TestAllTypes.FOO");
+ nested_bar_ =
+ pool->FindEnumValueByName("protobuf_unittest.TestAllTypes.BAR");
+ nested_baz_ =
+ pool->FindEnumValueByName("protobuf_unittest.TestAllTypes.BAZ");
+ foreign_foo_ =
+ pool->FindEnumValueByName("protobuf_unittest.FOREIGN_FOO");
+ foreign_bar_ =
+ pool->FindEnumValueByName("protobuf_unittest.FOREIGN_BAR");
+ foreign_baz_ =
+ pool->FindEnumValueByName("protobuf_unittest.FOREIGN_BAZ");
+ import_foo_ =
+ pool->FindEnumValueByName("protobuf_unittest_import.IMPORT_FOO");
+ import_bar_ =
+ pool->FindEnumValueByName("protobuf_unittest_import.IMPORT_BAR");
+ import_baz_ =
+ pool->FindEnumValueByName("protobuf_unittest_import.IMPORT_BAZ");
+
+ if (base_descriptor_->name() == "TestAllExtensions") {
+ group_a_ =
+ pool->FindFieldByName("protobuf_unittest.OptionalGroup_extension.a");
+ repeated_group_a_ =
+ pool->FindFieldByName("protobuf_unittest.RepeatedGroup_extension.a");
+ } else {
+ group_a_ =
+ pool->FindFieldByName("protobuf_unittest.TestAllTypes.OptionalGroup.a");
+ repeated_group_a_ =
+ pool->FindFieldByName("protobuf_unittest.TestAllTypes.RepeatedGroup.a");
+ }
+
+ EXPECT_TRUE(group_a_ != NULL);
+ EXPECT_TRUE(repeated_group_a_ != NULL);
+ EXPECT_TRUE(nested_b_ != NULL);
+ EXPECT_TRUE(foreign_c_ != NULL);
+ EXPECT_TRUE(import_d_ != NULL);
+ EXPECT_TRUE(import_e_ != NULL);
+ EXPECT_TRUE(nested_foo_ != NULL);
+ EXPECT_TRUE(nested_bar_ != NULL);
+ EXPECT_TRUE(nested_baz_ != NULL);
+ EXPECT_TRUE(foreign_foo_ != NULL);
+ EXPECT_TRUE(foreign_bar_ != NULL);
+ EXPECT_TRUE(foreign_baz_ != NULL);
+ EXPECT_TRUE(import_foo_ != NULL);
+ EXPECT_TRUE(import_bar_ != NULL);
+ EXPECT_TRUE(import_baz_ != NULL);
+}
+
+// Shorthand to get a FieldDescriptor for a field of unittest::TestAllTypes.
+const FieldDescriptor* TestUtil::ReflectionTester::F(const string& name) {
+ const FieldDescriptor* result = NULL;
+ if (base_descriptor_->name() == "TestAllExtensions" ||
+ base_descriptor_->name() == "TestPackedExtensions") {
+ result = base_descriptor_->file()->FindExtensionByName(name + "_extension");
+ } else {
+ result = base_descriptor_->FindFieldByName(name);
+ }
+ GOOGLE_CHECK(result != NULL);
+ return result;
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ReflectionTester::SetAllFieldsViaReflection(Message* message) {
+ const Reflection* reflection = message->GetReflection();
+ Message* sub_message;
+
+ reflection->SetInt32 (message, F("optional_int32" ), 101);
+ reflection->SetInt64 (message, F("optional_int64" ), 102);
+ reflection->SetUInt32(message, F("optional_uint32" ), 103);
+ reflection->SetUInt64(message, F("optional_uint64" ), 104);
+ reflection->SetInt32 (message, F("optional_sint32" ), 105);
+ reflection->SetInt64 (message, F("optional_sint64" ), 106);
+ reflection->SetUInt32(message, F("optional_fixed32" ), 107);
+ reflection->SetUInt64(message, F("optional_fixed64" ), 108);
+ reflection->SetInt32 (message, F("optional_sfixed32"), 109);
+ reflection->SetInt64 (message, F("optional_sfixed64"), 110);
+ reflection->SetFloat (message, F("optional_float" ), 111);
+ reflection->SetDouble(message, F("optional_double" ), 112);
+ reflection->SetBool (message, F("optional_bool" ), true);
+ reflection->SetString(message, F("optional_string" ), "115");
+ reflection->SetString(message, F("optional_bytes" ), "116");
+
+ sub_message = reflection->MutableMessage(message, F("optionalgroup"));
+ sub_message->GetReflection()->SetInt32(sub_message, group_a_, 117);
+ sub_message = reflection->MutableMessage(message, F("optional_nested_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 118);
+ sub_message = reflection->MutableMessage(message, F("optional_foreign_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, foreign_c_, 119);
+ sub_message = reflection->MutableMessage(message, F("optional_import_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, import_d_, 120);
+
+ reflection->SetEnum(message, F("optional_nested_enum" ), nested_baz_);
+ reflection->SetEnum(message, F("optional_foreign_enum"), foreign_baz_);
+ reflection->SetEnum(message, F("optional_import_enum" ), import_baz_);
+
+ reflection->SetString(message, F("optional_string_piece"), "124");
+ reflection->SetString(message, F("optional_cord"), "125");
+
+ sub_message = reflection->MutableMessage(message, F("optional_public_import_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, import_e_, 126);
+
+ sub_message = reflection->MutableMessage(message, F("optional_lazy_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 127);
+
+ // -----------------------------------------------------------------
+
+ reflection->AddInt32 (message, F("repeated_int32" ), 201);
+ reflection->AddInt64 (message, F("repeated_int64" ), 202);
+ reflection->AddUInt32(message, F("repeated_uint32" ), 203);
+ reflection->AddUInt64(message, F("repeated_uint64" ), 204);
+ reflection->AddInt32 (message, F("repeated_sint32" ), 205);
+ reflection->AddInt64 (message, F("repeated_sint64" ), 206);
+ reflection->AddUInt32(message, F("repeated_fixed32" ), 207);
+ reflection->AddUInt64(message, F("repeated_fixed64" ), 208);
+ reflection->AddInt32 (message, F("repeated_sfixed32"), 209);
+ reflection->AddInt64 (message, F("repeated_sfixed64"), 210);
+ reflection->AddFloat (message, F("repeated_float" ), 211);
+ reflection->AddDouble(message, F("repeated_double" ), 212);
+ reflection->AddBool (message, F("repeated_bool" ), true);
+ reflection->AddString(message, F("repeated_string" ), "215");
+ reflection->AddString(message, F("repeated_bytes" ), "216");
+
+ sub_message = reflection->AddMessage(message, F("repeatedgroup"));
+ sub_message->GetReflection()->SetInt32(sub_message, repeated_group_a_, 217);
+ sub_message = reflection->AddMessage(message, F("repeated_nested_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 218);
+ sub_message = reflection->AddMessage(message, F("repeated_foreign_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, foreign_c_, 219);
+ sub_message = reflection->AddMessage(message, F("repeated_import_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, import_d_, 220);
+ sub_message = reflection->AddMessage(message, F("repeated_lazy_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 227);
+
+ reflection->AddEnum(message, F("repeated_nested_enum" ), nested_bar_);
+ reflection->AddEnum(message, F("repeated_foreign_enum"), foreign_bar_);
+ reflection->AddEnum(message, F("repeated_import_enum" ), import_bar_);
+
+ reflection->AddString(message, F("repeated_string_piece"), "224");
+ reflection->AddString(message, F("repeated_cord"), "225");
+
+ // Add a second one of each field.
+ reflection->AddInt32 (message, F("repeated_int32" ), 301);
+ reflection->AddInt64 (message, F("repeated_int64" ), 302);
+ reflection->AddUInt32(message, F("repeated_uint32" ), 303);
+ reflection->AddUInt64(message, F("repeated_uint64" ), 304);
+ reflection->AddInt32 (message, F("repeated_sint32" ), 305);
+ reflection->AddInt64 (message, F("repeated_sint64" ), 306);
+ reflection->AddUInt32(message, F("repeated_fixed32" ), 307);
+ reflection->AddUInt64(message, F("repeated_fixed64" ), 308);
+ reflection->AddInt32 (message, F("repeated_sfixed32"), 309);
+ reflection->AddInt64 (message, F("repeated_sfixed64"), 310);
+ reflection->AddFloat (message, F("repeated_float" ), 311);
+ reflection->AddDouble(message, F("repeated_double" ), 312);
+ reflection->AddBool (message, F("repeated_bool" ), false);
+ reflection->AddString(message, F("repeated_string" ), "315");
+ reflection->AddString(message, F("repeated_bytes" ), "316");
+
+ sub_message = reflection->AddMessage(message, F("repeatedgroup"));
+ sub_message->GetReflection()->SetInt32(sub_message, repeated_group_a_, 317);
+ sub_message = reflection->AddMessage(message, F("repeated_nested_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 318);
+ sub_message = reflection->AddMessage(message, F("repeated_foreign_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, foreign_c_, 319);
+ sub_message = reflection->AddMessage(message, F("repeated_import_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, import_d_, 320);
+ sub_message = reflection->AddMessage(message, F("repeated_lazy_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 327);
+
+ reflection->AddEnum(message, F("repeated_nested_enum" ), nested_baz_);
+ reflection->AddEnum(message, F("repeated_foreign_enum"), foreign_baz_);
+ reflection->AddEnum(message, F("repeated_import_enum" ), import_baz_);
+
+ reflection->AddString(message, F("repeated_string_piece"), "324");
+ reflection->AddString(message, F("repeated_cord"), "325");
+
+ // -----------------------------------------------------------------
+
+ reflection->SetInt32 (message, F("default_int32" ), 401);
+ reflection->SetInt64 (message, F("default_int64" ), 402);
+ reflection->SetUInt32(message, F("default_uint32" ), 403);
+ reflection->SetUInt64(message, F("default_uint64" ), 404);
+ reflection->SetInt32 (message, F("default_sint32" ), 405);
+ reflection->SetInt64 (message, F("default_sint64" ), 406);
+ reflection->SetUInt32(message, F("default_fixed32" ), 407);
+ reflection->SetUInt64(message, F("default_fixed64" ), 408);
+ reflection->SetInt32 (message, F("default_sfixed32"), 409);
+ reflection->SetInt64 (message, F("default_sfixed64"), 410);
+ reflection->SetFloat (message, F("default_float" ), 411);
+ reflection->SetDouble(message, F("default_double" ), 412);
+ reflection->SetBool (message, F("default_bool" ), false);
+ reflection->SetString(message, F("default_string" ), "415");
+ reflection->SetString(message, F("default_bytes" ), "416");
+
+ reflection->SetEnum(message, F("default_nested_enum" ), nested_foo_);
+ reflection->SetEnum(message, F("default_foreign_enum"), foreign_foo_);
+ reflection->SetEnum(message, F("default_import_enum" ), import_foo_);
+
+ reflection->SetString(message, F("default_string_piece"), "424");
+ reflection->SetString(message, F("default_cord"), "425");
+
+ reflection->SetUInt32(message, F("oneof_uint32" ), 601);
+ sub_message = reflection->MutableMessage(message, F("oneof_nested_message"));
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 602);
+ reflection->SetString(message, F("oneof_string"), "603");
+ reflection->SetString(message, F("oneof_bytes" ), "604");
+}
+
+void TestUtil::ReflectionTester::SetOneofViaReflection(Message* message) {
+ const Descriptor* descriptor = message->GetDescriptor();
+ const Reflection* reflection = message->GetReflection();
+ Message* sub_message = reflection->MutableMessage(
+ message, descriptor->FindFieldByName("foo_lazy_message"));
+ sub_message->GetReflection()->SetInt64(
+ sub_message,
+ descriptor->file()->pool()->FindFieldByName(
+ "protobuf_unittest.TestOneof2.NestedMessage.qux_int"),
+ 100);
+
+ reflection->SetString(message,
+ descriptor->FindFieldByName("bar_cord"),
+ "101");
+ reflection->SetInt32(message,
+ descriptor->FindFieldByName("baz_int"),
+ 102);
+ reflection->SetString(message,
+ descriptor->FindFieldByName("baz_string"),
+ "103");
+}
+
+void TestUtil::ReflectionTester::ExpectOneofSetViaReflection(
+ const Message& message) {
+ const Descriptor* descriptor = message.GetDescriptor();
+ const Reflection* reflection = message.GetReflection();
+ string scratch;
+ EXPECT_TRUE(reflection->HasField(
+ message, descriptor->FindFieldByName("foo_lazy_message")));
+ EXPECT_TRUE(reflection->HasField(
+ message, descriptor->FindFieldByName("bar_cord")));
+ EXPECT_TRUE(reflection->HasField(
+ message, descriptor->FindFieldByName("baz_int")));
+ EXPECT_TRUE(reflection->HasField(
+ message, descriptor->FindFieldByName("baz_string")));
+
+ const Message* sub_message = &reflection->GetMessage(
+ message, descriptor->FindFieldByName("foo_lazy_message"));
+ EXPECT_EQ(100, sub_message->GetReflection()->GetInt64(
+ *sub_message,
+ descriptor->file()->pool()->FindFieldByName(
+ "protobuf_unittest.TestOneof2.NestedMessage.qux_int")));
+
+ EXPECT_EQ("101", reflection->GetString(
+ message, descriptor->FindFieldByName("bar_cord")));
+ EXPECT_EQ("101", reflection->GetStringReference(
+ message, descriptor->FindFieldByName("bar_cord"), &scratch));
+
+ EXPECT_EQ(102, reflection->GetInt32(
+ message, descriptor->FindFieldByName("baz_int")));
+
+ EXPECT_EQ("103", reflection->GetString(
+ message, descriptor->FindFieldByName("baz_string")));
+ EXPECT_EQ("103", reflection->GetStringReference(
+ message, descriptor->FindFieldByName("baz_string"), &scratch));
+}
+
+void TestUtil::ReflectionTester::SetPackedFieldsViaReflection(
+ Message* message) {
+ const Reflection* reflection = message->GetReflection();
+ reflection->AddInt32 (message, F("packed_int32" ), 601);
+ reflection->AddInt64 (message, F("packed_int64" ), 602);
+ reflection->AddUInt32(message, F("packed_uint32" ), 603);
+ reflection->AddUInt64(message, F("packed_uint64" ), 604);
+ reflection->AddInt32 (message, F("packed_sint32" ), 605);
+ reflection->AddInt64 (message, F("packed_sint64" ), 606);
+ reflection->AddUInt32(message, F("packed_fixed32" ), 607);
+ reflection->AddUInt64(message, F("packed_fixed64" ), 608);
+ reflection->AddInt32 (message, F("packed_sfixed32"), 609);
+ reflection->AddInt64 (message, F("packed_sfixed64"), 610);
+ reflection->AddFloat (message, F("packed_float" ), 611);
+ reflection->AddDouble(message, F("packed_double" ), 612);
+ reflection->AddBool (message, F("packed_bool" ), true);
+ reflection->AddEnum (message, F("packed_enum" ), foreign_bar_);
+
+ reflection->AddInt32 (message, F("packed_int32" ), 701);
+ reflection->AddInt64 (message, F("packed_int64" ), 702);
+ reflection->AddUInt32(message, F("packed_uint32" ), 703);
+ reflection->AddUInt64(message, F("packed_uint64" ), 704);
+ reflection->AddInt32 (message, F("packed_sint32" ), 705);
+ reflection->AddInt64 (message, F("packed_sint64" ), 706);
+ reflection->AddUInt32(message, F("packed_fixed32" ), 707);
+ reflection->AddUInt64(message, F("packed_fixed64" ), 708);
+ reflection->AddInt32 (message, F("packed_sfixed32"), 709);
+ reflection->AddInt64 (message, F("packed_sfixed64"), 710);
+ reflection->AddFloat (message, F("packed_float" ), 711);
+ reflection->AddDouble(message, F("packed_double" ), 712);
+ reflection->AddBool (message, F("packed_bool" ), false);
+ reflection->AddEnum (message, F("packed_enum" ), foreign_baz_);
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ReflectionTester::ExpectAllFieldsSetViaReflection(
+ const Message& message) {
+ // We have to split this into three function otherwise it creates a stack
+ // frame so large that it triggers a warning.
+ ExpectAllFieldsSetViaReflection1(message);
+ ExpectAllFieldsSetViaReflection2(message);
+ ExpectAllFieldsSetViaReflection3(message);
+}
+
+void TestUtil::ReflectionTester::ExpectAllFieldsSetViaReflection1(
+ const Message& message) {
+ const Reflection* reflection = message.GetReflection();
+ string scratch;
+ const Message* sub_message;
+
+ EXPECT_TRUE(reflection->HasField(message, F("optional_int32" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_int64" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_uint32" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_uint64" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_sint32" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_sint64" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_fixed32" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_fixed64" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_sfixed32")));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_sfixed64")));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_float" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_double" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_bool" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_string" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_bytes" )));
+
+ EXPECT_TRUE(reflection->HasField(message, F("optionalgroup" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_nested_message" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_foreign_message" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_import_message" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_public_import_message")));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_lazy_message" )));
+
+ sub_message = &reflection->GetMessage(message, F("optionalgroup"));
+ EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, group_a_));
+ sub_message = &reflection->GetMessage(message, F("optional_nested_message"));
+ EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, nested_b_));
+ sub_message = &reflection->GetMessage(message, F("optional_foreign_message"));
+ EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, foreign_c_));
+ sub_message = &reflection->GetMessage(message, F("optional_import_message"));
+ EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, import_d_));
+ sub_message = &reflection->GetMessage(message, F("optional_public_import_message"));
+ EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, import_e_));
+ sub_message = &reflection->GetMessage(message, F("optional_lazy_message"));
+ EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, nested_b_));
+
+ EXPECT_TRUE(reflection->HasField(message, F("optional_nested_enum" )));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_foreign_enum")));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_import_enum" )));
+
+ EXPECT_TRUE(reflection->HasField(message, F("optional_string_piece")));
+ EXPECT_TRUE(reflection->HasField(message, F("optional_cord")));
+
+ EXPECT_EQ(101 , reflection->GetInt32 (message, F("optional_int32" )));
+ EXPECT_EQ(102 , reflection->GetInt64 (message, F("optional_int64" )));
+ EXPECT_EQ(103 , reflection->GetUInt32(message, F("optional_uint32" )));
+ EXPECT_EQ(104 , reflection->GetUInt64(message, F("optional_uint64" )));
+ EXPECT_EQ(105 , reflection->GetInt32 (message, F("optional_sint32" )));
+ EXPECT_EQ(106 , reflection->GetInt64 (message, F("optional_sint64" )));
+ EXPECT_EQ(107 , reflection->GetUInt32(message, F("optional_fixed32" )));
+ EXPECT_EQ(108 , reflection->GetUInt64(message, F("optional_fixed64" )));
+ EXPECT_EQ(109 , reflection->GetInt32 (message, F("optional_sfixed32")));
+ EXPECT_EQ(110 , reflection->GetInt64 (message, F("optional_sfixed64")));
+ EXPECT_EQ(111 , reflection->GetFloat (message, F("optional_float" )));
+ EXPECT_EQ(112 , reflection->GetDouble(message, F("optional_double" )));
+ EXPECT_TRUE( reflection->GetBool (message, F("optional_bool" )));
+ EXPECT_EQ("115", reflection->GetString(message, F("optional_string" )));
+ EXPECT_EQ("116", reflection->GetString(message, F("optional_bytes" )));
+
+ EXPECT_EQ("115", reflection->GetStringReference(message, F("optional_string"), &scratch));
+ EXPECT_EQ("116", reflection->GetStringReference(message, F("optional_bytes" ), &scratch));
+
+ sub_message = &reflection->GetMessage(message, F("optionalgroup"));
+ EXPECT_EQ(117, sub_message->GetReflection()->GetInt32(*sub_message, group_a_));
+ sub_message = &reflection->GetMessage(message, F("optional_nested_message"));
+ EXPECT_EQ(118, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+ sub_message = &reflection->GetMessage(message, F("optional_foreign_message"));
+ EXPECT_EQ(119, sub_message->GetReflection()->GetInt32(*sub_message, foreign_c_));
+ sub_message = &reflection->GetMessage(message, F("optional_import_message"));
+ EXPECT_EQ(120, sub_message->GetReflection()->GetInt32(*sub_message, import_d_));
+ sub_message = &reflection->GetMessage(message, F("optional_public_import_message"));
+ EXPECT_EQ(126, sub_message->GetReflection()->GetInt32(*sub_message, import_e_));
+ sub_message = &reflection->GetMessage(message, F("optional_lazy_message"));
+ EXPECT_EQ(127, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+
+ EXPECT_EQ( nested_baz_, reflection->GetEnum(message, F("optional_nested_enum" )));
+ EXPECT_EQ(foreign_baz_, reflection->GetEnum(message, F("optional_foreign_enum")));
+ EXPECT_EQ( import_baz_, reflection->GetEnum(message, F("optional_import_enum" )));
+
+ EXPECT_EQ("124", reflection->GetString(message, F("optional_string_piece")));
+ EXPECT_EQ("124", reflection->GetStringReference(message, F("optional_string_piece"), &scratch));
+
+ EXPECT_EQ("125", reflection->GetString(message, F("optional_cord")));
+ EXPECT_EQ("125", reflection->GetStringReference(message, F("optional_cord"), &scratch));
+
+ EXPECT_TRUE(reflection->HasField(message, F("oneof_bytes" )));
+ EXPECT_EQ("604", reflection->GetString(message, F("oneof_bytes" )));
+
+ if (base_descriptor_->name() == "TestAllTypes") {
+ EXPECT_FALSE(reflection->HasField(message, F("oneof_uint32")));
+ EXPECT_FALSE(reflection->HasField(message, F("oneof_string")));
+ } else {
+ EXPECT_TRUE(reflection->HasField(message, F("oneof_uint32")));
+ EXPECT_TRUE(reflection->HasField(message, F("oneof_string")));
+ EXPECT_EQ(601 , reflection->GetUInt32(message, F("oneof_uint32")));
+ EXPECT_EQ("603", reflection->GetString(message, F("oneof_string")));
+ sub_message = &reflection->GetMessage(message, F("oneof_nested_message"));
+ EXPECT_EQ(602, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+ }
+}
+
+void TestUtil::ReflectionTester::ExpectAllFieldsSetViaReflection2(
+ const Message& message) {
+ const Reflection* reflection = message.GetReflection();
+ string scratch;
+ const Message* sub_message;
+
+ // -----------------------------------------------------------------
+
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_int32" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_int64" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_uint32" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_uint64" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_sint32" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_sint64" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_fixed32" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_fixed64" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_sfixed32")));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_sfixed64")));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_float" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_double" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_bool" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_string" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_bytes" )));
+
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeatedgroup" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_nested_message" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_foreign_message")));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_import_message" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_lazy_message" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_nested_enum" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_foreign_enum" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_import_enum" )));
+
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_string_piece")));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_cord")));
+
+ EXPECT_EQ(201 , reflection->GetRepeatedInt32 (message, F("repeated_int32" ), 0));
+ EXPECT_EQ(202 , reflection->GetRepeatedInt64 (message, F("repeated_int64" ), 0));
+ EXPECT_EQ(203 , reflection->GetRepeatedUInt32(message, F("repeated_uint32" ), 0));
+ EXPECT_EQ(204 , reflection->GetRepeatedUInt64(message, F("repeated_uint64" ), 0));
+ EXPECT_EQ(205 , reflection->GetRepeatedInt32 (message, F("repeated_sint32" ), 0));
+ EXPECT_EQ(206 , reflection->GetRepeatedInt64 (message, F("repeated_sint64" ), 0));
+ EXPECT_EQ(207 , reflection->GetRepeatedUInt32(message, F("repeated_fixed32" ), 0));
+ EXPECT_EQ(208 , reflection->GetRepeatedUInt64(message, F("repeated_fixed64" ), 0));
+ EXPECT_EQ(209 , reflection->GetRepeatedInt32 (message, F("repeated_sfixed32"), 0));
+ EXPECT_EQ(210 , reflection->GetRepeatedInt64 (message, F("repeated_sfixed64"), 0));
+ EXPECT_EQ(211 , reflection->GetRepeatedFloat (message, F("repeated_float" ), 0));
+ EXPECT_EQ(212 , reflection->GetRepeatedDouble(message, F("repeated_double" ), 0));
+ EXPECT_TRUE( reflection->GetRepeatedBool (message, F("repeated_bool" ), 0));
+ EXPECT_EQ("215", reflection->GetRepeatedString(message, F("repeated_string" ), 0));
+ EXPECT_EQ("216", reflection->GetRepeatedString(message, F("repeated_bytes" ), 0));
+
+ EXPECT_EQ("215", reflection->GetRepeatedStringReference(message, F("repeated_string"), 0, &scratch));
+ EXPECT_EQ("216", reflection->GetRepeatedStringReference(message, F("repeated_bytes"), 0, &scratch));
+
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeatedgroup"), 0);
+ EXPECT_EQ(217, sub_message->GetReflection()->GetInt32(*sub_message, repeated_group_a_));
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeated_nested_message"), 0);
+ EXPECT_EQ(218, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeated_foreign_message"), 0);
+ EXPECT_EQ(219, sub_message->GetReflection()->GetInt32(*sub_message, foreign_c_));
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeated_import_message"), 0);
+ EXPECT_EQ(220, sub_message->GetReflection()->GetInt32(*sub_message, import_d_));
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeated_lazy_message"), 0);
+ EXPECT_EQ(227, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+
+ EXPECT_EQ( nested_bar_, reflection->GetRepeatedEnum(message, F("repeated_nested_enum" ),0));
+ EXPECT_EQ(foreign_bar_, reflection->GetRepeatedEnum(message, F("repeated_foreign_enum"),0));
+ EXPECT_EQ( import_bar_, reflection->GetRepeatedEnum(message, F("repeated_import_enum" ),0));
+
+ EXPECT_EQ("224", reflection->GetRepeatedString(message, F("repeated_string_piece"), 0));
+ EXPECT_EQ("224", reflection->GetRepeatedStringReference(
+ message, F("repeated_string_piece"), 0, &scratch));
+
+ EXPECT_EQ("225", reflection->GetRepeatedString(message, F("repeated_cord"), 0));
+ EXPECT_EQ("225", reflection->GetRepeatedStringReference(
+ message, F("repeated_cord"), 0, &scratch));
+
+ EXPECT_EQ(301 , reflection->GetRepeatedInt32 (message, F("repeated_int32" ), 1));
+ EXPECT_EQ(302 , reflection->GetRepeatedInt64 (message, F("repeated_int64" ), 1));
+ EXPECT_EQ(303 , reflection->GetRepeatedUInt32(message, F("repeated_uint32" ), 1));
+ EXPECT_EQ(304 , reflection->GetRepeatedUInt64(message, F("repeated_uint64" ), 1));
+ EXPECT_EQ(305 , reflection->GetRepeatedInt32 (message, F("repeated_sint32" ), 1));
+ EXPECT_EQ(306 , reflection->GetRepeatedInt64 (message, F("repeated_sint64" ), 1));
+ EXPECT_EQ(307 , reflection->GetRepeatedUInt32(message, F("repeated_fixed32" ), 1));
+ EXPECT_EQ(308 , reflection->GetRepeatedUInt64(message, F("repeated_fixed64" ), 1));
+ EXPECT_EQ(309 , reflection->GetRepeatedInt32 (message, F("repeated_sfixed32"), 1));
+ EXPECT_EQ(310 , reflection->GetRepeatedInt64 (message, F("repeated_sfixed64"), 1));
+ EXPECT_EQ(311 , reflection->GetRepeatedFloat (message, F("repeated_float" ), 1));
+ EXPECT_EQ(312 , reflection->GetRepeatedDouble(message, F("repeated_double" ), 1));
+ EXPECT_FALSE( reflection->GetRepeatedBool (message, F("repeated_bool" ), 1));
+ EXPECT_EQ("315", reflection->GetRepeatedString(message, F("repeated_string" ), 1));
+ EXPECT_EQ("316", reflection->GetRepeatedString(message, F("repeated_bytes" ), 1));
+
+ EXPECT_EQ("315", reflection->GetRepeatedStringReference(message, F("repeated_string"),
+ 1, &scratch));
+ EXPECT_EQ("316", reflection->GetRepeatedStringReference(message, F("repeated_bytes"),
+ 1, &scratch));
+
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeatedgroup"), 1);
+ EXPECT_EQ(317, sub_message->GetReflection()->GetInt32(*sub_message, repeated_group_a_));
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeated_nested_message"), 1);
+ EXPECT_EQ(318, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeated_foreign_message"), 1);
+ EXPECT_EQ(319, sub_message->GetReflection()->GetInt32(*sub_message, foreign_c_));
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeated_import_message"), 1);
+ EXPECT_EQ(320, sub_message->GetReflection()->GetInt32(*sub_message, import_d_));
+ sub_message = &reflection->GetRepeatedMessage(message, F("repeated_lazy_message"), 1);
+ EXPECT_EQ(327, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+
+ EXPECT_EQ( nested_baz_, reflection->GetRepeatedEnum(message, F("repeated_nested_enum" ),1));
+ EXPECT_EQ(foreign_baz_, reflection->GetRepeatedEnum(message, F("repeated_foreign_enum"),1));
+ EXPECT_EQ( import_baz_, reflection->GetRepeatedEnum(message, F("repeated_import_enum" ),1));
+
+ EXPECT_EQ("324", reflection->GetRepeatedString(message, F("repeated_string_piece"), 1));
+ EXPECT_EQ("324", reflection->GetRepeatedStringReference(
+ message, F("repeated_string_piece"), 1, &scratch));
+
+ EXPECT_EQ("325", reflection->GetRepeatedString(message, F("repeated_cord"), 1));
+ EXPECT_EQ("325", reflection->GetRepeatedStringReference(
+ message, F("repeated_cord"), 1, &scratch));
+}
+
+void TestUtil::ReflectionTester::ExpectAllFieldsSetViaReflection3(
+ const Message& message) {
+ const Reflection* reflection = message.GetReflection();
+ string scratch;
+
+ // -----------------------------------------------------------------
+
+ EXPECT_TRUE(reflection->HasField(message, F("default_int32" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_int64" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_uint32" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_uint64" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_sint32" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_sint64" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_fixed32" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_fixed64" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_sfixed32")));
+ EXPECT_TRUE(reflection->HasField(message, F("default_sfixed64")));
+ EXPECT_TRUE(reflection->HasField(message, F("default_float" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_double" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_bool" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_string" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_bytes" )));
+
+ EXPECT_TRUE(reflection->HasField(message, F("default_nested_enum" )));
+ EXPECT_TRUE(reflection->HasField(message, F("default_foreign_enum")));
+ EXPECT_TRUE(reflection->HasField(message, F("default_import_enum" )));
+
+ EXPECT_TRUE(reflection->HasField(message, F("default_string_piece")));
+ EXPECT_TRUE(reflection->HasField(message, F("default_cord")));
+
+ EXPECT_EQ(401 , reflection->GetInt32 (message, F("default_int32" )));
+ EXPECT_EQ(402 , reflection->GetInt64 (message, F("default_int64" )));
+ EXPECT_EQ(403 , reflection->GetUInt32(message, F("default_uint32" )));
+ EXPECT_EQ(404 , reflection->GetUInt64(message, F("default_uint64" )));
+ EXPECT_EQ(405 , reflection->GetInt32 (message, F("default_sint32" )));
+ EXPECT_EQ(406 , reflection->GetInt64 (message, F("default_sint64" )));
+ EXPECT_EQ(407 , reflection->GetUInt32(message, F("default_fixed32" )));
+ EXPECT_EQ(408 , reflection->GetUInt64(message, F("default_fixed64" )));
+ EXPECT_EQ(409 , reflection->GetInt32 (message, F("default_sfixed32")));
+ EXPECT_EQ(410 , reflection->GetInt64 (message, F("default_sfixed64")));
+ EXPECT_EQ(411 , reflection->GetFloat (message, F("default_float" )));
+ EXPECT_EQ(412 , reflection->GetDouble(message, F("default_double" )));
+ EXPECT_FALSE( reflection->GetBool (message, F("default_bool" )));
+ EXPECT_EQ("415", reflection->GetString(message, F("default_string" )));
+ EXPECT_EQ("416", reflection->GetString(message, F("default_bytes" )));
+
+ EXPECT_EQ("415", reflection->GetStringReference(message, F("default_string"), &scratch));
+ EXPECT_EQ("416", reflection->GetStringReference(message, F("default_bytes" ), &scratch));
+
+ EXPECT_EQ( nested_foo_, reflection->GetEnum(message, F("default_nested_enum" )));
+ EXPECT_EQ(foreign_foo_, reflection->GetEnum(message, F("default_foreign_enum")));
+ EXPECT_EQ( import_foo_, reflection->GetEnum(message, F("default_import_enum" )));
+
+ EXPECT_EQ("424", reflection->GetString(message, F("default_string_piece")));
+ EXPECT_EQ("424", reflection->GetStringReference(message, F("default_string_piece"),
+ &scratch));
+
+ EXPECT_EQ("425", reflection->GetString(message, F("default_cord")));
+ EXPECT_EQ("425", reflection->GetStringReference(message, F("default_cord"), &scratch));
+}
+
+void TestUtil::ReflectionTester::ExpectPackedFieldsSetViaReflection(
+ const Message& message) {
+ const Reflection* reflection = message.GetReflection();
+
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_int32" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_int64" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_uint32" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_uint64" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_sint32" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_sint64" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_fixed32" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_fixed64" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_sfixed32")));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_sfixed64")));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_float" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_double" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_bool" )));
+ ASSERT_EQ(2, reflection->FieldSize(message, F("packed_enum" )));
+
+ EXPECT_EQ(601 , reflection->GetRepeatedInt32 (message, F("packed_int32" ), 0));
+ EXPECT_EQ(602 , reflection->GetRepeatedInt64 (message, F("packed_int64" ), 0));
+ EXPECT_EQ(603 , reflection->GetRepeatedUInt32(message, F("packed_uint32" ), 0));
+ EXPECT_EQ(604 , reflection->GetRepeatedUInt64(message, F("packed_uint64" ), 0));
+ EXPECT_EQ(605 , reflection->GetRepeatedInt32 (message, F("packed_sint32" ), 0));
+ EXPECT_EQ(606 , reflection->GetRepeatedInt64 (message, F("packed_sint64" ), 0));
+ EXPECT_EQ(607 , reflection->GetRepeatedUInt32(message, F("packed_fixed32" ), 0));
+ EXPECT_EQ(608 , reflection->GetRepeatedUInt64(message, F("packed_fixed64" ), 0));
+ EXPECT_EQ(609 , reflection->GetRepeatedInt32 (message, F("packed_sfixed32"), 0));
+ EXPECT_EQ(610 , reflection->GetRepeatedInt64 (message, F("packed_sfixed64"), 0));
+ EXPECT_EQ(611 , reflection->GetRepeatedFloat (message, F("packed_float" ), 0));
+ EXPECT_EQ(612 , reflection->GetRepeatedDouble(message, F("packed_double" ), 0));
+ EXPECT_TRUE( reflection->GetRepeatedBool (message, F("packed_bool" ), 0));
+ EXPECT_EQ(foreign_bar_,
+ reflection->GetRepeatedEnum(message, F("packed_enum"), 0));
+
+ EXPECT_EQ(701 , reflection->GetRepeatedInt32 (message, F("packed_int32" ), 1));
+ EXPECT_EQ(702 , reflection->GetRepeatedInt64 (message, F("packed_int64" ), 1));
+ EXPECT_EQ(703 , reflection->GetRepeatedUInt32(message, F("packed_uint32" ), 1));
+ EXPECT_EQ(704 , reflection->GetRepeatedUInt64(message, F("packed_uint64" ), 1));
+ EXPECT_EQ(705 , reflection->GetRepeatedInt32 (message, F("packed_sint32" ), 1));
+ EXPECT_EQ(706 , reflection->GetRepeatedInt64 (message, F("packed_sint64" ), 1));
+ EXPECT_EQ(707 , reflection->GetRepeatedUInt32(message, F("packed_fixed32" ), 1));
+ EXPECT_EQ(708 , reflection->GetRepeatedUInt64(message, F("packed_fixed64" ), 1));
+ EXPECT_EQ(709 , reflection->GetRepeatedInt32 (message, F("packed_sfixed32"), 1));
+ EXPECT_EQ(710 , reflection->GetRepeatedInt64 (message, F("packed_sfixed64"), 1));
+ EXPECT_EQ(711 , reflection->GetRepeatedFloat (message, F("packed_float" ), 1));
+ EXPECT_EQ(712 , reflection->GetRepeatedDouble(message, F("packed_double" ), 1));
+ EXPECT_FALSE( reflection->GetRepeatedBool (message, F("packed_bool" ), 1));
+ EXPECT_EQ(foreign_baz_,
+ reflection->GetRepeatedEnum(message, F("packed_enum"), 1));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ReflectionTester::ExpectClearViaReflection(
+ const Message& message) {
+ const Reflection* reflection = message.GetReflection();
+ string scratch;
+ const Message* sub_message;
+
+ // has_blah() should initially be false for all optional fields.
+ EXPECT_FALSE(reflection->HasField(message, F("optional_int32" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_int64" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_uint32" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_uint64" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_sint32" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_sint64" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_fixed32" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_fixed64" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_sfixed32")));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_sfixed64")));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_float" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_double" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_bool" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_string" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_bytes" )));
+
+ EXPECT_FALSE(reflection->HasField(message, F("optionalgroup" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_nested_message" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_foreign_message")));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_import_message" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_public_import_message")));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_lazy_message")));
+
+ EXPECT_FALSE(reflection->HasField(message, F("optional_nested_enum" )));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_foreign_enum")));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_import_enum" )));
+
+ EXPECT_FALSE(reflection->HasField(message, F("optional_string_piece")));
+ EXPECT_FALSE(reflection->HasField(message, F("optional_cord")));
+
+ // Optional fields without defaults are set to zero or something like it.
+ EXPECT_EQ(0 , reflection->GetInt32 (message, F("optional_int32" )));
+ EXPECT_EQ(0 , reflection->GetInt64 (message, F("optional_int64" )));
+ EXPECT_EQ(0 , reflection->GetUInt32(message, F("optional_uint32" )));
+ EXPECT_EQ(0 , reflection->GetUInt64(message, F("optional_uint64" )));
+ EXPECT_EQ(0 , reflection->GetInt32 (message, F("optional_sint32" )));
+ EXPECT_EQ(0 , reflection->GetInt64 (message, F("optional_sint64" )));
+ EXPECT_EQ(0 , reflection->GetUInt32(message, F("optional_fixed32" )));
+ EXPECT_EQ(0 , reflection->GetUInt64(message, F("optional_fixed64" )));
+ EXPECT_EQ(0 , reflection->GetInt32 (message, F("optional_sfixed32")));
+ EXPECT_EQ(0 , reflection->GetInt64 (message, F("optional_sfixed64")));
+ EXPECT_EQ(0 , reflection->GetFloat (message, F("optional_float" )));
+ EXPECT_EQ(0 , reflection->GetDouble(message, F("optional_double" )));
+ EXPECT_FALSE( reflection->GetBool (message, F("optional_bool" )));
+ EXPECT_EQ("" , reflection->GetString(message, F("optional_string" )));
+ EXPECT_EQ("" , reflection->GetString(message, F("optional_bytes" )));
+
+ EXPECT_EQ("", reflection->GetStringReference(message, F("optional_string"), &scratch));
+ EXPECT_EQ("", reflection->GetStringReference(message, F("optional_bytes" ), &scratch));
+
+ // Embedded messages should also be clear.
+ sub_message = &reflection->GetMessage(message, F("optionalgroup"));
+ EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, group_a_));
+ EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, group_a_));
+ sub_message = &reflection->GetMessage(message, F("optional_nested_message"));
+ EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, nested_b_));
+ EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+ sub_message = &reflection->GetMessage(message, F("optional_foreign_message"));
+ EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, foreign_c_));
+ EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, foreign_c_));
+ sub_message = &reflection->GetMessage(message, F("optional_import_message"));
+ EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, import_d_));
+ EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, import_d_));
+ sub_message = &reflection->GetMessage(message, F("optional_public_import_message"));
+ EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, import_e_));
+ EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, import_e_));
+ sub_message = &reflection->GetMessage(message, F("optional_lazy_message"));
+ EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, nested_b_));
+ EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
+
+ // Enums without defaults are set to the first value in the enum.
+ EXPECT_EQ( nested_foo_, reflection->GetEnum(message, F("optional_nested_enum" )));
+ EXPECT_EQ(foreign_foo_, reflection->GetEnum(message, F("optional_foreign_enum")));
+ EXPECT_EQ( import_foo_, reflection->GetEnum(message, F("optional_import_enum" )));
+
+ EXPECT_EQ("", reflection->GetString(message, F("optional_string_piece")));
+ EXPECT_EQ("", reflection->GetStringReference(message, F("optional_string_piece"), &scratch));
+
+ EXPECT_EQ("", reflection->GetString(message, F("optional_cord")));
+ EXPECT_EQ("", reflection->GetStringReference(message, F("optional_cord"), &scratch));
+
+ // Repeated fields are empty.
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_int32" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_int64" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_uint32" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_uint64" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_sint32" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_sint64" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_fixed32" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_fixed64" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_sfixed32")));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_sfixed64")));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_float" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_double" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_bool" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_string" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_bytes" )));
+
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeatedgroup" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_nested_message" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_foreign_message")));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_import_message" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_lazy_message" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_nested_enum" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_foreign_enum" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_import_enum" )));
+
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_string_piece")));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_cord")));
+
+ // has_blah() should also be false for all default fields.
+ EXPECT_FALSE(reflection->HasField(message, F("default_int32" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_int64" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_uint32" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_uint64" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_sint32" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_sint64" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_fixed32" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_fixed64" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_sfixed32")));
+ EXPECT_FALSE(reflection->HasField(message, F("default_sfixed64")));
+ EXPECT_FALSE(reflection->HasField(message, F("default_float" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_double" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_bool" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_string" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_bytes" )));
+
+ EXPECT_FALSE(reflection->HasField(message, F("default_nested_enum" )));
+ EXPECT_FALSE(reflection->HasField(message, F("default_foreign_enum")));
+ EXPECT_FALSE(reflection->HasField(message, F("default_import_enum" )));
+
+ EXPECT_FALSE(reflection->HasField(message, F("default_string_piece")));
+ EXPECT_FALSE(reflection->HasField(message, F("default_cord")));
+
+ // Fields with defaults have their default values (duh).
+ EXPECT_EQ( 41 , reflection->GetInt32 (message, F("default_int32" )));
+ EXPECT_EQ( 42 , reflection->GetInt64 (message, F("default_int64" )));
+ EXPECT_EQ( 43 , reflection->GetUInt32(message, F("default_uint32" )));
+ EXPECT_EQ( 44 , reflection->GetUInt64(message, F("default_uint64" )));
+ EXPECT_EQ(-45 , reflection->GetInt32 (message, F("default_sint32" )));
+ EXPECT_EQ( 46 , reflection->GetInt64 (message, F("default_sint64" )));
+ EXPECT_EQ( 47 , reflection->GetUInt32(message, F("default_fixed32" )));
+ EXPECT_EQ( 48 , reflection->GetUInt64(message, F("default_fixed64" )));
+ EXPECT_EQ( 49 , reflection->GetInt32 (message, F("default_sfixed32")));
+ EXPECT_EQ(-50 , reflection->GetInt64 (message, F("default_sfixed64")));
+ EXPECT_EQ( 51.5 , reflection->GetFloat (message, F("default_float" )));
+ EXPECT_EQ( 52e3 , reflection->GetDouble(message, F("default_double" )));
+ EXPECT_TRUE( reflection->GetBool (message, F("default_bool" )));
+ EXPECT_EQ("hello", reflection->GetString(message, F("default_string" )));
+ EXPECT_EQ("world", reflection->GetString(message, F("default_bytes" )));
+
+ EXPECT_EQ("hello", reflection->GetStringReference(message, F("default_string"), &scratch));
+ EXPECT_EQ("world", reflection->GetStringReference(message, F("default_bytes" ), &scratch));
+
+ EXPECT_EQ( nested_bar_, reflection->GetEnum(message, F("default_nested_enum" )));
+ EXPECT_EQ(foreign_bar_, reflection->GetEnum(message, F("default_foreign_enum")));
+ EXPECT_EQ( import_bar_, reflection->GetEnum(message, F("default_import_enum" )));
+
+ EXPECT_EQ("abc", reflection->GetString(message, F("default_string_piece")));
+ EXPECT_EQ("abc", reflection->GetStringReference(message, F("default_string_piece"), &scratch));
+
+ EXPECT_EQ("123", reflection->GetString(message, F("default_cord")));
+ EXPECT_EQ("123", reflection->GetStringReference(message, F("default_cord"), &scratch));
+}
+
+void TestUtil::ReflectionTester::ExpectPackedClearViaReflection(
+ const Message& message) {
+ const Reflection* reflection = message.GetReflection();
+
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_int32" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_int64" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_uint32" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_uint64" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_sint32" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_sint64" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_fixed32" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_fixed64" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_sfixed32")));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_sfixed64")));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_float" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_double" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_bool" )));
+ EXPECT_EQ(0, reflection->FieldSize(message, F("packed_enum" )));
+}
+
+// -------------------------------------------------------------------
+
+void TestUtil::ReflectionTester::ModifyRepeatedFieldsViaReflection(
+ Message* message) {
+ const Reflection* reflection = message->GetReflection();
+ Message* sub_message;
+
+ reflection->SetRepeatedInt32 (message, F("repeated_int32" ), 1, 501);
+ reflection->SetRepeatedInt64 (message, F("repeated_int64" ), 1, 502);
+ reflection->SetRepeatedUInt32(message, F("repeated_uint32" ), 1, 503);
+ reflection->SetRepeatedUInt64(message, F("repeated_uint64" ), 1, 504);
+ reflection->SetRepeatedInt32 (message, F("repeated_sint32" ), 1, 505);
+ reflection->SetRepeatedInt64 (message, F("repeated_sint64" ), 1, 506);
+ reflection->SetRepeatedUInt32(message, F("repeated_fixed32" ), 1, 507);
+ reflection->SetRepeatedUInt64(message, F("repeated_fixed64" ), 1, 508);
+ reflection->SetRepeatedInt32 (message, F("repeated_sfixed32"), 1, 509);
+ reflection->SetRepeatedInt64 (message, F("repeated_sfixed64"), 1, 510);
+ reflection->SetRepeatedFloat (message, F("repeated_float" ), 1, 511);
+ reflection->SetRepeatedDouble(message, F("repeated_double" ), 1, 512);
+ reflection->SetRepeatedBool (message, F("repeated_bool" ), 1, true);
+ reflection->SetRepeatedString(message, F("repeated_string" ), 1, "515");
+ reflection->SetRepeatedString(message, F("repeated_bytes" ), 1, "516");
+
+ sub_message = reflection->MutableRepeatedMessage(message, F("repeatedgroup"), 1);
+ sub_message->GetReflection()->SetInt32(sub_message, repeated_group_a_, 517);
+ sub_message = reflection->MutableRepeatedMessage(message, F("repeated_nested_message"), 1);
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 518);
+ sub_message = reflection->MutableRepeatedMessage(message, F("repeated_foreign_message"), 1);
+ sub_message->GetReflection()->SetInt32(sub_message, foreign_c_, 519);
+ sub_message = reflection->MutableRepeatedMessage(message, F("repeated_import_message"), 1);
+ sub_message->GetReflection()->SetInt32(sub_message, import_d_, 520);
+ sub_message = reflection->MutableRepeatedMessage(message, F("repeated_lazy_message"), 1);
+ sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 527);
+
+ reflection->SetRepeatedEnum(message, F("repeated_nested_enum" ), 1, nested_foo_);
+ reflection->SetRepeatedEnum(message, F("repeated_foreign_enum"), 1, foreign_foo_);
+ reflection->SetRepeatedEnum(message, F("repeated_import_enum" ), 1, import_foo_);
+
+ reflection->SetRepeatedString(message, F("repeated_string_piece"), 1, "524");
+ reflection->SetRepeatedString(message, F("repeated_cord"), 1, "525");
+}
+
+void TestUtil::ReflectionTester::ModifyPackedFieldsViaReflection(
+ Message* message) {
+ const Reflection* reflection = message->GetReflection();
+ reflection->SetRepeatedInt32 (message, F("packed_int32" ), 1, 801);
+ reflection->SetRepeatedInt64 (message, F("packed_int64" ), 1, 802);
+ reflection->SetRepeatedUInt32(message, F("packed_uint32" ), 1, 803);
+ reflection->SetRepeatedUInt64(message, F("packed_uint64" ), 1, 804);
+ reflection->SetRepeatedInt32 (message, F("packed_sint32" ), 1, 805);
+ reflection->SetRepeatedInt64 (message, F("packed_sint64" ), 1, 806);
+ reflection->SetRepeatedUInt32(message, F("packed_fixed32" ), 1, 807);
+ reflection->SetRepeatedUInt64(message, F("packed_fixed64" ), 1, 808);
+ reflection->SetRepeatedInt32 (message, F("packed_sfixed32"), 1, 809);
+ reflection->SetRepeatedInt64 (message, F("packed_sfixed64"), 1, 810);
+ reflection->SetRepeatedFloat (message, F("packed_float" ), 1, 811);
+ reflection->SetRepeatedDouble(message, F("packed_double" ), 1, 812);
+ reflection->SetRepeatedBool (message, F("packed_bool" ), 1, true);
+ reflection->SetRepeatedEnum (message, F("packed_enum" ), 1, foreign_foo_);
+}
+
+void TestUtil::ReflectionTester::RemoveLastRepeatedsViaReflection(
+ Message* message) {
+ const Reflection* reflection = message->GetReflection();
+
+ std::vector<const FieldDescriptor*> output;
+ reflection->ListFields(*message, &output);
+ for (int i=0; i<output.size(); ++i) {
+ const FieldDescriptor* field = output[i];
+ if (!field->is_repeated()) continue;
+
+ reflection->RemoveLast(message, field);
+ }
+}
+
+void TestUtil::ReflectionTester::ReleaseLastRepeatedsViaReflection(
+ Message* message, bool expect_extensions_notnull) {
+ const Reflection* reflection = message->GetReflection();
+
+ std::vector<const FieldDescriptor*> output;
+ reflection->ListFields(*message, &output);
+ for (int i=0; i<output.size(); ++i) {
+ const FieldDescriptor* field = output[i];
+ if (!field->is_repeated()) continue;
+ if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) continue;
+
+ Message* released = reflection->ReleaseLast(message, field);
+ if (!field->is_extension() || expect_extensions_notnull) {
+ ASSERT_TRUE(released != NULL) << "ReleaseLast returned NULL for: "
+ << field->name();
+ }
+ delete released;
+ }
+}
+
+void TestUtil::ReflectionTester::SwapRepeatedsViaReflection(Message* message) {
+ const Reflection* reflection = message->GetReflection();
+
+ std::vector<const FieldDescriptor*> output;
+ reflection->ListFields(*message, &output);
+ for (int i=0; i<output.size(); ++i) {
+ const FieldDescriptor* field = output[i];
+ if (!field->is_repeated()) continue;
+
+ reflection->SwapElements(message, field, 0, 1);
+ }
+}
+
+void TestUtil::ReflectionTester::
+SetAllocatedOptionalMessageFieldsToNullViaReflection(
+ Message* message) {
+ const Reflection* reflection = message->GetReflection();
+
+ std::vector<const FieldDescriptor*> fields;
+ reflection->ListFields(*message, &fields);
+
+ for (int i = 0; i < fields.size(); ++i) {
+ const FieldDescriptor* field = fields[i];
+ if (!field->is_optional() ||
+ field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) continue;
+
+ reflection->SetAllocatedMessage(message, NULL, field);
+ }
+}
+
+void TestUtil::ReflectionTester::
+SetAllocatedOptionalMessageFieldsToMessageViaReflection(
+ Message* from_message,
+ Message* to_message) {
+ EXPECT_EQ(from_message->GetDescriptor(), to_message->GetDescriptor());
+ const Reflection* from_reflection = from_message->GetReflection();
+ const Reflection* to_reflection = to_message->GetReflection();
+
+ std::vector<const FieldDescriptor*> fields;
+ from_reflection->ListFields(*from_message, &fields);
+
+ for (int i = 0; i < fields.size(); ++i) {
+ const FieldDescriptor* field = fields[i];
+ if (!field->is_optional() ||
+ field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) continue;
+
+ Message* sub_message =
+ from_reflection->ReleaseMessage(from_message, field);
+ to_reflection->SetAllocatedMessage(to_message, sub_message, field);
+ }
+}
+
+void TestUtil::ReflectionTester::ExpectMessagesReleasedViaReflection(
+ Message* message,
+ TestUtil::ReflectionTester::MessageReleaseState expected_release_state) {
+ const Reflection* reflection = message->GetReflection();
+
+ static const char* fields[] = {
+ "optionalgroup",
+ "optional_nested_message",
+ "optional_foreign_message",
+ "optional_import_message",
+ };
+ for (int i = 0; i < GOOGLE_ARRAYSIZE(fields); i++) {
+ const Message& sub_message = reflection->GetMessage(*message, F(fields[i]));
+ Message* released = reflection->ReleaseMessage(message, F(fields[i]));
+ switch (expected_release_state) {
+ case IS_NULL:
+ EXPECT_TRUE(released == NULL);
+ break;
+ case NOT_NULL:
+ EXPECT_TRUE(released != NULL);
+ if (message->GetArena() == NULL) {
+ // released message must be same as sub_message if source message is
+ // not on arena.
+ EXPECT_EQ(&sub_message, released);
+ }
+ break;
+ case CAN_BE_NULL:
+ break;
+ }
+ delete released;
+ EXPECT_FALSE(reflection->HasField(*message, F(fields[i])));
+ }
+}
+
+} // namespace protobuf
+} // namespace google
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/test_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/test_util.h
new file mode 100644
index 0000000000..1c13a1a7f6
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/test_util.h
@@ -0,0 +1,215 @@
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_TEST_UTIL_H__
+#define GOOGLE_PROTOBUF_TEST_UTIL_H__
+
+#include <stack>
+#include <string>
+#include <google/protobuf/message.h>
+#include <google/protobuf/unittest.pb.h>
+
+namespace google {
+namespace protobuf {
+
+namespace unittest = ::protobuf_unittest;
+namespace unittest_import = protobuf_unittest_import;
+
+class TestUtil {
+ public:
+ // Set every field in the message to a unique value.
+ static void SetAllFields(unittest::TestAllTypes* message);
+ static void SetOptionalFields(unittest::TestAllTypes* message);
+ static void AddRepeatedFields1(unittest::TestAllTypes* message);
+ static void AddRepeatedFields2(unittest::TestAllTypes* message);
+ static void SetDefaultFields(unittest::TestAllTypes* message);
+ static void SetOneofFields(unittest::TestAllTypes* message);
+ static void SetAllExtensions(unittest::TestAllExtensions* message);
+ static void SetOneofFields(unittest::TestAllExtensions* message);
+ static void SetAllFieldsAndExtensions(unittest::TestFieldOrderings* message);
+ static void SetPackedFields(unittest::TestPackedTypes* message);
+ static void SetPackedExtensions(unittest::TestPackedExtensions* message);
+ static void SetUnpackedFields(unittest::TestUnpackedTypes* message);
+ static void SetOneof1(unittest::TestOneof2* message);
+ static void SetOneof2(unittest::TestOneof2* message);
+
+ // Use the repeated versions of the set_*() accessors to modify all the
+ // repeated fields of the message (which should already have been
+ // initialized with Set*Fields()). Set*Fields() itself only tests
+ // the add_*() accessors.
+ static void ModifyRepeatedFields(unittest::TestAllTypes* message);
+ static void ModifyRepeatedExtensions(unittest::TestAllExtensions* message);
+ static void ModifyPackedFields(unittest::TestPackedTypes* message);
+ static void ModifyPackedExtensions(unittest::TestPackedExtensions* message);
+
+ // Check that all fields have the values that they should have after
+ // Set*Fields() is called.
+ static void ExpectAllFieldsSet(const unittest::TestAllTypes& message);
+ static void ExpectAllExtensionsSet(
+ const unittest::TestAllExtensions& message);
+ static void ExpectPackedFieldsSet(const unittest::TestPackedTypes& message);
+ static void ExpectPackedExtensionsSet(
+ const unittest::TestPackedExtensions& message);
+ static void ExpectUnpackedFieldsSet(
+ const unittest::TestUnpackedTypes& message);
+ static void ExpectUnpackedExtensionsSet(
+ const unittest::TestUnpackedExtensions& message);
+ static void ExpectOneofSet1(const unittest::TestOneof2& message);
+ static void ExpectOneofSet2(const unittest::TestOneof2& message);
+
+ // Expect that the message is modified as would be expected from
+ // Modify*Fields().
+ static void ExpectRepeatedFieldsModified(
+ const unittest::TestAllTypes& message);
+ static void ExpectRepeatedExtensionsModified(
+ const unittest::TestAllExtensions& message);
+ static void ExpectPackedFieldsModified(
+ const unittest::TestPackedTypes& message);
+ static void ExpectPackedExtensionsModified(
+ const unittest::TestPackedExtensions& message);
+
+ // Check that all fields have their default values.
+ static void ExpectClear(const unittest::TestAllTypes& message);
+ static void ExpectExtensionsClear(const unittest::TestAllExtensions& message);
+ static void ExpectPackedClear(const unittest::TestPackedTypes& message);
+ static void ExpectPackedExtensionsClear(
+ const unittest::TestPackedExtensions& message);
+ static void ExpectOneofClear(const unittest::TestOneof2& message);
+
+ // Check that the passed-in serialization is the canonical serialization we
+ // expect for a TestFieldOrderings message filled in by
+ // SetAllFieldsAndExtensions().
+ static void ExpectAllFieldsAndExtensionsInOrder(const string& serialized);
+
+ // Check that all repeated fields have had their last elements removed.
+ static void ExpectLastRepeatedsRemoved(
+ const unittest::TestAllTypes& message);
+ static void ExpectLastRepeatedExtensionsRemoved(
+ const unittest::TestAllExtensions& message);
+ static void ExpectLastRepeatedsReleased(
+ const unittest::TestAllTypes& message);
+ static void ExpectLastRepeatedExtensionsReleased(
+ const unittest::TestAllExtensions& message);
+
+ // Check that all repeated fields have had their first and last elements
+ // swapped.
+ static void ExpectRepeatedsSwapped(const unittest::TestAllTypes& message);
+ static void ExpectRepeatedExtensionsSwapped(
+ const unittest::TestAllExtensions& message);
+
+ static void ExpectAtMostOneFieldSetInOneof(
+ const unittest::TestOneof2 &message);
+
+ // Like above, but use the reflection interface.
+ class ReflectionTester {
+ public:
+ // base_descriptor must be a descriptor for TestAllTypes or
+ // TestAllExtensions. In the former case, ReflectionTester fetches from
+ // it the FieldDescriptors needed to use the reflection interface. In
+ // the latter case, ReflectionTester searches for extension fields in
+ // its file.
+ explicit ReflectionTester(const Descriptor* base_descriptor);
+
+ void SetAllFieldsViaReflection(Message* message);
+ void ModifyRepeatedFieldsViaReflection(Message* message);
+ void ExpectAllFieldsSetViaReflection(const Message& message);
+ void ExpectClearViaReflection(const Message& message);
+
+ void SetPackedFieldsViaReflection(Message* message);
+ void ModifyPackedFieldsViaReflection(Message* message);
+ void ExpectPackedFieldsSetViaReflection(const Message& message);
+ void ExpectPackedClearViaReflection(const Message& message);
+
+ void RemoveLastRepeatedsViaReflection(Message* message);
+ void ReleaseLastRepeatedsViaReflection(
+ Message* message, bool expect_extensions_notnull);
+ void SwapRepeatedsViaReflection(Message* message);
+ void SetAllocatedOptionalMessageFieldsToNullViaReflection(
+ Message* message);
+ static void SetAllocatedOptionalMessageFieldsToMessageViaReflection(
+ Message* from_message,
+ Message* to_message);
+
+ enum MessageReleaseState {
+ IS_NULL,
+ CAN_BE_NULL,
+ NOT_NULL,
+ };
+ void ExpectMessagesReleasedViaReflection(
+ Message* message, MessageReleaseState expected_release_state);
+
+ // Set and check functions for TestOneof2 messages. No need to construct
+ // the ReflectionTester by TestAllTypes nor TestAllExtensions.
+ static void SetOneofViaReflection(Message* message);
+ static void ExpectOneofSetViaReflection(const Message& message);
+
+ private:
+ const FieldDescriptor* F(const string& name);
+
+ const Descriptor* base_descriptor_;
+
+ const FieldDescriptor* group_a_;
+ const FieldDescriptor* repeated_group_a_;
+ const FieldDescriptor* nested_b_;
+ const FieldDescriptor* foreign_c_;
+ const FieldDescriptor* import_d_;
+ const FieldDescriptor* import_e_;
+
+ const EnumValueDescriptor* nested_foo_;
+ const EnumValueDescriptor* nested_bar_;
+ const EnumValueDescriptor* nested_baz_;
+ const EnumValueDescriptor* foreign_foo_;
+ const EnumValueDescriptor* foreign_bar_;
+ const EnumValueDescriptor* foreign_baz_;
+ const EnumValueDescriptor* import_foo_;
+ const EnumValueDescriptor* import_bar_;
+ const EnumValueDescriptor* import_baz_;
+
+ // We have to split this into three function otherwise it creates a stack
+ // frame so large that it triggers a warning.
+ void ExpectAllFieldsSetViaReflection1(const Message& message);
+ void ExpectAllFieldsSetViaReflection2(const Message& message);
+ void ExpectAllFieldsSetViaReflection3(const Message& message);
+
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ReflectionTester);
+ };
+
+ private:
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TestUtil);
+};
+
+} // namespace protobuf
+
+} // namespace google
+#endif // GOOGLE_PROTOBUF_TEST_UTIL_H__
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/test_util_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/test_util_lite.cc
index 79c5abec6d..79c5abec6d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/test_util_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/test_util_lite.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/test_util_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/test_util_lite.h
index 47a2269d36..47a2269d36 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/test_util_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/test_util_lite.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/bad_utf8_string b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/bad_utf8_string
index a1337ec689..a1337ec689 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/bad_utf8_string
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/bad_utf8_string
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message
index 0b7e6552c6..0b7e6552c6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message
Binary files differ
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_maps b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_maps
index c70a4d7cde..c70a4d7cde 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_maps
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_maps
Binary files differ
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_oneof_implemented b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_oneof_implemented
index b48c898526..b48c898526 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_oneof_implemented
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_oneof_implemented
Binary files differ
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_proto3 b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_proto3
index bd646a0dc8..bd646a0dc8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_message_proto3
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_message_proto3
Binary files differ
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_packed_fields_message b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_packed_fields_message
index ee28d38830..ee28d38830 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/golden_packed_fields_message
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/golden_packed_fields_message
Binary files differ
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/map_test_data.txt b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/map_test_data.txt
index bc2723214a..bc2723214a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/map_test_data.txt
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/map_test_data.txt
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data.txt b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data.txt
index 7a874b54cd..7a874b54cd 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data.txt
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data.txt
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt
index ec95e1e81a..ec95e1e81a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt
index e1011ebf15..e1011ebf15 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt
index 95109f62ab..95109f62ab 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt
index 8c8b1eb4d8..8c8b1eb4d8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt
index 132f7445f3..132f7445f3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testing/file.cc b/third_party/protobuf/3.4.0/src/google/protobuf/testing/file.cc
index 26cb0a67c2..f32222b7c4 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testing/file.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testing/file.cc
@@ -57,7 +57,7 @@ namespace protobuf {
// them like we do below.
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
using google::protobuf::internal::win32::access;
using google::protobuf::internal::win32::chdir;
using google::protobuf::internal::win32::fopen;
@@ -121,7 +121,7 @@ void File::WriteStringToFileOrDie(const string& contents, const string& name) {
bool File::CreateDir(const string& name, int mode) {
if (!name.empty()) {
- GOOGLE_CHECK_OK(name[name.size() - 1] != '.');
+ GOOGLE_CHECK_OK(name.back() != '.');
}
return mkdir(name.c_str(), mode) == 0;
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testing/file.h b/third_party/protobuf/3.4.0/src/google/protobuf/testing/file.h
index 2f63f80e7b..2f63f80e7b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testing/file.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testing/file.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testing/googletest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/testing/googletest.cc
index 8c89e5afba..33a75ed680 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testing/googletest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testing/googletest.cc
@@ -52,7 +52,7 @@
namespace google {
namespace protobuf {
-#ifdef _WIN32
+#ifdef _MSC_VER
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
using google::protobuf::internal::win32::close;
@@ -132,7 +132,7 @@ string GetTemporaryDirectoryName() {
// with "\\?\") but these will be degenerate in the sense that you cannot
// chdir into such directories (or navigate into them with Windows Explorer)
// nor can you open such files with some programs (e.g. Notepad).
- if (result[result.size() - 1] == '.') {
+ if (result.back() == '.') {
result[result.size() - 1] = '_';
}
// On Win32, tmpnam() returns a file prefixed with '\', but which is supposed
@@ -263,7 +263,7 @@ ScopedMemoryLog::~ScopedMemoryLog() {
active_log_ = NULL;
}
-const std::vector<string>& ScopedMemoryLog::GetMessages(LogLevel level) {
+const vector<string>& ScopedMemoryLog::GetMessages(LogLevel level) {
GOOGLE_CHECK(level == ERROR ||
level == WARNING);
return messages_[level];
@@ -286,8 +286,6 @@ namespace {
struct ForceShutdown {
~ForceShutdown() {
ShutdownProtobufLibrary();
- // Test to shutdown the library twice, which should succeed.
- ShutdownProtobufLibrary();
}
} force_shutdown;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testing/googletest.h b/third_party/protobuf/3.4.0/src/google/protobuf/testing/googletest.h
index 8163748603..dc4401d032 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testing/googletest.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testing/googletest.h
@@ -39,8 +39,7 @@
#include <google/protobuf/stubs/common.h>
#include <gmock/gmock.h>
// Disable death tests if we use exceptions in CHECK().
-#if !PROTOBUF_USE_EXCEPTIONS && defined(GTEST_HAS_DEATH_TEST) && \
- !GTEST_OS_WINDOWS
+#if !PROTOBUF_USE_EXCEPTIONS && defined(GTEST_HAS_DEATH_TEST)
#define PROTOBUF_HAS_DEATH_TEST
#endif
@@ -83,10 +82,10 @@ class ScopedMemoryLog {
virtual ~ScopedMemoryLog();
// Fetches all messages with the given severity level.
- const std::vector<string>& GetMessages(LogLevel error);
+ const vector<string>& GetMessages(LogLevel error);
private:
- std::map<LogLevel, std::vector<string> > messages_;
+ std::map<LogLevel, vector<string> > messages_;
LogHandler* old_handler_;
static void HandleLog(LogLevel level, const char* filename, int line,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testing/zcgunzip.cc b/third_party/protobuf/3.4.0/src/google/protobuf/testing/zcgunzip.cc
index 349ad86ee6..76f8cfe11b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testing/zcgunzip.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testing/zcgunzip.cc
@@ -72,10 +72,7 @@ int main(int argc, const char** argv) {
}
if (inlen > 0) {
int err = write(STDOUT_FILENO, inptr, inlen);
- if (err != inlen) {
- fprintf(stderr, "write unexpectedly returned %d.\n", err);
- return 1;
- }
+ assert(err == inlen);
}
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/testing/zcgzip.cc b/third_party/protobuf/3.4.0/src/google/protobuf/testing/zcgzip.cc
index 992ddc6ed6..992ddc6ed6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/testing/zcgzip.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/testing/zcgzip.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/text_format.cc b/third_party/protobuf/3.4.0/src/google/protobuf/text_format.cc
index 0965fd7af9..f1d2e8bc0f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/text_format.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/text_format.cc
@@ -57,7 +57,6 @@
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>
@@ -190,24 +189,6 @@ TextFormat::ParseInfoTree* TextFormat::ParseInfoTree::GetTreeForNested(
return (*trees)[index];
}
-namespace {
-// These functions implement the behavior of the "default" TextFormat::Finder,
-// they are defined as standalone to be called when finder_ is NULL.
-const FieldDescriptor* DefaultFinderFindExtension(Message* message,
- const string& name) {
- return message->GetReflection()->FindKnownExtensionByName(name);
-}
-
-const Descriptor* DefaultFinderFindAnyType(const Message& message,
- const string& prefix,
- const string& name) {
- if (prefix != internal::kTypeGoogleApisComPrefix &&
- prefix != internal::kTypeGoogleProdComPrefix) {
- return NULL;
- }
- return message.GetDescriptor()->file()->pool()->FindMessageTypeByName(name);
-}
-} // namespace
// ===========================================================================
// Internal class for parsing an ASCII representation of a Protocol Message.
@@ -236,7 +217,7 @@ class TextFormat::Parser::ParserImpl {
ParserImpl(const Descriptor* root_message_type,
io::ZeroCopyInputStream* input_stream,
io::ErrorCollector* error_collector,
- const TextFormat::Finder* finder,
+ TextFormat::Finder* finder,
ParseInfoTree* parse_info_tree,
SingularOverwritePolicy singular_overwrite_policy,
bool allow_case_insensitive_field,
@@ -399,15 +380,9 @@ class TextFormat::Parser::ParserImpl {
DO(Consume("]"));
TryConsume(":"); // ':' is optional between message labels and values.
string serialized_value;
- const Descriptor* value_descriptor =
- finder_ ? finder_->FindAnyType(*message, prefix, full_type_name)
- : DefaultFinderFindAnyType(*message, prefix, full_type_name);
- if (value_descriptor == NULL) {
- ReportError("Could not find type \"" + prefix + full_type_name +
- "\" stored in google.protobuf.Any.");
- return false;
- }
- DO(ConsumeAnyValue(value_descriptor, &serialized_value));
+ DO(ConsumeAnyValue(full_type_name,
+ message->GetDescriptor()->file()->pool(),
+ &serialized_value));
if (singular_overwrite_policy_ == FORBID_SINGULAR_OVERWRITES) {
// Fail if any_type_url_field has already been specified.
if ((!any_type_url_field->is_repeated() &&
@@ -429,8 +404,9 @@ class TextFormat::Parser::ParserImpl {
DO(ConsumeFullTypeName(&field_name));
DO(Consume("]"));
- field = finder_ ? finder_->FindExtension(message, field_name)
- : DefaultFinderFindExtension(message, field_name);
+ field = (finder_ != NULL
+ ? finder_->FindExtension(message, field_name)
+ : reflection->FindKnownExtensionByName(field_name));
if (field == NULL) {
if (!allow_unknown_field_) {
@@ -596,12 +572,12 @@ label_skip_parsing:
// Skips the next field including the field's name and value.
bool SkipField() {
+ string field_name;
if (TryConsume("[")) {
- // Extension name or type URL.
- DO(ConsumeTypeUrlOrFullTypeName());
+ // Extension name.
+ DO(ConsumeFullTypeName(&field_name));
DO(Consume("]"));
} else {
- string field_name;
DO(ConsumeIdentifier(&field_name));
}
@@ -905,15 +881,6 @@ label_skip_parsing:
return true;
}
- bool ConsumeTypeUrlOrFullTypeName() {
- string discarded;
- DO(ConsumeIdentifier(&discarded));
- while (TryConsume(".") || TryConsume("/")) {
- DO(ConsumeIdentifier(&discarded));
- }
- return true;
- }
-
// Consumes a string and saves its value in the text parameter.
// Returns false if the token is not of type STRING.
bool ConsumeString(string* text) {
@@ -1062,29 +1029,44 @@ label_skip_parsing:
bool ConsumeAnyTypeUrl(string* full_type_name, string* prefix) {
// TODO(saito) Extend Consume() to consume multiple tokens at once, so that
// this code can be written as just DO(Consume(kGoogleApisTypePrefix)).
- DO(ConsumeIdentifier(prefix));
- while (TryConsume(".")) {
- string url;
- DO(ConsumeIdentifier(&url));
- *prefix += "." + url;
- }
+ string url1, url2, url3;
+ DO(ConsumeIdentifier(&url1)); // type
+ DO(Consume("."));
+ DO(ConsumeIdentifier(&url2)); // googleapis
+ DO(Consume("."));
+ DO(ConsumeIdentifier(&url3)); // com
DO(Consume("/"));
- *prefix += "/";
DO(ConsumeFullTypeName(full_type_name));
+ *prefix = url1 + "." + url2 + "." + url3 + "/";
+ if (*prefix != internal::kTypeGoogleApisComPrefix &&
+ *prefix != internal::kTypeGoogleProdComPrefix) {
+ ReportError("TextFormat::Parser for Any supports only "
+ "type.googleapis.com and type.googleprod.com, "
+ "but found \"" + *prefix + "\"");
+ return false;
+ }
return true;
}
// A helper function for reconstructing Any::value. Consumes a text of
- // full_type_name, then serializes it into serialized_value.
- bool ConsumeAnyValue(const Descriptor* value_descriptor,
+ // full_type_name, then serializes it into serialized_value. "pool" is used to
+ // look up and create a temporary object with full_type_name.
+ bool ConsumeAnyValue(const string& full_type_name, const DescriptorPool* pool,
string* serialized_value) {
+ const Descriptor* value_descriptor =
+ pool->FindMessageTypeByName(full_type_name);
+ if (value_descriptor == NULL) {
+ ReportError("Could not find type \"" + full_type_name +
+ "\" stored in google.protobuf.Any.");
+ return false;
+ }
DynamicMessageFactory factory;
const Message* value_prototype = factory.GetPrototype(value_descriptor);
if (value_prototype == NULL) {
return false;
}
- std::unique_ptr<Message> value(value_prototype->New());
+ google::protobuf::scoped_ptr<Message> value(value_prototype->New());
string sub_delimiter;
DO(ConsumeMessageDelimiter(&sub_delimiter));
DO(ConsumeMessage(value.get(), sub_delimiter));
@@ -1094,7 +1076,7 @@ label_skip_parsing:
} else {
if (!value->IsInitialized()) {
ReportError(
- "Value of type \"" + value_descriptor->full_name() +
+ "Value of type \"" + full_type_name +
"\" stored in google.protobuf.Any has missing required fields");
return false;
}
@@ -1154,7 +1136,7 @@ label_skip_parsing:
};
io::ErrorCollector* error_collector_;
- const TextFormat::Finder* finder_;
+ TextFormat::Finder* finder_;
ParseInfoTree* parse_info_tree_;
ParserErrorCollector tokenizer_error_collector_;
io::Tokenizer tokenizer_;
@@ -1198,11 +1180,13 @@ class TextFormat::Printer::TextGenerator
// Indent text by two spaces. After calling Indent(), two spaces will be
// inserted at the beginning of each line of text. Indent() may be called
// multiple times to produce deeper indents.
- void Indent() override { ++indent_level_; }
+ void Indent() {
+ ++indent_level_;
+ }
// Reduces the current indent level by two spaces, or crashes if the indent
// level is zero.
- void Outdent() override {
+ void Outdent() {
if (indent_level_ == 0 ||
indent_level_ < initial_indent_level_) {
GOOGLE_LOG(DFATAL) << " Outdent() without matching Indent().";
@@ -1213,7 +1197,7 @@ class TextFormat::Printer::TextGenerator
}
// Print text to the output stream.
- void Print(const char* text, size_t size) override {
+ void Print(const char* text, size_t size) {
if (indent_level_ > 0) {
size_t pos = 0; // The number of bytes we've written so far.
for (size_t i = 0; i < size; i++) {
@@ -1232,7 +1216,7 @@ class TextFormat::Printer::TextGenerator
Write(text + pos, size - pos);
} else {
Write(text, size);
- if (size > 0 && text[size - 1] == '\n') {
+ if (text[size - 1] == '\n') {
at_start_of_line_ = true;
}
}
@@ -1260,12 +1244,10 @@ class TextFormat::Printer::TextGenerator
while (size > buffer_size_) {
// Data exceeds space in the buffer. Copy what we can and request a
// new buffer.
- if (buffer_size_ > 0) {
- memcpy(buffer_, data, buffer_size_);
- data += buffer_size_;
- size -= buffer_size_;
- }
- void* void_buffer = NULL;
+ memcpy(buffer_, data, buffer_size_);
+ data += buffer_size_;
+ size -= buffer_size_;
+ void* void_buffer;
failed_ = !output_->Next(&void_buffer, &buffer_size_);
if (failed_) return;
buffer_ = reinterpret_cast<char*>(void_buffer);
@@ -1310,23 +1292,10 @@ class TextFormat::Printer::TextGenerator
};
// ===========================================================================
-// Implementation of the default Finder for extensions.
-TextFormat::Finder::~Finder() {
-}
-
-const FieldDescriptor* TextFormat::Finder::FindExtension(
- Message* message, const string& name) const {
- return DefaultFinderFindExtension(message, name);
-}
-const Descriptor* TextFormat::Finder::FindAnyType(const Message& message,
- const string& prefix,
- const string& name) const {
- return DefaultFinderFindAnyType(message, prefix, name);
+TextFormat::Finder::~Finder() {
}
-// ===========================================================================
-
TextFormat::Parser::Parser()
: error_collector_(NULL),
finder_(NULL),
@@ -1392,9 +1361,8 @@ bool TextFormat::Parser::MergeUsingImpl(io::ZeroCopyInputStream* /* input */,
if (!allow_partial_ && !output->IsInitialized()) {
std::vector<string> missing_fields;
output->FindInitializationErrors(&missing_fields);
- parser_impl->ReportError(-1, 0,
- "Message missing required fields: " +
- Join(missing_fields, ", "));
+ parser_impl->ReportError(-1, 0, "Message missing required fields: " +
+ Join(missing_fields, ", "));
return false;
}
return true;
@@ -1583,12 +1551,6 @@ void TextFormat::FastFieldValuePrinter::PrintBytes(
PrintString(val, generator);
}
void TextFormat::FastFieldValuePrinter::PrintFieldName(
- const Message& message, int field_index, int field_count,
- const Reflection* reflection, const FieldDescriptor* field,
- BaseTextGenerator* generator) const {
- PrintFieldName(message, reflection, field, generator);
-}
-void TextFormat::FastFieldValuePrinter::PrintFieldName(
const Message& message, const Reflection* reflection,
const FieldDescriptor* field, BaseTextGenerator* generator) const {
if (field->is_extension()) {
@@ -1675,13 +1637,6 @@ class FieldValuePrinterWrapper : public TextFormat::FastFieldValuePrinter {
TextFormat::BaseTextGenerator* generator) const {
generator->PrintString(delegate_->PrintEnum(val, name));
}
- void PrintFieldName(const Message& message, int field_index, int field_count,
- const Reflection* reflection,
- const FieldDescriptor* field,
- TextFormat::BaseTextGenerator* generator) const {
- generator->PrintString(delegate_->PrintFieldName(
- message, reflection, field));
- }
void PrintFieldName(const Message& message, const Reflection* reflection,
const FieldDescriptor* field,
TextFormat::BaseTextGenerator* generator) const {
@@ -1702,7 +1657,7 @@ class FieldValuePrinterWrapper : public TextFormat::FastFieldValuePrinter {
}
private:
- std::unique_ptr<const TextFormat::FieldValuePrinter> delegate_;
+ google::protobuf::scoped_ptr<const TextFormat::FieldValuePrinter> delegate_;
};
// Our own specialization: for UTF8 escaped strings.
@@ -1731,14 +1686,12 @@ TextFormat::Printer::Printer()
hide_unknown_fields_(false),
print_message_fields_in_index_order_(false),
expand_any_(false),
- truncate_string_field_longer_than_(0LL),
- finder_(NULL) {
+ truncate_string_field_longer_than_(0LL) {
SetUseUtf8StringEscaping(false);
}
TextFormat::Printer::~Printer() {
STLDeleteValues(&custom_printers_);
- STLDeleteValues(&custom_message_printers_);
}
void TextFormat::Printer::SetUseUtf8StringEscaping(bool as_utf8) {
@@ -1763,7 +1716,7 @@ bool TextFormat::Printer::RegisterFieldValuePrinter(
return false;
}
FieldValuePrinterWrapper* const wrapper =
- new FieldValuePrinterWrapper(nullptr);
+ new FieldValuePrinterWrapper(NULL);
if (custom_printers_.insert(std::make_pair(field, wrapper)).second) {
wrapper->SetDelegate(printer);
return true;
@@ -1779,13 +1732,6 @@ bool TextFormat::Printer::RegisterFieldValuePrinter(
custom_printers_.insert(std::make_pair(field, printer)).second;
}
-bool TextFormat::Printer::RegisterMessagePrinter(
- const Descriptor* descriptor, const MessagePrinter* printer) {
- return descriptor != nullptr && printer != nullptr &&
- custom_message_printers_.insert(std::make_pair(descriptor, printer))
- .second;
-}
-
bool TextFormat::Printer::PrintToString(const Message& message,
string* output) const {
GOOGLE_DCHECK(output) << "output specified is NULL";
@@ -1829,19 +1775,10 @@ bool TextFormat::Printer::PrintUnknownFields(
namespace {
// Comparison functor for sorting FieldDescriptors by field index.
-// Normal fields have higher precedence than extensions.
struct FieldIndexSorter {
bool operator()(const FieldDescriptor* left,
const FieldDescriptor* right) const {
- if (left->is_extension() && right->is_extension()) {
- return left->number() < right->number();
- } else if (left->is_extension()) {
- return false;
- } else if (right->is_extension()) {
- return true;
- } else {
- return left->index() < right->index();
- }
+ return left->index() < right->index();
}
};
@@ -1860,22 +1797,21 @@ bool TextFormat::Printer::PrintAny(const Message& message,
// Extract the full type name from the type_url field.
const string& type_url = reflection->GetString(message, type_url_field);
- string url_prefix;
string full_type_name;
- if (!internal::ParseAnyTypeUrl(type_url, &url_prefix, &full_type_name)) {
+ if (!internal::ParseAnyTypeUrl(type_url, &full_type_name)) {
return false;
}
// Print the "value" in text.
const google::protobuf::Descriptor* value_descriptor =
- finder_ ? finder_->FindAnyType(message, url_prefix, full_type_name)
- : DefaultFinderFindAnyType(message, url_prefix, full_type_name);
+ message.GetDescriptor()->file()->pool()->FindMessageTypeByName(
+ full_type_name);
if (value_descriptor == NULL) {
GOOGLE_LOG(WARNING) << "Proto type " << type_url << " not found";
return false;
}
DynamicMessageFactory factory;
- std::unique_ptr<google::protobuf::Message> value_message(
+ google::protobuf::scoped_ptr<google::protobuf::Message> value_message(
factory.GetPrototype(value_descriptor)->New());
string serialized_value = reflection->GetString(message, value_field);
if (!value_message->ParseFromString(serialized_value)) {
@@ -1898,11 +1834,6 @@ bool TextFormat::Printer::PrintAny(const Message& message,
void TextFormat::Printer::Print(const Message& message,
TextGenerator* generator) const {
const Descriptor* descriptor = message.GetDescriptor();
- auto itr = custom_message_printers_.find(descriptor);
- if (itr != custom_message_printers_.end()) {
- itr->second->Print(message, single_line_mode_, generator);
- return;
- }
const Reflection* reflection = message.GetReflection();
if (descriptor->full_name() == internal::kAnyFullTypeName && expand_any_ &&
PrintAny(message, generator)) {
@@ -1926,6 +1857,7 @@ void TextFormat::Printer::PrintFieldValueToString(
const FieldDescriptor* field,
int index,
string* output) const {
+
GOOGLE_DCHECK(output) << "output specified is NULL";
output->clear();
@@ -1964,7 +1896,7 @@ void TextFormat::Printer::PrintField(const Message& message,
for (int j = 0; j < count; ++j) {
const int field_index = field->is_repeated() ? j : -1;
- PrintFieldName(message, field_index, count, reflection, field, generator);
+ PrintFieldName(message, reflection, field, generator);
if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
const FastFieldValuePrinter* printer = FindWithDefault(
@@ -1998,9 +1930,9 @@ void TextFormat::Printer::PrintShortRepeatedField(
const Message& message, const Reflection* reflection,
const FieldDescriptor* field, TextGenerator* generator) const {
// Print primitive repeated field in short form.
+ PrintFieldName(message, reflection, field, generator);
+
int size = reflection->FieldSize(message, field);
- PrintFieldName(message, /*field_index=*/-1, /*field_count=*/size, reflection,
- field, generator);
generator->PrintLiteral(": [");
for (int i = 0; i < size; i++) {
if (i > 0) generator->PrintLiteral(", ");
@@ -2014,7 +1946,6 @@ void TextFormat::Printer::PrintShortRepeatedField(
}
void TextFormat::Printer::PrintFieldName(const Message& message,
- int field_index, int field_count,
const Reflection* reflection,
const FieldDescriptor* field,
TextGenerator* generator) const {
@@ -2027,8 +1958,7 @@ void TextFormat::Printer::PrintFieldName(const Message& message,
const FastFieldValuePrinter* printer = FindWithDefault(
custom_printers_, field, default_field_value_printer_.get());
- printer->PrintFieldName(message, field_index, field_count, reflection, field,
- generator);
+ printer->PrintFieldName(message, reflection, field, generator);
}
void TextFormat::Printer::PrintFieldValue(const Message& message,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/text_format.h b/third_party/protobuf/3.4.0/src/google/protobuf/text_format.h
index d6f3e16bfd..cd0e307e9e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/text_format.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/text_format.h
@@ -40,13 +40,15 @@
#include <map>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
-#include <google/protobuf/message_lite.h>
namespace google {
namespace protobuf {
@@ -94,10 +96,6 @@ class LIBPROTOBUF_EXPORT TextFormat {
class LIBPROTOBUF_EXPORT BaseTextGenerator {
public:
virtual ~BaseTextGenerator();
-
- virtual void Indent() {}
- virtual void Outdent() {}
-
// Print text to the output stream.
virtual void Print(const char* text, size_t size) = 0;
@@ -130,10 +128,6 @@ class LIBPROTOBUF_EXPORT TextFormat {
BaseTextGenerator* generator) const;
virtual void PrintEnum(int32 val, const string& name,
BaseTextGenerator* generator) const;
- virtual void PrintFieldName(const Message& message, int field_index,
- int field_count, const Reflection* reflection,
- const FieldDescriptor* field,
- BaseTextGenerator* generator) const;
virtual void PrintFieldName(const Message& message,
const Reflection* reflection,
const FieldDescriptor* field,
@@ -149,8 +143,8 @@ class LIBPROTOBUF_EXPORT TextFormat {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FastFieldValuePrinter);
};
- class LIBPROTOBUF_EXPORT PROTOBUF_RUNTIME_DEPRECATED("Please use FastFieldValuePrinter")
- FieldValuePrinter {
+// DEPRECATED: Please use FastFieldValuePrinter.
+ class LIBPROTOBUF_EXPORT FieldValuePrinter {
public:
FieldValuePrinter();
virtual ~FieldValuePrinter();
@@ -181,40 +175,6 @@ class LIBPROTOBUF_EXPORT TextFormat {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldValuePrinter);
};
- class LIBPROTOBUF_EXPORT MessagePrinter {
- public:
- MessagePrinter() {}
- virtual ~MessagePrinter() {}
- virtual void Print(const Message& message, bool single_line_mode,
- BaseTextGenerator* generator) const = 0;
-
- private:
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessagePrinter);
- };
-
- // Interface that Printers or Parsers can use to find extensions, or types
- // referenced in Any messages.
- class LIBPROTOBUF_EXPORT Finder {
- public:
- virtual ~Finder();
-
- // Try to find an extension of *message by fully-qualified field
- // name. Returns NULL if no extension is known for this name or number.
- // The base implementation uses the extensions already known by the message.
- virtual const FieldDescriptor* FindExtension(
- Message* message,
- const string& name) const;
-
- // Find the message type for an Any proto.
- // Returns NULL if no message is known for this name.
- // The base implementation only accepts prefixes of type.googleprod.com/ or
- // type.googleapis.com/, and searches the DescriptorPool of the parent
- // message.
- virtual const Descriptor* FindAnyType(const Message& message,
- const string& prefix,
- const string& name) const;
- };
-
// Class for those users which require more fine-grained control over how
// a protobuffer message is printed out.
class LIBPROTOBUF_EXPORT Printer {
@@ -250,7 +210,7 @@ class LIBPROTOBUF_EXPORT TextFormat {
single_line_mode_ = single_line_mode;
}
- bool IsInSingleLineMode() const {
+ bool IsInSingleLineMode() {
return single_line_mode_;
}
@@ -290,11 +250,9 @@ class LIBPROTOBUF_EXPORT TextFormat {
hide_unknown_fields_ = hide;
}
- // If print_message_fields_in_index_order is true, fields of a proto message
- // will be printed using the order defined in source code instead of the
- // field number, extensions will be printed at the end of the message
- // and their relative order is determined by the extension number.
- // By default, use the field number order.
+ // If print_message_fields_in_index_order is true, print fields of a proto
+ // message using the order defined in source code instead of the field
+ // number. By default, use the field number order.
void SetPrintMessageFieldsInIndexOrder(
bool print_message_fields_in_index_order) {
print_message_fields_in_index_order_ =
@@ -312,11 +270,6 @@ class LIBPROTOBUF_EXPORT TextFormat {
expand_any_ = expand;
}
- // Set how parser finds message for Any payloads.
- void SetFinder(Finder* finder) {
- finder_ = finder;
- }
-
// If non-zero, we truncate all string fields that are longer than this
// threshold. This is useful when the proto message has very long strings,
// e.g., dump of encoded image file.
@@ -339,13 +292,6 @@ class LIBPROTOBUF_EXPORT TextFormat {
bool RegisterFieldValuePrinter(const FieldDescriptor* field,
const FastFieldValuePrinter* printer);
- // Register a custom message-specific MessagePrinter for messages with a
- // particular Descriptor.
- // Returns "true" if the registration succeeded, or "false" if there is
- // already a printer for that Descriptor.
- bool RegisterMessagePrinter(const Descriptor* descriptor,
- const MessagePrinter* printer);
-
private:
// Forward declaration of an internal class used to print the text
// output to the OutputStream (see text_format.cc for implementation).
@@ -368,8 +314,7 @@ class LIBPROTOBUF_EXPORT TextFormat {
// Print the name of a field -- i.e. everything that comes before the
// ':' for a single name/value pair.
- void PrintFieldName(const Message& message, int field_index,
- int field_count, const Reflection* reflection,
+ void PrintFieldName(const Message& message, const Reflection* reflection,
const FieldDescriptor* field,
TextGenerator* generator) const;
@@ -403,16 +348,10 @@ class LIBPROTOBUF_EXPORT TextFormat {
int64 truncate_string_field_longer_than_;
- std::unique_ptr<const FastFieldValuePrinter> default_field_value_printer_;
+ google::protobuf::scoped_ptr<const FastFieldValuePrinter> default_field_value_printer_;
typedef std::map<const FieldDescriptor*, const FastFieldValuePrinter*>
CustomPrinterMap;
CustomPrinterMap custom_printers_;
-
- typedef std::map<const Descriptor*, const MessagePrinter*>
- CustomMessagePrinterMap;
- CustomMessagePrinterMap custom_message_printers_;
-
- const Finder* finder_;
};
// Parses a text-format protocol message from the given input stream to
@@ -447,6 +386,20 @@ class LIBPROTOBUF_EXPORT TextFormat {
const FieldDescriptor* field,
Message* message);
+ // Interface that TextFormat::Parser can use to find extensions.
+ // This class may be extended in the future to find more information
+ // like fields, etc.
+ class LIBPROTOBUF_EXPORT Finder {
+ public:
+ virtual ~Finder();
+
+ // Try to find an extension of *message by fully-qualified field
+ // name. Returns NULL if no extension is known for this name or number.
+ virtual const FieldDescriptor* FindExtension(
+ Message* message,
+ const string& name) const = 0;
+ };
+
// A location in the parsed text.
struct ParseLocation {
int line;
@@ -570,7 +523,7 @@ class LIBPROTOBUF_EXPORT TextFormat {
ParserImpl* parser_impl);
io::ErrorCollector* error_collector_;
- const Finder* finder_;
+ Finder* finder_;
ParseInfoTree* parse_info_tree_;
bool allow_partial_;
bool allow_case_insensitive_field_;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/text_format_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/text_format_unittest.cc
index 544c37e258..f823bcb2cc 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/text_format_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/text_format_unittest.cc
@@ -38,6 +38,9 @@
#include <stdlib.h>
#include <limits>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -471,14 +474,14 @@ TEST_F(TextFormatTest, ErrorCasesRegisteringFieldValuePrinterShouldFail) {
// NULL printer.
EXPECT_FALSE(printer.RegisterFieldValuePrinter(
message.GetDescriptor()->FindFieldByName("optional_int32"),
- static_cast<const TextFormat::FieldValuePrinter*>(nullptr)));
+ static_cast<const TextFormat::FieldValuePrinter*>(NULL)));
EXPECT_FALSE(printer.RegisterFieldValuePrinter(
message.GetDescriptor()->FindFieldByName("optional_int32"),
- static_cast<const TextFormat::FastFieldValuePrinter*>(nullptr)));
+ static_cast<const TextFormat::FastFieldValuePrinter*>(NULL)));
// Because registration fails, the ownership of this printer is never taken.
TextFormat::FieldValuePrinter my_field_printer;
// NULL field
- EXPECT_FALSE(printer.RegisterFieldValuePrinter(nullptr, &my_field_printer));
+ EXPECT_FALSE(printer.RegisterFieldValuePrinter(NULL, &my_field_printer));
}
class CustomMessageFieldValuePrinter : public TextFormat::FieldValuePrinter {
@@ -561,143 +564,6 @@ TEST_F(TextFormatTest, CustomPrinterForMultilineComments) {
text);
}
-// Achieve effects similar to SetUseShortRepeatedPrimitives for messages, using
-// RegisterFieldValuePrinter. Use this to test the version of PrintFieldName
-// that accepts repeated field index and count.
-class CompactRepeatedFieldPrinter : public TextFormat::FastFieldValuePrinter {
- public:
- void PrintFieldName(const Message& message, int field_index, int field_count,
- const Reflection* reflection,
- const FieldDescriptor* field,
- TextFormat::BaseTextGenerator* generator) const override {
- if (field_index == 0 || field_index == -1) {
- generator->PrintString(field->name());
- }
- }
- void PrintMessageStart(
- const Message& message, int field_index, int field_count,
- bool single_line_mode,
- TextFormat::BaseTextGenerator* generator) const override {
- if (field_index == 0 || field_index == -1) {
- if (single_line_mode) {
- generator->PrintLiteral(" { ");
- } else {
- generator->PrintLiteral(" {\n");
- }
- }
- }
- void PrintMessageEnd(
- const Message& message, int field_index, int field_count,
- bool single_line_mode,
- TextFormat::BaseTextGenerator* generator) const override {
- if (field_index == field_count - 1 || field_index == -1) {
- if (single_line_mode) {
- generator->PrintLiteral("} ");
- } else {
- generator->PrintLiteral("}\n");
- }
- }
- }
-};
-
-TEST_F(TextFormatTest, CompactRepeatedFieldPrinter) {
- TextFormat::Printer printer;
- ASSERT_TRUE(printer.RegisterFieldValuePrinter(
- unittest::TestAllTypes::default_instance()
- .descriptor()
- ->FindFieldByNumber(
- unittest::TestAllTypes::kRepeatedNestedMessageFieldNumber),
- new CompactRepeatedFieldPrinter));
-
- protobuf_unittest::TestAllTypes message;
- message.add_repeated_nested_message()->set_bb(1);
- message.add_repeated_nested_message()->set_bb(2);
- message.add_repeated_nested_message()->set_bb(3);
-
- string text;
- ASSERT_TRUE(printer.PrintToString(message, &text));
- EXPECT_EQ(
- "repeated_nested_message {\n"
- " bb: 1\n"
- " bb: 2\n"
- " bb: 3\n"
- "}\n",
- text);
-}
-
-// Print strings into multiple line, with indention. Use this to test
-// BaseTextGenerator::Indent and BaseTextGenerator::Outdent.
-class MultilineStringPrinter : public TextFormat::FastFieldValuePrinter {
- public:
- void PrintString(const string& val,
- TextFormat::BaseTextGenerator* generator) const override {
- generator->Indent();
- int last_pos = 0;
- int newline_pos = val.find('\n');
- while (newline_pos != string::npos) {
- generator->PrintLiteral("\n");
- TextFormat::FastFieldValuePrinter::PrintString(
- val.substr(last_pos, newline_pos + 1 - last_pos), generator);
- last_pos = newline_pos + 1;
- newline_pos = val.find('\n', last_pos);
- }
- if (last_pos < val.size()) {
- generator->PrintLiteral("\n");
- TextFormat::FastFieldValuePrinter::PrintString(val.substr(last_pos),
- generator);
- }
- generator->Outdent();
- }
-};
-
-TEST_F(TextFormatTest, MultilineStringPrinter) {
- TextFormat::Printer printer;
- ASSERT_TRUE(printer.RegisterFieldValuePrinter(
- unittest::TestAllTypes::default_instance()
- .descriptor()
- ->FindFieldByNumber(
- unittest::TestAllTypes::kOptionalStringFieldNumber),
- new MultilineStringPrinter));
-
- protobuf_unittest::TestAllTypes message;
- message.set_optional_string("first line\nsecond line\nthird line");
-
- string text;
- ASSERT_TRUE(printer.PrintToString(message, &text));
- EXPECT_EQ(
- "optional_string: \n"
- " \"first line\\n\"\n"
- " \"second line\\n\"\n"
- " \"third line\"\n",
- text);
-}
-
-class CustomNestedMessagePrinter : public TextFormat::MessagePrinter {
- public:
- CustomNestedMessagePrinter() {}
- ~CustomNestedMessagePrinter() override {}
- void Print(const Message& message, bool single_line_mode,
- TextFormat::BaseTextGenerator* generator) const override {
- generator->PrintLiteral("custom");
- }
-};
-
-TEST_F(TextFormatTest, CustomMessagePrinter) {
- TextFormat::Printer printer;
- printer.RegisterMessagePrinter(
- unittest::TestAllTypes::NestedMessage::default_instance().descriptor(),
- new CustomNestedMessagePrinter);
-
- unittest::TestAllTypes message;
- string text;
- EXPECT_TRUE(printer.PrintToString(message, &text));
- EXPECT_EQ("", text);
-
- message.mutable_optional_nested_message()->set_bb(1);
- EXPECT_TRUE(printer.PrintToString(message, &text));
- EXPECT_EQ("optional_nested_message {\n custom}\n", text);
-}
-
TEST_F(TextFormatTest, ParseBasic) {
io::ArrayInputStream input_stream(proto_debug_string_.data(),
proto_debug_string_.size());
@@ -1165,93 +1031,29 @@ TEST_F(TextFormatTest, ParseExotic) {
TEST_F(TextFormatTest, PrintFieldsInIndexOrder) {
protobuf_unittest::TestFieldOrderings message;
// Fields are listed in index order instead of field number.
- message.set_my_string("str"); // Field number 11
+ message.set_my_string("Test String"); // Field number 11
message.set_my_int(12345); // Field number 1
message.set_my_float(0.999); // Field number 101
- // Extensions are listed based on the order of extension number.
- // Extension number 12.
- message
- .MutableExtension(
- protobuf_unittest::TestExtensionOrderings2::test_ext_orderings2)
- ->set_my_string("ext_str2");
- // Extension number 13.
- message
- .MutableExtension(
- protobuf_unittest::TestExtensionOrderings1::test_ext_orderings1)
- ->set_my_string("ext_str1");
- // Extension number 14.
- message
- .MutableExtension(protobuf_unittest::TestExtensionOrderings2::
- TestExtensionOrderings3::test_ext_orderings3)
- ->set_my_string("ext_str3");
- // Extension number 50.
- *message.MutableExtension(protobuf_unittest::my_extension_string) = "ext_str0";
-
TextFormat::Printer printer;
string text;
// By default, print in field number order.
- // my_int: 12345
- // my_string: "str"
- // [protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] {
- // my_string: "ext_str2"
- // }
- // [protobuf_unittest.TestExtensionOrderings1.test_ext_orderings1] {
- // my_string: "ext_str1"
- // }
- // [protobuf_unittest.TestExtensionOrderings2.TestExtensionOrderings3.test_ext_orderings3]
- // {
- // my_string: "ext_str3"
- // }
- // [protobuf_unittest.my_extension_string]: "ext_str0"
- // my_float: 0.999
printer.PrintToString(message, &text);
- EXPECT_EQ(
- "my_int: 12345\nmy_string: "
- "\"str\"\n[protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] "
- "{\n my_string: "
- "\"ext_str2\"\n}\n[protobuf_unittest.TestExtensionOrderings1.test_ext_"
- "orderings1] {\n my_string: "
- "\"ext_str1\"\n}\n[protobuf_unittest.TestExtensionOrderings2."
- "TestExtensionOrderings3.test_ext_orderings3] {\n my_string: "
- "\"ext_str3\"\n}\n[protobuf_unittest.my_extension_string]: "
- "\"ext_str0\"\nmy_float: 0.999\n",
- text);
+ EXPECT_EQ("my_int: 12345\nmy_string: \"Test String\"\nmy_float: 0.999\n",
+ text);
// Print in index order.
- // my_string: "str"
- // my_int: 12345
- // my_float: 0.999
- // [protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] {
- // my_string: "ext_str2"
- // }
- // [protobuf_unittest.TestExtensionOrderings1.test_ext_orderings1] {
- // my_string: "ext_str1"
- // }
- // [protobuf_unittest.TestExtensionOrderings2.TestExtensionOrderings3.test_ext_orderings3]
- // {
- // my_string: "ext_str3"
- // }
- // [protobuf_unittest.my_extension_string]: "ext_str0"
printer.SetPrintMessageFieldsInIndexOrder(true);
printer.PrintToString(message, &text);
- EXPECT_EQ(
- "my_string: \"str\"\nmy_int: 12345\nmy_float: "
- "0.999\n[protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] "
- "{\n my_string: "
- "\"ext_str2\"\n}\n[protobuf_unittest.TestExtensionOrderings1.test_ext_"
- "orderings1] {\n my_string: "
- "\"ext_str1\"\n}\n[protobuf_unittest.TestExtensionOrderings2."
- "TestExtensionOrderings3.test_ext_orderings3] {\n my_string: "
- "\"ext_str3\"\n}\n[protobuf_unittest.my_extension_string]: \"ext_str0\"\n",
- text);
+ EXPECT_EQ("my_string: \"Test String\"\nmy_int: 12345\nmy_float: 0.999\n",
+ text);
}
class TextFormatParserTest : public testing::Test {
protected:
void ExpectFailure(const string& input, const string& message, int line,
int col) {
- std::unique_ptr<unittest::TestAllTypes> proto(new unittest::TestAllTypes);
+ google::protobuf::scoped_ptr<unittest::TestAllTypes> proto(new unittest::TestAllTypes);
ExpectFailure(input, message, line, col, proto.get());
}
@@ -1312,7 +1114,7 @@ class TextFormatParserTest : public testing::Test {
};
TEST_F(TextFormatParserTest, ParseInfoTreeBuilding) {
- std::unique_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
+ google::protobuf::scoped_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
const Descriptor* d = message->GetDescriptor();
string stringData =
@@ -1377,7 +1179,7 @@ TEST_F(TextFormatParserTest, ParseInfoTreeBuilding) {
}
TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
- std::unique_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
+ google::protobuf::scoped_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
const Descriptor* d = message->GetDescriptor();
#define EXPECT_FIELD(name, value, valuestring) \
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/timestamp.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/timestamp.pb.cc
index 8e6b5f23f8..44ddc749a8 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/timestamp.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/timestamp.pb.cc
@@ -1,92 +1,108 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/timestamp.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/timestamp.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
class TimestampDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Timestamp>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Timestamp>
+ _instance;
} _Timestamp_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto {
-static void InitDefaultsTimestamp() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- {
- void* ptr = &::google::protobuf::_Timestamp_default_instance_;
- new (ptr) ::google::protobuf::Timestamp();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Timestamp::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Timestamp =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsTimestamp}, {}};
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_Timestamp.base);
-}
+namespace {
::google::protobuf::Metadata file_level_metadata[1];
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+} // namespace
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
+
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Timestamp, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Timestamp, seconds_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Timestamp, nanos_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, seconds_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, nanos_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::Timestamp)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(Timestamp)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Timestamp_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Timestamp_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/timestamp.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/timestamp.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _Timestamp_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Timestamp_default_instance_);}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\037google/protobuf/timestamp.proto\022\017googl"
"e.protobuf\"+\n\tTimestamp\022\017\n\007seconds\030\001 \001(\003"
"\022\r\n\005nanos\030\002 \001(\005B~\n\023com.google.protobufB\016"
@@ -99,10 +115,11 @@ void AddDescriptorsImpl() {
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/timestamp.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -110,14 +127,12 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto
-namespace google {
-namespace protobuf {
+
// ===================================================================
-void Timestamp::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Timestamp::kSecondsFieldNumber;
const int Timestamp::kNanosFieldNumber;
@@ -125,22 +140,24 @@ const int Timestamp::kNanosFieldNumber;
Timestamp::Timestamp()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2ftimestamp_2eproto::scc_info_Timestamp.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Timestamp)
}
Timestamp::Timestamp(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftimestamp_2eproto::scc_info_Timestamp.base);
+ protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Timestamp)
}
Timestamp::Timestamp(const Timestamp& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&seconds_, &from.seconds_,
static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -
@@ -152,6 +169,7 @@ void Timestamp::SharedCtor() {
::memset(&seconds_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&nanos_) -
reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
+ _cached_size_ = 0;
}
Timestamp::~Timestamp() {
@@ -160,7 +178,12 @@ Timestamp::~Timestamp() {
}
void Timestamp::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void Timestamp::ArenaDtor(void* object) {
@@ -170,18 +193,23 @@ void Timestamp::ArenaDtor(void* object) {
void Timestamp::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Timestamp::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Timestamp::descriptor() {
- ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2ftimestamp_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2ftimestamp_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Timestamp& Timestamp::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftimestamp_2eproto::scc_info_Timestamp.base);
+ protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaults();
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)
@@ -201,7 +229,7 @@ bool Timestamp::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Timestamp)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -325,7 +353,9 @@ size_t Timestamp::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -401,22 +431,49 @@ void Timestamp::InternalSwap(Timestamp* other) {
swap(seconds_, other->seconds_);
swap(nanos_, other->nanos_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Timestamp::GetMetadata() const {
protobuf_google_2fprotobuf_2ftimestamp_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2ftimestamp_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Timestamp
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Timestamp* Arena::CreateMaybeMessage< ::google::protobuf::Timestamp >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Timestamp >(arena);
+// int64 seconds = 1;
+void Timestamp::clear_seconds() {
+ seconds_ = GOOGLE_LONGLONG(0);
+}
+::google::protobuf::int64 Timestamp::seconds() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds)
+ return seconds_;
+}
+void Timestamp::set_seconds(::google::protobuf::int64 value) {
+
+ seconds_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds)
+}
+
+// int32 nanos = 2;
+void Timestamp::clear_nanos() {
+ nanos_ = 0;
+}
+::google::protobuf::int32 Timestamp::nanos() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos)
+ return nanos_;
}
+void Timestamp::set_nanos(::google::protobuf::int32 value) {
+
+ nanos_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/timestamp.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/timestamp.pb.h
index daea80f6b7..61596ed477 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/timestamp.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/timestamp.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/timestamp.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2ftimestamp_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2ftimestamp_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,41 +24,37 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2ftimestamp_2eproto LIBPROTOBUF_EXPORT
+namespace google {
+namespace protobuf {
+class Timestamp;
+class TimestampDefaultTypeInternal;
+LIBPROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_;
+} // namespace protobuf
+} // namespace google
+
+namespace google {
+namespace protobuf {
namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto {
-// Internal implementation detail -- do not use these members.
+// Internal implementation detail -- do not call these.
struct LIBPROTOBUF_EXPORT TableStruct {
static const ::google::protobuf::internal::ParseTableField entries[];
static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[1];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
+ static void InitDefaultsImpl();
};
void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
} // namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto
-namespace google {
-namespace protobuf {
-class Timestamp;
-class TimestampDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Timestamp* Arena::CreateMaybeMessage<::google::protobuf::Timestamp>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
// ===================================================================
@@ -88,21 +84,20 @@ class LIBPROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message /* @@pro
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Timestamp& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Timestamp* internal_default_instance() {
return reinterpret_cast<const Timestamp*>(
&_Timestamp_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void UnsafeArenaSwap(Timestamp* other);
@@ -113,33 +108,28 @@ class LIBPROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline Timestamp* New() const final {
- return CreateMaybeMessage<Timestamp>(NULL);
- }
+ inline Timestamp* New() const PROTOBUF_FINAL { return New(NULL); }
- Timestamp* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Timestamp>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Timestamp* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Timestamp& from);
void MergeFrom(const Timestamp& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Timestamp* other);
protected:
explicit Timestamp(::google::protobuf::Arena* arena);
@@ -155,7 +145,7 @@ class LIBPROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message /* @@pro
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -182,14 +172,15 @@ class LIBPROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message /* @@pro
typedef void DestructorSkippable_;
::google::protobuf::int64 seconds_;
::google::protobuf::int32 nanos_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2ftimestamp_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -227,12 +218,14 @@ inline void Timestamp::set_nanos(::google::protobuf::int32 value) {
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2ftimestamp_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/timestamp.proto b/third_party/protobuf/3.4.0/src/google/protobuf/timestamp.proto
new file mode 100644
index 0000000000..b7cbd17502
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/timestamp.proto
@@ -0,0 +1,133 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option cc_enable_arenas = true;
+option go_package = "github.com/golang/protobuf/ptypes/timestamp";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "TimestampProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+
+// A Timestamp represents a point in time independent of any time zone
+// or calendar, represented as seconds and fractions of seconds at
+// nanosecond resolution in UTC Epoch time. It is encoded using the
+// Proleptic Gregorian Calendar which extends the Gregorian calendar
+// backwards to year one. It is encoded assuming all minutes are 60
+// seconds long, i.e. leap seconds are "smeared" so that no leap second
+// table is needed for interpretation. Range is from
+// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
+// By restricting to that range, we ensure that we can convert to
+// and from RFC 3339 date strings.
+// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
+//
+// # Examples
+//
+// Example 1: Compute Timestamp from POSIX `time()`.
+//
+// Timestamp timestamp;
+// timestamp.set_seconds(time(NULL));
+// timestamp.set_nanos(0);
+//
+// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
+//
+// struct timeval tv;
+// gettimeofday(&tv, NULL);
+//
+// Timestamp timestamp;
+// timestamp.set_seconds(tv.tv_sec);
+// timestamp.set_nanos(tv.tv_usec * 1000);
+//
+// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
+//
+// FILETIME ft;
+// GetSystemTimeAsFileTime(&ft);
+// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+//
+// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
+// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
+// Timestamp timestamp;
+// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
+// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
+//
+// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
+//
+// long millis = System.currentTimeMillis();
+//
+// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
+// .setNanos((int) ((millis % 1000) * 1000000)).build();
+//
+//
+// Example 5: Compute Timestamp from current time in Python.
+//
+// timestamp = Timestamp()
+// timestamp.GetCurrentTime()
+//
+// # JSON Mapping
+//
+// In JSON format, the Timestamp type is encoded as a string in the
+// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
+// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
+// where {year} is always expressed using four digits while {month}, {day},
+// {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.
+//
+// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
+// 01:30 UTC on January 15, 2017.
+//
+// In JavaScript, one can convert a Date object to this format using the
+// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
+// method. In Python, a standard `datetime.datetime` object can be converted
+// 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://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime())
+// to obtain a formatter capable of generating timestamps in this format.
+//
+//
+message Timestamp {
+
+ // Represents seconds of UTC time since Unix epoch
+ // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
+ // 9999-12-31T23:59:59Z inclusive.
+ int64 seconds = 1;
+
+ // Non-negative fractions of a second at nanosecond resolution. Negative
+ // second values with fractions must still have non-negative nanos values
+ // that count forward in time. Must be from 0 to 999,999,999
+ // inclusive.
+ int32 nanos = 2;
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/type.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/type.pb.cc
index 130af52a30..abb52395dc 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/type.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/type.pb.cc
@@ -1,245 +1,201 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/type.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/type.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
-namespace protobuf_google_2fprotobuf_2fany_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fany_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_Any;
-} // namespace protobuf_google_2fprotobuf_2fany_2eproto
-namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_SourceContext;
-} // namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto
-namespace protobuf_google_2fprotobuf_2ftype_2eproto {
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2ftype_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_EnumValue;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2ftype_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_Field;
-extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2ftype_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_Option;
-} // namespace protobuf_google_2fprotobuf_2ftype_2eproto
namespace google {
namespace protobuf {
class TypeDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Type>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Type>
+ _instance;
} _Type_default_instance_;
class FieldDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Field>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Field>
+ _instance;
} _Field_default_instance_;
class EnumDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Enum>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Enum>
+ _instance;
} _Enum_default_instance_;
class EnumValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<EnumValue>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<EnumValue>
+ _instance;
} _EnumValue_default_instance_;
class OptionDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Option>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Option>
+ _instance;
} _Option_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2ftype_2eproto {
-static void InitDefaultsType() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_Type_default_instance_;
- new (ptr) ::google::protobuf::Type();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Type::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<3> scc_info_Type =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsType}, {
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Field.base,
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base,
- &protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::scc_info_SourceContext.base,}};
-
-static void InitDefaultsField() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_Field_default_instance_;
- new (ptr) ::google::protobuf::Field();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Field::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_Field =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsField}, {
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base,}};
-static void InitDefaultsEnum() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_Enum_default_instance_;
- new (ptr) ::google::protobuf::Enum();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Enum::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<3> scc_info_Enum =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsEnum}, {
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_EnumValue.base,
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base,
- &protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::scc_info_SourceContext.base,}};
-
-static void InitDefaultsEnumValue() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_EnumValue_default_instance_;
- new (ptr) ::google::protobuf::EnumValue();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::EnumValue::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2ftype_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_EnumValue =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsEnumValue}, {
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base,}};
-static void InitDefaultsOption() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
+namespace {
- {
- void* ptr = &::google::protobuf::_Option_default_instance_;
- new (ptr) ::google::protobuf::Option();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Option::InitAsDefaultInstance();
-}
+::google::protobuf::Metadata file_level_metadata[5];
+const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[3];
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_Option =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsOption}, {
- &protobuf_google_2fprotobuf_2fany_2eproto::scc_info_Any.base,}};
+} // namespace
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_Type.base);
- ::google::protobuf::internal::InitSCC(&scc_info_Field.base);
- ::google::protobuf::internal::InitSCC(&scc_info_Enum.base);
- ::google::protobuf::internal::InitSCC(&scc_info_EnumValue.base);
- ::google::protobuf::internal::InitSCC(&scc_info_Option.base);
-}
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
-::google::protobuf::Metadata file_level_metadata[5];
-const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[3];
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, fields_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, oneofs_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, source_context_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, syntax_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, fields_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, oneofs_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, source_context_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, syntax_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, kind_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, cardinality_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, number_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, type_url_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, oneof_index_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, packed_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, json_name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, default_value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, kind_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, cardinality_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, number_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, type_url_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, oneof_index_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, packed_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, json_name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, default_value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, enumvalue_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, options_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, source_context_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, syntax_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, enumvalue_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, source_context_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, syntax_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, number_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, options_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, number_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, options_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, name_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, name_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, value_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::Type)},
- { 11, -1, sizeof(::google::protobuf::Field)},
- { 26, -1, sizeof(::google::protobuf::Enum)},
- { 36, -1, sizeof(::google::protobuf::EnumValue)},
- { 44, -1, sizeof(::google::protobuf::Option)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(Type)},
+ { 11, -1, sizeof(Field)},
+ { 26, -1, sizeof(Enum)},
+ { 36, -1, sizeof(EnumValue)},
+ { 44, -1, sizeof(Option)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Type_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Field_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Enum_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumValue_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Option_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Type_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Field_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Enum_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_EnumValue_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Option_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/type.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/type.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, file_level_enum_descriptors, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 5);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ ::google::protobuf::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaults();
+ ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults();
+ _Type_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Type_default_instance_);_Field_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Field_default_instance_);_Enum_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Enum_default_instance_);_EnumValue_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_EnumValue_default_instance_);_Option_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Option_default_instance_);_Type_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>(
+ ::google::protobuf::SourceContext::internal_default_instance());
+ _Enum_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>(
+ ::google::protobuf::SourceContext::internal_default_instance());
+ _Option_default_instance_._instance.get_mutable()->value_ = const_cast< ::google::protobuf::Any*>(
+ ::google::protobuf::Any::internal_default_instance());
+}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\032google/protobuf/type.proto\022\017google.pro"
"tobuf\032\031google/protobuf/any.proto\032$google"
"/protobuf/source_context.proto\"\327\001\n\004Type\022"
@@ -285,13 +241,14 @@ void AddDescriptorsImpl() {
descriptor, 1594);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/type.proto", &protobuf_RegisterTypes);
- ::protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors();
- ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors();
+ ::google::protobuf::protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors();
+ ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors();
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -299,9 +256,9 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2ftype_2eproto
-namespace google {
-namespace protobuf {
+
const ::google::protobuf::EnumDescriptor* Field_Kind_descriptor() {
protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_enum_descriptors[0];
@@ -399,9 +356,25 @@ bool Syntax_IsValid(int value) {
// ===================================================================
-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());
+}
+::google::protobuf::SourceContext* Type::_slow_release_source_context() {
+ if (source_context_ == NULL) {
+ return NULL;
+ } else {
+ ::google::protobuf::SourceContext* temp = new ::google::protobuf::SourceContext(*source_context_);
+ source_context_ = NULL;
+ return temp;
+ }
+}
+::google::protobuf::SourceContext* Type::unsafe_arena_release_source_context() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.source_context)
+
+ ::google::protobuf::SourceContext* temp = source_context_;
+ source_context_ = NULL;
+ return temp;
}
void Type::unsafe_arena_set_allocated_source_context(
::google::protobuf::SourceContext* source_context) {
@@ -416,12 +389,6 @@ void Type::unsafe_arena_set_allocated_source_context(
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.source_context)
}
-void Type::clear_source_context() {
- if (GetArenaNoVirtual() == NULL && source_context_ != NULL) {
- delete source_context_;
- }
- source_context_ = NULL;
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Type::kNameFieldNumber;
const int Type::kFieldsFieldNumber;
@@ -433,8 +400,9 @@ const int Type::kSyntaxFieldNumber;
Type::Type()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Type.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Type)
}
@@ -444,7 +412,7 @@ Type::Type(::google::protobuf::Arena* arena)
fields_(arena),
oneofs_(arena),
options_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Type.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Type)
@@ -454,7 +422,8 @@ Type::Type(const Type& from)
_internal_metadata_(NULL),
fields_(from.fields_),
oneofs_(from.oneofs_),
- options_(from.options_) {
+ options_(from.options_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
@@ -475,6 +444,7 @@ void Type::SharedCtor() {
::memset(&source_context_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_));
+ _cached_size_ = 0;
}
Type::~Type() {
@@ -483,8 +453,13 @@ Type::~Type() {
}
void Type::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
- name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
+ name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
if (this != internal_default_instance()) delete source_context_;
}
@@ -495,18 +470,23 @@ void Type::ArenaDtor(void* object) {
void Type::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Type::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Type::descriptor() {
- ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Type& Type::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Type.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
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)
@@ -532,7 +512,7 @@ bool Type::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Type)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -556,7 +536,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_fields()));
} else {
goto handle_unusual;
@@ -585,7 +565,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_options()));
} else {
goto handle_unusual;
@@ -597,7 +577,7 @@ bool Type::MergePartialFromCodedStream(
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_source_context()));
} else {
goto handle_unusual;
@@ -660,9 +640,7 @@ 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;
@@ -679,15 +657,13 @@ 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->_internal_source_context(), output);
+ 5, *this->source_context_, output);
}
// .google.protobuf.Syntax syntax = 6;
@@ -725,7 +701,7 @@ void Type::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->fields_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
2, this->fields(static_cast<int>(i)), deterministic, target);
}
@@ -743,15 +719,15 @@ void Type::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
4, this->options(static_cast<int>(i)), deterministic, target);
}
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 5, this->_internal_source_context(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 5, *this->source_context_, deterministic, target);
}
// .google.protobuf.Syntax syntax = 6;
@@ -783,7 +759,7 @@ size_t Type::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->fields(static_cast<int>(i)));
}
}
@@ -802,7 +778,7 @@ size_t Type::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(static_cast<int>(i)));
}
}
@@ -817,8 +793,8 @@ size_t Type::ByteSizeLong() const {
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *source_context_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->source_context_);
}
// .google.protobuf.Syntax syntax = 6;
@@ -828,7 +804,9 @@ size_t Type::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -907,26 +885,298 @@ void Type::UnsafeArenaSwap(Type* other) {
}
void Type::InternalSwap(Type* other) {
using std::swap;
- CastToBase(&fields_)->InternalSwap(CastToBase(&other->fields_));
- oneofs_.InternalSwap(CastToBase(&other->oneofs_));
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ fields_.InternalSwap(&other->fields_);
+ oneofs_.InternalSwap(&other->oneofs_);
+ options_.InternalSwap(&other->options_);
+ name_.Swap(&other->name_);
swap(source_context_, other->source_context_);
swap(syntax_, other->syntax_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Type::GetMetadata() const {
protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Type
-// ===================================================================
+// string name = 1;
+void Type::clear_name() {
+ name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& Type::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Type.name)
+ return name_.Get();
+}
+void Type::set_name(const ::std::string& value) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.Type.name)
+}
+#if LANG_CXX11
+void Type::set_name(::std::string&& value) {
+
+ name_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Type.name)
+}
+#endif
+void Type::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Type.name)
+}
+void Type::set_name(const char* value,
+ size_t size) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.name)
+}
+::std::string* Type::mutable_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Type.name)
+ return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Type::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Type.name)
+
+ return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Type::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void Type::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name)
+}
+void Type::unsafe_arena_set_allocated_name(
+ ::std::string* name) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ name, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.name)
+}
-void Field::InitAsDefaultInstance() {
+// repeated .google.protobuf.Field fields = 2;
+int Type::fields_size() const {
+ return fields_.size();
+}
+void Type::clear_fields() {
+ fields_.Clear();
+}
+const ::google::protobuf::Field& Type::fields(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Type.fields)
+ return fields_.Get(index);
+}
+::google::protobuf::Field* Type::mutable_fields(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Type.fields)
+ return fields_.Mutable(index);
+}
+::google::protobuf::Field* Type::add_fields() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Type.fields)
+ return fields_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >*
+Type::mutable_fields() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.fields)
+ return &fields_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >&
+Type::fields() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Type.fields)
+ return fields_;
+}
+
+// repeated string oneofs = 3;
+int Type::oneofs_size() const {
+ return oneofs_.size();
+}
+void Type::clear_oneofs() {
+ oneofs_.Clear();
+}
+const ::std::string& Type::oneofs(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Type.oneofs)
+ return oneofs_.Get(index);
+}
+::std::string* Type::mutable_oneofs(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Type.oneofs)
+ return oneofs_.Mutable(index);
+}
+void Type::set_oneofs(int index, const ::std::string& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.Type.oneofs)
+ oneofs_.Mutable(index)->assign(value);
+}
+#if LANG_CXX11
+void Type::set_oneofs(int index, ::std::string&& value) {
+ // @@protoc_insertion_point(field_set:google.protobuf.Type.oneofs)
+ oneofs_.Mutable(index)->assign(std::move(value));
+}
+#endif
+void Type::set_oneofs(int index, const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ oneofs_.Mutable(index)->assign(value);
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Type.oneofs)
+}
+void Type::set_oneofs(int index, const char* value, size_t size) {
+ oneofs_.Mutable(index)->assign(
+ reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.oneofs)
+}
+::std::string* Type::add_oneofs() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.Type.oneofs)
+ return oneofs_.Add();
}
+void Type::add_oneofs(const ::std::string& value) {
+ oneofs_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add:google.protobuf.Type.oneofs)
+}
+#if LANG_CXX11
+void Type::add_oneofs(::std::string&& value) {
+ oneofs_.Add(std::move(value));
+ // @@protoc_insertion_point(field_add:google.protobuf.Type.oneofs)
+}
+#endif
+void Type::add_oneofs(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+ oneofs_.Add()->assign(value);
+ // @@protoc_insertion_point(field_add_char:google.protobuf.Type.oneofs)
+}
+void Type::add_oneofs(const char* value, size_t size) {
+ oneofs_.Add()->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_add_pointer:google.protobuf.Type.oneofs)
+}
+const ::google::protobuf::RepeatedPtrField< ::std::string>&
+Type::oneofs() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Type.oneofs)
+ return oneofs_;
+}
+::google::protobuf::RepeatedPtrField< ::std::string>*
+Type::mutable_oneofs() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.oneofs)
+ return &oneofs_;
+}
+
+// repeated .google.protobuf.Option options = 4;
+int Type::options_size() const {
+ return options_.size();
+}
+void Type::clear_options() {
+ options_.Clear();
+}
+const ::google::protobuf::Option& Type::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Type.options)
+ return options_.Get(index);
+}
+::google::protobuf::Option* Type::mutable_options(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Type.options)
+ return options_.Mutable(index);
+}
+::google::protobuf::Option* Type::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Type.options)
+ return options_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
+Type::mutable_options() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.options)
+ return &options_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
+Type::options() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Type.options)
+ return options_;
+}
+
+// .google.protobuf.SourceContext source_context = 5;
+bool Type::has_source_context() const {
+ return this != internal_default_instance() && source_context_ != NULL;
+}
+void Type::clear_source_context() {
+ if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_;
+ source_context_ = NULL;
+}
+const ::google::protobuf::SourceContext& Type::source_context() const {
+ const ::google::protobuf::SourceContext* p = source_context_;
+ // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>(
+ &::google::protobuf::_SourceContext_default_instance_);
+}
+::google::protobuf::SourceContext* Type::mutable_source_context() {
+
+ if (source_context_ == NULL) {
+ _slow_mutable_source_context();
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context)
+ return source_context_;
+}
+::google::protobuf::SourceContext* Type::release_source_context() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context)
+
+ if (GetArenaNoVirtual() != NULL) {
+ return _slow_release_source_context();
+ } else {
+ ::google::protobuf::SourceContext* temp = source_context_;
+ source_context_ = NULL;
+ return temp;
+ }
+}
+ void Type::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
+ ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+ if (message_arena == NULL) {
+ delete source_context_;
+ }
+ if (source_context != NULL) {
+ if (message_arena != NULL) {
+ message_arena->Own(source_context);
+ }
+ }
+ source_context_ = source_context;
+ if (source_context) {
+
+ } else {
+
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.source_context)
+}
+
+// .google.protobuf.Syntax syntax = 6;
+void Type::clear_syntax() {
+ syntax_ = 0;
+}
+::google::protobuf::Syntax Type::syntax() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Type.syntax)
+ return static_cast< ::google::protobuf::Syntax >(syntax_);
+}
+void Type::set_syntax(::google::protobuf::Syntax value) {
+
+ syntax_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Type.syntax)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Field::kKindFieldNumber;
const int Field::kCardinalityFieldNumber;
@@ -942,8 +1192,9 @@ const int Field::kDefaultValueFieldNumber;
Field::Field()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Field.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Field)
}
@@ -951,7 +1202,7 @@ Field::Field(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
options_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Field.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Field)
@@ -959,7 +1210,8 @@ Field::Field(::google::protobuf::Arena* arena)
Field::Field(const Field& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- options_(from.options_) {
+ options_(from.options_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
@@ -995,6 +1247,7 @@ void Field::SharedCtor() {
::memset(&kind_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&packed_) -
reinterpret_cast<char*>(&kind_)) + sizeof(packed_));
+ _cached_size_ = 0;
}
Field::~Field() {
@@ -1003,11 +1256,16 @@ Field::~Field() {
}
void Field::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
- name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- json_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- default_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
+ name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
+ type_url_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
+ json_name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
+ default_value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
}
void Field::ArenaDtor(void* object) {
@@ -1017,18 +1275,23 @@ void Field::ArenaDtor(void* object) {
void Field::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Field::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Field::descriptor() {
- ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Field& Field::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Field.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
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)
@@ -1053,7 +1316,7 @@ bool Field::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Field)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1165,7 +1428,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_options()));
} else {
goto handle_unusual;
@@ -1282,9 +1545,7 @@ 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;
@@ -1374,7 +1635,7 @@ void Field::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
9, this->options(static_cast<int>(i)), deterministic, target);
}
@@ -1423,7 +1684,7 @@ size_t Field::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(static_cast<int>(i)));
}
}
@@ -1488,7 +1749,9 @@ size_t Field::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1583,34 +1846,451 @@ void Field::UnsafeArenaSwap(Field* other) {
}
void Field::InternalSwap(Field* other) {
using std::swap;
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- type_url_.Swap(&other->type_url_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- json_name_.Swap(&other->json_name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
- default_value_.Swap(&other->default_value_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ options_.InternalSwap(&other->options_);
+ name_.Swap(&other->name_);
+ type_url_.Swap(&other->type_url_);
+ json_name_.Swap(&other->json_name_);
+ default_value_.Swap(&other->default_value_);
swap(kind_, other->kind_);
swap(cardinality_, other->cardinality_);
swap(number_, other->number_);
swap(oneof_index_, other->oneof_index_);
swap(packed_, other->packed_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Field::GetMetadata() const {
protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Field
+
+// .google.protobuf.Field.Kind kind = 1;
+void Field::clear_kind() {
+ kind_ = 0;
+}
+::google::protobuf::Field_Kind Field::kind() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.kind)
+ return static_cast< ::google::protobuf::Field_Kind >(kind_);
+}
+void Field::set_kind(::google::protobuf::Field_Kind value) {
+
+ kind_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.kind)
+}
+
+// .google.protobuf.Field.Cardinality cardinality = 2;
+void Field::clear_cardinality() {
+ cardinality_ = 0;
+}
+::google::protobuf::Field_Cardinality Field::cardinality() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.cardinality)
+ return static_cast< ::google::protobuf::Field_Cardinality >(cardinality_);
+}
+void Field::set_cardinality(::google::protobuf::Field_Cardinality value) {
+
+ cardinality_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.cardinality)
+}
+
+// int32 number = 3;
+void Field::clear_number() {
+ number_ = 0;
+}
+::google::protobuf::int32 Field::number() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.number)
+ return number_;
+}
+void Field::set_number(::google::protobuf::int32 value) {
+
+ number_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.number)
+}
+
+// string name = 4;
+void Field::clear_name() {
+ name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& Field::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.name)
+ return name_.Get();
+}
+void Field::set_name(const ::std::string& value) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.name)
+}
+#if LANG_CXX11
+void Field::set_name(::std::string&& value) {
+
+ name_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Field.name)
+}
+#endif
+void Field::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Field.name)
+}
+void Field::set_name(const char* value,
+ size_t size) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.name)
+}
+::std::string* Field::mutable_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.name)
+ return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Field::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Field.name)
+
+ return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Field::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void Field::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name)
+}
+void Field::unsafe_arena_set_allocated_name(
+ ::std::string* name) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ name, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.name)
+}
+
+// string type_url = 6;
+void Field::clear_type_url() {
+ type_url_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& Field::type_url() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.type_url)
+ return type_url_.Get();
+}
+void Field::set_type_url(const ::std::string& value) {
+
+ type_url_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.type_url)
+}
+#if LANG_CXX11
+void Field::set_type_url(::std::string&& value) {
+
+ type_url_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Field.type_url)
+}
+#endif
+void Field::set_type_url(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ type_url_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Field.type_url)
+}
+void Field::set_type_url(const char* value,
+ size_t size) {
+
+ type_url_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.type_url)
+}
+::std::string* Field::mutable_type_url() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.type_url)
+ return type_url_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Field::release_type_url() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Field.type_url)
+
+ return type_url_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Field::unsafe_arena_release_type_url() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.type_url)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return type_url_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void Field::set_allocated_type_url(::std::string* type_url) {
+ if (type_url != NULL) {
+
+ } else {
+
+ }
+ type_url_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url)
+}
+void Field::unsafe_arena_set_allocated_type_url(
+ ::std::string* type_url) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (type_url != NULL) {
+
+ } else {
+
+ }
+ type_url_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ type_url, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.type_url)
}
+// int32 oneof_index = 7;
+void Field::clear_oneof_index() {
+ oneof_index_ = 0;
+}
+::google::protobuf::int32 Field::oneof_index() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index)
+ return oneof_index_;
+}
+void Field::set_oneof_index(::google::protobuf::int32 value) {
+
+ oneof_index_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index)
+}
+
+// bool packed = 8;
+void Field::clear_packed() {
+ packed_ = false;
+}
+bool Field::packed() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.packed)
+ return packed_;
+}
+void Field::set_packed(bool value) {
+
+ packed_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.packed)
+}
+
+// repeated .google.protobuf.Option options = 9;
+int Field::options_size() const {
+ return options_.size();
+}
+void Field::clear_options() {
+ options_.Clear();
+}
+const ::google::protobuf::Option& Field::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.options)
+ return options_.Get(index);
+}
+::google::protobuf::Option* Field::mutable_options(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.options)
+ return options_.Mutable(index);
+}
+::google::protobuf::Option* Field::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Field.options)
+ return options_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
+Field::mutable_options() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Field.options)
+ return &options_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
+Field::options() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Field.options)
+ return options_;
+}
+
+// string json_name = 10;
+void Field::clear_json_name() {
+ json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& Field::json_name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.json_name)
+ return json_name_.Get();
+}
+void Field::set_json_name(const ::std::string& value) {
+
+ json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.json_name)
+}
+#if LANG_CXX11
+void Field::set_json_name(::std::string&& value) {
+
+ json_name_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Field.json_name)
+}
+#endif
+void Field::set_json_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Field.json_name)
+}
+void Field::set_json_name(const char* value,
+ size_t size) {
+
+ json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.json_name)
+}
+::std::string* Field::mutable_json_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.json_name)
+ return json_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Field::release_json_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Field.json_name)
+
+ return json_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Field::unsafe_arena_release_json_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.json_name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return json_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void Field::set_allocated_json_name(::std::string* json_name) {
+ if (json_name != NULL) {
+
+ } else {
+
+ }
+ json_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name)
+}
+void Field::unsafe_arena_set_allocated_json_name(
+ ::std::string* json_name) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (json_name != NULL) {
+
+ } else {
+
+ }
+ json_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ json_name, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.json_name)
+}
+
+// string default_value = 11;
+void Field::clear_default_value() {
+ default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& Field::default_value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.default_value)
+ return default_value_.Get();
+}
+void Field::set_default_value(const ::std::string& value) {
+
+ default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.default_value)
+}
+#if LANG_CXX11
+void Field::set_default_value(::std::string&& value) {
+
+ default_value_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Field.default_value)
+}
+#endif
+void Field::set_default_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Field.default_value)
+}
+void Field::set_default_value(const char* value,
+ size_t size) {
+
+ default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.default_value)
+}
+::std::string* Field::mutable_default_value() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.default_value)
+ return default_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Field::release_default_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Field.default_value)
+
+ return default_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Field::unsafe_arena_release_default_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.default_value)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return default_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void Field::set_allocated_default_value(::std::string* default_value) {
+ if (default_value != NULL) {
+
+ } else {
+
+ }
+ default_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value)
+}
+void Field::unsafe_arena_set_allocated_default_value(
+ ::std::string* default_value) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (default_value != NULL) {
+
+ } else {
+
+ }
+ default_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ default_value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.default_value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-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());
+}
+::google::protobuf::SourceContext* Enum::_slow_release_source_context() {
+ if (source_context_ == NULL) {
+ return NULL;
+ } else {
+ ::google::protobuf::SourceContext* temp = new ::google::protobuf::SourceContext(*source_context_);
+ source_context_ = NULL;
+ return temp;
+ }
+}
+::google::protobuf::SourceContext* Enum::unsafe_arena_release_source_context() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.source_context)
+
+ ::google::protobuf::SourceContext* temp = source_context_;
+ source_context_ = NULL;
+ return temp;
}
void Enum::unsafe_arena_set_allocated_source_context(
::google::protobuf::SourceContext* source_context) {
@@ -1625,12 +2305,6 @@ void Enum::unsafe_arena_set_allocated_source_context(
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.source_context)
}
-void Enum::clear_source_context() {
- if (GetArenaNoVirtual() == NULL && source_context_ != NULL) {
- delete source_context_;
- }
- source_context_ = NULL;
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Enum::kNameFieldNumber;
const int Enum::kEnumvalueFieldNumber;
@@ -1641,8 +2315,9 @@ const int Enum::kSyntaxFieldNumber;
Enum::Enum()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Enum.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Enum)
}
@@ -1651,7 +2326,7 @@ Enum::Enum(::google::protobuf::Arena* arena)
_internal_metadata_(arena),
enumvalue_(arena),
options_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Enum.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Enum)
@@ -1660,7 +2335,8 @@ Enum::Enum(const Enum& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
enumvalue_(from.enumvalue_),
- options_(from.options_) {
+ options_(from.options_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
@@ -1681,6 +2357,7 @@ void Enum::SharedCtor() {
::memset(&source_context_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_));
+ _cached_size_ = 0;
}
Enum::~Enum() {
@@ -1689,8 +2366,13 @@ Enum::~Enum() {
}
void Enum::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
- name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
+ name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
if (this != internal_default_instance()) delete source_context_;
}
@@ -1701,18 +2383,23 @@ void Enum::ArenaDtor(void* object) {
void Enum::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Enum::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Enum::descriptor() {
- ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Enum& Enum::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Enum.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
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)
@@ -1737,7 +2424,7 @@ bool Enum::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Enum)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1761,7 +2448,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_enumvalue()));
} else {
goto handle_unusual;
@@ -1773,7 +2460,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_options()));
} else {
goto handle_unusual;
@@ -1785,7 +2472,7 @@ bool Enum::MergePartialFromCodedStream(
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_source_context()));
} else {
goto handle_unusual;
@@ -1848,24 +2535,20 @@ 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->_internal_source_context(), output);
+ 4, *this->source_context_, output);
}
// .google.protobuf.Syntax syntax = 5;
@@ -1903,7 +2586,7 @@ void Enum::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->enumvalue_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
2, this->enumvalue(static_cast<int>(i)), deterministic, target);
}
@@ -1911,15 +2594,15 @@ void Enum::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
3, this->options(static_cast<int>(i)), deterministic, target);
}
// .google.protobuf.SourceContext source_context = 4;
if (this->has_source_context()) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 4, this->_internal_source_context(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 4, *this->source_context_, deterministic, target);
}
// .google.protobuf.Syntax syntax = 5;
@@ -1951,7 +2634,7 @@ size_t Enum::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->enumvalue(static_cast<int>(i)));
}
}
@@ -1962,7 +2645,7 @@ size_t Enum::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(static_cast<int>(i)));
}
}
@@ -1977,8 +2660,8 @@ size_t Enum::ByteSizeLong() const {
// .google.protobuf.SourceContext source_context = 4;
if (this->has_source_context()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *source_context_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->source_context_);
}
// .google.protobuf.Syntax syntax = 5;
@@ -1988,7 +2671,9 @@ size_t Enum::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -2066,25 +2751,228 @@ void Enum::UnsafeArenaSwap(Enum* other) {
}
void Enum::InternalSwap(Enum* other) {
using std::swap;
- CastToBase(&enumvalue_)->InternalSwap(CastToBase(&other->enumvalue_));
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ enumvalue_.InternalSwap(&other->enumvalue_);
+ options_.InternalSwap(&other->options_);
+ name_.Swap(&other->name_);
swap(source_context_, other->source_context_);
swap(syntax_, other->syntax_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Enum::GetMetadata() const {
protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Enum
-// ===================================================================
+// string name = 1;
+void Enum::clear_name() {
+ name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& Enum::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Enum.name)
+ return name_.Get();
+}
+void Enum::set_name(const ::std::string& value) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.Enum.name)
+}
+#if LANG_CXX11
+void Enum::set_name(::std::string&& value) {
+
+ name_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Enum.name)
+}
+#endif
+void Enum::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Enum.name)
+}
+void Enum::set_name(const char* value,
+ size_t size) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Enum.name)
+}
+::std::string* Enum::mutable_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.name)
+ return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Enum::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Enum.name)
+
+ return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Enum::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void Enum::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name)
+}
+void Enum::unsafe_arena_set_allocated_name(
+ ::std::string* name) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ name, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.name)
+}
+
+// repeated .google.protobuf.EnumValue enumvalue = 2;
+int Enum::enumvalue_size() const {
+ return enumvalue_.size();
+}
+void Enum::clear_enumvalue() {
+ enumvalue_.Clear();
+}
+const ::google::protobuf::EnumValue& Enum::enumvalue(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue)
+ return enumvalue_.Get(index);
+}
+::google::protobuf::EnumValue* Enum::mutable_enumvalue(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.enumvalue)
+ return enumvalue_.Mutable(index);
+}
+::google::protobuf::EnumValue* Enum::add_enumvalue() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue)
+ return enumvalue_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >*
+Enum::mutable_enumvalue() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.enumvalue)
+ return &enumvalue_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >&
+Enum::enumvalue() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Enum.enumvalue)
+ return enumvalue_;
+}
+
+// repeated .google.protobuf.Option options = 3;
+int Enum::options_size() const {
+ return options_.size();
+}
+void Enum::clear_options() {
+ options_.Clear();
+}
+const ::google::protobuf::Option& Enum::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Enum.options)
+ return options_.Get(index);
+}
+::google::protobuf::Option* Enum::mutable_options(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.options)
+ return options_.Mutable(index);
+}
+::google::protobuf::Option* Enum::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Enum.options)
+ return options_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
+Enum::mutable_options() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.options)
+ return &options_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
+Enum::options() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.Enum.options)
+ return options_;
+}
+
+// .google.protobuf.SourceContext source_context = 4;
+bool Enum::has_source_context() const {
+ return this != internal_default_instance() && source_context_ != NULL;
+}
+void Enum::clear_source_context() {
+ if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_;
+ source_context_ = NULL;
+}
+const ::google::protobuf::SourceContext& Enum::source_context() const {
+ const ::google::protobuf::SourceContext* p = source_context_;
+ // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>(
+ &::google::protobuf::_SourceContext_default_instance_);
+}
+::google::protobuf::SourceContext* Enum::mutable_source_context() {
+
+ if (source_context_ == NULL) {
+ _slow_mutable_source_context();
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context)
+ return source_context_;
+}
+::google::protobuf::SourceContext* Enum::release_source_context() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context)
+
+ if (GetArenaNoVirtual() != NULL) {
+ return _slow_release_source_context();
+ } else {
+ ::google::protobuf::SourceContext* temp = source_context_;
+ source_context_ = NULL;
+ return temp;
+ }
+}
+ void Enum::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
+ ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+ if (message_arena == NULL) {
+ delete source_context_;
+ }
+ if (source_context != NULL) {
+ if (message_arena != NULL) {
+ message_arena->Own(source_context);
+ }
+ }
+ source_context_ = source_context;
+ if (source_context) {
+
+ } else {
+
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.source_context)
+}
-void EnumValue::InitAsDefaultInstance() {
+// .google.protobuf.Syntax syntax = 5;
+void Enum::clear_syntax() {
+ syntax_ = 0;
+}
+::google::protobuf::Syntax Enum::syntax() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Enum.syntax)
+ return static_cast< ::google::protobuf::Syntax >(syntax_);
}
+void Enum::set_syntax(::google::protobuf::Syntax value) {
+
+ syntax_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Enum.syntax)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// ===================================================================
+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumValue::kNameFieldNumber;
const int EnumValue::kNumberFieldNumber;
@@ -2093,8 +2981,9 @@ const int EnumValue::kOptionsFieldNumber;
EnumValue::EnumValue()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_EnumValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumValue)
}
@@ -2102,7 +2991,7 @@ EnumValue::EnumValue(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
options_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_EnumValue.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValue)
@@ -2110,7 +2999,8 @@ EnumValue::EnumValue(::google::protobuf::Arena* arena)
EnumValue::EnumValue(const EnumValue& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
- options_(from.options_) {
+ options_(from.options_),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
@@ -2124,6 +3014,7 @@ EnumValue::EnumValue(const EnumValue& from)
void EnumValue::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
number_ = 0;
+ _cached_size_ = 0;
}
EnumValue::~EnumValue() {
@@ -2132,8 +3023,13 @@ EnumValue::~EnumValue() {
}
void EnumValue::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
- name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
+ name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
}
void EnumValue::ArenaDtor(void* object) {
@@ -2143,18 +3039,23 @@ void EnumValue::ArenaDtor(void* object) {
void EnumValue::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void EnumValue::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumValue::descriptor() {
- ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumValue& EnumValue::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_EnumValue.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
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)
@@ -2174,7 +3075,7 @@ bool EnumValue::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumValue)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -2212,7 +3113,7 @@ 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(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_options()));
} else {
goto handle_unusual;
@@ -2265,9 +3166,7 @@ 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())) {
@@ -2304,7 +3203,7 @@ void EnumValue::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
+ InternalWriteMessageNoVirtualToArray(
3, this->options(static_cast<int>(i)), deterministic, target);
}
@@ -2331,7 +3230,7 @@ size_t EnumValue::ByteSizeLong() const {
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSize(
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(static_cast<int>(i)));
}
}
@@ -2351,7 +3250,9 @@ size_t EnumValue::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -2425,24 +3326,163 @@ void EnumValue::UnsafeArenaSwap(EnumValue* other) {
}
void EnumValue::InternalSwap(EnumValue* other) {
using std::swap;
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ options_.InternalSwap(&other->options_);
+ name_.Swap(&other->name_);
swap(number_, other->number_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata EnumValue::GetMetadata() const {
protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// EnumValue
+
+// string name = 1;
+void EnumValue::clear_name() {
+ name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& EnumValue::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.name)
+ return name_.Get();
+}
+void EnumValue::set_name(const ::std::string& value) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name)
+}
+#if LANG_CXX11
+void EnumValue::set_name(::std::string&& value) {
+
+ name_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumValue.name)
+}
+#endif
+void EnumValue::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.EnumValue.name)
+}
+void EnumValue::set_name(const char* value,
+ size_t size) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValue.name)
+}
+::std::string* EnumValue::mutable_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.name)
+ return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* EnumValue::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumValue.name)
+
+ return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* EnumValue::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValue.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void EnumValue::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name)
+}
+void EnumValue::unsafe_arena_set_allocated_name(
+ ::std::string* name) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ name, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValue.name)
}
+// int32 number = 2;
+void EnumValue::clear_number() {
+ number_ = 0;
+}
+::google::protobuf::int32 EnumValue::number() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number)
+ return number_;
+}
+void EnumValue::set_number(::google::protobuf::int32 value) {
+
+ number_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number)
+}
+
+// repeated .google.protobuf.Option options = 3;
+int EnumValue::options_size() const {
+ return options_.size();
+}
+void EnumValue::clear_options() {
+ options_.Clear();
+}
+const ::google::protobuf::Option& EnumValue::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options)
+ return options_.Get(index);
+}
+::google::protobuf::Option* EnumValue::mutable_options(int index) {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.options)
+ return options_.Mutable(index);
+}
+::google::protobuf::Option* EnumValue::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options)
+ return options_.Add();
+}
+::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
+EnumValue::mutable_options() {
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValue.options)
+ return &options_;
+}
+const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
+EnumValue::options() const {
+ // @@protoc_insertion_point(field_list:google.protobuf.EnumValue.options)
+ return options_;
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-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());
+}
+::google::protobuf::Any* Option::_slow_release_value() {
+ if (value_ == NULL) {
+ return NULL;
+ } else {
+ ::google::protobuf::Any* temp = new ::google::protobuf::Any(*value_);
+ value_ = NULL;
+ return temp;
+ }
+}
+::google::protobuf::Any* Option::unsafe_arena_release_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.value)
+
+ ::google::protobuf::Any* temp = value_;
+ value_ = NULL;
+ return temp;
}
void Option::unsafe_arena_set_allocated_value(
::google::protobuf::Any* value) {
@@ -2457,12 +3497,6 @@ void Option::unsafe_arena_set_allocated_value(
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.value)
}
-void Option::clear_value() {
- if (GetArenaNoVirtual() == NULL && value_ != NULL) {
- delete value_;
- }
- value_ = NULL;
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Option::kNameFieldNumber;
const int Option::kValueFieldNumber;
@@ -2470,22 +3504,24 @@ const int Option::kValueFieldNumber;
Option::Option()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Option)
}
Option::Option(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Option)
}
Option::Option(const Option& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
@@ -2503,6 +3539,7 @@ Option::Option(const Option& from)
void Option::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
value_ = NULL;
+ _cached_size_ = 0;
}
Option::~Option() {
@@ -2511,8 +3548,13 @@ Option::~Option() {
}
void Option::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
- name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
+ name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
if (this != internal_default_instance()) delete value_;
}
@@ -2523,18 +3565,23 @@ void Option::ArenaDtor(void* object) {
void Option::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Option::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Option::descriptor() {
- ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Option& Option::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2ftype_2eproto::scc_info_Option.base);
+ protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults();
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)
@@ -2556,7 +3603,7 @@ bool Option::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Option)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -2580,7 +3627,7 @@ bool Option::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_value()));
} else {
goto handle_unusual;
@@ -2627,7 +3674,7 @@ void Option::SerializeWithCachedSizes(
// .google.protobuf.Any value = 2;
if (this->has_value()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->_internal_value(), output);
+ 2, *this->value_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -2658,8 +3705,8 @@ void Option::SerializeWithCachedSizes(
// .google.protobuf.Any value = 2;
if (this->has_value()) {
target = ::google::protobuf::internal::WireFormatLite::
- InternalWriteMessageToArray(
- 2, this->_internal_value(), deterministic, target);
+ InternalWriteMessageNoVirtualToArray(
+ 2, *this->value_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -2689,12 +3736,14 @@ size_t Option::ByteSizeLong() const {
// .google.protobuf.Any value = 2;
if (this->has_value()) {
total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSize(
- *value_);
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->value_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -2767,38 +3816,151 @@ void Option::UnsafeArenaSwap(Option* other) {
}
void Option::InternalSwap(Option* other) {
using std::swap;
- name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ name_.Swap(&other->name_);
swap(value_, other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Option::GetMetadata() const {
protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Option
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Type* Arena::CreateMaybeMessage< ::google::protobuf::Type >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Type >(arena);
+// string name = 1;
+void Option::clear_name() {
+ name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& Option::name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Option.name)
+ return name_.Get();
+}
+void Option::set_name(const ::std::string& value) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.Option.name)
+}
+#if LANG_CXX11
+void Option::set_name(::std::string&& value) {
+
+ name_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Option.name)
+}
+#endif
+void Option::set_name(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Option.name)
+}
+void Option::set_name(const char* value,
+ size_t size) {
+
+ name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Option.name)
+}
+::std::string* Option::mutable_name() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Option.name)
+ return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Option::release_name() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Option.name)
+
+ return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* Option::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void Option::set_allocated_name(::std::string* name) {
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name)
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Field* Arena::CreateMaybeMessage< ::google::protobuf::Field >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Field >(arena);
+void Option::unsafe_arena_set_allocated_name(
+ ::std::string* name) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (name != NULL) {
+
+ } else {
+
+ }
+ name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ name, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.name)
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Enum* Arena::CreateMaybeMessage< ::google::protobuf::Enum >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Enum >(arena);
+
+// .google.protobuf.Any value = 2;
+bool Option::has_value() const {
+ return this != internal_default_instance() && value_ != NULL;
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumValue* Arena::CreateMaybeMessage< ::google::protobuf::EnumValue >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::EnumValue >(arena);
+void Option::clear_value() {
+ if (GetArenaNoVirtual() == NULL && value_ != NULL) delete value_;
+ value_ = NULL;
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Option* Arena::CreateMaybeMessage< ::google::protobuf::Option >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Option >(arena);
+const ::google::protobuf::Any& Option::value() const {
+ const ::google::protobuf::Any* p = value_;
+ // @@protoc_insertion_point(field_get:google.protobuf.Option.value)
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::Any*>(
+ &::google::protobuf::_Any_default_instance_);
+}
+::google::protobuf::Any* Option::mutable_value() {
+
+ if (value_ == NULL) {
+ _slow_mutable_value();
+ }
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value)
+ return value_;
+}
+::google::protobuf::Any* Option::release_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Option.value)
+
+ if (GetArenaNoVirtual() != NULL) {
+ return _slow_release_value();
+ } else {
+ ::google::protobuf::Any* temp = value_;
+ value_ = NULL;
+ return temp;
+ }
}
+ void Option::set_allocated_value(::google::protobuf::Any* value) {
+ ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+ if (message_arena == NULL) {
+ delete value_;
+ }
+ if (value != NULL) {
+ if (message_arena != NULL) {
+ message_arena->Own(value);
+ }
+ }
+ value_ = value;
+ if (value) {
+
+ } else {
+
+ }
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/type.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/type.pb.h
index cbd0cdccce..cc76cc97df 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/type.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/type.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/type.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2ftype_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2ftype_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,7 +24,6 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
@@ -34,20 +33,6 @@
#include <google/protobuf/any.pb.h>
#include <google/protobuf/source_context.pb.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2ftype_2eproto LIBPROTOBUF_EXPORT
-
-namespace protobuf_google_2fprotobuf_2ftype_2eproto {
-// Internal implementation detail -- do not use these members.
-struct LIBPROTOBUF_EXPORT TableStruct {
- static const ::google::protobuf::internal::ParseTableField entries[];
- static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[5];
- static const ::google::protobuf::internal::FieldMetadata field_metadata[];
- static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
-};
-void LIBPROTOBUF_EXPORT AddDescriptors();
-} // namespace protobuf_google_2fprotobuf_2ftype_2eproto
namespace google {
namespace protobuf {
class Enum;
@@ -67,18 +52,25 @@ class TypeDefaultTypeInternal;
LIBPROTOBUF_EXPORT extern TypeDefaultTypeInternal _Type_default_instance_;
} // namespace protobuf
} // namespace google
-namespace google {
-namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Enum* Arena::CreateMaybeMessage<::google::protobuf::Enum>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumValue* Arena::CreateMaybeMessage<::google::protobuf::EnumValue>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Field* Arena::CreateMaybeMessage<::google::protobuf::Field>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Option* Arena::CreateMaybeMessage<::google::protobuf::Option>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Type* Arena::CreateMaybeMessage<::google::protobuf::Type>(Arena*);
-} // namespace protobuf
-} // namespace google
+
namespace google {
namespace protobuf {
+namespace protobuf_google_2fprotobuf_2ftype_2eproto {
+// Internal implementation detail -- do not call these.
+struct LIBPROTOBUF_EXPORT TableStruct {
+ static const ::google::protobuf::internal::ParseTableField entries[];
+ static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
+ static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+ static const ::google::protobuf::internal::SerializationTable serialization_table[];
+ static void InitDefaultsImpl();
+};
+void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
+} // namespace protobuf_google_2fprotobuf_2ftype_2eproto
+
enum Field_Kind {
Field_Kind_TYPE_UNKNOWN = 0,
Field_Kind_TYPE_DOUBLE = 1,
@@ -189,21 +181,20 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Type& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Type* internal_default_instance() {
return reinterpret_cast<const Type*>(
&_Type_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void UnsafeArenaSwap(Type* other);
@@ -214,33 +205,28 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
// implements Message ----------------------------------------------
- inline Type* New() const final {
- return CreateMaybeMessage<Type>(NULL);
- }
+ inline Type* New() const PROTOBUF_FINAL { return New(NULL); }
- Type* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Type>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Type* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Type& from);
void MergeFrom(const Type& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Type* other);
protected:
explicit Type(::google::protobuf::Arena* arena);
@@ -256,7 +242,7 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -266,11 +252,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;
@@ -300,11 +286,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;
@@ -321,13 +307,7 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_name(
::std::string* name);
@@ -336,15 +316,16 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
void clear_source_context();
static const int kSourceContextFieldNumber = 5;
private:
- const ::google::protobuf::SourceContext& _internal_source_context() const;
+ void _slow_mutable_source_context();
+ ::google::protobuf::SourceContext* _slow_release_source_context();
public:
const ::google::protobuf::SourceContext& source_context() const;
- ::google::protobuf::SourceContext* release_source_context();
::google::protobuf::SourceContext* mutable_source_context();
+ ::google::protobuf::SourceContext* release_source_context();
void set_allocated_source_context(::google::protobuf::SourceContext* source_context);
+ ::google::protobuf::SourceContext* unsafe_arena_release_source_context();
void unsafe_arena_set_allocated_source_context(
::google::protobuf::SourceContext* source_context);
- ::google::protobuf::SourceContext* unsafe_arena_release_source_context();
// .google.protobuf.Syntax syntax = 6;
void clear_syntax();
@@ -365,8 +346,8 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::SourceContext* source_context_;
int syntax_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -396,21 +377,20 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Field& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Field* internal_default_instance() {
return reinterpret_cast<const Field*>(
&_Field_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
1;
void UnsafeArenaSwap(Field* other);
@@ -421,33 +401,28 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Field* New() const final {
- return CreateMaybeMessage<Field>(NULL);
- }
+ inline Field* New() const PROTOBUF_FINAL { return New(NULL); }
- Field* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Field>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Field* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Field& from);
void MergeFrom(const Field& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Field* other);
protected:
explicit Field(::google::protobuf::Arena* arena);
@@ -463,7 +438,7 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -563,11 +538,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;
@@ -584,13 +559,7 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_name(
::std::string* name);
@@ -607,13 +576,7 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
::std::string* mutable_type_url();
::std::string* release_type_url();
void set_allocated_type_url(::std::string* type_url);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_type_url();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_type_url(
::std::string* type_url);
@@ -630,13 +593,7 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
::std::string* mutable_json_name();
::std::string* release_json_name();
void set_allocated_json_name(::std::string* json_name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_json_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_json_name(
::std::string* json_name);
@@ -653,13 +610,7 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
::std::string* mutable_default_value();
::std::string* release_default_value();
void set_allocated_default_value(::std::string* default_value);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_default_value();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_default_value(
::std::string* default_value);
@@ -710,8 +661,8 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
::google::protobuf::int32 number_;
::google::protobuf::int32 oneof_index_;
bool packed_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -741,21 +692,20 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Enum& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Enum* internal_default_instance() {
return reinterpret_cast<const Enum*>(
&_Enum_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
2;
void UnsafeArenaSwap(Enum* other);
@@ -766,33 +716,28 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
// implements Message ----------------------------------------------
- inline Enum* New() const final {
- return CreateMaybeMessage<Enum>(NULL);
- }
+ inline Enum* New() const PROTOBUF_FINAL { return New(NULL); }
- Enum* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Enum>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Enum* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Enum& from);
void MergeFrom(const Enum& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Enum* other);
protected:
explicit Enum(::google::protobuf::Arena* arena);
@@ -808,7 +753,7 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -818,11 +763,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;
@@ -830,11 +775,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;
@@ -851,13 +796,7 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_name(
::std::string* name);
@@ -866,15 +805,16 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
void clear_source_context();
static const int kSourceContextFieldNumber = 4;
private:
- const ::google::protobuf::SourceContext& _internal_source_context() const;
+ void _slow_mutable_source_context();
+ ::google::protobuf::SourceContext* _slow_release_source_context();
public:
const ::google::protobuf::SourceContext& source_context() const;
- ::google::protobuf::SourceContext* release_source_context();
::google::protobuf::SourceContext* mutable_source_context();
+ ::google::protobuf::SourceContext* release_source_context();
void set_allocated_source_context(::google::protobuf::SourceContext* source_context);
+ ::google::protobuf::SourceContext* unsafe_arena_release_source_context();
void unsafe_arena_set_allocated_source_context(
::google::protobuf::SourceContext* source_context);
- ::google::protobuf::SourceContext* unsafe_arena_release_source_context();
// .google.protobuf.Syntax syntax = 5;
void clear_syntax();
@@ -894,8 +834,8 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::SourceContext* source_context_;
int syntax_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -925,21 +865,20 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const EnumValue& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const EnumValue* internal_default_instance() {
return reinterpret_cast<const EnumValue*>(
&_EnumValue_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
3;
void UnsafeArenaSwap(EnumValue* other);
@@ -950,33 +889,28 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline EnumValue* New() const final {
- return CreateMaybeMessage<EnumValue>(NULL);
- }
+ inline EnumValue* New() const PROTOBUF_FINAL { return New(NULL); }
- EnumValue* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<EnumValue>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ EnumValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumValue& from);
void MergeFrom(const EnumValue& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(EnumValue* other);
protected:
explicit EnumValue(::google::protobuf::Arena* arena);
@@ -992,7 +926,7 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -1002,11 +936,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;
@@ -1023,13 +957,7 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_name(
::std::string* name);
@@ -1049,8 +977,8 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro
::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::int32 number_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -1080,21 +1008,20 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Option& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Option* internal_default_instance() {
return reinterpret_cast<const Option*>(
&_Option_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
4;
void UnsafeArenaSwap(Option* other);
@@ -1105,33 +1032,28 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc
// implements Message ----------------------------------------------
- inline Option* New() const final {
- return CreateMaybeMessage<Option>(NULL);
- }
+ inline Option* New() const PROTOBUF_FINAL { return New(NULL); }
- Option* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Option>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Option* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Option& from);
void MergeFrom(const Option& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Option* other);
protected:
explicit Option(::google::protobuf::Arena* arena);
@@ -1147,7 +1069,7 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -1166,13 +1088,7 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_name();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_name(
::std::string* name);
@@ -1181,15 +1097,16 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc
void clear_value();
static const int kValueFieldNumber = 2;
private:
- const ::google::protobuf::Any& _internal_value() const;
+ void _slow_mutable_value();
+ ::google::protobuf::Any* _slow_release_value();
public:
const ::google::protobuf::Any& value() const;
- ::google::protobuf::Any* release_value();
::google::protobuf::Any* mutable_value();
+ ::google::protobuf::Any* release_value();
void set_allocated_value(::google::protobuf::Any* value);
+ ::google::protobuf::Any* unsafe_arena_release_value();
void unsafe_arena_set_allocated_value(
::google::protobuf::Any* value);
- ::google::protobuf::Any* unsafe_arena_release_value();
// @@protoc_insertion_point(class_scope:google.protobuf.Option)
private:
@@ -1200,14 +1117,15 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc
typedef void DestructorSkippable_;
::google::protobuf::internal::ArenaStringPtr name_;
::google::protobuf::Any* value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -1259,6 +1177,13 @@ inline ::std::string* Type::release_name() {
return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* Type::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void Type::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -1269,13 +1194,6 @@ inline void Type::set_allocated_name(::std::string* name) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name)
}
-inline ::std::string* Type::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void Type::unsafe_arena_set_allocated_name(
::std::string* name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -1296,23 +1214,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)
@@ -1395,23 +1313,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)
@@ -1422,8 +1340,9 @@ Type::options() const {
inline bool Type::has_source_context() const {
return this != internal_default_instance() && source_context_ != NULL;
}
-inline const ::google::protobuf::SourceContext& Type::_internal_source_context() const {
- return *source_context_;
+inline void Type::clear_source_context() {
+ if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_;
+ source_context_ = NULL;
}
inline const ::google::protobuf::SourceContext& Type::source_context() const {
const ::google::protobuf::SourceContext* p = source_context_;
@@ -1431,48 +1350,41 @@ inline const ::google::protobuf::SourceContext& Type::source_context() const {
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>(
&::google::protobuf::_SourceContext_default_instance_);
}
-inline ::google::protobuf::SourceContext* Type::release_source_context() {
- // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context)
-
- ::google::protobuf::SourceContext* temp = source_context_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- source_context_ = NULL;
- return temp;
-}
-inline ::google::protobuf::SourceContext* Type::unsafe_arena_release_source_context() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.source_context)
-
- ::google::protobuf::SourceContext* temp = source_context_;
- source_context_ = NULL;
- return temp;
-}
inline ::google::protobuf::SourceContext* Type::mutable_source_context() {
if (source_context_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::SourceContext>(GetArenaNoVirtual());
- source_context_ = p;
+ _slow_mutable_source_context();
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context)
return source_context_;
}
-inline void Type::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
+inline ::google::protobuf::SourceContext* Type::release_source_context() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context)
+
+ if (GetArenaNoVirtual() != NULL) {
+ return _slow_release_source_context();
+ } else {
+ ::google::protobuf::SourceContext* temp = source_context_;
+ source_context_ = NULL;
+ return temp;
+ }
+}
+inline void Type::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
- delete reinterpret_cast< ::google::protobuf::MessageLite*>(source_context_);
+ delete source_context_;
}
- if (source_context) {
- ::google::protobuf::Arena* submessage_arena = NULL;
- if (message_arena != submessage_arena) {
- source_context = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, source_context, submessage_arena);
+ if (source_context != NULL) {
+ if (message_arena != NULL) {
+ message_arena->Own(source_context);
}
+ }
+ source_context_ = source_context;
+ if (source_context) {
} else {
}
- source_context_ = source_context;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.source_context)
}
@@ -1581,6 +1493,13 @@ inline ::std::string* Field::release_name() {
return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* Field::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void Field::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -1591,13 +1510,6 @@ inline void Field::set_allocated_name(::std::string* name) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name)
}
-inline ::std::string* Field::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void Field::unsafe_arena_set_allocated_name(
::std::string* name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -1656,6 +1568,13 @@ inline ::std::string* Field::release_type_url() {
return type_url_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* Field::unsafe_arena_release_type_url() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.type_url)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return type_url_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void Field::set_allocated_type_url(::std::string* type_url) {
if (type_url != NULL) {
@@ -1666,13 +1585,6 @@ inline void Field::set_allocated_type_url(::std::string* type_url) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url)
}
-inline ::std::string* Field::unsafe_arena_release_type_url() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.type_url)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return type_url_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void Field::unsafe_arena_set_allocated_type_url(
::std::string* type_url) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -1721,23 +1633,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)
@@ -1789,6 +1701,13 @@ inline ::std::string* Field::release_json_name() {
return json_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* Field::unsafe_arena_release_json_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.json_name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return json_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void Field::set_allocated_json_name(::std::string* json_name) {
if (json_name != NULL) {
@@ -1799,13 +1718,6 @@ inline void Field::set_allocated_json_name(::std::string* json_name) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name)
}
-inline ::std::string* Field::unsafe_arena_release_json_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.json_name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return json_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void Field::unsafe_arena_set_allocated_json_name(
::std::string* json_name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -1864,6 +1776,13 @@ inline ::std::string* Field::release_default_value() {
return default_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* Field::unsafe_arena_release_default_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.default_value)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return default_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void Field::set_allocated_default_value(::std::string* default_value) {
if (default_value != NULL) {
@@ -1874,13 +1793,6 @@ inline void Field::set_allocated_default_value(::std::string* default_value) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value)
}
-inline ::std::string* Field::unsafe_arena_release_default_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.default_value)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return default_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void Field::unsafe_arena_set_allocated_default_value(
::std::string* default_value) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -1943,6 +1855,13 @@ inline ::std::string* Enum::release_name() {
return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* Enum::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void Enum::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -1953,13 +1872,6 @@ inline void Enum::set_allocated_name(::std::string* name) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name)
}
-inline ::std::string* Enum::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void Enum::unsafe_arena_set_allocated_name(
::std::string* name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -1980,23 +1892,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)
@@ -2010,23 +1922,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)
@@ -2037,8 +1949,9 @@ Enum::options() const {
inline bool Enum::has_source_context() const {
return this != internal_default_instance() && source_context_ != NULL;
}
-inline const ::google::protobuf::SourceContext& Enum::_internal_source_context() const {
- return *source_context_;
+inline void Enum::clear_source_context() {
+ if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_;
+ source_context_ = NULL;
}
inline const ::google::protobuf::SourceContext& Enum::source_context() const {
const ::google::protobuf::SourceContext* p = source_context_;
@@ -2046,48 +1959,41 @@ inline const ::google::protobuf::SourceContext& Enum::source_context() const {
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>(
&::google::protobuf::_SourceContext_default_instance_);
}
-inline ::google::protobuf::SourceContext* Enum::release_source_context() {
- // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context)
-
- ::google::protobuf::SourceContext* temp = source_context_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- source_context_ = NULL;
- return temp;
-}
-inline ::google::protobuf::SourceContext* Enum::unsafe_arena_release_source_context() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.source_context)
-
- ::google::protobuf::SourceContext* temp = source_context_;
- source_context_ = NULL;
- return temp;
-}
inline ::google::protobuf::SourceContext* Enum::mutable_source_context() {
if (source_context_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::SourceContext>(GetArenaNoVirtual());
- source_context_ = p;
+ _slow_mutable_source_context();
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context)
return source_context_;
}
-inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
+inline ::google::protobuf::SourceContext* Enum::release_source_context() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context)
+
+ if (GetArenaNoVirtual() != NULL) {
+ return _slow_release_source_context();
+ } else {
+ ::google::protobuf::SourceContext* temp = source_context_;
+ source_context_ = NULL;
+ return temp;
+ }
+}
+inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
- delete reinterpret_cast< ::google::protobuf::MessageLite*>(source_context_);
+ delete source_context_;
}
- if (source_context) {
- ::google::protobuf::Arena* submessage_arena = NULL;
- if (message_arena != submessage_arena) {
- source_context = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, source_context, submessage_arena);
+ if (source_context != NULL) {
+ if (message_arena != NULL) {
+ message_arena->Own(source_context);
}
+ }
+ source_context_ = source_context;
+ if (source_context) {
} else {
}
- source_context_ = source_context;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.source_context)
}
@@ -2154,6 +2060,13 @@ inline ::std::string* EnumValue::release_name() {
return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* EnumValue::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValue.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void EnumValue::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -2164,13 +2077,6 @@ inline void EnumValue::set_allocated_name(::std::string* name) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name)
}
-inline ::std::string* EnumValue::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValue.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void EnumValue::unsafe_arena_set_allocated_name(
::std::string* name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -2205,23 +2111,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)
@@ -2277,6 +2183,13 @@ inline ::std::string* Option::release_name() {
return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* Option::unsafe_arena_release_name() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.name)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void Option::set_allocated_name(::std::string* name) {
if (name != NULL) {
@@ -2287,13 +2200,6 @@ inline void Option::set_allocated_name(::std::string* name) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name)
}
-inline ::std::string* Option::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.name)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void Option::unsafe_arena_set_allocated_name(
::std::string* name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -2311,8 +2217,9 @@ inline void Option::unsafe_arena_set_allocated_name(
inline bool Option::has_value() const {
return this != internal_default_instance() && value_ != NULL;
}
-inline const ::google::protobuf::Any& Option::_internal_value() const {
- return *value_;
+inline void Option::clear_value() {
+ if (GetArenaNoVirtual() == NULL && value_ != NULL) delete value_;
+ value_ = NULL;
}
inline const ::google::protobuf::Any& Option::value() const {
const ::google::protobuf::Any* p = value_;
@@ -2320,54 +2227,48 @@ inline const ::google::protobuf::Any& Option::value() const {
return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::Any*>(
&::google::protobuf::_Any_default_instance_);
}
-inline ::google::protobuf::Any* Option::release_value() {
- // @@protoc_insertion_point(field_release:google.protobuf.Option.value)
-
- ::google::protobuf::Any* temp = value_;
- if (GetArenaNoVirtual() != NULL) {
- temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
- }
- value_ = NULL;
- return temp;
-}
-inline ::google::protobuf::Any* Option::unsafe_arena_release_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.value)
-
- ::google::protobuf::Any* temp = value_;
- value_ = NULL;
- return temp;
-}
inline ::google::protobuf::Any* Option::mutable_value() {
if (value_ == NULL) {
- auto* p = CreateMaybeMessage<::google::protobuf::Any>(GetArenaNoVirtual());
- value_ = p;
+ _slow_mutable_value();
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Option.value)
return value_;
}
-inline void Option::set_allocated_value(::google::protobuf::Any* value) {
+inline ::google::protobuf::Any* Option::release_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.Option.value)
+
+ if (GetArenaNoVirtual() != NULL) {
+ return _slow_release_value();
+ } else {
+ ::google::protobuf::Any* temp = value_;
+ value_ = NULL;
+ return temp;
+ }
+}
+inline void Option::set_allocated_value(::google::protobuf::Any* value) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
- delete reinterpret_cast< ::google::protobuf::MessageLite*>(value_);
+ delete value_;
}
- if (value) {
- ::google::protobuf::Arena* submessage_arena = NULL;
- if (message_arena != submessage_arena) {
- value = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, value, submessage_arena);
+ if (value != NULL) {
+ if (message_arena != NULL) {
+ message_arena->Own(value);
}
+ }
+ value_ = value;
+ if (value) {
} else {
}
- value_ = value;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.value)
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// -------------------------------------------------------------------
// -------------------------------------------------------------------
@@ -2379,23 +2280,24 @@ inline void Option::set_allocated_value(::google::protobuf::Any* value) {
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
namespace google {
namespace protobuf {
-template <> struct is_proto_enum< ::google::protobuf::Field_Kind> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::Field_Kind> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::Field_Kind>() {
return ::google::protobuf::Field_Kind_descriptor();
}
-template <> struct is_proto_enum< ::google::protobuf::Field_Cardinality> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::Field_Cardinality> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::Field_Cardinality>() {
return ::google::protobuf::Field_Cardinality_descriptor();
}
-template <> struct is_proto_enum< ::google::protobuf::Syntax> : ::std::true_type {};
+template <> struct is_proto_enum< ::google::protobuf::Syntax> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::Syntax>() {
return ::google::protobuf::Syntax_descriptor();
@@ -2406,4 +2308,4 @@ inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::Syntax>() {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2ftype_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/type.proto b/third_party/protobuf/3.4.0/src/google/protobuf/type.proto
new file mode 100644
index 0000000000..624c15ee61
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/type.proto
@@ -0,0 +1,187 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+import "google/protobuf/any.proto";
+import "google/protobuf/source_context.proto";
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option cc_enable_arenas = true;
+option java_package = "com.google.protobuf";
+option java_outer_classname = "TypeProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+option go_package = "google.golang.org/genproto/protobuf/ptype;ptype";
+
+// A protocol buffer message type.
+message Type {
+ // The fully qualified message name.
+ string name = 1;
+ // The list of fields.
+ repeated Field fields = 2;
+ // The list of types appearing in `oneof` definitions in this type.
+ repeated string oneofs = 3;
+ // The protocol buffer options.
+ repeated Option options = 4;
+ // The source context.
+ SourceContext source_context = 5;
+ // The source syntax.
+ Syntax syntax = 6;
+}
+
+// A single field of a message type.
+message Field {
+ // Basic field types.
+ enum Kind {
+ // Field type unknown.
+ TYPE_UNKNOWN = 0;
+ // Field type double.
+ TYPE_DOUBLE = 1;
+ // Field type float.
+ TYPE_FLOAT = 2;
+ // Field type int64.
+ TYPE_INT64 = 3;
+ // Field type uint64.
+ TYPE_UINT64 = 4;
+ // Field type int32.
+ TYPE_INT32 = 5;
+ // Field type fixed64.
+ TYPE_FIXED64 = 6;
+ // Field type fixed32.
+ TYPE_FIXED32 = 7;
+ // Field type bool.
+ TYPE_BOOL = 8;
+ // Field type string.
+ TYPE_STRING = 9;
+ // Field type group. Proto2 syntax only, and deprecated.
+ TYPE_GROUP = 10;
+ // Field type message.
+ TYPE_MESSAGE = 11;
+ // Field type bytes.
+ TYPE_BYTES = 12;
+ // Field type uint32.
+ TYPE_UINT32 = 13;
+ // Field type enum.
+ TYPE_ENUM = 14;
+ // Field type sfixed32.
+ TYPE_SFIXED32 = 15;
+ // Field type sfixed64.
+ TYPE_SFIXED64 = 16;
+ // Field type sint32.
+ TYPE_SINT32 = 17;
+ // Field type sint64.
+ TYPE_SINT64 = 18;
+ };
+
+ // Whether a field is optional, required, or repeated.
+ enum Cardinality {
+ // For fields with unknown cardinality.
+ CARDINALITY_UNKNOWN = 0;
+ // For optional fields.
+ CARDINALITY_OPTIONAL = 1;
+ // For required fields. Proto2 syntax only.
+ CARDINALITY_REQUIRED = 2;
+ // For repeated fields.
+ CARDINALITY_REPEATED = 3;
+ };
+
+ // The field type.
+ Kind kind = 1;
+ // The field cardinality.
+ Cardinality cardinality = 2;
+ // The field number.
+ int32 number = 3;
+ // The field name.
+ string name = 4;
+ // The field type URL, without the scheme, for message or enumeration
+ // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
+ string type_url = 6;
+ // The index of the field type in `Type.oneofs`, for message or enumeration
+ // types. The first type has index 1; zero means the type is not in the list.
+ int32 oneof_index = 7;
+ // Whether to use alternative packed wire representation.
+ bool packed = 8;
+ // The protocol buffer options.
+ repeated Option options = 9;
+ // The field JSON name.
+ string json_name = 10;
+ // The string value of the default value of this field. Proto2 syntax only.
+ string default_value = 11;
+}
+
+// Enum type definition.
+message Enum {
+ // Enum type name.
+ string name = 1;
+ // Enum value definitions.
+ repeated EnumValue enumvalue = 2;
+ // Protocol buffer options.
+ repeated Option options = 3;
+ // The source context.
+ SourceContext source_context = 4;
+ // The source syntax.
+ Syntax syntax = 5;
+}
+
+// Enum value definition.
+message EnumValue {
+ // Enum value name.
+ string name = 1;
+ // Enum value number.
+ int32 number = 2;
+ // Protocol buffer options.
+ repeated Option options = 3;
+}
+
+// A protocol buffer option, which can be attached to a message, field,
+// enumeration, etc.
+message Option {
+ // The option's name. For protobuf built-in options (options defined in
+ // descriptor.proto), this is the short name. For example, `"map_entry"`.
+ // For custom options, it should be the fully-qualified name. For example,
+ // `"google.api.http"`.
+ string name = 1;
+ // The option's value packed in an Any message. If the value is a primitive,
+ // the corresponding wrapper type defined in google/protobuf/wrappers.proto
+ // should be used. If the value is an enum, it should be stored as an int32
+ // value using the google.protobuf.Int32Value type.
+ Any value = 2;
+}
+
+// The syntax in which a protocol buffer element is defined.
+enum Syntax {
+ // Syntax `proto2`.
+ SYNTAX_PROTO2 = 0;
+ // Syntax `proto3`.
+ SYNTAX_PROTO3 = 1;
+}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest.proto
index 4af2b051d1..45a0edad9d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest.proto
@@ -33,8 +33,6 @@
// Sanjay Ghemawat, Jeff Dean, and others.
//
// A proto file we will use for unit testing.
-//
-// LINT: ALLOW_GROUPS, LEGACY_NAMES
syntax = "proto2";
@@ -191,9 +189,6 @@ message NestedTestAllTypes {
message TestDeprecatedFields {
optional int32 deprecated_int32 = 1 [deprecated=true];
- oneof oneof_fields {
- int32 deprecated_int32_in_oneof = 2 [deprecated=true];
- }
}
message TestDeprecatedMessage {
@@ -335,17 +330,6 @@ extend TestAllExtensions {
optional bytes oneof_bytes_extension = 114;
}
-message TestGroup {
- optional group OptionalGroup = 16 {
- optional int32 a = 17;
- }
- optional ForeignEnum optional_foreign_enum = 22;
-}
-
-message TestGroupExtension {
- extensions 1 to max;
-}
-
message TestNestedExtension {
extend TestAllExtensions {
// Check for bug where string extensions declared in tested scope did not
@@ -355,13 +339,6 @@ message TestNestedExtension {
// underscores.
optional string nested_string_extension = 1003;
}
-
- extend TestGroupExtension {
- optional group OptionalGroup_extension = 16 {
- optional int32 a = 17;
- }
- optional ForeignEnum optional_foreign_enum_extension = 22;
- }
}
// We have separate messages for testing required fields because it's
@@ -574,30 +551,12 @@ message TestFieldOrderings {
optional NestedMessage optional_nested_message = 200;
}
+
extend TestFieldOrderings {
optional string my_extension_string = 50;
optional int32 my_extension_int = 5;
}
-message TestExtensionOrderings1 {
- extend TestFieldOrderings {
- optional TestExtensionOrderings1 test_ext_orderings1 = 13;
- }
- optional string my_string = 1;
-}
-
-message TestExtensionOrderings2 {
- extend TestFieldOrderings {
- optional TestExtensionOrderings2 test_ext_orderings2 = 12;
- }
- message TestExtensionOrderings3 {
- extend TestFieldOrderings {
- optional TestExtensionOrderings3 test_ext_orderings3 = 14;
- }
- optional string my_string = 1;
- }
- optional string my_string = 1;
-}
message TestExtremeDefaultValues {
optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
@@ -984,21 +943,3 @@ message TestHugeFieldNumbers {
extend TestHugeFieldNumbers {
optional TestAllTypes test_all_types = 536860000;
}
-
-message TestExtensionInsideTable {
- optional int32 field1 = 1;
- optional int32 field2 = 2;
- optional int32 field3 = 3;
- optional int32 field4 = 4;
- extensions 5 to 5;
- optional int32 field6 = 6;
- optional int32 field7 = 7;
- optional int32 field8 = 8;
- optional int32 field9 = 9;
- optional int32 field10 = 10;
-}
-
-extend TestExtensionInsideTable {
- optional int32 test_extension_inside_table_extension = 5;
-}
-
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_arena.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_arena.proto
index cd7e437e16..cd7e437e16 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_arena.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_arena.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_custom_options.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_custom_options.proto
index 218447e9aa..218447e9aa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_custom_options.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_custom_options.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_drop_unknown_fields.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_drop_unknown_fields.proto
index 8aa3a37b8e..8aa3a37b8e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_drop_unknown_fields.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_drop_unknown_fields.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_embed_optimize_for.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_embed_optimize_for.proto
index d8b0f9b94f..d8b0f9b94f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_embed_optimize_for.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_embed_optimize_for.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_empty.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_empty.proto
index 36443e7e01..36443e7e01 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_empty.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_empty.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_enormous_descriptor.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_enormous_descriptor.proto
index 6e65dc18b7..6e65dc18b7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_enormous_descriptor.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_enormous_descriptor.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_import.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import.proto
index 8d03e3888b..8d03e3888b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_import.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_lite.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_lite.proto
index a7afa45233..a7afa45233 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_lite.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_lite.proto
diff --git a/third_party/protobuf/3.6.0/csharp/protos/unittest_import_proto3.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_proto3.proto
index 2e66682286..59673eaf9d 100644
--- a/third_party/protobuf/3.6.0/csharp/protos/unittest_import_proto3.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_proto3.proto
@@ -36,12 +36,24 @@
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 "unittest_import_public_proto3.proto";
+import public "google/protobuf/unittest_import_public_proto3.proto";
message ImportMessage {
int32 d = 1;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_public.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public.proto
index ffaf773698..ffaf773698 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_public.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_public_lite.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public_lite.proto
index 33549c2279..33549c2279 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_import_public_lite.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public_lite.proto
diff --git a/third_party/protobuf/3.6.0/csharp/protos/unittest_import_public_proto3.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public_proto3.proto
index 88c20799ae..d6f11e28bd 100644
--- a/third_party/protobuf/3.6.0/csharp/protos/unittest_import_public_proto3.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_import_public_proto3.proto
@@ -34,6 +34,7 @@ syntax = "proto3";
package protobuf_unittest_import;
+option java_package = "com.google.protobuf.test";
option csharp_namespace = "Google.Protobuf.TestProtos";
message PublicImportMessage {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies.proto
index 2f5efd2aaa..2f5efd2aaa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto
index 22438257d3..22438257d3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies_enum.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies_enum.proto
index 9be64d8580..9be64d8580 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lazy_dependencies_enum.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lazy_dependencies_enum.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lite.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lite.proto
index f3ff2b5d19..9a15bdaacf 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lite.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lite.proto
@@ -454,22 +454,3 @@ message TestOneofParsingLite {
V2EnumLite oneof_enum = 9;
}
}
-
-// The following four messages are set up to test for wire compatibility between
-// packed and non-packed repeated fields. We use the field number 2048, because
-// that is large enough to require a 3-byte varint for the tag.
-message PackedInt32 {
- repeated int32 repeated_int32 = 2048 [packed = true];
-}
-
-message NonPackedInt32 {
- repeated int32 repeated_int32 = 2048;
-}
-
-message PackedFixed32 {
- repeated fixed32 repeated_fixed32 = 2048 [packed = true];
-}
-
-message NonPackedFixed32 {
- repeated fixed32 repeated_fixed32 = 2048;
-}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lite_imports_nonlite.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lite_imports_nonlite.proto
index 8a470160a8..132d6a82d2 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_lite_imports_nonlite.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_lite_imports_nonlite.proto
@@ -41,7 +41,4 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/unittest_mset.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_mset.proto
index 49d9adad0b..49d9adad0b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_mset.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_mset.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_mset_wire_format.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_mset_wire_format.proto
index 04e4352e06..04e4352e06 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_mset_wire_format.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_mset_wire_format.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena.proto
index 41518df297..41518df297 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena_import.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena_import.proto
index 072af49e3c..072af49e3c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena_import.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena_import.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena_lite.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena_lite.proto
index 34c7b7ce99..34c7b7ce99 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_arena_lite.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_arena_lite.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_field_presence.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_field_presence.proto
index 994afff42d..994afff42d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_field_presence.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_field_presence.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_generic_services.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_generic_services.proto
index 8fc7713c9e..8fc7713c9e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_no_generic_services.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_no_generic_services.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_optimize_for.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_optimize_for.proto
index ee9cc7bd49..ee9cc7bd49 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_optimize_for.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_optimize_for.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_preserve_unknown_enum.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_preserve_unknown_enum.proto
index 2f91332c9e..2f91332c9e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_preserve_unknown_enum.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_preserve_unknown_enum.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_preserve_unknown_enum2.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_preserve_unknown_enum2.proto
index adf42968aa..adf42968aa 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_preserve_unknown_enum2.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_preserve_unknown_enum2.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3.proto
index 84815d4253..84815d4253 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_arena.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_arena.proto
index ea88ec90ca..9375d85ae0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_arena.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_arena.proto
@@ -187,7 +187,6 @@ message TestUnpackedTypes {
message NestedTestAllTypes {
NestedTestAllTypes child = 1;
TestAllTypes payload = 2;
- repeated NestedTestAllTypes repeated_child = 3;
}
// Define these after TestAllTypes to make sure the compiler can handle
@@ -206,3 +205,4 @@ enum ForeignEnum {
// TestEmptyMessage is used to test behavior of unknown fields.
message TestEmptyMessage {
}
+
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_arena_lite.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_arena_lite.proto
index 5a60b90f5c..5a60b90f5c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_arena_lite.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_arena_lite.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_lite.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_lite.proto
index 874ade6c0e..874ade6c0e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_proto3_lite.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_proto3_lite.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_well_known_types.proto b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_well_known_types.proto
index c90752440b..c90752440b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unittest_well_known_types.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unittest_well_known_types.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set.cc b/third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set.cc
index 0ada85e570..0ada85e570 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set.h b/third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set.h
index 619855ed0a..beb4c9ecca 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set.h
@@ -43,7 +43,7 @@
#include <vector>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/message_lite.h>
+#include <google/protobuf/generated_message_util.h>
namespace google {
namespace protobuf {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set_unittest.cc
index a64769e7cd..e55bb01274 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/unknown_field_set_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/unknown_field_set_unittest.cc
@@ -49,7 +49,6 @@
#include <google/protobuf/stubs/mutex.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
-
#include <google/protobuf/stubs/stl_util.h>
namespace google {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util.cc
index 3ba930e7fb..1637878216 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util.cc
@@ -12,7 +12,7 @@ bool SerializeDelimitedToFileDescriptor(const MessageLite& message, int file_des
return SerializeDelimitedToZeroCopyStream(message, &output);
}
-bool SerializeDelimitedToOstream(const MessageLite& message, std::ostream* output) {
+bool SerializeDelimitedToOstream(const MessageLite& message, ostream* output) {
{
io::OstreamOutputStream zero_copy_output(output);
if (!SerializeDelimitedToZeroCopyStream(message, &zero_copy_output)) return false;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util.h
index e8a7204a25..302d4781b3 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util.h
@@ -32,7 +32,7 @@ namespace util {
// underlying source, so instead you must keep using the same stream object.
bool LIBPROTOBUF_EXPORT SerializeDelimitedToFileDescriptor(const MessageLite& message, int file_descriptor);
-bool LIBPROTOBUF_EXPORT SerializeDelimitedToOstream(const MessageLite& message, std::ostream* output);
+bool LIBPROTOBUF_EXPORT SerializeDelimitedToOstream(const MessageLite& message, ostream* output);
// Read a single size-delimited message from the given stream. Delimited
// format allows a single file or stream to contain multiple messages,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util_test.cc
index 157a84112c..157a84112c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/delimited_message_util_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/delimited_message_util_test.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator.cc
index 86ddf06a9b..a1a56ee674 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator.cc
@@ -36,7 +36,6 @@
#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>
@@ -131,15 +130,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator.h
index 27ef4c7799..26a7ba4d97 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator.h
@@ -35,7 +35,6 @@
#include <map>
#include <string>
-#include <vector>
#include <google/protobuf/stubs/common.h>
@@ -49,7 +48,6 @@ 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
@@ -155,15 +153,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator_test.cc
index 249b8d5463..249b8d5463 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_comparator_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_comparator_test.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util.cc
index a2e2a38899..982d640775 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util.cc
@@ -31,7 +31,6 @@
#include <google/protobuf/util/field_mask_util.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/map_util.h>
namespace google {
@@ -132,27 +131,27 @@ bool FieldMaskUtil::FromJsonString(StringPiece str, FieldMask* out) {
bool FieldMaskUtil::GetFieldDescriptors(
const Descriptor* descriptor, StringPiece path,
std::vector<const FieldDescriptor*>* field_descriptors) {
- if (field_descriptors != nullptr) {
+ if (field_descriptors != NULL) {
field_descriptors->clear();
}
std::vector<string> parts = Split(path, ".");
for (int i = 0; i < parts.size(); ++i) {
const string& field_name = parts[i];
- if (descriptor == nullptr) {
+ if (descriptor == NULL) {
return false;
}
const FieldDescriptor* field = descriptor->FindFieldByName(field_name);
- if (field == nullptr) {
+ if (field == NULL) {
return false;
}
- if (field_descriptors != nullptr) {
+ if (field_descriptors != NULL) {
field_descriptors->push_back(field);
}
if (!field->is_repeated() &&
field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
descriptor = field->message_type();
} else {
- descriptor = nullptr;
+ descriptor = NULL;
}
}
return true;
@@ -193,13 +192,6 @@ class FieldMaskTree {
// children removed because the path matches all the node's children.
void AddPath(const string& path);
- // Remove a path from the tree.
- // If the path is a sub-path of an existing field path in the tree, it means
- // we need remove the existing fied path and add all sub-paths except
- // specified path. If the path matches an existing node in the tree, this node
- // will be moved.
- void RemovePath(const string& path, const Descriptor* descriptor);
-
// Calculate the intersection part of a field path with this tree and add
// the intersection field path into out.
void IntersectPath(const string& path, FieldMaskTree* out);
@@ -341,65 +333,6 @@ void FieldMaskTree::AddPath(const string& path) {
}
}
-void FieldMaskTree::RemovePath(const string& path,
- const Descriptor* descriptor) {
- if (root_.children.empty()) {
- // Nothing to be removed from an empty tree. We shortcut it here so an empty
- // tree won't be interpreted as a field mask containing all fields by the
- // code below.
- return;
- }
- std::vector<string> parts = Split(path, ".");
- if (parts.empty()) {
- return;
- }
- std::vector<Node*> nodes(parts.size());
- Node* node = &root_;
- const Descriptor* current_descriptor = descriptor;
- Node* new_branch_node = nullptr;
- for (int i = 0; i < parts.size(); ++i) {
- nodes[i] = node;
- const FieldDescriptor* field_descriptor =
- current_descriptor->FindFieldByName(parts[i]);
- if (field_descriptor == nullptr ||
- (field_descriptor->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE &&
- i != parts.size() - 1)) {
- // Invalid path.
- if (new_branch_node != nullptr) {
- // If add any new nodes, cleanup.
- new_branch_node->ClearChildren();
- }
- return;
- }
-
- if (node->children.empty()) {
- if (new_branch_node == nullptr) {
- new_branch_node = node;
- }
- for (int i = 0; i < current_descriptor->field_count(); ++i) {
- node->children[current_descriptor->field(i)->name()] = new Node();
- }
- }
- if (ContainsKey(node->children, parts[i])) {
- node = node->children[parts[i]];
- if (field_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
- current_descriptor = field_descriptor->message_type();
- }
- } else {
- // Path does not exist.
- return;
- }
- }
- // Remove path.
- for (int i = parts.size() - 1; i >= 0; i--) {
- delete nodes[i]->children[parts[i]];
- nodes[i]->children.erase(parts[i]);
- if (!nodes[i]->children.empty()) {
- break;
- }
- }
-}
-
void FieldMaskTree::IntersectPath(const string& path, FieldMaskTree* out) {
std::vector<string> parts = Split(path, ".");
if (parts.empty()) {
@@ -549,7 +482,7 @@ void FieldMaskTree::AddRequiredFieldPath(
if (field->is_required()) {
const string& node_name = field->name();
Node*& child = node->children[node_name];
- if (child == nullptr) {
+ if (child == NULL) {
// Add required field path to the tree
child = new Node();
} else if (child->children.empty()){
@@ -627,22 +560,6 @@ void FieldMaskUtil::Intersect(const FieldMask& mask1, const FieldMask& mask2,
intersection.MergeToFieldMask(out);
}
-void FieldMaskUtil::InternalSubtract(const Descriptor* descriptor,
- const FieldMask& mask1,
- const FieldMask& mask2, FieldMask* out) {
- if (mask1.paths().empty()) {
- out->Clear();
- return;
- }
- FieldMaskTree tree;
- tree.MergeFromFieldMask(mask1);
- for (int i = 0; i < mask2.paths_size(); ++i) {
- tree.RemovePath(mask2.paths(i), descriptor);
- }
- out->Clear();
- tree.MergeToFieldMask(out);
-}
-
bool FieldMaskUtil::IsPathInFieldMask(StringPiece path, const FieldMask& mask) {
for (int i = 0; i < mask.paths_size(); ++i) {
const string& mask_path = mask.paths(i);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util.h
index f0299de963..71c68fec8c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util.h
@@ -70,14 +70,14 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil {
// Checks whether the given path is valid for type T.
template <typename T>
static bool IsValidPath(StringPiece path) {
- return GetFieldDescriptors(T::descriptor(), path, nullptr);
+ return GetFieldDescriptors(T::descriptor(), path, NULL);
}
// Checks whether the given FieldMask is valid for type T.
template <typename T>
static bool IsValidFieldMask(const FieldMask& mask) {
for (int i = 0; i < mask.paths_size(); ++i) {
- if (!GetFieldDescriptors(T::descriptor(), mask.paths(i), nullptr))
+ if (!GetFieldDescriptors(T::descriptor(), mask.paths(i), NULL))
return false;
}
return true;
@@ -94,13 +94,6 @@ 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);
}
@@ -120,17 +113,8 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil {
static void Intersect(const FieldMask& mask1, const FieldMask& mask2,
FieldMask* out);
- // Subtracts mask2 from mask1 base of type T.
- template <typename T>
- static void Subtract(const FieldMask& mask1, const FieldMask& mask2,
- FieldMask* out) {
- InternalSubtract(T::descriptor(), mask1, mask2, out);
- }
-
// 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;
@@ -183,10 +167,6 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil {
static void InternalGetFieldMaskForAllFields(const Descriptor* descriptor,
FieldMask* out);
-
- static void InternalSubtract(const Descriptor* descriptor,
- const FieldMask& mask1, const FieldMask& mask2,
- FieldMask* out);
};
// Note that for compatibility with the defined behaviour for FieldMask in
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util_test.cc
index 3ba30aa38c..24943ed1f6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/field_mask_util_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/field_mask_util_test.cc
@@ -168,7 +168,7 @@ TEST(FieldMaskUtilTest, GetFieldDescriptors) {
EXPECT_EQ(1, field_descriptors.size());
EXPECT_EQ("optional_int32", field_descriptors[0]->name());
EXPECT_FALSE(FieldMaskUtil::GetFieldDescriptors(
- TestAllTypes::descriptor(), "optional_nonexist", nullptr));
+ TestAllTypes::descriptor(), "optional_nonexist", NULL));
EXPECT_TRUE(FieldMaskUtil::GetFieldDescriptors(TestAllTypes::descriptor(),
"optional_nested_message.bb",
&field_descriptors));
@@ -176,10 +176,10 @@ TEST(FieldMaskUtilTest, GetFieldDescriptors) {
EXPECT_EQ("optional_nested_message", field_descriptors[0]->name());
EXPECT_EQ("bb", field_descriptors[1]->name());
EXPECT_FALSE(FieldMaskUtil::GetFieldDescriptors(
- TestAllTypes::descriptor(), "optional_nested_message.nonexist", nullptr));
+ TestAllTypes::descriptor(), "optional_nested_message.nonexist", NULL));
// FieldMask cannot be used to specify sub-fields of a repeated message.
EXPECT_FALSE(FieldMaskUtil::GetFieldDescriptors(
- TestAllTypes::descriptor(), "repeated_nested_message.bb", nullptr));
+ TestAllTypes::descriptor(), "repeated_nested_message.bb", NULL));
}
TEST(FieldMaskUtilTest, TestIsVaildPath) {
@@ -206,12 +206,12 @@ TEST(FieldMaskUtilTest, TestIsValidFieldMask) {
TEST(FieldMaskUtilTest, TestGetFieldMaskForAllFields) {
FieldMask mask;
- mask = FieldMaskUtil::GetFieldMaskForAllFields<TestAllTypes::NestedMessage>();
+ FieldMaskUtil::GetFieldMaskForAllFields<TestAllTypes::NestedMessage>(&mask);
EXPECT_EQ(1, mask.paths_size());
EXPECT_TRUE(FieldMaskUtil::IsPathInFieldMask("bb", mask));
- mask = FieldMaskUtil::GetFieldMaskForAllFields<TestAllTypes>();
- EXPECT_EQ(75, mask.paths_size());
+ FieldMaskUtil::GetFieldMaskForAllFields<TestAllTypes>(&mask);
+ EXPECT_EQ(76, mask.paths_size());
EXPECT_TRUE(FieldMaskUtil::IsPathInFieldMask("optional_int32", mask));
EXPECT_TRUE(FieldMaskUtil::IsPathInFieldMask("optional_int64", mask));
EXPECT_TRUE(FieldMaskUtil::IsPathInFieldMask("optional_uint32", mask));
@@ -348,53 +348,6 @@ TEST(FieldMaskUtilTest, TestIntersect) {
EXPECT_EQ("foo.bar.baz", FieldMaskUtil::ToString(out));
}
-TEST(FieldMaskUtilTest, TestSubtract) {
- FieldMask mask1, mask2, out;
- // Normal case.
- FieldMaskUtil::FromString(
- "optional_int32,optional_uint64,optional_nested_message,optional_foreign_"
- "message,repeated_int32,repeated_foreign_message,repeated_nested_message."
- "bb",
- &mask1);
-
- FieldMaskUtil::FromString(
- "optional_int32,optional_nested_message.bb,optional_foreign_message.c,"
- "repeated_int32,repeated_nested_message.bb,repeated_foreign_message.f,"
- "repeated_foreign_message.d,repeated_nested_message.bb,repeated_uint32",
- &mask2);
-
- FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out);
- EXPECT_EQ(
- "optional_foreign_message.d,optional_uint64,repeated_foreign_message.c",
- FieldMaskUtil::ToString(out));
-
- // mask1 is empty.
- FieldMaskUtil::FromString("", &mask1);
- FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out);
- EXPECT_EQ("", FieldMaskUtil::ToString(out));
-
- // mask1 is "optional_nested_message" and mask2 is
- // "optional_nested_message.nonexist_field".
- FieldMaskUtil::FromString("optional_nested_message", &mask1);
- FieldMaskUtil::FromString("optional_nested_message.nonexist_field", &mask2);
- FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out);
- EXPECT_EQ("optional_nested_message", FieldMaskUtil::ToString(out));
-
- // mask1 is "optional_nested_message" and mask2 is
- // "optional_nested_message".
- FieldMaskUtil::FromString("optional_nested_message", &mask1);
- FieldMaskUtil::FromString("optional_nested_message", &mask2);
- FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out);
- EXPECT_EQ("", FieldMaskUtil::ToString(out));
-
- // Regression test for b/72727550
- FieldMaskUtil::FromString("optional_foreign_message.c", &mask1);
- FieldMaskUtil::FromString("optional_foreign_message,optional_nested_message",
- &mask2);
- FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out);
- EXPECT_EQ("", FieldMaskUtil::ToString(out));
-}
-
TEST(FieldMaskUtilTest, TestIspathInFieldMask) {
FieldMask mask;
FieldMaskUtil::FromString("foo.bar", &mask);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/constants.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/constants.h
index a018a09ef7..a018a09ef7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/constants.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/constants.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/datapiece.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/datapiece.cc
index 59bc28ae71..213c2c40c0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/datapiece.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/datapiece.cc
@@ -64,9 +64,9 @@ StatusOr<To> ValidateNumberConversion(To after, From before) {
MathUtil::Sign<From>(before) == MathUtil::Sign<To>(after)) {
return after;
} else {
- return InvalidArgument(std::is_integral<From>::value
+ return InvalidArgument(::google::protobuf::internal::is_integral<From>::value
? ValueAsString(before)
- : std::is_same<From, double>::value
+ : ::google::protobuf::internal::is_same<From, double>::value
? DoubleAsString(before)
: FloatAsString(before));
}
@@ -77,7 +77,7 @@ StatusOr<To> ValidateNumberConversion(To after, From before) {
// except conversion between double and float.
template <typename To, typename From>
StatusOr<To> NumberConvertAndCheck(From before) {
- if (std::is_same<From, To>::value) return before;
+ if (::google::protobuf::internal::is_same<From, To>::value) return before;
To after = static_cast<To>(before);
return ValidateNumberConversion(after, before);
@@ -87,7 +87,7 @@ StatusOr<To> NumberConvertAndCheck(From before) {
// point types (double, float) only.
template <typename To, typename From>
StatusOr<To> FloatingPointToIntConvertAndCheck(From before) {
- if (std::is_same<From, To>::value) return before;
+ if (::google::protobuf::internal::is_same<From, To>::value) return before;
To after = static_cast<To>(before);
return ValidateNumberConversion(after, before);
@@ -272,8 +272,7 @@ StatusOr<string> DataPiece::ToBytes() const {
}
StatusOr<int> DataPiece::ToEnum(const google::protobuf::Enum* enum_type,
- bool use_lower_camel_for_enums,
- bool ignore_unknown_enum_values) const {
+ bool use_lower_camel_for_enums) const {
if (type_ == TYPE_NULL) return google::protobuf::NULL_VALUE;
if (type_ == TYPE_STRING) {
@@ -281,7 +280,7 @@ StatusOr<int> DataPiece::ToEnum(const google::protobuf::Enum* enum_type,
string enum_name = str_.ToString();
const google::protobuf::EnumValue* value =
FindEnumValueByNameOrNull(enum_type, enum_name);
- if (value != nullptr) return value->number();
+ if (value != NULL) return value->number();
// Check if int version of enum is sent as string.
StatusOr<int32> int_value = ToInt32();
@@ -297,19 +296,15 @@ StatusOr<int> DataPiece::ToEnum(const google::protobuf::Enum* enum_type,
*it = *it == '-' ? '_' : ascii_toupper(*it);
}
value = FindEnumValueByNameOrNull(enum_type, enum_name);
- if (value != nullptr) return value->number();
+ if (value != NULL) return value->number();
// If use_lower_camel_for_enums is true try with enum name without
// underscore. This will also accept camel case names as the enum_name has
// been normalized before.
if (use_lower_camel_for_enums) {
value = FindEnumValueByNameWithoutUnderscoreOrNull(enum_type, enum_name);
- if (value != nullptr) return value->number();
+ if (value != NULL) return value->number();
}
-
- // If ignore_unknown_enum_values is true an unknown enum value is treated
- // as the default
- if (ignore_unknown_enum_values) return enum_type->enumvalue(0).number();
} else {
// We don't need to check whether the value is actually declared in the
// enum because we preserve unknown enum values as well.
@@ -362,8 +357,7 @@ bool DataPiece::DecodeBase64(StringPiece src, string* dest) const {
WebSafeBase64Escape(*dest, &encoded);
// Remove trailing padding '=' characters before comparison.
StringPiece src_no_padding = StringPiece(src).substr(
- 0, StringEndsWith(src, "=") ? src.find_last_not_of('=') + 1
- : src.length());
+ 0, src.ends_with("=") ? src.find_last_not_of('=') + 1 : src.length());
return encoded == src_no_padding;
}
return true;
@@ -376,8 +370,7 @@ bool DataPiece::DecodeBase64(StringPiece src, string* dest) const {
reinterpret_cast<const unsigned char*>(dest->data()), dest->length(),
&encoded, false);
StringPiece src_no_padding = StringPiece(src).substr(
- 0, StringEndsWith(src, "=") ? src.find_last_not_of('=') + 1
- : src.length());
+ 0, src.ends_with("=") ? src.find_last_not_of('=') + 1 : src.length());
return encoded == src_no_padding;
}
return true;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/datapiece.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/datapiece.h
index 95b133da07..83516d0972 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/datapiece.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/datapiece.h
@@ -164,8 +164,7 @@ class LIBPROTOBUF_EXPORT DataPiece {
// If the value is not a string, attempts to convert to a 32-bit integer.
// If none of these succeeds, returns a conversion error status.
util::StatusOr<int> ToEnum(const google::protobuf::Enum* enum_type,
- bool use_lower_camel_for_enums,
- bool ignore_unknown_enum_values) const;
+ bool use_lower_camel_for_enums) const;
private:
// Disallow implicit constructor.
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter.cc
index b41feb7a5c..95b3a17dd4 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter.cc
@@ -62,12 +62,11 @@ DefaultValueObjectWriter::DefaultValueObjectWriter(
: typeinfo_(TypeInfo::NewTypeInfo(type_resolver)),
own_typeinfo_(true),
type_(type),
- current_(nullptr),
- root_(nullptr),
+ current_(NULL),
+ root_(NULL),
suppress_empty_list_(false),
preserve_proto_field_names_(false),
- use_ints_for_enums_(false),
- field_scrub_callback_(nullptr),
+ field_scrub_callback_(NULL),
ow_(ow) {}
DefaultValueObjectWriter::~DefaultValueObjectWriter() {
@@ -81,7 +80,7 @@ DefaultValueObjectWriter::~DefaultValueObjectWriter() {
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderBool(StringPiece name,
bool value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderBool(name, value);
} else {
RenderDataPiece(name, DataPiece(value));
@@ -91,7 +90,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderBool(StringPiece name,
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderInt32(
StringPiece name, int32 value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderInt32(name, value);
} else {
RenderDataPiece(name, DataPiece(value));
@@ -101,7 +100,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderInt32(
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderUint32(
StringPiece name, uint32 value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderUint32(name, value);
} else {
RenderDataPiece(name, DataPiece(value));
@@ -111,7 +110,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderUint32(
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderInt64(
StringPiece name, int64 value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderInt64(name, value);
} else {
RenderDataPiece(name, DataPiece(value));
@@ -121,7 +120,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderInt64(
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderUint64(
StringPiece name, uint64 value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderUint64(name, value);
} else {
RenderDataPiece(name, DataPiece(value));
@@ -131,7 +130,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderUint64(
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderDouble(
StringPiece name, double value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderDouble(name, value);
} else {
RenderDataPiece(name, DataPiece(value));
@@ -141,7 +140,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderDouble(
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderFloat(
StringPiece name, float value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderBool(name, value);
} else {
RenderDataPiece(name, DataPiece(value));
@@ -151,7 +150,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderFloat(
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderString(
StringPiece name, StringPiece value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderString(name, value);
} else {
// Since StringPiece is essentially a pointer, takes a copy of "value" to
@@ -164,7 +163,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderString(
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderBytes(
StringPiece name, StringPiece value) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderBytes(name, value);
} else {
// Since StringPiece is essentially a pointer, takes a copy of "value" to
@@ -177,7 +176,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderBytes(
DefaultValueObjectWriter* DefaultValueObjectWriter::RenderNull(
StringPiece name) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ow_->RenderNull(name);
} else {
RenderDataPiece(name, DataPiece::NullData());
@@ -201,10 +200,10 @@ DefaultValueObjectWriter::Node* DefaultValueObjectWriter::CreateNewNode(
DefaultValueObjectWriter::Node* DefaultValueObjectWriter::CreateNewNode(
const string& name, const google::protobuf::Type* type, NodeKind kind,
const DataPiece& data, bool is_placeholder, const std::vector<string>& path,
- bool suppress_empty_list, bool preserve_proto_field_names, bool use_ints_for_enums,
+ bool suppress_empty_list, bool preserve_proto_field_names,
FieldScrubCallBack* field_scrub_callback) {
return new Node(name, type, kind, data, is_placeholder, path,
- suppress_empty_list, preserve_proto_field_names, use_ints_for_enums,
+ suppress_empty_list, preserve_proto_field_names,
field_scrub_callback);
}
@@ -221,13 +220,12 @@ DefaultValueObjectWriter::Node::Node(
path_(path),
suppress_empty_list_(suppress_empty_list),
preserve_proto_field_names_(false),
- use_ints_for_enums_(false),
field_scrub_callback_(field_scrub_callback) {}
DefaultValueObjectWriter::Node::Node(
const string& name, const google::protobuf::Type* type, NodeKind kind,
const DataPiece& data, bool is_placeholder, const std::vector<string>& path,
- bool suppress_empty_list, bool preserve_proto_field_names, bool use_ints_for_enums,
+ bool suppress_empty_list, bool preserve_proto_field_names,
FieldScrubCallBack* field_scrub_callback)
: name_(name),
type_(type),
@@ -238,13 +236,12 @@ DefaultValueObjectWriter::Node::Node(
path_(path),
suppress_empty_list_(suppress_empty_list),
preserve_proto_field_names_(preserve_proto_field_names),
- use_ints_for_enums_(use_ints_for_enums),
field_scrub_callback_(field_scrub_callback) {}
DefaultValueObjectWriter::Node* DefaultValueObjectWriter::Node::FindChild(
StringPiece name) {
if (name.empty() || kind_ != OBJECT) {
- return nullptr;
+ return NULL;
}
for (int i = 0; i < children_.size(); ++i) {
Node* child = children_[i];
@@ -252,7 +249,7 @@ DefaultValueObjectWriter::Node* DefaultValueObjectWriter::Node::FindChild(
return child;
}
}
- return nullptr;
+ return NULL;
}
void DefaultValueObjectWriter::Node::WriteTo(ObjectWriter* ow) {
@@ -320,7 +317,7 @@ const google::protobuf::Type* DefaultValueObjectWriter::Node::GetMapValueType(
}
break;
}
- return nullptr;
+ return NULL;
}
void DefaultValueObjectWriter::Node::PopulateChildren(
@@ -331,7 +328,7 @@ void DefaultValueObjectWriter::Node::PopulateChildren(
// TODO(tsun): remove "kStructValueType" from the list. It's being checked
// now because of a bug in the tool-chain that causes the "oneof_index"
// of kStructValueType to not be set correctly.
- if (type_ == nullptr || type_->name() == kAnyType ||
+ if (type_ == NULL || type_->name() == kAnyType ||
type_->name() == kStructType || type_->name() == kTimestampType ||
type_->name() == kDurationType || type_->name() == kStructValueType) {
return;
@@ -354,7 +351,7 @@ void DefaultValueObjectWriter::Node::PopulateChildren(
path.insert(path.begin(), path_.begin(), path_.end());
}
path.push_back(field.name());
- if (field_scrub_callback_ != nullptr &&
+ if (field_scrub_callback_ != NULL &&
field_scrub_callback_->Run(path, &field)) {
continue;
}
@@ -365,11 +362,11 @@ void DefaultValueObjectWriter::Node::PopulateChildren(
// of children.
if (found != orig_children_map.end()) {
new_children.push_back(children_[found->second]);
- children_[found->second] = nullptr;
+ children_[found->second] = NULL;
continue;
}
- const google::protobuf::Type* field_type = nullptr;
+ const google::protobuf::Type* field_type = NULL;
bool is_map = false;
NodeKind kind = PRIMITIVE;
@@ -408,22 +405,22 @@ void DefaultValueObjectWriter::Node::PopulateChildren(
// If the child field is of primitive type, sets its data to the default
// value of its type.
- std::unique_ptr<Node> child(new Node(
+ google::protobuf::scoped_ptr<Node> child(new Node(
preserve_proto_field_names_ ? field.name() : field.json_name(),
field_type, kind,
- kind == PRIMITIVE ? CreateDefaultDataPieceForField(field, typeinfo, use_ints_for_enums_)
+ kind == PRIMITIVE ? CreateDefaultDataPieceForField(field, typeinfo)
: DataPiece::NullData(),
- true, path, suppress_empty_list_, preserve_proto_field_names_, use_ints_for_enums_,
+ true, path, suppress_empty_list_, preserve_proto_field_names_,
field_scrub_callback_));
new_children.push_back(child.release());
}
// Adds all leftover nodes in children_ to the beginning of new_child.
for (int i = 0; i < children_.size(); ++i) {
- if (children_[i] == nullptr) {
+ if (children_[i] == NULL) {
continue;
}
new_children.insert(new_children.begin(), children_[i]);
- children_[i] = nullptr;
+ children_[i] = NULL;
}
children_.swap(new_children);
}
@@ -431,14 +428,14 @@ void DefaultValueObjectWriter::Node::PopulateChildren(
void DefaultValueObjectWriter::MaybePopulateChildrenOfAny(Node* node) {
// If this is an "Any" node with "@type" already given and no other children
// have been added, populates its children.
- if (node != nullptr && node->is_any() && node->type() != nullptr &&
+ if (node != NULL && node->is_any() && node->type() != NULL &&
node->type()->name() != kAnyType && node->number_of_children() == 1) {
node->PopulateChildren(typeinfo_);
}
}
DataPiece DefaultValueObjectWriter::FindEnumDefault(
- const google::protobuf::Field& field, const TypeInfo* typeinfo, bool use_ints_for_enums) {
+ const google::protobuf::Field& field, const TypeInfo* typeinfo) {
if (!field.default_value().empty())
return DataPiece(field.default_value(), true);
@@ -451,12 +448,12 @@ DataPiece DefaultValueObjectWriter::FindEnumDefault(
}
// We treat the first value as the default if none is specified.
return enum_type->enumvalue_size() > 0
- ? (use_ints_for_enums ? DataPiece(enum_type->enumvalue(0).number()) : DataPiece(enum_type->enumvalue(0).name(), true))
+ ? DataPiece(enum_type->enumvalue(0).name(), true)
: DataPiece::NullData();
}
DataPiece DefaultValueObjectWriter::CreateDefaultDataPieceForField(
- const google::protobuf::Field& field, const TypeInfo* typeinfo, bool use_ints_for_enums) {
+ const google::protobuf::Field& field, const TypeInfo* typeinfo) {
switch (field.kind()) {
case google::protobuf::Field_Kind_TYPE_DOUBLE: {
return DataPiece(ConvertTo<double>(
@@ -499,7 +496,7 @@ DataPiece DefaultValueObjectWriter::CreateDefaultDataPieceForField(
field.default_value(), &DataPiece::ToUint32, static_cast<uint32>(0)));
}
case google::protobuf::Field_Kind_TYPE_ENUM: {
- return FindEnumDefault(field, typeinfo, use_ints_for_enums);
+ return FindEnumDefault(field, typeinfo);
}
default: { return DataPiece::NullData(); }
}
@@ -507,11 +504,11 @@ DataPiece DefaultValueObjectWriter::CreateDefaultDataPieceForField(
DefaultValueObjectWriter* DefaultValueObjectWriter::StartObject(
StringPiece name) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
std::vector<string> path;
root_.reset(CreateNewNode(string(name), &type_, OBJECT,
DataPiece::NullData(), false, path,
- suppress_empty_list_, preserve_proto_field_names_, use_ints_for_enums_,
+ suppress_empty_list_, preserve_proto_field_names_,
field_scrub_callback_.get()));
root_->PopulateChildren(typeinfo_);
current_ = root_.get();
@@ -519,17 +516,17 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::StartObject(
}
MaybePopulateChildrenOfAny(current_);
Node* child = current_->FindChild(name);
- if (current_->kind() == LIST || current_->kind() == MAP || child == nullptr) {
+ if (current_->kind() == LIST || current_->kind() == MAP || child == NULL) {
// If current_ is a list or a map node, we should create a new child and use
// the type of current_ as the type of the new child.
- std::unique_ptr<Node> node(
+ google::protobuf::scoped_ptr<Node> node(
CreateNewNode(string(name),
((current_->kind() == LIST || current_->kind() == MAP)
? current_->type()
- : nullptr),
+ : NULL),
OBJECT, DataPiece::NullData(), false,
- child == nullptr ? current_->path() : child->path(),
- suppress_empty_list_, preserve_proto_field_names_, use_ints_for_enums_,
+ child == NULL ? current_->path() : child->path(),
+ suppress_empty_list_, preserve_proto_field_names_,
field_scrub_callback_.get()));
child = node.get();
current_->AddChild(node.release());
@@ -558,22 +555,22 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::EndObject() {
DefaultValueObjectWriter* DefaultValueObjectWriter::StartList(
StringPiece name) {
- if (current_ == nullptr) {
+ if (current_ == NULL) {
std::vector<string> path;
root_.reset(CreateNewNode(string(name), &type_, LIST, DataPiece::NullData(),
false, path, suppress_empty_list_,
- preserve_proto_field_names_, use_ints_for_enums_,
+ preserve_proto_field_names_,
field_scrub_callback_.get()));
current_ = root_.get();
return this;
}
MaybePopulateChildrenOfAny(current_);
Node* child = current_->FindChild(name);
- if (child == nullptr || child->kind() != LIST) {
- std::unique_ptr<Node> node(
- CreateNewNode(string(name), nullptr, LIST, DataPiece::NullData(), false,
- child == nullptr ? current_->path() : child->path(),
- suppress_empty_list_, preserve_proto_field_names_, use_ints_for_enums_,
+ if (child == NULL || child->kind() != LIST) {
+ google::protobuf::scoped_ptr<Node> node(
+ CreateNewNode(string(name), NULL, LIST, DataPiece::NullData(), false,
+ child == NULL ? current_->path() : child->path(),
+ suppress_empty_list_, preserve_proto_field_names_,
field_scrub_callback_.get()));
child = node.get();
current_->AddChild(node.release());
@@ -587,8 +584,8 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::StartList(
void DefaultValueObjectWriter::WriteRoot() {
root_->WriteTo(ow_);
- root_.reset(nullptr);
- current_ = nullptr;
+ root_.reset(NULL);
+ current_ = NULL;
}
DefaultValueObjectWriter* DefaultValueObjectWriter::EndList() {
@@ -604,7 +601,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::EndList() {
void DefaultValueObjectWriter::RenderDataPiece(StringPiece name,
const DataPiece& data) {
MaybePopulateChildrenOfAny(current_);
- if (current_->type() != nullptr && current_->type()->name() == kAnyType &&
+ if (current_->type() != NULL && current_->type()->name() == kAnyType &&
name == "@type") {
util::StatusOr<string> data_string = data.ToString();
if (data_string.ok()) {
@@ -624,18 +621,18 @@ void DefaultValueObjectWriter::RenderDataPiece(StringPiece name,
// other children of primitive type now. Otherwise, we should wait until
// the first value field is rendered before we populate the children,
// because the "value" field of a Any message could be omitted.
- if (current_->number_of_children() > 1 && current_->type() != nullptr) {
+ if (current_->number_of_children() > 1 && current_->type() != NULL) {
current_->PopulateChildren(typeinfo_);
}
}
}
Node* child = current_->FindChild(name);
- if (child == nullptr || child->kind() != PRIMITIVE) {
+ if (child == NULL || child->kind() != PRIMITIVE) {
// No children are found, creates a new child.
- std::unique_ptr<Node> node(
- CreateNewNode(string(name), nullptr, PRIMITIVE, data, false,
- child == nullptr ? current_->path() : child->path(),
- suppress_empty_list_, preserve_proto_field_names_, use_ints_for_enums_,
+ google::protobuf::scoped_ptr<Node> node(
+ CreateNewNode(string(name), NULL, PRIMITIVE, data, false,
+ child == NULL ? current_->path() : child->path(),
+ suppress_empty_list_, preserve_proto_field_names_,
field_scrub_callback_.get()));
current_->AddChild(node.release());
} else {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter.h
index 6e71f9c898..09c6d23f4c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter.h
@@ -32,6 +32,9 @@
#define GOOGLE_PROTOBUF_UTIL_CONVERTER_DEFAULT_VALUE_OBJECTWRITER_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <stack>
#include <vector>
@@ -74,7 +77,7 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
FieldScrubCallBack;
// A unique pointer to a DefaultValueObjectWriter::FieldScrubCallBack.
- typedef std::unique_ptr<FieldScrubCallBack> FieldScrubCallBackPtr;
+ typedef google::protobuf::scoped_ptr<FieldScrubCallBack> FieldScrubCallBackPtr;
DefaultValueObjectWriter(TypeResolver* type_resolver,
const google::protobuf::Type& type,
@@ -128,12 +131,6 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
preserve_proto_field_names_ = value;
}
- // If set to true, enums are rendered as ints from output when default values
- // are written.
- void set_print_enums_as_ints(bool value) {
- use_ints_for_enums_ = value;
- }
-
protected:
enum NodeKind {
PRIMITIVE = 0,
@@ -153,7 +150,7 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
Node(const string& name, const google::protobuf::Type* type, NodeKind kind,
const DataPiece& data, bool is_placeholder,
const std::vector<string>& path, bool suppress_empty_list,
- bool preserve_proto_field_names, bool use_ints_for_enums,
+ bool preserve_proto_field_names,
FieldScrubCallBack* field_scrub_callback);
virtual ~Node() {
for (int i = 0; i < children_.size(); ++i) {
@@ -236,9 +233,6 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
// Whether to preserve original proto field names
bool preserve_proto_field_names_;
- // Whether to always print enums as ints
- bool use_ints_for_enums_;
-
// Pointer to function for determining whether a field needs to be scrubbed
// or not. This callback is owned by the creator of this node.
FieldScrubCallBack* field_scrub_callback_;
@@ -262,12 +256,11 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
const std::vector<string>& path,
bool suppress_empty_list,
bool preserve_proto_field_names,
- bool use_ints_for_enums,
FieldScrubCallBack* field_scrub_callback);
// Creates a DataPiece containing the default value of the type of the field.
static DataPiece CreateDefaultDataPieceForField(
- const google::protobuf::Field& field, const TypeInfo* typeinfo, bool use_ints_for_enums);
+ const google::protobuf::Field& field, const TypeInfo* typeinfo);
protected:
// Returns a pointer to current Node in tree.
@@ -279,7 +272,7 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
void MaybePopulateChildrenOfAny(Node* node);
// Writes the root_ node to ow_ and resets the root_ and current_ pointer to
- // nullptr.
+ // NULL.
void WriteRoot();
// Adds or replaces the data_ of a primitive child node.
@@ -289,8 +282,7 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
// there is no default. For proto3, where we cannot specify an explicit
// default, a zero value will always be returned.
static DataPiece FindEnumDefault(const google::protobuf::Field& field,
- const TypeInfo* typeinfo,
- bool use_ints_for_enums);
+ const TypeInfo* typeinfo);
// Type information for all the types used in the descriptor. Used to find
// google::protobuf::Type of nested messages/enums.
@@ -305,7 +297,7 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
// The current Node. Owned by its parents.
Node* current_;
// The root Node.
- std::unique_ptr<Node> root_;
+ google::protobuf::scoped_ptr<Node> root_;
// The stack to hold the path of Nodes from current_ to root_;
std::stack<Node*> stack_;
@@ -315,9 +307,6 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
// Whether to preserve original proto field names
bool preserve_proto_field_names_;
- // Whether to always print enums as ints
- bool use_ints_for_enums_;
-
// Unique Pointer to function for determining whether a field needs to be
// scrubbed or not.
FieldScrubCallBackPtr field_scrub_callback_;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
index 0c4af61bc8..e1dd697aec 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
@@ -60,7 +60,7 @@ class BaseDefaultValueObjectWriterTest
TypeInfoTestHelper helper_;
MockObjectWriter mock_;
ExpectingObjectWriter expects_;
- std::unique_ptr<DefaultValueObjectWriter> testing_;
+ google::protobuf::scoped_ptr<DefaultValueObjectWriter> testing_;
};
// Tests to cover some basic DefaultValueObjectWriter use cases. More tests are
@@ -156,7 +156,7 @@ class DefaultValueObjectWriterSuppressListTest
: BaseDefaultValueObjectWriterTest(DefaultValueTest::descriptor()) {
testing_->set_suppress_empty_list(true);
}
- ~DefaultValueObjectWriterSuppressListTest() override {}
+ ~DefaultValueObjectWriterSuppressListTest() {}
};
INSTANTIATE_TEST_CASE_P(DifferentTypeInfoSourceTest,
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/error_listener.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/error_listener.cc
index 538307bae2..538307bae2 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/error_listener.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/error_listener.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/error_listener.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/error_listener.h
index a19bd3f79a..1dc814a360 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/error_listener.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/error_listener.h
@@ -33,6 +33,9 @@
#include <algorithm>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/expecting_objectwriter.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/expecting_objectwriter.h
index ae98ddd86a..ae98ddd86a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/expecting_objectwriter.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/expecting_objectwriter.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/field_mask_utility.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/field_mask_utility.cc
index 778a4510d7..38835f67d2 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/field_mask_utility.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/field_mask_utility.cc
@@ -30,7 +30,6 @@
#include <google/protobuf/util/internal/field_mask_utility.h>
-#include <google/protobuf/util/internal/utility.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/status_macros.h>
@@ -54,7 +53,7 @@ string AppendPathSegmentToPrefix(StringPiece prefix, StringPiece segment) {
return prefix.ToString();
}
// If the segment is a map key, appends it to the prefix without the ".".
- if (StringStartsWith(segment, "[\"")) {
+ if (segment.starts_with("[\"")) {
return StrCat(prefix, segment);
}
return StrCat(prefix, ".", segment);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/field_mask_utility.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/field_mask_utility.h
index 59f36f756f..59f36f756f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/field_mask_utility.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/field_mask_utility.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_escaping.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_escaping.cc
index 06b9a7f2e9..18b7f92363 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_escaping.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_escaping.cc
@@ -207,7 +207,7 @@ StringPiece ToHex(uint16 cp, char* buffer) {
buffer[3] = kHex[cp & 0x0f];
cp >>= 4;
buffer[2] = kHex[cp & 0x0f];
- return StringPiece(buffer, 6);
+ return StringPiece(buffer).substr(0, 6);
}
// Stores the 32-bit unicode code point as its hexadecimal digits in buffer
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_escaping.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_escaping.h
index 5495c57f92..e3e329fc96 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_escaping.h
+++ b/third_party/protobuf/3.4.0/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 GOOGLE_PROTOBUF_UTIL_INTERNAL__JSON_ESCAPING_H__
-#define GOOGLE_PROTOBUF_UTIL_INTERNAL__JSON_ESCAPING_H__
+#ifndef NET_PROTO2_UTIL_CONVERTER_STRINGS_JSON_ESCAPING_H_
+#define NET_PROTO2_UTIL_CONVERTER_STRINGS_JSON_ESCAPING_H_
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/bytestream.h>
@@ -87,5 +87,5 @@ class JsonEscaping {
} // namespace util
} // namespace protobuf
+#endif // NET_PROTO2_UTIL_CONVERTER_STRINGS_JSON_ESCAPING_H_
} // namespace google
-#endif // GOOGLE_PROTOBUF_UTIL_INTERNAL__JSON_ESCAPING_H__
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter.cc
index a431177a50..6e4edd8836 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter.cc
@@ -57,7 +57,7 @@ JsonObjectWriter::~JsonObjectWriter() {
JsonObjectWriter* JsonObjectWriter::StartObject(StringPiece name) {
WritePrefix(name);
WriteChar('{');
- PushObject();
+ Push();
return this;
}
@@ -71,7 +71,7 @@ JsonObjectWriter* JsonObjectWriter::EndObject() {
JsonObjectWriter* JsonObjectWriter::StartList(StringPiece name) {
WritePrefix(name);
WriteChar('[');
- PushArray();
+ Push();
return this;
}
@@ -172,7 +172,8 @@ void JsonObjectWriter::WritePrefix(StringPiece name) {
bool not_first = !element()->is_first();
if (not_first) WriteChar(',');
if (not_first || !element()->is_root()) NewLine();
- if (!name.empty() || element()->is_json_object()) {
+ bool empty_key_ok = GetAndResetEmptyKeyOk();
+ if (!name.empty() || empty_key_ok) {
WriteChar('"');
if (!name.empty()) {
ArrayByteSource source(name);
@@ -183,6 +184,12 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter.h
index 81644dabd4..31edc2927f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter.h
@@ -32,6 +32,9 @@
#define GOOGLE_PROTOBUF_UTIL_CONVERTER_JSON_OBJECTWRITER_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <google/protobuf/io/coded_stream.h>
@@ -86,11 +89,12 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
public:
JsonObjectWriter(StringPiece indent_string,
google::protobuf::io::CodedOutputStream* out)
- : element_(new Element(/*parent=*/nullptr, /*is_json_object=*/false)),
+ : element_(new Element(NULL)),
stream_(out),
sink_(out),
indent_string_(indent_string.ToString()),
- use_websafe_base64_for_bytes_(false) {}
+ use_websafe_base64_for_bytes_(false),
+ empty_name_ok_for_next_key_(false) {}
virtual ~JsonObjectWriter();
// ObjectWriter methods.
@@ -114,13 +118,17 @@ 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:
- Element(Element* parent, bool is_json_object)
- : BaseElement(parent),
- is_first_(true),
- is_json_object_(is_json_object) {}
+ explicit Element(Element* parent) : BaseElement(parent), is_first_(true) {}
// Called before each field of the Element is to be processed.
// Returns true if this is the first call (processing the first field).
@@ -132,13 +140,8 @@ 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);
};
@@ -172,15 +175,8 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
return this;
}
- // 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));
- }
+ // Pushes a new element to the stack.
+ void Push() { element_.reset(new Element(element_.release())); }
// Pops an element off of the stack and deletes the popped element.
void Pop() {
@@ -208,7 +204,11 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
// Writes an individual character to the output.
void WriteChar(const char c) { stream_->WriteRaw(&c, sizeof(c)); }
- std::unique_ptr<Element> element_;
+ // 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_;
const string indent_string_;
@@ -217,6 +217,11 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter_test.cc
index 0dc710c7fe..bbd9d78a43 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_objectwriter_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_objectwriter_test.cc
@@ -47,7 +47,7 @@ class JsonObjectWriterTest : public ::testing::Test {
JsonObjectWriterTest()
: str_stream_(new StringOutputStream(&output_)),
out_stream_(new CodedOutputStream(str_stream_)),
- ow_(nullptr) {}
+ ow_(NULL) {}
virtual ~JsonObjectWriterTest() {
delete ow_;
@@ -95,12 +95,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser.cc
index 1c63b31d37..047c14e150 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser.cc
@@ -36,6 +36,9 @@
#include <cstdlib>
#include <cstring>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -154,7 +157,7 @@ util::Status JsonStreamParser::FinishParse() {
}
// Storage for UTF8-coerced string.
- std::unique_ptr<char[]> utf8;
+ google::protobuf::scoped_array<char> utf8;
if (coerce_to_utf8_) {
utf8.reset(new char[leftover_.size()]);
char* coerced = internal::UTF8CoerceToStructurallyValid(leftover_, utf8.get(), ' ');
@@ -495,19 +498,6 @@ util::Status JsonStreamParser::ParseNumber() {
return result;
}
-util::Status JsonStreamParser::ParseDoubleHelper(
- const string& number, NumberResult* result) {
- if (!safe_strtod(number, &result->double_val)) {
- return ReportFailure("Unable to parse number.");
- }
- if (!loose_float_number_conversion_ &&
- !MathLimits<double>::IsFinite(result->double_val)) {
- return ReportFailure("Number exceeds the range of double.");
- }
- result->type = NumberResult::DOUBLE;
- return util::Status();
-}
-
util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) {
const char* data = p_.data();
int length = p_.length();
@@ -543,11 +533,16 @@ util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) {
// Floating point number, parse as a double.
if (floating) {
- util::Status status = ParseDoubleHelper(number, result);
- if (status.ok()) {
- p_.remove_prefix(index);
+ if (!safe_strtod(number, &result->double_val)) {
+ return ReportFailure("Unable to parse number.");
}
- return status;
+ if (!loose_float_number_conversion_ &&
+ !MathLimits<double>::IsFinite(result->double_val)) {
+ return ReportFailure("Number exceeds the range of double.");
+ }
+ result->type = NumberResult::DOUBLE;
+ p_.remove_prefix(index);
+ return util::Status();
}
// Positive non-floating point number, parse as a uint64.
@@ -556,18 +551,12 @@ util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) {
if (number.length() >= 2 && number[0] == '0') {
return ReportFailure("Octal/hex numbers are not valid JSON values.");
}
- if (safe_strtou64(number, &result->uint_val)) {
- result->type = NumberResult::UINT;
- p_.remove_prefix(index);
- return util::Status();
- } else {
- // If the value is too large, parse it as double.
- util::Status status = ParseDoubleHelper(number, result);
- if (status.ok()) {
- p_.remove_prefix(index);
- }
- return status;
+ if (!safe_strtou64(number, &result->uint_val)) {
+ return ReportFailure("Unable to parse number.");
}
+ result->type = NumberResult::UINT;
+ p_.remove_prefix(index);
+ return util::Status();
}
// Octal/Hex numbers are not valid JSON values.
@@ -575,18 +564,12 @@ util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) {
return ReportFailure("Octal/hex numbers are not valid JSON values.");
}
// Negative non-floating point number, parse as an int64.
- if (safe_strto64(number, &result->int_val)) {
- result->type = NumberResult::INT;
- p_.remove_prefix(index);
- return util::Status();
- } else {
- // If the value is too large, parse it as double.
- util::Status status = ParseDoubleHelper(number, result);
- if (status.ok()) {
- p_.remove_prefix(index);
- }
- return status;
+ if (!safe_strto64(number, &result->int_val)) {
+ return ReportFailure("Unable to parse number.");
}
+ result->type = NumberResult::INT;
+ p_.remove_prefix(index);
+ return util::Status();
}
util::Status JsonStreamParser::HandleBeginObject() {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser.h
index 31933b6749..6b9d46ee22 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser.h
@@ -154,9 +154,6 @@ class LIBPROTOBUF_EXPORT JsonStreamParser {
// component.
util::Status ParseNumberHelper(NumberResult* result);
- // Parse a number as double into a NumberResult.
- util::Status ParseDoubleHelper(const string& number, NumberResult* result);
-
// Handles a { during parsing of a value.
util::Status HandleBeginObject();
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser_test.cc
index a11e9be030..ca71ff2419 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/json_stream_parser_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/json_stream_parser_test.cc
@@ -694,19 +694,20 @@ TEST_F(JsonStreamParserTest, ExtraCharactersAfterObject) {
}
}
-TEST_F(JsonStreamParserTest, PositiveNumberTooBigIsDouble) {
- StringPiece str = "18446744073709551616"; // 2^64
+// numbers too large
+TEST_F(JsonStreamParserTest, PositiveNumberTooBig) {
+ StringPiece str = "[18446744073709551616]"; // 2^64
for (int i = 0; i <= str.length(); ++i) {
- ow_.RenderDouble("", 18446744073709552000.0);
- DoTest(str, i);
+ ow_.StartList("");
+ DoErrorTest(str, i, "Unable to parse number.");
}
}
-TEST_F(JsonStreamParserTest, NegativeNumberTooBigIsDouble) {
- StringPiece str = "-18446744073709551616";
+TEST_F(JsonStreamParserTest, NegativeNumberTooBig) {
+ StringPiece str = "[-18446744073709551616]";
for (int i = 0; i <= str.length(); ++i) {
- ow_.RenderDouble("", -18446744073709551616.0);
- DoTest(str, i);
+ ow_.StartList("");
+ DoErrorTest(str, i, "Unable to parse number.");
}
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/location_tracker.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/location_tracker.h
index 0864b05737..0864b05737 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/location_tracker.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/location_tracker.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/mock_error_listener.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/mock_error_listener.h
index 591c35dbbb..591c35dbbb 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/mock_error_listener.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/mock_error_listener.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_location_tracker.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_location_tracker.h
index 8586cecc91..8586cecc91 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_location_tracker.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_location_tracker.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_source.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_source.h
index 2c31cfb09e..2c31cfb09e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_source.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_source.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_writer.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_writer.cc
index 57cc08a1d7..57cc08a1d7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_writer.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_writer.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_writer.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_writer.h
index 5781aa1e21..b6fbd19bf7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/object_writer.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/object_writer.h
@@ -119,6 +119,13 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/proto_writer.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/proto_writer.cc
index b7a52db642..8bebf2ab1f 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/proto_writer.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/proto_writer.cc
@@ -66,7 +66,7 @@ ProtoWriter::ProtoWriter(TypeResolver* type_resolver,
done_(false),
ignore_unknown_fields_(false),
use_lower_camel_for_enums_(false),
- element_(nullptr),
+ element_(NULL),
size_insert_(),
output_(output),
buffer_(),
@@ -85,7 +85,7 @@ ProtoWriter::ProtoWriter(const TypeInfo* typeinfo,
done_(false),
ignore_unknown_fields_(false),
use_lower_camel_for_enums_(false),
- element_(nullptr),
+ element_(NULL),
size_insert_(),
output_(output),
buffer_(),
@@ -99,14 +99,14 @@ ProtoWriter::~ProtoWriter() {
if (own_typeinfo_) {
delete typeinfo_;
}
- if (element_ == nullptr) return;
+ if (element_ == NULL) return;
// Cleanup explicitly in order to avoid destructor stack overflow when input
// is deeply nested.
// Cast to BaseElement to avoid doing additional checks (like missing fields)
// during pop().
- std::unique_ptr<BaseElement> element(
+ google::protobuf::scoped_ptr<BaseElement> element(
static_cast<BaseElement*>(element_.get())->pop<BaseElement>());
- while (element != nullptr) {
+ while (element != NULL) {
element.reset(element->pop<BaseElement>());
}
}
@@ -267,9 +267,8 @@ inline Status WriteString(int field_number, const DataPiece& data,
inline Status WriteEnum(int field_number, const DataPiece& data,
const google::protobuf::Enum* enum_type,
CodedOutputStream* stream,
- bool use_lower_camel_for_enums,
- bool ignore_unknown_values) {
- StatusOr<int> e = data.ToEnum(enum_type, use_lower_camel_for_enums, ignore_unknown_values);
+ bool use_lower_camel_for_enums) {
+ StatusOr<int> e = data.ToEnum(enum_type, use_lower_camel_for_enums);
if (e.ok()) {
WireFormatLite::WriteEnum(field_number, e.ValueOrDie(), stream);
}
@@ -295,9 +294,9 @@ std::set<const google::protobuf::Field*> GetRequiredFields(
ProtoWriter::ProtoElement::ProtoElement(const TypeInfo* typeinfo,
const google::protobuf::Type& type,
ProtoWriter* enclosing)
- : BaseElement(nullptr),
+ : BaseElement(NULL),
ow_(enclosing),
- parent_field_(nullptr),
+ parent_field_(NULL),
typeinfo_(typeinfo),
proto3_(type.syntax() == google::protobuf::SYNTAX_PROTO3),
type_(type),
@@ -375,7 +374,7 @@ ProtoWriter::ProtoElement* ProtoWriter::ProtoElement::pop() {
// all enclosing messages.
int size = ow_->size_insert_[size_index_].size;
int length = CodedOutputStream::VarintSize32(size);
- for (ProtoElement* e = parent(); e != nullptr; e = e->parent()) {
+ for (ProtoElement* e = parent(); e != NULL; e = e->parent()) {
// Only nested messages have size field, lists do not have size field.
if (e->size_index_ >= 0) {
ow_->size_insert_[e->size_index_].size += length;
@@ -395,7 +394,7 @@ void ProtoWriter::ProtoElement::RegisterField(
}
string ProtoWriter::ProtoElement::ToString() const {
- if (parent() == nullptr) return "";
+ if (parent() == NULL) return "";
string loc = parent()->ToString();
if (!ow_->IsRepeated(*parent_field_) ||
parent()->parent_field_ != parent_field_) {
@@ -440,7 +439,7 @@ void ProtoWriter::MissingField(StringPiece missing_name) {
ProtoWriter* ProtoWriter::StartObject(StringPiece name) {
// Starting the root message. Create the root ProtoElement and return.
- if (element_ == nullptr) {
+ if (element_ == NULL) {
if (!name.empty()) {
InvalidName(name, "Root element should not be named.");
}
@@ -448,9 +447,9 @@ ProtoWriter* ProtoWriter::StartObject(StringPiece name) {
return this;
}
- const google::protobuf::Field* field = nullptr;
+ const google::protobuf::Field* field = NULL;
field = BeginNamed(name, false);
- if (field == nullptr) return this;
+ if (field == NULL) return this;
// Check to see if this field is a oneof and that no oneof in that group has
// already been set.
@@ -460,7 +459,7 @@ ProtoWriter* ProtoWriter::StartObject(StringPiece name) {
}
const google::protobuf::Type* type = LookupType(field);
- if (type == nullptr) {
+ if (type == NULL) {
++invalid_depth_;
InvalidName(name,
StrCat("Missing descriptor for field: ", field->type_url()));
@@ -476,14 +475,14 @@ ProtoWriter* ProtoWriter::EndObject() {
return this;
}
- if (element_ != nullptr) {
+ if (element_ != NULL) {
element_.reset(element_->pop());
}
// If ending the root element,
// then serialize the full message with calculated sizes.
- if (element_ == nullptr) {
+ if (element_ == NULL) {
WriteRootMessage();
}
return this;
@@ -491,7 +490,7 @@ ProtoWriter* ProtoWriter::EndObject() {
ProtoWriter* ProtoWriter::StartList(StringPiece name) {
const google::protobuf::Field* field = BeginNamed(name, true);
- if (field == nullptr) return this;
+ if (field == NULL) return this;
if (!ValidOneof(*field, name)) {
++invalid_depth_;
@@ -499,7 +498,7 @@ ProtoWriter* ProtoWriter::StartList(StringPiece name) {
}
const google::protobuf::Type* type = LookupType(field);
- if (type == nullptr) {
+ if (type == NULL) {
++invalid_depth_;
InvalidName(name,
StrCat("Missing descriptor for field: ", field->type_url()));
@@ -512,7 +511,7 @@ ProtoWriter* ProtoWriter::StartList(StringPiece name) {
ProtoWriter* ProtoWriter::EndList() {
if (invalid_depth_ > 0) {
--invalid_depth_;
- } else if (element_ != nullptr) {
+ } else if (element_ != NULL) {
element_.reset(element_->pop());
}
return this;
@@ -524,12 +523,12 @@ ProtoWriter* ProtoWriter::RenderDataPiece(StringPiece name,
if (invalid_depth_ > 0) return this;
const google::protobuf::Field* field = Lookup(name);
- if (field == nullptr) return this;
+ if (field == NULL) return this;
if (!ValidOneof(*field, name)) return this;
const google::protobuf::Type* type = LookupType(field);
- if (type == nullptr) {
+ if (type == NULL) {
InvalidName(name,
StrCat("Missing descriptor for field: ", field->type_url()));
return this;
@@ -540,7 +539,7 @@ ProtoWriter* ProtoWriter::RenderDataPiece(StringPiece name,
bool ProtoWriter::ValidOneof(const google::protobuf::Field& field,
StringPiece unnormalized_name) {
- if (element_ == nullptr) return true;
+ if (element_ == NULL) return true;
if (field.oneof_index() > 0) {
if (element_->IsOneofIndexTaken(field.oneof_index())) {
@@ -666,8 +665,7 @@ ProtoWriter* ProtoWriter::RenderPrimitiveField(
case google::protobuf::Field_Kind_TYPE_ENUM: {
status = WriteEnum(field.number(), data,
typeinfo_->GetEnumByTypeUrl(field.type_url()),
- stream_.get(), use_lower_camel_for_enums_,
- ignore_unknown_fields_);
+ stream_.get(), use_lower_camel_for_enums_);
break;
}
default: // TYPE_GROUP or TYPE_MESSAGE
@@ -694,18 +692,18 @@ const google::protobuf::Field* ProtoWriter::BeginNamed(StringPiece name,
bool is_list) {
if (invalid_depth_ > 0) {
++invalid_depth_;
- return nullptr;
+ return NULL;
}
const google::protobuf::Field* field = Lookup(name);
- if (field == nullptr) {
+ if (field == NULL) {
++invalid_depth_;
// InvalidName() already called in Lookup().
- return nullptr;
+ return NULL;
}
if (is_list && !IsRepeated(*field)) {
++invalid_depth_;
InvalidName(name, "Proto field is not repeating, cannot start list.");
- return nullptr;
+ return NULL;
}
return field;
}
@@ -713,23 +711,23 @@ const google::protobuf::Field* ProtoWriter::BeginNamed(StringPiece name,
const google::protobuf::Field* ProtoWriter::Lookup(
StringPiece unnormalized_name) {
ProtoElement* e = element();
- if (e == nullptr) {
+ if (e == NULL) {
InvalidName(unnormalized_name, "Root element must be a message.");
- return nullptr;
+ return NULL;
}
if (unnormalized_name.empty()) {
// Objects in repeated field inherit the same field descriptor.
- if (e->parent_field() == nullptr) {
+ if (e->parent_field() == NULL) {
InvalidName(unnormalized_name, "Proto fields must have a name.");
} else if (!IsRepeated(*e->parent_field())) {
InvalidName(unnormalized_name, "Proto fields must have a name.");
- return nullptr;
+ return NULL;
}
return e->parent_field();
}
const google::protobuf::Field* field =
typeinfo_->FindField(&e->type(), unnormalized_name);
- if (field == nullptr && !ignore_unknown_fields_) {
+ if (field == NULL && !ignore_unknown_fields_) {
InvalidName(unnormalized_name, "Cannot find field.");
}
return field;
@@ -748,7 +746,7 @@ void ProtoWriter::WriteRootMessage() {
int curr_pos = 0;
// Calls the destructor of CodedOutputStream to remove any uninitialized
// memory from the Cord before we read it.
- stream_.reset(nullptr);
+ stream_.reset(NULL);
const void* data;
int length;
google::protobuf::io::ArrayInputStream input_stream(buffer_.data(), buffer_.size());
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/proto_writer.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/proto_writer.h
index 284969639e..0db8485cb7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/proto_writer.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/proto_writer.h
@@ -81,32 +81,32 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
virtual ~ProtoWriter();
// ObjectWriter methods.
- ProtoWriter* StartObject(StringPiece name) override;
- ProtoWriter* EndObject() override;
- ProtoWriter* StartList(StringPiece name) override;
- ProtoWriter* EndList() override;
- ProtoWriter* RenderBool(StringPiece name, bool value) override {
+ ProtoWriter* StartObject(StringPiece name);
+ ProtoWriter* EndObject();
+ ProtoWriter* StartList(StringPiece name);
+ ProtoWriter* EndList();
+ ProtoWriter* RenderBool(StringPiece name, bool value) {
return RenderDataPiece(name, DataPiece(value));
}
- ProtoWriter* RenderInt32(StringPiece name, int32 value) override {
+ ProtoWriter* RenderInt32(StringPiece name, int32 value) {
return RenderDataPiece(name, DataPiece(value));
}
- ProtoWriter* RenderUint32(StringPiece name, uint32 value) override {
+ ProtoWriter* RenderUint32(StringPiece name, uint32 value) {
return RenderDataPiece(name, DataPiece(value));
}
- ProtoWriter* RenderInt64(StringPiece name, int64 value) override {
+ ProtoWriter* RenderInt64(StringPiece name, int64 value) {
return RenderDataPiece(name, DataPiece(value));
}
- ProtoWriter* RenderUint64(StringPiece name, uint64 value) override {
+ ProtoWriter* RenderUint64(StringPiece name, uint64 value) {
return RenderDataPiece(name, DataPiece(value));
}
- ProtoWriter* RenderDouble(StringPiece name, double value) override {
+ ProtoWriter* RenderDouble(StringPiece name, double value) {
return RenderDataPiece(name, DataPiece(value));
}
- ProtoWriter* RenderFloat(StringPiece name, float value) override {
+ ProtoWriter* RenderFloat(StringPiece name, float value) {
return RenderDataPiece(name, DataPiece(value));
}
- ProtoWriter* RenderString(StringPiece name, StringPiece value) override {
+ ProtoWriter* RenderString(StringPiece name, StringPiece value) {
return RenderDataPiece(name,
DataPiece(value, use_strict_base64_decoding()));
}
@@ -114,7 +114,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
return RenderDataPiece(
name, DataPiece(value, false, use_strict_base64_decoding()));
}
- ProtoWriter* RenderNull(StringPiece name) override {
+ ProtoWriter* RenderNull(StringPiece name) {
return RenderDataPiece(name, DataPiece::NullData());
}
@@ -126,11 +126,11 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
// Returns the location tracker to use for tracking locations for errors.
const LocationTrackerInterface& location() {
- return element_ != nullptr ? *element_ : *tracker_;
+ return element_ != NULL ? *element_ : *tracker_;
}
// When true, we finished writing to output a complete message.
- bool done() override { return done_; }
+ bool done() { return done_; }
// Returns the proto stream object.
google::protobuf::io::CodedOutputStream* stream() { return stream_.get(); }
@@ -173,7 +173,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
ProtoElement* pop();
// Accessors
- // parent_field() may be nullptr if we are at root.
+ // parent_field() may be NULL if we are at root.
const google::protobuf::Field* parent_field() const {
return parent_field_;
}
@@ -204,7 +204,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
ProtoWriter* ow_;
// Describes the element as a field in the parent message.
- // parent_field_ is nullptr if and only if this element is the root element.
+ // parent_field_ is NULL if and only if this element is the root element.
const google::protobuf::Field* parent_field_;
// TypeInfo to lookup types.
@@ -242,7 +242,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
ProtoWriter(const TypeInfo* typeinfo, const google::protobuf::Type& type,
strings::ByteSink* output, ErrorListener* listener);
- ProtoElement* element() override { return element_.get(); }
+ ProtoElement* element() { return element_.get(); }
// Helper methods for calling ErrorListener. See error_listener.h.
void InvalidName(StringPiece unknown_name, StringPiece message);
@@ -259,7 +259,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
// extensions are found.
const google::protobuf::Field* Lookup(StringPiece name);
- // Lookup the field type in the type descriptor. Returns nullptr if the type
+ // Lookup the field type in the type descriptor. Returns NULL if the type
// is not known.
const google::protobuf::Type* LookupType(
const google::protobuf::Field* field);
@@ -309,7 +309,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
// Indicates whether we finished writing root message completely.
bool done_;
- // If true, don't report unknown field names and enum values to the listener.
+ // If true, don't report unknown field names to the listener.
bool ignore_unknown_fields_;
// If true, check if enum name in camel case or without underscore matches the
@@ -321,7 +321,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
// size_insert_: sizes of nested messages.
// pos - position to insert the size field.
// size - size value to be inserted.
- std::unique_ptr<ProtoElement> element_;
+ google::protobuf::scoped_ptr<ProtoElement> element_;
std::deque<SizeInfo> size_insert_;
// Variables for output generation:
@@ -332,7 +332,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
strings::ByteSink* output_;
string buffer_;
google::protobuf::io::StringOutputStream adapter_;
- std::unique_ptr<google::protobuf::io::CodedOutputStream> stream_;
+ google::protobuf::scoped_ptr<google::protobuf::io::CodedOutputStream> stream_;
// Variables for error tracking and reporting:
// listener_ : a place to report any errors found.
@@ -340,7 +340,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
// tracker_ : the root location tracker interface.
ErrorListener* listener_;
int invalid_depth_;
- std::unique_ptr<LocationTrackerInterface> tracker_;
+ google::protobuf::scoped_ptr<LocationTrackerInterface> tracker_;
GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS(ProtoWriter);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource.cc
index 56e6db1243..02360a1a32 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource.cc
@@ -73,14 +73,14 @@ namespace {
static int kDefaultMaxRecursionDepth = 64;
-// Finds a field with the given number. nullptr if none found.
+// Finds a field with the given number. NULL if none found.
const google::protobuf::Field* FindFieldByNumber(
const google::protobuf::Type& type, int number);
// Returns true if the field is packable.
bool IsPackable(const google::protobuf::Field& field);
-// Finds an enum value with the given number. nullptr if none found.
+// Finds an enum value with the given number. NULL if none found.
const google::protobuf::EnumValue* FindEnumValueByNumber(
const google::protobuf::Enum& tech_enum, int number);
@@ -127,7 +127,7 @@ ProtoStreamObjectSource::ProtoStreamObjectSource(
render_unknown_fields_(false),
render_unknown_enum_values_(true),
add_trailing_zeros_for_timestamp_and_duration_(false) {
- GOOGLE_LOG_IF(DFATAL, stream == nullptr) << "Input stream is nullptr.";
+ GOOGLE_LOG_IF(DFATAL, stream == NULL) << "Input stream is NULL.";
}
ProtoStreamObjectSource::ProtoStreamObjectSource(
@@ -145,7 +145,7 @@ ProtoStreamObjectSource::ProtoStreamObjectSource(
render_unknown_fields_(false),
render_unknown_enum_values_(true),
add_trailing_zeros_for_timestamp_and_duration_(false) {
- GOOGLE_LOG_IF(DFATAL, stream == nullptr) << "Input stream is nullptr.";
+ GOOGLE_LOG_IF(DFATAL, stream == NULL) << "Input stream is NULL.";
}
ProtoStreamObjectSource::~ProtoStreamObjectSource() {
@@ -165,7 +165,7 @@ const google::protobuf::Field* ProtoStreamObjectSource::FindAndVerifyField(
const google::protobuf::Field* field = FindFieldByNumber(type, tag >> 3);
// Verify if the field corresponds to the wire type in tag.
// If there is any discrepancy, mark the field as not found.
- if (field != nullptr) {
+ if (field != NULL) {
WireFormatLite::WireType expected_type =
WireFormatLite::WireTypeForFieldType(
static_cast<WireFormatLite::FieldType>(field->kind()));
@@ -173,7 +173,7 @@ const google::protobuf::Field* ProtoStreamObjectSource::FindAndVerifyField(
if (actual_type != expected_type &&
(!IsPackable(*field) ||
actual_type != WireFormatLite::WIRETYPE_LENGTH_DELIMITED)) {
- field = nullptr;
+ field = NULL;
}
}
return field;
@@ -186,11 +186,11 @@ Status ProtoStreamObjectSource::WriteMessage(const google::protobuf::Type& type,
ObjectWriter* ow) const {
const TypeRenderer* type_renderer = FindTypeRenderer(type.name());
- if (type_renderer != nullptr) {
+ if (type_renderer != NULL) {
return (*type_renderer)(this, type, name, ow);
}
- const google::protobuf::Field* field = nullptr;
+ const google::protobuf::Field* field = NULL;
string field_name;
// last_tag set to dummy value that is different from tag.
uint32 tag = stream_->ReadTag(), last_tag = tag + 1;
@@ -203,7 +203,7 @@ Status ProtoStreamObjectSource::WriteMessage(const google::protobuf::Type& type,
if (tag != last_tag) { // Update field only if tag is changed.
last_tag = tag;
field = FindAndVerifyField(type, tag);
- if (field != nullptr) {
+ if (field != NULL) {
if (preserve_proto_field_names_) {
field_name = field->name();
} else {
@@ -211,11 +211,11 @@ Status ProtoStreamObjectSource::WriteMessage(const google::protobuf::Type& type,
}
}
}
- if (field == nullptr) {
+ if (field == NULL) {
// If we didn't find a field, skip this unknown tag.
// TODO(wpoon): Check return boolean value.
WireFormat::SkipField(stream_, tag,
- render_unknown_fields_ ? &unknown_fields : nullptr);
+ render_unknown_fields_ ? &unknown_fields : NULL);
tag = stream_->ReadTag();
continue;
}
@@ -282,8 +282,8 @@ StatusOr<uint32> ProtoStreamObjectSource::RenderMap(
for (uint32 tag = stream_->ReadTag(); tag != 0; tag = stream_->ReadTag()) {
const google::protobuf::Field* field =
FindAndVerifyField(*field_type, tag);
- if (field == nullptr) {
- WireFormat::SkipField(stream_, tag, nullptr);
+ if (field == NULL) {
+ WireFormat::SkipField(stream_, tag, NULL);
continue;
}
// Map field numbers are key = 1 and value = 2
@@ -294,12 +294,14 @@ StatusOr<uint32> ProtoStreamObjectSource::RenderMap(
// An absent map key is treated as the default.
const google::protobuf::Field* key_field =
FindFieldByNumber(*field_type, 1);
- if (key_field == nullptr) {
+ if (key_field == NULL) {
// The Type info for this map entry is incorrect. It should always
// have a field named "key" and with field number 1.
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 {
@@ -525,7 +527,7 @@ Status ProtoStreamObjectSource::RenderStruct(const ProtoStreamObjectSource* os,
const google::protobuf::Type& type,
StringPiece field_name,
ObjectWriter* ow) {
- const google::protobuf::Field* field = nullptr;
+ const google::protobuf::Field* field = NULL;
uint32 tag = os->stream_->ReadTag();
ow->StartObject(field_name);
while (tag != 0) {
@@ -543,12 +545,12 @@ Status ProtoStreamObjectSource::RenderStruct(const ProtoStreamObjectSource* os,
Status ProtoStreamObjectSource::RenderStructValue(
const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
StringPiece field_name, ObjectWriter* ow) {
- const google::protobuf::Field* field = nullptr;
+ const google::protobuf::Field* field = NULL;
for (uint32 tag = os->stream_->ReadTag(); tag != 0;
tag = os->stream_->ReadTag()) {
field = os->FindAndVerifyField(type, tag);
- if (field == nullptr) {
- WireFormat::SkipField(os->stream_, tag, nullptr);
+ if (field == NULL) {
+ WireFormat::SkipField(os->stream_, tag, NULL);
continue;
}
RETURN_IF_ERROR(os->RenderField(field, field_name, ow));
@@ -571,8 +573,8 @@ Status ProtoStreamObjectSource::RenderStructListValue(
while (tag != 0) {
const google::protobuf::Field* field = os->FindAndVerifyField(type, tag);
- if (field == nullptr) {
- WireFormat::SkipField(os->stream_, tag, nullptr);
+ if (field == NULL) {
+ WireFormat::SkipField(os->stream_, tag, NULL);
tag = os->stream_->ReadTag();
continue;
}
@@ -593,8 +595,8 @@ Status ProtoStreamObjectSource::RenderAny(const ProtoStreamObjectSource* os,
// First read out the type_url and value from the proto stream
for (tag = os->stream_->ReadTag(); tag != 0; tag = os->stream_->ReadTag()) {
const google::protobuf::Field* field = os->FindAndVerifyField(type, tag);
- if (field == nullptr) {
- WireFormat::SkipField(os->stream_, tag, nullptr);
+ if (field == NULL) {
+ WireFormat::SkipField(os->stream_, tag, NULL);
continue;
}
// 'type_url' has field number of 1 and 'value' has field number 2
@@ -667,7 +669,7 @@ Status ProtoStreamObjectSource::RenderFieldMask(
tag = os->stream_->ReadTag()) {
if (paths_field_tag == 0) {
const google::protobuf::Field* field = os->FindAndVerifyField(type, tag);
- if (field != nullptr && field->number() == 1 &&
+ if (field != NULL && field->number() == 1 &&
field->name() == "paths") {
paths_field_tag = tag;
}
@@ -754,7 +756,7 @@ Status ProtoStreamObjectSource::RenderField(
// Get the nested message type for this field.
const google::protobuf::Type* type =
typeinfo_->GetTypeByTypeUrl(field->type_url());
- if (type == nullptr) {
+ if (type == NULL) {
return Status(util::error::INTERNAL,
StrCat("Invalid configuration. Could not find the type: ",
field->type_url()));
@@ -763,7 +765,7 @@ Status ProtoStreamObjectSource::RenderField(
// Short-circuit any special type rendering to save call-stack space.
const TypeRenderer* type_renderer = FindTypeRenderer(type->name());
- bool use_type_renderer = type_renderer != nullptr;
+ bool use_type_renderer = type_renderer != NULL;
if (use_type_renderer) {
RETURN_IF_ERROR((*type_renderer)(this, *type, field_name, ow));
@@ -873,15 +875,14 @@ Status ProtoStreamObjectSource::RenderNonMessageField(
typeinfo_->GetEnumByTypeUrl(field->type_url());
// Lookup the name of the enum, and render that. Unknown enum values
// are printed as integers.
- if (en != nullptr) {
+ if (en != NULL) {
const google::protobuf::EnumValue* enum_value =
FindEnumValueByNumber(*en, buffer32);
- if (enum_value != nullptr) {
+ if (enum_value != NULL) {
if (use_ints_for_enums_) {
ow->RenderInt32(field_name, buffer32);
} else if (use_lower_camel_for_enums_) {
- ow->RenderString(field_name,
- EnumValueNameToLowerCamelCase(enum_value->name()));
+ ow->RenderString(field_name, ToCamelCase(enum_value->name()));
} else {
ow->RenderString(field_name, enum_value->name());
}
@@ -1003,10 +1004,10 @@ const string ProtoStreamObjectSource::ReadFieldValueAsString(
const google::protobuf::Enum* en =
typeinfo_->GetEnumByTypeUrl(field.type_url());
// Lookup the name of the enum, and render that. Skips unknown enums.
- if (en != nullptr) {
+ if (en != NULL) {
const google::protobuf::EnumValue* enum_value =
FindEnumValueByNumber(*en, buffer32);
- if (enum_value != nullptr) {
+ if (enum_value != NULL) {
result = enum_value->name();
}
}
@@ -1050,8 +1051,8 @@ std::pair<int64, int32> ProtoStreamObjectSource::ReadSecondsAndNanos(
for (tag = stream_->ReadTag(); tag != 0; tag = stream_->ReadTag()) {
const google::protobuf::Field* field = FindAndVerifyField(type, tag);
- if (field == nullptr) {
- WireFormat::SkipField(stream_, tag, nullptr);
+ if (field == NULL) {
+ WireFormat::SkipField(stream_, tag, NULL);
continue;
}
// 'seconds' has field number of 1 and 'nanos' has field number 2
@@ -1089,7 +1090,7 @@ const google::protobuf::Field* FindFieldByNumber(
return &type.fields(i);
}
}
- return nullptr;
+ return NULL;
}
// TODO(skarvaje): Replace FieldDescriptor by implementing IsTypePackable()
@@ -1110,7 +1111,7 @@ const google::protobuf::EnumValue* FindEnumValueByNumber(
return &ev;
}
}
- return nullptr;
+ return NULL;
}
// TODO(skarvaje): Look into optimizing this by not doing computation on
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource.h
index b56efdf43a..b56efdf43a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource_test.cc
index df7907289c..36bb1ba96b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectsource_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectsource_test.cc
@@ -31,6 +31,9 @@
#include <google/protobuf/util/internal/protostream_objectsource.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <sstream>
#include <google/protobuf/stubs/casts.h>
@@ -119,7 +122,7 @@ class ProtostreamObjectSourceTest
ArrayInputStream arr_stream(proto.data(), proto.size());
CodedInputStream in_stream(&arr_stream);
- std::unique_ptr<ProtoStreamObjectSource> os(
+ google::protobuf::scoped_ptr<ProtoStreamObjectSource> os(
helper_.NewProtoSource(&in_stream, GetTypeUrl(descriptor)));
if (use_lower_camel_for_enums_) os->set_use_lower_camel_for_enums(true);
if (use_ints_for_enums_) os->set_use_ints_for_enums(true);
@@ -487,7 +490,7 @@ TEST_P(ProtostreamObjectSourceTest,
DoTest(book, Book::descriptor());
}
-TEST_P(ProtostreamObjectSourceTest, LowerCamelEnumOutputMacroCase) {
+TEST_P(ProtostreamObjectSourceTest, LowerCamelEnumOutputTest) {
Book book;
book.set_type(Book::ACTION_AND_ADVENTURE);
@@ -497,26 +500,6 @@ TEST_P(ProtostreamObjectSourceTest, LowerCamelEnumOutputMacroCase) {
DoTest(book, Book::descriptor());
}
-TEST_P(ProtostreamObjectSourceTest, LowerCamelEnumOutputSnakeCase) {
- Book book;
- book.set_type(Book::arts_and_photography);
-
- UseLowerCamelForEnums();
-
- ow_.StartObject("")->RenderString("type", "artsAndPhotography")->EndObject();
- DoTest(book, Book::descriptor());
-}
-
-TEST_P(ProtostreamObjectSourceTest, LowerCamelEnumOutputWithNumber) {
- Book book;
- book.set_type(Book::I18N_Tech);
-
- UseLowerCamelForEnums();
-
- ow_.StartObject("")->RenderString("type", "i18nTech")->EndObject();
- DoTest(book, Book::descriptor());
-}
-
TEST_P(ProtostreamObjectSourceTest, EnumCaseIsUnchangedByDefault) {
Book book;
book.set_type(Book::ACTION_AND_ADVENTURE);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter.cc
index 2edfd0759c..97f9681949 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter.cc
@@ -62,7 +62,7 @@ ProtoStreamObjectWriter::ProtoStreamObjectWriter(
const ProtoStreamObjectWriter::Options& options)
: ProtoWriter(type_resolver, type, output, listener),
master_type_(type),
- current_(nullptr),
+ current_(NULL),
options_(options) {
set_ignore_unknown_fields(options_.ignore_unknown_fields);
set_use_lower_camel_for_enums(options_.use_lower_camel_for_enums);
@@ -73,18 +73,18 @@ ProtoStreamObjectWriter::ProtoStreamObjectWriter(
strings::ByteSink* output, ErrorListener* listener)
: ProtoWriter(typeinfo, type, output, listener),
master_type_(type),
- current_(nullptr),
+ current_(NULL),
options_(ProtoStreamObjectWriter::Options::Defaults()) {}
ProtoStreamObjectWriter::~ProtoStreamObjectWriter() {
- if (current_ == nullptr) return;
+ if (current_ == NULL) return;
// Cleanup explicitly in order to avoid destructor stack overflow when input
// is deeply nested.
// Cast to BaseElement to avoid doing additional checks (like missing fields)
// during pop().
- std::unique_ptr<BaseElement> element(
+ google::protobuf::scoped_ptr<BaseElement> element(
static_cast<BaseElement*>(current_.get())->pop<BaseElement>());
- while (element != nullptr) {
+ while (element != NULL) {
element.reset(element->pop<BaseElement>());
}
}
@@ -186,7 +186,7 @@ ProtoStreamObjectWriter::AnyWriter::AnyWriter(ProtoStreamObjectWriter* parent)
output_(&data_),
depth_(0),
is_well_known_type_(false),
- well_known_type_render_(nullptr) {}
+ well_known_type_render_(NULL) {}
ProtoStreamObjectWriter::AnyWriter::~AnyWriter() {}
@@ -195,7 +195,7 @@ void ProtoStreamObjectWriter::AnyWriter::StartObject(StringPiece name) {
// If an object writer is absent, that means we have not called StartAny()
// before reaching here, which happens when we have data before the "@type"
// field.
- if (ow_ == nullptr) {
+ if (ow_ == NULL) {
// Save data before the "@type" field for later replay.
uninterpreted_events_.push_back(Event(Event::START_OBJECT, name));
} else if (is_well_known_type_ && depth_ == 1) {
@@ -217,7 +217,7 @@ void ProtoStreamObjectWriter::AnyWriter::StartObject(StringPiece name) {
bool ProtoStreamObjectWriter::AnyWriter::EndObject() {
--depth_;
- if (ow_ == nullptr) {
+ if (ow_ == NULL) {
if (depth_ >= 0) {
// Save data before the "@type" field for later replay.
uninterpreted_events_.push_back(Event(Event::END_OBJECT));
@@ -239,7 +239,7 @@ bool ProtoStreamObjectWriter::AnyWriter::EndObject() {
void ProtoStreamObjectWriter::AnyWriter::StartList(StringPiece name) {
++depth_;
- if (ow_ == nullptr) {
+ if (ow_ == NULL) {
// Save data before the "@type" field for later replay.
uninterpreted_events_.push_back(Event(Event::START_LIST, name));
} else if (is_well_known_type_ && depth_ == 1) {
@@ -260,7 +260,7 @@ void ProtoStreamObjectWriter::AnyWriter::EndList() {
GOOGLE_LOG(DFATAL) << "Mismatched EndList found, should not be possible";
depth_ = 0;
}
- if (ow_ == nullptr) {
+ if (ow_ == NULL) {
// Save data before the "@type" field for later replay.
uninterpreted_events_.push_back(Event(Event::END_LIST));
} else {
@@ -272,9 +272,9 @@ void ProtoStreamObjectWriter::AnyWriter::RenderDataPiece(
StringPiece name, const DataPiece& value) {
// Start an Any only at depth_ 0. Other RenderDataPiece calls with "@type"
// should go to the contained ow_ as they indicate nested Anys.
- if (depth_ == 0 && ow_ == nullptr && name == "@type") {
+ if (depth_ == 0 && ow_ == NULL && name == "@type") {
StartAny(value);
- } else if (ow_ == nullptr) {
+ } else if (ow_ == NULL) {
// Save data before the "@type" field.
uninterpreted_events_.push_back(Event(name, value));
} else if (depth_ == 0 && is_well_known_type_) {
@@ -283,7 +283,7 @@ void ProtoStreamObjectWriter::AnyWriter::RenderDataPiece(
"Expect a \"value\" field for well-known types.");
invalid_ = true;
}
- if (well_known_type_render_ == nullptr) {
+ if (well_known_type_render_ == NULL) {
// Only Any and Struct don't have a special type render but both of
// them expect a JSON object (i.e., a StartObject() call).
if (value.type() != DataPiece::TYPE_NULL && !invalid_) {
@@ -327,7 +327,7 @@ void ProtoStreamObjectWriter::AnyWriter::StartAny(const DataPiece& value) {
const google::protobuf::Type* type = resolved_type.ValueOrDie();
well_known_type_render_ = FindTypeRenderer(type_url_);
- if (well_known_type_render_ != nullptr ||
+ if (well_known_type_render_ != NULL ||
// Explicitly list Any and Struct here because they don't have a
// custom renderer.
type->name() == kAnyType || type->name() == kStructType) {
@@ -360,7 +360,7 @@ void ProtoStreamObjectWriter::AnyWriter::StartAny(const DataPiece& value) {
}
void ProtoStreamObjectWriter::AnyWriter::WriteAny() {
- if (ow_ == nullptr) {
+ if (ow_ == NULL) {
if (uninterpreted_events_.empty()) {
// We never got any content, so just return immediately, which is
// equivalent to writing an empty Any.
@@ -421,7 +421,7 @@ void ProtoStreamObjectWriter::AnyWriter::Event::DeepCopy() {
ProtoStreamObjectWriter::Item::Item(ProtoStreamObjectWriter* enclosing,
ItemType item_type, bool is_placeholder,
bool is_list)
- : BaseElement(nullptr),
+ : BaseElement(NULL),
ow_(enclosing),
any_(),
item_type_(item_type),
@@ -467,7 +467,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartObject(
// Starting the root message. Create the root Item and return.
// ANY message type does not need special handling, just set the ItemType
// to ANY.
- if (current_ == nullptr) {
+ if (current_ == NULL) {
ProtoWriter::StartObject(name);
current_.reset(new Item(
this, master_type_.name() == kAnyType ? Item::ANY : Item::MESSAGE,
@@ -541,14 +541,14 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartObject(
// If top of stack is g.p.Struct type, start the struct the map field within
// it.
- if (element() != nullptr && IsStruct(*element()->parent_field())) {
+ if (element() != NULL && IsStruct(*element()->parent_field())) {
// Render "fields": [
Push("fields", Item::MAP, true, true);
return this;
}
// If top of stack is g.p.Value type, start the Struct within it.
- if (element() != nullptr && IsStructValue(*element()->parent_field())) {
+ if (element() != NULL && IsStructValue(*element()->parent_field())) {
// Render
// "struct_value": {
// "fields": [
@@ -559,7 +559,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartObject(
}
const google::protobuf::Field* field = BeginNamed(name, false);
- if (field == nullptr) return this;
+ if (field == NULL) return this;
if (IsStruct(*field)) {
// Start a struct object.
@@ -607,7 +607,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::EndObject() {
return this;
}
- if (current_ == nullptr) return this;
+ if (current_ == NULL) return this;
if (current_->IsAny()) {
if (current_->any()->EndObject()) return this;
@@ -627,7 +627,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartList(StringPiece name) {
// Since we cannot have a top-level repeated item in protobuf, the only way
// this is valid is if we start a special type google.protobuf.ListValue or
// google.protobuf.Value.
- if (current_ == nullptr) {
+ if (current_ == NULL) {
if (!name.empty()) {
InvalidName(name, "Root element should not be named.");
IncrementInvalidDepth();
@@ -706,7 +706,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartList(StringPiece name) {
if (invalid_depth() > 0) return this;
// case i and ii above. Start "list_value" field within g.p.Value
- if (element() != nullptr && element()->parent_field() != nullptr) {
+ if (element() != NULL && element()->parent_field() != NULL) {
// Render
// "list_value": {
// "values": [ // Start this list
@@ -734,7 +734,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartList(StringPiece name) {
// When name is empty and stack is not empty, we are rendering an item within
// a list.
if (name.empty()) {
- if (element() != nullptr && element()->parent_field() != nullptr) {
+ if (element() != NULL && element()->parent_field() != NULL) {
if (IsStructValue(*element()->parent_field())) {
// Since it is g.p.Value, we bind directly to the list_value.
// Render
@@ -765,7 +765,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartList(StringPiece name) {
// name is not empty
const google::protobuf::Field* field = Lookup(name);
- if (field == nullptr) {
+ if (field == NULL) {
IncrementInvalidDepth();
return this;
}
@@ -837,7 +837,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::EndList() {
return this;
}
- if (current_ == nullptr) return this;
+ if (current_ == NULL) return this;
if (current_->IsAny()) {
current_->any()->EndList();
@@ -961,7 +961,7 @@ Status ProtoStreamObjectWriter::RenderFieldMask(ProtoStreamObjectWriter* ow,
// TODO(tsun): figure out how to do proto descriptor based snake case
// conversions as much as possible. Because ToSnakeCase sometimes returns the
// wrong value.
- std::unique_ptr<ResultCallback1<util::Status, StringPiece> > callback(
+ google::protobuf::scoped_ptr<ResultCallback1<util::Status, StringPiece> > callback(
::google::protobuf::NewPermanentCallback(&RenderOneFieldPath, ow));
return DecodeCompactFieldMaskPaths(data.str(), callback.get());
}
@@ -977,13 +977,13 @@ Status ProtoStreamObjectWriter::RenderDuration(ProtoStreamObjectWriter* ow,
StringPiece value(data.str());
- if (!StringEndsWith(value, "s")) {
+ if (!value.ends_with("s")) {
return Status(INVALID_ARGUMENT,
"Illegal duration format; duration must end with 's'");
}
value = value.substr(0, value.size() - 1);
int sign = 1;
- if (StringStartsWith(value, "-")) {
+ if (value.starts_with("-")) {
sign = -1;
value = value.substr(1);
}
@@ -1028,10 +1028,10 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::RenderDataPiece(
Status status;
if (invalid_depth() > 0) return this;
- if (current_ == nullptr) {
+ if (current_ == NULL) {
const TypeRenderer* type_renderer =
FindTypeRenderer(GetFullTypeWithUrl(master_type_.name()));
- if (type_renderer == nullptr) {
+ if (type_renderer == NULL) {
InvalidName(name, "Root element must be a message.");
return this;
}
@@ -1054,7 +1054,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::RenderDataPiece(
return this;
}
- const google::protobuf::Field* field = nullptr;
+ const google::protobuf::Field* field = NULL;
if (current_->IsMap()) {
if (!ValidMapKey(name)) return this;
@@ -1064,14 +1064,14 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::RenderDataPiece(
ProtoWriter::RenderDataPiece("key",
DataPiece(name, use_strict_base64_decoding()));
field = Lookup("value");
- if (field == nullptr) {
+ if (field == NULL) {
Pop();
GOOGLE_LOG(DFATAL) << "Map does not have a value field.";
return this;
}
const TypeRenderer* type_renderer = FindTypeRenderer(field->type_url());
- if (type_renderer != nullptr) {
+ if (type_renderer != NULL) {
// Map's value type is a special type. Render it like a message:
// "value": {
// ... Render special type ...
@@ -1101,11 +1101,11 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::RenderDataPiece(
}
field = Lookup(name);
- if (field == nullptr) return this;
+ if (field == NULL) return this;
// Check if the field is of special type. Render it accordingly if so.
const TypeRenderer* type_renderer = FindTypeRenderer(field->type_url());
- if (type_renderer != nullptr) {
+ if (type_renderer != NULL) {
// Pass through null value only for google.protobuf.Value. For other
// types we ignore null value just like for regular field types.
if (data.type() != DataPiece::TYPE_NULL ||
@@ -1199,7 +1199,7 @@ ProtoStreamObjectWriter::FindTypeRenderer(const string& type_url) {
}
bool ProtoStreamObjectWriter::ValidMapKey(StringPiece unnormalized_name) {
- if (current_ == nullptr) return true;
+ if (current_ == NULL) return true;
if (!current_->InsertMapKeyIfNotPresent(unnormalized_name)) {
listener()->InvalidName(
@@ -1224,10 +1224,10 @@ void ProtoStreamObjectWriter::Push(StringPiece name, Item::ItemType item_type,
void ProtoStreamObjectWriter::Pop() {
// Pop all placeholder items sending StartObject or StartList events to
// ProtoWriter according to is_list value.
- while (current_ != nullptr && current_->is_placeholder()) {
+ while (current_ != NULL && current_->is_placeholder()) {
PopOneElement();
}
- if (current_ != nullptr) {
+ if (current_ != NULL) {
PopOneElement();
}
}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter.h
index c33a463923..ab534912e6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter.h
@@ -216,7 +216,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
ProtoStreamObjectWriter* parent_;
// The nested object writer, used to write events.
- std::unique_ptr<ProtoStreamObjectWriter> ow_;
+ google::protobuf::scoped_ptr<ProtoStreamObjectWriter> ow_;
// The type_url_ that this Any represents.
string type_url_;
@@ -292,14 +292,14 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
ProtoStreamObjectWriter* ow_;
// A writer for Any objects, handles all Any-related nonsense.
- std::unique_ptr<AnyWriter> any_;
+ google::protobuf::scoped_ptr<AnyWriter> any_;
// The type of this element, see enum for permissible types.
ItemType item_type_;
// Set of map keys already seen for the type_. Used to validate incoming
// messages so no map key appears more than once.
- std::unique_ptr<hash_set<string> > map_keys_;
+ google::protobuf::scoped_ptr<hash_set<string> > map_keys_;
// Conveys whether this Item is a placeholder or not. Placeholder items are
// pushed to stack to account for special types.
@@ -392,7 +392,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
const google::protobuf::Type& master_type_;
// The current element, variable for internal state processing.
- std::unique_ptr<Item> current_;
+ google::protobuf::scoped_ptr<Item> current_;
// Reference to the options that control this class's behavior.
const ProtoStreamObjectWriter::Options options_;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
index 7f0df5677e..87d35b08bc 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
@@ -146,7 +146,7 @@ class BaseProtoStreamObjectWriterTest
void CheckOutput(const Message& expected, int expected_length) {
size_t nbytes;
- std::unique_ptr<char[]> buffer(output_->GetBuffer(&nbytes));
+ google::protobuf::scoped_array<char> buffer(output_->GetBuffer(&nbytes));
if (expected_length >= 0) {
EXPECT_EQ(expected_length, nbytes);
}
@@ -154,7 +154,7 @@ class BaseProtoStreamObjectWriterTest
std::stringbuf str_buf(str, std::ios_base::in);
std::istream istream(&str_buf);
- std::unique_ptr<Message> message(expected.New());
+ google::protobuf::scoped_ptr<Message> message(expected.New());
message->ParsePartialFromIstream(&istream);
if (!MessageDifferencer::Equivalent(expected, *message)) {
@@ -170,8 +170,8 @@ class BaseProtoStreamObjectWriterTest
testing::TypeInfoTestHelper helper_;
MockErrorListener listener_;
- std::unique_ptr<GrowingArrayByteSink> output_;
- std::unique_ptr<ProtoStreamObjectWriter> ow_;
+ google::protobuf::scoped_ptr<GrowingArrayByteSink> output_;
+ google::protobuf::scoped_ptr<ProtoStreamObjectWriter> ow_;
ProtoStreamObjectWriter::Options options_;
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/structured_objectwriter.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/structured_objectwriter.h
index 8e63222b07..3f065d6b1c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/structured_objectwriter.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/structured_objectwriter.h
@@ -32,6 +32,9 @@
#define GOOGLE_PROTOBUF_UTIL_CONVERTER_STRUCTURED_OBJECTWRITER_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/stubs/common.h>
@@ -77,7 +80,7 @@ class LIBPROTOBUF_EXPORT StructuredObjectWriter : public ObjectWriter {
}
// Returns true if this element is the root.
- bool is_root() const { return parent_ == nullptr; }
+ bool is_root() const { return parent_ == NULL; }
// Returns the number of hops from this element to the root element.
int level() const { return level_; }
@@ -88,10 +91,10 @@ class LIBPROTOBUF_EXPORT StructuredObjectWriter : public ObjectWriter {
private:
// Pointer to the parent Element.
- std::unique_ptr<BaseElement> parent_;
+ google::protobuf::scoped_ptr<BaseElement> parent_;
// Number of hops to the root Element.
- // The root Element has nullptr parent_ and a level_ of 0.
+ // The root Element has NULL parent_ and a level_ of 0.
const int level_;
GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS(BaseElement);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/anys.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/anys.proto
index a9ebca3d43..a9ebca3d43 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/anys.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/anys.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/books.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/books.proto
index 5630cc78d6..869271f4e5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/books.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/books.proto
@@ -65,7 +65,6 @@ message Book {
KIDS = 2;
ACTION_AND_ADVENTURE = 3;
arts_and_photography = 4;
- I18N_Tech = 5;
}
optional Type type = 11;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/default_value.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/default_value.proto
index cccc741c2d..cccc741c2d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/default_value.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/default_value.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/default_value_test.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/default_value_test.proto
index 932883410e..932883410e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/default_value_test.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/default_value_test.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/field_mask.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/field_mask.proto
index e8b2bc5f2e..e8b2bc5f2e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/field_mask.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/field_mask.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/maps.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/maps.proto
index 0f381b320b..0f381b320b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/maps.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/maps.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/oneofs.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/oneofs.proto
index c37da08316..c37da08316 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/oneofs.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/oneofs.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/proto3.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/proto3.proto
index c013cee31e..c013cee31e 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/proto3.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/proto3.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/struct.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/struct.proto
index 7b1cc1b954..7b1cc1b954 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/struct.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/struct.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/timestamp_duration.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/timestamp_duration.proto
index b74484ce58..b74484ce58 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/timestamp_duration.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/timestamp_duration.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/wrappers.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/wrappers.proto
index eabc99f245..eabc99f245 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/testdata/wrappers.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/testdata/wrappers.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info.cc
index 3847b17904..85d0d5c945 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info.cc
@@ -69,7 +69,7 @@ class TypeInfoForTypeResolver : public TypeInfo {
// cached_types_ map.
const string& string_type_url =
*string_storage_.insert(type_url.ToString()).first;
- std::unique_ptr<google::protobuf::Type> type(new google::protobuf::Type());
+ google::protobuf::scoped_ptr<google::protobuf::Type> type(new google::protobuf::Type());
util::Status status =
type_resolver_->ResolveMessageType(string_type_url, type.get());
StatusOrType result =
@@ -95,7 +95,7 @@ class TypeInfoForTypeResolver : public TypeInfo {
// cached_enums_ map.
const string& string_type_url =
*string_storage_.insert(type_url.ToString()).first;
- std::unique_ptr<google::protobuf::Enum> enum_type(
+ google::protobuf::scoped_ptr<google::protobuf::Enum> enum_type(
new google::protobuf::Enum());
util::Status status =
type_resolver_->ResolveEnumType(string_type_url, enum_type.get());
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info.h
index d81331763a..d81331763a 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info_test_helper.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info_test_helper.cc
index 281a7f5800..737ba9e475 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info_test_helper.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info_test_helper.cc
@@ -31,6 +31,9 @@
#include <google/protobuf/util/internal/type_info_test_helper.h>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/stubs/logging.h>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info_test_helper.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info_test_helper.h
index 5a077e0492..1a1967156b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/type_info_test_helper.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/type_info_test_helper.h
@@ -32,6 +32,9 @@
#define GOOGLE_PROTOBUF_UTIL_CONVERTER_TYPE_INFO_TEST_HELPER_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/io/coded_stream.h>
@@ -83,8 +86,8 @@ class TypeInfoTestHelper {
private:
TypeInfoSource type_;
- std::unique_ptr<TypeInfo> typeinfo_;
- std::unique_ptr<TypeResolver> type_resolver_;
+ google::protobuf::scoped_ptr<TypeInfo> typeinfo_;
+ google::protobuf::scoped_ptr<TypeResolver> type_resolver_;
};
} // namespace testing
} // namespace converter
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/utility.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/utility.cc
index b8d917ce28..11780ee8b0 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/utility.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/utility.cc
@@ -52,7 +52,7 @@ bool GetBoolOptionOrDefault(
const google::protobuf::RepeatedPtrField<google::protobuf::Option>& options,
const string& option_name, bool default_value) {
const google::protobuf::Option* opt = FindOptionOrNull(options, option_name);
- if (opt == nullptr) {
+ if (opt == NULL) {
return default_value;
}
return GetBoolFromAny(opt->value());
@@ -62,7 +62,7 @@ int64 GetInt64OptionOrDefault(
const google::protobuf::RepeatedPtrField<google::protobuf::Option>& options,
const string& option_name, int64 default_value) {
const google::protobuf::Option* opt = FindOptionOrNull(options, option_name);
- if (opt == nullptr) {
+ if (opt == NULL) {
return default_value;
}
return GetInt64FromAny(opt->value());
@@ -72,7 +72,7 @@ double GetDoubleOptionOrDefault(
const google::protobuf::RepeatedPtrField<google::protobuf::Option>& options,
const string& option_name, double default_value) {
const google::protobuf::Option* opt = FindOptionOrNull(options, option_name);
- if (opt == nullptr) {
+ if (opt == NULL) {
return default_value;
}
return GetDoubleFromAny(opt->value());
@@ -82,7 +82,7 @@ string GetStringOptionOrDefault(
const google::protobuf::RepeatedPtrField<google::protobuf::Option>& options,
const string& option_name, const string& default_value) {
const google::protobuf::Option* opt = FindOptionOrNull(options, option_name);
- if (opt == nullptr) {
+ if (opt == NULL) {
return default_value;
}
return GetStringFromAny(opt->value());
@@ -144,12 +144,12 @@ const google::protobuf::Option* FindOptionOrNull(
return &opt;
}
}
- return nullptr;
+ return NULL;
}
const google::protobuf::Field* FindFieldInTypeOrNull(
const google::protobuf::Type* type, StringPiece field_name) {
- if (type != nullptr) {
+ if (type != NULL) {
for (int i = 0; i < type->fields_size(); ++i) {
const google::protobuf::Field& field = type->fields(i);
if (field.name() == field_name) {
@@ -157,12 +157,12 @@ const google::protobuf::Field* FindFieldInTypeOrNull(
}
}
}
- return nullptr;
+ return NULL;
}
const google::protobuf::Field* FindJsonFieldInTypeOrNull(
const google::protobuf::Type* type, StringPiece json_name) {
- if (type != nullptr) {
+ if (type != NULL) {
for (int i = 0; i < type->fields_size(); ++i) {
const google::protobuf::Field& field = type->fields(i);
if (field.json_name() == json_name) {
@@ -170,12 +170,12 @@ const google::protobuf::Field* FindJsonFieldInTypeOrNull(
}
}
}
- return nullptr;
+ return NULL;
}
const google::protobuf::Field* FindFieldInTypeByNumberOrNull(
const google::protobuf::Type* type, int32 number) {
- if (type != nullptr) {
+ if (type != NULL) {
for (int i = 0; i < type->fields_size(); ++i) {
const google::protobuf::Field& field = type->fields(i);
if (field.number() == number) {
@@ -183,12 +183,12 @@ const google::protobuf::Field* FindFieldInTypeByNumberOrNull(
}
}
}
- return nullptr;
+ return NULL;
}
const google::protobuf::EnumValue* FindEnumValueByNameOrNull(
const google::protobuf::Enum* enum_type, StringPiece enum_name) {
- if (enum_type != nullptr) {
+ if (enum_type != NULL) {
for (int i = 0; i < enum_type->enumvalue_size(); ++i) {
const google::protobuf::EnumValue& enum_value = enum_type->enumvalue(i);
if (enum_value.name() == enum_name) {
@@ -196,12 +196,12 @@ const google::protobuf::EnumValue* FindEnumValueByNameOrNull(
}
}
}
- return nullptr;
+ return NULL;
}
const google::protobuf::EnumValue* FindEnumValueByNumberOrNull(
const google::protobuf::Enum* enum_type, int32 value) {
- if (enum_type != nullptr) {
+ if (enum_type != NULL) {
for (int i = 0; i < enum_type->enumvalue_size(); ++i) {
const google::protobuf::EnumValue& enum_value = enum_type->enumvalue(i);
if (enum_value.number() == value) {
@@ -209,12 +209,12 @@ const google::protobuf::EnumValue* FindEnumValueByNumberOrNull(
}
}
}
- return nullptr;
+ return NULL;
}
const google::protobuf::EnumValue* FindEnumValueByNameWithoutUnderscoreOrNull(
const google::protobuf::Enum* enum_type, StringPiece enum_name) {
- if (enum_type != nullptr) {
+ if (enum_type != NULL) {
for (int i = 0; i < enum_type->enumvalue_size(); ++i) {
const google::protobuf::EnumValue& enum_value = enum_type->enumvalue(i);
string enum_name_without_underscore = enum_value.name();
@@ -235,14 +235,7 @@ const google::protobuf::EnumValue* FindEnumValueByNameWithoutUnderscoreOrNull(
}
}
}
- return nullptr;
-}
-
-string EnumValueNameToLowerCamelCase(const StringPiece input) {
- string input_string(input);
- std::transform(input_string.begin(), input_string.end(), input_string.begin(),
- ::tolower);
- return ToCamelCase(input_string);
+ return NULL;
}
string ToCamelCase(const StringPiece input) {
@@ -360,6 +353,8 @@ 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));
}
@@ -367,6 +362,9 @@ 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);
@@ -405,13 +403,6 @@ bool SafeStrToFloat(StringPiece str, float* value) {
return true;
}
-bool StringStartsWith(StringPiece text, StringPiece prefix) {
- return text.starts_with(prefix);
-}
-
-bool StringEndsWith(StringPiece text, StringPiece suffix) {
- return text.ends_with(suffix);
-}
} // namespace converter
} // namespace util
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/utility.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/utility.h
index d8e06a97d2..667e660c58 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/internal/utility.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/internal/utility.h
@@ -32,6 +32,9 @@
#define GOOGLE_PROTOBUF_UTIL_CONVERTER_UTILITY_H__
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <utility>
@@ -118,13 +121,13 @@ LIBPROTOBUF_EXPORT const StringPiece GetTypeWithoutUrl(StringPiece type_url);
LIBPROTOBUF_EXPORT const string GetFullTypeWithUrl(StringPiece simple_type);
// Finds and returns option identified by name and option_name within the
-// provided map. Returns nullptr if none found.
+// provided map. Returns NULL if none found.
const google::protobuf::Option* FindOptionOrNull(
const google::protobuf::RepeatedPtrField<google::protobuf::Option>& options,
const string& option_name);
// Finds and returns the field identified by field_name in the passed tech Type
-// object. Returns nullptr if none found.
+// object. Returns NULL if none found.
const google::protobuf::Field* FindFieldInTypeOrNull(
const google::protobuf::Type* type, StringPiece field_name);
@@ -138,17 +141,17 @@ const google::protobuf::Field* FindFieldInTypeByNumberOrNull(
const google::protobuf::Type* type, int32 number);
// Finds and returns the EnumValue identified by enum_name in the passed tech
-// Enum object. Returns nullptr if none found.
+// Enum object. Returns NULL if none found.
const google::protobuf::EnumValue* FindEnumValueByNameOrNull(
const google::protobuf::Enum* enum_type, StringPiece enum_name);
// Finds and returns the EnumValue identified by value in the passed tech
-// Enum object. Returns nullptr if none found.
+// Enum object. Returns NULL if none found.
const google::protobuf::EnumValue* FindEnumValueByNumberOrNull(
const google::protobuf::Enum* enum_type, int32 value);
// Finds and returns the EnumValue identified by enum_name without underscore in
-// the passed tech Enum object. Returns nullptr if none found.
+// the passed tech Enum object. Returns NULL if none found.
// For Ex. if enum_name is ACTIONANDADVENTURE it can get accepted if
// EnumValue's name is action_and_adventure or ACTION_AND_ADVENTURE.
const google::protobuf::EnumValue* FindEnumValueByNameWithoutUnderscoreOrNull(
@@ -157,9 +160,6 @@ const google::protobuf::EnumValue* FindEnumValueByNameWithoutUnderscoreOrNull(
// Converts input to camel-case and returns it.
LIBPROTOBUF_EXPORT string ToCamelCase(const StringPiece input);
-// Converts enum name string to camel-case and returns it.
-string EnumValueNameToLowerCamelCase(const StringPiece input);
-
// Converts input to snake_case and returns it.
LIBPROTOBUF_EXPORT string ToSnakeCase(StringPiece input);
@@ -200,12 +200,6 @@ inline string ValueAsString(double value) {
// Converts a string to float. Unlike safe_strtof, conversion will fail if the
// value fits into double but not float (e.g., DBL_MAX).
LIBPROTOBUF_EXPORT bool SafeStrToFloat(StringPiece str, float* value);
-
-// Returns whether a StringPiece begins with the provided prefix.
-bool StringStartsWith(StringPiece text, StringPiece prefix);
-
-// Returns whether a StringPiece ends with the provided suffix.
-bool StringEndsWith(StringPiece text, StringPiece suffix);
} // namespace converter
} // namespace util
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/json_format_proto3.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/json_format_proto3.proto
index cbc3f81f24..8a0441c8f6 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/json_format_proto3.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/json_format_proto3.proto
@@ -181,9 +181,3 @@ message TestCustomJsonName {
message TestExtensions {
.protobuf_unittest.TestAllExtensions extensions = 1;
}
-
-message TestEnumValue{
- EnumType enum_value1 = 1;
- EnumType enum_value2 = 2;
- EnumType enum_value3 = 3;
-} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/json_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/json_util.cc
index f81a7a3061..c85f18994c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/json_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/json_util.cc
@@ -50,9 +50,7 @@ namespace util {
namespace internal {
ZeroCopyStreamByteSink::~ZeroCopyStreamByteSink() {
- if (buffer_size_ > 0) {
- stream_->BackUp(buffer_size_);
- }
+ stream_->BackUp(buffer_size_);
}
void ZeroCopyStreamByteSink::Append(const char* bytes, size_t len) {
@@ -63,11 +61,9 @@ void ZeroCopyStreamByteSink::Append(const char* bytes, size_t len) {
buffer_size_ -= len;
return;
}
- if (buffer_size_ > 0) {
- memcpy(buffer_, bytes, buffer_size_);
- bytes += buffer_size_;
- len -= buffer_size_;
- }
+ memcpy(buffer_, bytes, buffer_size_);
+ bytes += buffer_size_;
+ len -= buffer_size_;
if (!stream_->Next(&buffer_, &buffer_size_)) {
// There isn't a way for ByteSink to report errors.
buffer_size_ = 0;
@@ -97,8 +93,6 @@ util::Status BinaryToJsonStream(TypeResolver* resolver,
resolver, type, &json_writer);
default_value_writer.set_preserve_proto_field_names(
options.preserve_proto_field_names);
- default_value_writer.set_print_enums_as_ints(
- options.always_print_enums_as_ints);
return proto_source.WriteTo(&default_value_writer);
} else {
return proto_source.WriteTo(&json_writer);
@@ -127,22 +121,22 @@ class StatusErrorListener : public converter::ErrorListener {
virtual void InvalidName(const converter::LocationTrackerInterface& loc,
StringPiece unknown_name, StringPiece message) {
status_ = util::Status(util::error::INVALID_ARGUMENT,
- loc.ToString() + ": " + string(message));
+ loc.ToString() + ": " + message.ToString());
}
virtual void InvalidValue(const converter::LocationTrackerInterface& loc,
StringPiece type_name, StringPiece value) {
status_ =
util::Status(util::error::INVALID_ARGUMENT,
- loc.ToString() + ": invalid value " + string(value) +
- " for type " + string(type_name));
+ loc.ToString() + ": invalid value " + value.ToString() +
+ " for type " + type_name.ToString());
}
virtual void MissingField(const converter::LocationTrackerInterface& loc,
StringPiece missing_name) {
status_ = util::Status(
util::error::INVALID_ARGUMENT,
- loc.ToString() + ": missing field " + string(missing_name));
+ loc.ToString() + ": missing field " + missing_name.ToString());
}
private:
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/json_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/json_util.h
index b1c69813b8..f4f4380a73 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/json_util.h
+++ b/third_party/protobuf/3.4.0/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 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.
+ // 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.
bool always_print_primitive_fields;
// Whether to always print enums as ints. By default they are rendered as
// strings.
@@ -179,7 +179,7 @@ namespace internal {
class LIBPROTOBUF_EXPORT ZeroCopyStreamByteSink : public strings::ByteSink {
public:
explicit ZeroCopyStreamByteSink(io::ZeroCopyOutputStream* stream)
- : stream_(stream), buffer_(NULL), buffer_size_(0) {}
+ : stream_(stream), buffer_size_(0) {}
~ZeroCopyStreamByteSink();
virtual void Append(const char* bytes, size_t len);
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/json_util_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/json_util_test.cc
index ed9092dfea..25c7e96c0d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/json_util_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/json_util_test.cc
@@ -34,7 +34,6 @@
#include <string>
#include <google/protobuf/io/zero_copy_stream.h>
-#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/descriptor_database.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/util/internal/testdata/maps.pb.h>
@@ -48,13 +47,12 @@ namespace protobuf {
namespace util {
namespace {
-using google::protobuf::testing::MapIn;
using proto3::FOO;
using proto3::BAR;
using proto3::TestMessage;
using proto3::TestMap;
using proto3::TestOneof;
-using proto3::TestEnumValue;
+using google::protobuf::testing::MapIn;
static const char kTypeUrlPrefix[] = "type.googleapis.com";
@@ -83,7 +81,7 @@ class JsonUtilTest : public ::testing::Test {
return FromJson(json, message, JsonParseOptions());
}
- std::unique_ptr<TypeResolver> resolver_;
+ google::protobuf::scoped_ptr<TypeResolver> resolver_;
};
TEST_F(JsonUtilTest, TestWhitespaces) {
@@ -218,29 +216,6 @@ TEST_F(JsonUtilTest, TestAlwaysPrintEnumsAsInts) {
EXPECT_EQ(proto3::BAR, parsed.repeated_enum_value(1));
}
-TEST_F(JsonUtilTest, TestPrintEnumsAsIntsWithDefaultValue) {
- TestEnumValue orig;
- //orig.set_enum_value1(proto3::FOO)
- orig.set_enum_value2(proto3::FOO);
- orig.set_enum_value3(proto3::BAR);
-
- JsonPrintOptions print_options;
- print_options.always_print_enums_as_ints = true;
- print_options.always_print_primitive_fields = true;
-
- string expected_json = "{\"enumValue1\":0,\"enumValue2\":0,\"enumValue3\":1}";
- EXPECT_EQ(expected_json, ToJson(orig, print_options));
-
- TestEnumValue parsed;
- JsonParseOptions parse_options;
- ASSERT_TRUE(FromJson(expected_json, &parsed, parse_options));
-
- EXPECT_EQ(proto3::FOO, parsed.enum_value1());
- EXPECT_EQ(proto3::FOO, parsed.enum_value2());
- EXPECT_EQ(proto3::BAR, parsed.enum_value3());
-
-}
-
TEST_F(JsonUtilTest, ParseMessage) {
// Some random message but good enough to verify that the parsing warpper
// functions are working properly.
@@ -337,7 +312,7 @@ TEST_F(JsonUtilTest, TestDynamicMessage) {
DescriptorPool pool(&database);
// A dynamic version of the test proto.
DynamicMessageFactory factory;
- std::unique_ptr<Message> message(factory.GetPrototype(
+ google::protobuf::scoped_ptr<Message> message(factory.GetPrototype(
pool.FindMessageTypeByName("proto3.TestMessage"))->New());
EXPECT_TRUE(FromJson(input, message.get()));
@@ -357,64 +332,6 @@ TEST_F(JsonUtilTest, TestDynamicMessage) {
EXPECT_EQ(ToJson(generated, options), ToJson(*message, options));
}
-TEST_F(JsonUtilTest, TestParsingUnknownEnumsAs0) {
- TestMessage m;
- {
- JsonParseOptions options;
- ASSERT_FALSE(options.ignore_unknown_fields);
- string input =
- "{\n"
- " \"enum_value\":\"UNKNOWN_VALUE\"\n"
- "}";
- m.set_enum_value(proto3::BAR);
- EXPECT_FALSE(FromJson(input, &m, options));
- ASSERT_EQ(proto3::BAR, m.enum_value()); // Keep previous value
-
- options.ignore_unknown_fields = true;
- EXPECT_TRUE(FromJson(input, &m, options));
- EXPECT_EQ(0, m.enum_value()); // Unknown enum value must be decoded as 0
- }
- // Integer values are read as usual
- {
- JsonParseOptions options;
- string input =
- "{\n"
- " \"enum_value\":12345\n"
- "}";
- m.set_enum_value(proto3::BAR);
- EXPECT_TRUE(FromJson(input, &m, options));
- ASSERT_EQ(12345, m.enum_value());
-
- options.ignore_unknown_fields = true;
- EXPECT_TRUE(FromJson(input, &m, options));
- EXPECT_EQ(12345, m.enum_value());
- }
-
- // Trying to pass an object as an enum field value is always treated as an error
- {
- JsonParseOptions options;
- string input =
- "{\n"
- " \"enum_value\":{}\n"
- "}";
- options.ignore_unknown_fields = true;
- EXPECT_FALSE(FromJson(input, &m, options));
- options.ignore_unknown_fields = false;
- EXPECT_FALSE(FromJson(input, &m, options));
- }
- // Trying to pass an array as an enum field value is always treated as an error
- {
- JsonParseOptions options;
- string input =
- "{\n"
- " \"enum_value\":[]\n"
- "}";
- EXPECT_FALSE(FromJson(input, &m, options));
- options.ignore_unknown_fields = true;
- EXPECT_FALSE(FromJson(input, &m, options));
- }
-}
-
typedef std::pair<char*, int> Segment;
// A ZeroCopyOutputStream that writes to multiple buffers.
class SegmentedZeroCopyOutputStream : public io::ZeroCopyOutputStream {
@@ -540,25 +457,6 @@ TEST(ZeroCopyStreamByteSinkTest, TestAllInputOutputPatterns) {
}
}
-TEST_F(JsonUtilTest, TestWrongJsonInput) {
- 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());
-
- auto result_status = util::JsonToBinaryStream(
- resolver, message_type, &input_stream, &output_stream);
-
- delete resolver;
-
- EXPECT_FALSE(result_status.ok());
- EXPECT_EQ(result_status.error_code(),
- util::error::INVALID_ARGUMENT);
-}
-
} // namespace
} // namespace util
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer.cc
index 9842f64c11..d62038adcd 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer.cc
@@ -40,6 +40,9 @@
#include <algorithm>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <utility>
#include <google/protobuf/stubs/callback.h>
@@ -360,6 +363,9 @@ 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.";
@@ -487,8 +493,8 @@ bool MessageDifferencer::Compare(
}
// Expand google.protobuf.Any payload if possible.
if (descriptor1->full_name() == internal::kAnyFullTypeName) {
- std::unique_ptr<Message> data1;
- std::unique_ptr<Message> data2;
+ google::protobuf::scoped_ptr<Message> data1;
+ google::protobuf::scoped_ptr<Message> data2;
if (UnpackAny(message1, &data1) && UnpackAny(message2, &data2)) {
// Avoid DFATAL for different descriptors in google.protobuf.Any payloads.
if (data1->GetDescriptor() != data2->GetDescriptor()) {
@@ -1065,7 +1071,7 @@ struct UnknownFieldOrdering {
} // namespace
bool MessageDifferencer::UnpackAny(const Message& any,
- std::unique_ptr<Message>* data) {
+ google::protobuf::scoped_ptr<Message>* data) {
const Reflection* reflection = any.GetReflection();
const FieldDescriptor* type_url_field;
const FieldDescriptor* value_field;
@@ -1338,7 +1344,7 @@ class MaximumMatcher {
int count1_;
int count2_;
- std::unique_ptr<NodeMatchCallback> match_callback_;
+ google::protobuf::scoped_ptr<NodeMatchCallback> match_callback_;
std::map<std::pair<int, int>, bool> cached_match_results_;
std::vector<int>* match_list1_;
std::vector<int>* match_list2_;
@@ -1434,6 +1440,9 @@ bool MessageDifferencer::MatchRepeatedFieldIndices(
match_list1->assign(count1, -1);
match_list2->assign(count2, -1);
+ SpecificField specific_field;
+ specific_field.field = repeated_field;
+
bool success = true;
// Find potential match if this is a special repeated field.
if (key_comparator != NULL || IsTreatedAsSet(repeated_field)) {
@@ -1456,35 +1465,24 @@ bool MessageDifferencer::MatchRepeatedFieldIndices(
if (match_count != count1 && reporter_ == NULL) return false;
success = success && (match_count == count1);
} else {
- int start_offset = 0;
- // If the two repeated fields are treated as sets, optimize for the case
- // where both start with same items stored in the same order.
- if (IsTreatedAsSet(repeated_field)) {
- start_offset = std::min(count1, count2);
- for (int i = 0; i < count1 && i < count2; i++) {
- if (IsMatch(repeated_field, key_comparator, &message1, &message2,
- parent_fields, i, i)) {
- match_list1->at(i) = i;
- match_list2->at(i) = i;
- } else {
- start_offset = i;
- break;
- }
- }
- }
- for (int i = start_offset; i < count1; ++i) {
+ for (int i = 0; i < count1; ++i) {
// Indicates any matched elements for this repeated field.
bool match = false;
- for (int j = start_offset; j < count2; j++) {
+ specific_field.index = i;
+ specific_field.new_index = i;
+
+ for (int j = 0; j < count2; j++) {
if (match_list2->at(j) != -1) continue;
+ specific_field.index = i;
+ specific_field.new_index = j;
match = IsMatch(repeated_field, key_comparator,
&message1, &message2, parent_fields, i, j);
if (match) {
- match_list1->at(i) = j;
- match_list2->at(j) = i;
+ match_list1->at(specific_field.index) = specific_field.new_index;
+ match_list2->at(specific_field.new_index) = specific_field.index;
break;
}
}
@@ -1761,13 +1759,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer.h
index bbcf8498ff..b7d4de00ab 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer.h
@@ -64,7 +64,6 @@ class Printer;
namespace util {
-class DefaultFieldComparator;
class FieldContext; // declared below MessageDifferencer
// A basic differencer that can be used to determine
@@ -175,8 +174,10 @@ class LIBPROTOBUF_EXPORT MessageDifferencer {
// If "field" is a repeated field which is being treated as a map or
// a set (see TreatAsMap() and TreatAsSet(), below), new_index indicates
- // the index the position to which the element has moved. If the element
- // has not moved, "new_index" will have the same value as "index".
+ // the index the position to which the element has moved. This only
+ // applies to ReportMoved() and (in the case of TreatAsMap())
+ // ReportModified(). In all other cases, "new_index" will have the same
+ // value as "index".
int new_index;
// For unknown fields, these are the pointers to the UnknownFieldSet
@@ -371,7 +372,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.
+ AS_SET, // Treat all the repeated fields as sets by default.
// See TreatAsSet(), as below.
};
@@ -385,11 +386,6 @@ 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.
@@ -474,10 +470,6 @@ 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.
@@ -668,8 +660,6 @@ 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
@@ -821,7 +811,7 @@ class LIBPROTOBUF_EXPORT MessageDifferencer {
// If "any" is of type google.protobuf.Any, extract its payload using
// DynamicMessageFactory and store in "data".
- bool UnpackAny(const Message& any, std::unique_ptr<Message>* data);
+ bool UnpackAny(const Message& any, google::protobuf::scoped_ptr<Message>* data);
// Checks if index is equal to new_index in all the specific fields.
static bool CheckPathChanged(const std::vector<SpecificField>& parent_fields);
@@ -862,7 +852,7 @@ class LIBPROTOBUF_EXPORT MessageDifferencer {
string* output_string_;
- std::unique_ptr<DynamicMessageFactory> dynamic_message_factory_;
+ google::protobuf::scoped_ptr<DynamicMessageFactory> dynamic_message_factory_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageDifferencer);
};
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer_unittest.cc
index a263d98316..75cffd9f7a 100644..100755
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer_unittest.cc
@@ -127,27 +127,6 @@ TEST(MessageDifferencerTest, RepeatedFieldInequalityTest) {
EXPECT_FALSE(util::MessageDifferencer::Equals(msg1, msg2));
}
-TEST(MessageDifferencerTest, RepeatedFieldSetOptimizationTest) {
- util::MessageDifferencer differencer;
- protobuf_unittest::TestDiffMessage msg1;
- protobuf_unittest::TestDiffMessage msg2;
- protobuf_unittest::TestDiffMessage::Item* item1 = msg1.add_item();
- protobuf_unittest::TestDiffMessage::Item* item2 = msg2.add_item();
- differencer.TreatAsSet(item1->GetDescriptor()->FindFieldByName("ra"));
- differencer.TreatAsSet(item2->GetDescriptor()->FindFieldByName("ra"));
- for (int i = 0; i < 1000; i++) {
- item1->add_ra(i);
- item2->add_ra(i);
- }
- EXPECT_TRUE(differencer.Compare(msg1, msg2));
- item2->add_ra(1001);
- EXPECT_FALSE(differencer.Compare(msg1, msg2));
- item1->add_ra(1001);
- EXPECT_TRUE(differencer.Compare(msg1, msg2));
- item1->add_ra(1002);
- EXPECT_FALSE(differencer.Compare(msg1, msg2));
-}
-
TEST(MessageDifferencerTest, MapFieldEqualityTest) {
// Create the testing protos
unittest::TestMap msg1;
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer_unittest.proto b/third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer_unittest.proto
index 698775f14c..698775f14c 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/message_differencer_unittest.proto
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/message_differencer_unittest.proto
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/package_info.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/package_info.h
index 96019203bc..e37e6dc098 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/package_info.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/package_info.h
@@ -38,7 +38,7 @@ namespace protobuf {
// Utility classes.
//
-// This package contains various utilities for message comparison, JSON
+// This package contains various utilities for message comprasion, JSON
// conversion, well known types, etc.
namespace util {}
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/time_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/time_util.cc
index d49128378c..46a6f5a8a5 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/time_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/time_util.cc
@@ -30,14 +30,13 @@
#include <google/protobuf/util/time_util.h>
+#include <google/protobuf/stubs/time.h>
#include <google/protobuf/stubs/int128.h>
-#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/strutil.h>
-#include <google/protobuf/stubs/time.h>
+#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/duration.pb.h>
#include <google/protobuf/timestamp.pb.h>
-
namespace google {
namespace protobuf {
namespace util {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/time_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/time_util.h
index b8846935a7..b8846935a7 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/time_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/time_util.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/time_util_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/time_util_test.cc
index 285740abe1..285740abe1 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/time_util_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/time_util_test.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver.h
index 959f3c7933..959f3c7933 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util.cc
index a69ed58c76..febaa41f75 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util.cc
@@ -95,6 +95,11 @@ class DescriptorPoolTypeResolver : public TypeResolver {
type->Clear();
type->set_name(descriptor->full_name());
for (int i = 0; i < descriptor->field_count(); ++i) {
+ const FieldDescriptor* field = descriptor->field(i);
+ if (field->type() == FieldDescriptor::TYPE_GROUP) {
+ // Group fields cannot be represented with Type. We discard them.
+ continue;
+ }
ConvertFieldDescriptor(descriptor->field(i), type->add_fields());
}
for (int i = 0; i < descriptor->oneof_decl_count(); ++i) {
@@ -136,8 +141,7 @@ class DescriptorPoolTypeResolver : public TypeResolver {
if (descriptor->has_default_value()) {
field->set_default_value(DefaultValueAsString(descriptor));
}
- if (descriptor->type() == FieldDescriptor::TYPE_MESSAGE ||
- descriptor->type() == FieldDescriptor::TYPE_GROUP) {
+ if (descriptor->type() == FieldDescriptor::TYPE_MESSAGE) {
field->set_type_url(GetTypeUrl(descriptor->message_type()));
} else if (descriptor->type() == FieldDescriptor::TYPE_ENUM) {
field->set_type_url(GetTypeUrl(descriptor->enum_type()));
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util.h b/third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util.h
index c17366fc79..c17366fc79 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util.h
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util_test.cc b/third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util_test.cc
index 9dea17aec5..8a0bf65297 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/util/type_resolver_util_test.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/util/type_resolver_util_test.cc
@@ -32,6 +32,9 @@
#include <limits>
#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <vector>
@@ -150,7 +153,7 @@ class DescriptorPoolTypeResolverTest : public testing::Test {
}
protected:
- std::unique_ptr<TypeResolver> resolver_;
+ google::protobuf::scoped_ptr<TypeResolver> resolver_;
};
TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) {
@@ -190,13 +193,6 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) {
Field::TYPE_BYTES, "optional_bytes", 15));
EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL,
- Field::TYPE_GROUP, "optionalgroup", 16));
-
- EXPECT_TRUE(CheckFieldTypeUrl(
- type, "optionalgroup",
- GetTypeUrl<protobuf_unittest::TestAllTypes::OptionalGroup>()));
-
- EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL,
Field::TYPE_MESSAGE, "optional_nested_message", 18));
EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL,
Field::TYPE_MESSAGE, "optional_foreign_message", 19));
@@ -253,13 +249,6 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) {
Field::TYPE_BYTES, "repeated_bytes", 45));
EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED,
- Field::TYPE_GROUP, "repeatedgroup", 46));
-
- EXPECT_TRUE(CheckFieldTypeUrl(
- type, "repeatedgroup",
- GetTypeUrl<protobuf_unittest::TestAllTypes::RepeatedGroup>()));
-
- EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED,
Field::TYPE_MESSAGE, "repeated_nested_message", 48));
EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED,
Field::TYPE_MESSAGE, "repeated_foreign_message", 49));
@@ -282,6 +271,13 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) {
EXPECT_TRUE(CheckFieldTypeUrl(
type, "repeated_foreign_enum",
GetTypeUrl("protobuf_unittest.ForeignEnum")));
+
+ // Groups are discarded when converting to Type.
+ const Descriptor* descriptor = protobuf_unittest::TestAllTypes::descriptor();
+ EXPECT_TRUE(descriptor->FindFieldByName("optionalgroup") != NULL);
+ EXPECT_TRUE(descriptor->FindFieldByName("repeatedgroup") != NULL);
+ ASSERT_FALSE(HasField(type, "optionalgroup"));
+ ASSERT_FALSE(HasField(type, "repeatedgroup"));
}
TEST_F(DescriptorPoolTypeResolverTest, TestPackedField) {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/well_known_types_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/well_known_types_unittest.cc
index c9a9aa10ec..c9a9aa10ec 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/well_known_types_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/well_known_types_unittest.cc
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format.cc b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format.cc
index 3fdf84edef..01704c9470 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format.cc
@@ -41,15 +41,16 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/stringprintf.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/dynamic_message.h>
+#include <google/protobuf/map_field.h>
+#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
-#include <google/protobuf/descriptor.h>
-#include <google/protobuf/dynamic_message.h>
-#include <google/protobuf/map_field.h>
#include <google/protobuf/unknown_field_set.h>
-#include <google/protobuf/wire_format_lite_inl.h>
+
namespace google {
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format.h b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format.h
index d602d214be..01ee133762 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format.h
@@ -41,6 +41,7 @@
#include <string>
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/wire_format_lite.h>
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite.cc b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite.cc
index 1d8cda5a4a..359353c3d1 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite.cc
@@ -34,6 +34,9 @@
#include <google/protobuf/wire_format_lite_inl.h>
+#ifdef __SSE_4_1__
+#include <immintrin.h>
+#endif
#include <stack>
#include <string>
#include <vector>
@@ -583,7 +586,7 @@ void WireFormatLite::WriteMessageMaybeToArray(int field_number,
}
}
-GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static bool ReadBytesToString(
+GOOGLE_ATTRIBUTE_ALWAYS_INLINE static bool ReadBytesToString(
io::CodedInputStream* input, string* value);
inline static bool ReadBytesToString(io::CodedInputStream* input,
string* value) {
@@ -632,12 +635,12 @@ bool WireFormatLite::VerifyUtf8String(const char* data,
return true;
}
-// 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) {
+#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) {
#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,
@@ -646,83 +649,101 @@ static size_t VarintSize(const T* data, const int n) {
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
- uint32 sum = n;
- uint32 msb_sum = 0;
- for (int i = 0; i < n; i++) {
- uint32 x = data[i];
+
+ 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]));
+
if (ZigZag) {
- x = WireFormatLite::ZigZagEncode32(x);
- } else if (SignExtended) {
- msb_sum += x >> 31;
+ // 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);
}
- // 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;
-}
-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 (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++) {
if (ZigZag) {
- x = WireFormatLite::ZigZagEncode64(x);
+ out += WireFormatLite::SInt32Size(data[i]);
+ } else if (SignExtended) {
+ out += WireFormatLite::Int32Size(data[i]);
+ } else {
+ out += WireFormatLite::UInt32Size(data[i]);
}
- // 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 sum;
+
+ return out;
}
-// 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<false, true>(value.data(), value.size());
+ return VarintSize<int32, false, true>(value.data(), value.size());
}
size_t WireFormatLite::UInt32Size(const RepeatedField<uint32>& value) {
- return VarintSize<false, false>(value.data(), value.size());
+ return VarintSize<uint32, false, false>(value.data(), value.size());
}
size_t WireFormatLite::SInt32Size(const RepeatedField<int32>& value) {
- return VarintSize<true, false>(value.data(), value.size());
+ return VarintSize<int32, true, true>(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<false, true>(value.data(), value.size());
+ return VarintSize<int, false, true>(value.data(), value.size());
}
-#else // !(defined(__SSE4_1__) && defined(__clang__))
-
+#else // !__SSE_4_1__
size_t WireFormatLite::Int32Size(const RepeatedField<int32>& value) {
size_t out = 0;
const int n = value.size();
@@ -758,56 +779,6 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite.h b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite.h
index 77eaa9a684..3e079ea530 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite.h
@@ -41,12 +41,10 @@
#define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
#include <string>
-
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/message_lite.h>
-#include <google/protobuf/stubs/port.h>
#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/message_lite.h>
+#include <google/protobuf/io/coded_stream.h> // for CodedOutputStream::Varint32Size
// Do UTF-8 validation on string type in Debug build only
#ifndef NDEBUG
@@ -151,7 +149,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
// Helper method to get the CppType for a particular Type.
static CppType FieldTypeToCppType(FieldType type);
- // Given a FieldDescriptor::Type return its WireType
+ // Given a FieldSescriptor::Type return its WireType
static inline WireFormatLite::WireType WireTypeForFieldType(
WireFormatLite::FieldType type) {
return kWireTypeForFieldType[type];
@@ -258,7 +256,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
// that file to use these.
#ifdef NDEBUG
-#define INL GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
+#define INL GOOGLE_ATTRIBUTE_ALWAYS_INLINE
#else
// Avoid excessive inlining in non-optimized builds. Without other optimizations
// the inlining is not going to provide benefits anyway and the huge resulting
@@ -336,6 +334,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
static bool ReadBytes(io::CodedInputStream* input, string* value);
static bool ReadBytes(io::CodedInputStream* input, string** p);
+
enum Operation {
PARSE = 0,
SERIALIZE = 1,
@@ -346,27 +345,32 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
Operation op,
const char* field_name);
- template <typename MessageType>
static inline bool ReadGroup(int field_number, io::CodedInputStream* input,
- MessageType* value);
-
- template <typename MessageType>
+ MessageLite* value);
static inline bool ReadMessage(io::CodedInputStream* input,
- MessageType* value);
+ MessageLite* value);
- // Do not use.
+ // Like above, but de-virtualize the call to MergePartialFromCodedStream().
+ // The pointer must point at an instance of MessageType, *not* a subclass (or
+ // the subclass must not override MergePartialFromCodedStream()).
template <typename MessageType>
static inline bool ReadGroupNoVirtual(int field_number,
io::CodedInputStream* input,
- MessageType* value) {
- return ReadGroup(field_number, input, value);
- }
-
+ MessageType* value);
template<typename MessageType>
static inline bool ReadMessageNoVirtual(io::CodedInputStream* input,
- MessageType* value) {
- return ReadMessage(input, value);
- }
+ MessageType* value);
+
+ // The same, but do not modify input's recursion depth. This is useful
+ // when reading a bunch of groups or messages in a loop, because then the
+ // recursion depth can be incremented before the loop and decremented after.
+ template<typename MessageType>
+ static inline bool ReadGroupNoVirtualNoRecursionDepth(
+ int field_number, io::CodedInputStream* input, MessageType* value);
+
+ template<typename MessageType>
+ static inline bool ReadMessageNoVirtualNoRecursionDepth(
+ io::CodedInputStream* input, MessageType* value);
// Write a tag. The Write*() functions typically include the tag, so
// normally there's no need to call this unless using the Write*NoTag()
@@ -607,14 +611,12 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
// of serialization, the "ToArray" variants may be invoked. But they don't
// have a CodedOutputStream available, so they get an additional parameter
// telling them whether to serialize deterministically.
- template<typename MessageType>
INL static uint8* InternalWriteGroupToArray(int field_number,
- const MessageType& value,
+ const MessageLite& value,
bool deterministic,
uint8* target);
- template<typename MessageType>
INL static uint8* InternalWriteMessageToArray(int field_number,
- const MessageType& value,
+ const MessageLite& value,
bool deterministic,
uint8* target);
@@ -671,13 +673,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 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);
+ 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);
// These types always have the same size.
static const size_t kFixed32Size = 4;
@@ -691,10 +693,8 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
static inline size_t StringSize(const string& value);
static inline size_t BytesSize (const string& value);
- template<typename MessageType>
- static inline size_t GroupSize (const MessageType& value);
- template<typename MessageType>
- static inline size_t MessageSize(const MessageType& value);
+ static inline size_t GroupSize (const MessageLite& value);
+ static inline size_t MessageSize(const MessageLite& value);
// Like above, but de-virtualize the call to ByteSize(). The
// pointer must point at an instance of MessageType, *not* a subclass (or
@@ -712,8 +712,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
// A helper method for the repeated primitive reader. This method has
// optimizations for primitive types that have fixed size on the wire, and
// can be read using potentially faster paths.
- template <typename CType, enum FieldType DeclaredType>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
+ template <typename CType, enum FieldType DeclaredType> GOOGLE_ATTRIBUTE_ALWAYS_INLINE
static bool ReadRepeatedFixedSizePrimitive(
int tag_size,
uint32 tag,
@@ -722,8 +721,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
// Like ReadRepeatedFixedSizePrimitive but for packed primitive fields.
template <typename CType, enum FieldType DeclaredType>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- static bool ReadPackedFixedSizePrimitive(
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE static bool ReadPackedFixedSizePrimitive(
google::protobuf::io::CodedInputStream* input, RepeatedField<CType>* value);
static const CppType kFieldTypeToCppTypeMap[];
@@ -853,24 +851,20 @@ inline double WireFormatLite::DecodeDouble(uint64 value) {
inline uint32 WireFormatLite::ZigZagEncode32(int32 n) {
// Note: the right-shift must be arithmetic
- // Note: left shift must be unsigned because of overflow
- return (static_cast<uint32>(n) << 1) ^ static_cast<uint32>(n >> 31);
+ return static_cast<uint32>((n << 1) ^ (n >> 31));
}
inline int32 WireFormatLite::ZigZagDecode32(uint32 n) {
- // Note: Using unsigned types prevent undefined behavior
- return static_cast<int32>((n >> 1) ^ (~(n & 1) + 1));
+ return static_cast<int32>(n >> 1) ^ -static_cast<int32>(n & 1);
}
inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
// Note: the right-shift must be arithmetic
- // Note: left shift must be unsigned because of overflow
- return (static_cast<uint64>(n) << 1) ^ static_cast<uint64>(n >> 63);
+ return static_cast<uint64>((n << 1) ^ (n >> 63));
}
inline int64 WireFormatLite::ZigZagDecode64(uint64 n) {
- // Note: Using unsigned types prevent undefined behavior
- return static_cast<int64>((n >> 1) ^ (~(n & 1) + 1));
+ return static_cast<int64>(n >> 1) ^ -static_cast<int64>(n & 1);
}
// String is for UTF-8 text only, but, even so, ReadString() can simply
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite_inl.h b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite_inl.h
index 6cd2c2fbe2..c044def8bd 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format_lite_inl.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format_lite_inl.h
@@ -426,22 +426,21 @@ bool WireFormatLite::ReadPackedPrimitiveNoInline(io::CodedInputStream* input,
}
-template<typename MessageType>
-inline bool WireFormatLite::ReadGroup(
- int field_number, io::CodedInputStream* input,
- MessageType* value) {
+
+inline bool WireFormatLite::ReadGroup(int field_number,
+ io::CodedInputStream* input,
+ MessageLite* value) {
if (!input->IncrementRecursionDepth()) return false;
if (!value->MergePartialFromCodedStream(input)) return false;
- input->UnsafeDecrementRecursionDepth();
+ input->DecrementRecursionDepth();
// Make sure the last thing read was an end tag for this group.
if (!input->LastTagWas(MakeTag(field_number, WIRETYPE_END_GROUP))) {
return false;
}
return true;
}
-template<typename MessageType>
-inline bool WireFormatLite::ReadMessage(
- io::CodedInputStream* input, MessageType* value) {
+inline bool WireFormatLite::ReadMessage(io::CodedInputStream* input,
+ MessageLite* value) {
int length;
if (!input->ReadVarintSizeAsInt(&length)) return false;
std::pair<io::CodedInputStream::Limit, int> p =
@@ -449,9 +448,69 @@ inline bool WireFormatLite::ReadMessage(
if (p.second < 0 || !value->MergePartialFromCodedStream(input)) return false;
// Make sure that parsing stopped when the limit was hit, not at an endgroup
// tag.
+ return input->DecrementRecursionDepthAndPopLimit(p.first);
+}
+
+// We name the template parameter something long and extremely unlikely to occur
+// elsewhere because a *qualified* member access expression designed to avoid
+// virtual dispatch, C++03 [basic.lookup.classref] 3.4.5/4 requires that the
+// name of the qualifying class to be looked up both in the context of the full
+// expression (finding the template parameter) and in the context of the object
+// whose member we are accessing. This could potentially find a nested type
+// within that object. The standard goes on to require these names to refer to
+// the same entity, which this collision would violate. The lack of a safe way
+// to avoid this collision appears to be a defect in the standard, but until it
+// is corrected, we choose the name to avoid accidental collisions.
+template<typename MessageType_WorkAroundCppLookupDefect>
+inline bool WireFormatLite::ReadGroupNoVirtual(
+ int field_number, io::CodedInputStream* input,
+ MessageType_WorkAroundCppLookupDefect* value) {
+ if (!input->IncrementRecursionDepth()) return false;
+ if (!value->
+ MessageType_WorkAroundCppLookupDefect::MergePartialFromCodedStream(input))
+ return false;
+ input->UnsafeDecrementRecursionDepth();
+ // Make sure the last thing read was an end tag for this group.
+ if (!input->LastTagWas(MakeTag(field_number, WIRETYPE_END_GROUP))) {
+ return false;
+ }
+ return true;
+}
+template<typename MessageType_WorkAroundCppLookupDefect>
+inline bool WireFormatLite::ReadGroupNoVirtualNoRecursionDepth(
+ int field_number, io::CodedInputStream* input,
+ MessageType_WorkAroundCppLookupDefect* value) {
+ return value->MessageType_WorkAroundCppLookupDefect::
+ MergePartialFromCodedStream(input) &&
+ input->LastTagWas(MakeTag(field_number, WIRETYPE_END_GROUP));
+}
+template<typename MessageType_WorkAroundCppLookupDefect>
+inline bool WireFormatLite::ReadMessageNoVirtual(
+ io::CodedInputStream* input, MessageType_WorkAroundCppLookupDefect* value) {
+ int length;
+ if (!input->ReadVarintSizeAsInt(&length)) return false;
+ std::pair<io::CodedInputStream::Limit, int> p =
+ input->IncrementRecursionDepthAndPushLimit(length);
+ if (p.second < 0 || !value->
+ MessageType_WorkAroundCppLookupDefect::MergePartialFromCodedStream(input))
+ return false;
+ // Make sure that parsing stopped when the limit was hit, not at an endgroup
+ // tag.
return input->DecrementRecursionDepthAndPopLimit(p.first);
}
+template<typename MessageType_WorkAroundCppLookupDefect>
+inline bool WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
+ io::CodedInputStream* input, MessageType_WorkAroundCppLookupDefect* value) {
+ io::CodedInputStream::Limit old_limit = input->ReadLengthAndPushLimit();
+ if (!value->
+ MessageType_WorkAroundCppLookupDefect::MergePartialFromCodedStream(input))
+ return false;
+ // Make sure that parsing stopped when the limit was hit, not at an endgroup
+ // tag.
+ return input->CheckEntireMessageConsumedAndPopLimit(old_limit);
+}
+
// ===================================================================
inline void WireFormatLite::WriteTag(int field_number, WireType type,
@@ -883,17 +942,15 @@ inline uint8* WireFormatLite::WriteBytesToArray(int field_number,
}
-template<typename MessageType>
inline uint8* WireFormatLite::InternalWriteGroupToArray(
- int field_number, const MessageType& value, bool deterministic,
+ int field_number, const MessageLite& value, bool deterministic,
uint8* target) {
target = WriteTagToArray(field_number, WIRETYPE_START_GROUP, target);
target = value.InternalSerializeWithCachedSizesToArray(deterministic, target);
return WriteTagToArray(field_number, WIRETYPE_END_GROUP, target);
}
-template<typename MessageType>
inline uint8* WireFormatLite::InternalWriteMessageToArray(
- int field_number, const MessageType& value, bool deterministic,
+ int field_number, const MessageLite& value, bool deterministic,
uint8* target) {
target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target);
target = io::CodedOutputStream::WriteVarint32ToArray(
@@ -957,12 +1014,10 @@ inline size_t WireFormatLite::BytesSize(const string& value) {
}
-template<typename MessageType>
-inline size_t WireFormatLite::GroupSize(const MessageType& value) {
+inline size_t WireFormatLite::GroupSize(const MessageLite& value) {
return value.ByteSizeLong();
}
-template<typename MessageType>
-inline size_t WireFormatLite::MessageSize(const MessageType& value) {
+inline size_t WireFormatLite::MessageSize(const MessageLite& value) {
return LengthDelimitedSize(value.ByteSizeLong());
}
@@ -989,6 +1044,33 @@ 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/third_party/protobuf/3.6.0/src/google/protobuf/wire_format_unittest.cc b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format_unittest.cc
index 736a12828f..cafe9a48f9 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wire_format_unittest.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wire_format_unittest.cc
@@ -1436,7 +1436,6 @@ TEST(RepeatedVarint, Enum) {
EXPECT_EQ(expected, WireFormatLite::EnumSize(v));
}
-
} // namespace
} // namespace internal
} // namespace protobuf
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/wrappers.pb.cc b/third_party/protobuf/3.4.0/src/google/protobuf/wrappers.pb.cc
index ffd905f507..d76e8aa63b 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wrappers.pb.cc
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wrappers.pb.cc
@@ -1,315 +1,235 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/wrappers.proto
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/wrappers.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
class DoubleValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<DoubleValue>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<DoubleValue>
+ _instance;
} _DoubleValue_default_instance_;
class FloatValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<FloatValue>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<FloatValue>
+ _instance;
} _FloatValue_default_instance_;
class Int64ValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Int64Value>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Int64Value>
+ _instance;
} _Int64Value_default_instance_;
class UInt64ValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<UInt64Value>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<UInt64Value>
+ _instance;
} _UInt64Value_default_instance_;
class Int32ValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<Int32Value>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<Int32Value>
+ _instance;
} _Int32Value_default_instance_;
class UInt32ValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<UInt32Value>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<UInt32Value>
+ _instance;
} _UInt32Value_default_instance_;
class BoolValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<BoolValue>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<BoolValue>
+ _instance;
} _BoolValue_default_instance_;
class StringValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<StringValue>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<StringValue>
+ _instance;
} _StringValue_default_instance_;
class BytesValueDefaultTypeInternal {
- public:
- ::google::protobuf::internal::ExplicitlyConstructed<BytesValue>
- _instance;
+public:
+ ::google::protobuf::internal::ExplicitlyConstructed<BytesValue>
+ _instance;
} _BytesValue_default_instance_;
-} // namespace protobuf
-} // namespace google
-namespace protobuf_google_2fprotobuf_2fwrappers_2eproto {
-static void InitDefaultsDoubleValue() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_DoubleValue_default_instance_;
- new (ptr) ::google::protobuf::DoubleValue();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::DoubleValue::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_DoubleValue =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsDoubleValue}, {}};
-
-static void InitDefaultsFloatValue() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_FloatValue_default_instance_;
- new (ptr) ::google::protobuf::FloatValue();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::FloatValue::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_FloatValue =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsFloatValue}, {}};
-
-static void InitDefaultsInt64Value() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_Int64Value_default_instance_;
- new (ptr) ::google::protobuf::Int64Value();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Int64Value::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Int64Value =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsInt64Value}, {}};
-
-static void InitDefaultsUInt64Value() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_UInt64Value_default_instance_;
- new (ptr) ::google::protobuf::UInt64Value();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::UInt64Value::InitAsDefaultInstance();
-}
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_UInt64Value =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsUInt64Value}, {}};
-
-static void InitDefaultsInt32Value() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_Int32Value_default_instance_;
- new (ptr) ::google::protobuf::Int32Value();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::Int32Value::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Int32Value =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsInt32Value}, {}};
-
-static void InitDefaultsUInt32Value() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_UInt32Value_default_instance_;
- new (ptr) ::google::protobuf::UInt32Value();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::UInt32Value::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_UInt32Value =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsUInt32Value}, {}};
-
-static void InitDefaultsBoolValue() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_BoolValue_default_instance_;
- new (ptr) ::google::protobuf::BoolValue();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::BoolValue::InitAsDefaultInstance();
-}
-
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_BoolValue =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsBoolValue}, {}};
-
-static void InitDefaultsStringValue() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- {
- void* ptr = &::google::protobuf::_StringValue_default_instance_;
- new (ptr) ::google::protobuf::StringValue();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::StringValue::InitAsDefaultInstance();
-}
+namespace protobuf_google_2fprotobuf_2fwrappers_2eproto {
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_StringValue =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsStringValue}, {}};
-static void InitDefaultsBytesValue() {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
+namespace {
- {
- void* ptr = &::google::protobuf::_BytesValue_default_instance_;
- new (ptr) ::google::protobuf::BytesValue();
- ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
- }
- ::google::protobuf::BytesValue::InitAsDefaultInstance();
-}
+::google::protobuf::Metadata file_level_metadata[9];
-LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_BytesValue =
- {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsBytesValue}, {}};
+} // namespace
-void InitDefaults() {
- ::google::protobuf::internal::InitSCC(&scc_info_DoubleValue.base);
- ::google::protobuf::internal::InitSCC(&scc_info_FloatValue.base);
- ::google::protobuf::internal::InitSCC(&scc_info_Int64Value.base);
- ::google::protobuf::internal::InitSCC(&scc_info_UInt64Value.base);
- ::google::protobuf::internal::InitSCC(&scc_info_Int32Value.base);
- ::google::protobuf::internal::InitSCC(&scc_info_UInt32Value.base);
- ::google::protobuf::internal::InitSCC(&scc_info_BoolValue.base);
- ::google::protobuf::internal::InitSCC(&scc_info_StringValue.base);
- ::google::protobuf::internal::InitSCC(&scc_info_BytesValue.base);
-}
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
+ const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
+};
-::google::protobuf::Metadata file_level_metadata[9];
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
+ const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ ::google::protobuf::internal::AuxillaryParseTableField(),
+};
+PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
+ TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+ { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
+};
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DoubleValue, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DoubleValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DoubleValue, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DoubleValue, value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FloatValue, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FloatValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FloatValue, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FloatValue, value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Int64Value, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int64Value, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Int64Value, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int64Value, value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UInt64Value, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt64Value, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UInt64Value, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt64Value, value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Int32Value, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int32Value, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Int32Value, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int32Value, value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UInt32Value, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt32Value, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UInt32Value, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt32Value, value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::BoolValue, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BoolValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::BoolValue, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BoolValue, value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::StringValue, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StringValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::StringValue, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StringValue, value_),
~0u, // no _has_bits_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::BytesValue, _internal_metadata_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BytesValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::BytesValue, value_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BytesValue, value_),
};
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::google::protobuf::DoubleValue)},
- { 6, -1, sizeof(::google::protobuf::FloatValue)},
- { 12, -1, sizeof(::google::protobuf::Int64Value)},
- { 18, -1, sizeof(::google::protobuf::UInt64Value)},
- { 24, -1, sizeof(::google::protobuf::Int32Value)},
- { 30, -1, sizeof(::google::protobuf::UInt32Value)},
- { 36, -1, sizeof(::google::protobuf::BoolValue)},
- { 42, -1, sizeof(::google::protobuf::StringValue)},
- { 48, -1, sizeof(::google::protobuf::BytesValue)},
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(DoubleValue)},
+ { 6, -1, sizeof(FloatValue)},
+ { 12, -1, sizeof(Int64Value)},
+ { 18, -1, sizeof(UInt64Value)},
+ { 24, -1, sizeof(Int32Value)},
+ { 30, -1, sizeof(UInt32Value)},
+ { 36, -1, sizeof(BoolValue)},
+ { 42, -1, sizeof(StringValue)},
+ { 48, -1, sizeof(BytesValue)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_DoubleValue_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FloatValue_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Int64Value_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_UInt64Value_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Int32Value_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_UInt32Value_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_BoolValue_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_StringValue_default_instance_),
- reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_BytesValue_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_DoubleValue_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_FloatValue_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Int64Value_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_UInt64Value_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_Int32Value_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_UInt32Value_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_BoolValue_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_StringValue_default_instance_),
+ reinterpret_cast<const ::google::protobuf::Message*>(&_BytesValue_default_instance_),
};
+namespace {
+
void protobuf_AssignDescriptors() {
AddDescriptors();
+ ::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
- "google/protobuf/wrappers.proto", schemas, file_default_instances, TableStruct::offsets,
+ "google/protobuf/wrappers.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 9);
}
+} // namespace
+void TableStruct::InitDefaultsImpl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::internal::InitProtobufDefaults();
+ _DoubleValue_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_DoubleValue_default_instance_);_FloatValue_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_FloatValue_default_instance_);_Int64Value_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Int64Value_default_instance_);_UInt64Value_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_UInt64Value_default_instance_);_Int32Value_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_Int32Value_default_instance_);_UInt32Value_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_UInt32Value_default_instance_);_BoolValue_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_BoolValue_default_instance_);_StringValue_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_StringValue_default_instance_);_BytesValue_default_instance_._instance.DefaultConstruct();
+ ::google::protobuf::internal::OnShutdownDestroyMessage(
+ &_BytesValue_default_instance_);}
+
+void InitDefaults() {
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
+}
+namespace {
void AddDescriptorsImpl() {
InitDefaults();
- static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+ static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\036google/protobuf/wrappers.proto\022\017google"
".protobuf\"\034\n\013DoubleValue\022\r\n\005value\030\001 \001(\001\""
"\033\n\nFloatValue\022\r\n\005value\030\001 \001(\002\"\033\n\nInt64Val"
@@ -328,10 +248,11 @@ void AddDescriptorsImpl() {
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/wrappers.proto", &protobuf_RegisterTypes);
}
+} // anonymous namespace
void AddDescriptors() {
- static ::google::protobuf::internal::once_flag once;
- ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
+ static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+ ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
@@ -339,36 +260,36 @@ struct StaticDescriptorInitializer {
AddDescriptors();
}
} static_descriptor_initializer;
+
} // namespace protobuf_google_2fprotobuf_2fwrappers_2eproto
-namespace google {
-namespace protobuf {
+
// ===================================================================
-void DoubleValue::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int DoubleValue::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
DoubleValue::DoubleValue()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_DoubleValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.DoubleValue)
}
DoubleValue::DoubleValue(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_DoubleValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.DoubleValue)
}
DoubleValue::DoubleValue(const DoubleValue& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_ = from.value_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.DoubleValue)
@@ -376,6 +297,7 @@ DoubleValue::DoubleValue(const DoubleValue& from)
void DoubleValue::SharedCtor() {
value_ = 0;
+ _cached_size_ = 0;
}
DoubleValue::~DoubleValue() {
@@ -384,7 +306,12 @@ DoubleValue::~DoubleValue() {
}
void DoubleValue::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void DoubleValue::ArenaDtor(void* object) {
@@ -394,18 +321,23 @@ void DoubleValue::ArenaDtor(void* object) {
void DoubleValue::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void DoubleValue::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DoubleValue::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const DoubleValue& DoubleValue::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_DoubleValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -423,7 +355,7 @@ bool DoubleValue::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.DoubleValue)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -514,7 +446,9 @@ size_t DoubleValue::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -586,40 +520,59 @@ void DoubleValue::InternalSwap(DoubleValue* other) {
using std::swap;
swap(value_, other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata DoubleValue::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// DoubleValue
+
+// double value = 1;
+void DoubleValue::clear_value() {
+ value_ = 0;
+}
+double DoubleValue::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DoubleValue.value)
+ return value_;
+}
+void DoubleValue::set_value(double value) {
+
+ value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.DoubleValue.value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void FloatValue::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FloatValue::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FloatValue::FloatValue()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_FloatValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FloatValue)
}
FloatValue::FloatValue(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_FloatValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.FloatValue)
}
FloatValue::FloatValue(const FloatValue& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_ = from.value_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.FloatValue)
@@ -627,6 +580,7 @@ FloatValue::FloatValue(const FloatValue& from)
void FloatValue::SharedCtor() {
value_ = 0;
+ _cached_size_ = 0;
}
FloatValue::~FloatValue() {
@@ -635,7 +589,12 @@ FloatValue::~FloatValue() {
}
void FloatValue::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void FloatValue::ArenaDtor(void* object) {
@@ -645,18 +604,23 @@ void FloatValue::ArenaDtor(void* object) {
void FloatValue::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void FloatValue::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FloatValue::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FloatValue& FloatValue::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_FloatValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -674,7 +638,7 @@ bool FloatValue::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FloatValue)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -765,7 +729,9 @@ size_t FloatValue::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -837,40 +803,59 @@ void FloatValue::InternalSwap(FloatValue* other) {
using std::swap;
swap(value_, other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata FloatValue::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// FloatValue
+
+// float value = 1;
+void FloatValue::clear_value() {
+ value_ = 0;
+}
+float FloatValue::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FloatValue.value)
+ return value_;
+}
+void FloatValue::set_value(float value) {
+
+ value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.FloatValue.value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void Int64Value::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Int64Value::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
Int64Value::Int64Value()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_Int64Value.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Int64Value)
}
Int64Value::Int64Value(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_Int64Value.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Int64Value)
}
Int64Value::Int64Value(const Int64Value& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_ = from.value_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.Int64Value)
@@ -878,6 +863,7 @@ Int64Value::Int64Value(const Int64Value& from)
void Int64Value::SharedCtor() {
value_ = GOOGLE_LONGLONG(0);
+ _cached_size_ = 0;
}
Int64Value::~Int64Value() {
@@ -886,7 +872,12 @@ Int64Value::~Int64Value() {
}
void Int64Value::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void Int64Value::ArenaDtor(void* object) {
@@ -896,18 +887,23 @@ void Int64Value::ArenaDtor(void* object) {
void Int64Value::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Int64Value::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Int64Value::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Int64Value& Int64Value::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_Int64Value.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -925,7 +921,7 @@ bool Int64Value::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Int64Value)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1018,7 +1014,9 @@ size_t Int64Value::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1090,40 +1088,59 @@ void Int64Value::InternalSwap(Int64Value* other) {
using std::swap;
swap(value_, other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Int64Value::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Int64Value
+
+// int64 value = 1;
+void Int64Value::clear_value() {
+ value_ = GOOGLE_LONGLONG(0);
+}
+::google::protobuf::int64 Int64Value::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value)
+ return value_;
+}
+void Int64Value::set_value(::google::protobuf::int64 value) {
+
+ value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value)
}
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void UInt64Value::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int UInt64Value::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
UInt64Value::UInt64Value()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_UInt64Value.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.UInt64Value)
}
UInt64Value::UInt64Value(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_UInt64Value.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.UInt64Value)
}
UInt64Value::UInt64Value(const UInt64Value& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_ = from.value_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.UInt64Value)
@@ -1131,6 +1148,7 @@ UInt64Value::UInt64Value(const UInt64Value& from)
void UInt64Value::SharedCtor() {
value_ = GOOGLE_ULONGLONG(0);
+ _cached_size_ = 0;
}
UInt64Value::~UInt64Value() {
@@ -1139,7 +1157,12 @@ UInt64Value::~UInt64Value() {
}
void UInt64Value::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void UInt64Value::ArenaDtor(void* object) {
@@ -1149,18 +1172,23 @@ void UInt64Value::ArenaDtor(void* object) {
void UInt64Value::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void UInt64Value::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UInt64Value::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const UInt64Value& UInt64Value::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_UInt64Value.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -1178,7 +1206,7 @@ bool UInt64Value::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.UInt64Value)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1271,7 +1299,9 @@ size_t UInt64Value::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1343,40 +1373,59 @@ void UInt64Value::InternalSwap(UInt64Value* other) {
using std::swap;
swap(value_, other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata UInt64Value::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// UInt64Value
+
+// uint64 value = 1;
+void UInt64Value::clear_value() {
+ value_ = GOOGLE_ULONGLONG(0);
+}
+::google::protobuf::uint64 UInt64Value::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value)
+ return value_;
+}
+void UInt64Value::set_value(::google::protobuf::uint64 value) {
+
+ value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value)
}
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void Int32Value::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Int32Value::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
Int32Value::Int32Value()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_Int32Value.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.Int32Value)
}
Int32Value::Int32Value(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_Int32Value.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Int32Value)
}
Int32Value::Int32Value(const Int32Value& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_ = from.value_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.Int32Value)
@@ -1384,6 +1433,7 @@ Int32Value::Int32Value(const Int32Value& from)
void Int32Value::SharedCtor() {
value_ = 0;
+ _cached_size_ = 0;
}
Int32Value::~Int32Value() {
@@ -1392,7 +1442,12 @@ Int32Value::~Int32Value() {
}
void Int32Value::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void Int32Value::ArenaDtor(void* object) {
@@ -1402,18 +1457,23 @@ void Int32Value::ArenaDtor(void* object) {
void Int32Value::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void Int32Value::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Int32Value::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const Int32Value& Int32Value::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_Int32Value.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -1431,7 +1491,7 @@ bool Int32Value::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.Int32Value)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1524,7 +1584,9 @@ size_t Int32Value::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1596,40 +1658,59 @@ void Int32Value::InternalSwap(Int32Value* other) {
using std::swap;
swap(value_, other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Int32Value::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// Int32Value
+
+// int32 value = 1;
+void Int32Value::clear_value() {
+ value_ = 0;
+}
+::google::protobuf::int32 Int32Value::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value)
+ return value_;
+}
+void Int32Value::set_value(::google::protobuf::int32 value) {
+
+ value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void UInt32Value::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int UInt32Value::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
UInt32Value::UInt32Value()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_UInt32Value.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.UInt32Value)
}
UInt32Value::UInt32Value(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_UInt32Value.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.UInt32Value)
}
UInt32Value::UInt32Value(const UInt32Value& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_ = from.value_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.UInt32Value)
@@ -1637,6 +1718,7 @@ UInt32Value::UInt32Value(const UInt32Value& from)
void UInt32Value::SharedCtor() {
value_ = 0u;
+ _cached_size_ = 0;
}
UInt32Value::~UInt32Value() {
@@ -1645,7 +1727,12 @@ UInt32Value::~UInt32Value() {
}
void UInt32Value::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void UInt32Value::ArenaDtor(void* object) {
@@ -1655,18 +1742,23 @@ void UInt32Value::ArenaDtor(void* object) {
void UInt32Value::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void UInt32Value::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UInt32Value::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const UInt32Value& UInt32Value::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_UInt32Value.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -1684,7 +1776,7 @@ bool UInt32Value::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.UInt32Value)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -1777,7 +1869,9 @@ size_t UInt32Value::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -1849,40 +1943,59 @@ void UInt32Value::InternalSwap(UInt32Value* other) {
using std::swap;
swap(value_, other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata UInt32Value::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// UInt32Value
+
+// uint32 value = 1;
+void UInt32Value::clear_value() {
+ value_ = 0u;
+}
+::google::protobuf::uint32 UInt32Value::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value)
+ return value_;
+}
+void UInt32Value::set_value(::google::protobuf::uint32 value) {
+
+ value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void BoolValue::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int BoolValue::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
BoolValue::BoolValue()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_BoolValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.BoolValue)
}
BoolValue::BoolValue(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_BoolValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.BoolValue)
}
BoolValue::BoolValue(const BoolValue& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_ = from.value_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.BoolValue)
@@ -1890,6 +2003,7 @@ BoolValue::BoolValue(const BoolValue& from)
void BoolValue::SharedCtor() {
value_ = false;
+ _cached_size_ = 0;
}
BoolValue::~BoolValue() {
@@ -1898,7 +2012,12 @@ BoolValue::~BoolValue() {
}
void BoolValue::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
}
void BoolValue::ArenaDtor(void* object) {
@@ -1908,18 +2027,23 @@ void BoolValue::ArenaDtor(void* object) {
void BoolValue::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void BoolValue::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* BoolValue::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const BoolValue& BoolValue::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_BoolValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -1937,7 +2061,7 @@ bool BoolValue::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.BoolValue)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -2028,7 +2152,9 @@ size_t BoolValue::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -2100,40 +2226,59 @@ void BoolValue::InternalSwap(BoolValue* other) {
using std::swap;
swap(value_, other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata BoolValue::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// BoolValue
+
+// bool value = 1;
+void BoolValue::clear_value() {
+ value_ = false;
+}
+bool BoolValue::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.BoolValue.value)
+ return value_;
+}
+void BoolValue::set_value(bool value) {
+
+ value_ = value;
+ // @@protoc_insertion_point(field_set:google.protobuf.BoolValue.value)
+}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void StringValue::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int StringValue::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
StringValue::StringValue()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_StringValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.StringValue)
}
StringValue::StringValue(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_StringValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.StringValue)
}
StringValue::StringValue(const StringValue& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.value().size() > 0) {
@@ -2145,6 +2290,7 @@ StringValue::StringValue(const StringValue& from)
void StringValue::SharedCtor() {
value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ _cached_size_ = 0;
}
StringValue::~StringValue() {
@@ -2153,8 +2299,13 @@ StringValue::~StringValue() {
}
void StringValue::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
- value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
+ value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
}
void StringValue::ArenaDtor(void* object) {
@@ -2164,18 +2315,23 @@ void StringValue::ArenaDtor(void* object) {
void StringValue::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void StringValue::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* StringValue::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const StringValue& StringValue::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_StringValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -2193,7 +2349,7 @@ bool StringValue::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.StringValue)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -2299,7 +2455,9 @@ size_t StringValue::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -2369,43 +2527,122 @@ void StringValue::UnsafeArenaSwap(StringValue* other) {
}
void StringValue::InternalSwap(StringValue* other) {
using std::swap;
- value_.Swap(&other->value_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ value_.Swap(&other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata StringValue::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// StringValue
+
+// string value = 1;
+void StringValue::clear_value() {
+ value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+const ::std::string& StringValue::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.StringValue.value)
+ return value_.Get();
+}
+void StringValue::set_value(const ::std::string& value) {
+
+ value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.StringValue.value)
+}
+#if LANG_CXX11
+void StringValue::set_value(::std::string&& value) {
+
+ value_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.StringValue.value)
+}
+#endif
+void StringValue::set_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.StringValue.value)
+}
+void StringValue::set_value(const char* value,
+ size_t size) {
+
+ value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.StringValue.value)
+}
+::std::string* StringValue::mutable_value() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.StringValue.value)
+ return value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* StringValue::release_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.StringValue.value)
+
+ return value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* StringValue::unsafe_arena_release_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.StringValue.value)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
+void StringValue::set_allocated_value(::std::string* value) {
+ if (value != NULL) {
+
+ } else {
+
+ }
+ value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value)
+}
+void StringValue::unsafe_arena_set_allocated_value(
+ ::std::string* value) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (value != NULL) {
+
+ } else {
+
+ }
+ value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.StringValue.value)
}
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
-void BytesValue::InitAsDefaultInstance() {
-}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int BytesValue::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
BytesValue::BytesValue()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
- ::google::protobuf::internal::InitSCC(
- &protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_BytesValue.base);
+ if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
+ }
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.BytesValue)
}
BytesValue::BytesValue(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_BytesValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:google.protobuf.BytesValue)
}
BytesValue::BytesValue(const BytesValue& from)
: ::google::protobuf::Message(),
- _internal_metadata_(NULL) {
+ _internal_metadata_(NULL),
+ _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.value().size() > 0) {
@@ -2417,6 +2654,7 @@ BytesValue::BytesValue(const BytesValue& from)
void BytesValue::SharedCtor() {
value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ _cached_size_ = 0;
}
BytesValue::~BytesValue() {
@@ -2425,8 +2663,13 @@ BytesValue::~BytesValue() {
}
void BytesValue::SharedDtor() {
- GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
- value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::google::protobuf::Arena* arena = GetArenaNoVirtual();
+ GOOGLE_DCHECK(arena == NULL);
+ if (arena != NULL) {
+ return;
+ }
+
+ value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
}
void BytesValue::ArenaDtor(void* object) {
@@ -2436,18 +2679,23 @@ void BytesValue::ArenaDtor(void* object) {
void BytesValue::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void BytesValue::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* BytesValue::descriptor() {
- ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const BytesValue& BytesValue::default_instance() {
- ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fwrappers_2eproto::scc_info_BytesValue.base);
+ protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults();
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)
@@ -2465,7 +2713,7 @@ bool BytesValue::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.BytesValue)
for (;;) {
- ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
@@ -2559,7 +2807,9 @@ size_t BytesValue::ByteSizeLong() const {
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = cached_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
@@ -2629,49 +2879,98 @@ void BytesValue::UnsafeArenaSwap(BytesValue* other) {
}
void BytesValue::InternalSwap(BytesValue* other) {
using std::swap;
- value_.Swap(&other->value_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
+ value_.Swap(&other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
+ swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata BytesValue::GetMetadata() const {
protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce();
- return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
+ return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages];
}
+#if PROTOBUF_INLINE_NOT_IN_HEADERS
+// BytesValue
-// @@protoc_insertion_point(namespace_scope)
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::DoubleValue* Arena::CreateMaybeMessage< ::google::protobuf::DoubleValue >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::DoubleValue >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FloatValue* Arena::CreateMaybeMessage< ::google::protobuf::FloatValue >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::FloatValue >(arena);
-}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Int64Value* Arena::CreateMaybeMessage< ::google::protobuf::Int64Value >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Int64Value >(arena);
+// bytes value = 1;
+void BytesValue::clear_value() {
+ value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::UInt64Value* Arena::CreateMaybeMessage< ::google::protobuf::UInt64Value >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::UInt64Value >(arena);
+const ::std::string& BytesValue::value() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.BytesValue.value)
+ return value_.Get();
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Int32Value* Arena::CreateMaybeMessage< ::google::protobuf::Int32Value >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::Int32Value >(arena);
+void BytesValue::set_value(const ::std::string& value) {
+
+ value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value)
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::UInt32Value* Arena::CreateMaybeMessage< ::google::protobuf::UInt32Value >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::UInt32Value >(arena);
+#if LANG_CXX11
+void BytesValue::set_value(::std::string&& value) {
+
+ value_.Set(
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.BytesValue.value)
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::BoolValue* Arena::CreateMaybeMessage< ::google::protobuf::BoolValue >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::BoolValue >(arena);
+#endif
+void BytesValue::set_value(const char* value) {
+ GOOGLE_DCHECK(value != NULL);
+
+ value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_char:google.protobuf.BytesValue.value)
+}
+void BytesValue::set_value(const void* value,
+ size_t size) {
+
+ value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
+ reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.BytesValue.value)
+}
+::std::string* BytesValue::mutable_value() {
+
+ // @@protoc_insertion_point(field_mutable:google.protobuf.BytesValue.value)
+ return value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* BytesValue::release_value() {
+ // @@protoc_insertion_point(field_release:google.protobuf.BytesValue.value)
+
+ return value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
+}
+::std::string* BytesValue::unsafe_arena_release_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.BytesValue.value)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::StringValue* Arena::CreateMaybeMessage< ::google::protobuf::StringValue >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::StringValue >(arena);
+void BytesValue::set_allocated_value(::std::string* value) {
+ if (value != NULL) {
+
+ } else {
+
+ }
+ value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value,
+ GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value)
}
-template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::BytesValue* Arena::CreateMaybeMessage< ::google::protobuf::BytesValue >(Arena* arena) {
- return Arena::CreateMessageInternal< ::google::protobuf::BytesValue >(arena);
+void BytesValue::unsafe_arena_set_allocated_value(
+ ::std::string* value) {
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+ if (value != NULL) {
+
+ } else {
+
+ }
+ value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ value, GetArenaNoVirtual());
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.BytesValue.value)
}
+
+#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
+
+// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/wrappers.pb.h b/third_party/protobuf/3.4.0/src/google/protobuf/wrappers.pb.h
index b00d4ea91a..29d6b7384d 100644
--- a/third_party/protobuf/3.6.0/src/google/protobuf/wrappers.pb.h
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wrappers.pb.h
@@ -1,19 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/wrappers.proto
-#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2fwrappers_2eproto
-#define PROTOBUF_INCLUDED_google_2fprotobuf_2fwrappers_2eproto
+#ifndef PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 3006000
+#if GOOGLE_PROTOBUF_VERSION < 3004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -24,27 +24,12 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
-#define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fwrappers_2eproto LIBPROTOBUF_EXPORT
-
-namespace protobuf_google_2fprotobuf_2fwrappers_2eproto {
-// Internal implementation detail -- do not use these members.
-struct LIBPROTOBUF_EXPORT TableStruct {
- static const ::google::protobuf::internal::ParseTableField entries[];
- static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[9];
- static const ::google::protobuf::internal::FieldMetadata field_metadata[];
- static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
-};
-void LIBPROTOBUF_EXPORT AddDescriptors();
-} // namespace protobuf_google_2fprotobuf_2fwrappers_2eproto
namespace google {
namespace protobuf {
class BoolValue;
@@ -76,21 +61,24 @@ class UInt64ValueDefaultTypeInternal;
LIBPROTOBUF_EXPORT extern UInt64ValueDefaultTypeInternal _UInt64Value_default_instance_;
} // namespace protobuf
} // namespace google
+
namespace google {
namespace protobuf {
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::BoolValue* Arena::CreateMaybeMessage<::google::protobuf::BoolValue>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::BytesValue* Arena::CreateMaybeMessage<::google::protobuf::BytesValue>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::DoubleValue* Arena::CreateMaybeMessage<::google::protobuf::DoubleValue>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::FloatValue* Arena::CreateMaybeMessage<::google::protobuf::FloatValue>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Int32Value* Arena::CreateMaybeMessage<::google::protobuf::Int32Value>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::Int64Value* Arena::CreateMaybeMessage<::google::protobuf::Int64Value>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::StringValue* Arena::CreateMaybeMessage<::google::protobuf::StringValue>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::UInt32Value* Arena::CreateMaybeMessage<::google::protobuf::UInt32Value>(Arena*);
-template<> LIBPROTOBUF_EXPORT ::google::protobuf::UInt64Value* Arena::CreateMaybeMessage<::google::protobuf::UInt64Value>(Arena*);
-} // namespace protobuf
-} // namespace google
-namespace google {
-namespace protobuf {
+
+namespace protobuf_google_2fprotobuf_2fwrappers_2eproto {
+// Internal implementation detail -- do not call these.
+struct LIBPROTOBUF_EXPORT TableStruct {
+ static const ::google::protobuf::internal::ParseTableField entries[];
+ static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+ static const ::google::protobuf::internal::ParseTable schema[];
+ static const ::google::protobuf::uint32 offsets[];
+ static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+ static const ::google::protobuf::internal::SerializationTable serialization_table[];
+ static void InitDefaultsImpl();
+};
+void LIBPROTOBUF_EXPORT AddDescriptors();
+void LIBPROTOBUF_EXPORT InitDefaults();
+} // namespace protobuf_google_2fprotobuf_2fwrappers_2eproto
// ===================================================================
@@ -120,21 +108,20 @@ class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@p
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const DoubleValue& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const DoubleValue* internal_default_instance() {
return reinterpret_cast<const DoubleValue*>(
&_DoubleValue_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void UnsafeArenaSwap(DoubleValue* other);
@@ -145,33 +132,28 @@ class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline DoubleValue* New() const final {
- return CreateMaybeMessage<DoubleValue>(NULL);
- }
+ inline DoubleValue* New() const PROTOBUF_FINAL { return New(NULL); }
- DoubleValue* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<DoubleValue>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ DoubleValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const DoubleValue& from);
void MergeFrom(const DoubleValue& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(DoubleValue* other);
protected:
explicit DoubleValue(::google::protobuf::Arena* arena);
@@ -187,7 +169,7 @@ class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@p
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -207,8 +189,8 @@ class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@p
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
double value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -238,21 +220,20 @@ class LIBPROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@pr
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const FloatValue& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FloatValue* internal_default_instance() {
return reinterpret_cast<const FloatValue*>(
&_FloatValue_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
1;
void UnsafeArenaSwap(FloatValue* other);
@@ -263,33 +244,28 @@ class LIBPROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@pr
// implements Message ----------------------------------------------
- inline FloatValue* New() const final {
- return CreateMaybeMessage<FloatValue>(NULL);
- }
+ inline FloatValue* New() const PROTOBUF_FINAL { return New(NULL); }
- FloatValue* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<FloatValue>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ FloatValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FloatValue& from);
void MergeFrom(const FloatValue& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(FloatValue* other);
protected:
explicit FloatValue(::google::protobuf::Arena* arena);
@@ -305,7 +281,7 @@ class LIBPROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@pr
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -325,8 +301,8 @@ class LIBPROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@pr
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
float value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -356,21 +332,20 @@ class LIBPROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@pr
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Int64Value& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Int64Value* internal_default_instance() {
return reinterpret_cast<const Int64Value*>(
&_Int64Value_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
2;
void UnsafeArenaSwap(Int64Value* other);
@@ -381,33 +356,28 @@ class LIBPROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@pr
// implements Message ----------------------------------------------
- inline Int64Value* New() const final {
- return CreateMaybeMessage<Int64Value>(NULL);
- }
+ inline Int64Value* New() const PROTOBUF_FINAL { return New(NULL); }
- Int64Value* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Int64Value>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Int64Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Int64Value& from);
void MergeFrom(const Int64Value& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Int64Value* other);
protected:
explicit Int64Value(::google::protobuf::Arena* arena);
@@ -423,7 +393,7 @@ class LIBPROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@pr
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -443,8 +413,8 @@ class LIBPROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@pr
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::google::protobuf::int64 value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -474,21 +444,20 @@ class LIBPROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@p
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const UInt64Value& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const UInt64Value* internal_default_instance() {
return reinterpret_cast<const UInt64Value*>(
&_UInt64Value_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
3;
void UnsafeArenaSwap(UInt64Value* other);
@@ -499,33 +468,28 @@ class LIBPROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline UInt64Value* New() const final {
- return CreateMaybeMessage<UInt64Value>(NULL);
- }
+ inline UInt64Value* New() const PROTOBUF_FINAL { return New(NULL); }
- UInt64Value* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<UInt64Value>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ UInt64Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const UInt64Value& from);
void MergeFrom(const UInt64Value& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(UInt64Value* other);
protected:
explicit UInt64Value(::google::protobuf::Arena* arena);
@@ -541,7 +505,7 @@ class LIBPROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@p
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -561,8 +525,8 @@ class LIBPROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@p
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::google::protobuf::uint64 value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -592,21 +556,20 @@ class LIBPROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@pr
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const Int32Value& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Int32Value* internal_default_instance() {
return reinterpret_cast<const Int32Value*>(
&_Int32Value_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
4;
void UnsafeArenaSwap(Int32Value* other);
@@ -617,33 +580,28 @@ class LIBPROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@pr
// implements Message ----------------------------------------------
- inline Int32Value* New() const final {
- return CreateMaybeMessage<Int32Value>(NULL);
- }
+ inline Int32Value* New() const PROTOBUF_FINAL { return New(NULL); }
- Int32Value* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<Int32Value>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ Int32Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Int32Value& from);
void MergeFrom(const Int32Value& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(Int32Value* other);
protected:
explicit Int32Value(::google::protobuf::Arena* arena);
@@ -659,7 +617,7 @@ class LIBPROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@pr
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -679,8 +637,8 @@ class LIBPROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@pr
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::google::protobuf::int32 value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -710,21 +668,20 @@ class LIBPROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@p
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const UInt32Value& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const UInt32Value* internal_default_instance() {
return reinterpret_cast<const UInt32Value*>(
&_UInt32Value_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
5;
void UnsafeArenaSwap(UInt32Value* other);
@@ -735,33 +692,28 @@ class LIBPROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline UInt32Value* New() const final {
- return CreateMaybeMessage<UInt32Value>(NULL);
- }
+ inline UInt32Value* New() const PROTOBUF_FINAL { return New(NULL); }
- UInt32Value* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<UInt32Value>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ UInt32Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const UInt32Value& from);
void MergeFrom(const UInt32Value& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(UInt32Value* other);
protected:
explicit UInt32Value(::google::protobuf::Arena* arena);
@@ -777,7 +729,7 @@ class LIBPROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@p
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -797,8 +749,8 @@ class LIBPROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@p
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::google::protobuf::uint32 value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -828,21 +780,20 @@ class LIBPROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@pro
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const BoolValue& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const BoolValue* internal_default_instance() {
return reinterpret_cast<const BoolValue*>(
&_BoolValue_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
6;
void UnsafeArenaSwap(BoolValue* other);
@@ -853,33 +804,28 @@ class LIBPROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline BoolValue* New() const final {
- return CreateMaybeMessage<BoolValue>(NULL);
- }
+ inline BoolValue* New() const PROTOBUF_FINAL { return New(NULL); }
- BoolValue* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<BoolValue>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ BoolValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const BoolValue& from);
void MergeFrom(const BoolValue& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(BoolValue* other);
protected:
explicit BoolValue(::google::protobuf::Arena* arena);
@@ -895,7 +841,7 @@ class LIBPROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@pro
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -915,8 +861,8 @@ class LIBPROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@pro
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
bool value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -946,21 +892,20 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const StringValue& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const StringValue* internal_default_instance() {
return reinterpret_cast<const StringValue*>(
&_StringValue_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
7;
void UnsafeArenaSwap(StringValue* other);
@@ -971,33 +916,28 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline StringValue* New() const final {
- return CreateMaybeMessage<StringValue>(NULL);
- }
+ inline StringValue* New() const PROTOBUF_FINAL { return New(NULL); }
- StringValue* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<StringValue>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ StringValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const StringValue& from);
void MergeFrom(const StringValue& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(StringValue* other);
protected:
explicit StringValue(::google::protobuf::Arena* arena);
@@ -1013,7 +953,7 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -1032,13 +972,7 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p
::std::string* mutable_value();
::std::string* release_value();
void set_allocated_value(::std::string* value);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_value();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_value(
::std::string* value);
@@ -1050,8 +984,8 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::google::protobuf::internal::ArenaStringPtr value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// -------------------------------------------------------------------
@@ -1081,21 +1015,20 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr
return *this;
}
#endif
- inline ::google::protobuf::Arena* GetArena() const final {
+ inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
- inline void* GetMaybeArenaPointer() const final {
+ inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const BytesValue& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const BytesValue* internal_default_instance() {
return reinterpret_cast<const BytesValue*>(
&_BytesValue_default_instance_);
}
- static constexpr int kIndexInFileMessages =
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
8;
void UnsafeArenaSwap(BytesValue* other);
@@ -1106,33 +1039,28 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr
// implements Message ----------------------------------------------
- inline BytesValue* New() const final {
- return CreateMaybeMessage<BytesValue>(NULL);
- }
+ inline BytesValue* New() const PROTOBUF_FINAL { return New(NULL); }
- BytesValue* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<BytesValue>(arena);
- }
- void CopyFrom(const ::google::protobuf::Message& from) final;
- void MergeFrom(const ::google::protobuf::Message& from) final;
+ BytesValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const BytesValue& from);
void MergeFrom(const BytesValue& from);
- void Clear() final;
- bool IsInitialized() const final;
+ void Clear() PROTOBUF_FINAL;
+ bool IsInitialized() const PROTOBUF_FINAL;
- size_t ByteSizeLong() const final;
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) final;
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const final;
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
- bool deterministic, ::google::protobuf::uint8* target) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
- void SetCachedSize(int size) const final;
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(BytesValue* other);
protected:
explicit BytesValue(::google::protobuf::Arena* arena);
@@ -1148,7 +1076,7 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr
}
public:
- ::google::protobuf::Metadata GetMetadata() const final;
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
@@ -1167,13 +1095,7 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr
::std::string* mutable_value();
::std::string* release_value();
void set_allocated_value(::std::string* value);
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
::std::string* unsafe_arena_release_value();
- PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
void unsafe_arena_set_allocated_value(
::std::string* value);
@@ -1185,14 +1107,15 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::google::protobuf::internal::ArenaStringPtr value_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
+ mutable int _cached_size_;
+ friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct;
};
// ===================================================================
// ===================================================================
+#if !PROTOBUF_INLINE_NOT_IN_HEADERS
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -1370,6 +1293,13 @@ inline ::std::string* StringValue::release_value() {
return value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* StringValue::unsafe_arena_release_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.StringValue.value)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void StringValue::set_allocated_value(::std::string* value) {
if (value != NULL) {
@@ -1380,13 +1310,6 @@ inline void StringValue::set_allocated_value(::std::string* value) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value)
}
-inline ::std::string* StringValue::unsafe_arena_release_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.StringValue.value)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void StringValue::unsafe_arena_set_allocated_value(
::std::string* value) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -1449,6 +1372,13 @@ inline ::std::string* BytesValue::release_value() {
return value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
+inline ::std::string* BytesValue::unsafe_arena_release_value() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.BytesValue.value)
+ GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
+
+ return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ GetArenaNoVirtual());
+}
inline void BytesValue::set_allocated_value(::std::string* value) {
if (value != NULL) {
@@ -1459,13 +1389,6 @@ inline void BytesValue::set_allocated_value(::std::string* value) {
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value)
}
-inline ::std::string* BytesValue::unsafe_arena_release_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.BytesValue.value)
- GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
-
- return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- GetArenaNoVirtual());
-}
inline void BytesValue::unsafe_arena_set_allocated_value(
::std::string* value) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
@@ -1482,6 +1405,7 @@ inline void BytesValue::unsafe_arena_set_allocated_value(
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// -------------------------------------------------------------------
// -------------------------------------------------------------------
@@ -1501,9 +1425,10 @@ inline void BytesValue::unsafe_arena_set_allocated_value(
// @@protoc_insertion_point(namespace_scope)
+
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2fwrappers_2eproto
+#endif // PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/wrappers.proto b/third_party/protobuf/3.4.0/src/google/protobuf/wrappers.proto
new file mode 100644
index 0000000000..01947639ac
--- /dev/null
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/wrappers.proto
@@ -0,0 +1,118 @@
+// 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.
+
+// Wrappers for primitive (non-message) types. These types are useful
+// for embedding primitives in the `google.protobuf.Any` type and for places
+// where we need to distinguish between the absence of a primitive
+// typed field and its default value.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option cc_enable_arenas = true;
+option go_package = "github.com/golang/protobuf/ptypes/wrappers";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "WrappersProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+
+// Wrapper message for `double`.
+//
+// The JSON representation for `DoubleValue` is JSON number.
+message DoubleValue {
+ // The double value.
+ double value = 1;
+}
+
+// Wrapper message for `float`.
+//
+// The JSON representation for `FloatValue` is JSON number.
+message FloatValue {
+ // The float value.
+ float value = 1;
+}
+
+// Wrapper message for `int64`.
+//
+// The JSON representation for `Int64Value` is JSON string.
+message Int64Value {
+ // The int64 value.
+ int64 value = 1;
+}
+
+// Wrapper message for `uint64`.
+//
+// The JSON representation for `UInt64Value` is JSON string.
+message UInt64Value {
+ // The uint64 value.
+ uint64 value = 1;
+}
+
+// Wrapper message for `int32`.
+//
+// The JSON representation for `Int32Value` is JSON number.
+message Int32Value {
+ // The int32 value.
+ int32 value = 1;
+}
+
+// Wrapper message for `uint32`.
+//
+// The JSON representation for `UInt32Value` is JSON number.
+message UInt32Value {
+ // The uint32 value.
+ uint32 value = 1;
+}
+
+// Wrapper message for `bool`.
+//
+// The JSON representation for `BoolValue` is JSON `true` and `false`.
+message BoolValue {
+ // The bool value.
+ bool value = 1;
+}
+
+// Wrapper message for `string`.
+//
+// The JSON representation for `StringValue` is JSON string.
+message StringValue {
+ // The string value.
+ string value = 1;
+}
+
+// Wrapper message for `bytes`.
+//
+// The JSON representation for `BytesValue` is JSON string.
+message BytesValue {
+ // The bytes value.
+ bytes value = 1;
+}
diff --git a/third_party/protobuf/3.6.0/src/libprotobuf-lite.map b/third_party/protobuf/3.4.0/src/libprotobuf-lite.map
index 3915546694..3915546694 100644
--- a/third_party/protobuf/3.6.0/src/libprotobuf-lite.map
+++ b/third_party/protobuf/3.4.0/src/libprotobuf-lite.map
diff --git a/third_party/protobuf/3.6.0/src/libprotobuf.map b/third_party/protobuf/3.4.0/src/libprotobuf.map
index 3915546694..3915546694 100644
--- a/third_party/protobuf/3.6.0/src/libprotobuf.map
+++ b/third_party/protobuf/3.4.0/src/libprotobuf.map
diff --git a/third_party/protobuf/3.6.0/src/libprotoc.map b/third_party/protobuf/3.4.0/src/libprotoc.map
index 3915546694..3915546694 100644
--- a/third_party/protobuf/3.6.0/src/libprotoc.map
+++ b/third_party/protobuf/3.4.0/src/libprotoc.map
diff --git a/third_party/protobuf/3.6.0/src/solaris/libstdc++.la b/third_party/protobuf/3.4.0/src/solaris/libstdc++.la
index 3edf425419..3edf425419 100644
--- a/third_party/protobuf/3.6.0/src/solaris/libstdc++.la
+++ b/third_party/protobuf/3.4.0/src/solaris/libstdc++.la
diff --git a/third_party/protobuf/3.6.0/tests.sh b/third_party/protobuf/3.4.0/tests.sh
index da6072813a..cfc08c35c0 100644..100755
--- a/third_party/protobuf/3.6.0/tests.sh
+++ b/third_party/protobuf/3.4.0/tests.sh
@@ -27,9 +27,6 @@ internal_build_cpp() {
export CXX="g++-4.8" CC="gcc-4.8"
fi
- # Initialize any submodules.
- git submodule update --init --recursive
-
./autogen.sh
./configure CXXFLAGS="-fPIC" # -fPIC is needed for python cpp test.
# See python/setup.py for more details
@@ -38,7 +35,7 @@ internal_build_cpp() {
build_cpp() {
internal_build_cpp
- make check -j2 || (cat src/test-suite.log; false)
+ make check -j2
cd conformance && make test_cpp && cd ..
# The benchmark code depends on cmake, so test if it is installed before
@@ -47,7 +44,10 @@ build_cpp() {
# appears to be missing it: https://github.com/travis-ci/travis-ci/issues/6996
if [[ $(type cmake 2>/dev/null) ]]; then
# Verify benchmarking code can build successfully.
- cd benchmarks && make cpp-benchmark && cd ..
+ git submodule init
+ git submodule update
+ cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make && cd ../..
+ cd benchmarks && make && ./generate-datasets && cd ..
else
echo ""
echo "WARNING: Skipping validation of the bench marking code, cmake isn't installed."
@@ -56,15 +56,14 @@ build_cpp() {
}
build_cpp_distcheck() {
- # Initialize any submodules.
- git submodule update --init --recursive
./autogen.sh
./configure
make dist
# List all files that should be included in the distribution package.
- git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake\|examples\|src/google/protobuf/.*\.proto\)" |\
+ git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake\|examples\)" |\
grep -v ".gitignore" | grep -v "java/compatibility_tests" |\
+ grep -v "cmake/protobuf.*\.pc\.cmake" |\
grep -v "python/compatibility_tests" | grep -v "csharp/compatibility_tests" > dist.lst
# Unzip the dist tar file.
DIST=`ls *.tar.gz`
@@ -89,7 +88,9 @@ build_cpp_distcheck() {
}
build_csharp() {
- # Required for conformance tests and to regenerate protos.
+ # 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.
internal_build_cpp
NUGET=/usr/local/bin/nuget.exe
@@ -104,10 +105,6 @@ 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 ..
@@ -132,7 +129,7 @@ build_golang() {
export PATH="$GOPATH/bin:$PATH"
go get github.com/golang/protobuf/protoc-gen-go
- cd examples && PROTO_PATH="-I../src -I." make gotest && cd ..
+ cd examples && make gotest && cd ..
}
use_java() {
@@ -228,8 +225,7 @@ internal_install_python_deps() {
fi
# Install tox (OS X doesn't have pip).
if [ $(uname -s) == "Darwin" ]; then
- brew upgrade python
- python3 -m pip install tox
+ sudo easy_install tox
else
sudo pip install tox
fi
@@ -238,10 +234,9 @@ internal_install_python_deps() {
sudo apt-get install -y python-software-properties # for apt-add-repository
sudo apt-add-repository -y ppa:fkrull/deadsnakes
sudo apt-get update -qq
+ sudo apt-get install -y python2.6 python2.6-dev
sudo apt-get install -y python3.3 python3.3-dev
sudo apt-get install -y python3.4 python3.4-dev
- sudo apt-get install -y python3.5 python3.5-dev
- sudo apt-get install -y python3.6 python3.6-dev
fi
}
@@ -283,7 +278,7 @@ build_python() {
cd python
# Only test Python 2.6/3.x on Linux
if [ $(uname -s) == "Linux" ]; then
- envlist=py\{27,33,34,35,36\}-python
+ envlist=py\{26,27,33,34\}-python
else
envlist=py27-python
fi
@@ -297,9 +292,10 @@ build_python_cpp() {
export LD_LIBRARY_PATH=../src/.libs # for Linux
export DYLD_LIBRARY_PATH=../src/.libs # for OS X
cd python
- # Only test Python 3.x on Linux
+ # Only test Python 2.6/3.x on Linux
if [ $(uname -s) == "Linux" ]; then
- envlist=py\{27,33,34,35,36\}-cpp
+ # py26 is currently disabled due to json_format
+ envlist=py\{27,33,34\}-cpp
else
envlist=py27-cpp
fi
@@ -351,26 +347,19 @@ generate_php_test_proto() {
# Generate test file
rm -rf generated
mkdir generated
- ../../src/protoc --php_out=generated \
- proto/empty/echo.proto \
- proto/test.proto \
- proto/test_include.proto \
- proto/test_no_namespace.proto \
- proto/test_prefix.proto \
- proto/test_php_namespace.proto \
- proto/test_empty_php_namespace.proto \
- proto/test_reserved_enum_lower.proto \
- proto/test_reserved_enum_upper.proto \
- proto/test_reserved_enum_value_lower.proto \
- proto/test_reserved_enum_value_upper.proto \
- proto/test_reserved_message_lower.proto \
- proto/test_reserved_message_upper.proto \
- proto/test_service.proto \
- proto/test_service_namespace.proto \
+ ../../src/protoc --php_out=generated \
+ proto/test.proto \
+ proto/test_include.proto \
+ proto/test_no_namespace.proto \
+ proto/test_prefix.proto \
+ proto/test_php_namespace.proto \
+ proto/test_empty_php_namespace.proto \
+ proto/test_service.proto \
+ proto/test_service_namespace.proto \
proto/test_descriptors.proto
pushd ../../src
- ./protoc --php_out=../php/tests/generated -I../php/tests -I. \
- ../php/tests/proto/test_import_descriptor_proto.proto
+ ./protoc --php_out=../php/tests/generated google/protobuf/empty.proto
+ ./protoc --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto
popd
popd
}
@@ -426,7 +415,7 @@ build_php5.5_c() {
use_php 5.5
wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
pushd php/tests
- /bin/bash ./test.sh 5.5
+ /bin/bash ./test.sh
popd
# TODO(teboring): Add it back
# pushd conformance
@@ -437,7 +426,7 @@ build_php5.5_c() {
build_php5.5_zts_c() {
use_php_zts 5.5
wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
- cd php/tests && /bin/bash ./test.sh 5.5-zts && cd ../..
+ cd php/tests && /bin/bash ./test.sh && cd ../..
# TODO(teboring): Add it back
# pushd conformance
# make test_php_zts_c
@@ -460,7 +449,7 @@ build_php5.6() {
build_php5.6_c() {
use_php 5.6
wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
- cd php/tests && /bin/bash ./test.sh 5.6 && cd ../..
+ cd php/tests && /bin/bash ./test.sh && cd ../..
# TODO(teboring): Add it back
# pushd conformance
# make test_php_c
@@ -470,7 +459,7 @@ build_php5.6_c() {
build_php5.6_zts_c() {
use_php_zts 5.6
wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
- cd php/tests && /bin/bash ./test.sh 5.6-zts && cd ../..
+ cd php/tests && /bin/bash ./test.sh && cd ../..
# TODO(teboring): Add it back
# pushd conformance
# make test_php_zts_c
@@ -518,7 +507,7 @@ build_php7.0() {
build_php7.0_c() {
use_php 7.0
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
- cd php/tests && /bin/bash ./test.sh 7.0 && cd ../..
+ cd php/tests && /bin/bash ./test.sh && cd ../..
# TODO(teboring): Add it back
# pushd conformance
# make test_php_c
@@ -528,7 +517,7 @@ build_php7.0_c() {
build_php7.0_zts_c() {
use_php_zts 7.0
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
- cd php/tests && /bin/bash ./test.sh 7.0-zts && cd ../..
+ cd php/tests && /bin/bash ./test.sh && cd ../..
# TODO(teboring): Add it back.
# pushd conformance
# make test_php_zts_c
@@ -582,7 +571,7 @@ build_php7.1() {
build_php7.1_c() {
use_php 7.1
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
- cd php/tests && /bin/bash ./test.sh 7.1 && cd ../..
+ cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
# make test_php_c
popd
@@ -591,7 +580,7 @@ build_php7.1_c() {
build_php7.1_zts_c() {
use_php_zts 7.1
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
- cd php/tests && /bin/bash ./test.sh 7.1-zts && cd ../..
+ cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
# make test_php_c
popd
diff --git a/third_party/protobuf/3.6.0/update_file_lists.sh b/third_party/protobuf/3.4.0/update_file_lists.sh
index 646c8ce344..6d4b5735f1 100644..100755
--- a/third_party/protobuf/3.6.0/update_file_lists.sh
+++ b/third_party/protobuf/3.4.0/update_file_lists.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# This script copies source file lists from src/Makefile.am to cmake files.
@@ -24,7 +24,7 @@ get_header_files() {
}
get_source_files() {
- get_variable_value $@ | grep "cc$\|inc$"
+ get_variable_value $@ | grep "cc$"
}
get_proto_files_blacklisted() {
@@ -36,7 +36,7 @@ get_proto_files() {
}
sort_files() {
- for FILE in $@; do
+ for FILE in "$@"; do
echo $FILE
done | LC_ALL=C sort | uniq
}
@@ -55,7 +55,6 @@ PUBLIC_HEADERS=$(sort_files $GZHEADERS $HEADERS)
LIBPROTOBUF_LITE_SOURCES=$(get_source_files $MAKEFILE libprotobuf_lite_la_SOURCES)
LIBPROTOBUF_SOURCES=$(get_source_files $MAKEFILE libprotobuf_la_SOURCES)
LIBPROTOC_SOURCES=$(get_source_files $MAKEFILE libprotoc_la_SOURCES)
-LIBPROTOC_HEADERS=$(get_header_files $MAKEFILE libprotoc_la_SOURCES)
LITE_PROTOS=$(get_proto_files $MAKEFILE protoc_lite_outputs)
PROTOS=$(get_proto_files $MAKEFILE protoc_outputs)
PROTOS_BLACKLISTED=$(get_proto_files_blacklisted $MAKEFILE protoc_outputs)
@@ -117,7 +116,6 @@ CMAKE_PREFIX="\${protobuf_source_dir}/src/"
set_cmake_value $CMAKE_DIR/libprotobuf-lite.cmake libprotobuf_lite_files $CMAKE_PREFIX $LIBPROTOBUF_LITE_SOURCES
set_cmake_value $CMAKE_DIR/libprotobuf.cmake libprotobuf_files $CMAKE_PREFIX $LIBPROTOBUF_SOURCES
set_cmake_value $CMAKE_DIR/libprotoc.cmake libprotoc_files $CMAKE_PREFIX $LIBPROTOC_SOURCES
-set_cmake_value $CMAKE_DIR/libprotoc.cmake libprotoc_headers $CMAKE_PREFIX $LIBPROTOC_HEADERS
set_cmake_value $CMAKE_DIR/tests.cmake lite_test_protos "" $LITE_PROTOS
set_cmake_value $CMAKE_DIR/tests.cmake tests_protos "" $PROTOS_BLACKLISTED
set_cmake_value $CMAKE_DIR/tests.cmake common_test_files $CMAKE_PREFIX $COMMON_TEST_SOURCES
@@ -128,15 +126,15 @@ set_cmake_value $CMAKE_DIR/tests.cmake lite_arena_test_files $CMAKE_PREFIX $LITE
# Generate extract_includes.bat
echo "mkdir include" > $EXTRACT_INCLUDES_BAT
-for INCLUDE in $PUBLIC_HEADERS $WKT_PROTOS; do
- INCLUDE_DIR=$(dirname "$INCLUDE")
- while [ ! "$INCLUDE_DIR" = "." ]; do
- echo "mkdir include\\${INCLUDE_DIR//\//\\}"
- INCLUDE_DIR=$(dirname "$INCLUDE_DIR")
+for HEADER in $PUBLIC_HEADERS; do
+ HEADER_DIR=$(dirname $HEADER)
+ while [ ! "$HEADER_DIR" = "." ]; do
+ echo $HEADER_DIR | sed "s/\\//\\\\/g"
+ HEADER_DIR=$(dirname $HEADER_DIR)
done
-done | sort | uniq >> $EXTRACT_INCLUDES_BAT
-for INCLUDE in $PUBLIC_HEADERS $WKT_PROTOS; do
- WINPATH=${INCLUDE//\//\\}
+done | sort | uniq | sed "s/^/mkdir include\\\\/" >> $EXTRACT_INCLUDES_BAT
+for HEADER in $PUBLIC_HEADERS; do
+ WINPATH=$(echo $HEADER | sed 's;/;\\;g')
echo "copy \"\${PROTOBUF_SOURCE_WIN32_PATH}\\..\\src\\$WINPATH\" include\\$WINPATH" >> $EXTRACT_INCLUDES_BAT
done
diff --git a/third_party/protobuf/3.6.0/util/python/BUILD b/third_party/protobuf/3.4.0/util/python/BUILD
index ea9fa641e2..ea9fa641e2 100644
--- a/third_party/protobuf/3.6.0/util/python/BUILD
+++ b/third_party/protobuf/3.4.0/util/python/BUILD
diff --git a/third_party/protobuf/3.6.0/.travis.yml b/third_party/protobuf/3.6.0/.travis.yml
deleted file mode 100644
index 74d4ea7beb..0000000000
--- a/third_party/protobuf/3.6.0/.travis.yml
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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
-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:
- include:
- # -----------------------------------------------------------------
- # macOS hosted tests for Objective-C
-
- - os: osx
- env: CONFIG=objectivec_osx
- osx_image: xcode9.3
- 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=objectivec_ios_debug
- osx_image: xcode9.3
- language: objective-c
- - os: osx
- env: CONFIG=objectivec_ios_release
- osx_image: xcode9.3
- language: objective-c
- - os: osx
- env: CONFIG=objectivec_cocoapods_integration
- osx_image: xcode9.3
- language: objective-c
-
- # -----------------------------------------------------------------
- # macOS hosted tests for other languages.
-
- - os: osx
- env: CONFIG=cpp
- - os: osx
- 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.
- - os: linux
- env: CONFIG=csharp
- language: csharp
- dist: trusty
- dotnet: 2.0.3
- mono: none
- # Install the .NET Core 1.0 runtime as that's what we test against
- addons:
- apt:
- sources:
- - sourceline: 'deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main'
- key_url: 'https://packages.microsoft.com/keys/microsoft.asc'
- packages:
- - dotnet-sharedframework-microsoft.netcore.app-1.0.5
- # This test is kept on travis because it doesn't play nicely with other
- # tests on jenkins running in parallel.
- - os: linux
- env: CONFIG=cpp_distcheck
- # The Java compatibility test currently only runs on Linux because it will
- # 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
- sudo: required
- dist: trusty
-
-notifications:
- email: false
diff --git a/third_party/protobuf/3.6.0/README.md b/third_party/protobuf/3.6.0/README.md
deleted file mode 100644
index 1a45ee60ec..0000000000
--- a/third_party/protobuf/3.6.0/README.md
+++ /dev/null
@@ -1,85 +0,0 @@
-Protocol Buffers - Google's data interchange format
-===================================================
-
-Copyright 2008 Google Inc.
-
-https://developers.google.com/protocol-buffers/
-
-Overview
---------
-
-Protocol Buffers (a.k.a., protobuf) are Google's language-neutral,
-platform-neutral, extensible mechanism for serializing structured data. You
-can find [protobuf's documentation on the Google Developers site](https://developers.google.com/protocol-buffers/).
-
-This README file contains protobuf installation instructions. To install
-protobuf, you need to install the protocol compiler (used to compile .proto
-files) and the protobuf runtime for your chosen programming language.
-
-Protocol Compiler Installation
-------------------------------
-
-The protocol compiler is written in C++. If you are using C++, please follow
-the [C++ Installation Instructions](src/README.md) to install protoc along
-with the C++ runtime.
-
-For non-C++ users, the simplest way to install the protocol compiler is to
-download a pre-built binary from our release page:
-
- [https://github.com/google/protobuf/releases](https://github.com/google/protobuf/releases)
-
-In the downloads section of each release, you can find pre-built binaries in
-zip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binary
-as well as a set of standard .proto files distributed along with protobuf.
-
-If you are looking for an old version that is not available in the release
-page, check out the maven repo here:
-
- [https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/)
-
-These pre-built binaries are only provided for released versions. If you want
-to use the github master version at HEAD, or you need to modify protobuf code,
-or you are using C++, it's recommended to build your own protoc binary from
-source.
-
-If you would like to build protoc binary from source, see the [C++ Installation
-Instructions](src/README.md).
-
-Protobuf Runtime Installation
------------------------------
-
-Protobuf supports several different programming languages. For each programming
-language, you can find instructions in the corresponding source directory about
-how to install protobuf runtime for that specific language:
-
-| Language | Source | Ubuntu | MacOS | Windows |
-|--------------------------------------|-------------------------------------------------------------|--------|-------|---------|
-| C++ (include C++ runtime and protoc) | [src](src) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fcpp_distcheck%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp_distcheck%2Fcontinuous) | [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) |
-| Java | [java](java) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_compatibility.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_compatibility%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_jdk7.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_jdk7%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_oracle7.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_oracle7%2Fcontinuous) | | |
-| Python | [python](python) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python_compatibility.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython_compatibility%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython_cpp%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython_cpp%2Fcontinuous) | |
-| Objective-C | [objectivec](objectivec) | | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_cocoapods_integration.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_cocoapods_integration%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_ios_debug.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_ios_debug%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_ios_release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_ios_release%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_osx.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_osx%2Fcontinuous) | |
-| C# | [csharp](csharp) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-csharp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fcsharp%2Fcontinuous) | | [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) |
-| JavaScript | [js](js) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-javascript.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjavascript%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-javascript.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fjavascript%2Fcontinuous) | |
-| Ruby | [ruby](ruby) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby_all.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby_all%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby21.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby21%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby22.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby22%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-jruby.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fjruby%2Fcontinuous) | |
-| Go | [golang/protobuf](https://github.com/golang/protobuf) | | | |
-| PHP | [php](php) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-php_all.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fphp_all%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-32-bit.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2F32-bit%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-php5.6_mac.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fphp5.6_mac%2Fcontinuous)<br/>[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-php7.0_mac.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fphp7.0_mac%2Fcontinuous) | |
-| Dart | [dart-lang/protobuf](https://github.com/dart-lang/protobuf) | | | |
-
-Quick Start
------------
-
-The best way to learn how to use protobuf is to follow the tutorials in our
-developer guide:
-
-https://developers.google.com/protocol-buffers/docs/tutorials
-
-If you want to learn from code examples, take a look at the examples in the
-[examples](examples) directory.
-
-Documentation
--------------
-
-The complete documentation for Protocol Buffers is available via the
-web at:
-
-https://developers.google.com/protocol-buffers/
diff --git a/third_party/protobuf/3.6.0/benchmarks/Makefile.am b/third_party/protobuf/3.6.0/benchmarks/Makefile.am
deleted file mode 100644
index 564fdab3c7..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/Makefile.am
+++ /dev/null
@@ -1,518 +0,0 @@
-benchmarks_protoc_inputs_benchmark_wrapper = \
- benchmarks.proto
-
-benchmarks_protoc_inputs = \
- datasets/google_message1/proto3/benchmark_message1_proto3.proto
-
-benchmarks_protoc_inputs_proto2 = \
- datasets/google_message1/proto2/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/java/src/main/java'
- touch make_tmp_dir
-
-# 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: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper)
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd/cpp --java_out=$$oldpwd/tmp/java/src/main/java --python_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) )
- 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/cpp --java_out=$$oldpwd/tmp/java/src/main/java --python_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2) )
- touch protoc_middleman2
-
-all_data = $$(find $(srcdir) -type f -name "dataset.*.pb" -not -path "./tmp/*")
-
-############# CPP RULES ##############
-
-benchmarks_protoc_outputs = \
- cpp/benchmarks.pb.cc \
- cpp/datasets/google_message1/proto3/benchmark_message1_proto3.pb.cc
-
-benchmarks_protoc_outputs_header = \
- cpp/benchmarks.pb.h \
- cpp/datasets/google_message1/proto3/benchmark_message1_proto3.pb.h
-
-benchmarks_protoc_outputs_proto2_header = \
- cpp/datasets/google_message1/proto2/benchmark_message1_proto2.pb.h \
- cpp/datasets/google_message2/benchmark_message2.pb.h \
- cpp/datasets/google_message3/benchmark_message3.pb.h \
- cpp/datasets/google_message3/benchmark_message3_1.pb.h \
- cpp/datasets/google_message3/benchmark_message3_2.pb.h \
- cpp/datasets/google_message3/benchmark_message3_3.pb.h \
- cpp/datasets/google_message3/benchmark_message3_4.pb.h \
- cpp/datasets/google_message3/benchmark_message3_5.pb.h \
- cpp/datasets/google_message3/benchmark_message3_6.pb.h \
- cpp/datasets/google_message3/benchmark_message3_7.pb.h \
- cpp/datasets/google_message3/benchmark_message3_8.pb.h \
- cpp/datasets/google_message4/benchmark_message4.pb.h \
- cpp/datasets/google_message4/benchmark_message4_1.pb.h \
- cpp/datasets/google_message4/benchmark_message4_2.pb.h \
- cpp/datasets/google_message4/benchmark_message4_3.pb.h
-
-benchmarks_protoc_outputs_proto2 = \
- cpp/datasets/google_message1/proto2/benchmark_message1_proto2.pb.cc \
- cpp/datasets/google_message2/benchmark_message2.pb.cc \
- cpp/datasets/google_message3/benchmark_message3.pb.cc \
- cpp/datasets/google_message3/benchmark_message3_1.pb.cc \
- cpp/datasets/google_message3/benchmark_message3_2.pb.cc \
- cpp/datasets/google_message3/benchmark_message3_3.pb.cc \
- cpp/datasets/google_message3/benchmark_message3_4.pb.cc \
- cpp/datasets/google_message3/benchmark_message3_5.pb.cc \
- cpp/datasets/google_message3/benchmark_message3_6.pb.cc \
- cpp/datasets/google_message3/benchmark_message3_7.pb.cc \
- cpp/datasets/google_message3/benchmark_message3_8.pb.cc \
- cpp/datasets/google_message4/benchmark_message4.pb.cc \
- cpp/datasets/google_message4/benchmark_message4_1.pb.cc \
- cpp/datasets/google_message4/benchmark_message4_2.pb.cc \
- cpp/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
-
-initialize_submodule:
- oldpwd=`pwd`
- cd $(top_srcdir)/third_party
- git submodule update --init -r
- cd $(top_srcdir)/third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make
- cd $$oldpwd
- touch initialize_submodule
-
-$(top_srcdir)/third_party/benchmark/src/libbenchmark.a: initialize_submodule
-
-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/cpp_benchmark.cc
-cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -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/cpp_benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
-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 initialize_submodule
- ./cpp-benchmark $(all_data)
-
-############ CPP RULES END ############
-
-############# JAVA RULES ##############
-
-java_benchmark_testing_files = \
- java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java
-
-javac_middleman: $(java_benchmark_testing_files) protoc_middleman protoc_middleman2
- cp -r $(srcdir)/java tmp && cd tmp/java && mvn clean compile assembly:single
- cd ../..
- @touch javac_middleman
-
-java-benchmark: javac_middleman
- @echo "Writing shortcut script java-benchmark..."
- @echo '#! /bin/bash' > java-benchmark
- @echo 'all_data=""' >> java-benchmark
- @echo 'conf=()' >> java-benchmark
- @echo 'data_files=""' >> java-benchmark
- @echo 'for arg in $$@; do if [[ $${arg:0:1} == "-" ]]; then conf+=($$arg); else data_files+="$$arg,"; fi; done' >> java-benchmark
- @echo 'java -cp '"tmp/java/target/*.jar"' com.google.caliper.runner.CaliperMain com.google.protobuf.ProtoCaliperBenchmark -i runtime '"\\" >> java-benchmark
- @echo '-b serializeToByteString,serializeToByteArray,serializeToMemoryStream,'"\\" >> java-benchmark
- @echo 'deserializeFromByteString,deserializeFromByteArray,deserializeFromMemoryStream '"\\" >> java-benchmark
- @echo '-DdataFile=$${data_files:0:-1} $${conf[*]}' >> java-benchmark
- @chmod +x java-benchmark
-
-java: protoc_middleman protoc_middleman2 java-benchmark
- ./java-benchmark $(all_data)
-
-############# JAVA RULES END ##############
-
-
-############# PYTHON RULES ##############
-
-python_add_init: protoc_middleman protoc_middleman2
- all_file=`find tmp -type f -regex '.*\.py'` && \
- for file in $${all_file[@]}; do \
- path="$${file%/*}"; \
- while true; do \
- touch "$$path/__init__.py" && chmod +x "$$path/__init__.py"; \
- if [[ $$path != *"/"* ]]; then break; fi; \
- path=$${path%/*}; \
- done \
- done
-
-python_cpp_pkg_flags = `pkg-config --cflags --libs python`
-
-lib_LTLIBRARIES = libbenchmark_messages.la
-libbenchmark_messages_la_SOURCES = python/python_benchmark_messages.cc
-libbenchmark_messages_la_LIBADD = $(top_srcdir)/src/.libs/libprotobuf.la
-libbenchmark_messages_la_LDFLAGS = -version-info 1:0:0 -export-dynamic
-libbenchmark_messages_la_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp $(python_cpp_pkg_flags)
-libbenchmark_messages_la-python_benchmark_messages.$(OBJEXT): $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2)
-nodist_libbenchmark_messages_la_SOURCES = \
- $(benchmarks_protoc_outputs) \
- $(benchmarks_protoc_outputs_proto2) \
- $(benchmarks_protoc_outputs_proto2_header) \
- $(benchmarks_protoc_outputs_header)
-
-python-pure-python-benchmark: python_add_init
- @echo "Writing shortcut script python-pure-python-benchmark..."
- @echo '#! /bin/bash' > python-pure-python-benchmark
- @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-pure-python-benchmark
- @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-pure-python-benchmark
- @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'python\' >> python-pure-python-benchmark
- @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-pure-python-benchmark
- @echo python tmp/py_benchmark.py '$$@' >> python-pure-python-benchmark
- @chmod +x python-pure-python-benchmark
-
-python-cpp-reflection-benchmark: python_add_init
- @echo "Writing shortcut script python-cpp-reflection-benchmark..."
- @echo '#! /bin/bash' > python-cpp-reflection-benchmark
- @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-cpp-reflection-benchmark
- @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-cpp-reflection-benchmark
- @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-reflection-benchmark
- @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-reflection-benchmark
- @echo python tmp/py_benchmark.py '$$@' >> python-cpp-reflection-benchmark
- @chmod +x python-cpp-reflection-benchmark
-
-python-cpp-generated-code-benchmark: python_add_init libbenchmark_messages.la
- @echo "Writing shortcut script python-cpp-generated-code-benchmark..."
- @echo '#! /bin/bash' > python-cpp-generated-code-benchmark
- @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-cpp-generated-code-benchmark
- @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-cpp-generated-code-benchmark
- @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-generated-code-benchmark
- @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-generated-code-benchmark
- @echo python tmp/py_benchmark.py --cpp_generated '$$@' >> python-cpp-generated-code-benchmark
- @chmod +x python-cpp-generated-code-benchmark
-
-python-pure-python: python-pure-python-benchmark
- ./python-pure-python-benchmark $(all_data)
-
-python-cpp-reflection: python-cpp-reflection-benchmark
- ./python-cpp-reflection-benchmark $(all_data)
-
-python-cpp-generated-code: python-cpp-generated-code-benchmark
- ./python-cpp-generated-code-benchmark $(all_data)
-
-############# PYTHON RULES END ##############
-
-############# GO RULES BEGIN ##############
-
-benchmarks_protoc_inputs_proto2_message1 = \
- datasets/google_message1/proto2/benchmark_message1_proto2.proto
-
-benchmarks_protoc_inputs_proto2_message2 = \
- datasets/google_message2/benchmark_message2.proto
-
-benchmarks_protoc_inputs_proto2_message3 = \
- 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
-
-benchmarks_protoc_inputs_proto2_message4 = \
- 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
-
-go_protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) $(benchmarks_protoc_inputs_proto2_message1) $(benchmarks_protoc_inputs_proto2_message2) $(benchmarks_protoc_inputs_proto2_message3) $(benchmarks_protoc_inputs_proto2_message4) $(well_known_type_protoc_inputs)
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) )
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_benchmark_wrapper) )
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message1) )
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message2) )
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message3) )
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message4) )
- touch go_protoc_middleman
-
-go-benchmark: go_protoc_middleman
- @echo "Writing shortcut script go-benchmark..."
- @echo '#! /bin/bash' > go-benchmark
- @echo 'cd $(srcdir)/go' >> go-benchmark
- @echo 'all_data=""' >> go-benchmark
- @echo 'conf=()' >> go-benchmark
- @echo 'data_files=()' >> go-benchmark
- @echo 'for arg in $$@; do if [[ $${arg:0:1} == "-" ]]; then conf+=($$arg); else data_files+=("../$$arg"); fi; done' >> go-benchmark
- @echo 'go test -bench=. $${conf[*]} -- $${data_files[*]}' >> go-benchmark
- @echo 'cd ..' >> go-benchmark
- @chmod +x go-benchmark
-
-go: go_protoc_middleman go-benchmark
- ./go-benchmark $(all_data)
-
-############# GO RULES END ##############
-
-############# GOGO RULES BEGIN ############
-
-cpp_no_group_benchmarks_protoc_outputs_header = \
- gogo/cpp_no_group/benchmarks.pb.h \
- gogo/cpp_no_group/datasets/google_message1/proto3/benchmark_message1_proto3.pb.h
-
-cpp_no_group_benchmarks_protoc_outputs = \
- gogo/cpp_no_group/benchmarks.pb.cc \
- gogo/cpp_no_group/datasets/google_message1/proto3/benchmark_message1_proto3.pb.cc
-
-cpp_no_group_benchmarks_protoc_outputs_proto2_header = \
- gogo/cpp_no_group/datasets/google_message1/proto2/benchmark_message1_proto2.pb.h \
- gogo/cpp_no_group/datasets/google_message2/benchmark_message2.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_1.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_2.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_3.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_4.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_5.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_6.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_7.pb.h \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_8.pb.h \
- gogo/cpp_no_group/datasets/google_message4/benchmark_message4.pb.h \
- gogo/cpp_no_group/datasets/google_message4/benchmark_message4_1.pb.h \
- gogo/cpp_no_group/datasets/google_message4/benchmark_message4_2.pb.h \
- gogo/cpp_no_group/datasets/google_message4/benchmark_message4_3.pb.h
-
-cpp_no_group_benchmarks_protoc_outputs_proto2 = \
- gogo/cpp_no_group/datasets/google_message1/proto2/benchmark_message1_proto2.pb.cc \
- gogo/cpp_no_group/datasets/google_message2/benchmark_message2.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_1.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_2.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_3.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_4.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_5.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_6.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_7.pb.cc \
- gogo/cpp_no_group/datasets/google_message3/benchmark_message3_8.pb.cc \
- gogo/cpp_no_group/datasets/google_message4/benchmark_message4.pb.cc \
- gogo/cpp_no_group/datasets/google_message4/benchmark_message4_1.pb.cc \
- gogo/cpp_no_group/datasets/google_message4/benchmark_message4_2.pb.cc \
- gogo/cpp_no_group/datasets/google_message4/benchmark_message4_3.pb.cc
-
-$(cpp_no_group_benchmarks_protoc_outputs): cpp_no_group_protoc_middleman
-$(cpp_no_group_benchmarks_protoc_outputs_header): cpp_no_group_protoc_middleman
-$(cpp_no_group_benchmarks_protoc_outputs_proto2): cpp_no_group_protoc_middleman
-$(cpp_no_group_benchmarks_protoc_outputs_proto2_header): cpp_no_group_protoc_middleman
-
-generate_cpp_no_group_benchmark_code:
- cp $(srcdir)/cpp/cpp_benchmark.cc gogo/cpp_no_group/cpp_benchmark.cc
- sed -i -e "s/\#include \"datasets/\#include \"gogo\/cpp_no_group\/datasets/g" gogo/cpp_no_group/cpp_benchmark.cc
- sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc
- touch generate_cpp_no_group_benchmark_code
-
-bin_PROGRAMS += cpp-no-group-benchmark
-cpp_no_group_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
-cpp_no_group_benchmark_SOURCES = gogo/cpp_no_group/cpp_benchmark.cc
-cpp_no_group_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/gogo/cpp_no_group -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
-gogo/cpp_no_group/cpp_no_group_benchmark-cpp_benchmark.$(OBJEXT): $(cpp_no_group_benchmarks_protoc_outputs) $(cpp_no_group_benchmarks_protoc_outputs_proto2) $(cpp_no_group_benchmarks_protoc_outputs_header) \
- $(cpp_no_group_benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/third_party/benchmark/src/libbenchmark.a generate_cpp_no_group_benchmark_code
-gogo/cpp_no_group/cpp_benchmark.cc: generate_cpp_no_group_benchmark_code
-nodist_cpp_no_group_benchmark_SOURCES = \
- $(cpp_no_group_benchmarks_protoc_outputs_proto2) \
- $(cpp_no_group_benchmarks_protoc_outputs) \
- $(cpp_no_group_benchmarks_protoc_outputs_header) \
- $(cpp_no_group_benchmarks_protoc_outputs_proto2_header)
-
-cpp_no_group: cpp_no_group_protoc_middleman generate_gogo_data cpp-no-group-benchmark
- ./cpp-no-group-benchmark $(gogo_data)
-
-gogo_proto_middleman: protoc-gen-gogoproto
- mkdir -p "tmp/gogo_proto"
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-gogoproto --gogoproto_out=$$oldpwd/tmp/gogo_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) )
- touch gogo_proto_middleman
-
-new_data = $$(for data in $(all_data); do echo "tmp$${data\#$(srcdir)}"; done | xargs)
-
-generate_gogo_data: protoc_middleman protoc_middleman2 gogo-data-scrubber
- mkdir -p `dirname $(new_data)`
- ./gogo-data-scrubber $(all_data) $(new_data)
- touch generate_gogo_data
-
-make_tmp_dir_gogo:
- mkdir -p tmp/go_no_group/benchmark_code
- mkdir -p tmp/gogofast/benchmark_code
- mkdir -p tmp/gogofaster/benchmark_code
- mkdir -p tmp/gogoslick/benchmark_code
- touch make_tmp_dir_gogo
-
-go_no_group_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_benchmark_wrapper) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message1) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message2) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message3) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message4) )
- touch go_no_group_protoc_middleman
-
-cpp_no_group_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_benchmark_wrapper) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message1) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message2) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message3) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message4) )
- touch cpp_no_group_protoc_middleman
-
-gogofast_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_benchmark_wrapper) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message1) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message2) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message3) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message4) )
- touch gogofast_protoc_middleman
-
-gogofaster_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_benchmark_wrapper) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message1) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message2) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message3) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message4) )
- touch gogofaster_protoc_middleman
-
-gogoslick_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_benchmark_wrapper) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message1) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message2) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message3) )
- oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message4) )
- touch gogoslick_protoc_middleman
-
-gogo_data = $$(find . -type f -name "dataset.*.pb" -path "./tmp/*")
-
-generate-gogo-benchmark-code:
- @echo '#! /bin/bash' > generate-gogo-benchmark-code
- @echo 'cp $(srcdir)/go/go_benchmark_test.go tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code
- @echo 'sed -i -e "s/\.\.\/tmp/../g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code
- @echo 'sed -i -e "s/b\.Run(\"\(.*\)\"/b.Run(\"\1\_$$1\"/g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code
- @echo 'if [[ $$2 == 1 ]]; then sed -i -e "s/github\.com\/golang/github.com\/gogo/g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go; fi ' >> generate-gogo-benchmark-code
- @chmod +x generate-gogo-benchmark-code
-
-generate_all_gogo_benchmark_code: generate-gogo-benchmark-code make_tmp_dir_gogo
- ./generate-gogo-benchmark-code go_no_group 0
- ./generate-gogo-benchmark-code gogofast 1
- ./generate-gogo-benchmark-code gogofaster 1
- ./generate-gogo-benchmark-code gogoslick 1
-
-gogo-benchmark:
- @echo "Writing shortcut script gogo-benchmark..."
- @echo '#! /bin/bash' > gogo-benchmark
- @echo 'cd tmp/$$1/benchmark_code' >> gogo-benchmark
- @echo 'shift' >> gogo-benchmark
- @echo 'all_data=""' >> gogo-benchmark
- @echo 'for data_file in $$@; do all_data="$$all_data ../../../$$data_file"; done' >> gogo-benchmark
- @echo 'go test -bench=. -- $$all_data' >> gogo-benchmark
- @echo 'cd ../..' >> gogo-benchmark
- @chmod +x gogo-benchmark
-
-go_no_group: go_no_group_protoc_middleman generate_gogo_data generate_all_gogo_benchmark_code gogo-benchmark
- ./gogo-benchmark go_no_group $(gogo_data)
-
-gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
- ./gogo-benchmark gogofast $(gogo_data)
-
-gogofaster: gogofaster_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
- ./gogo-benchmark gogofaster $(gogo_data)
-
-gogoslick: gogoslick_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
- ./gogo-benchmark gogoslick $(gogo_data)
-
-
-############# GOGO RULES END ############
-
-
-############ UTIL RULES BEGIN ############
-
-bin_PROGRAMS += protoc-gen-gogoproto gogo-data-scrubber
-
-protoc_gen_gogoproto_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/src/libprotoc.la
-protoc_gen_gogoproto_SOURCES = util/protoc-gen-gogoproto.cc
-protoc_gen_gogoproto_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util
-
-gogo_data_scrubber_LDADD = $(top_srcdir)/src/libprotobuf.la
-gogo_data_scrubber_SOURCES = util/gogo_data_scrubber.cc
-gogo_data_scrubber_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util
-util/gogo_data_scrubber-gogo_data_scrubber.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header)
-nodist_gogo_data_scrubber_SOURCES = \
- $(benchmarks_protoc_outputs) \
- $(benchmarks_protoc_outputs_proto2) \
- $(benchmarks_protoc_outputs_proto2_header) \
- $(benchmarks_protoc_outputs_header)
-
-############ UTIL RULES END ############
-
-MAINTAINERCLEANFILES = \
- Makefile.in
-
-CLEANFILES = \
- $(benchmarks_protoc_outputs) \
- $(benchmarks_protoc_outputs_header) \
- $(benchmarks_protoc_outputs_proto2) \
- $(benchmarks_protoc_outputs_proto2_header) \
- initialize_submodule \
- make_tmp_dir \
- protoc_middleman \
- protoc_middleman2 \
- javac_middleman \
- java-benchmark \
- python_cpp_proto_library \
- python-pure-python-benchmark \
- python-cpp-reflection-benchmark \
- python-cpp-generated-code-benchmark \
- go-benchmark \
- go_protoc_middleman \
- make_tmp_dir_gogo \
- gogo_proto_middleman \
- generate_gogo_data \
- go_no_group_protoc_middleman \
- go_no_group \
- go-no-group-benchmark \
- $(cpp_no_group_benchmarks_protoc_outputs_header) \
- $(cpp_no_group_benchmarks_protoc_outputs) \
- $(cpp_no_group_benchmarks_protoc_outputs_proto2_header) \
- $(cpp_no_group_benchmarks_protoc_outputs_proto2) \
- generate_all_gogo_benchmark_code \
- generate-gogo-benchmark-code \
- cpp_no_group_protoc_middleman \
- generate_cpp_no_group_benchmark_code \
- generate_gogo_benchmark_code \
- gogofast_protoc_middleman \
- gogofast \
- gogofaster_protoc_middleman \
- gogofaster \
- gogoslick_protoc_middleman \
- gogoslick \
- gogo-benchmark \
- gogo/cpp_no_group/cpp_benchmark.*
-
-
-clean-local:
- -rm -rf tmp/*
diff --git a/third_party/protobuf/3.6.0/benchmarks/README.md b/third_party/protobuf/3.6.0/benchmarks/README.md
deleted file mode 100644
index 21cd7352ff..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/README.md
+++ /dev/null
@@ -1,187 +0,0 @@
-
-# Protocol Buffers Benchmarks
-
-This directory contains benchmarking schemas and data sets that you
-can use to test a variety of performance scenarios against your
-protobuf language runtime. If you are looking for performance
-numbers of officially support languages, see [here](
-https://github.com/google/protobuf/blob/master/docs/Performance.md)
-
-## Prerequisite
-
-First, you need to follow the instruction in the root directory's README to
-build your language's protobuf, then:
-
-### CPP
-You need to install [cmake](https://cmake.org/) before building the benchmark.
-
-We are using [google/benchmark](https://github.com/google/benchmark) as the
-benchmark tool for testing cpp. This will be automaticly made during build the
-cpp benchmark.
-
-The cpp protobuf performance can be improved by linking with [tcmalloc library](
-https://gperftools.github.io/gperftools/tcmalloc.html). For using tcmalloc, you
-need to build [gpertools](https://github.com/gperftools/gperftools) to generate
-libtcmallc.so library.
-
-### Java
-We're using maven to build the java benchmarks, which is the same as to build
-the Java protobuf. There're no other tools need to install. We're using
-[google/caliper](https://github.com/google/caliper) as benchmark tool, which
-can be automaticly included by maven.
-
-### Python
-We're using python C++ API for testing the generated
-CPP proto version of python protobuf, which is also a prerequisite for Python
-protobuf cpp implementation. You need to install the correct version of Python
-C++ extension package before run generated CPP proto version of Python
-protobuf's benchmark. e.g. under Ubuntu, you need to
-
-```
-$ sudo apt-get install python-dev
-$ sudo apt-get install python3-dev
-```
-And you also need to make sure `pkg-config` is installed.
-
-### Go
-Go protobufs are maintained at [github.com/golang/protobuf](
-http://github.com/golang/protobuf). If not done already, you need to install the
-toolchain and the Go protoc-gen-go plugin for protoc.
-
-To install protoc-gen-go, run:
-
-```
-$ go get -u github.com/golang/protobuf/protoc-gen-go
-$ export PATH=$PATH:$(go env GOPATH)/bin
-```
-
-The first command installs `protoc-gen-go` into the `bin` directory in your local `GOPATH`.
-The second command adds the `bin` directory to your `PATH` so that `protoc` can locate the plugin later.
-
-### Big data
-
-There's some optional big testing data which is not included in the directory
-initially, you need to run the following command to download the testing data:
-
-```
-$ ./download_data.sh
-```
-
-After doing this the big data file will automaticly generated in the
-benchmark directory.
-
-## Run instructions
-
-To run all the benchmark dataset:
-
-### Java:
-
-```
-$ make java
-```
-
-### CPP:
-
-```
-$ make cpp
-```
-
-For linking with tcmalloc:
-
-```
-$ env LD_PRELOAD={directory to libtcmalloc.so} make cpp
-```
-
-### Python:
-
-We have three versions of python protobuf implementation: pure python, cpp
-reflection and cpp generated code. To run these version benchmark, you need to:
-
-#### Pure Python:
-
-```
-$ make python-pure-python
-```
-
-#### CPP reflection:
-
-```
-$ make python-cpp-reflection
-```
-
-#### CPP generated code:
-
-```
-$ make python-cpp-generated-code
-```
-
-### Go
-```
-$ make go
-```
-
-To run a specific dataset or run with specific options:
-
-### Java:
-
-```
-$ make java-benchmark
-$ ./java-benchmark $(specific generated dataset file name) [$(caliper options)]
-```
-
-### CPP:
-
-```
-$ make cpp-benchmark
-$ ./cpp-benchmark $(specific generated dataset file name) [$(benchmark options)]
-```
-
-### Python:
-
-For Python benchmark we have `--json` for outputing the json result
-
-#### Pure Python:
-
-```
-$ make python-pure-python-benchmark
-$ ./python-pure-python-benchmark [--json] $(specific generated dataset file name)
-```
-
-#### CPP reflection:
-
-```
-$ make python-cpp-reflection-benchmark
-$ ./python-cpp-reflection-benchmark [--json] $(specific generated dataset file name)
-```
-
-#### CPP generated code:
-
-```
-$ make python-cpp-generated-code-benchmark
-$ ./python-cpp-generated-code-benchmark [--json] $(specific generated dataset file name)
-```
-
-### Go:
-```
-$ make go-benchmark
-$ ./go-benchmark $(specific generated dataset file name) [go testing options]
-```
-
-
-## Benchmark datasets
-
-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.
-
-The schema for the datasets is described in `benchmarks.proto`.
-
-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
-that make the overall suite diverse without being too large or having
-too many similar tests. Ideally everyone can run through the entire
-suite without the test run getting too long.
diff --git a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto
deleted file mode 100644
index 21261905da..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto
+++ /dev/null
@@ -1,78 +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;
-}
diff --git a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pb b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pb
deleted file mode 100644
index 4955bed31b..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pb
+++ /dev/null
Binary files differ
diff --git a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message2/benchmark_message2.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message2/benchmark_message2.proto
deleted file mode 100644
index 820630e44d..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message2/benchmark_message2.proto
+++ /dev/null
@@ -1,76 +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 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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3.proto
deleted file mode 100644
index d6f0d14e1b..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3.proto
+++ /dev/null
@@ -1,534 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_1.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_1.proto
deleted file mode 100644
index 3219553cc5..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_1.proto
+++ /dev/null
@@ -1,1280 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_2.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_2.proto
deleted file mode 100644
index 7ab993ba55..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_2.proto
+++ /dev/null
@@ -1,499 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_3.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_3.proto
deleted file mode 100644
index e71d266136..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_3.proto
+++ /dev/null
@@ -1,466 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_4.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_4.proto
deleted file mode 100644
index 597cec6d11..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_4.proto
+++ /dev/null
@@ -1,491 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_5.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_5.proto
deleted file mode 100644
index bc6cbc1c81..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_5.proto
+++ /dev/null
@@ -1,473 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_6.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_6.proto
deleted file mode 100644
index 98e1529e24..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_6.proto
+++ /dev/null
@@ -1,454 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_7.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_7.proto
deleted file mode 100644
index 2497db5e29..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_7.proto
+++ /dev/null
@@ -1,56 +0,0 @@
-syntax = "proto2";
-
-package benchmarks.google_message3;
-
-option cc_enable_arenas = true;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_8.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_8.proto
deleted file mode 100644
index 1d2b147230..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message3/benchmark_message3_8.proto
+++ /dev/null
@@ -1,1900 +0,0 @@
-syntax = "proto2";
-
-package benchmarks.google_message3;
-
-option cc_enable_arenas = true;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4.proto
deleted file mode 100644
index 2161393918..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4.proto
+++ /dev/null
@@ -1,454 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_1.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_1.proto
deleted file mode 100644
index e769748052..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_1.proto
+++ /dev/null
@@ -1,474 +0,0 @@
-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;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_2.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_2.proto
deleted file mode 100644
index d5e9da5aa9..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_2.proto
+++ /dev/null
@@ -1,292 +0,0 @@
-syntax = "proto2";
-
-import "datasets/google_message4/benchmark_message4_3.proto";
-package benchmarks.google_message4;
-
-option cc_enable_arenas = true;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_3.proto b/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_3.proto
deleted file mode 100644
index 544fad202a..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/datasets/google_message4/benchmark_message4_3.proto
+++ /dev/null
@@ -1,751 +0,0 @@
-syntax = "proto2";
-
-package benchmarks.google_message4;
-
-option cc_enable_arenas = true;
-option java_package = "com.google.protobuf.benchmarks";
-
-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/third_party/protobuf/3.6.0/benchmarks/download_data.sh b/third_party/protobuf/3.6.0/benchmarks/download_data.sh
deleted file mode 100644
index fa0729e9a3..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/download_data.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/sh
-
-curl -O https://storage.googleapis.com/protobuf_opensource_benchmark_data/datasets.tar.gz
-tar -zvxf datasets.tar.gz
-
diff --git a/third_party/protobuf/3.6.0/benchmarks/go/go_benchmark_test.go b/third_party/protobuf/3.6.0/benchmarks/go/go_benchmark_test.go
deleted file mode 100644
index 8c741b7106..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/go/go_benchmark_test.go
+++ /dev/null
@@ -1,124 +0,0 @@
-package main
-
-import (
- benchmarkWrapper "../tmp"
- googleMessage1Proto2 "../tmp/datasets/google_message1/proto2"
- googleMessage1Proto3 "../tmp/datasets/google_message1/proto3"
- googleMessage2 "../tmp/datasets/google_message2"
- googleMessage3 "../tmp/datasets/google_message3"
- googleMessage4 "../tmp/datasets/google_message4"
- "flag"
- "github.com/golang/protobuf/proto"
- "io/ioutil"
- "testing"
-)
-
-// Data is returned by the Load function.
-type Dataset struct {
- name string
- newMessage func() proto.Message
- marshaled [][]byte
- unmarshaled []proto.Message
-}
-
-var datasets []Dataset
-
-// This is used to getDefaultInstance for a message type.
-func generateNewMessageFunction(dataset benchmarkWrapper.BenchmarkDataset) func() proto.Message {
- switch dataset.MessageName {
- case "benchmarks.proto3.GoogleMessage1":
- return func() proto.Message { return new(googleMessage1Proto3.GoogleMessage1) }
- case "benchmarks.proto2.GoogleMessage1":
- return func() proto.Message { return new(googleMessage1Proto2.GoogleMessage1) }
- case "benchmarks.proto2.GoogleMessage2":
- return func() proto.Message { return new(googleMessage2.GoogleMessage2) }
- case "benchmarks.google_message3.GoogleMessage3":
- return func() proto.Message { return new(googleMessage3.GoogleMessage3) }
- case "benchmarks.google_message4.GoogleMessage4":
- return func() proto.Message { return new(googleMessage4.GoogleMessage4) }
- default:
- panic("Unknown message type: " + dataset.MessageName)
- }
-}
-
-func init() {
- flag.Parse()
- for _, f := range flag.Args() {
- // Load the benchmark.
- b, err := ioutil.ReadFile(f)
- if err != nil {
- panic(err)
- }
-
- // Parse the benchmark.
- var dm benchmarkWrapper.BenchmarkDataset
- if err := proto.Unmarshal(b, &dm); err != nil {
- panic(err)
- }
-
- // Determine the concrete protobuf message type to use.
- var ds Dataset
- ds.newMessage = generateNewMessageFunction(dm)
-
- // Unmarshal each test message.
- for _, payload := range dm.Payload {
- ds.marshaled = append(ds.marshaled, payload)
- m := ds.newMessage()
- if err := proto.Unmarshal(payload, m); err != nil {
- panic(err)
- }
- ds.unmarshaled = append(ds.unmarshaled, m)
- }
- ds.name = f
-
- datasets = append(datasets, ds)
- }
-}
-
-func Benchmark(b *testing.B) {
- for _, ds := range datasets {
- b.Run(ds.name, func(b *testing.B) {
- b.Run("Unmarshal", func(b *testing.B) {
- for i := 0; i < b.N; i++ {
- for j, payload := range ds.marshaled {
- out := ds.newMessage()
- if err := proto.Unmarshal(payload, out); err != nil {
- b.Fatalf("can't unmarshal message %d %v", j, err)
- }
- }
- }
- })
- b.Run("Marshal", func(b *testing.B) {
- for i := 0; i < b.N; i++ {
- for j, m := range ds.unmarshaled {
- if _, err := proto.Marshal(m); err != nil {
- b.Fatalf("can't marshal message %d %+v: %v", j, m, err)
- }
- }
- }
- })
- b.Run("Size", func(b *testing.B) {
- for i := 0; i < b.N; i++ {
- for _, m := range ds.unmarshaled {
- proto.Size(m)
- }
- }
- })
- b.Run("Clone", func(b *testing.B) {
- for i := 0; i < b.N; i++ {
- for _, m := range ds.unmarshaled {
- proto.Clone(m)
- }
- }
- })
- b.Run("Merge", func(b *testing.B) {
- for i := 0; i < b.N; i++ {
- for _, m := range ds.unmarshaled {
- out := ds.newMessage()
- proto.Merge(out, m)
- }
- }
- })
- })
- }
-}
diff --git a/third_party/protobuf/3.6.0/benchmarks/java/pom.xml b/third_party/protobuf/3.6.0/benchmarks/java/pom.xml
deleted file mode 100644
index c2cd78a1b4..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/java/pom.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>protobuf-java-benchmark</artifactId>
- <groupId>com.google.protobuf</groupId>
- <version>1.0.0</version>
- <name>Protocol Buffers [Benchmark]</name>
- <description>The benchmark tools for Protobuf Java.</description>
-
- <dependencies>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- <version>3.5.0</version>
- </dependency>
- <dependency>
- <groupId>com.google.caliper</groupId>
- <artifactId>caliper</artifactId>
- <version>1.0-beta-2</version>
- </dependency>
- </dependencies>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.4.1</version>
- <configuration>
- <!-- get all project dependencies -->
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- <!-- MainClass in mainfest make a executable jar -->
- <archive>
- <manifest>
- <mainClass>com.mkyong.core.utils.App</mainClass>
- </manifest>
- </archive>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <!-- bind to the packaging phase -->
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.5.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- <mainClass>com.google.protocolbuffers.ProtoBench</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-</project>
-
diff --git a/third_party/protobuf/3.6.0/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java b/third_party/protobuf/3.6.0/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java
deleted file mode 100644
index 94568aea78..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java
+++ /dev/null
@@ -1,232 +0,0 @@
-
-package com.google.protobuf;
-
-import com.google.caliper.BeforeExperiment;
-import com.google.caliper.AfterExperiment;
-import com.google.caliper.Benchmark;
-import com.google.caliper.Param;
-import com.google.protobuf.ByteString;
-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.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ProtoCaliperBenchmark {
- public enum BenchmarkMessageType {
- GOOGLE_MESSAGE1_PROTO3 {
- @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); }
- @Override
- Message getDefaultInstance() {
- return com.google.protobuf.benchmarks.BenchmarkMessage1Proto3.GoogleMessage1
- .getDefaultInstance();
- }
- },
- GOOGLE_MESSAGE1_PROTO2 {
- @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); }
- @Override
- Message getDefaultInstance() {
- return com.google.protobuf.benchmarks.BenchmarkMessage1Proto2.GoogleMessage1
- .getDefaultInstance();
- }
- },
- GOOGLE_MESSAGE2 {
- @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); }
- @Override
- Message getDefaultInstance() {
- return com.google.protobuf.benchmarks.BenchmarkMessage2.GoogleMessage2.getDefaultInstance();
- }
- },
- GOOGLE_MESSAGE3 {
- @Override
- ExtensionRegistry getExtensionRegistry() {
- ExtensionRegistry extensions = ExtensionRegistry.newInstance();
- com.google.protobuf.benchmarks.BenchmarkMessage38.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage37.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage36.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage35.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage34.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage33.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage32.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage31.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage3.registerAllExtensions(extensions);
- return extensions;
- }
- @Override
- Message getDefaultInstance() {
- return com.google.protobuf.benchmarks.BenchmarkMessage3.GoogleMessage3.getDefaultInstance();
- }
- },
- GOOGLE_MESSAGE4 {
- @Override
- ExtensionRegistry getExtensionRegistry() {
- ExtensionRegistry extensions = ExtensionRegistry.newInstance();
- com.google.protobuf.benchmarks.BenchmarkMessage43.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage42.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage41.registerAllExtensions(extensions);
- com.google.protobuf.benchmarks.BenchmarkMessage4.registerAllExtensions(extensions);
- return extensions;
- }
- @Override
- Message getDefaultInstance() {
- return com.google.protobuf.benchmarks.BenchmarkMessage4.GoogleMessage4.getDefaultInstance();
- }
- };
-
- abstract ExtensionRegistry getExtensionRegistry();
- abstract Message getDefaultInstance();
- }
-
- private BenchmarkMessageType benchmarkMessageType;
- @Param("")
- private String dataFile;
-
- private byte[] inputData;
- private BenchmarkDataset benchmarkDataset;
- private Message defaultMessage;
- private ExtensionRegistry extensions;
- private List<byte[]> inputDataList;
- private List<ByteArrayInputStream> inputStreamList;
- private List<ByteString> inputStringList;
- private List<Message> sampleMessageList;
-
- private BenchmarkMessageType getMessageType() throws IOException {
- if (benchmarkDataset.getMessageName().equals("benchmarks.proto3.GoogleMessage1")) {
- return BenchmarkMessageType.GOOGLE_MESSAGE1_PROTO3;
- } else if (benchmarkDataset.getMessageName().equals("benchmarks.proto2.GoogleMessage1")) {
- return BenchmarkMessageType.GOOGLE_MESSAGE1_PROTO2;
- } else if (benchmarkDataset.getMessageName().equals("benchmarks.proto2.GoogleMessage2")) {
- return BenchmarkMessageType.GOOGLE_MESSAGE2;
- } else if (benchmarkDataset.getMessageName().
- equals("benchmarks.google_message3.GoogleMessage3")) {
- return BenchmarkMessageType.GOOGLE_MESSAGE3;
- } else if (benchmarkDataset.getMessageName().
- equals("benchmarks.google_message4.GoogleMessage4")) {
- return BenchmarkMessageType.GOOGLE_MESSAGE4;
- } else {
- throw new IllegalStateException("Invalid DataFile! There's no testing message named "
- + benchmarkDataset.getMessageName());
- }
- }
-
- @BeforeExperiment
- void setUp() throws IOException {
- if (!dataFile.equals("")) {
- RandomAccessFile file = new RandomAccessFile(new File(dataFile), "r");
- inputData = new byte[(int) file.length()];
- file.readFully(inputData);
- benchmarkDataset = BenchmarkDataset.parseFrom(inputData);
- benchmarkMessageType = getMessageType();
- } else {
- inputData = new byte[0];
- benchmarkDataset = BenchmarkDataset.parseFrom(inputData);
- benchmarkMessageType = BenchmarkMessageType.GOOGLE_MESSAGE2;
- }
- defaultMessage = benchmarkMessageType.getDefaultInstance();
- extensions = benchmarkMessageType.getExtensionRegistry();
- inputDataList = new ArrayList<byte[]>();
- inputStreamList = new ArrayList<ByteArrayInputStream>();
- inputStringList = new ArrayList<ByteString>();
- 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());
- }
- }
-
-
- @Benchmark
- void serializeToByteString(int reps) throws IOException {
- if (sampleMessageList.size() == 0) {
- return;
- }
- for (int i = 0; i < reps; i++) {
- for (int j = 0; j < sampleMessageList.size(); j++) {
- sampleMessageList.get(j).toByteString();
- }
- }
- }
-
- @Benchmark
- void serializeToByteArray(int reps) throws IOException {
- if (sampleMessageList.size() == 0) {
- return;
- }
- for (int i = 0; i < reps; i++) {
- for (int j = 0; j < sampleMessageList.size(); j++) {
- sampleMessageList.get(j).toByteArray();
- }
- }
- }
-
- @Benchmark
- void serializeToMemoryStream(int reps) throws IOException {
- if (sampleMessageList.size() == 0) {
- return;
- }
- for (int i = 0; i < reps; i++) {
- for (int j = 0; j < sampleMessageList.size(); j++) {
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- sampleMessageList.get(j).writeTo(output);
- }
- }
- }
-
- @Benchmark
- void deserializeFromByteString(int reps) throws IOException {
- if (inputStringList.size() == 0) {
- return;
- }
- for (int i = 0; i < reps; i++) {
- for (int j = 0; j < inputStringList.size(); j++) {
- benchmarkMessageType.getDefaultInstance().getParserForType().parseFrom(
- inputStringList.get(j), extensions);
- }
- }
- }
-
- @Benchmark
- void deserializeFromByteArray(int reps) throws IOException {
- if (inputDataList.size() == 0) {
- return;
- }
- for (int i = 0; i < reps; i++) {
- for (int j = 0; j < inputDataList.size(); j++) {
- benchmarkMessageType.getDefaultInstance().getParserForType().parseFrom(
- inputDataList.get(j), extensions);
- }
- }
- }
-
- @Benchmark
- void deserializeFromMemoryStream(int reps) throws IOException {
- if (inputStreamList.size() == 0) {
- return;
- }
- for (int i = 0; i < reps; i++) {
- for (int j = 0; j < inputStreamList.size(); j++) {
- benchmarkMessageType.getDefaultInstance().getParserForType().parseFrom(
- inputStreamList.get(j), extensions);
- inputStreamList.get(j).reset();
- }
- }
- }
-}
-
-
diff --git a/third_party/protobuf/3.6.0/benchmarks/python/__init__.py b/third_party/protobuf/3.6.0/benchmarks/python/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/python/__init__.py
+++ /dev/null
diff --git a/third_party/protobuf/3.6.0/benchmarks/python/py_benchmark.py b/third_party/protobuf/3.6.0/benchmarks/python/py_benchmark.py
deleted file mode 100644
index 6942d2085b..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/python/py_benchmark.py
+++ /dev/null
@@ -1,152 +0,0 @@
-import sys
-import os
-import timeit
-import math
-import argparse
-import fnmatch
-import json
-
-parser = argparse.ArgumentParser(description="Python protobuf benchmark")
-parser.add_argument("data_files", metavar="dataFile", nargs="+",
- help="testing data files.")
-parser.add_argument("--json", action="store_const", dest="json",
- const="yes", default="no",
- help="Whether to output json results")
-parser.add_argument("--behavior_prefix", dest="behavior_prefix",
- help="The output json format's behavior's name's prefix",
- default="")
-# BEGIN CPP GENERATED MESSAGE
-parser.add_argument("--cpp_generated", action="store_const",
- dest="cpp_generated", const="yes", default="no",
- help="Whether to link generated code library")
-# END CPP GENERATED MESSAGE
-args = parser.parse_args()
-# BEGIN CPP GENERATED MESSAGE
-# CPP generated code must be linked before importing the generated Python code
-# for the descriptor can be found in the pool
-if args.cpp_generated != "no":
- sys.path.append( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) + "/.libs" )
- import libbenchmark_messages
- sys.path.append( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) + "/tmp" )
-# END CPP GENERATED MESSAGE
-
-
-import datasets.google_message1.proto2.benchmark_message1_proto2_pb2 as benchmark_message1_proto2_pb2
-import datasets.google_message1.proto3.benchmark_message1_proto3_pb2 as benchmark_message1_proto3_pb2
-import datasets.google_message2.benchmark_message2_pb2 as benchmark_message2_pb2
-import datasets.google_message3.benchmark_message3_pb2 as benchmark_message3_pb2
-import datasets.google_message4.benchmark_message4_pb2 as benchmark_message4_pb2
-import benchmarks_pb2 as benchmarks_pb2
-
-
-def run_one_test(filename):
- data = open(filename).read()
- benchmark_dataset = benchmarks_pb2.BenchmarkDataset()
- benchmark_dataset.ParseFromString(data)
- benchmark_util = Benchmark(full_iteration=len(benchmark_dataset.payload),
- module="py_benchmark",
- setup_method="init")
- result={}
- result["filename"] = filename
- result["message_name"] = benchmark_dataset.message_name
- result["benchmarks"] = {}
- benchmark_util.set_test_method("parse_from_benchmark")
- result["benchmarks"][args.behavior_prefix + "_parse_from_benchmark"] = \
- benchmark_util.run_benchmark(setup_method_args='"%s"' % (filename))
- benchmark_util.set_test_method("serialize_to_benchmark")
- result["benchmarks"][args.behavior_prefix + "_serialize_to_benchmark"] = \
- benchmark_util.run_benchmark(setup_method_args='"%s"' % (filename))
- return result
-
-
-def init(filename):
- global benchmark_dataset, message_class, message_list, counter
- message_list=[]
- counter = 0
- data = open(os.path.dirname(sys.argv[0]) + "/../" + filename).read()
- benchmark_dataset = benchmarks_pb2.BenchmarkDataset()
- benchmark_dataset.ParseFromString(data)
-
- if benchmark_dataset.message_name == "benchmarks.proto3.GoogleMessage1":
- message_class = benchmark_message1_proto3_pb2.GoogleMessage1
- elif benchmark_dataset.message_name == "benchmarks.proto2.GoogleMessage1":
- message_class = benchmark_message1_proto2_pb2.GoogleMessage1
- elif benchmark_dataset.message_name == "benchmarks.proto2.GoogleMessage2":
- message_class = benchmark_message2_pb2.GoogleMessage2
- elif benchmark_dataset.message_name == "benchmarks.google_message3.GoogleMessage3":
- message_class = benchmark_message3_pb2.GoogleMessage3
- elif benchmark_dataset.message_name == "benchmarks.google_message4.GoogleMessage4":
- message_class = benchmark_message4_pb2.GoogleMessage4
- else:
- raise IOError("Message %s not found!" % (benchmark_dataset.message_name))
-
- for one_payload in benchmark_dataset.payload:
- temp = message_class()
- temp.ParseFromString(one_payload)
- message_list.append(temp)
-
-
-def parse_from_benchmark():
- global counter, message_class, benchmark_dataset
- m = message_class().ParseFromString(benchmark_dataset.payload[counter % len(benchmark_dataset.payload)])
- counter = counter + 1
-
-
-def serialize_to_benchmark():
- global counter, message_list, message_class
- s = message_list[counter % len(benchmark_dataset.payload)].SerializeToString()
- counter = counter + 1
-
-
-class Benchmark:
- def __init__(self, module=None, test_method=None,
- setup_method=None, full_iteration = 1):
- self.full_iteration = full_iteration
- self.module = module
- self.test_method = test_method
- self.setup_method = setup_method
-
- def set_test_method(self, test_method):
- self.test_method = test_method
-
- def full_setup_code(self, setup_method_args=''):
- setup_code = ""
- setup_code += "from %s import %s\n" % (self.module, self.test_method)
- setup_code += "from %s import %s\n" % (self.module, self.setup_method)
- setup_code += "%s(%s)\n" % (self.setup_method, setup_method_args)
- return setup_code
-
- def dry_run(self, test_method_args='', setup_method_args=''):
- return timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args),
- setup=self.full_setup_code(setup_method_args),
- number=self.full_iteration);
-
- def run_benchmark(self, test_method_args='', setup_method_args=''):
- reps = self.full_iteration;
- t = self.dry_run(test_method_args, setup_method_args);
- if t < 3 :
- reps = int(math.ceil(3 / t)) * self.full_iteration
- t = timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args),
- setup=self.full_setup_code(setup_method_args),
- number=reps);
- return 1.0 * t / reps * (10 ** 9)
-
-
-if __name__ == "__main__":
- results = []
- for file in args.data_files:
- results.append(run_one_test(file))
-
- if args.json != "no":
- print json.dumps(results)
- else:
- for result in results:
- print "Message %s of dataset file %s" % \
- (result["message_name"], result["filename"])
- print "Average time for parse_from_benchmark: %.2f ns" % \
- (result["benchmarks"][ \
- args.behavior_prefix + "_parse_from_benchmark"])
- print "Average time for serialize_to_benchmark: %.2f ns" % \
- (result["benchmarks"][ \
- args.behavior_prefix + "_serialize_to_benchmark"])
- print ""
diff --git a/third_party/protobuf/3.6.0/benchmarks/python/python_benchmark_messages.cc b/third_party/protobuf/3.6.0/benchmarks/python/python_benchmark_messages.cc
deleted file mode 100644
index ded16fe96e..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/python/python_benchmark_messages.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <Python.h>
-
-#include "benchmarks.pb.h"
-#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h"
-#include "datasets/google_message1/proto3/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"
-
-static PyMethodDef python_benchmark_methods[] = {
- {NULL, NULL, 0, NULL} /* Sentinel */
-};
-
-
-PyMODINIT_FUNC
-initlibbenchmark_messages() {
- benchmarks::BenchmarkDataset().descriptor();
- benchmarks::proto3::GoogleMessage1().descriptor();
- benchmarks::proto2::GoogleMessage1().descriptor();
- benchmarks::proto2::GoogleMessage2().descriptor();
- benchmarks::google_message3::GoogleMessage3().descriptor();
- benchmarks::google_message4::GoogleMessage4().descriptor();
-
- PyObject *m;
-
- m = Py_InitModule("libbenchmark_messages", python_benchmark_methods);
- if (m == NULL)
- return;
-}
diff --git a/third_party/protobuf/3.6.0/benchmarks/util/__init__.py b/third_party/protobuf/3.6.0/benchmarks/util/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/util/__init__.py
+++ /dev/null
diff --git a/third_party/protobuf/3.6.0/benchmarks/util/big_query_utils.py b/third_party/protobuf/3.6.0/benchmarks/util/big_query_utils.py
deleted file mode 100644
index 14105aa6ca..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/util/big_query_utils.py
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/usr/bin/env python2.7
-
-import argparse
-import json
-import uuid
-import httplib2
-
-from apiclient import discovery
-from apiclient.errors import HttpError
-from oauth2client.client import GoogleCredentials
-
-# 30 days in milliseconds
-_EXPIRATION_MS = 30 * 24 * 60 * 60 * 1000
-NUM_RETRIES = 3
-
-
-def create_big_query():
- """Authenticates with cloud platform and gets a BiqQuery service object
- """
- creds = GoogleCredentials.get_application_default()
- return discovery.build(
- 'bigquery', 'v2', credentials=creds, cache_discovery=False)
-
-
-def create_dataset(biq_query, project_id, dataset_id):
- is_success = True
- body = {
- 'datasetReference': {
- 'projectId': project_id,
- 'datasetId': dataset_id
- }
- }
-
- try:
- dataset_req = biq_query.datasets().insert(
- projectId=project_id, body=body)
- dataset_req.execute(num_retries=NUM_RETRIES)
- except HttpError as http_error:
- if http_error.resp.status == 409:
- print 'Warning: The dataset %s already exists' % dataset_id
- else:
- # Note: For more debugging info, print "http_error.content"
- print 'Error in creating dataset: %s. Err: %s' % (dataset_id,
- http_error)
- is_success = False
- return is_success
-
-
-def create_table(big_query, project_id, dataset_id, table_id, table_schema,
- description):
- fields = [{
- 'name': field_name,
- 'type': field_type,
- 'description': field_description
- } for (field_name, field_type, field_description) in table_schema]
- return create_table2(big_query, project_id, dataset_id, table_id, fields,
- description)
-
-
-def create_partitioned_table(big_query,
- project_id,
- dataset_id,
- table_id,
- table_schema,
- description,
- partition_type='DAY',
- expiration_ms=_EXPIRATION_MS):
- """Creates a partitioned table. By default, a date-paritioned table is created with
- each partition lasting 30 days after it was last modified.
- """
- fields = [{
- 'name': field_name,
- 'type': field_type,
- 'description': field_description
- } for (field_name, field_type, field_description) in table_schema]
- return create_table2(big_query, project_id, dataset_id, table_id, fields,
- description, partition_type, expiration_ms)
-
-
-def create_table2(big_query,
- project_id,
- dataset_id,
- table_id,
- fields_schema,
- description,
- partition_type=None,
- expiration_ms=None):
- is_success = True
-
- body = {
- 'description': description,
- 'schema': {
- 'fields': fields_schema
- },
- 'tableReference': {
- 'datasetId': dataset_id,
- 'projectId': project_id,
- 'tableId': table_id
- }
- }
-
- if partition_type and expiration_ms:
- body["timePartitioning"] = {
- "type": partition_type,
- "expirationMs": expiration_ms
- }
-
- try:
- table_req = big_query.tables().insert(
- projectId=project_id, datasetId=dataset_id, body=body)
- res = table_req.execute(num_retries=NUM_RETRIES)
- print 'Successfully created %s "%s"' % (res['kind'], res['id'])
- except HttpError as http_error:
- if http_error.resp.status == 409:
- print 'Warning: Table %s already exists' % table_id
- else:
- print 'Error in creating table: %s. Err: %s' % (table_id,
- http_error)
- is_success = False
- return is_success
-
-
-def patch_table(big_query, project_id, dataset_id, table_id, fields_schema):
- is_success = True
-
- body = {
- 'schema': {
- 'fields': fields_schema
- },
- 'tableReference': {
- 'datasetId': dataset_id,
- 'projectId': project_id,
- 'tableId': table_id
- }
- }
-
- try:
- table_req = big_query.tables().patch(
- projectId=project_id,
- datasetId=dataset_id,
- tableId=table_id,
- body=body)
- res = table_req.execute(num_retries=NUM_RETRIES)
- print 'Successfully patched %s "%s"' % (res['kind'], res['id'])
- except HttpError as http_error:
- print 'Error in creating table: %s. Err: %s' % (table_id, http_error)
- is_success = False
- return is_success
-
-
-def insert_rows(big_query, project_id, dataset_id, table_id, rows_list):
- is_success = True
- body = {'rows': rows_list}
- try:
- insert_req = big_query.tabledata().insertAll(
- projectId=project_id,
- datasetId=dataset_id,
- tableId=table_id,
- body=body)
- res = insert_req.execute(num_retries=NUM_RETRIES)
- if res.get('insertErrors', None):
- print 'Error inserting rows! Response: %s' % res
- is_success = False
- except HttpError as http_error:
- print 'Error inserting rows to the table %s' % table_id
- is_success = False
-
- return is_success
-
-
-def sync_query_job(big_query, project_id, query, timeout=5000):
- query_data = {'query': query, 'timeoutMs': timeout}
- query_job = None
- try:
- query_job = big_query.jobs().query(
- projectId=project_id,
- body=query_data).execute(num_retries=NUM_RETRIES)
- except HttpError as http_error:
- print 'Query execute job failed with error: %s' % http_error
- print http_error.content
- return query_job
-
-
- # List of (column name, column type, description) tuples
-def make_row(unique_row_id, row_values_dict):
- """row_values_dict is a dictionary of column name and column value.
- """
- return {'insertId': unique_row_id, 'json': row_values_dict}
diff --git a/third_party/protobuf/3.6.0/benchmarks/util/gogo_data_scrubber.cc b/third_party/protobuf/3.6.0/benchmarks/util/gogo_data_scrubber.cc
deleted file mode 100644
index fb9af6e2f2..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/util/gogo_data_scrubber.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "benchmarks.pb.h"
-#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h"
-#include "datasets/google_message1/proto3/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"
-
-#include "google/protobuf/message.h"
-#include "google/protobuf/descriptor.h"
-
-#include <fstream>
-
-using google::protobuf::FieldDescriptor;
-using google::protobuf::Message;
-using google::protobuf::Reflection;
-
-
-class DataGroupStripper {
- public:
- static void StripMessage(Message *message) {
- std::vector<const FieldDescriptor*> set_fields;
- const Reflection* reflection = message->GetReflection();
- reflection->ListFields(*message, &set_fields);
-
- for (size_t i = 0; i < set_fields.size(); i++) {
- const FieldDescriptor* field = set_fields[i];
- if (field->type() == FieldDescriptor::TYPE_GROUP) {
- reflection->ClearField(message, field);
- }
- if (field->type() == FieldDescriptor::TYPE_MESSAGE) {
- if (field->is_repeated()) {
- for (int j = 0; j < reflection->FieldSize(*message, field); j++) {
- StripMessage(reflection->MutableRepeatedMessage(message, field, j));
- }
- } else {
- StripMessage(reflection->MutableMessage(message, field));
- }
- }
- }
-
- reflection->MutableUnknownFields(message)->Clear();
- }
-};
-
-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(int argc, char *argv[]) {
- if (argc % 2 == 0 || argc == 1) {
- std::cerr << "Usage: [input_files] [output_file_names] where " <<
- "input_files are one to one mapping to output_file_names." <<
- std::endl;
- return 1;
- }
-
- for (int i = argc / 2; i > 0; i--) {
- const std::string &input_file = argv[i];
- const std::string &output_file = argv[i + argc / 2];
-
- std::cerr << "Generating " << input_file
- << " to " << output_file << std::endl;
- benchmarks::BenchmarkDataset dataset;
- Message* message;
- std::string dataset_payload = ReadFile(input_file);
- GOOGLE_CHECK(dataset.ParseFromString(dataset_payload))
- << "Can' t parse data file " << input_file;
-
- if (dataset.message_name() == "benchmarks.proto3.GoogleMessage1") {
- message = new benchmarks::proto3::GoogleMessage1;
- } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage1") {
- message = new benchmarks::proto2::GoogleMessage1;
- } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") {
- message = new benchmarks::proto2::GoogleMessage2;
- } else if (dataset.message_name() ==
- "benchmarks.google_message3.GoogleMessage3") {
- message = new benchmarks::google_message3::GoogleMessage3;
- } else if (dataset.message_name() ==
- "benchmarks.google_message4.GoogleMessage4") {
- message = new benchmarks::google_message4::GoogleMessage4;
- } else {
- std::cerr << "Unknown message type: " << dataset.message_name();
- exit(1);
- }
-
- for (int i = 0; i < dataset.payload_size(); i++) {
- message->ParseFromString(dataset.payload(i));
- DataGroupStripper::StripMessage(message);
- dataset.set_payload(i, message->SerializeAsString());
- }
-
- std::ofstream ofs(output_file);
- ofs << dataset.SerializeAsString();
- ofs.close();
- }
-
-
- return 0;
-}
diff --git a/third_party/protobuf/3.6.0/benchmarks/util/protoc-gen-gogoproto.cc b/third_party/protobuf/3.6.0/benchmarks/util/protoc-gen-gogoproto.cc
deleted file mode 100644
index bfa6a5e54a..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/util/protoc-gen-gogoproto.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-#include "google/protobuf/compiler/code_generator.h"
-#include "google/protobuf/io/zero_copy_stream.h"
-#include "google/protobuf/io/printer.h"
-#include "google/protobuf/descriptor.h"
-#include "google/protobuf/descriptor.pb.h"
-#include "schema_proto2_to_proto3_util.h"
-
-#include "google/protobuf/compiler/plugin.h"
-
-using google::protobuf::FileDescriptorProto;
-using google::protobuf::FileDescriptor;
-using google::protobuf::DescriptorPool;
-using google::protobuf::io::Printer;
-using google::protobuf::util::SchemaGroupStripper;
-using google::protobuf::util::SchemaAddZeroEnumValue;
-
-namespace google {
-namespace protobuf {
-namespace compiler {
-
-namespace {
-
-string StripProto(string filename) {
- if (filename.substr(filename.size() - 11) == ".protodevel") {
- // .protodevel
- return filename.substr(0, filename.size() - 11);
- } else {
- // .proto
- return filename.substr(0, filename.size() - 6);
- }
-}
-
-DescriptorPool new_pool_;
-
-} // namespace
-
-class GoGoProtoGenerator : public CodeGenerator {
- public:
- virtual bool GenerateAll(const std::vector<const FileDescriptor*>& files,
- const string& parameter,
- GeneratorContext* context,
- string* error) const {
- for (int i = 0; i < files.size(); i++) {
- for (auto file : files) {
- bool can_generate =
- (new_pool_.FindFileByName(file->name()) == nullptr);
- for (int j = 0; j < file->dependency_count(); j++) {
- can_generate &= (new_pool_.FindFileByName(
- file->dependency(j)->name()) != nullptr);
- }
- for (int j = 0; j < file->public_dependency_count(); j++) {
- can_generate &= (new_pool_.FindFileByName(
- file->public_dependency(j)->name()) != nullptr);
- }
- for (int j = 0; j < file->weak_dependency_count(); j++) {
- can_generate &= (new_pool_.FindFileByName(
- file->weak_dependency(j)->name()) != nullptr);
- }
- if (can_generate) {
- Generate(file, parameter, context, error);
- break;
- }
- }
- }
-
- return true;
- }
-
- virtual bool Generate(const FileDescriptor* file,
- const string& parameter,
- GeneratorContext* context,
- string* error) const {
- FileDescriptorProto new_file;
- file->CopyTo(&new_file);
- SchemaGroupStripper::StripFile(file, &new_file);
-
- SchemaAddZeroEnumValue enum_scrubber;
- enum_scrubber.ScrubFile(&new_file);
-
- string filename = file->name();
- string basename = StripProto(filename);
-
- std::vector<std::pair<string,string>> option_pairs;
- ParseGeneratorParameter(parameter, &option_pairs);
-
- std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
- context->Open(basename + ".proto"));
- string content = new_pool_.BuildFile(new_file)->DebugString();
- Printer printer(output.get(), '$');
- printer.WriteRaw(content.c_str(), content.size());
-
- return true;
- }
-};
-
-} // namespace compiler
-} // namespace protobuf
-} // namespace google
-
-int main(int argc, char* argv[]) {
- google::protobuf::compiler::GoGoProtoGenerator generator;
- return google::protobuf::compiler::PluginMain(argc, argv, &generator);
-}
diff --git a/third_party/protobuf/3.6.0/benchmarks/util/run_and_upload.py b/third_party/protobuf/3.6.0/benchmarks/util/run_and_upload.py
deleted file mode 100644
index ae22a668bb..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/util/run_and_upload.py
+++ /dev/null
@@ -1,290 +0,0 @@
-import argparse
-import os
-import re
-import copy
-import uuid
-import calendar
-import time
-import big_query_utils
-import datetime
-import json
-# This import depends on the automake rule protoc_middleman, please make sure
-# protoc_middleman has been built before run this file.
-import os.path, sys
-sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
-import tmp.benchmarks_pb2 as benchmarks_pb2
-from click.types import STRING
-
-_PROJECT_ID = 'grpc-testing'
-_DATASET = 'protobuf_benchmark_result'
-_TABLE = 'opensource_result_v1'
-_NOW = "%d%02d%02d" % (datetime.datetime.now().year,
- datetime.datetime.now().month,
- datetime.datetime.now().day)
-
-file_size_map = {}
-
-def get_data_size(file_name):
- if file_name in file_size_map:
- return file_size_map[file_name]
- benchmark_dataset = benchmarks_pb2.BenchmarkDataset()
- benchmark_dataset.ParseFromString(
- open(os.path.dirname(os.path.abspath(__file__)) + "/../" + file_name).read())
- size = 0
- count = 0
- for payload in benchmark_dataset.payload:
- size += len(payload)
- count += 1
- file_size_map[file_name] = (size, 1.0 * size / count)
- return size, 1.0 * size / count
-
-
-def extract_file_name(file_name):
- name_list = re.split("[/\.]", file_name)
- short_file_name = ""
- for name in name_list:
- if name[:14] == "google_message":
- short_file_name = name
- return short_file_name
-
-
-cpp_result = []
-python_result = []
-java_result = []
-go_result = []
-
-
-# CPP results example:
-# [
-# "benchmarks": [
-# {
-# "bytes_per_second": int,
-# "cpu_time": int,
-# "name: string,
-# "time_unit: string,
-# ...
-# },
-# ...
-# ],
-# ...
-# ]
-def parse_cpp_result(filename):
- global cpp_result
- if filename == "":
- return
- if filename[0] != '/':
- filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
- with open(filename) as f:
- results = json.loads(f.read())
- for benchmark in results["benchmarks"]:
- data_filename = "".join(
- re.split("(_parse_|_serialize)", benchmark["name"])[0])
- behavior = benchmark["name"][len(data_filename) + 1:]
- cpp_result.append({
- "language": "cpp",
- "dataFileName": data_filename,
- "behavior": behavior,
- "throughput": benchmark["bytes_per_second"] / 2.0 ** 20
- })
-
-
-# Python results example:
-# [
-# [
-# {
-# "filename": string,
-# "benchmarks": {
-# behavior: results,
-# ...
-# },
-# "message_name": STRING
-# },
-# ...
-# ], #pure-python
-# ...
-# ]
-def parse_python_result(filename):
- global python_result
- if filename == "":
- return
- if filename[0] != '/':
- filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
- with open(filename) as f:
- results_list = json.loads(f.read())
- for results in results_list:
- for result in results:
- _, avg_size = get_data_size(result["filename"])
- for behavior in result["benchmarks"]:
- python_result.append({
- "language": "python",
- "dataFileName": extract_file_name(result["filename"]),
- "behavior": behavior,
- "throughput": avg_size /
- result["benchmarks"][behavior] * 1e9 / 2 ** 20
- })
-
-
-# Java results example:
-# [
-# {
-# "id": string,
-# "instrumentSpec": {...},
-# "measurements": [
-# {
-# "weight": float,
-# "value": {
-# "magnitude": float,
-# "unit": string
-# },
-# ...
-# },
-# ...
-# ],
-# "run": {...},
-# "scenario": {
-# "benchmarkSpec": {
-# "methodName": string,
-# "parameters": {
-# defined parameters in the benchmark: parameters value
-# },
-# ...
-# },
-# ...
-# }
-#
-# },
-# ...
-# ]
-def parse_java_result(filename):
- global average_bytes_per_message, java_result
- if filename == "":
- return
- if filename[0] != '/':
- filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
- with open(filename) as f:
- results = json.loads(f.read())
- for result in results:
- total_weight = 0
- total_value = 0
- for measurement in result["measurements"]:
- total_weight += measurement["weight"]
- total_value += measurement["value"]["magnitude"]
- avg_time = total_value * 1.0 / total_weight
- total_size, _ = get_data_size(
- result["scenario"]["benchmarkSpec"]["parameters"]["dataFile"])
- java_result.append({
- "language": "java",
- "throughput": total_size / avg_time * 1e9 / 2 ** 20,
- "behavior": result["scenario"]["benchmarkSpec"]["methodName"],
- "dataFileName": extract_file_name(
- result["scenario"]["benchmarkSpec"]["parameters"]["dataFile"])
- })
-
-
-# Go benchmark results:
-#
-# goos: linux
-# goarch: amd64
-# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Unmarshal-12 3000 705784 ns/op
-# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Marshal-12 2000 634648 ns/op
-# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Size-12 5000 244174 ns/op
-# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Clone-12 300 4120954 ns/op
-# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Merge-12 300 4108632 ns/op
-# PASS
-# ok _/usr/local/google/home/yilunchong/mygit/protobuf/benchmarks 124.173s
-def parse_go_result(filename):
- global go_result
- if filename == "":
- return
- if filename[0] != '/':
- filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
- with open(filename) as f:
- for line in f:
- result_list = re.split("[\ \t]+", line)
- if result_list[0][:9] != "Benchmark":
- continue
- first_slash_index = result_list[0].find('/')
- last_slash_index = result_list[0].rfind('/')
- full_filename = result_list[0][first_slash_index+4:last_slash_index] # delete ../ prefix
- total_bytes, _ = get_data_size(full_filename)
- behavior_with_suffix = result_list[0][last_slash_index+1:]
- last_dash = behavior_with_suffix.rfind("-")
- if last_dash == -1:
- behavior = behavior_with_suffix
- else:
- behavior = behavior_with_suffix[:last_dash]
- go_result.append({
- "dataFilename": extract_file_name(full_filename),
- "throughput": total_bytes / float(result_list[2]) * 1e9 / 2 ** 20,
- "behavior": behavior,
- "language": "go"
- })
-
-
-def get_metadata():
- build_number = os.getenv('BUILD_NUMBER')
- build_url = os.getenv('BUILD_URL')
- job_name = os.getenv('JOB_NAME')
- git_commit = os.getenv('GIT_COMMIT')
- # actual commit is the actual head of PR that is getting tested
- git_actual_commit = os.getenv('ghprbActualCommit')
-
- utc_timestamp = str(calendar.timegm(time.gmtime()))
- metadata = {'created': utc_timestamp}
-
- if build_number:
- metadata['buildNumber'] = build_number
- if build_url:
- metadata['buildUrl'] = build_url
- if job_name:
- metadata['jobName'] = job_name
- if git_commit:
- metadata['gitCommit'] = git_commit
- if git_actual_commit:
- metadata['gitActualCommit'] = git_actual_commit
-
- return metadata
-
-
-def upload_result(result_list, metadata):
- for result in result_list:
- new_result = copy.deepcopy(result)
- new_result['metadata'] = metadata
- bq = big_query_utils.create_big_query()
- row = big_query_utils.make_row(str(uuid.uuid4()), new_result)
- if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET,
- _TABLE + "$" + _NOW,
- [row]):
- print 'Error when uploading result', new_result
-
-
-if __name__ == "__main__":
- parser = argparse.ArgumentParser()
- parser.add_argument("-cpp", "--cpp_input_file",
- help="The CPP benchmark result file's name",
- default="")
- parser.add_argument("-java", "--java_input_file",
- help="The Java benchmark result file's name",
- default="")
- parser.add_argument("-python", "--python_input_file",
- help="The Python benchmark result file's name",
- default="")
- parser.add_argument("-go", "--go_input_file",
- help="The golang benchmark result file's name",
- default="")
- args = parser.parse_args()
-
- parse_cpp_result(args.cpp_input_file)
- parse_python_result(args.python_input_file)
- parse_java_result(args.java_input_file)
- parse_go_result(args.go_input_file)
-
- metadata = get_metadata()
- print "uploading cpp results..."
- upload_result(cpp_result, metadata)
- print "uploading java results..."
- upload_result(java_result, metadata)
- print "uploading python results..."
- upload_result(python_result, metadata)
- print "uploading go results..."
- upload_result(go_result, metadata)
diff --git a/third_party/protobuf/3.6.0/benchmarks/util/schema_proto2_to_proto3_util.h b/third_party/protobuf/3.6.0/benchmarks/util/schema_proto2_to_proto3_util.h
deleted file mode 100644
index 089012dd7c..0000000000
--- a/third_party/protobuf/3.6.0/benchmarks/util/schema_proto2_to_proto3_util.h
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_
-#define PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_
-
-#include "google/protobuf/message.h"
-#include "google/protobuf/descriptor.h"
-#include "google/protobuf/descriptor.pb.h"
-
-#include <sstream>
-#include <algorithm>
-
-using google::protobuf::Descriptor;
-using google::protobuf::DescriptorProto;
-using google::protobuf::FileDescriptorProto;
-using google::protobuf::FieldDescriptorProto;
-using google::protobuf::Message;
-using google::protobuf::EnumValueDescriptorProto;
-
-namespace google {
-namespace protobuf {
-namespace util {
-
-class SchemaGroupStripper {
-
- public:
- static void StripFile(const FileDescriptor* old_file,
- FileDescriptorProto *file) {
- for (int i = file->mutable_message_type()->size() - 1; i >= 0; i--) {
- if (IsMessageSet(old_file->message_type(i))) {
- file->mutable_message_type()->DeleteSubrange(i, 1);
- continue;
- }
- StripMessage(old_file->message_type(i), file->mutable_message_type(i));
- }
- for (int i = file->mutable_extension()->size() - 1; i >= 0; i--) {
- auto field = old_file->extension(i);
- if (field->type() == FieldDescriptor::TYPE_GROUP ||
- IsMessageSet(field->message_type()) ||
- IsMessageSet(field->containing_type())) {
- file->mutable_extension()->DeleteSubrange(i, 1);
- }
- }
- }
-
- private:
- static bool IsMessageSet(const Descriptor *descriptor) {
- if (descriptor != nullptr
- && descriptor->options().message_set_wire_format()) {
- return true;
- }
- return false;
- }
-
- static void StripMessage(const Descriptor *old_message,
- DescriptorProto *new_message) {
- for (int i = new_message->mutable_field()->size() - 1; i >= 0; i--) {
- if (old_message->field(i)->type() == FieldDescriptor::TYPE_GROUP ||
- IsMessageSet(old_message->field(i)->message_type())) {
- new_message->mutable_field()->DeleteSubrange(i, 1);
- }
- }
- for (int i = new_message->mutable_extension()->size() - 1; i >= 0; i--) {
- auto field_type_name = new_message->mutable_extension(i)->type_name();
- if (old_message->extension(i)->type() == FieldDescriptor::TYPE_GROUP ||
- IsMessageSet(old_message->extension(i)->containing_type()) ||
- IsMessageSet(old_message->extension(i)->message_type())) {
- new_message->mutable_extension()->DeleteSubrange(i, 1);
- }
- }
- for (int i = 0; i < new_message->mutable_nested_type()->size(); i++) {
- StripMessage(old_message->nested_type(i),
- new_message->mutable_nested_type(i));
- }
- }
-
-};
-
-class SchemaAddZeroEnumValue {
-
- public:
- SchemaAddZeroEnumValue()
- : total_added_(0) {
- }
-
- void ScrubFile(FileDescriptorProto *file) {
- for (int i = 0; i < file->enum_type_size(); i++) {
- ScrubEnum(file->mutable_enum_type(i));
- }
- for (int i = 0; i < file->mutable_message_type()->size(); i++) {
- ScrubMessage(file->mutable_message_type(i));
- }
- }
-
- private:
- void ScrubEnum(EnumDescriptorProto *enum_type) {
- if (enum_type->value(0).number() != 0) {
- bool has_zero = false;
- for (int j = 0; j < enum_type->value().size(); j++) {
- if (enum_type->value(j).number() == 0) {
- EnumValueDescriptorProto temp_enum_value;
- temp_enum_value.CopyFrom(enum_type->value(j));
- enum_type->mutable_value(j)->CopyFrom(enum_type->value(0));
- enum_type->mutable_value(0)->CopyFrom(temp_enum_value);
- has_zero = true;
- break;
- }
- }
- if (!has_zero) {
- enum_type->mutable_value()->Add();
- for (int i = enum_type->mutable_value()->size() - 1; i > 0; i--) {
- enum_type->mutable_value(i)->CopyFrom(
- *enum_type->mutable_value(i - 1));
- }
- enum_type->mutable_value(0)->set_number(0);
- enum_type->mutable_value(0)->set_name("ADDED_ZERO_VALUE_" +
- std::to_string(total_added_++));
- }
- }
-
- }
-
- void ScrubMessage(DescriptorProto *message_type) {
- for (int i = 0; i < message_type->mutable_enum_type()->size(); i++) {
- ScrubEnum(message_type->mutable_enum_type(i));
- }
- for (int i = 0; i < message_type->mutable_nested_type()->size(); i++) {
- ScrubMessage(message_type->mutable_nested_type(i));
- }
- }
-
- int total_added_;
-};
-
-} // namespace util
-} // namespace protobuf
-} // namespace google
-
-#endif // PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_csharp.txt b/third_party/protobuf/3.6.0/conformance/failure_list_csharp.txt
deleted file mode 100644
index 2a20aa78e7..0000000000
--- a/third_party/protobuf/3.6.0/conformance/failure_list_csharp.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
-Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
diff --git a/third_party/protobuf/3.6.0/conformance/failure_list_php.txt b/third_party/protobuf/3.6.0/conformance/failure_list_php.txt
deleted file mode 100644
index 0d2341127e..0000000000
--- a/third_party/protobuf/3.6.0/conformance/failure_list_php.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput
-Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
-Recommended.FieldMaskTooManyUnderscore.JsonOutput
-Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
-Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
-Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
-Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
-Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator
-Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator
-Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
-Required.Proto3.JsonInput.FloatFieldTooLarge
-Required.Proto3.JsonInput.FloatFieldTooSmall
-Required.Proto3.JsonInput.DoubleFieldTooSmall
-Required.Proto3.JsonInput.Int32FieldNotInteger
-Required.Proto3.JsonInput.Int64FieldNotInteger
-Required.Proto3.JsonInput.Uint32FieldNotInteger
-Required.Proto3.JsonInput.Uint64FieldNotInteger
-Required.Proto3.JsonInput.Int32FieldLeadingSpace
-Required.Proto3.JsonInput.OneofFieldDuplicate
-Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput
diff --git a/third_party/protobuf/3.6.0/csharp/global.json b/third_party/protobuf/3.6.0/csharp/global.json
deleted file mode 100644
index 5ab775b9b4..0000000000
--- a/third_party/protobuf/3.6.0/csharp/global.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "sdk": {
- "version": "2.0.3"
- }
-}
diff --git a/third_party/protobuf/3.6.0/csharp/protos/README.md b/third_party/protobuf/3.6.0/csharp/protos/README.md
deleted file mode 100644
index bdd66fcf39..0000000000
--- a/third_party/protobuf/3.6.0/csharp/protos/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-This directory contains unit test protos adapted from those in
-src/google/protobuf, and C#-specific test protos for regression
-tests against bugs found in the C# codegen or library.
diff --git a/third_party/protobuf/3.6.0/csharp/protos/unittest_proto3.proto b/third_party/protobuf/3.6.0/csharp/protos/unittest_proto3.proto
deleted file mode 100644
index ef4933a509..0000000000
--- a/third_party/protobuf/3.6.0/csharp/protos/unittest_proto3.proto
+++ /dev/null
@@ -1,380 +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 we will use for unit testing.
-
-syntax = "proto3";
-
-option csharp_namespace = "Google.Protobuf.TestProtos";
-
-// Only present so we can test that we can read it (as an example
-// of a non-C# option)
-option java_outer_classname = "UnittestProto";
-
-import "unittest_import_proto3.proto";
-
-package protobuf_unittest3;
-
-// This proto includes every type of field in both singular and repeated
-// forms.
-message TestAllTypes {
- message NestedMessage {
- // The field name "b" fails to compile in proto1 because it conflicts with
- // a local variable named "b" in one of the generated methods. Doh.
- // This file needs to compile in proto1 to test backwards-compatibility.
- int32 bb = 1;
- }
-
- enum NestedEnum {
- NESTED_ENUM_UNSPECIFIED = 0;
- FOO = 1;
- BAR = 2;
- BAZ = 3;
- NEG = -1; // Intentionally negative.
- }
-
- // Singular
- int32 single_int32 = 1;
- int64 single_int64 = 2;
- uint32 single_uint32 = 3;
- uint64 single_uint64 = 4;
- sint32 single_sint32 = 5;
- sint64 single_sint64 = 6;
- fixed32 single_fixed32 = 7;
- fixed64 single_fixed64 = 8;
- sfixed32 single_sfixed32 = 9;
- sfixed64 single_sfixed64 = 10;
- float single_float = 11;
- double single_double = 12;
- bool single_bool = 13;
- string single_string = 14;
- bytes single_bytes = 15;
-
- NestedMessage single_nested_message = 18;
- ForeignMessage single_foreign_message = 19;
- protobuf_unittest_import.ImportMessage single_import_message = 20;
-
- NestedEnum single_nested_enum = 21;
- ForeignEnum single_foreign_enum = 22;
- protobuf_unittest_import.ImportEnum single_import_enum = 23;
-
- // Defined in unittest_import_public.proto
- protobuf_unittest_import.PublicImportMessage
- single_public_import_message = 26;
-
- // Repeated
- repeated int32 repeated_int32 = 31;
- repeated int64 repeated_int64 = 32;
- repeated uint32 repeated_uint32 = 33;
- repeated uint64 repeated_uint64 = 34;
- repeated sint32 repeated_sint32 = 35;
- repeated sint64 repeated_sint64 = 36;
- repeated fixed32 repeated_fixed32 = 37;
- repeated fixed64 repeated_fixed64 = 38;
- repeated sfixed32 repeated_sfixed32 = 39;
- repeated sfixed64 repeated_sfixed64 = 40;
- repeated float repeated_float = 41;
- repeated double repeated_double = 42;
- repeated bool repeated_bool = 43;
- repeated string repeated_string = 44;
- repeated bytes repeated_bytes = 45;
-
- repeated NestedMessage repeated_nested_message = 48;
- repeated ForeignMessage repeated_foreign_message = 49;
- repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50;
-
- repeated NestedEnum repeated_nested_enum = 51;
- repeated ForeignEnum repeated_foreign_enum = 52;
- repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53;
- // Defined in unittest_import_public.proto
- repeated protobuf_unittest_import.PublicImportMessage
- repeated_public_import_message = 54;
-
- // For oneof test
- oneof oneof_field {
- uint32 oneof_uint32 = 111;
- NestedMessage oneof_nested_message = 112;
- string oneof_string = 113;
- bytes oneof_bytes = 114;
- }
-}
-
-// This proto includes a recusively nested message.
-message NestedTestAllTypes {
- NestedTestAllTypes child = 1;
- TestAllTypes payload = 2;
- repeated NestedTestAllTypes repeated_child = 3;
-}
-
-message TestDeprecatedFields {
- int32 deprecated_int32 = 1 [deprecated=true];
-}
-
-// Define these after TestAllTypes to make sure the compiler can handle
-// that.
-message ForeignMessage {
- int32 c = 1;
-}
-
-enum ForeignEnum {
- FOREIGN_UNSPECIFIED = 0;
- FOREIGN_FOO = 4;
- FOREIGN_BAR = 5;
- FOREIGN_BAZ = 6;
-}
-
-message TestReservedFields {
- reserved 2, 15, 9 to 11;
- reserved "bar", "baz";
-}
-
-
-// Test that we can use NestedMessage from outside TestAllTypes.
-message TestForeignNested {
- TestAllTypes.NestedMessage foreign_nested = 1;
-}
-
-// Test that really large tag numbers don't break anything.
-message TestReallyLargeTagNumber {
- // The largest possible tag number is 2^28 - 1, since the wire format uses
- // three bits to communicate wire type.
- int32 a = 1;
- int32 bb = 268435455;
-}
-
-message TestRecursiveMessage {
- TestRecursiveMessage a = 1;
- int32 i = 2;
-}
-
-// Test that mutual recursion works.
-message TestMutualRecursionA {
- TestMutualRecursionB bb = 1;
-}
-
-message TestMutualRecursionB {
- TestMutualRecursionA a = 1;
- int32 optional_int32 = 2;
-}
-
-message TestEnumAllowAlias {
- TestEnumWithDupValue value = 1;
-}
-
-// Test an enum that has multiple values with the same number.
-enum TestEnumWithDupValue {
- TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0;
- option allow_alias = true;
-
- FOO1 = 1;
- BAR1 = 2;
- BAZ = 3;
- FOO2 = 1;
- BAR2 = 2;
-}
-
-// Test an enum with large, unordered values.
-enum TestSparseEnum {
- TEST_SPARSE_ENUM_UNSPECIFIED = 0;
- SPARSE_A = 123;
- SPARSE_B = 62374;
- SPARSE_C = 12589234;
- SPARSE_D = -15;
- SPARSE_E = -53452;
- // In proto3, value 0 must be the first one specified
- // SPARSE_F = 0;
- SPARSE_G = 2;
-}
-
-// Test message with CamelCase field names. This violates Protocol Buffer
-// standard style.
-message TestCamelCaseFieldNames {
- int32 PrimitiveField = 1;
- string StringField = 2;
- ForeignEnum EnumField = 3;
- ForeignMessage MessageField = 4;
-
- repeated int32 RepeatedPrimitiveField = 7;
- repeated string RepeatedStringField = 8;
- repeated ForeignEnum RepeatedEnumField = 9;
- repeated ForeignMessage RepeatedMessageField = 10;
-}
-
-
-// We list fields out of order, to ensure that we're using field number and not
-// field index to determine serialization order.
-message TestFieldOrderings {
- string my_string = 11;
- int64 my_int = 1;
- float my_float = 101;
- message NestedMessage {
- int64 oo = 2;
- // The field name "b" fails to compile in proto1 because it conflicts with
- // a local variable named "b" in one of the generated methods. Doh.
- // This file needs to compile in proto1 to test backwards-compatibility.
- int32 bb = 1;
- }
-
- NestedMessage single_nested_message = 200;
-}
-
-message SparseEnumMessage {
- TestSparseEnum sparse_enum = 1;
-}
-
-// Test String and Bytes: string is for valid UTF-8 strings
-message OneString {
- string data = 1;
-}
-
-message MoreString {
- repeated string data = 1;
-}
-
-message OneBytes {
- bytes data = 1;
-}
-
-message MoreBytes {
- bytes data = 1;
-}
-
-// Test int32, uint32, int64, uint64, and bool are all compatible
-message Int32Message {
- int32 data = 1;
-}
-
-message Uint32Message {
- uint32 data = 1;
-}
-
-message Int64Message {
- int64 data = 1;
-}
-
-message Uint64Message {
- uint64 data = 1;
-}
-
-message BoolMessage {
- bool data = 1;
-}
-
-// Test oneofs.
-message TestOneof {
- oneof foo {
- int32 foo_int = 1;
- string foo_string = 2;
- TestAllTypes foo_message = 3;
- }
-}
-
-// Test messages for packed fields
-
-message TestPackedTypes {
- repeated int32 packed_int32 = 90 [packed = true];
- repeated int64 packed_int64 = 91 [packed = true];
- repeated uint32 packed_uint32 = 92 [packed = true];
- repeated uint64 packed_uint64 = 93 [packed = true];
- repeated sint32 packed_sint32 = 94 [packed = true];
- repeated sint64 packed_sint64 = 95 [packed = true];
- repeated fixed32 packed_fixed32 = 96 [packed = true];
- repeated fixed64 packed_fixed64 = 97 [packed = true];
- repeated sfixed32 packed_sfixed32 = 98 [packed = true];
- repeated sfixed64 packed_sfixed64 = 99 [packed = true];
- repeated float packed_float = 100 [packed = true];
- repeated double packed_double = 101 [packed = true];
- repeated bool packed_bool = 102 [packed = true];
- repeated ForeignEnum packed_enum = 103 [packed = true];
-}
-
-// A message with the same fields as TestPackedTypes, but without packing. Used
-// to test packed <-> unpacked wire compatibility.
-message TestUnpackedTypes {
- repeated int32 unpacked_int32 = 90 [packed = false];
- repeated int64 unpacked_int64 = 91 [packed = false];
- repeated uint32 unpacked_uint32 = 92 [packed = false];
- repeated uint64 unpacked_uint64 = 93 [packed = false];
- repeated sint32 unpacked_sint32 = 94 [packed = false];
- repeated sint64 unpacked_sint64 = 95 [packed = false];
- repeated fixed32 unpacked_fixed32 = 96 [packed = false];
- repeated fixed64 unpacked_fixed64 = 97 [packed = false];
- repeated sfixed32 unpacked_sfixed32 = 98 [packed = false];
- repeated sfixed64 unpacked_sfixed64 = 99 [packed = false];
- repeated float unpacked_float = 100 [packed = false];
- repeated double unpacked_double = 101 [packed = false];
- repeated bool unpacked_bool = 102 [packed = false];
- repeated ForeignEnum unpacked_enum = 103 [packed = false];
-}
-
-message TestRepeatedScalarDifferentTagSizes {
- // Parsing repeated fixed size values used to fail. This message needs to be
- // used in order to get a tag of the right size; all of the repeated fields
- // in TestAllTypes didn't trigger the check.
- repeated fixed32 repeated_fixed32 = 12;
- // Check for a varint type, just for good measure.
- repeated int32 repeated_int32 = 13;
-
- // These have two-byte tags.
- repeated fixed64 repeated_fixed64 = 2046;
- repeated int64 repeated_int64 = 2047;
-
- // Three byte tags.
- repeated float repeated_float = 262142;
- repeated uint64 repeated_uint64 = 262143;
-}
-
-message TestCommentInjectionMessage {
- // */ <- This should not close the generated doc comment
- string a = 1;
-}
-
-
-// Test that RPC services work.
-message FooRequest {}
-message FooResponse {}
-
-message FooClientMessage {}
-message FooServerMessage{}
-
-service TestService {
- rpc Foo(FooRequest) returns (FooResponse);
- rpc Bar(BarRequest) returns (BarResponse);
-}
-
-
-message BarRequest {}
-message BarResponse {}
-
-message TestEmptyMessage {}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs b/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs
deleted file mode 100644
index c76d7ca125..0000000000
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2017 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.
-#endregion
-
-using NUnit.Framework;
-using System.Collections.Generic;
-using System.Linq;
-using static Google.Protobuf.Collections.ProtobufEqualityComparers;
-
-namespace Google.Protobuf.Collections
-{
- public class ProtobufEqualityComparersTest
- {
- private static readonly double[] doubles =
- {
- 0,
- 1,
- 1.5,
- -1.5,
- double.PositiveInfinity,
- double.NegativeInfinity,
- // Three different types of NaN...
- SampleNaNs.Regular,
- SampleNaNs.SignallingFlipped,
- SampleNaNs.PayloadFlipped
- };
-
- [Test]
- public void GetEqualityComparer_Default()
- {
- // It's more pain than it's worth to try to parameterize these tests.
- Assert.AreSame(EqualityComparer<object>.Default, GetEqualityComparer<object>());
- Assert.AreSame(EqualityComparer<string>.Default, GetEqualityComparer<string>());
- Assert.AreSame(EqualityComparer<int>.Default, GetEqualityComparer<int>());
- Assert.AreSame(EqualityComparer<int?>.Default, GetEqualityComparer<int?>());
- }
-
- [Test]
- public void GetEqualityComparer_NotDefault()
- {
- // It's more pain than it's worth to try to parameterize these tests.
- Assert.AreSame(BitwiseDoubleEqualityComparer, GetEqualityComparer<double>());
- Assert.AreSame(BitwiseSingleEqualityComparer, GetEqualityComparer<float>());
- Assert.AreSame(BitwiseNullableDoubleEqualityComparer, GetEqualityComparer<double?>());
- Assert.AreSame(BitwiseNullableSingleEqualityComparer, GetEqualityComparer<float?>());
- }
-
- [Test]
- public void DoubleComparisons()
- {
- ValidateEqualityComparer(BitwiseDoubleEqualityComparer, doubles);
- }
-
- [Test]
- public void NullableDoubleComparisons()
- {
- ValidateEqualityComparer(BitwiseNullableDoubleEqualityComparer, doubles.Select(d => (double?) d).Concat(new double?[] { null }));
- }
-
- [Test]
- public void SingleComparisons()
- {
- ValidateEqualityComparer(BitwiseSingleEqualityComparer, doubles.Select(d => (float) d));
- }
-
- [Test]
- public void NullableSingleComparisons()
- {
- ValidateEqualityComparer(BitwiseNullableSingleEqualityComparer, doubles.Select(d => (float?) d).Concat(new float?[] { null }));
- }
-
- private static void ValidateEqualityComparer<T>(EqualityComparer<T> comparer, IEnumerable<T> values)
- {
- var array = values.ToArray();
- // Each value should be equal to itself, but not to any other value.
- for (int i = 0; i < array.Length; i++)
- {
- for (int j = 0; j < array.Length; j++)
- {
- if (i == j)
- {
- Assert.IsTrue(comparer.Equals(array[i], array[j]),
- "{0} should be equal to itself", array[i], array[j]);
- }
- else
- {
- Assert.IsFalse(comparer.Equals(array[i], array[j]),
- "{0} and {1} should not be equal", array[i], array[j]);
- Assert.AreNotEqual(comparer.GetHashCode(array[i]), comparer.GetHashCode(array[j]),
- "Hash codes for {0} and {1} should not be equal", array[i], array[j]);
- }
- }
- }
- }
- }
-}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs b/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs
deleted file mode 100644
index ddf623219a..0000000000
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-#region Copyright notice and license
-// 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.
-#endregion
-
-using System;
-using System.IO;
-using Google.Protobuf.TestProtos;
-using NUnit.Framework;
-
-namespace Google.Protobuf
-{
- public class UnknownFieldSetTest
- {
- [Test]
- public void EmptyUnknownFieldSet()
- {
- UnknownFieldSet unknownFields = new UnknownFieldSet();
- Assert.AreEqual(0, unknownFields.CalculateSize());
- }
-
- [Test]
- public void MergeUnknownFieldSet()
- {
- UnknownFieldSet unknownFields = new UnknownFieldSet();
- UnknownField field = new UnknownField();
- field.AddFixed32(123);
- unknownFields.AddOrReplaceField(1, field);
- UnknownFieldSet otherUnknownFields = new UnknownFieldSet();
- Assert.IsFalse(otherUnknownFields.HasField(1));
- UnknownFieldSet.MergeFrom(otherUnknownFields, unknownFields);
- Assert.IsTrue(otherUnknownFields.HasField(1));
- }
-
- [Test]
- public void TestMergeCodedInput()
- {
- var message = SampleMessages.CreateFullTestAllTypes();
- var emptyMessage = new TestEmptyMessage();
- emptyMessage.MergeFrom(message.ToByteArray());
- Assert.AreEqual(message.CalculateSize(), emptyMessage.CalculateSize());
- Assert.AreEqual(message.ToByteArray(), emptyMessage.ToByteArray());
-
- var newMessage = new TestAllTypes();
- newMessage.MergeFrom(emptyMessage.ToByteArray());
- Assert.AreEqual(message, newMessage);
- Assert.AreEqual(message.CalculateSize(), newMessage.CalculateSize());
- }
-
- [Test]
- public void TestMergeMessage()
- {
- var message = SampleMessages.CreateFullTestAllTypes();
- var emptyMessage = new TestEmptyMessage();
- var otherEmptyMessage = new TestEmptyMessage();
- emptyMessage.MergeFrom(message.ToByteArray());
- otherEmptyMessage.MergeFrom(emptyMessage);
-
- Assert.AreEqual(message.CalculateSize(), otherEmptyMessage.CalculateSize());
- Assert.AreEqual(message.ToByteArray(), otherEmptyMessage.ToByteArray());
- }
-
- [Test]
- public void TestEquals()
- {
- var message = SampleMessages.CreateFullTestAllTypes();
- var emptyMessage = new TestEmptyMessage();
- var otherEmptyMessage = new TestEmptyMessage();
- Assert.AreEqual(emptyMessage, otherEmptyMessage);
- emptyMessage.MergeFrom(message.ToByteArray());
- Assert.AreNotEqual(emptyMessage.CalculateSize(),
- otherEmptyMessage.CalculateSize());
- Assert.AreNotEqual(emptyMessage, otherEmptyMessage);
- }
-
- [Test]
- public void TestHashCode()
- {
- var message = SampleMessages.CreateFullTestAllTypes();
- var emptyMessage = new TestEmptyMessage();
- int hashCode = emptyMessage.GetHashCode();
- emptyMessage.MergeFrom(message.ToByteArray());
- Assert.AreNotEqual(hashCode, emptyMessage.GetHashCode());
- }
-
- [Test]
- public void TestClone()
- {
- var emptyMessage = new TestEmptyMessage();
- var otherEmptyMessage = new TestEmptyMessage();
- otherEmptyMessage = emptyMessage.Clone();
- Assert.AreEqual(emptyMessage.CalculateSize(), otherEmptyMessage.CalculateSize());
- Assert.AreEqual(emptyMessage.ToByteArray(), otherEmptyMessage.ToByteArray());
-
- var message = SampleMessages.CreateFullTestAllTypes();
- emptyMessage.MergeFrom(message.ToByteArray());
- otherEmptyMessage = emptyMessage.Clone();
- Assert.AreEqual(message.CalculateSize(), otherEmptyMessage.CalculateSize());
- Assert.AreEqual(message.ToByteArray(), otherEmptyMessage.ToByteArray());
- }
-
- [Test]
- public void TestDiscardUnknownFields()
- {
- var message = SampleMessages.CreateFullTestAllTypes();
- var goldenEmptyMessage = new TestEmptyMessage();
- byte[] data = message.ToByteArray();
- int fullSize = message.CalculateSize();
-
- Action<IMessage> assertEmpty = msg =>
- {
- Assert.AreEqual(0, msg.CalculateSize());
- Assert.AreEqual(goldenEmptyMessage, msg);
- };
-
- Action<IMessage> assertFull = msg => Assert.AreEqual(fullSize, msg.CalculateSize());
-
- // Test the behavior of the parsers with and without discarding, both generic and non-generic.
- MessageParser<TestEmptyMessage> retainingParser1 = TestEmptyMessage.Parser;
- MessageParser retainingParser2 = retainingParser1;
- MessageParser<TestEmptyMessage> discardingParser1 = retainingParser1.WithDiscardUnknownFields(true);
- MessageParser discardingParser2 = retainingParser2.WithDiscardUnknownFields(true);
-
- // Test parse from byte[]
- assertFull(retainingParser1.ParseFrom(data));
- assertFull(retainingParser2.ParseFrom(data));
- assertEmpty(discardingParser1.ParseFrom(data));
- assertEmpty(discardingParser2.ParseFrom(data));
-
- // Test parse from byte[] with offset
- assertFull(retainingParser1.ParseFrom(data, 0, data.Length));
- assertFull(retainingParser2.ParseFrom(data, 0, data.Length));
- assertEmpty(discardingParser1.ParseFrom(data, 0, data.Length));
- assertEmpty(discardingParser2.ParseFrom(data, 0, data.Length));
-
- // Test parse from CodedInputStream
- assertFull(retainingParser1.ParseFrom(new CodedInputStream(data)));
- assertFull(retainingParser2.ParseFrom(new CodedInputStream(data)));
- assertEmpty(discardingParser1.ParseFrom(new CodedInputStream(data)));
- assertEmpty(discardingParser2.ParseFrom(new CodedInputStream(data)));
-
- // Test parse from Stream
- assertFull(retainingParser1.ParseFrom(new MemoryStream(data)));
- assertFull(retainingParser2.ParseFrom(new MemoryStream(data)));
- assertEmpty(discardingParser1.ParseFrom(new MemoryStream(data)));
- assertEmpty(discardingParser2.ParseFrom(new MemoryStream(data)));
- }
- }
-}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/Lists.cs b/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/Lists.cs
deleted file mode 100644
index 860795ceef..0000000000
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/Lists.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2017 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.
-#endregion
-
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Google.Protobuf.Collections
-{
- /// <summary>
- /// Utility to compare if two Lists are the same, and the hash code
- /// of a List.
- /// </summary>
- public static class Lists
- {
- /// <summary>
- /// Checks if two lists are equal.
- /// </summary>
- public static bool Equals<T>(List<T> left, List<T> right)
- {
- if (left == right)
- {
- return true;
- }
- if (left == null || right == null)
- {
- return false;
- }
- if (left.Count != right.Count)
- {
- return false;
- }
- IEqualityComparer<T> comparer = EqualityComparer<T>.Default;
- for (int i = 0; i < left.Count; i++)
- {
- if (!comparer.Equals(left[i], right[i]))
- {
- return false;
- }
- }
- return true;
- }
-
- /// <summary>
- /// Gets the list's hash code.
- /// </summary>
- public static int GetHashCode<T>(List<T> list)
- {
- if (list == null)
- {
- return 0;
- }
- int hash = 31;
- foreach (T element in list)
- {
- hash = hash * 29 + element.GetHashCode();
- }
- return hash;
- }
- }
-} \ No newline at end of file
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs b/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs
deleted file mode 100644
index 13ef60fca5..0000000000
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2017 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.
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Google.Protobuf.Collections
-{
- /// <summary>
- /// Provides a central place to implement equality comparisons, primarily for bitwise float/double equality.
- /// </summary>
- public static class ProtobufEqualityComparers
- {
- /// <summary>
- /// Returns an equality comparer for <typeparamref name="T"/> suitable for Protobuf equality comparisons.
- /// This is usually just the default equality comparer for the type, but floating point numbers are compared
- /// bitwise.
- /// </summary>
- /// <typeparam name="T">The type of equality comparer to return.</typeparam>
- /// <returns>The equality comparer.</returns>
- public static EqualityComparer<T> GetEqualityComparer<T>()
- {
- return typeof(T) == typeof(double) ? (EqualityComparer<T>) (object) BitwiseDoubleEqualityComparer
- : typeof(T) == typeof(float) ? (EqualityComparer<T>) (object) BitwiseSingleEqualityComparer
- : typeof(T) == typeof(double?) ? (EqualityComparer<T>) (object) BitwiseNullableDoubleEqualityComparer
- : typeof(T) == typeof(float?) ? (EqualityComparer<T>) (object) BitwiseNullableSingleEqualityComparer
- : EqualityComparer<T>.Default;
- }
-
- /// <summary>
- /// Returns an equality comparer suitable for comparing 64-bit floating point values, by bitwise comparison.
- /// (NaN values are considered equal, but only when they have the same representation.)
- /// </summary>
- public static EqualityComparer<double> BitwiseDoubleEqualityComparer { get; } = new BitwiseDoubleEqualityComparerImpl();
-
- /// <summary>
- /// Returns an equality comparer suitable for comparing 32-bit floating point values, by bitwise comparison.
- /// (NaN values are considered equal, but only when they have the same representation.)
- /// </summary>
- public static EqualityComparer<float> BitwiseSingleEqualityComparer { get; } = new BitwiseSingleEqualityComparerImpl();
-
- /// <summary>
- /// Returns an equality comparer suitable for comparing nullable 64-bit floating point values, by bitwise comparison.
- /// (NaN values are considered equal, but only when they have the same representation.)
- /// </summary>
- public static EqualityComparer<double?> BitwiseNullableDoubleEqualityComparer { get; } = new BitwiseNullableDoubleEqualityComparerImpl();
-
- /// <summary>
- /// Returns an equality comparer suitable for comparing nullable 32-bit floating point values, by bitwise comparison.
- /// (NaN values are considered equal, but only when they have the same representation.)
- /// </summary>
- public static EqualityComparer<float?> BitwiseNullableSingleEqualityComparer { get; } = new BitwiseNullableSingleEqualityComparerImpl();
-
- private class BitwiseDoubleEqualityComparerImpl : EqualityComparer<double>
- {
- public override bool Equals(double x, double y) =>
- BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y);
-
- public override int GetHashCode(double obj) =>
- BitConverter.DoubleToInt64Bits(obj).GetHashCode();
- }
-
- private class BitwiseSingleEqualityComparerImpl : EqualityComparer<float>
- {
- // Just promote values to double and use BitConverter.DoubleToInt64Bits,
- // as there's no BitConverter.SingleToInt32Bits, unfortunately.
-
- public override bool Equals(float x, float y) =>
- BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y);
-
- public override int GetHashCode(float obj) =>
- BitConverter.DoubleToInt64Bits(obj).GetHashCode();
- }
-
- private class BitwiseNullableDoubleEqualityComparerImpl : EqualityComparer<double?>
- {
- public override bool Equals(double? x, double? y) =>
- x == null && y == null ? true
- : x == null || y == null ? false
- : BitwiseDoubleEqualityComparer.Equals(x.Value, y.Value);
-
- // The hash code for null is just a constant which is at least *unlikely* to be used
- // elsewhere. (Compared with 0, say.)
- public override int GetHashCode(double? obj) =>
- obj == null ? 293864 : BitwiseDoubleEqualityComparer.GetHashCode(obj.Value);
- }
-
- private class BitwiseNullableSingleEqualityComparerImpl : EqualityComparer<float?>
- {
- public override bool Equals(float? x, float? y) =>
- x == null && y == null ? true
- : x == null || y == null ? false
- : BitwiseSingleEqualityComparer.Equals(x.Value, y.Value);
-
- // The hash code for null is just a constant which is at least *unlikely* to be used
- // elsewhere. (Compared with 0, say.)
- public override int GetHashCode(float? obj) =>
- obj == null ? 293864 : BitwiseSingleEqualityComparer.GetHashCode(obj.Value);
- }
- }
-}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs b/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs
deleted file mode 100644
index feaeba0ee7..0000000000
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs
+++ /dev/null
@@ -1,205 +0,0 @@
-#region Copyright notice and license
-// 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.
-#endregion
-
-using Google.Protobuf.Compatibility;
-using System;
-using System.Reflection;
-
-namespace Google.Protobuf.Reflection
-{
- /// <summary>
- /// The methods in this class are somewhat evil, and should not be tampered with lightly.
- /// Basically they allow the creation of relatively weakly typed delegates from MethodInfos
- /// which are more strongly typed. They do this by creating an appropriate strongly typed
- /// delegate from the MethodInfo, and then calling that within an anonymous method.
- /// Mind-bending stuff (at least to your humble narrator) but the resulting delegates are
- /// very fast compared with calling Invoke later on.
- /// </summary>
- internal static class ReflectionUtil
- {
- static ReflectionUtil()
- {
- ForceInitialize<string>(); // Handles all reference types
- ForceInitialize<int>();
- ForceInitialize<long>();
- ForceInitialize<uint>();
- ForceInitialize<ulong>();
- ForceInitialize<float>();
- ForceInitialize<double>();
- ForceInitialize<bool>();
- ForceInitialize<int?>();
- ForceInitialize<long?>();
- ForceInitialize<uint?>();
- ForceInitialize<ulong?>();
- ForceInitialize<float?>();
- ForceInitialize<double?>();
- ForceInitialize<bool?>();
- ForceInitialize<SampleEnum>();
- SampleEnumMethod();
- }
-
- internal static void ForceInitialize<T>() => new ReflectionHelper<IMessage, T>();
-
- /// <summary>
- /// Empty Type[] used when calling GetProperty to force property instead of indexer fetching.
- /// </summary>
- internal static readonly Type[] EmptyTypes = new Type[0];
-
- /// <summary>
- /// Creates a delegate which will cast the argument to the type that declares the method,
- /// call the method on it, then convert the result to object.
- /// </summary>
- /// <param name="method">The method to create a delegate for, which must be declared in an IMessage
- /// implementation.</param>
- internal static Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method) =>
- GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageObject(method);
-
- /// <summary>
- /// Creates a delegate which will cast the argument to the type that declares the method,
- /// call the method on it, then convert the result to the specified type. The method is expected
- /// to actually return an enum (because of where we're calling it - for oneof cases). Sometimes that
- /// means we need some extra work to perform conversions.
- /// </summary>
- /// <param name="method">The method to create a delegate for, which must be declared in an IMessage
- /// implementation.</param>
- internal static Func<IMessage, int> CreateFuncIMessageInt32(MethodInfo method) =>
- GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageInt32(method);
-
- /// <summary>
- /// Creates a delegate which will execute the given method after casting the first argument to
- /// the type that declares the method, and the second argument to the first parameter type of the method.
- /// </summary>
- /// <param name="method">The method to create a delegate for, which must be declared in an IMessage
- /// implementation.</param>
- internal static Action<IMessage, object> CreateActionIMessageObject(MethodInfo method) =>
- GetReflectionHelper(method.DeclaringType, method.GetParameters()[0].ParameterType).CreateActionIMessageObject(method);
-
- /// <summary>
- /// Creates a delegate which will execute the given method after casting the first argument to
- /// type that declares the method.
- /// </summary>
- /// <param name="method">The method to create a delegate for, which must be declared in an IMessage
- /// implementation.</param>
- internal static Action<IMessage> CreateActionIMessage(MethodInfo method) =>
- GetReflectionHelper(method.DeclaringType, typeof(object)).CreateActionIMessage(method);
-
- /// <summary>
- /// Creates a reflection helper for the given type arguments. Currently these are created on demand
- /// rather than cached; this will be "busy" when initially loading a message's descriptor, but after that
- /// they can be garbage collected. We could cache them by type if that proves to be important, but creating
- /// an object is pretty cheap.
- /// </summary>
- private static IReflectionHelper GetReflectionHelper(Type t1, Type t2) =>
- (IReflectionHelper) Activator.CreateInstance(typeof(ReflectionHelper<,>).MakeGenericType(t1, t2));
-
- // Non-generic interface allowing us to use an instance of ReflectionHelper<T1, T2> without statically
- // knowing the types involved.
- private interface IReflectionHelper
- {
- Func<IMessage, int> CreateFuncIMessageInt32(MethodInfo method);
- Action<IMessage> CreateActionIMessage(MethodInfo method);
- Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method);
- Action<IMessage, object> CreateActionIMessageObject(MethodInfo method);
- }
-
- private class ReflectionHelper<T1, T2> : IReflectionHelper
- {
-
- public Func<IMessage, int> CreateFuncIMessageInt32(MethodInfo method)
- {
- // On pleasant runtimes, we can create a Func<int> from a method returning
- // an enum based on an int. That's the fast path.
- if (CanConvertEnumFuncToInt32Func)
- {
- var del = (Func<T1, int>) method.CreateDelegate(typeof(Func<T1, int>));
- return message => del((T1) message);
- }
- else
- {
- // On some runtimes (e.g. old Mono) the return type has to be exactly correct,
- // so we go via boxing. Reflection is already fairly inefficient, and this is
- // only used for one-of case checking, fortunately.
- var del = (Func<T1, T2>) method.CreateDelegate(typeof(Func<T1, T2>));
- return message => (int) (object) del((T1) message);
- }
- }
-
- public Action<IMessage> CreateActionIMessage(MethodInfo method)
- {
- var del = (Action<T1>) method.CreateDelegate(typeof(Action<T1>));
- return message => del((T1) message);
- }
-
- public Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method)
- {
- var del = (Func<T1, T2>) method.CreateDelegate(typeof(Func<T1, T2>));
- return message => del((T1) message);
- }
-
- public Action<IMessage, object> CreateActionIMessageObject(MethodInfo method)
- {
- var del = (Action<T1, T2>) method.CreateDelegate(typeof(Action<T1, T2>));
- return (message, arg) => del((T1) message, (T2) arg);
- }
- }
-
- // Runtime compatibility checking code - see ReflectionHelper<T1, T2>.CreateFuncIMessageInt32 for
- // details about why we're doing this.
-
- // Deliberately not inside the generic type. We only want to check this once.
- private static bool CanConvertEnumFuncToInt32Func { get; } = CheckCanConvertEnumFuncToInt32Func();
-
- private static bool CheckCanConvertEnumFuncToInt32Func()
- {
- try
- {
- // Try to do the conversion using reflection, so we can see whether it's supported.
- MethodInfo method = typeof(ReflectionUtil).GetMethod(nameof(SampleEnumMethod));
- // If this passes, we're in a reasonable runtime.
- method.CreateDelegate(typeof(Func<int>));
- return true;
- }
- catch (ArgumentException)
- {
- return false;
- }
- }
-
- public enum SampleEnum
- {
- X
- }
-
- // Public to make the reflection simpler.
- public static SampleEnum SampleEnumMethod() => SampleEnum.X;
- }
-}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/UnknownField.cs b/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/UnknownField.cs
deleted file mode 100644
index 0d6eed6357..0000000000
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/UnknownField.cs
+++ /dev/null
@@ -1,263 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2017 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.
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using Google.Protobuf.Collections;
-
-namespace Google.Protobuf
-{
- /// <summary>
- /// Represents a single field in an UnknownFieldSet.
- ///
- /// An UnknownField consists of four lists of values. The lists correspond
- /// to the four "wire types" used in the protocol buffer binary format.
- /// Normally, only one of the four lists will contain any values, since it
- /// is impossible to define a valid message type that declares two different
- /// types for the same field number. However, the code is designed to allow
- /// for the case where the same unknown field number is encountered using
- /// multiple different wire types.
- ///
- /// </summary>
- internal sealed class UnknownField
- {
- private List<ulong> varintList;
- private List<uint> fixed32List;
- private List<ulong> fixed64List;
- private List<ByteString> lengthDelimitedList;
-
- /// <summary>
- /// Creates a new UnknownField.
- /// </summary>
- public UnknownField()
- {
- }
-
- /// <summary>
- /// Checks if two unknown field are equal.
- /// </summary>
- public override bool Equals(object other)
- {
- if (ReferenceEquals(this, other))
- {
- return true;
- }
- UnknownField otherField = other as UnknownField;
- return otherField != null
- && Lists.Equals(varintList, otherField.varintList)
- && Lists.Equals(fixed32List, otherField.fixed32List)
- && Lists.Equals(fixed64List, otherField.fixed64List)
- && Lists.Equals(lengthDelimitedList, otherField.lengthDelimitedList);
- }
-
- /// <summary>
- /// Get the hash code of the unknown field.
- /// </summary>
- public override int GetHashCode()
- {
- int hash = 43;
- hash = hash * 47 + Lists.GetHashCode(varintList);
- hash = hash * 47 + Lists.GetHashCode(fixed32List);
- hash = hash * 47 + Lists.GetHashCode(fixed64List);
- hash = hash * 47 + Lists.GetHashCode(lengthDelimitedList);
- return hash;
- }
-
- /// <summary>
- /// Serializes the field, including the field number, and writes it to
- /// <paramref name="output"/>
- /// </summary>
- /// <param name="fieldNumber">The unknown field number.</param>
- /// <param name="output">The CodedOutputStream to write to.</param>
- internal void WriteTo(int fieldNumber, CodedOutputStream output)
- {
- if (varintList != null)
- {
- foreach (ulong value in varintList)
- {
- output.WriteTag(fieldNumber, WireFormat.WireType.Varint);
- output.WriteUInt64(value);
- }
- }
- if (fixed32List != null)
- {
- foreach (uint value in fixed32List)
- {
- output.WriteTag(fieldNumber, WireFormat.WireType.Fixed32);
- output.WriteFixed32(value);
- }
- }
- if (fixed64List != null)
- {
- foreach (ulong value in fixed64List)
- {
- output.WriteTag(fieldNumber, WireFormat.WireType.Fixed64);
- output.WriteFixed64(value);
- }
- }
- if (lengthDelimitedList != null)
- {
- foreach (ByteString value in lengthDelimitedList)
- {
- output.WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited);
- output.WriteBytes(value);
- }
- }
- }
-
- /// <summary>
- /// Computes the number of bytes required to encode this field, including field
- /// number.
- /// </summary>
- internal int GetSerializedSize(int fieldNumber)
- {
- int result = 0;
- if (varintList != null)
- {
- result += CodedOutputStream.ComputeTagSize(fieldNumber) * varintList.Count;
- foreach (ulong value in varintList)
- {
- result += CodedOutputStream.ComputeUInt64Size(value);
- }
- }
- if (fixed32List != null)
- {
- result += CodedOutputStream.ComputeTagSize(fieldNumber) * fixed32List.Count;
- result += CodedOutputStream.ComputeFixed32Size(1) * fixed32List.Count;
- }
- if (fixed64List != null)
- {
- result += CodedOutputStream.ComputeTagSize(fieldNumber) * fixed64List.Count;
- result += CodedOutputStream.ComputeFixed64Size(1) * fixed64List.Count;
- }
- if (lengthDelimitedList != null)
- {
- result += CodedOutputStream.ComputeTagSize(fieldNumber) * lengthDelimitedList.Count;
- foreach (ByteString value in lengthDelimitedList)
- {
- result += CodedOutputStream.ComputeBytesSize(value);
- }
- }
- return result;
- }
-
- /// <summary>
- /// Merge the values in <paramref name="other" /> into this field. For each list
- /// of values, <paramref name="other"/>'s values are append to the ones in this
- /// field.
- /// </summary>
- internal UnknownField MergeFrom(UnknownField other)
- {
- varintList = AddAll(varintList, other.varintList);
- fixed32List = AddAll(fixed32List, other.fixed32List);
- fixed64List = AddAll(fixed64List, other.fixed64List);
- lengthDelimitedList = AddAll(lengthDelimitedList, other.lengthDelimitedList);
- return this;
- }
-
- /// <summary>
- /// Returns a new list containing all of the given specified values from
- /// both the <paramref name="current"/> and <paramref name="extras"/> lists.
- /// If <paramref name="current" /> is null and <paramref name="extras"/> is empty,
- /// null is returned. Otherwise, either a new list is created (if <paramref name="current" />
- /// is null) or the elements of <paramref name="extras"/> are added to <paramref name="current" />.
- /// </summary>
- private static List<T> AddAll<T>(List<T> current, IList<T> extras)
- {
- if (extras.Count == 0)
- {
- return current;
- }
- if (current == null)
- {
- current = new List<T>(extras);
- }
- else
- {
- current.AddRange(extras);
- }
- return current;
- }
-
- /// <summary>
- /// Adds a varint value.
- /// </summary>
- internal UnknownField AddVarint(ulong value)
- {
- varintList = Add(varintList, value);
- return this;
- }
-
- /// <summary>
- /// Adds a fixed32 value.
- /// </summary>
- internal UnknownField AddFixed32(uint value)
- {
- fixed32List = Add(fixed32List, value);
- return this;
- }
-
- /// <summary>
- /// Adds a fixed64 value.
- /// </summary>
- internal UnknownField AddFixed64(ulong value)
- {
- fixed64List = Add(fixed64List, value);
- return this;
- }
-
- /// <summary>
- /// Adds a length-delimited value.
- /// </summary>
- internal UnknownField AddLengthDelimited(ByteString value)
- {
- lengthDelimitedList = Add(lengthDelimitedList, value);
- return this;
- }
-
- /// <summary>
- /// Adds <paramref name="value"/> to the <paramref name="list"/>, creating
- /// a new list if <paramref name="list"/> is null. The list is returned - either
- /// the original reference or the new list.
- /// </summary>
- private static List<T> Add<T>(List<T> list, T value)
- {
- if (list == null)
- {
- list = new List<T>();
- }
- list.Add(value);
- return list;
- }
- }
-}
diff --git a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/UnknownFieldSet.cs b/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/UnknownFieldSet.cs
deleted file mode 100644
index 6404c3c08f..0000000000
--- a/third_party/protobuf/3.6.0/csharp/src/Google.Protobuf/UnknownFieldSet.cs
+++ /dev/null
@@ -1,330 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 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.
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Google.Protobuf.Reflection;
-
-namespace Google.Protobuf
-{
- /// <summary>
- /// Used to keep track of fields which were seen when parsing a protocol message
- /// but whose field numbers or types are unrecognized. This most frequently
- /// occurs when new fields are added to a message type and then messages containing
- /// those fields are read by old software that was built before the new types were
- /// added.
- ///
- /// Most users will never need to use this class directly.
- /// </summary>
- public sealed partial class UnknownFieldSet
- {
- private readonly IDictionary<int, UnknownField> fields;
-
- /// <summary>
- /// Creates a new UnknownFieldSet.
- /// </summary>
- internal UnknownFieldSet()
- {
- this.fields = new Dictionary<int, UnknownField>();
- }
-
- /// <summary>
- /// Checks whether or not the given field number is present in the set.
- /// </summary>
- internal bool HasField(int field)
- {
- return fields.ContainsKey(field);
- }
-
- /// <summary>
- /// Serializes the set and writes it to <paramref name="output"/>.
- /// </summary>
- public void WriteTo(CodedOutputStream output)
- {
- foreach (KeyValuePair<int, UnknownField> entry in fields)
- {
- entry.Value.WriteTo(entry.Key, output);
- }
- }
-
- /// <summary>
- /// Gets the number of bytes required to encode this set.
- /// </summary>
- public int CalculateSize()
- {
- int result = 0;
- foreach (KeyValuePair<int, UnknownField> entry in fields)
- {
- result += entry.Value.GetSerializedSize(entry.Key);
- }
- return result;
- }
-
- /// <summary>
- /// Checks if two unknown field sets are equal.
- /// </summary>
- public override bool Equals(object other)
- {
- if (ReferenceEquals(this, other))
- {
- return true;
- }
- UnknownFieldSet otherSet = other as UnknownFieldSet;
- IDictionary<int, UnknownField> otherFields = otherSet.fields;
- if (fields.Count != otherFields.Count)
- {
- return false;
- }
- foreach (KeyValuePair<int, UnknownField> leftEntry in fields)
- {
- UnknownField rightValue;
- if (!otherFields.TryGetValue(leftEntry.Key, out rightValue))
- {
- return false;
- }
- if (!leftEntry.Value.Equals(rightValue))
- {
- return false;
- }
- }
- return true;
- }
-
- /// <summary>
- /// Gets the unknown field set's hash code.
- /// </summary>
- public override int GetHashCode()
- {
- int ret = 1;
- foreach (KeyValuePair<int, UnknownField> field in fields)
- {
- // Use ^ here to make the field order irrelevant.
- int hash = field.Key.GetHashCode() ^ field.Value.GetHashCode();
- ret ^= hash;
- }
- return ret;
- }
-
- // Optimization: We keep around the last field that was
- // modified so that we can efficiently add to it multiple times in a
- // row (important when parsing an unknown repeated field).
- private int lastFieldNumber;
- private UnknownField lastField;
-
- private UnknownField GetOrAddField(int number)
- {
- if (lastField != null && number == lastFieldNumber)
- {
- return lastField;
- }
- if (number == 0)
- {
- return null;
- }
-
- UnknownField existing;
- if (fields.TryGetValue(number, out existing))
- {
- return existing;
- }
- lastField = new UnknownField();
- AddOrReplaceField(number, lastField);
- lastFieldNumber = number;
- return lastField;
- }
-
- /// <summary>
- /// Adds a field to the set. If a field with the same number already exists, it
- /// is replaced.
- /// </summary>
- internal UnknownFieldSet AddOrReplaceField(int number, UnknownField field)
- {
- if (number == 0)
- {
- throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number.");
- }
- fields[number] = field;
- return this;
- }
-
- /// <summary>
- /// Parse a single field from <paramref name="input"/> and merge it
- /// into this set.
- /// </summary>
- /// <param name="input">The coded input stream containing the field</param>
- /// <returns>false if the tag is an "end group" tag, true otherwise</returns>
- private void MergeFieldFrom(CodedInputStream input)
- {
- uint tag = input.LastTag;
- int number = WireFormat.GetTagFieldNumber(tag);
- switch (WireFormat.GetTagWireType(tag))
- {
- case WireFormat.WireType.Varint:
- {
- ulong uint64 = input.ReadUInt64();
- GetOrAddField(number).AddVarint(uint64);
- return;
- }
- case WireFormat.WireType.Fixed32:
- {
- uint uint32 = input.ReadFixed32();
- GetOrAddField(number).AddFixed32(uint32);
- return;
- }
- case WireFormat.WireType.Fixed64:
- {
- ulong uint64 = input.ReadFixed64();
- GetOrAddField(number).AddFixed64(uint64);
- return;
- }
- case WireFormat.WireType.LengthDelimited:
- {
- ByteString bytes = input.ReadBytes();
- GetOrAddField(number).AddLengthDelimited(bytes);
- return;
- }
- case WireFormat.WireType.StartGroup:
- {
- input.SkipGroup(tag);
- return;
- }
- case WireFormat.WireType.EndGroup:
- {
- throw new InvalidProtocolBufferException("Merge an unknown field of end-group tag, indicating that the corresponding start-group was missing.");
- }
- default:
- throw new InvalidOperationException("Wire Type is invalid.");
- }
- }
-
- /// <summary>
- /// Create a new UnknownFieldSet if unknownFields is null.
- /// Parse a single field from <paramref name="input"/> and merge it
- /// into unknownFields. If <paramref name="input"/> is configured to discard unknown fields,
- /// <paramref name="unknownFields"/> will be returned as-is and the field will be skipped.
- /// </summary>
- /// <param name="unknownFields">The UnknownFieldSet which need to be merged</param>
- /// <param name="input">The coded input stream containing the field</param>
- /// <returns>The merged UnknownFieldSet</returns>
- public static UnknownFieldSet MergeFieldFrom(UnknownFieldSet unknownFields,
- CodedInputStream input)
- {
- if (input.DiscardUnknownFields)
- {
- input.SkipLastField();
- return unknownFields;
- }
- if (unknownFields == null)
- {
- unknownFields = new UnknownFieldSet();
- }
- unknownFields.MergeFieldFrom(input);
- return unknownFields;
- }
-
- /// <summary>
- /// Merges the fields from <paramref name="other"/> into this set.
- /// If a field number exists in both sets, the values in <paramref name="other"/>
- /// will be appended to the values in this set.
- /// </summary>
- private UnknownFieldSet MergeFrom(UnknownFieldSet other)
- {
- if (other != null)
- {
- foreach (KeyValuePair<int, UnknownField> entry in other.fields)
- {
- MergeField(entry.Key, entry.Value);
- }
- }
- return this;
- }
-
- /// <summary>
- /// Created a new UnknownFieldSet to <paramref name="unknownFields"/> if
- /// needed and merges the fields from <paramref name="other"/> into the first set.
- /// If a field number exists in both sets, the values in <paramref name="other"/>
- /// will be appended to the values in this set.
- /// </summary>
- public static UnknownFieldSet MergeFrom(UnknownFieldSet unknownFields,
- UnknownFieldSet other)
- {
- if (other == null)
- {
- return unknownFields;
- }
- if (unknownFields == null)
- {
- unknownFields = new UnknownFieldSet();
- }
- unknownFields.MergeFrom(other);
- return unknownFields;
- }
-
-
- /// <summary>
- /// Adds a field to the unknown field set. If a field with the same
- /// number already exists, the two are merged.
- /// </summary>
- private UnknownFieldSet MergeField(int number, UnknownField field)
- {
- if (number == 0)
- {
- throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number.");
- }
- if (HasField(number))
- {
- GetOrAddField(number).MergeFrom(field);
- }
- else
- {
- AddOrReplaceField(number, field);
- }
- return this;
- }
-
- /// <summary>
- /// Clone an unknown field set from <paramref name="other"/>.
- /// </summary>
- public static UnknownFieldSet Clone(UnknownFieldSet other)
- {
- if (other == null)
- {
- return null;
- }
- UnknownFieldSet unknownFields = new UnknownFieldSet();
- unknownFields.MergeFrom(other);
- return unknownFields;
- }
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/docs/performance.md b/third_party/protobuf/3.6.0/docs/performance.md
deleted file mode 100644
index 6a5316c801..0000000000
--- a/third_party/protobuf/3.6.0/docs/performance.md
+++ /dev/null
@@ -1,304 +0,0 @@
-# Protobuf Perforamcne
-This benchmark result is tested on workstation with processor of Intel® Xeon® Processor E5-2630 and 32GB RAM
-
-This table contains 3 languages' results:
-
-* **C++** - For C++ there're 3 kinds of parsing ways:
- * **new** - This is for using new operator for creating message instance.
- * **new arena** - This is for using arena for creating new message instance.
- * **reuse** - This is for reusing the same message instance for parsing.
-* **Java** - For Java there're 3 kinds of parsing/Serialization ways:
- * **byte[]** - This is for parsing from a Byte Array.
- * **ByteString** - This is for parsing from a
- com.google.protobuf.ByteString.
- * **InputStream** - This is for parsing from a InputStream
-* **Python** - For Pythong there're 3 kinds of python protobuf for testing:
- * **C++-genereated-code** - This is for using cpp generated code of the
- proto file as dynamic linked library.
- * **C++-reflection** - This is for using cpp reflection, which there's no
- generated code, but still using cpp protobuf library as dynamic linked
- library.
- * **pure-Python** - This is for pure Python version, which don't link with
- any cpp protobuf library.
-
-## Parsing performance
-
-<table>
-<tbody><tr>
-<th rowspan="2"> </th>
-<th colspan="3" rowspan="1">C++</th>
-<th colspan="3" rowspan="1">C++ with tcmalloc</th>
-<th colspan="3" rowspan="1">java</th>
-<th colspan="3" rowspan="1">python</th>
-</tr>
-<tr>
-<th colspan="1">new</th>
-<th colspan="1">new arena</th>
-<th colspan="1">reuse</th>
-<th colspan="1">new</th>
-<th colspan="1">new arena</th>
-<th colspan="1">reuse</th>
-<th colspan="1">byte[]</th>
-<th colspan="1">ByteString</th>
-<th colspan="1">InputStream</th>
-<th colspan="1">C++-generated-code</th>
-<th colspan="1">C++-reflection</th>
-<th colspan="1">pure-Python</th>
-</tr>
-<tr>
-<td>google_message1_proto2</td>
-<td>368.717MB/s</td>
-<td>261.847MB/s</td>
-<td>799.403MB/s</td>
-<td>645.183MB/s</td>
-<td>441.023MB/s</td>
-<td>1.122GB/s</td>
-<td>425.437MB/s</td>
-<td>425.937MB/s</td>
-<td>251.018MB/s</td>
-<td>82.8314MB/s</td>
-<td>47.6763MB/s</td>
-<td>3.76299MB/s</td>
-</tr>
-<tr>
-<td>google_message1_proto3</td>
-<td>294.517MB/s</td>
-<td>229.116MB/s</td>
-<td>469.982MB/s</td>
-<td>434.510MB/s</td>
-<td>394.701MB/s</td>
-<td>591.931MB/s</td>
-<td>357.597MB/s</td>
-<td>378.568MB/s</td>
-<td>221.676MB/s</td>
-<td>82.0498MB/s</td>
-<td>39.9467MB/s</td>
-<td>3.77751MB/s</td>
-</tr>
-<tr>
-<td>google_message2</td>
-<td>277.242MB/s</td>
-<td>347.611MB/s</td>
-<td>793.67MB/s</td>
-<td>503.721MB/s</td>
-<td>596.333MB/s</td>
-<td>922.533MB/s</td>
-<td>416.778MB/s</td>
-<td>419.543MB/s</td>
-<td>367.145MB/s</td>
-<td>241.46MB/s</td>
-<td>71.5723MB/s</td>
-<td>2.73538MB/s</td>
-</tr>
-<tr>
-<td>google_message3_1</td>
-<td>213.478MB/s</td>
-<td>291.58MB/s</td>
-<td>543.398MB/s</td>
-<td>539.704MB/s</td>
-<td>717.300MB/s</td>
-<td>927.333MB/s</td>
-<td>684.241MB/s</td>
-<td>704.47MB/s</td>
-<td>648.624MB/s</td>
-<td>209.036MB/s</td>
-<td>142.356MB/s</td>
-<td>15.3324MB/s</td>
-</tr>
-<tr>
-<td>google_message3_2</td>
-<td>672.685MB/s</td>
-<td>802.767MB/s</td>
-<td>1.21505GB/s</td>
-<td>985.790MB/s</td>
-<td>1.136GB/s</td>
-<td>1.367GB/s</td>
-<td>1.54439GB/s</td>
-<td>1.60603GB/s</td>
-<td>1.33443GB/s</td>
-<td>573.835MB/s</td>
-<td>314.33MB/s</td>
-<td>15.0169MB/s</td>
-</tr>
-<tr>
-<td>google_message3_3</td>
-<td>207.681MB/s</td>
-<td>140.591MB/s</td>
-<td>535.181MB/s</td>
-<td>369.743MB/s</td>
-<td>262.301MB/s</td>
-<td>556.644MB/s</td>
-<td>279.385MB/s</td>
-<td>304.853MB/s</td>
-<td>107.575MB/s</td>
-<td>32.248MB/s</td>
-<td>26.1431MB/s</td>
-<td>2.63541MB/s</td>
-</tr>
-<tr>
-<td>google_message3_4</td>
-<td>7.96091GB/s</td>
-<td>7.10024GB/s</td>
-<td>9.3013GB/s</td>
-<td>8.518GB/s</td>
-<td>8.171GB/s</td>
-<td>9.917GB/s</td>
-<td>5.78006GB/s</td>
-<td>5.85198GB/s</td>
-<td>4.62609GB/s</td>
-<td>2.49631GB/s</td>
-<td>2.35442GB/s</td>
-<td>802.061MB/s</td>
-</tr>
-<tr>
-<td>google_message3_5</td>
-<td>76.0072MB/s</td>
-<td>51.6769MB/s</td>
-<td>237.856MB/s</td>
-<td>178.495MB/s</td>
-<td>111.751MB/s</td>
-<td>329.569MB/s</td>
-<td>121.038MB/s</td>
-<td>132.866MB/s</td>
-<td>36.9197MB/s</td>
-<td>10.3962MB/s</td>
-<td>8.84659MB/s</td>
-<td>1.25203MB/s</td>
-</tr>
-<tr>
-<td>google_message4</td>
-<td>331.46MB/s</td>
-<td>404.862MB/s</td>
-<td>427.99MB/s</td>
-<td>589.887MB/s</td>
-<td>720.367MB/s</td>
-<td>705.373MB/s</td>
-<td>606.228MB/s</td>
-<td>589.13MB/s</td>
-<td>530.692MB/s</td>
-<td>305.543MB/s</td>
-<td>174.834MB/s</td>
-<td>7.86485MB/s</td>
-</tr>
-</tbody></table>
-
-## Serialization performance
-
-<table>
-<tbody><tr>
-<th rowspan="2"> </th>
-<th colspan="1" rowspan="2">C++</th>
-<th colspan="1" rowspan="2">C++ with tcmalloc</th>
-<th colspan="3" rowspan="1">java</th>
-<th colspan="3" rowspan="1">python</th>
-</tr>
-<tr>
-<th colspan="1">byte[]</th>
-<th colspan="1">ByteString</th>
-<th colspan="1">InputStream</th>
-<th colspan="1">C++-generated-code</th>
-<th colspan="1">C++-reflection</th>
-<th colspan="1">pure-Python</th>
-</tr>
-<tr>
-<td>google_message1_proto2</td>
-<td>1.39698GB/s</td>
-<td>1.701GB/s</td>
-<td>1.12915GB/s</td>
-<td>1.13589GB/s</td>
-<td>758.609MB/s</td>
-<td>260.911MB/s</td>
-<td>58.4815MB/s</td>
-<td>5.77824MB/s</td>
-</tr>
-<tr>
-<td>google_message1_proto3</td>
-<td>959.305MB/s</td>
-<td>939.404MB/s</td>
-<td>1.15372GB/s</td>
-<td>1.07824GB/s</td>
-<td>802.337MB/s</td>
-<td>239.4MB/s</td>
-<td>33.6336MB/s</td>
-<td>5.80524MB/s</td>
-</tr>
-<tr>
-<td>google_message2</td>
-<td>1.27429GB/s</td>
-<td>1.402GB/s</td>
-<td>1.01039GB/s</td>
-<td>1022.99MB/s</td>
-<td>798.736MB/s</td>
-<td>996.755MB/s</td>
-<td>57.9601MB/s</td>
-<td>4.09246MB/s</td>
-</tr>
-<tr>
-<td>google_message3_1</td>
-<td>1.31916GB/s</td>
-<td>2.049GB/s</td>
-<td>991.496MB/s</td>
-<td>860.332MB/s</td>
-<td>662.88MB/s</td>
-<td>1.48625GB/s</td>
-<td>421.287MB/s</td>
-<td>18.002MB/s</td>
-</tr>
-<tr>
-<td>google_message3_2</td>
-<td>2.15676GB/s</td>
-<td>2.632GB/s</td>
-<td>2.14736GB/s</td>
-<td>2.08136GB/s</td>
-<td>1.55997GB/s</td>
-<td>2.39597GB/s</td>
-<td>326.777MB/s</td>
-<td>16.0527MB/s</td>
-</tr>
-<tr>
-<td>google_message3_3</td>
-<td>650.456MB/s</td>
-<td>1.040GB/s</td>
-<td>593.52MB/s</td>
-<td>580.667MB/s</td>
-<td>346.839MB/s</td>
-<td>123.978MB/s</td>
-<td>35.893MB/s</td>
-<td>2.32834MB/s</td>
-</tr>
-<tr>
-<td>google_message3_4</td>
-<td>8.70154GB/s</td>
-<td>9.825GB/s</td>
-<td>5.88645GB/s</td>
-<td>5.93946GB/s</td>
-<td>2.44388GB/s</td>
-<td>5.9241GB/s</td>
-<td>4.05837GB/s</td>
-<td>876.87MB/s</td>
-</tr>
-<tr>
-<td>google_message3_5</td>
-<td>246.33MB/s</td>
-<td>443.993MB/s</td>
-<td>283.278MB/s</td>
-<td>259.167MB/s</td>
-<td>206.37MB/s</td>
-<td>37.0285MB/s</td>
-<td>12.2228MB/s</td>
-<td>1.1979MB/s</td>
-</tr>
-<tr>
-<td>google_message4</td>
-<td>1.56674GB/s</td>
-<td>2.19601GB/s</td>
-<td>776.907MB/s</td>
-<td>770.707MB/s</td>
-<td>702.931MB/s</td>
-<td>1.49623GB/s</td>
-<td>205.116MB/s</td>
-<td>8.93428MB/s</td>
-</tr>
-</tbody></table>
-
-\* The cpp performance can be improved by using [tcmalloc](https://gperftools.github.io/gperftools/tcmalloc.html), please follow the (instruction)[https://github.com/google/protobuf/blob/master/benchmarks/README.md] to link with tcmalloc to get the faster result.
diff --git a/third_party/protobuf/3.6.0/examples/BUILD b/third_party/protobuf/3.6.0/examples/BUILD
deleted file mode 100644
index 8592145ec1..0000000000
--- a/third_party/protobuf/3.6.0/examples/BUILD
+++ /dev/null
@@ -1,109 +0,0 @@
-# This BUILD file shows how to use protobuf with bazel. Before you can use
-# proto_library/<lang>_proto_library rules in a BUILD file, you need to
-# include protobuf repo as remote repositories in your WORKSPACE file. See
-# the WORKSPACE file in the same directory with this BUILD file for an
-# example.
-
-# For each .proto file, a proto_library target should be defined. This target
-# is not bound to any particular language. Instead, it defines the dependency
-# graph of the .proto files (i.e., proto imports) and serves as the provider
-# of .proto source files to the protocol compiler.
-#
-# Remote repository "com_google_protobuf" must be defined to use this rule.
-licenses(["notice"])
-
-filegroup(
- name = "srcs",
- srcs = glob(["**"]),
- visibility = ["//visibility:public"],
-)
-
-proto_library(
- name = "addressbook_proto",
- srcs = ["addressbook.proto"],
- deps = ["@com_google_protobuf//:timestamp_proto"],
-)
-
-# The cc_proto_library rule generates C++ code for a proto_library rule. It
-# must have exactly one proto_library dependency. If you want to use multiple
-# proto_library targets, create a separate cc_proto_library target for each
-# of them.
-#
-# Remote repository "com_google_protobuf_cc" must be defined to use this rule.
-cc_proto_library(
- name = "addressbook_cc_proto",
- deps = [":addressbook_proto"],
-)
-
-# cc_library/cc_binary targets can depend on cc_proto_library targets.
-cc_binary(
- name = "add_person_cpp",
- srcs = ["add_person.cc"],
- deps = [":addressbook_cc_proto"],
-)
-
-cc_binary(
- name = "list_people_cpp",
- srcs = ["list_people.cc"],
- deps = [":addressbook_cc_proto"],
-)
-
-# Similar to cc_proto_library but for Java.
-#
-# Remote repository "com_google_protobuf_java" must be defined to use this rule.
-java_proto_library(
- name = "addressbook_java_proto",
- deps = [":addressbook_proto"],
-)
-
-java_binary(
- name = "add_person_java",
- srcs = ["AddPerson.java"],
- main_class = "AddPerson",
- deps = [":addressbook_java_proto"],
-)
-
-java_binary(
- name = "list_people_java",
- srcs = ["ListPeople.java"],
- main_class = "ListPeople",
- deps = [":addressbook_java_proto"],
-)
-
-# Java lite.
-#
-# Remote repository "com_google_protobuf_javalite" must be defined to use this
-# rule.
-java_lite_proto_library(
- name = "addressbook_java_lite_proto",
- deps = [":addressbook_proto"],
-)
-
-# Java lite API is a subset of the regular Java API so if you only uses this
-# subset in your code, you can actually compile your code against both (i.e.,
-# share code between server build and Android build).
-#
-# The lite version has a smaller code size, and you can see that by comparing
-# the resulted .jar file:
-#
-# $ bazel build :add_person_java_deploy.jar :add_person_java_lite_deploy.jar
-# $ ls -l bazel-bin/*_deploy.jar
-# -r-xr-xr-x 1 xiaofeng eng 1230797 Sep 8 12:24 bazel-bin/add_person_java_deploy.jar
-# -r-xr-xr-x 1 xiaofeng eng 236166 Sep 8 12:24 bazel-bin/add_person_java_lite_deploy.jar
-#
-# In the above example, the lite .jar file is 6 times smaller. With proper
-# proguard inlining/stripping, the difference can be much more larger than
-# that.
-java_binary(
- name = "add_person_java_lite",
- srcs = ["AddPerson.java"],
- main_class = "AddPerson",
- deps = [":addressbook_java_lite_proto"],
-)
-
-java_binary(
- name = "list_people_java_lite",
- srcs = ["ListPeople.java"],
- main_class = "ListPeople",
- deps = [":addressbook_java_lite_proto"],
-)
diff --git a/third_party/protobuf/3.6.0/examples/README.md b/third_party/protobuf/3.6.0/examples/README.md
deleted file mode 100644
index 20f285cdd7..0000000000
--- a/third_party/protobuf/3.6.0/examples/README.md
+++ /dev/null
@@ -1,124 +0,0 @@
-# Protocol Buffers - Code Example
-
-This directory contains example code that uses Protocol Buffers to manage an
-address book. Two programs are provided for each supported language. The
-add_person example adds a new person to an address book, prompting the user to
-input the person's information. The list_people example lists people already in
-the address book. The examples use the exact same format in all three languages,
-so you can, for example, use add_person_java to create an address book and then
-use list_people_python to read it.
-
-These examples are part of the Protocol Buffers tutorial, located at:
- https://developers.google.com/protocol-buffers/docs/tutorials
-
-## Build the example using bazel
-
-The example requires bazel 0.5.4 or newer to build. You can download/install
-the latest version of bazel from bazel's release page:
-
- https://github.com/bazelbuild/bazel/releases
-
-Once you have bazel installed, simply run the following command in this examples
-directory to build the code:
-
- $ bazel build :all
-
-Then you can run the built binary:
-
- $ bazel-bin/add_person_cpp addressbook.data
-
-To use protobuf in your own bazel project, please follow instructions in the
-[BUILD](BUILD) file and [WORKSPACE](WORKSPACE) file.
-
-## Build the example using make
-
-You must install the protobuf package before you can build it using make. The
-minimum requirement is to install protocol compiler (i.e., the protoc binary)
-and the protobuf runtime for the language you want to build.
-
-You can simply run "make" to build the example for all languages (except for
-Go). However, since different language has different installation requirement,
-it will likely fail. It's better to follow individual instrutions below to
-build only the language you are interested in.
-
-### C++
-
-You can follow instructions in [../src/README.md](../src/README.md) to install
-protoc and protobuf C++ runtime from source.
-
-Then run "make cpp" in this examples directory to build the C++ example. It
-will create two executables: add_person_cpp and list_people_cpp. These programs
-simply take an address book file as their parameter. The add_person_cpp
-programs will create the file if it doesn't already exist.
-
-To run the examples:
-
- $ ./add_person_cpp addressbook.data
- $ ./list_people_cpp addressbook.data
-
-Note that on some platforms you may have to edit the Makefile and remove
-"-lpthread" from the linker commands (perhaps replacing it with something else).
-We didn't do this automatically because we wanted to keep the example simple.
-
-### Python
-
-Follow instructions in [../README.md](../README.md) to install protoc and then
-follow [../python/README.md](../python/README.md) to install protobuf python
-runtime from source. You can also install python runtime using pip:
-
- $ pip install protobuf
-
-Make sure the runtime version is the same as protoc binary, or it may not work.
-
-After you have install both protoc and python runtime, run "make python" to
-build two executables (shell scripts actually): add_person_python and
-list_people_python. They work the same way as the C++ executables.
-
-### Java
-
-Follow instructions in [../README.md](../README.md) to install protoc and then
-download protobuf Java runtime .jar file from maven:
-
- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
-
-Then run the following:
-
- $ export CLASSPATH=/path/to/protobuf-java-[version].jar
- $ make java
-
-This will create the add_person_java/list_people_java executables (shell
-scripts) and can be used to create/display an address book data file.
-
-### Go
-
-The Go example requires a plugin to the protocol buffer compiler, so it is not
-build with all the other examples. See:
-
- https://github.com/golang/protobuf
-
-for more information about Go protocol buffer support.
-
-First, install the Protocol Buffers compiler (protoc).
-
-Then, install the Go Protocol Buffers plugin ($GOPATH/bin must be in your $PATH
-for protoc to find it):
-
- go get github.com/golang/protobuf/protoc-gen-go
-
-Build the Go samples in this directory with "make go". This creates the
-following executable files in the current directory:
-
- add_person_go list_people_go
-
-To run the example:
-
- ./add_person_go addressbook.data
-
-to add a person to the protocol buffer encoded file addressbook.data. The file
-is created if it does not exist. To view the data, run:
-
- ./list_people_go addressbook.data
-
-Observe that the C++, Python, and Java examples in this directory run in a
-similar way and can view/modify files created by the Go example and vice
-versa.
diff --git a/third_party/protobuf/3.6.0/examples/WORKSPACE b/third_party/protobuf/3.6.0/examples/WORKSPACE
deleted file mode 100644
index 936f244182..0000000000
--- a/third_party/protobuf/3.6.0/examples/WORKSPACE
+++ /dev/null
@@ -1,35 +0,0 @@
-# This com_google_protobuf repository is required for proto_library rule.
-# It provides the protocol compiler binary (i.e., protoc).
-http_archive(
- name = "com_google_protobuf",
- 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
-# repo as com_google_protobuf but has to be given a different name as
-# required by bazel.
-http_archive(
- name = "com_google_protobuf_cc",
- strip_prefix = "protobuf-master",
- urls = ["https://github.com/google/protobuf/archive/master.zip"],
-)
-
-# Similar to com_google_protobuf_cc but for Java (i.e., java_proto_library).
-http_archive(
- name = "com_google_protobuf_java",
- strip_prefix = "protobuf-master",
- urls = ["https://github.com/google/protobuf/archive/master.zip"],
-)
-
-# Similar to com_google_protobuf_cc but for Java lite. If you are building
-# for Android, the lite version should be prefered because it has a much
-# smaller code size.
-http_archive(
- name = "com_google_protobuf_javalite",
- strip_prefix = "protobuf-javalite",
- urls = ["https://github.com/google/protobuf/archive/javalite.zip"],
-)
diff --git a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java b/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java
deleted file mode 100644
index 713e806469..0000000000
--- a/third_party/protobuf/3.6.0/java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java
+++ /dev/null
@@ -1,150 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf;
-
-import static com.google.protobuf.Internal.EMPTY_BYTE_BUFFER;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.Iterator;
-
-class IterableByteBufferInputStream extends InputStream {
- /** The {@link Iterator} with type {@link ByteBuffer} of {@code input} */
- private Iterator<ByteBuffer> iterator;
- /** The current ByteBuffer; */
- private ByteBuffer currentByteBuffer;
- /** The number of ByteBuffers in the input data. */
- private int dataSize;
- /**
- * Current {@code ByteBuffer}'s index
- *
- * <p>If index equals dataSize, then all the data in the InputStream has been consumed
- */
- private int currentIndex;
- /** The current position for current ByteBuffer */
- private int currentByteBufferPos;
- /** Whether current ByteBuffer has an array */
- private boolean hasArray;
- /**
- * If the current ByteBuffer is unsafe-direct based, currentArray is null; otherwise should be the
- * array inside ByteBuffer.
- */
- private byte[] currentArray;
- /** Current ByteBuffer's array offset */
- private int currentArrayOffset;
- /**
- * If the current ByteBuffer is unsafe-direct based, currentAddress is the start address of this
- * ByteBuffer; otherwise should be zero.
- */
- private long currentAddress;
-
- IterableByteBufferInputStream(Iterable<ByteBuffer> data) {
- iterator = data.iterator();
- dataSize = 0;
- for (ByteBuffer unused : data) {
- dataSize++;
- }
- currentIndex = -1;
-
- if (!getNextByteBuffer()) {
- currentByteBuffer = EMPTY_BYTE_BUFFER;
- currentIndex = 0;
- currentByteBufferPos = 0;
- currentAddress = 0;
- }
- }
-
- private boolean getNextByteBuffer() {
- currentIndex++;
- if (!iterator.hasNext()) {
- return false;
- }
- currentByteBuffer = iterator.next();
- currentByteBufferPos = currentByteBuffer.position();
- if (currentByteBuffer.hasArray()) {
- hasArray = true;
- currentArray = currentByteBuffer.array();
- currentArrayOffset = currentByteBuffer.arrayOffset();
- } else {
- hasArray = false;
- currentAddress = UnsafeUtil.addressOffset(currentByteBuffer);
- currentArray = null;
- }
- return true;
- }
-
- private void updateCurrentByteBufferPos(int numberOfBytesRead) {
- currentByteBufferPos += numberOfBytesRead;
- if (currentByteBufferPos == currentByteBuffer.limit()) {
- getNextByteBuffer();
- }
- }
-
- @Override
- public int read() throws IOException {
- if (currentIndex == dataSize) {
- return -1;
- }
- if (hasArray) {
- int result = currentArray[currentByteBufferPos + currentArrayOffset] & 0xFF;
- updateCurrentByteBufferPos(1);
- return result;
- } else {
- int result = UnsafeUtil.getByte(currentByteBufferPos + currentAddress) & 0xFF;
- updateCurrentByteBufferPos(1);
- return result;
- }
- }
-
- @Override
- public int read(byte[] output, int offset, int length) throws IOException {
- if (currentIndex == dataSize) {
- return -1;
- }
- int remaining = currentByteBuffer.limit() - currentByteBufferPos;
- if (length > remaining) {
- length = remaining;
- }
- if (hasArray) {
- System.arraycopy(
- currentArray, currentByteBufferPos + currentArrayOffset, output, offset, length);
- updateCurrentByteBufferPos(length);
- } else {
- int prevPos = currentByteBuffer.position();
- currentByteBuffer.position(currentByteBufferPos);
- currentByteBuffer.get(output, offset, length);
- currentByteBuffer.position(prevPos);
- updateCurrentByteBufferPos(length);
- }
- return length;
- }
-}
diff --git a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java b/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java
deleted file mode 100644
index 359d4d74c0..0000000000
--- a/third_party/protobuf/3.6.0/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java
+++ /dev/null
@@ -1,325 +0,0 @@
-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/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_lite_test.proto b/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_lite_test.proto
deleted file mode 100644
index c04f5d57a7..0000000000
--- a/third_party/protobuf/3.6.0/java/core/src/test/proto/com/google/protobuf/map_lite_test.proto
+++ /dev/null
@@ -1,111 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package map_lite_test;
-
-option optimize_for = LITE_RUNTIME;
-option java_package = "map_lite_test";
-option java_outer_classname = "MapTestProto";
-
-message TestMap {
- message MessageValue {
- int32 value = 1;
- }
- enum EnumValue {
- FOO = 0;
- BAR = 1;
- BAZ = 2;
- QUX = 3;
- }
-
- map<int32, int32> int32_to_int32_field = 1;
- map<int32, string> int32_to_string_field = 2;
- map<int32, bytes> int32_to_bytes_field = 3;
- map<int32, EnumValue> int32_to_enum_field = 4;
- map<int32, MessageValue> int32_to_message_field = 5;
- map<string, int32> string_to_int32_field = 6;
- map<uint32, int32> uint32_to_int32_field = 7;
- map<int64, int32> int64_to_int32_field = 8;
-}
-
-// Used to test that a nested builder containing map fields will properly
-// propagate the onChange event and mark its parent dirty when a change
-// is made to a map field.
-message TestOnChangeEventPropagation {
- TestMap optional_message = 1;
-}
-
-// a decoy of TestMap for testing parsing errors
-message BizarroTestMap {
- map<int32, bytes> int32_to_int32_field = 1; // same key type, different value
- map<string, int32> int32_to_string_field = 2; // different key and value types
- map<string, int32> int32_to_bytes_field = 3; // different key types, same value
- map<string, bytes> int32_to_enum_field = 4; // different key and value types
- map<string, bytes> int32_to_message_field = 5; // different key and value types
- map<string, bytes> string_to_int32_field = 6; // same key type, different value
-}
-
-// Used to test that java reserved words can be used as protobuf field names
-// Not all reserved words are tested (to avoid bloat) but instead an arbitrary
-// subset of them chosen to cover various keyword categories like
-// type, modifier, declaration, etc.
-message ReservedAsMapField {
- map<string, uint32> if = 1;
- map<string, uint32> const = 2;
- map<string, uint32> private = 3;
- map<string, uint32> class = 4;
- map<string, uint32> int = 5;
- map<string, uint32> void = 6;
- map<string, uint32> string = 7; // These are also proto keywords
- map<string, uint32> package = 8;
- map<string, uint32> enum = 9; // Most recent Java reserved word
- map<string, uint32> null = 10;
- // null is not a 'reserved word' per se but as a literal needs similar care
-}
-
-message ReservedAsMapFieldWithEnumValue {
- enum SampleEnum {
- A = 0;
- B = 1;
- }
- map<string, SampleEnum> if = 1;
- map<string, SampleEnum> const = 2;
- map<string, SampleEnum> private = 3;
- map<string, SampleEnum> class = 4;
- map<string, SampleEnum> int = 5;
- map<string, SampleEnum> void = 6;
- map<string, SampleEnum> string = 7; // These are also proto keywords
- map<string, SampleEnum> package = 8;
- map<string, SampleEnum> enum = 9; // Most recent Java reserved word
- map<string, SampleEnum> null = 10;
- // null is not a 'reserved word' per se but as a literal needs similar care
-}
diff --git a/third_party/protobuf/3.6.0/java/lite.md b/third_party/protobuf/3.6.0/java/lite.md
deleted file mode 100644
index 84a45ec5ab..0000000000
--- a/third_party/protobuf/3.6.0/java/lite.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Protocol Buffers - Google's data interchange format
-
-Copyright 2008 Google Inc.
-
-https://developers.google.com/protocol-buffers/
-
-## Use Protobuf Java Lite Runtime
-
-Protobuf Java Lite runtime is separated from the main Java runtime because
-it's designed/implemented with different constraints. In particular, Java
-Lite runtime has a much smaller code size which makes it more suitable to
-be used on Android.
-
-To use Java Lite runtime, you need to install protoc and the protoc plugin for
-Java Lite runtime. You can obtain protoc following the instructions in the
-toplevel [README.md](../README.md) file. For the protoc plugin, you can
-download it from maven:
-
- https://repo1.maven.org/maven2/com/google/protobuf/protoc-gen-javalite/
-
-Choose the version that works on your platform (e.g., on windows you can
-download `protoc-gen-javalite-3.0.0-windows-x86_32.exe`), rename it to
-protoc-gen-javalite (or protoc-gen-javalite.exe on windows) and place it
-in a directory where it can be find in PATH.
-
-Once you have the protoc and protoc plugin, you can generate Java Lite code
-for your .proto files:
-
- $ protoc --javalite_out=${OUTPUT_DIR} path/to/your/proto/file
-
-Include the generated Java files in your project and add a dependency on the
-protobuf Java runtime. If you are using Maven, use the following:
-
-```xml
-<dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-lite</artifactId>
- <version>3.0.1</version>
-</dependency>
-```
-
-Make sure the version number of the runtime matches (or is newer than) the
-version number of the protoc plugin. The version number of the protoc doesn't
-matter and any version >= 3.0.0 should work.
-
-### Use Protobuf Java Lite Runtime with Bazel
-
-Bazel has native build rules to work with protobuf. For Java Lite runtime,
-you can use the `java_lite_proto_library` rule. Check out [our build files
-examples](../examples/BUILD) to learn how to use it.
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/32-bit/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/32-bit/build.sh
deleted file mode 100644
index 04383a5701..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/32-bit/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/32-bit/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/32-bit/continuous.cfg
deleted file mode 100644
index 28b66c07c2..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/32-bit/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/32-bit/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/32-bit/presubmit.cfg
deleted file mode 100644
index 28b66c07c2..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/32-bit/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/64-bit/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/64-bit/continuous.cfg
deleted file mode 100644
index 3a4faac117..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/64-bit/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/64-bit/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/64-bit/presubmit.cfg
deleted file mode 100644
index 3a4faac117..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/64-bit/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/benchmark/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/benchmark/build.sh
deleted file mode 100644
index 750c3e5c74..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/benchmark/build.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-#
-# Change to repo root
-cd $(dirname $0)/../../..
-
-export OUTPUT_DIR=testoutput
-oldpwd=`pwd`
-
-# tcmalloc
-if [ ! -f gperftools/.libs/libtcmalloc.so ]; then
- git clone https://github.com/gperftools/gperftools.git
- cd gperftools
- ./autogen.sh
- ./configure
- make -j8
- cd ..
-fi
-
-# download datasets for benchmark
-cd benchmarks
-./download_data.sh
-datasets=`find . -type f -name "dataset.*.pb"`
-cd $oldpwd
-
-# build Python protobuf
-./autogen.sh
-./configure CXXFLAGS="-fPIC -O2"
-make -j8
-cd python
-python setup.py -q build --cpp_implementation
-pip install .
-
-
-# build and run Python benchmark
-cd ../benchmarks
-make python-pure-python-benchmark
-make python-cpp-reflection-benchmark
-make -j8 python-cpp-generated-code-benchmark
-echo "[" > tmp/python_result.json
-echo "benchmarking pure python..."
-./python-pure-python-benchmark --json --behavior_prefix="pure-python-benchmark" $datasets >> tmp/python_result.json
-echo "," >> "tmp/python_result.json"
-echo "benchmarking python cpp reflection..."
-env LD_PRELOAD="$oldpwd/gperftools/.libs/libtcmalloc.so" ./python-cpp-reflection-benchmark --json --behavior_prefix="cpp-reflection-benchmark" $datasets >> tmp/python_result.json
-echo "," >> "tmp/python_result.json"
-echo "benchmarking python cpp generated code..."
-env LD_PRELOAD="$oldpwd/gperftools/.libs/libtcmalloc.so" ./python-cpp-generated-code-benchmark --json --behavior_prefix="cpp-generated-code-benchmark" $datasets >> tmp/python_result.json
-echo "]" >> "tmp/python_result.json"
-cd $oldpwd
-
-# build CPP protobuf
-./configure
-make clean && make -j8
-
-# build CPP benchmark
-cd benchmarks
-mv tmp/python_result.json . && make clean && make -j8 cpp-benchmark && mv python_result.json tmp
-echo "benchmarking cpp..."
-env LD_PRELOAD="$oldpwd/gperftools/.libs/libtcmalloc.so" ./cpp-benchmark --benchmark_min_time=5.0 --benchmark_out_format=json --benchmark_out="tmp/cpp_result.json" $datasets
-cd $oldpwd
-
-# build go protobuf
-export PATH="`pwd`/src:$PATH"
-export GOPATH="$HOME/gocode"
-mkdir -p "$GOPATH/src/github.com/google"
-rm -f "$GOPATH/src/github.com/google/protobuf"
-ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf"
-export PATH="$GOPATH/bin:$PATH"
-go get github.com/golang/protobuf/protoc-gen-go
-
-# build go benchmark
-cd benchmarks
-make go-benchmark
-echo "benchmarking go..."
-./go-benchmark $datasets > tmp/go_result.txt
-
-# build java benchmark
-make java-benchmark
-echo "benchmarking java..."
-./java-benchmark -Cresults.file.options.file="tmp/java_result.json" $datasets
-
-# upload result to bq
-make python_add_init
-python util/run_and_upload.py -cpp="../tmp/cpp_result.json" -java="../tmp/java_result.json" \
- -python="../tmp/python_result.json" -go="../tmp/go_result.txt"
-
-cd $oldpwd
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/benchmark/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/benchmark/continuous.cfg
deleted file mode 100644
index a3558c6557..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/benchmark/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/benchmark/build.sh"
-timeout_mins: 240
-
-action {
- define_artifacts {
- regex: "**/sponge_log.xml"
- }
-}
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/golang/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/golang/build.sh
deleted file mode 100644
index 79cddff15c..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/golang/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/golang/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/golang/continuous.cfg
deleted file mode 100644
index 2282f78f04..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/golang/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/golang/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/golang/presubmit.cfg
deleted file mode 100644
index 2282f78f04..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/golang/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/build.sh
deleted file mode 100644
index 0a5604b426..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/continuous.cfg
deleted file mode 100644
index 07a9df5f44..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/presubmit.cfg
deleted file mode 100644
index 07a9df5f44..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_jdk7/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/build.sh
deleted file mode 100644
index 9ab90dadf2..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/continuous.cfg
deleted file mode 100644
index 610469b42c..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/presubmit.cfg
deleted file mode 100644
index 610469b42c..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/java_oracle7/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/javascript/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/javascript/build.sh
deleted file mode 100644
index c2585fb793..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/javascript/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/javascript/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/javascript/continuous.cfg
deleted file mode 100644
index b42f522fe9..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/javascript/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/javascript/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/javascript/presubmit.cfg
deleted file mode 100644
index b42f522fe9..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/javascript/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/php_all/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/php_all/build.sh
deleted file mode 100644
index e9ab84cb5d..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/php_all/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/php_all/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/php_all/continuous.cfg
deleted file mode 100644
index dfa8037ef8..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/php_all/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/php_all/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/php_all/presubmit.cfg
deleted file mode 100644
index dfa8037ef8..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/php_all/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/prepare_build_linux_rc b/third_party/protobuf/3.6.0/kokoro/linux/prepare_build_linux_rc
deleted file mode 100644
index f64ea95238..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/prepare_build_linux_rc
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-# Source this rc script to prepare the environment for Linux builds
-
-# Set up dotnet
-sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
-sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF
-sudo apt-get update
-# We use the .NET Core SDK 2.x to build...
-sudo apt-get install -y dotnet-sdk-2.0.3
-# But we also need the 1.x framework to test against, as we
-# target netstandard1.x
-sudo apt-get install -y dotnet-sharedframework-microsoft.netcore.app-1.0.5
diff --git a/third_party/protobuf/3.6.0/kokoro/linux/python/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/python/build.sh
deleted file mode 100644
index 86964f55ef..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/python/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/python/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/python/continuous.cfg
deleted file mode 100644
index e2fc4136f0..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/python/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/python/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/python/presubmit.cfg
deleted file mode 100644
index e2fc4136f0..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/python/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/build.sh
deleted file mode 100644
index add6465190..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/continuous.cfg
deleted file mode 100644
index b1b0e550ff..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/presubmit.cfg
deleted file mode 100644
index b1b0e550ff..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/python_cpp/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/build.sh b/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/build.sh
deleted file mode 100644
index ea7589585d..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/continuous.cfg b/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/continuous.cfg
deleted file mode 100644
index 02d7643728..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/presubmit.cfg b/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/presubmit.cfg
deleted file mode 100644
index 02d7643728..0000000000
--- a/third_party/protobuf/3.6.0/kokoro/linux/ruby_all/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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/third_party/protobuf/3.6.0/libprotobuf_java.jar b/third_party/protobuf/3.6.0/libprotobuf_java.jar
deleted file mode 100644
index d455fc6c36..0000000000
--- a/third_party/protobuf/3.6.0/libprotobuf_java.jar
+++ /dev/null
Binary files differ
diff --git a/third_party/protobuf/3.6.0/libprotobuf_java_util.jar b/third_party/protobuf/3.6.0/libprotobuf_java_util.jar
deleted file mode 100644
index fde824aa46..0000000000
--- a/third_party/protobuf/3.6.0/libprotobuf_java_util.jar
+++ /dev/null
Binary files differ
diff --git a/third_party/protobuf/3.6.0/m4/ax_pthread.m4 b/third_party/protobuf/3.6.0/m4/ax_pthread.m4
deleted file mode 100644
index d218d1af73..0000000000
--- a/third_party/protobuf/3.6.0/m4/ax_pthread.m4
+++ /dev/null
@@ -1,485 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-#
-# DESCRIPTION
-#
-# This macro figures out how to build C programs using POSIX threads. It
-# sets the PTHREAD_LIBS output variable to the threads library and linker
-# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
-# flags that are needed. (The user can also force certain compiler
-# flags/libs to be tested by setting these environment variables.)
-#
-# Also sets PTHREAD_CC to any special C compiler that is needed for
-# multi-threaded programs (defaults to the value of CC otherwise). (This
-# is necessary on AIX to use the special cc_r compiler alias.)
-#
-# NOTE: You are assumed to not only compile your program with these flags,
-# but also to link with them as well. For example, you might link with
-# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
-#
-# If you are only building threaded programs, you may wish to use these
-# variables in your default LIBS, CFLAGS, and CC:
-#
-# LIBS="$PTHREAD_LIBS $LIBS"
-# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-# CC="$PTHREAD_CC"
-#
-# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
-# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
-# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-#
-# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
-# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
-# PTHREAD_CFLAGS.
-#
-# ACTION-IF-FOUND is a list of shell commands to run if a threads library
-# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
-# is not found. If ACTION-IF-FOUND is not specified, the default action
-# will define HAVE_PTHREAD.
-#
-# Please let the authors know if this macro fails on any platform, or if
-# you have any other suggestions or comments. This macro was based on work
-# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
-# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
-# Alejandro Forero Cuervo to the autoconf macro repository. We are also
-# grateful for the helpful feedback of numerous users.
-#
-# Updated for Autoconf 2.68 by Daniel Richard G.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
-# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception, the respective Autoconf Macro's copyright owner
-# gives unlimited permission to copy, distribute and modify the configure
-# scripts that are the output of Autoconf when processing the Macro. You
-# need not follow the terms of the GNU General Public License when using
-# or distributing such scripts, even though portions of the text of the
-# Macro appear in them. The GNU General Public License (GPL) does govern
-# all other use of the material that constitutes the Autoconf Macro.
-#
-# This special exception to the GPL applies to versions of the Autoconf
-# Macro released by the Autoconf Archive. When you make and distribute a
-# modified version of the Autoconf Macro, you may extend this special
-# exception to the GPL to apply to your modified version as well.
-
-#serial 22
-
-AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
-AC_DEFUN([AX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_SED])
-AC_LANG_PUSH([C])
-ax_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on Tru64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
- ax_pthread_save_CC="$CC"
- ax_pthread_save_CFLAGS="$CFLAGS"
- ax_pthread_save_LIBS="$LIBS"
- AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
- AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
- AC_MSG_RESULT([$ax_pthread_ok])
- if test "x$ax_pthread_ok" = "xno"; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- CC="$ax_pthread_save_CC"
- CFLAGS="$ax_pthread_save_CFLAGS"
- LIBS="$ax_pthread_save_LIBS"
-fi
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# Create a list of thread flags to try. Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all, and "pthread-config"
-# which is a program returning the flags for the Pth emulation library.
-
-ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-
-# The ordering *is* (sometimes) important. Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-# other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
-# (Note: HP C rejects this with "bad form for `-t' option")
-# -pthreads: Solaris/gcc (Note: HP C also rejects)
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads and
-# -D_REENTRANT too), HP C (must be checked before -lpthread, which
-# is present but should not be used directly; and before -mthreads,
-# because the compiler interprets this as "-mt" + "-hreads")
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-# pthread-config: use pthread-config program (for GNU Pth library)
-
-case $host_os in
-
- freebsd*)
-
- # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
- # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-
- ax_pthread_flags="-kthread lthread $ax_pthread_flags"
- ;;
-
- hpux*)
-
- # From the cc(1) man page: "[-mt] Sets various -D flags to enable
- # multi-threading and also sets -lpthread."
-
- ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
- ;;
-
- openedition*)
-
- # IBM z/OS requires a feature-test macro to be defined in order to
- # enable POSIX threads at all, so give the user a hint if this is
- # not set. (We don't define these ourselves, as they can affect
- # other portions of the system API in unpredictable ways.)
-
- AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
- [
-# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
- AX_PTHREAD_ZOS_MISSING
-# endif
- ],
- [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
- ;;
-
- solaris*)
-
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (N.B.: The stubs are missing
- # pthread_cleanup_push, or rather a function called by this macro,
- # so we could check for that, but who knows whether they'll stub
- # that too in a future libc.) So we'll check first for the
- # standard Solaris way of linking pthreads (-mt -lpthread).
-
- ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
- ;;
-esac
-
-# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
-
-AS_IF([test "x$GCC" = "xyes"],
- [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"])
-
-# The presence of a feature test macro requesting re-entrant function
-# definitions is, on some systems, a strong hint that pthreads support is
-# correctly enabled
-
-case $host_os in
- darwin* | hpux* | linux* | osf* | solaris*)
- ax_pthread_check_macro="_REENTRANT"
- ;;
-
- aix* | freebsd*)
- ax_pthread_check_macro="_THREAD_SAFE"
- ;;
-
- *)
- ax_pthread_check_macro="--"
- ;;
-esac
-AS_IF([test "x$ax_pthread_check_macro" = "x--"],
- [ax_pthread_check_cond=0],
- [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
-
-# Are we compiling with Clang?
-
-AC_CACHE_CHECK([whether $CC is Clang],
- [ax_cv_PTHREAD_CLANG],
- [ax_cv_PTHREAD_CLANG=no
- # Note that Autoconf sets GCC=yes for Clang as well as GCC
- if test "x$GCC" = "xyes"; then
- AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
- [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
-# if defined(__clang__) && defined(__llvm__)
- AX_PTHREAD_CC_IS_CLANG
-# endif
- ],
- [ax_cv_PTHREAD_CLANG=yes])
- fi
- ])
-ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
-
-ax_pthread_clang_warning=no
-
-# Clang needs special handling, because older versions handle the -pthread
-# option in a rather... idiosyncratic way
-
-if test "x$ax_pthread_clang" = "xyes"; then
-
- # Clang takes -pthread; it has never supported any other flag
-
- # (Note 1: This will need to be revisited if a system that Clang
- # supports has POSIX threads in a separate library. This tends not
- # to be the way of modern systems, but it's conceivable.)
-
- # (Note 2: On some systems, notably Darwin, -pthread is not needed
- # to get POSIX threads support; the API is always present and
- # active. We could reasonably leave PTHREAD_CFLAGS empty. But
- # -pthread does define _REENTRANT, and while the Darwin headers
- # ignore this macro, third-party headers might not.)
-
- PTHREAD_CFLAGS="-pthread"
- PTHREAD_LIBS=
-
- ax_pthread_ok=yes
-
- # However, older versions of Clang make a point of warning the user
- # that, in an invocation where only linking and no compilation is
- # taking place, the -pthread option has no effect ("argument unused
- # during compilation"). They expect -pthread to be passed in only
- # when source code is being compiled.
- #
- # Problem is, this is at odds with the way Automake and most other
- # C build frameworks function, which is that the same flags used in
- # compilation (CFLAGS) are also used in linking. Many systems
- # supported by AX_PTHREAD require exactly this for POSIX threads
- # support, and in fact it is often not straightforward to specify a
- # flag that is used only in the compilation phase and not in
- # linking. Such a scenario is extremely rare in practice.
- #
- # Even though use of the -pthread flag in linking would only print
- # a warning, this can be a nuisance for well-run software projects
- # that build with -Werror. So if the active version of Clang has
- # this misfeature, we search for an option to squash it.
-
- AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
- [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
- [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
- # Create an alternate version of $ac_link that compiles and
- # links in two steps (.c -> .o, .o -> exe) instead of one
- # (.c -> exe), because the warning occurs only in the second
- # step
- ax_pthread_save_ac_link="$ac_link"
- ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
- ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
- ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
- ax_pthread_save_CFLAGS="$CFLAGS"
- for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
- AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
- CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
- ac_link="$ax_pthread_save_ac_link"
- AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
- [ac_link="$ax_pthread_2step_ac_link"
- AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
- [break])
- ])
- done
- ac_link="$ax_pthread_save_ac_link"
- CFLAGS="$ax_pthread_save_CFLAGS"
- AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
- ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
- ])
-
- case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
- no | unknown) ;;
- *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
- esac
-
-fi # $ax_pthread_clang = yes
-
-if test "x$ax_pthread_ok" = "xno"; then
-for ax_pthread_try_flag in $ax_pthread_flags; do
-
- case $ax_pthread_try_flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -mt,pthread)
- AC_MSG_CHECKING([whether pthreads work with -mt -lpthread])
- PTHREAD_CFLAGS="-mt"
- PTHREAD_LIBS="-lpthread"
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
- PTHREAD_CFLAGS="$ax_pthread_try_flag"
- ;;
-
- pthread-config)
- AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
- AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
- PTHREAD_CFLAGS="`pthread-config --cflags`"
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
- PTHREAD_LIBS="-l$ax_pthread_try_flag"
- ;;
- esac
-
- ax_pthread_save_CFLAGS="$CFLAGS"
- ax_pthread_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
-
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
-# if $ax_pthread_check_cond
-# error "$ax_pthread_check_macro must be defined"
-# endif
- static void routine(void *a) { a = 0; }
- static void *start_routine(void *a) { return a; }],
- [pthread_t th; pthread_attr_t attr;
- pthread_create(&th, 0, start_routine, 0);
- pthread_join(th, 0);
- pthread_attr_init(&attr);
- pthread_cleanup_push(routine, 0);
- pthread_cleanup_pop(0) /* ; */])],
- [ax_pthread_ok=yes],
- [])
-
- CFLAGS="$ax_pthread_save_CFLAGS"
- LIBS="$ax_pthread_save_LIBS"
-
- AC_MSG_RESULT([$ax_pthread_ok])
- AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$ax_pthread_ok" = "xyes"; then
- ax_pthread_save_CFLAGS="$CFLAGS"
- ax_pthread_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
-
- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
- AC_CACHE_CHECK([for joinable pthread attribute],
- [ax_cv_PTHREAD_JOINABLE_ATTR],
- [ax_cv_PTHREAD_JOINABLE_ATTR=unknown
- for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
- [int attr = $ax_pthread_attr; return attr /* ; */])],
- [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
- [])
- done
- ])
- AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
- test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
- test "x$ax_pthread_joinable_attr_defined" != "xyes"],
- [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
- [$ax_cv_PTHREAD_JOINABLE_ATTR],
- [Define to necessary symbol if this constant
- uses a non-standard name on your system.])
- ax_pthread_joinable_attr_defined=yes
- ])
-
- AC_CACHE_CHECK([whether more special flags are required for pthreads],
- [ax_cv_PTHREAD_SPECIAL_FLAGS],
- [ax_cv_PTHREAD_SPECIAL_FLAGS=no
- case $host_os in
- solaris*)
- ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
- ;;
- esac
- ])
- AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
- test "x$ax_pthread_special_flags_added" != "xyes"],
- [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
- ax_pthread_special_flags_added=yes])
-
- AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
- [ax_cv_PTHREAD_PRIO_INHERIT],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
- [[int i = PTHREAD_PRIO_INHERIT;]])],
- [ax_cv_PTHREAD_PRIO_INHERIT=yes],
- [ax_cv_PTHREAD_PRIO_INHERIT=no])
- ])
- AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
- test "x$ax_pthread_prio_inherit_defined" != "xyes"],
- [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
- ax_pthread_prio_inherit_defined=yes
- ])
-
- CFLAGS="$ax_pthread_save_CFLAGS"
- LIBS="$ax_pthread_save_LIBS"
-
- # More AIX lossage: compile with *_r variant
- if test "x$GCC" != "xyes"; then
- case $host_os in
- aix*)
- AS_CASE(["x/$CC"],
- [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
- [#handle absolute path differently from PATH based program lookup
- AS_CASE(["x$CC"],
- [x/*],
- [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
- [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
- ;;
- esac
- fi
-fi
-
-test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
-
-AC_SUBST([PTHREAD_LIBS])
-AC_SUBST([PTHREAD_CFLAGS])
-AC_SUBST([PTHREAD_CC])
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test "x$ax_pthread_ok" = "xyes"; then
- ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
- :
-else
- ax_pthread_ok=no
- $2
-fi
-AC_LANG_POP
-])dnl AX_PTHREAD
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100644
index 18d981003d..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IDEDidComputeMac32BitWarning</key>
- <true/>
-</dict>
-</plist>
diff --git a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100644
index 18d981003d..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IDEDidComputeMac32BitWarning</key>
- <true/>
-</dict>
-</plist>
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest04.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest04.m
deleted file mode 100644
index c31498f12c..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest04.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "GPBDescriptor.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_4 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest05.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest05.m
deleted file mode 100644
index adb72252f5..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest05.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "GPBDictionary.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_5 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest06.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest06.m
deleted file mode 100644
index b7505b02a6..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest06.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "GPBExtensionRegistry.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_6 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest08.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest08.m
deleted file mode 100644
index a84f38cf71..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest08.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "GPBRootObject.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_8 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest09.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest09.m
deleted file mode 100644
index f8ccb4a00f..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest09.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "GPBUnknownField.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_9 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest14.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest14.m
deleted file mode 100644
index ae04349ab8..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest14.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/Any.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_14 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest15.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest15.m
deleted file mode 100644
index 889243aa38..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest15.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/Api.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_15 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest16.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest16.m
deleted file mode 100644
index c5aaf14f7d..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest16.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/Duration.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_16 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest17.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest17.m
deleted file mode 100644
index feb64d6694..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest17.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/Empty.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_17 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest18.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest18.m
deleted file mode 100644
index 66784c4ffc..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest18.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/FieldMask.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_18 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest19.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest19.m
deleted file mode 100644
index 435dea0132..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest19.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/SourceContext.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_19 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest20.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest20.m
deleted file mode 100644
index c2da80668c..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest20.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/Struct.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_20 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest21.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest21.m
deleted file mode 100644
index d7110b9377..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest21.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/Timestamp.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_21 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest22.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest22.m
deleted file mode 100644
index 173806180c..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest22.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/Type.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_22 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest23.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest23.m
deleted file mode 100644
index f22f9bdd52..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest23.m
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// This is a test including a single public header to ensure things build.
-// It helps test that imports are complete/ordered correctly.
-
-#import "google/protobuf/Wrappers.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_23 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest24.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest24.m
deleted file mode 100644
index c81ea73255..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBCompileTest24.m
+++ /dev/null
@@ -1,42 +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 is a test including a single header to ensure things build. This
-// is NOT a public header of the library, but uses a file that defines
-// proto2 syntax messages that are extendable, so it can need more things
-// that the proto3 syntax WKTs bundled with the library.
-
-#import "google/protobuf/Descriptor.pbobjc.h"
-
-
-// Something in the body of this file so the compiler/linker won't complain
-// about an empty .o file.
-__attribute__((visibility("default"))) char dummy_symbol_24 = 0;
diff --git a/third_party/protobuf/3.6.0/objectivec/Tests/GPBUnknownFieldSetTest.m b/third_party/protobuf/3.6.0/objectivec/Tests/GPBUnknownFieldSetTest.m
deleted file mode 100644
index 8e03a427d9..0000000000
--- a/third_party/protobuf/3.6.0/objectivec/Tests/GPBUnknownFieldSetTest.m
+++ /dev/null
@@ -1,502 +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.
-
-#import "GPBTestUtilities.h"
-
-#import "GPBUnknownField_PackagePrivate.h"
-#import "GPBUnknownFieldSet_PackagePrivate.h"
-#import "google/protobuf/Unittest.pbobjc.h"
-
-@interface GPBUnknownFieldSet (GPBUnknownFieldSetTest)
-- (void)getTags:(int32_t*)tags;
-@end
-
-@interface UnknownFieldSetTest : GPBTestCase {
- @private
- TestAllTypes* allFields_;
- NSData* allFieldsData_;
-
- // An empty message that has been parsed from allFieldsData. So, it has
- // unknown fields of every type.
- TestEmptyMessage* emptyMessage_;
- GPBUnknownFieldSet* unknownFields_;
-}
-
-@end
-
-@implementation UnknownFieldSetTest
-
-- (void)setUp {
- allFields_ = [self allSetRepeatedCount:kGPBDefaultRepeatCount];
- allFieldsData_ = [allFields_ data];
- emptyMessage_ = [TestEmptyMessage parseFromData:allFieldsData_ error:NULL];
- unknownFields_ = emptyMessage_.unknownFields;
-}
-
-- (void)testInvalidFieldNumber {
- GPBUnknownFieldSet *set = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:0] autorelease];
- XCTAssertThrowsSpecificNamed([set addField:field], NSException, NSInvalidArgumentException);
-}
-
-- (void)testEqualityAndHash {
- // Empty
-
- GPBUnknownFieldSet *set1 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- XCTAssertTrue([set1 isEqual:set1]);
- XCTAssertFalse([set1 isEqual:@"foo"]);
- GPBUnknownFieldSet *set2 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- XCTAssertEqualObjects(set1, set2);
- XCTAssertEqual([set1 hash], [set2 hash]);
-
- // Varint
-
- GPBUnknownField* field1 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- [field1 addVarint:1];
- [set1 addField:field1];
- XCTAssertNotEqualObjects(set1, set2);
- GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- [field2 addVarint:1];
- [set2 addField:field2];
- XCTAssertEqualObjects(set1, set2);
- XCTAssertEqual([set1 hash], [set2 hash]);
-
- // Fixed32
-
- field1 = [[[GPBUnknownField alloc] initWithNumber:2] autorelease];
- [field1 addFixed32:2];
- [set1 addField:field1];
- XCTAssertNotEqualObjects(set1, set2);
- field2 = [[[GPBUnknownField alloc] initWithNumber:2] autorelease];
- [field2 addFixed32:2];
- [set2 addField:field2];
- XCTAssertEqualObjects(set1, set2);
- XCTAssertEqual([set1 hash], [set2 hash]);
-
- // Fixed64
-
- field1 = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
- [field1 addFixed64:3];
- [set1 addField:field1];
- XCTAssertNotEqualObjects(set1, set2);
- field2 = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
- [field2 addFixed64:3];
- [set2 addField:field2];
- XCTAssertEqualObjects(set1, set2);
- XCTAssertEqual([set1 hash], [set2 hash]);
-
- // LengthDelimited
-
- field1 = [[[GPBUnknownField alloc] initWithNumber:4] autorelease];
- [field1 addLengthDelimited:DataFromCStr("foo")];
- [set1 addField:field1];
- XCTAssertNotEqualObjects(set1, set2);
- field2 = [[[GPBUnknownField alloc] initWithNumber:4] autorelease];
- [field2 addLengthDelimited:DataFromCStr("foo")];
- [set2 addField:field2];
- XCTAssertEqualObjects(set1, set2);
- XCTAssertEqual([set1 hash], [set2 hash]);
-
- // Group
-
- GPBUnknownFieldSet *group1 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* fieldGroup1 = [[[GPBUnknownField alloc] initWithNumber:10] autorelease];
- [fieldGroup1 addVarint:1];
- [group1 addField:fieldGroup1];
- GPBUnknownFieldSet *group2 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* fieldGroup2 = [[[GPBUnknownField alloc] initWithNumber:10] autorelease];
- [fieldGroup2 addVarint:1];
- [group2 addField:fieldGroup2];
-
- field1 = [[[GPBUnknownField alloc] initWithNumber:5] autorelease];
- [field1 addGroup:group1];
- [set1 addField:field1];
- XCTAssertNotEqualObjects(set1, set2);
- field2 = [[[GPBUnknownField alloc] initWithNumber:5] autorelease];
- [field2 addGroup:group2];
- [set2 addField:field2];
- XCTAssertEqualObjects(set1, set2);
- XCTAssertEqual([set1 hash], [set2 hash]);
-
- // Exercise description for completeness.
- XCTAssertTrue(set1.description.length > 10);
-}
-
-// Constructs a protocol buffer which contains fields with all the same
-// numbers as allFieldsData except that each field is some other wire
-// type.
-- (NSData*)getBizarroData {
- GPBUnknownFieldSet* bizarroFields =
- [[[GPBUnknownFieldSet alloc] init] autorelease];
- NSUInteger count = [unknownFields_ countOfFields];
- int32_t tags[count];
- [unknownFields_ getTags:tags];
- for (NSUInteger i = 0; i < count; ++i) {
- int32_t tag = tags[i];
- GPBUnknownField* field = [unknownFields_ getField:tag];
- if (field.varintList.count == 0) {
- // Original field is not a varint, so use a varint.
- GPBUnknownField* varintField =
- [[[GPBUnknownField alloc] initWithNumber:tag] autorelease];
- [varintField addVarint:1];
- [bizarroFields addField:varintField];
- } else {
- // Original field *is* a varint, so use something else.
- GPBUnknownField* fixed32Field =
- [[[GPBUnknownField alloc] initWithNumber:tag] autorelease];
- [fixed32Field addFixed32:1];
- [bizarroFields addField:fixed32Field];
- }
- }
-
- return [bizarroFields data];
-}
-
-- (void)testSerialize {
- // Check that serializing the UnknownFieldSet produces the original data
- // again.
- NSData* data = [emptyMessage_ data];
- XCTAssertEqualObjects(allFieldsData_, data);
-}
-
-- (void)testCopyFrom {
- TestEmptyMessage* message = [TestEmptyMessage message];
- [message mergeFrom:emptyMessage_];
-
- XCTAssertEqualObjects(emptyMessage_.data, message.data);
-}
-
-- (void)testMergeFrom {
- GPBUnknownFieldSet* set1 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease];
- [field addVarint:2];
- [set1 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
- [field addVarint:4];
- [set1 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:4] autorelease];
- [field addFixed32:6];
- [set1 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:5] autorelease];
- [field addFixed64:20];
- [set1 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:10] autorelease];
- [field addLengthDelimited:DataFromCStr("data1")];
- [set1 addField:field];
-
- GPBUnknownFieldSet *group1 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* fieldGroup1 = [[[GPBUnknownField alloc] initWithNumber:200] autorelease];
- [fieldGroup1 addVarint:100];
- [group1 addField:fieldGroup1];
-
- field = [[[GPBUnknownField alloc] initWithNumber:11] autorelease];
- [field addGroup:group1];
- [set1 addField:field];
-
- GPBUnknownFieldSet* set2 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- [field addVarint:1];
- [set2 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
- [field addVarint:3];
- [set2 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:4] autorelease];
- [field addFixed32:7];
- [set2 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:5] autorelease];
- [field addFixed64:30];
- [set2 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:10] autorelease];
- [field addLengthDelimited:DataFromCStr("data2")];
- [set2 addField:field];
-
- GPBUnknownFieldSet *group2 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* fieldGroup2 = [[[GPBUnknownField alloc] initWithNumber:201] autorelease];
- [fieldGroup2 addVarint:99];
- [group2 addField:fieldGroup2];
-
- field = [[[GPBUnknownField alloc] initWithNumber:11] autorelease];
- [field addGroup:group2];
- [set2 addField:field];
-
- GPBUnknownFieldSet* set3 = [[[GPBUnknownFieldSet alloc] init] autorelease];
- field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- [field addVarint:1];
- [set3 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease];
- [field addVarint:2];
- [set3 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease];
- [field addVarint:4];
- [set3 addField:field];
- [field addVarint:3];
- [set3 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:4] autorelease];
- [field addFixed32:6];
- [field addFixed32:7];
- [set3 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:5] autorelease];
- [field addFixed64:20];
- [field addFixed64:30];
- [set3 addField:field];
- field = [[[GPBUnknownField alloc] initWithNumber:10] autorelease];
- [field addLengthDelimited:DataFromCStr("data1")];
- [field addLengthDelimited:DataFromCStr("data2")];
- [set3 addField:field];
-
- GPBUnknownFieldSet *group3a = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* fieldGroup3a1 = [[[GPBUnknownField alloc] initWithNumber:200] autorelease];
- [fieldGroup3a1 addVarint:100];
- [group3a addField:fieldGroup3a1];
- GPBUnknownFieldSet *group3b = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* fieldGroup3b2 = [[[GPBUnknownField alloc] initWithNumber:201] autorelease];
- [fieldGroup3b2 addVarint:99];
- [group3b addField:fieldGroup3b2];
-
- field = [[[GPBUnknownField alloc] initWithNumber:11] autorelease];
- [field addGroup:group1];
- [field addGroup:group3b];
- [set3 addField:field];
-
- TestEmptyMessage* source1 = [TestEmptyMessage message];
- [source1 setUnknownFields:set1];
- TestEmptyMessage* source2 = [TestEmptyMessage message];
- [source2 setUnknownFields:set2];
- TestEmptyMessage* source3 = [TestEmptyMessage message];
- [source3 setUnknownFields:set3];
-
- TestEmptyMessage* destination1 = [TestEmptyMessage message];
- [destination1 mergeFrom:source1];
- [destination1 mergeFrom:source2];
-
- TestEmptyMessage* destination2 = [TestEmptyMessage message];
- [destination2 mergeFrom:source3];
-
- XCTAssertEqualObjects(destination1.data, destination2.data);
- XCTAssertEqualObjects(destination1.data, source3.data);
- XCTAssertEqualObjects(destination2.data, source3.data);
-}
-
-- (void)testClearMessage {
- TestEmptyMessage *message = [TestEmptyMessage message];
- [message mergeFrom:emptyMessage_];
- [message clear];
- XCTAssertEqual(message.serializedSize, (size_t)0);
-}
-
-- (void)testParseKnownAndUnknown {
- // Test mixing known and unknown fields when parsing.
- GPBUnknownFieldSet *fields = [[unknownFields_ copy] autorelease];
- GPBUnknownField *field =
- [[[GPBUnknownField alloc] initWithNumber:123456] autorelease];
- [field addVarint:654321];
- [fields addField:field];
-
- NSData* data = fields.data;
- TestAllTypes* destination = [TestAllTypes parseFromData:data error:NULL];
-
- [self assertAllFieldsSet:destination repeatedCount:kGPBDefaultRepeatCount];
- XCTAssertEqual(destination.unknownFields.countOfFields, (NSUInteger)1);
-
- GPBUnknownField* field2 = [destination.unknownFields getField:123456];
- XCTAssertEqual(field2.varintList.count, (NSUInteger)1);
- XCTAssertEqual(654321ULL, [field2.varintList valueAtIndex:0]);
-}
-
-- (void)testWrongTypeTreatedAsUnknown {
- // Test that fields of the wrong wire type are treated like unknown fields
- // when parsing.
-
- NSData* bizarroData = [self getBizarroData];
- TestAllTypes* allTypesMessage =
- [TestAllTypes parseFromData:bizarroData error:NULL];
- TestEmptyMessage* emptyMessage =
- [TestEmptyMessage parseFromData:bizarroData error:NULL];
-
- // All fields should have been interpreted as unknown, so the debug strings
- // should be the same.
- XCTAssertEqualObjects(emptyMessage.data, allTypesMessage.data);
-}
-
-- (void)testUnknownExtensions {
- // Make sure fields are properly parsed to the UnknownFieldSet even when
- // they are declared as extension numbers.
-
- TestEmptyMessageWithExtensions* message =
- [TestEmptyMessageWithExtensions parseFromData:allFieldsData_ error:NULL];
-
- XCTAssertEqual(unknownFields_.countOfFields,
- message.unknownFields.countOfFields);
- XCTAssertEqualObjects(allFieldsData_, message.data);
-}
-
-- (void)testWrongExtensionTypeTreatedAsUnknown {
- // Test that fields of the wrong wire type are treated like unknown fields
- // when parsing extensions.
-
- NSData* bizarroData = [self getBizarroData];
- TestAllExtensions* allExtensionsMessage =
- [TestAllExtensions parseFromData:bizarroData error:NULL];
- TestEmptyMessage* emptyMessage =
- [TestEmptyMessage parseFromData:bizarroData error:NULL];
-
- // All fields should have been interpreted as unknown, so the debug strings
- // should be the same.
- XCTAssertEqualObjects(emptyMessage.data, allExtensionsMessage.data);
-}
-
-- (void)testLargeVarint {
- GPBUnknownFieldSet* fields = [[unknownFields_ copy] autorelease];
- GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- [field addVarint:0x7FFFFFFFFFFFFFFFL];
- [fields addField:field];
-
- NSData* data = [fields data];
-
- GPBUnknownFieldSet* parsed = [[[GPBUnknownFieldSet alloc] init] autorelease];
- [parsed mergeFromData:data];
- GPBUnknownField* field2 = [parsed getField:1];
- XCTAssertEqual(field2.varintList.count, (NSUInteger)1);
- XCTAssertEqual(0x7FFFFFFFFFFFFFFFULL, [field2.varintList valueAtIndex:0]);
-}
-
-#pragma mark - Field tests
-// Some tests directly on fields since the dictionary in FieldSet can gate
-// testing some of these.
-
-- (void)testFieldEqualityAndHash {
- GPBUnknownField* field1 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- XCTAssertTrue([field1 isEqual:field1]);
- XCTAssertFalse([field1 isEqual:@"foo"]);
- GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:2] autorelease];
- XCTAssertNotEqualObjects(field1, field2);
-
- field2 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
-
- // Varint
-
- [field1 addVarint:10];
- XCTAssertNotEqualObjects(field1, field2);
- [field2 addVarint:10];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
- [field1 addVarint:11];
- XCTAssertNotEqualObjects(field1, field2);
- [field2 addVarint:11];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
-
- // Fixed32
-
- [field1 addFixed32:20];
- XCTAssertNotEqualObjects(field1, field2);
- [field2 addFixed32:20];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
- [field1 addFixed32:21];
- XCTAssertNotEqualObjects(field1, field2);
- [field2 addFixed32:21];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
-
- // Fixed64
-
- [field1 addFixed64:30];
- XCTAssertNotEqualObjects(field1, field2);
- [field2 addFixed64:30];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
- [field1 addFixed64:31];
- XCTAssertNotEqualObjects(field1, field2);
- [field2 addFixed64:31];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
-
- // LengthDelimited
-
- [field1 addLengthDelimited:DataFromCStr("foo")];
- XCTAssertNotEqualObjects(field1, field2);
- [field2 addLengthDelimited:DataFromCStr("foo")];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
- [field1 addLengthDelimited:DataFromCStr("bar")];
- XCTAssertNotEqualObjects(field1, field2);
- [field2 addLengthDelimited:DataFromCStr("bar")];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
-
- // Group
-
- GPBUnknownFieldSet *group = [[[GPBUnknownFieldSet alloc] init] autorelease];
- GPBUnknownField* fieldGroup = [[[GPBUnknownField alloc] initWithNumber:100] autorelease];
- [fieldGroup addVarint:100];
- [group addField:fieldGroup];
- [field1 addGroup:group];
- XCTAssertNotEqualObjects(field1, field2);
- group = [[[GPBUnknownFieldSet alloc] init] autorelease];
- fieldGroup = [[[GPBUnknownField alloc] initWithNumber:100] autorelease];
- [fieldGroup addVarint:100];
- [group addField:fieldGroup];
- [field2 addGroup:group];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
-
- group = [[[GPBUnknownFieldSet alloc] init] autorelease];
- fieldGroup = [[[GPBUnknownField alloc] initWithNumber:101] autorelease];
- [fieldGroup addVarint:101];
- [group addField:fieldGroup];
- [field1 addGroup:group];
- XCTAssertNotEqualObjects(field1, field2);
- group = [[[GPBUnknownFieldSet alloc] init] autorelease];
- fieldGroup = [[[GPBUnknownField alloc] initWithNumber:101] autorelease];
- [fieldGroup addVarint:101];
- [group addField:fieldGroup];
- [field2 addGroup:group];
- XCTAssertEqualObjects(field1, field2);
- XCTAssertEqual([field1 hash], [field2 hash]);
-
- // Exercise description for completeness.
- XCTAssertTrue(field1.description.length > 10);
-}
-
-- (void)testMergingFields {
- GPBUnknownField* field1 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- [field1 addVarint:1];
- [field1 addFixed32:2];
- [field1 addFixed64:3];
- [field1 addLengthDelimited:[NSData dataWithBytes:"hello" length:5]];
- [field1 addGroup:[[unknownFields_ copy] autorelease]];
- GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease];
- [field2 mergeFromField:field1];
-}
-
-@end
diff --git a/third_party/protobuf/3.6.0/php/ext/google/protobuf/message.c b/third_party/protobuf/3.6.0/php/ext/google/protobuf/message.c
deleted file mode 100644
index e28e42a152..0000000000
--- a/third_party/protobuf/3.6.0/php/ext/google/protobuf/message.c
+++ /dev/null
@@ -1,2235 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2014 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 <php.h>
-#include <stdlib.h>
-
-#include "protobuf.h"
-#include "utf8.h"
-
-zend_class_entry* message_type;
-zend_object_handlers* message_handlers;
-static const char TYPE_URL_PREFIX[] = "type.googleapis.com/";
-static void hex_to_binary(const char* hex, char** binary, int* binary_len);
-
-static zend_function_entry message_methods[] = {
- PHP_ME(Message, clear, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, discardUnknownFields, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, serializeToString, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, mergeFromString, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, serializeToJsonString, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, mergeFromJsonString, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, mergeFrom, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, readOneof, NULL, ZEND_ACC_PROTECTED)
- PHP_ME(Message, writeOneof, NULL, ZEND_ACC_PROTECTED)
- PHP_ME(Message, whichOneof, NULL, ZEND_ACC_PROTECTED)
- PHP_ME(Message, __construct, NULL, ZEND_ACC_PROTECTED)
- {NULL, NULL, NULL}
-};
-
-// Forward declare static functions.
-
-#if PHP_MAJOR_VERSION < 7
-static void message_set_property(zval* object, zval* member, zval* value,
- php_proto_zend_literal key TSRMLS_DC);
-static zval* message_get_property(zval* object, zval* member, int type,
- const zend_literal* key TSRMLS_DC);
-static zval** message_get_property_ptr_ptr(zval* object, zval* member, int type,
- php_proto_zend_literal key TSRMLS_DC);
-static HashTable* message_get_gc(zval* object, zval*** table, int* n TSRMLS_DC);
-#else
-static void message_set_property(zval* object, zval* member, zval* value,
- void** cache_slot);
-static zval* message_get_property(zval* object, zval* member, int type,
- void** cache_slot, zval* rv);
-static zval* message_get_property_ptr_ptr(zval* object, zval* member, int type,
- void** cache_slot);
-static HashTable* message_get_gc(zval* object, zval** table, int* n);
-#endif
-static HashTable* message_get_properties(zval* object TSRMLS_DC);
-
-// -----------------------------------------------------------------------------
-// PHP Message Handlers
-// -----------------------------------------------------------------------------
-
-// Define object free method.
-PHP_PROTO_OBJECT_FREE_START(MessageHeader, message)
- if (*(void**)intern->data != NULL) {
- stringsink_uninit(*(void**)intern->data);
- FREE(*(void**)intern->data);
- }
- FREE(intern->data);
-PHP_PROTO_OBJECT_FREE_END
-
-PHP_PROTO_OBJECT_DTOR_START(MessageHeader, message)
-PHP_PROTO_OBJECT_DTOR_END
-
-// Define object create method.
-PHP_PROTO_OBJECT_CREATE_START(MessageHeader, message)
-// Because php call this create func before calling the sub-message's
-// constructor defined in PHP, it's possible that the decriptor of this class
-// hasn't been added to descritpor pool (when the class is first
-// instantiated). In that case, we will defer the initialization of the custom
-// data to the parent Message's constructor, which will be called by
-// sub-message's constructors after the descriptor has been added.
-PHP_PROTO_OBJECT_CREATE_END(MessageHeader, message)
-
-// Init class entry.
-PHP_PROTO_INIT_CLASS_START("Google\\Protobuf\\Internal\\Message",
- MessageHeader, message)
- message_handlers->write_property = message_set_property;
- message_handlers->read_property = message_get_property;
- message_handlers->get_property_ptr_ptr = message_get_property_ptr_ptr;
- message_handlers->get_properties = message_get_properties;
- message_handlers->get_gc = message_get_gc;
-PHP_PROTO_INIT_CLASS_END
-
-static void message_set_property_internal(zval* object, zval* member,
- zval* value TSRMLS_DC) {
- const upb_fielddef* field;
-
- MessageHeader* self = UNBOX(MessageHeader, object);
-
- field = upb_msgdef_ntofz(self->descriptor->msgdef, Z_STRVAL_P(member));
- if (field == NULL) {
- zend_error(E_USER_ERROR, "Unknown field: %s", Z_STRVAL_P(member));
- }
-
- layout_set(self->descriptor->layout, self, field, value TSRMLS_CC);
-}
-
-#if PHP_MAJOR_VERSION < 7
-static void message_set_property(zval* object, zval* member, zval* value,
- php_proto_zend_literal key TSRMLS_DC) {
-#else
-static void message_set_property(zval* object, zval* member, zval* value,
- void** cache_slot) {
-#endif
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_error(E_USER_ERROR, "Unexpected type for field name");
- return;
- }
-
-#if PHP_MAJOR_VERSION < 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION == 0)
- if (Z_OBJCE_P(object) != EG(scope)) {
-#else
- if (Z_OBJCE_P(object) != zend_get_executed_scope()) {
-#endif
- // User cannot set property directly (e.g., $m->a = 1)
- zend_error(E_USER_ERROR, "Cannot access private property.");
- return;
- }
-
- message_set_property_internal(object, member, value TSRMLS_CC);
-}
-
-static zval* message_get_property_internal(zval* object,
- zval* member TSRMLS_DC) {
- MessageHeader* self = UNBOX(MessageHeader, object);
- const upb_fielddef* field;
- field = upb_msgdef_ntofz(self->descriptor->msgdef, Z_STRVAL_P(member));
- if (field == NULL) {
- return PHP_PROTO_GLOBAL_UNINITIALIZED_ZVAL;
- }
-
- zend_property_info* property_info;
-#if PHP_MAJOR_VERSION < 7
- property_info =
- zend_get_property_info(Z_OBJCE_P(object), member, true TSRMLS_CC);
-#else
- property_info =
- zend_get_property_info(Z_OBJCE_P(object), Z_STR_P(member), true);
-#endif
- return layout_get(
- self->descriptor->layout, message_data(self), field,
- OBJ_PROP(Z_OBJ_P(object), property_info->offset) TSRMLS_CC);
-}
-
-static void message_get_oneof_property_internal(zval* object, zval* member,
- zval* return_value TSRMLS_DC) {
- MessageHeader* self = UNBOX(MessageHeader, object);
- const upb_fielddef* field;
- field = upb_msgdef_ntofz(self->descriptor->msgdef, Z_STRVAL_P(member));
- if (field == NULL) {
- return;
- }
-
- layout_get(self->descriptor->layout, message_data(self), field,
- ZVAL_PTR_TO_CACHED_PTR(return_value) TSRMLS_CC);
-}
-
-#if PHP_MAJOR_VERSION < 7
-static zval* message_get_property(zval* object, zval* member, int type,
- const zend_literal* key TSRMLS_DC) {
-#else
-static zval* message_get_property(zval* object, zval* member, int type,
- void** cache_slot, zval* rv) {
-#endif
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_error(E_USER_ERROR, "Property name has to be a string.");
- return PHP_PROTO_GLOBAL_UNINITIALIZED_ZVAL;
- }
-
-#if PHP_MAJOR_VERSION < 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION == 0)
- if (Z_OBJCE_P(object) != EG(scope)) {
-#else
- if (Z_OBJCE_P(object) != zend_get_executed_scope()) {
-#endif
- // User cannot get property directly (e.g., $a = $m->a)
- zend_error(E_USER_ERROR, "Cannot access private property.");
- return PHP_PROTO_GLOBAL_UNINITIALIZED_ZVAL;
- }
-
- return message_get_property_internal(object, member TSRMLS_CC);
-}
-
-#if PHP_MAJOR_VERSION < 7
-static zval** message_get_property_ptr_ptr(zval* object, zval* member, int type,
- php_proto_zend_literal key
- TSRMLS_DC) {
-#else
-static zval* message_get_property_ptr_ptr(zval* object, zval* member, int type,
- void** cache_slot) {
-#endif
- return NULL;
-}
-
-static HashTable* message_get_properties(zval* object TSRMLS_DC) {
- // User cannot get property directly (e.g., $a = $m->a)
- zend_error(E_USER_ERROR, "Cannot access private properties.");
-#if PHP_MAJOR_VERSION < 7
- return zend_std_get_properties(object TSRMLS_CC);
-#else
- return zend_std_get_properties(object);
-#endif
-}
-
-static HashTable* message_get_gc(zval* object, CACHED_VALUE** table,
- int* n TSRMLS_DC) {
- zend_object* zobj = Z_OBJ_P(object);
- *table = zobj->properties_table;
- *n = zobj->ce->default_properties_count;
- return NULL;
-}
-
-// -----------------------------------------------------------------------------
-// C Message Utilities
-// -----------------------------------------------------------------------------
-
-void* message_data(MessageHeader* msg) {
- return msg->data;
-}
-
-void custom_data_init(const zend_class_entry* ce,
- MessageHeader* intern PHP_PROTO_TSRMLS_DC) {
- Descriptor* desc = UNBOX_HASHTABLE_VALUE(Descriptor, get_ce_obj(ce));
- intern->data = ALLOC_N(uint8_t, desc->layout->size);
- memset(message_data(intern), 0, desc->layout->size);
- // We wrap first so that everything in the message object is GC-rooted in
- // case a collection happens during object creation in layout_init().
- intern->descriptor = desc;
- layout_init(desc->layout, message_data(intern),
- &intern->std PHP_PROTO_TSRMLS_CC);
-}
-
-void build_class_from_descriptor(
- PHP_PROTO_HASHTABLE_VALUE php_descriptor TSRMLS_DC) {
- Descriptor* desc = UNBOX_HASHTABLE_VALUE(Descriptor, php_descriptor);
-
- // Map entries don't have existing php class.
- if (upb_msgdef_mapentry(desc->msgdef)) {
- return;
- }
-
- zend_class_entry* registered_ce = desc->klass;
-
- if (desc->layout == NULL) {
- MessageLayout* layout = create_layout(desc->msgdef);
- desc->layout = layout;
- }
-
- registered_ce->create_object = message_create;
-}
-
-// -----------------------------------------------------------------------------
-// PHP Methods
-// -----------------------------------------------------------------------------
-
-void Message_construct(zval* msg, zval* array_wrapper) {
- zend_class_entry* ce = Z_OBJCE_P(msg);
- MessageHeader* intern = NULL;
- if (EXPECTED(class_added(ce))) {
- intern = UNBOX(MessageHeader, msg);
- custom_data_init(ce, intern PHP_PROTO_TSRMLS_CC);
- }
-
- if (array_wrapper == NULL) {
- return;
- }
-
- HashTable* array = Z_ARRVAL_P(array_wrapper);
- HashPosition pointer;
- zval key;
- void* value;
- const upb_fielddef* field;
-
- for (zend_hash_internal_pointer_reset_ex(array, &pointer);
- php_proto_zend_hash_get_current_data_ex(array, (void**)&value,
- &pointer) == SUCCESS;
- zend_hash_move_forward_ex(array, &pointer)) {
- zend_hash_get_current_key_zval_ex(array, &key, &pointer);
- field = upb_msgdef_ntofz(intern->descriptor->msgdef, Z_STRVAL_P(&key));
- if (field == NULL) {
- zend_error(E_USER_ERROR, "Unknown field: %s", Z_STRVAL_P(&key));
- }
- if (upb_fielddef_ismap(field)) {
- PHP_PROTO_FAKE_SCOPE_BEGIN(Z_OBJCE_P(msg));
- zval* submap = message_get_property_internal(msg, &key TSRMLS_CC);
- PHP_PROTO_FAKE_SCOPE_END;
- HashTable* subtable = HASH_OF(
- CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value));
- HashPosition subpointer;
- zval subkey;
- void* memory;
- for (zend_hash_internal_pointer_reset_ex(subtable, &subpointer);
- php_proto_zend_hash_get_current_data_ex(subtable, (void**)&memory,
- &subpointer) == SUCCESS;
- zend_hash_move_forward_ex(subtable, &subpointer)) {
- zend_hash_get_current_key_zval_ex(subtable, &subkey, &subpointer);
- map_field_handlers->write_dimension(
- submap, &subkey,
- CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC);
- zval_dtor(&subkey);
- }
- } else if (upb_fielddef_isseq(field)) {
- PHP_PROTO_FAKE_SCOPE_BEGIN(Z_OBJCE_P(msg));
- zval* subarray = message_get_property_internal(msg, &key TSRMLS_CC);
- PHP_PROTO_FAKE_SCOPE_END;
- HashTable* subtable = HASH_OF(
- CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value));
- HashPosition subpointer;
- void* memory;
- for (zend_hash_internal_pointer_reset_ex(subtable, &subpointer);
- php_proto_zend_hash_get_current_data_ex(subtable, (void**)&memory,
- &subpointer) == SUCCESS;
- zend_hash_move_forward_ex(subtable, &subpointer)) {
- repeated_field_handlers->write_dimension(
- subarray, NULL,
- CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC);
- }
- } else if (upb_fielddef_issubmsg(field)) {
- const upb_msgdef* submsgdef = upb_fielddef_msgsubdef(field);
- PHP_PROTO_HASHTABLE_VALUE desc_php = get_def_obj(submsgdef);
- Descriptor* desc = UNBOX_HASHTABLE_VALUE(Descriptor, desc_php);
- zend_property_info* property_info;
- PHP_PROTO_FAKE_SCOPE_BEGIN(Z_OBJCE_P(msg));
-#if PHP_MAJOR_VERSION < 7
- property_info =
- zend_get_property_info(Z_OBJCE_P(msg), &key, true TSRMLS_CC);
-#else
- property_info =
- zend_get_property_info(Z_OBJCE_P(msg), Z_STR_P(&key), true);
-#endif
- PHP_PROTO_FAKE_SCOPE_END;
- CACHED_VALUE* cached = OBJ_PROP(Z_OBJ_P(msg), property_info->offset);
-#if PHP_MAJOR_VERSION < 7
- SEPARATE_ZVAL_IF_NOT_REF(cached);
-#endif
- zval* submsg = CACHED_PTR_TO_ZVAL_PTR(cached);
- ZVAL_OBJ(submsg, desc->klass->create_object(desc->klass TSRMLS_CC));
- Message_construct(submsg, NULL);
- MessageHeader* from = UNBOX(MessageHeader,
- CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value));
- MessageHeader* to = UNBOX(MessageHeader, submsg);
- if(from->descriptor != to->descriptor) {
- zend_error(E_USER_ERROR, "Cannot merge messages with different class.");
- return;
- }
-
- layout_merge(from->descriptor->layout, from, to TSRMLS_CC);
- } else {
- message_set_property_internal(msg, &key,
- CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC);
- }
- zval_dtor(&key);
- }
-}
-
-// At the first time the message is created, the class entry hasn't been
-// modified. As a result, the first created instance will be a normal zend
-// object. Here, we manually modify it to our message in such a case.
-PHP_METHOD(Message, __construct) {
- // Init message with array
- zval* array_wrapper = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "|a!", &array_wrapper) == FAILURE) {
- return;
- }
-
- Message_construct(getThis(), array_wrapper);
-}
-
-PHP_METHOD(Message, clear) {
- MessageHeader* msg = UNBOX(MessageHeader, getThis());
- Descriptor* desc = msg->descriptor;
- zend_class_entry* ce = desc->klass;
-
- zend_object_std_dtor(&msg->std TSRMLS_CC);
- object_properties_init(&msg->std, ce);
-
- layout_init(desc->layout, message_data(msg), &msg->std TSRMLS_CC);
-}
-
-PHP_METHOD(Message, mergeFrom) {
- zval* value;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &value,
- message_type) == FAILURE) {
- return;
- }
-
- MessageHeader* from = UNBOX(MessageHeader, value);
- MessageHeader* to = UNBOX(MessageHeader, getThis());
-
- if(from->descriptor != to->descriptor) {
- zend_error(E_USER_ERROR, "Cannot merge messages with different class.");
- return;
- }
-
- layout_merge(from->descriptor->layout, from, to TSRMLS_CC);
-}
-
-PHP_METHOD(Message, readOneof) {
- PHP_PROTO_LONG index;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) ==
- FAILURE) {
- return;
- }
-
- MessageHeader* msg = UNBOX(MessageHeader, getThis());
-
- const upb_fielddef* field = upb_msgdef_itof(msg->descriptor->msgdef, index);
-
- // Unlike singular fields, oneof fields share cached property. So we cannot
- // let lay_get modify the cached property. Instead, we pass in the return
- // value directly.
- layout_get(msg->descriptor->layout, message_data(msg), field,
- ZVAL_PTR_TO_CACHED_PTR(return_value) TSRMLS_CC);
-}
-
-PHP_METHOD(Message, writeOneof) {
- PHP_PROTO_LONG index;
- zval* value;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &index, &value) ==
- FAILURE) {
- return;
- }
-
- MessageHeader* msg = UNBOX(MessageHeader, getThis());
-
- const upb_fielddef* field = upb_msgdef_itof(msg->descriptor->msgdef, index);
-
- layout_set(msg->descriptor->layout, msg, field, value TSRMLS_CC);
-}
-
-PHP_METHOD(Message, whichOneof) {
- char* oneof_name;
- PHP_PROTO_SIZE length;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &oneof_name,
- &length) == FAILURE) {
- return;
- }
-
- MessageHeader* msg = UNBOX(MessageHeader, getThis());
-
- const upb_oneofdef* oneof =
- upb_msgdef_ntoo(msg->descriptor->msgdef, oneof_name, length);
- const char* oneof_case_name = layout_get_oneof_case(
- msg->descriptor->layout, message_data(msg), oneof TSRMLS_CC);
- PHP_PROTO_RETURN_STRING(oneof_case_name, 1);
-}
-
-// -----------------------------------------------------------------------------
-// Well Known Types Support
-// -----------------------------------------------------------------------------
-
-#define PHP_PROTO_FIELD_ACCESSORS(UPPER_CLASS, LOWER_CLASS, UPPER_FIELD, \
- LOWER_FIELD) \
- PHP_METHOD(UPPER_CLASS, get##UPPER_FIELD) { \
- zval member; \
- PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \
- PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \
- zval* value = message_get_property_internal(getThis(), &member TSRMLS_CC); \
- PHP_PROTO_FAKE_SCOPE_END; \
- zval_dtor(&member); \
- PHP_PROTO_RETVAL_ZVAL(value); \
- } \
- PHP_METHOD(UPPER_CLASS, set##UPPER_FIELD) { \
- zval* value = NULL; \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == \
- FAILURE) { \
- return; \
- } \
- zval member; \
- PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \
- message_set_property_internal(getThis(), &member, value TSRMLS_CC); \
- zval_dtor(&member); \
- PHP_PROTO_RETVAL_ZVAL(getThis()); \
- }
-
-#define PHP_PROTO_ONEOF_FIELD_ACCESSORS(UPPER_CLASS, LOWER_CLASS, UPPER_FIELD, \
- LOWER_FIELD) \
- PHP_METHOD(UPPER_CLASS, get##UPPER_FIELD) { \
- zval member; \
- PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \
- PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \
- message_get_oneof_property_internal(getThis(), &member, \
- return_value TSRMLS_CC); \
- PHP_PROTO_FAKE_SCOPE_END; \
- zval_dtor(&member); \
- } \
- PHP_METHOD(UPPER_CLASS, set##UPPER_FIELD) { \
- zval* value = NULL; \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == \
- FAILURE) { \
- return; \
- } \
- zval member; \
- PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \
- message_set_property_internal(getThis(), &member, value TSRMLS_CC); \
- zval_dtor(&member); \
- PHP_PROTO_RETVAL_ZVAL(getThis()); \
- }
-
-#define PHP_PROTO_ONEOF_ACCESSORS(UPPER_CLASS, LOWER_CLASS, UPPER_FIELD, \
- LOWER_FIELD) \
- PHP_METHOD(UPPER_CLASS, get##UPPER_FIELD) { \
- MessageHeader* msg = UNBOX(MessageHeader, getThis()); \
- PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \
- const upb_oneofdef* oneof = upb_msgdef_ntoo( \
- msg->descriptor->msgdef, LOWER_FIELD, strlen(LOWER_FIELD)); \
- const char* oneof_case_name = layout_get_oneof_case( \
- msg->descriptor->layout, message_data(msg), oneof TSRMLS_CC); \
- PHP_PROTO_FAKE_SCOPE_END; \
- PHP_PROTO_RETURN_STRING(oneof_case_name, 1); \
- }
-
-// Forward declare file init functions
-static void init_file_any(TSRMLS_D);
-static void init_file_api(TSRMLS_D);
-static void init_file_duration(TSRMLS_D);
-static void init_file_field_mask(TSRMLS_D);
-static void init_file_empty(TSRMLS_D);
-static void init_file_source_context(TSRMLS_D);
-static void init_file_struct(TSRMLS_D);
-static void init_file_timestamp(TSRMLS_D);
-static void init_file_type(TSRMLS_D);
-static void init_file_wrappers(TSRMLS_D);
-
-// Define file init functions
-static void init_file_any(TSRMLS_D) {
- if (is_inited_file_any) return;
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0acd010a19676f6f676c652f70726f746f6275662f616e792e70726f746f"
- "120f676f6f676c652e70726f746f62756622260a03416e7912100a087479"
- "70655f75726c180120012809120d0a0576616c756518022001280c426f0a"
- "13636f6d2e676f6f676c652e70726f746f6275664208416e7950726f746f"
- "50015a256769746875622e636f6d2f676f6c616e672f70726f746f627566"
- "2f7074797065732f616e79a20203475042aa021e476f6f676c652e50726f"
- "746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_any = true;
-}
-
-static void init_file_api(TSRMLS_D) {
- if (is_inited_file_api) return;
- init_file_source_context(TSRMLS_C);
- init_file_type(TSRMLS_C);
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0aee050a19676f6f676c652f70726f746f6275662f6170692e70726f746f"
- "120f676f6f676c652e70726f746f6275661a24676f6f676c652f70726f74"
- "6f6275662f736f757263655f636f6e746578742e70726f746f1a1a676f6f"
- "676c652f70726f746f6275662f747970652e70726f746f2281020a034170"
- "69120c0a046e616d6518012001280912280a076d6574686f647318022003"
- "280b32172e676f6f676c652e70726f746f6275662e4d6574686f6412280a"
- "076f7074696f6e7318032003280b32172e676f6f676c652e70726f746f62"
- "75662e4f7074696f6e120f0a0776657273696f6e18042001280912360a0e"
- "736f757263655f636f6e7465787418052001280b321e2e676f6f676c652e"
- "70726f746f6275662e536f75726365436f6e7465787412260a066d697869"
- "6e7318062003280b32162e676f6f676c652e70726f746f6275662e4d6978"
- "696e12270a0673796e74617818072001280e32172e676f6f676c652e7072"
- "6f746f6275662e53796e74617822d5010a064d6574686f64120c0a046e61"
- "6d6518012001280912180a10726571756573745f747970655f75726c1802"
- "2001280912190a11726571756573745f73747265616d696e671803200128"
- "0812190a11726573706f6e73655f747970655f75726c180420012809121a"
- "0a12726573706f6e73655f73747265616d696e6718052001280812280a07"
- "6f7074696f6e7318062003280b32172e676f6f676c652e70726f746f6275"
- "662e4f7074696f6e12270a0673796e74617818072001280e32172e676f6f"
- "676c652e70726f746f6275662e53796e74617822230a054d6978696e120c"
- "0a046e616d65180120012809120c0a04726f6f7418022001280942750a13"
- "636f6d2e676f6f676c652e70726f746f627566420841706950726f746f50"
- "015a2b676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f"
- "70726f746f6275662f6170693b617069a20203475042aa021e476f6f676c"
- "652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f"
- "746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_api = true;
-}
-
-static void init_file_duration(TSRMLS_D) {
- if (is_inited_file_duration) return;
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0ae3010a1e676f6f676c652f70726f746f6275662f6475726174696f6e2e"
- "70726f746f120f676f6f676c652e70726f746f627566222a0a0844757261"
- "74696f6e120f0a077365636f6e6473180120012803120d0a056e616e6f73"
- "180220012805427c0a13636f6d2e676f6f676c652e70726f746f62756642"
- "0d4475726174696f6e50726f746f50015a2a6769746875622e636f6d2f67"
- "6f6c616e672f70726f746f6275662f7074797065732f6475726174696f6e"
- "f80101a20203475042aa021e476f6f676c652e50726f746f6275662e5765"
- "6c6c4b6e6f776e5479706573620670726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_duration = true;
-}
-
-static void init_file_field_mask(TSRMLS_D) {
- if (is_inited_file_field_mask) return;
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0ae3010a20676f6f676c652f70726f746f6275662f6669656c645f6d6173"
- "6b2e70726f746f120f676f6f676c652e70726f746f627566221a0a094669"
- "656c644d61736b120d0a0570617468731801200328094289010a13636f6d"
- "2e676f6f676c652e70726f746f627566420e4669656c644d61736b50726f"
- "746f50015a39676f6f676c652e676f6c616e672e6f72672f67656e70726f"
- "746f2f70726f746f6275662f6669656c645f6d61736b3b6669656c645f6d"
- "61736ba20203475042aa021e476f6f676c652e50726f746f6275662e5765"
- "6c6c4b6e6f776e5479706573620670726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_field_mask = true;
-}
-
-static void init_file_empty(TSRMLS_D) {
- if (is_inited_file_empty) return;
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0ab7010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f"
- "746f120f676f6f676c652e70726f746f62756622070a05456d7074794276"
- "0a13636f6d2e676f6f676c652e70726f746f627566420a456d7074795072"
- "6f746f50015a276769746875622e636f6d2f676f6c616e672f70726f746f"
- "6275662f7074797065732f656d707479f80101a20203475042aa021e476f"
- "6f676c652e50726f746f6275662e57656c6c4b6e6f776e54797065736206"
- "70726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_empty = true;
-}
-
-static void init_file_source_context(TSRMLS_D) {
- if (is_inited_file_source_context) return;
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0afb010a24676f6f676c652f70726f746f6275662f736f757263655f636f"
- "6e746578742e70726f746f120f676f6f676c652e70726f746f6275662222"
- "0a0d536f75726365436f6e7465787412110a0966696c655f6e616d651801"
- "200128094295010a13636f6d2e676f6f676c652e70726f746f6275664212"
- "536f75726365436f6e7465787450726f746f50015a41676f6f676c652e67"
- "6f6c616e672e6f72672f67656e70726f746f2f70726f746f6275662f736f"
- "757263655f636f6e746578743b736f757263655f636f6e74657874a20203"
- "475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f77"
- "6e5479706573620670726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_source_context = true;
-}
-
-static void init_file_struct(TSRMLS_D) {
- if (is_inited_file_struct) return;
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0a81050a1c676f6f676c652f70726f746f6275662f7374727563742e7072"
- "6f746f120f676f6f676c652e70726f746f6275662284010a065374727563"
- "7412330a066669656c647318012003280b32232e676f6f676c652e70726f"
- "746f6275662e5374727563742e4669656c6473456e7472791a450a0b4669"
- "656c6473456e747279120b0a036b657918012001280912250a0576616c75"
- "6518022001280b32162e676f6f676c652e70726f746f6275662e56616c75"
- "653a02380122ea010a0556616c756512300a0a6e756c6c5f76616c756518"
- "012001280e321a2e676f6f676c652e70726f746f6275662e4e756c6c5661"
- "6c7565480012160a0c6e756d6265725f76616c7565180220012801480012"
- "160a0c737472696e675f76616c7565180320012809480012140a0a626f6f"
- "6c5f76616c75651804200128084800122f0a0c7374727563745f76616c75"
- "6518052001280b32172e676f6f676c652e70726f746f6275662e53747275"
- "6374480012300a0a6c6973745f76616c756518062001280b321a2e676f6f"
- "676c652e70726f746f6275662e4c69737456616c7565480042060a046b69"
- "6e6422330a094c69737456616c756512260a0676616c7565731801200328"
- "0b32162e676f6f676c652e70726f746f6275662e56616c75652a1b0a094e"
- "756c6c56616c7565120e0a0a4e554c4c5f56414c554510004281010a1363"
- "6f6d2e676f6f676c652e70726f746f627566420b53747275637450726f74"
- "6f50015a316769746875622e636f6d2f676f6c616e672f70726f746f6275"
- "662f7074797065732f7374727563743b7374727563747062f80101a20203"
- "475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f77"
- "6e5479706573620670726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_struct = true;
-}
-
-static void init_file_timestamp(TSRMLS_D) {
- if (is_inited_file_timestamp) return;
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0ae7010a1f676f6f676c652f70726f746f6275662f74696d657374616d70"
- "2e70726f746f120f676f6f676c652e70726f746f627566222b0a0954696d"
- "657374616d70120f0a077365636f6e6473180120012803120d0a056e616e"
- "6f73180220012805427e0a13636f6d2e676f6f676c652e70726f746f6275"
- "66420e54696d657374616d7050726f746f50015a2b6769746875622e636f"
- "6d2f676f6c616e672f70726f746f6275662f7074797065732f74696d6573"
- "74616d70f80101a20203475042aa021e476f6f676c652e50726f746f6275"
- "662e57656c6c4b6e6f776e5479706573620670726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_timestamp = true;
-}
-
-static void init_file_type(TSRMLS_D) {
- if (is_inited_file_type) return;
- init_file_any(TSRMLS_C);
- init_file_source_context(TSRMLS_C);
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0aba0c0a1a676f6f676c652f70726f746f6275662f747970652e70726f74"
- "6f120f676f6f676c652e70726f746f6275661a19676f6f676c652f70726f"
- "746f6275662f616e792e70726f746f1a24676f6f676c652f70726f746f62"
- "75662f736f757263655f636f6e746578742e70726f746f22d7010a045479"
- "7065120c0a046e616d6518012001280912260a066669656c647318022003"
- "280b32162e676f6f676c652e70726f746f6275662e4669656c64120e0a06"
- "6f6e656f667318032003280912280a076f7074696f6e7318042003280b32"
- "172e676f6f676c652e70726f746f6275662e4f7074696f6e12360a0e736f"
- "757263655f636f6e7465787418052001280b321e2e676f6f676c652e7072"
- "6f746f6275662e536f75726365436f6e7465787412270a0673796e746178"
- "18062001280e32172e676f6f676c652e70726f746f6275662e53796e7461"
- "7822d5050a054669656c6412290a046b696e6418012001280e321b2e676f"
- "6f676c652e70726f746f6275662e4669656c642e4b696e6412370a0b6361"
- "7264696e616c69747918022001280e32222e676f6f676c652e70726f746f"
- "6275662e4669656c642e43617264696e616c697479120e0a066e756d6265"
- "72180320012805120c0a046e616d6518042001280912100a08747970655f"
- "75726c18062001280912130a0b6f6e656f665f696e646578180720012805"
- "120e0a067061636b656418082001280812280a076f7074696f6e73180920"
- "03280b32172e676f6f676c652e70726f746f6275662e4f7074696f6e1211"
- "0a096a736f6e5f6e616d65180a2001280912150a0d64656661756c745f76"
- "616c7565180b2001280922c8020a044b696e6412100a0c545950455f554e"
- "4b4e4f574e1000120f0a0b545950455f444f55424c451001120e0a0a5459"
- "50455f464c4f41541002120e0a0a545950455f494e5436341003120f0a0b"
- "545950455f55494e5436341004120e0a0a545950455f494e543332100512"
- "100a0c545950455f46495845443634100612100a0c545950455f46495845"
- "4433321007120d0a09545950455f424f4f4c1008120f0a0b545950455f53"
- "5452494e471009120e0a0a545950455f47524f5550100a12100a0c545950"
- "455f4d455353414745100b120e0a0a545950455f4259544553100c120f0a"
- "0b545950455f55494e543332100d120d0a09545950455f454e554d100e12"
- "110a0d545950455f5346495845443332100f12110a0d545950455f534649"
- "58454436341010120f0a0b545950455f53494e5433321011120f0a0b5459"
- "50455f53494e543634101222740a0b43617264696e616c69747912170a13"
- "43415244494e414c4954595f554e4b4e4f574e100012180a144341524449"
- "4e414c4954595f4f5054494f4e414c100112180a1443415244494e414c49"
- "54595f5245515549524544100212180a1443415244494e414c4954595f52"
- "45504541544544100322ce010a04456e756d120c0a046e616d6518012001"
- "2809122d0a09656e756d76616c756518022003280b321a2e676f6f676c65"
- "2e70726f746f6275662e456e756d56616c756512280a076f7074696f6e73"
- "18032003280b32172e676f6f676c652e70726f746f6275662e4f7074696f"
- "6e12360a0e736f757263655f636f6e7465787418042001280b321e2e676f"
- "6f676c652e70726f746f6275662e536f75726365436f6e7465787412270a"
- "0673796e74617818052001280e32172e676f6f676c652e70726f746f6275"
- "662e53796e74617822530a09456e756d56616c7565120c0a046e616d6518"
- "0120012809120e0a066e756d62657218022001280512280a076f7074696f"
- "6e7318032003280b32172e676f6f676c652e70726f746f6275662e4f7074"
- "696f6e223b0a064f7074696f6e120c0a046e616d6518012001280912230a"
- "0576616c756518022001280b32142e676f6f676c652e70726f746f627566"
- "2e416e792a2e0a0653796e74617812110a0d53594e5441585f50524f544f"
- "32100012110a0d53594e5441585f50524f544f331001427d0a13636f6d2e"
- "676f6f676c652e70726f746f62756642095479706550726f746f50015a2f"
- "676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f70726f"
- "746f6275662f70747970653b7074797065f80101a20203475042aa021e47"
- "6f6f676c652e50726f746f6275662e57656c6c4b6e6f776e547970657362"
- "0670726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_type = true;
-}
-
-static void init_file_wrappers(TSRMLS_D) {
- if (is_inited_file_wrappers) return;
- init_generated_pool_once(TSRMLS_C);
- const char* generated_file =
- "0abf030a1e676f6f676c652f70726f746f6275662f77726170706572732e"
- "70726f746f120f676f6f676c652e70726f746f627566221c0a0b446f7562"
- "6c6556616c7565120d0a0576616c7565180120012801221b0a0a466c6f61"
- "7456616c7565120d0a0576616c7565180120012802221b0a0a496e743634"
- "56616c7565120d0a0576616c7565180120012803221c0a0b55496e743634"
- "56616c7565120d0a0576616c7565180120012804221b0a0a496e74333256"
- "616c7565120d0a0576616c7565180120012805221c0a0b55496e74333256"
- "616c7565120d0a0576616c756518012001280d221a0a09426f6f6c56616c"
- "7565120d0a0576616c7565180120012808221c0a0b537472696e6756616c"
- "7565120d0a0576616c7565180120012809221b0a0a427974657356616c75"
- "65120d0a0576616c756518012001280c427c0a13636f6d2e676f6f676c65"
- "2e70726f746f627566420d577261707065727350726f746f50015a2a6769"
- "746875622e636f6d2f676f6c616e672f70726f746f6275662f7074797065"
- "732f7772617070657273f80101a20203475042aa021e476f6f676c652e50"
- "726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33";
- char* binary;
- int binary_len;
- hex_to_binary(generated_file, &binary, &binary_len);
- internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC);
- FREE(binary);
- is_inited_file_wrappers = true;
-}
-
-// -----------------------------------------------------------------------------
-// Define enum
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// Field_Cardinality
-// -----------------------------------------------------------------------------
-
-static zend_function_entry field_cardinality_methods[] = {
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* field_cardinality_type;
-
-// Init class entry.
-PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field\\Cardinality",
- Field_Cardinality, field_cardinality)
- zend_declare_class_constant_long(field_cardinality_type,
- "CARDINALITY_UNKNOWN", 19, 0 TSRMLS_CC);
- zend_declare_class_constant_long(field_cardinality_type,
- "CARDINALITY_OPTIONAL", 20, 1 TSRMLS_CC);
- zend_declare_class_constant_long(field_cardinality_type,
- "CARDINALITY_REQUIRED", 20, 2 TSRMLS_CC);
- zend_declare_class_constant_long(field_cardinality_type,
- "CARDINALITY_REPEATED", 20, 3 TSRMLS_CC);
- const char *alias = "Google\\Protobuf\\Field_Cardinality";
- zend_register_class_alias_ex(alias, strlen(alias), field_cardinality_type TSRMLS_CC);
-PHP_PROTO_INIT_ENUMCLASS_END
-
-// -----------------------------------------------------------------------------
-// Field_Kind
-// -----------------------------------------------------------------------------
-
-static zend_function_entry field_kind_methods[] = {
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* field_kind_type;
-
-// Init class entry.
-PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field\\Kind",
- Field_Kind, field_kind)
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_UNKNOWN", 12, 0 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_DOUBLE", 11, 1 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_FLOAT", 10, 2 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_INT64", 10, 3 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_UINT64", 11, 4 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_INT32", 10, 5 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_FIXED64", 12, 6 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_FIXED32", 12, 7 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_BOOL", 9, 8 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_STRING", 11, 9 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_GROUP", 10, 10 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_MESSAGE", 12, 11 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_BYTES", 10, 12 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_UINT32", 11, 13 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_ENUM", 9, 14 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_SFIXED32", 13, 15 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_SFIXED64", 13, 16 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_SINT32", 11, 17 TSRMLS_CC);
- zend_declare_class_constant_long(field_kind_type,
- "TYPE_SINT64", 11, 18 TSRMLS_CC);
- const char *alias = "Google\\Protobuf\\Field_Kind";
- zend_register_class_alias_ex(alias, strlen(alias), field_kind_type TSRMLS_CC);
-PHP_PROTO_INIT_ENUMCLASS_END
-
-// -----------------------------------------------------------------------------
-// NullValue
-// -----------------------------------------------------------------------------
-
-static zend_function_entry null_value_methods[] = {
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* null_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\NullValue",
- NullValue, null_value)
- zend_declare_class_constant_long(null_value_type,
- "NULL_VALUE", 10, 0 TSRMLS_CC);
-PHP_PROTO_INIT_ENUMCLASS_END
-
-// -----------------------------------------------------------------------------
-// Syntax
-// -----------------------------------------------------------------------------
-
-static zend_function_entry syntax_methods[] = {
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* syntax_type;
-
-// Init class entry.
-PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Syntax",
- Syntax, syntax)
- zend_declare_class_constant_long(syntax_type,
- "SYNTAX_PROTO2", 13, 0 TSRMLS_CC);
- zend_declare_class_constant_long(syntax_type,
- "SYNTAX_PROTO3", 13, 1 TSRMLS_CC);
-PHP_PROTO_INIT_ENUMCLASS_END
-
-
-
-// -----------------------------------------------------------------------------
-// Define message
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// Any
-// -----------------------------------------------------------------------------
-
-static zend_function_entry any_methods[] = {
- PHP_ME(Any, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Any, getTypeUrl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Any, setTypeUrl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Any, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Any, setValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Any, pack, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Any, unpack, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Any, is, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* any_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Any", Any, any)
- zend_class_implements(any_type TSRMLS_CC, 1, message_type);
- zend_declare_property_string(any_type, "type_url", strlen("type_url"),
- "" ,ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_string(any_type, "value", strlen("value"),
- "" ,ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-static void hex_to_binary(const char* hex, char** binary, int* binary_len) {
- int i;
- int hex_len = strlen(hex);
- *binary_len = hex_len / 2;
- *binary = ALLOC_N(char, *binary_len);
- for (i = 0; i < *binary_len; i++) {
- char value = 0;
- if (hex[i * 2] >= '0' && hex[i * 2] <= '9') {
- value += (hex[i * 2] - '0') * 16;
- } else {
- value += (hex[i * 2] - 'a' + 10) * 16;
- }
- if (hex[i * 2 + 1] >= '0' && hex[i * 2 + 1] <= '9') {
- value += hex[i * 2 + 1] - '0';
- } else {
- value += hex[i * 2 + 1] - 'a' + 10;
- }
- (*binary)[i] = value;
- }
-}
-
-PHP_METHOD(Any, __construct) {
- init_file_any(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(any_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Any, any, TypeUrl, "type_url")
-PHP_PROTO_FIELD_ACCESSORS(Any, any, Value, "value")
-
-PHP_METHOD(Any, unpack) {
- // Get type url.
- zval type_url_member;
- PHP_PROTO_ZVAL_STRING(&type_url_member, "type_url", 1);
- PHP_PROTO_FAKE_SCOPE_BEGIN(any_type);
- zval* type_url_php = php_proto_message_read_property(
- getThis(), &type_url_member PHP_PROTO_TSRMLS_CC);
- zval_dtor(&type_url_member);
- PHP_PROTO_FAKE_SCOPE_END;
-
- // Get fully-qualified name from type url.
- size_t url_prefix_len = strlen(TYPE_URL_PREFIX);
- const char* type_url = Z_STRVAL_P(type_url_php);
- size_t type_url_len = Z_STRLEN_P(type_url_php);
-
- if (url_prefix_len > type_url_len ||
- strncmp(TYPE_URL_PREFIX, type_url, url_prefix_len) != 0) {
- zend_throw_exception(
- NULL, "Type url needs to be type.googleapis.com/fully-qualified",
- 0 TSRMLS_CC);
- return;
- }
-
- const char* fully_qualified_name = type_url + url_prefix_len;
- PHP_PROTO_HASHTABLE_VALUE desc_php = get_proto_obj(fully_qualified_name);
- if (desc_php == NULL) {
- zend_throw_exception(
- NULL, "Specified message in any hasn't been added to descriptor pool",
- 0 TSRMLS_CC);
- return;
- }
- Descriptor* desc = UNBOX_HASHTABLE_VALUE(Descriptor, desc_php);
- zend_class_entry* klass = desc->klass;
- ZVAL_OBJ(return_value, klass->create_object(klass TSRMLS_CC));
- MessageHeader* msg = UNBOX(MessageHeader, return_value);
- custom_data_init(klass, msg PHP_PROTO_TSRMLS_CC);
-
- // Get value.
- zval value_member;
- PHP_PROTO_ZVAL_STRING(&value_member, "value", 1);
- PHP_PROTO_FAKE_SCOPE_RESTART(any_type);
- zval* value = php_proto_message_read_property(
- getThis(), &value_member PHP_PROTO_TSRMLS_CC);
- zval_dtor(&value_member);
- PHP_PROTO_FAKE_SCOPE_END;
-
- merge_from_string(Z_STRVAL_P(value), Z_STRLEN_P(value), desc, msg);
-}
-
-PHP_METHOD(Any, pack) {
- zval* val;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &val) ==
- FAILURE) {
- return;
- }
-
- if (!instanceof_function(Z_OBJCE_P(val), message_type TSRMLS_CC)) {
- zend_error(E_USER_ERROR, "Given value is not an instance of Message.");
- return;
- }
-
- // Set value by serialized data.
- zval data;
- serialize_to_string(val, &data TSRMLS_CC);
-
- zval member;
- PHP_PROTO_ZVAL_STRING(&member, "value", 1);
-
- PHP_PROTO_FAKE_SCOPE_BEGIN(any_type);
- message_handlers->write_property(getThis(), &member, &data,
- NULL PHP_PROTO_TSRMLS_CC);
- zval_dtor(&data);
- zval_dtor(&member);
- PHP_PROTO_FAKE_SCOPE_END;
-
- // Set type url.
- Descriptor* desc =
- UNBOX_HASHTABLE_VALUE(Descriptor, get_ce_obj(Z_OBJCE_P(val)));
- const char* fully_qualified_name = upb_msgdef_fullname(desc->msgdef);
- size_t type_url_len =
- strlen(TYPE_URL_PREFIX) + strlen(fully_qualified_name) + 1;
- char* type_url = ALLOC_N(char, type_url_len);
- sprintf(type_url, "%s%s", TYPE_URL_PREFIX, fully_qualified_name);
- zval type_url_php;
- PHP_PROTO_ZVAL_STRING(&type_url_php, type_url, 1);
- PHP_PROTO_ZVAL_STRING(&member, "type_url", 1);
-
- PHP_PROTO_FAKE_SCOPE_RESTART(any_type);
- message_handlers->write_property(getThis(), &member, &type_url_php,
- NULL PHP_PROTO_TSRMLS_CC);
- zval_dtor(&type_url_php);
- zval_dtor(&member);
- PHP_PROTO_FAKE_SCOPE_END;
- FREE(type_url);
-}
-
-PHP_METHOD(Any, is) {
- zend_class_entry *klass = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "C", &klass) ==
- FAILURE) {
- return;
- }
-
- PHP_PROTO_HASHTABLE_VALUE desc_php = get_ce_obj(klass);
- if (desc_php == NULL) {
- RETURN_BOOL(false);
- }
-
- // Create corresponded type url.
- Descriptor* desc =
- UNBOX_HASHTABLE_VALUE(Descriptor, get_ce_obj(klass));
- const char* fully_qualified_name = upb_msgdef_fullname(desc->msgdef);
- size_t type_url_len =
- strlen(TYPE_URL_PREFIX) + strlen(fully_qualified_name) + 1;
- char* type_url = ALLOC_N(char, type_url_len);
- sprintf(type_url, "%s%s", TYPE_URL_PREFIX, fully_qualified_name);
-
- // Fetch stored type url.
- zval member;
- PHP_PROTO_ZVAL_STRING(&member, "type_url", 1);
- PHP_PROTO_FAKE_SCOPE_BEGIN(any_type);
- zval* value =
- php_proto_message_read_property(getThis(), &member PHP_PROTO_TSRMLS_CC);
- zval_dtor(&member);
- PHP_PROTO_FAKE_SCOPE_END;
-
- // Compare two type url.
- bool is = strcmp(type_url, Z_STRVAL_P(value)) == 0;
- FREE(type_url);
-
- RETURN_BOOL(is);
-}
-
-// -----------------------------------------------------------------------------
-// Duration
-// -----------------------------------------------------------------------------
-
-static zend_function_entry duration_methods[] = {
- PHP_ME(Duration, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Duration, getSeconds, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Duration, setSeconds, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Duration, getNanos, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Duration, setNanos, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* duration_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Duration",
- Duration, duration)
- zend_class_implements(duration_type TSRMLS_CC, 1, message_type);
- zend_declare_property_long(duration_type, "seconds", strlen("seconds"),
- 0 ,ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_long(duration_type, "nanos", strlen("nanos"),
- 0 ,ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Duration, __construct) {
- init_file_duration(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(duration_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Duration, duration, Seconds, "seconds")
-PHP_PROTO_FIELD_ACCESSORS(Duration, duration, Nanos, "nanos")
-
-// -----------------------------------------------------------------------------
-// Timestamp
-// -----------------------------------------------------------------------------
-
-static zend_function_entry timestamp_methods[] = {
- PHP_ME(Timestamp, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Timestamp, fromDateTime, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Timestamp, toDateTime, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Timestamp, getSeconds, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Timestamp, setSeconds, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Timestamp, getNanos, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Timestamp, setNanos, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* timestamp_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Timestamp",
- Timestamp, timestamp)
- zend_class_implements(timestamp_type TSRMLS_CC, 1, message_type);
- zend_declare_property_long(timestamp_type, "seconds", strlen("seconds"),
- 0 ,ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_long(timestamp_type, "nanos", strlen("nanos"),
- 0 ,ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Timestamp, __construct) {
- init_file_timestamp(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(timestamp_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Timestamp, timestamp, Seconds, "seconds")
-PHP_PROTO_FIELD_ACCESSORS(Timestamp, timestamp, Nanos, "nanos")
-
-PHP_METHOD(Timestamp, fromDateTime) {
- zval* datetime;
- zval member;
-
- PHP_PROTO_CE_DECLARE date_interface_ce;
- if (php_proto_zend_lookup_class("\\DatetimeInterface", 18,
- &date_interface_ce) == FAILURE) {
- zend_error(E_ERROR, "Make sure date extension is enabled.");
- return;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime,
- PHP_PROTO_CE_UNREF(date_interface_ce)) == FAILURE) {
- zend_error(E_USER_ERROR, "Expect DatetimeInterface.");
- return;
- }
-
- // Get timestamp from Datetime object.
- zval retval;
- zval function_name;
- int64_t timestamp;
-
-#if PHP_MAJOR_VERSION < 7
- INIT_ZVAL(retval);
- INIT_ZVAL(function_name);
-#endif
-
- PHP_PROTO_ZVAL_STRING(&function_name, "date_timestamp_get", 1);
-
- if (call_user_function(EG(function_table), NULL, &function_name, &retval, 1,
- ZVAL_PTR_TO_CACHED_PTR(datetime) TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Cannot get timestamp from DateTime.");
- return;
- }
-
- protobuf_convert_to_int64(&retval, &timestamp);
-
- zval_dtor(&retval);
- zval_dtor(&function_name);
-
- // Set seconds
- MessageHeader* self = UNBOX(MessageHeader, getThis());
- const upb_fielddef* field =
- upb_msgdef_ntofz(self->descriptor->msgdef, "seconds");
- void* storage = message_data(self);
- void* memory = slot_memory(self->descriptor->layout, storage, field);
- *(int64_t*)memory = timestamp;
-
- // Set nanos
- field = upb_msgdef_ntofz(self->descriptor->msgdef, "nanos");
- storage = message_data(self);
- memory = slot_memory(self->descriptor->layout, storage, field);
- *(int32_t*)memory = 0;
-
- RETURN_NULL();
-}
-
-PHP_METHOD(Timestamp, toDateTime) {
- // Get seconds
- MessageHeader* self = UNBOX(MessageHeader, getThis());
- const upb_fielddef* field =
- upb_msgdef_ntofz(self->descriptor->msgdef, "seconds");
- void* storage = message_data(self);
- void* memory = slot_memory(self->descriptor->layout, storage, field);
- int64_t seconds = *(int64_t*)memory;
-
- // Get nanos
- field = upb_msgdef_ntofz(self->descriptor->msgdef, "nanos");
- memory = slot_memory(self->descriptor->layout, storage, field);
- int32_t nanos = *(int32_t*)memory;
-
- // Get formated time string.
- char formated_time[50];
- time_t raw_time = seconds;
- struct tm *utc_time = gmtime(&raw_time);
- strftime(formated_time, sizeof(formated_time), "%Y-%m-%dT%H:%M:%SUTC",
- utc_time);
-
- // Create Datetime object.
- zval datetime;
- zval formated_time_php;
- zval function_name;
- int64_t timestamp = 0;
-
-#if PHP_MAJOR_VERSION < 7
- INIT_ZVAL(function_name);
- INIT_ZVAL(formated_time_php);
-#endif
-
- PHP_PROTO_ZVAL_STRING(&function_name, "date_create", 1);
- PHP_PROTO_ZVAL_STRING(&formated_time_php, formated_time, 1);
-
- CACHED_VALUE params[1] = {ZVAL_TO_CACHED_VALUE(formated_time_php)};
-
- if (call_user_function(EG(function_table), NULL,
- &function_name, &datetime, 1,
- params TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Cannot create DateTime.");
- return;
- }
-
- zval_dtor(&formated_time_php);
- zval_dtor(&function_name);
-
-#if PHP_MAJOR_VERSION < 7
- zval* datetime_ptr = &datetime;
- PHP_PROTO_RETVAL_ZVAL(datetime_ptr);
-#else
- ZVAL_OBJ(return_value, Z_OBJ(datetime));
-#endif
-}
-
-// -----------------------------------------------------------------------------
-// Api
-// -----------------------------------------------------------------------------
-
-static zend_function_entry api_methods[] = {
- PHP_ME(Api, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, getName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, setName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, getMethods, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, setMethods, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, getOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, setOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, getVersion, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, setVersion, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, getSourceContext, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, setSourceContext, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, getMixins, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, setMixins, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, getSyntax, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Api, setSyntax, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* api_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Api",
- Api, api)
- zend_class_implements(api_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(api_type, "name", strlen("name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(api_type, "methods", strlen("methods"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(api_type, "options", strlen("options"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(api_type, "version", strlen("version"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(api_type, "source_context", strlen("source_context"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(api_type, "mixins", strlen("mixins"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(api_type, "syntax", strlen("syntax"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Api, __construct) {
- init_file_api(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(api_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Api, api, Name, "name")
-PHP_PROTO_FIELD_ACCESSORS(Api, api, Methods, "methods")
-PHP_PROTO_FIELD_ACCESSORS(Api, api, Options, "options")
-PHP_PROTO_FIELD_ACCESSORS(Api, api, Version, "version")
-PHP_PROTO_FIELD_ACCESSORS(Api, api, SourceContext, "source_context")
-PHP_PROTO_FIELD_ACCESSORS(Api, api, Mixins, "mixins")
-PHP_PROTO_FIELD_ACCESSORS(Api, api, Syntax, "syntax")
-
-// -----------------------------------------------------------------------------
-// BoolValue
-// -----------------------------------------------------------------------------
-
-static zend_function_entry bool_value_methods[] = {
- PHP_ME(BoolValue, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(BoolValue, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(BoolValue, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* bool_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\BoolValue",
- BoolValue, bool_value)
- zend_class_implements(bool_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(bool_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(BoolValue, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(bool_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(BoolValue, bool_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// BytesValue
-// -----------------------------------------------------------------------------
-
-static zend_function_entry bytes_value_methods[] = {
- PHP_ME(BytesValue, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(BytesValue, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(BytesValue, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* bytes_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\BytesValue",
- BytesValue, bytes_value)
- zend_class_implements(bytes_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(bytes_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(BytesValue, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(bytes_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(BytesValue, bytes_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// DoubleValue
-// -----------------------------------------------------------------------------
-
-static zend_function_entry double_value_methods[] = {
- PHP_ME(DoubleValue, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DoubleValue, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DoubleValue, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* double_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\DoubleValue",
- DoubleValue, double_value)
- zend_class_implements(double_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(double_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(DoubleValue, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(double_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(DoubleValue, double_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// Enum
-// -----------------------------------------------------------------------------
-
-static zend_function_entry enum_methods[] = {
- PHP_ME(Enum, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, getName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, setName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, getEnumvalue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, setEnumvalue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, getOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, setOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, getSourceContext, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, setSourceContext, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, getSyntax, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Enum, setSyntax, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* enum_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Enum",
- Enum, enum)
- zend_class_implements(enum_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(enum_type, "name", strlen("name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(enum_type, "enumvalue", strlen("enumvalue"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(enum_type, "options", strlen("options"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(enum_type, "source_context", strlen("source_context"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(enum_type, "syntax", strlen("syntax"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Enum, __construct) {
- init_file_type(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(enum_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Enum, enum, Name, "name")
-PHP_PROTO_FIELD_ACCESSORS(Enum, enum, Enumvalue, "enumvalue")
-PHP_PROTO_FIELD_ACCESSORS(Enum, enum, Options, "options")
-PHP_PROTO_FIELD_ACCESSORS(Enum, enum, SourceContext, "source_context")
-PHP_PROTO_FIELD_ACCESSORS(Enum, enum, Syntax, "syntax")
-
-// -----------------------------------------------------------------------------
-// EnumValue
-// -----------------------------------------------------------------------------
-
-static zend_function_entry enum_value_methods[] = {
- PHP_ME(EnumValue, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(EnumValue, getName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(EnumValue, setName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(EnumValue, getNumber, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(EnumValue, setNumber, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(EnumValue, getOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(EnumValue, setOptions, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* enum_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\EnumValue",
- EnumValue, enum_value)
- zend_class_implements(enum_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(enum_value_type, "name", strlen("name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(enum_value_type, "number", strlen("number"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(enum_value_type, "options", strlen("options"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(EnumValue, __construct) {
- init_file_type(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(enum_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(EnumValue, enum_value, Name, "name")
-PHP_PROTO_FIELD_ACCESSORS(EnumValue, enum_value, Number, "number")
-PHP_PROTO_FIELD_ACCESSORS(EnumValue, enum_value, Options, "options")
-
-// -----------------------------------------------------------------------------
-// FieldMask
-// -----------------------------------------------------------------------------
-
-static zend_function_entry field_mask_methods[] = {
- PHP_ME(FieldMask, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(FieldMask, getPaths, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(FieldMask, setPaths, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* field_mask_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\FieldMask",
- FieldMask, field_mask)
- zend_class_implements(field_mask_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(field_mask_type, "paths", strlen("paths"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(FieldMask, __construct) {
- init_file_field_mask(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(field_mask_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(FieldMask, field_mask, Paths, "paths")
-
-// -----------------------------------------------------------------------------
-// Field
-// -----------------------------------------------------------------------------
-
-static zend_function_entry field_methods[] = {
- PHP_ME(Field, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getKind, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setKind, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getCardinality, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setCardinality, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getNumber, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setNumber, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getTypeUrl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setTypeUrl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getOneofIndex, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setOneofIndex, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getPacked, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setPacked, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getJsonName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setJsonName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, getDefaultValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Field, setDefaultValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* field_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Field",
- Field, field)
- zend_class_implements(field_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(field_type, "kind", strlen("kind"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "cardinality", strlen("cardinality"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "number", strlen("number"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "name", strlen("name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "type_url", strlen("type_url"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "oneof_index", strlen("oneof_index"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "packed", strlen("packed"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "options", strlen("options"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "json_name", strlen("json_name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(field_type, "default_value", strlen("default_value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Field, __construct) {
- init_file_type(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(field_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Field, field, Kind, "kind")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, Cardinality, "cardinality")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, Number, "number")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, Name, "name")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, TypeUrl, "type_url")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, OneofIndex, "oneof_index")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, Packed, "packed")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, Options, "options")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, JsonName, "json_name")
-PHP_PROTO_FIELD_ACCESSORS(Field, field, DefaultValue, "default_value")
-
-// -----------------------------------------------------------------------------
-// FloatValue
-// -----------------------------------------------------------------------------
-
-static zend_function_entry float_value_methods[] = {
- PHP_ME(FloatValue, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(FloatValue, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(FloatValue, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* float_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\FloatValue",
- FloatValue, float_value)
- zend_class_implements(float_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(float_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(FloatValue, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(float_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(FloatValue, float_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// GPBEmpty
-// -----------------------------------------------------------------------------
-
-static zend_function_entry empty_methods[] = {
- PHP_ME(GPBEmpty, __construct, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* empty_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\GPBEmpty",
- GPBEmpty, empty)
- zend_class_implements(empty_type TSRMLS_CC, 1, message_type);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(GPBEmpty, __construct) {
- init_file_empty(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(empty_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-
-// -----------------------------------------------------------------------------
-// Int32Value
-// -----------------------------------------------------------------------------
-
-static zend_function_entry int32_value_methods[] = {
- PHP_ME(Int32Value, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Int32Value, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Int32Value, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* int32_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Int32Value",
- Int32Value, int32_value)
- zend_class_implements(int32_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(int32_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Int32Value, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(int32_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Int32Value, int32_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// Int64Value
-// -----------------------------------------------------------------------------
-
-static zend_function_entry int64_value_methods[] = {
- PHP_ME(Int64Value, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Int64Value, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Int64Value, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* int64_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Int64Value",
- Int64Value, int64_value)
- zend_class_implements(int64_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(int64_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Int64Value, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(int64_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Int64Value, int64_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// ListValue
-// -----------------------------------------------------------------------------
-
-static zend_function_entry list_value_methods[] = {
- PHP_ME(ListValue, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(ListValue, getValues, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(ListValue, setValues, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* list_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\ListValue",
- ListValue, list_value)
- zend_class_implements(list_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(list_value_type, "values", strlen("values"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(ListValue, __construct) {
- init_file_struct(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(list_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(ListValue, list_value, Values, "values")
-
-// -----------------------------------------------------------------------------
-// Method
-// -----------------------------------------------------------------------------
-
-static zend_function_entry method_methods[] = {
- PHP_ME(Method, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, getName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, setName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, getRequestTypeUrl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, setRequestTypeUrl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, getRequestStreaming, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, setRequestStreaming, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, getResponseTypeUrl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, setResponseTypeUrl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, getResponseStreaming, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, setResponseStreaming, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, getOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, setOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, getSyntax, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Method, setSyntax, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* method_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Method",
- Method, method)
- zend_class_implements(method_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(method_type, "name", strlen("name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(method_type, "request_type_url", strlen("request_type_url"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(method_type, "request_streaming", strlen("request_streaming"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(method_type, "response_type_url", strlen("response_type_url"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(method_type, "response_streaming", strlen("response_streaming"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(method_type, "options", strlen("options"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(method_type, "syntax", strlen("syntax"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Method, __construct) {
- init_file_api(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(method_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Method, method, Name, "name")
-PHP_PROTO_FIELD_ACCESSORS(Method, method, RequestTypeUrl, "request_type_url")
-PHP_PROTO_FIELD_ACCESSORS(Method, method, RequestStreaming, "request_streaming")
-PHP_PROTO_FIELD_ACCESSORS(Method, method, ResponseTypeUrl, "response_type_url")
-PHP_PROTO_FIELD_ACCESSORS(Method, method, ResponseStreaming, "response_streaming")
-PHP_PROTO_FIELD_ACCESSORS(Method, method, Options, "options")
-PHP_PROTO_FIELD_ACCESSORS(Method, method, Syntax, "syntax")
-
-// -----------------------------------------------------------------------------
-// Mixin
-// -----------------------------------------------------------------------------
-
-static zend_function_entry mixin_methods[] = {
- PHP_ME(Mixin, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Mixin, getName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Mixin, setName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Mixin, getRoot, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Mixin, setRoot, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* mixin_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Mixin",
- Mixin, mixin)
- zend_class_implements(mixin_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(mixin_type, "name", strlen("name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(mixin_type, "root", strlen("root"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Mixin, __construct) {
- init_file_api(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(mixin_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Mixin, mixin, Name, "name")
-PHP_PROTO_FIELD_ACCESSORS(Mixin, mixin, Root, "root")
-
-// -----------------------------------------------------------------------------
-// Option
-// -----------------------------------------------------------------------------
-
-static zend_function_entry option_methods[] = {
- PHP_ME(Option, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Option, getName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Option, setName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Option, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Option, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* option_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Option",
- Option, option)
- zend_class_implements(option_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(option_type, "name", strlen("name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(option_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Option, __construct) {
- init_file_type(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(option_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Option, option, Name, "name")
-PHP_PROTO_FIELD_ACCESSORS(Option, option, Value, "value")
-
-// -----------------------------------------------------------------------------
-// SourceContext
-// -----------------------------------------------------------------------------
-
-static zend_function_entry source_context_methods[] = {
- PHP_ME(SourceContext, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(SourceContext, getFileName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(SourceContext, setFileName, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* source_context_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\SourceContext",
- SourceContext, source_context)
- zend_class_implements(source_context_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(source_context_type, "file_name", strlen("file_name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(SourceContext, __construct) {
- init_file_source_context(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(source_context_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(SourceContext, source_context, FileName, "file_name")
-
-// -----------------------------------------------------------------------------
-// StringValue
-// -----------------------------------------------------------------------------
-
-static zend_function_entry string_value_methods[] = {
- PHP_ME(StringValue, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(StringValue, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(StringValue, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* string_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\StringValue",
- StringValue, string_value)
- zend_class_implements(string_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(string_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(StringValue, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(string_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(StringValue, string_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// Struct
-// -----------------------------------------------------------------------------
-
-static zend_function_entry struct_methods[] = {
- PHP_ME(Struct, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Struct, getFields, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Struct, setFields, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* struct_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Struct",
- Struct, struct)
- zend_class_implements(struct_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(struct_type, "fields", strlen("fields"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Struct, __construct) {
- init_file_struct(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(struct_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Struct, struct, Fields, "fields")
-
-// -----------------------------------------------------------------------------
-// Type
-// -----------------------------------------------------------------------------
-
-static zend_function_entry type_methods[] = {
- PHP_ME(Type, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, getName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, setName, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, getFields, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, setFields, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, getOneofs, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, setOneofs, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, getOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, setOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, getSourceContext, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, setSourceContext, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, getSyntax, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Type, setSyntax, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* type_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Type",
- Type, type)
- zend_class_implements(type_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(type_type, "name", strlen("name"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(type_type, "fields", strlen("fields"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(type_type, "oneofs", strlen("oneofs"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(type_type, "options", strlen("options"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(type_type, "source_context", strlen("source_context"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_null(type_type, "syntax", strlen("syntax"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Type, __construct) {
- init_file_type(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(type_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(Type, type, Name, "name")
-PHP_PROTO_FIELD_ACCESSORS(Type, type, Fields, "fields")
-PHP_PROTO_FIELD_ACCESSORS(Type, type, Oneofs, "oneofs")
-PHP_PROTO_FIELD_ACCESSORS(Type, type, Options, "options")
-PHP_PROTO_FIELD_ACCESSORS(Type, type, SourceContext, "source_context")
-PHP_PROTO_FIELD_ACCESSORS(Type, type, Syntax, "syntax")
-
-// -----------------------------------------------------------------------------
-// UInt32Value
-// -----------------------------------------------------------------------------
-
-static zend_function_entry u_int32_value_methods[] = {
- PHP_ME(UInt32Value, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(UInt32Value, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(UInt32Value, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* u_int32_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\UInt32Value",
- UInt32Value, u_int32_value)
- zend_class_implements(u_int32_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(u_int32_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(UInt32Value, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(u_int32_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(UInt32Value, u_int32_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// UInt64Value
-// -----------------------------------------------------------------------------
-
-static zend_function_entry u_int64_value_methods[] = {
- PHP_ME(UInt64Value, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(UInt64Value, getValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(UInt64Value, setValue, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* u_int64_value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\UInt64Value",
- UInt64Value, u_int64_value)
- zend_class_implements(u_int64_value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(u_int64_value_type, "value", strlen("value"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(UInt64Value, __construct) {
- init_file_wrappers(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(u_int64_value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_FIELD_ACCESSORS(UInt64Value, u_int64_value, Value, "value")
-
-// -----------------------------------------------------------------------------
-// Value
-// -----------------------------------------------------------------------------
-
-static zend_function_entry value_methods[] = {
- PHP_ME(Value, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, getNullValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, setNullValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, getNumberValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, setNumberValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, getStringValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, setStringValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, getBoolValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, setBoolValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, getStructValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, setStructValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, getListValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, setListValue, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Value, getKind, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-zend_class_entry* value_type;
-
-// Init class entry.
-PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Value",
- Value, value)
- zend_class_implements(value_type TSRMLS_CC, 1, message_type);
- zend_declare_property_null(value_type, "kind", strlen("kind"),
- ZEND_ACC_PRIVATE TSRMLS_CC);
-PHP_PROTO_INIT_SUBMSGCLASS_END
-
-PHP_METHOD(Value, __construct) {
- init_file_struct(TSRMLS_C);
- MessageHeader* intern = UNBOX(MessageHeader, getThis());
- custom_data_init(value_type, intern PHP_PROTO_TSRMLS_CC);
-}
-
-PHP_PROTO_ONEOF_FIELD_ACCESSORS(Value, value, NullValue, "null_value")
-PHP_PROTO_ONEOF_FIELD_ACCESSORS(Value, value, NumberValue, "number_value")
-PHP_PROTO_ONEOF_FIELD_ACCESSORS(Value, value, StringValue, "string_value")
-PHP_PROTO_ONEOF_FIELD_ACCESSORS(Value, value, BoolValue, "bool_value")
-PHP_PROTO_ONEOF_FIELD_ACCESSORS(Value, value, StructValue, "struct_value")
-PHP_PROTO_ONEOF_FIELD_ACCESSORS(Value, value, ListValue, "list_value")
-PHP_PROTO_ONEOF_ACCESSORS(Value, value, Kind, "kind")
-
-// -----------------------------------------------------------------------------
-// GPBMetadata files for well known types
-// -----------------------------------------------------------------------------
-
-#define DEFINE_GPBMETADATA_FILE(LOWERNAME, CAMELNAME, CLASSNAME) \
- zend_class_entry* gpb_metadata_##LOWERNAME##_type; \
- static zend_function_entry gpb_metadata_##LOWERNAME##_methods[] = { \
- PHP_ME(GPBMetadata_##CAMELNAME, initOnce, NULL, \
- ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) \
- ZEND_FE_END \
- }; \
- void gpb_metadata_##LOWERNAME##_init(TSRMLS_D) { \
- zend_class_entry class_type; \
- INIT_CLASS_ENTRY(class_type, CLASSNAME, \
- gpb_metadata_##LOWERNAME##_methods); \
- gpb_metadata_##LOWERNAME##_type = \
- zend_register_internal_class(&class_type TSRMLS_CC); \
- } \
- PHP_METHOD(GPBMetadata_##CAMELNAME, initOnce) { \
- init_file_##LOWERNAME(TSRMLS_C); \
- }
-
-DEFINE_GPBMETADATA_FILE(any, Any, "GPBMetadata\\Google\\Protobuf\\Any");
-DEFINE_GPBMETADATA_FILE(api, Api, "GPBMetadata\\Google\\Protobuf\\Api");
-DEFINE_GPBMETADATA_FILE(duration, Duration,
- "GPBMetadata\\Google\\Protobuf\\Duration");
-DEFINE_GPBMETADATA_FILE(field_mask, FieldMask,
- "GPBMetadata\\Google\\Protobuf\\FieldMask");
-DEFINE_GPBMETADATA_FILE(empty, Empty,
- "GPBMetadata\\Google\\Protobuf\\GPBEmpty");
-DEFINE_GPBMETADATA_FILE(source_context, SourceContext,
- "GPBMetadata\\Google\\Protobuf\\SourceContext");
-DEFINE_GPBMETADATA_FILE(struct, Struct,
- "GPBMetadata\\Google\\Protobuf\\Struct");
-DEFINE_GPBMETADATA_FILE(timestamp, Timestamp,
- "GPBMetadata\\Google\\Protobuf\\Timestamp");
-DEFINE_GPBMETADATA_FILE(type, Type, "GPBMetadata\\Google\\Protobuf\\Type");
-DEFINE_GPBMETADATA_FILE(wrappers, Wrappers,
- "GPBMetadata\\Google\\Protobuf\\Wrappers");
-
-#undef DEFINE_GPBMETADATA_FILE
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Any.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Any.php
deleted file mode 100644
index 22cc25008f..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Any.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/any.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class Any
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- $pool->internalAddGeneratedFile(hex2bin(
- "0acd010a19676f6f676c652f70726f746f6275662f616e792e70726f746f" .
- "120f676f6f676c652e70726f746f62756622260a03416e7912100a087479" .
- "70655f75726c180120012809120d0a0576616c756518022001280c426f0a" .
- "13636f6d2e676f6f676c652e70726f746f6275664208416e7950726f746f" .
- "50015a256769746875622e636f6d2f676f6c616e672f70726f746f627566" .
- "2f7074797065732f616e79a20203475042aa021e476f6f676c652e50726f" .
- "746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Api.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Api.php
deleted file mode 100644
index b18e0d33ac..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Api.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/api.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class Api
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- \GPBMetadata\Google\Protobuf\SourceContext::initOnce();
- \GPBMetadata\Google\Protobuf\Type::initOnce();
- $pool->internalAddGeneratedFile(hex2bin(
- "0ac8050a19676f6f676c652f70726f746f6275662f6170692e70726f746f" .
- "120f676f6f676c652e70726f746f6275661a1a676f6f676c652f70726f74" .
- "6f6275662f747970652e70726f746f2281020a03417069120c0a046e616d" .
- "6518012001280912280a076d6574686f647318022003280b32172e676f6f" .
- "676c652e70726f746f6275662e4d6574686f6412280a076f7074696f6e73" .
- "18032003280b32172e676f6f676c652e70726f746f6275662e4f7074696f" .
- "6e120f0a0776657273696f6e18042001280912360a0e736f757263655f63" .
- "6f6e7465787418052001280b321e2e676f6f676c652e70726f746f627566" .
- "2e536f75726365436f6e7465787412260a066d6978696e7318062003280b" .
- "32162e676f6f676c652e70726f746f6275662e4d6978696e12270a067379" .
- "6e74617818072001280e32172e676f6f676c652e70726f746f6275662e53" .
- "796e74617822d5010a064d6574686f64120c0a046e616d65180120012809" .
- "12180a10726571756573745f747970655f75726c18022001280912190a11" .
- "726571756573745f73747265616d696e6718032001280812190a11726573" .
- "706f6e73655f747970655f75726c180420012809121a0a12726573706f6e" .
- "73655f73747265616d696e6718052001280812280a076f7074696f6e7318" .
- "062003280b32172e676f6f676c652e70726f746f6275662e4f7074696f6e" .
- "12270a0673796e74617818072001280e32172e676f6f676c652e70726f74" .
- "6f6275662e53796e74617822230a054d6978696e120c0a046e616d651801" .
- "20012809120c0a04726f6f7418022001280942750a13636f6d2e676f6f67" .
- "6c652e70726f746f627566420841706950726f746f50015a2b676f6f676c" .
- "652e676f6c616e672e6f72672f67656e70726f746f2f70726f746f627566" .
- "2f6170693b617069a20203475042aa021e476f6f676c652e50726f746f62" .
- "75662e57656c6c4b6e6f776e5479706573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Duration.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Duration.php
deleted file mode 100644
index b1c85ad889..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Duration.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/duration.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class Duration
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- $pool->internalAddGeneratedFile(hex2bin(
- "0ae3010a1e676f6f676c652f70726f746f6275662f6475726174696f6e2e" .
- "70726f746f120f676f6f676c652e70726f746f627566222a0a0844757261" .
- "74696f6e120f0a077365636f6e6473180120012803120d0a056e616e6f73" .
- "180220012805427c0a13636f6d2e676f6f676c652e70726f746f62756642" .
- "0d4475726174696f6e50726f746f50015a2a6769746875622e636f6d2f67" .
- "6f6c616e672f70726f746f6275662f7074797065732f6475726174696f6e" .
- "f80101a20203475042aa021e476f6f676c652e50726f746f6275662e5765" .
- "6c6c4b6e6f776e5479706573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/FieldMask.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/FieldMask.php
deleted file mode 100644
index 5812be1e24..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/FieldMask.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/field_mask.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class FieldMask
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- $pool->internalAddGeneratedFile(hex2bin(
- "0ae3010a20676f6f676c652f70726f746f6275662f6669656c645f6d6173" .
- "6b2e70726f746f120f676f6f676c652e70726f746f627566221a0a094669" .
- "656c644d61736b120d0a0570617468731801200328094289010a13636f6d" .
- "2e676f6f676c652e70726f746f627566420e4669656c644d61736b50726f" .
- "746f50015a39676f6f676c652e676f6c616e672e6f72672f67656e70726f" .
- "746f2f70726f746f6275662f6669656c645f6d61736b3b6669656c645f6d" .
- "61736ba20203475042aa021e476f6f676c652e50726f746f6275662e5765" .
- "6c6c4b6e6f776e5479706573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php
deleted file mode 100644
index 88f42a11a4..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/empty.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class GPBEmpty
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- $pool->internalAddGeneratedFile(hex2bin(
- "0ab7010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f" .
- "746f120f676f6f676c652e70726f746f62756622070a05456d7074794276" .
- "0a13636f6d2e676f6f676c652e70726f746f627566420a456d7074795072" .
- "6f746f50015a276769746875622e636f6d2f676f6c616e672f70726f746f" .
- "6275662f7074797065732f656d707479f80101a20203475042aa021e476f" .
- "6f676c652e50726f746f6275662e57656c6c4b6e6f776e54797065736206" .
- "70726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/SourceContext.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/SourceContext.php
deleted file mode 100644
index 495c6de410..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/SourceContext.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/source_context.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class SourceContext
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- $pool->internalAddGeneratedFile(hex2bin(
- "0afb010a24676f6f676c652f70726f746f6275662f736f757263655f636f" .
- "6e746578742e70726f746f120f676f6f676c652e70726f746f6275662222" .
- "0a0d536f75726365436f6e7465787412110a0966696c655f6e616d651801" .
- "200128094295010a13636f6d2e676f6f676c652e70726f746f6275664212" .
- "536f75726365436f6e7465787450726f746f50015a41676f6f676c652e67" .
- "6f6c616e672e6f72672f67656e70726f746f2f70726f746f6275662f736f" .
- "757263655f636f6e746578743b736f757263655f636f6e74657874a20203" .
- "475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f77" .
- "6e5479706573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Struct.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Struct.php
deleted file mode 100644
index 96b42af41d..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Struct.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/struct.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class Struct
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- $pool->internalAddGeneratedFile(hex2bin(
- "0a81050a1c676f6f676c652f70726f746f6275662f7374727563742e7072" .
- "6f746f120f676f6f676c652e70726f746f6275662284010a065374727563" .
- "7412330a066669656c647318012003280b32232e676f6f676c652e70726f" .
- "746f6275662e5374727563742e4669656c6473456e7472791a450a0b4669" .
- "656c6473456e747279120b0a036b657918012001280912250a0576616c75" .
- "6518022001280b32162e676f6f676c652e70726f746f6275662e56616c75" .
- "653a02380122ea010a0556616c756512300a0a6e756c6c5f76616c756518" .
- "012001280e321a2e676f6f676c652e70726f746f6275662e4e756c6c5661" .
- "6c7565480012160a0c6e756d6265725f76616c7565180220012801480012" .
- "160a0c737472696e675f76616c7565180320012809480012140a0a626f6f" .
- "6c5f76616c75651804200128084800122f0a0c7374727563745f76616c75" .
- "6518052001280b32172e676f6f676c652e70726f746f6275662e53747275" .
- "6374480012300a0a6c6973745f76616c756518062001280b321a2e676f6f" .
- "676c652e70726f746f6275662e4c69737456616c7565480042060a046b69" .
- "6e6422330a094c69737456616c756512260a0676616c7565731801200328" .
- "0b32162e676f6f676c652e70726f746f6275662e56616c75652a1b0a094e" .
- "756c6c56616c7565120e0a0a4e554c4c5f56414c554510004281010a1363" .
- "6f6d2e676f6f676c652e70726f746f627566420b53747275637450726f74" .
- "6f50015a316769746875622e636f6d2f676f6c616e672f70726f746f6275" .
- "662f7074797065732f7374727563743b7374727563747062f80101a20203" .
- "475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f77" .
- "6e5479706573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Timestamp.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Timestamp.php
deleted file mode 100644
index 373665c977..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Timestamp.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/timestamp.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class Timestamp
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- $pool->internalAddGeneratedFile(hex2bin(
- "0ae7010a1f676f6f676c652f70726f746f6275662f74696d657374616d70" .
- "2e70726f746f120f676f6f676c652e70726f746f627566222b0a0954696d" .
- "657374616d70120f0a077365636f6e6473180120012803120d0a056e616e" .
- "6f73180220012805427e0a13636f6d2e676f6f676c652e70726f746f6275" .
- "66420e54696d657374616d7050726f746f50015a2b6769746875622e636f" .
- "6d2f676f6c616e672f70726f746f6275662f7074797065732f74696d6573" .
- "74616d70f80101a20203475042aa021e476f6f676c652e50726f746f6275" .
- "662e57656c6c4b6e6f776e5479706573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Type.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Type.php
deleted file mode 100644
index 8fbe8cbfe0..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Type.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class Type
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- \GPBMetadata\Google\Protobuf\Any::initOnce();
- \GPBMetadata\Google\Protobuf\SourceContext::initOnce();
- $pool->internalAddGeneratedFile(hex2bin(
- "0a9f0c0a1a676f6f676c652f70726f746f6275662f747970652e70726f74" .
- "6f120f676f6f676c652e70726f746f6275661a24676f6f676c652f70726f" .
- "746f6275662f736f757263655f636f6e746578742e70726f746f22d7010a" .
- "0454797065120c0a046e616d6518012001280912260a066669656c647318" .
- "022003280b32162e676f6f676c652e70726f746f6275662e4669656c6412" .
- "0e0a066f6e656f667318032003280912280a076f7074696f6e7318042003" .
- "280b32172e676f6f676c652e70726f746f6275662e4f7074696f6e12360a" .
- "0e736f757263655f636f6e7465787418052001280b321e2e676f6f676c65" .
- "2e70726f746f6275662e536f75726365436f6e7465787412270a0673796e" .
- "74617818062001280e32172e676f6f676c652e70726f746f6275662e5379" .
- "6e74617822d5050a054669656c6412290a046b696e6418012001280e321b" .
- "2e676f6f676c652e70726f746f6275662e4669656c642e4b696e6412370a" .
- "0b63617264696e616c69747918022001280e32222e676f6f676c652e7072" .
- "6f746f6275662e4669656c642e43617264696e616c697479120e0a066e75" .
- "6d626572180320012805120c0a046e616d6518042001280912100a087479" .
- "70655f75726c18062001280912130a0b6f6e656f665f696e646578180720" .
- "012805120e0a067061636b656418082001280812280a076f7074696f6e73" .
- "18092003280b32172e676f6f676c652e70726f746f6275662e4f7074696f" .
- "6e12110a096a736f6e5f6e616d65180a2001280912150a0d64656661756c" .
- "745f76616c7565180b2001280922c8020a044b696e6412100a0c54595045" .
- "5f554e4b4e4f574e1000120f0a0b545950455f444f55424c451001120e0a" .
- "0a545950455f464c4f41541002120e0a0a545950455f494e543634100312" .
- "0f0a0b545950455f55494e5436341004120e0a0a545950455f494e543332" .
- "100512100a0c545950455f46495845443634100612100a0c545950455f46" .
- "4958454433321007120d0a09545950455f424f4f4c1008120f0a0b545950" .
- "455f535452494e471009120e0a0a545950455f47524f5550100a12100a0c" .
- "545950455f4d455353414745100b120e0a0a545950455f4259544553100c" .
- "120f0a0b545950455f55494e543332100d120d0a09545950455f454e554d" .
- "100e12110a0d545950455f5346495845443332100f12110a0d545950455f" .
- "53464958454436341010120f0a0b545950455f53494e5433321011120f0a" .
- "0b545950455f53494e543634101222740a0b43617264696e616c69747912" .
- "170a1343415244494e414c4954595f554e4b4e4f574e100012180a144341" .
- "5244494e414c4954595f4f5054494f4e414c100112180a1443415244494e" .
- "414c4954595f5245515549524544100212180a1443415244494e414c4954" .
- "595f5245504541544544100322ce010a04456e756d120c0a046e616d6518" .
- "0120012809122d0a09656e756d76616c756518022003280b321a2e676f6f" .
- "676c652e70726f746f6275662e456e756d56616c756512280a076f707469" .
- "6f6e7318032003280b32172e676f6f676c652e70726f746f6275662e4f70" .
- "74696f6e12360a0e736f757263655f636f6e7465787418042001280b321e" .
- "2e676f6f676c652e70726f746f6275662e536f75726365436f6e74657874" .
- "12270a0673796e74617818052001280e32172e676f6f676c652e70726f74" .
- "6f6275662e53796e74617822530a09456e756d56616c7565120c0a046e61" .
- "6d65180120012809120e0a066e756d62657218022001280512280a076f70" .
- "74696f6e7318032003280b32172e676f6f676c652e70726f746f6275662e" .
- "4f7074696f6e223b0a064f7074696f6e120c0a046e616d65180120012809" .
- "12230a0576616c756518022001280b32142e676f6f676c652e70726f746f" .
- "6275662e416e792a2e0a0653796e74617812110a0d53594e5441585f5052" .
- "4f544f32100012110a0d53594e5441585f50524f544f331001427d0a1363" .
- "6f6d2e676f6f676c652e70726f746f62756642095479706550726f746f50" .
- "015a2f676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f" .
- "70726f746f6275662f70747970653b7074797065f80101a20203475042aa" .
- "021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e547970" .
- "6573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Wrappers.php b/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Wrappers.php
deleted file mode 100644
index dd72ff48ce..0000000000
--- a/third_party/protobuf/3.6.0/php/src/GPBMetadata/Google/Protobuf/Wrappers.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace GPBMetadata\Google\Protobuf;
-
-class Wrappers
-{
- public static $is_initialized = false;
-
- public static function initOnce() {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-
- if (static::$is_initialized == true) {
- return;
- }
- $pool->internalAddGeneratedFile(hex2bin(
- "0abf030a1e676f6f676c652f70726f746f6275662f77726170706572732e" .
- "70726f746f120f676f6f676c652e70726f746f627566221c0a0b446f7562" .
- "6c6556616c7565120d0a0576616c7565180120012801221b0a0a466c6f61" .
- "7456616c7565120d0a0576616c7565180120012802221b0a0a496e743634" .
- "56616c7565120d0a0576616c7565180120012803221c0a0b55496e743634" .
- "56616c7565120d0a0576616c7565180120012804221b0a0a496e74333256" .
- "616c7565120d0a0576616c7565180120012805221c0a0b55496e74333256" .
- "616c7565120d0a0576616c756518012001280d221a0a09426f6f6c56616c" .
- "7565120d0a0576616c7565180120012808221c0a0b537472696e6756616c" .
- "7565120d0a0576616c7565180120012809221b0a0a427974657356616c75" .
- "65120d0a0576616c756518012001280c427c0a13636f6d2e676f6f676c65" .
- "2e70726f746f627566420d577261707065727350726f746f50015a2a6769" .
- "746875622e636f6d2f676f6c616e672f70726f746f6275662f7074797065" .
- "732f7772617070657273f80101a20203475042aa021e476f6f676c652e50" .
- "726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
- ));
-
- static::$is_initialized = true;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Any.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Any.php
deleted file mode 100644
index a992854957..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Any.php
+++ /dev/null
@@ -1,325 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/any.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\Message;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * `Any` contains an arbitrary serialized protocol buffer message along with a
- * URL that describes the type of the serialized message.
- * Protobuf library provides support to pack/unpack Any values in the form
- * of utility functions or additional generated methods of the Any type.
- * Example 1: Pack and unpack a message in C++.
- * Foo foo = ...;
- * Any any;
- * any.PackFrom(foo);
- * ...
- * if (any.UnpackTo(&foo)) {
- * ...
- * }
- * Example 2: Pack and unpack a message in Java.
- * Foo foo = ...;
- * Any any = Any.pack(foo);
- * ...
- * if (any.is(Foo.class)) {
- * foo = any.unpack(Foo.class);
- * }
- * Example 3: Pack and unpack a message in Python.
- * foo = Foo(...)
- * any = Any()
- * any.Pack(foo)
- * ...
- * if any.Is(Foo.DESCRIPTOR):
- * any.Unpack(foo)
- * ...
- * Example 4: Pack and unpack a message in Go
- * foo := &pb.Foo{...}
- * any, err := ptypes.MarshalAny(foo)
- * ...
- * foo := &pb.Foo{}
- * if err := ptypes.UnmarshalAny(any, foo); err != nil {
- * ...
- * }
- * The pack methods provided by protobuf library will by default use
- * 'type.googleapis.com/full.type.name' as the type URL and the unpack
- * methods only use the fully qualified type name after the last '/'
- * in the type URL, for example "foo.bar.com/x/y.z" will yield type
- * name "y.z".
- * JSON
- * ====
- * The JSON representation of an `Any` value uses the regular
- * representation of the deserialized, embedded message, with an
- * additional field `&#64;type` which contains the type URL. Example:
- * package google.profile;
- * message Person {
- * string first_name = 1;
- * string last_name = 2;
- * }
- * {
- * "&#64;type": "type.googleapis.com/google.profile.Person",
- * "firstName": <string>,
- * "lastName": <string>
- * }
- * If the embedded message type is well-known and has a custom JSON
- * representation, that representation will be embedded adding a field
- * `value` which holds the custom JSON in addition to the `&#64;type`
- * field. Example (for message [google.protobuf.Duration][]):
- * {
- * "&#64;type": "type.googleapis.com/google.protobuf.Duration",
- * "value": "1.212s"
- * }
- *
- * Generated from protobuf message <code>google.protobuf.Any</code>
- */
-class Any extends \Google\Protobuf\Internal\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).
- * 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.
- * * 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
- * URL, or have them precompiled into a binary to avoid any
- * lookup. Therefore, binary compatibility needs to be preserved
- * 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.
- *
- * Generated from protobuf field <code>string type_url = 1;</code>
- */
- private $type_url = '';
- /**
- * Must be a valid serialized protocol buffer of the above specified type.
- *
- * Generated from protobuf field <code>bytes value = 2;</code>
- */
- private $value = '';
-
- const TYPE_URL_PREFIX = 'type.googleapis.com/';
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $type_url
- * 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).
- * 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.
- * * 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
- * URL, or have them precompiled into a binary to avoid any
- * lookup. Therefore, binary compatibility needs to be preserved
- * 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.
- * @type string $value
- * Must be a valid serialized protocol buffer of the above specified type.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Any::initOnce();
- parent::__construct($data);
- }
-
- /**
- * 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).
- * 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.
- * * 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
- * URL, or have them precompiled into a binary to avoid any
- * lookup. Therefore, binary compatibility needs to be preserved
- * 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.
- *
- * Generated from protobuf field <code>string type_url = 1;</code>
- * @return string
- */
- public function getTypeUrl()
- {
- return $this->type_url;
- }
-
- /**
- * 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).
- * 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.
- * * 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
- * URL, or have them precompiled into a binary to avoid any
- * lookup. Therefore, binary compatibility needs to be preserved
- * 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.
- *
- * Generated from protobuf field <code>string type_url = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setTypeUrl($var)
- {
- GPBUtil::checkString($var, True);
- $this->type_url = $var;
-
- return $this;
- }
-
- /**
- * Must be a valid serialized protocol buffer of the above specified type.
- *
- * Generated from protobuf field <code>bytes value = 2;</code>
- * @return string
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * Must be a valid serialized protocol buffer of the above specified type.
- *
- * Generated from protobuf field <code>bytes value = 2;</code>
- * @param string $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkString($var, False);
- $this->value = $var;
-
- return $this;
- }
-
- /**
- * This method will try to resolve the type_url in Any message to get the
- * targeted message type. If failed, an error will be thrown. Otherwise,
- * the method will create a message of the targeted type and fill it with
- * the decoded value in Any.
- * @return unpacked message
- * @throws Exception Type url needs to be type.googleapis.com/fully-qulified.
- * @throws Exception Class hasn't been added to descriptor pool.
- * @throws Exception cannot decode data in value field.
- */
- public function unpack()
- {
- // Get fully qualifed name from type url.
- $url_prifix_len = strlen(GPBUtil::TYPE_URL_PREFIX);
- if (substr($this->type_url, 0, $url_prifix_len) !=
- GPBUtil::TYPE_URL_PREFIX) {
- throw new \Exception(
- "Type url needs to be type.googleapis.com/fully-qulified");
- }
- $fully_qualifed_name =
- substr($this->type_url, $url_prifix_len);
-
- // Create message according to fully qualified name.
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
- $desc = $pool->getDescriptorByProtoName( ".".$fully_qualifed_name);
- if (is_null($desc)) {
- throw new \Exception("Class ".$fully_qualifed_name
- ." hasn't been added to descriptor pool");
- }
- $klass = $desc->getClass();
- $msg = new $klass();
-
- // Merge data into message.
- $msg->mergeFromString($this->value);
- return $msg;
- }
-
- /**
- * The type_url will be created according to the given message’s type and
- * the value is encoded data from the given message..
- * @param message: A proto message.
- */
- public function pack($msg)
- {
- if (!$msg instanceof Message) {
- trigger_error("Given parameter is not a message instance.",
- E_USER_ERROR);
- return;
- }
-
- // Set value using serialzed message.
- $this->value = $msg->serializeToString();
-
- // Set type url.
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
- $desc = $pool->getDescriptorByClassName(get_class($msg));
- $fully_qualifed_name = $desc->getFullName();
- $this->type_url = GPBUtil::TYPE_URL_PREFIX.substr(
- $fully_qualifed_name, 1, strlen($fully_qualifed_name));
- }
-
- /**
- * This method returns whether the type_url in any_message is corresponded
- * to the given class.
- * @param klass: The fully qualified PHP class name of a proto message type.
- */
- public function is($klass)
- {
- $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
- $desc = $pool->getDescriptorByClassName($klass);
- $fully_qualifed_name = $desc->getFullName();
- $type_url = GPBUtil::TYPE_URL_PREFIX.substr(
- $fully_qualifed_name, 1, strlen($fully_qualifed_name));
- return $this->type_url === $type_url;
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Api.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Api.php
deleted file mode 100644
index db37ffb019..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Api.php
+++ /dev/null
@@ -1,350 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/api.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Api is a light-weight descriptor for an API Interface.
- * Interfaces are also described as "protocol buffer services" in some contexts,
- * such as by the "service" keyword in a .proto file, but they are different
- * from API Services, which represent a concrete implementation of an interface
- * as opposed to simply a description of methods and bindings. They are also
- * sometimes simply referred to as "APIs" in other contexts, such as the name of
- * this message itself. See https://cloud.google.com/apis/design/glossary for
- * detailed terminology.
- *
- * Generated from protobuf message <code>google.protobuf.Api</code>
- */
-class Api extends \Google\Protobuf\Internal\Message
-{
- /**
- * The fully qualified name of this interface, including package name
- * followed by the interface's simple name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- */
- private $name = '';
- /**
- * The methods of this interface, in unspecified order.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Method methods = 2;</code>
- */
- private $methods;
- /**
- * Any metadata attached to the interface.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- */
- private $options;
- /**
- * A version string for this interface. If specified, must have the form
- * `major-version.minor-version`, as in `1.10`. If the minor version is
- * omitted, it defaults to zero. If the entire version field is empty, the
- * major version is derived from the package name, as outlined below. If the
- * field is not empty, the version in the package name will be verified to be
- * consistent with what is provided here.
- * The versioning schema uses [semantic
- * versioning](http://semver.org) where the major version number
- * indicates a breaking change and the minor version an additive,
- * non-breaking change. Both version numbers are signals to users
- * what to expect from different versions, and should be carefully
- * chosen based on the product plan.
- * The major version is also reflected in the package name of the
- * interface, which must end in `v<major-version>`, as in
- * `google.feature.v1`. For major versions 0 and 1, the suffix can
- * be omitted. Zero major versions must only be used for
- * experimental, non-GA interfaces.
- *
- * Generated from protobuf field <code>string version = 4;</code>
- */
- private $version = '';
- /**
- * Source context for the protocol buffer service represented by this
- * message.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 5;</code>
- */
- private $source_context = null;
- /**
- * Included interfaces. See [Mixin][].
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Mixin mixins = 6;</code>
- */
- private $mixins;
- /**
- * The source syntax of the service.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
- */
- private $syntax = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * The fully qualified name of this interface, including package name
- * followed by the interface's simple name.
- * @type \Google\Protobuf\Method[]|\Google\Protobuf\Internal\RepeatedField $methods
- * The methods of this interface, in unspecified order.
- * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
- * Any metadata attached to the interface.
- * @type string $version
- * A version string for this interface. If specified, must have the form
- * `major-version.minor-version`, as in `1.10`. If the minor version is
- * omitted, it defaults to zero. If the entire version field is empty, the
- * major version is derived from the package name, as outlined below. If the
- * field is not empty, the version in the package name will be verified to be
- * consistent with what is provided here.
- * The versioning schema uses [semantic
- * versioning](http://semver.org) where the major version number
- * indicates a breaking change and the minor version an additive,
- * non-breaking change. Both version numbers are signals to users
- * what to expect from different versions, and should be carefully
- * chosen based on the product plan.
- * The major version is also reflected in the package name of the
- * interface, which must end in `v<major-version>`, as in
- * `google.feature.v1`. For major versions 0 and 1, the suffix can
- * be omitted. Zero major versions must only be used for
- * experimental, non-GA interfaces.
- * @type \Google\Protobuf\SourceContext $source_context
- * Source context for the protocol buffer service represented by this
- * message.
- * @type \Google\Protobuf\Mixin[]|\Google\Protobuf\Internal\RepeatedField $mixins
- * Included interfaces. See [Mixin][].
- * @type int $syntax
- * The source syntax of the service.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Api::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The fully qualified name of this interface, including package name
- * followed by the interface's simple name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * The fully qualified name of this interface, including package name
- * followed by the interface's simple name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * The methods of this interface, in unspecified order.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Method methods = 2;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getMethods()
- {
- return $this->methods;
- }
-
- /**
- * The methods of this interface, in unspecified order.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Method methods = 2;</code>
- * @param \Google\Protobuf\Method[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setMethods($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Method::class);
- $this->methods = $arr;
-
- return $this;
- }
-
- /**
- * Any metadata attached to the interface.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * Any metadata attached to the interface.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setOptions($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
- $this->options = $arr;
-
- return $this;
- }
-
- /**
- * A version string for this interface. If specified, must have the form
- * `major-version.minor-version`, as in `1.10`. If the minor version is
- * omitted, it defaults to zero. If the entire version field is empty, the
- * major version is derived from the package name, as outlined below. If the
- * field is not empty, the version in the package name will be verified to be
- * consistent with what is provided here.
- * The versioning schema uses [semantic
- * versioning](http://semver.org) where the major version number
- * indicates a breaking change and the minor version an additive,
- * non-breaking change. Both version numbers are signals to users
- * what to expect from different versions, and should be carefully
- * chosen based on the product plan.
- * The major version is also reflected in the package name of the
- * interface, which must end in `v<major-version>`, as in
- * `google.feature.v1`. For major versions 0 and 1, the suffix can
- * be omitted. Zero major versions must only be used for
- * experimental, non-GA interfaces.
- *
- * Generated from protobuf field <code>string version = 4;</code>
- * @return string
- */
- public function getVersion()
- {
- return $this->version;
- }
-
- /**
- * A version string for this interface. If specified, must have the form
- * `major-version.minor-version`, as in `1.10`. If the minor version is
- * omitted, it defaults to zero. If the entire version field is empty, the
- * major version is derived from the package name, as outlined below. If the
- * field is not empty, the version in the package name will be verified to be
- * consistent with what is provided here.
- * The versioning schema uses [semantic
- * versioning](http://semver.org) where the major version number
- * indicates a breaking change and the minor version an additive,
- * non-breaking change. Both version numbers are signals to users
- * what to expect from different versions, and should be carefully
- * chosen based on the product plan.
- * The major version is also reflected in the package name of the
- * interface, which must end in `v<major-version>`, as in
- * `google.feature.v1`. For major versions 0 and 1, the suffix can
- * be omitted. Zero major versions must only be used for
- * experimental, non-GA interfaces.
- *
- * Generated from protobuf field <code>string version = 4;</code>
- * @param string $var
- * @return $this
- */
- public function setVersion($var)
- {
- GPBUtil::checkString($var, True);
- $this->version = $var;
-
- return $this;
- }
-
- /**
- * Source context for the protocol buffer service represented by this
- * message.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 5;</code>
- * @return \Google\Protobuf\SourceContext
- */
- public function getSourceContext()
- {
- return $this->source_context;
- }
-
- /**
- * Source context for the protocol buffer service represented by this
- * message.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 5;</code>
- * @param \Google\Protobuf\SourceContext $var
- * @return $this
- */
- public function setSourceContext($var)
- {
- GPBUtil::checkMessage($var, \Google\Protobuf\SourceContext::class);
- $this->source_context = $var;
-
- return $this;
- }
-
- /**
- * Included interfaces. See [Mixin][].
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Mixin mixins = 6;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getMixins()
- {
- return $this->mixins;
- }
-
- /**
- * Included interfaces. See [Mixin][].
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Mixin mixins = 6;</code>
- * @param \Google\Protobuf\Mixin[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setMixins($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Mixin::class);
- $this->mixins = $arr;
-
- return $this;
- }
-
- /**
- * The source syntax of the service.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
- * @return int
- */
- public function getSyntax()
- {
- return $this->syntax;
- }
-
- /**
- * The source syntax of the service.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
- * @param int $var
- * @return $this
- */
- public function setSyntax($var)
- {
- GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class);
- $this->syntax = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/BoolValue.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/BoolValue.php
deleted file mode 100644
index 13872eb1e4..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/BoolValue.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `bool`.
- * The JSON representation for `BoolValue` is JSON `true` and `false`.
- *
- * Generated from protobuf message <code>google.protobuf.BoolValue</code>
- */
-class BoolValue extends \Google\Protobuf\Internal\Message
-{
- /**
- * The bool value.
- *
- * Generated from protobuf field <code>bool value = 1;</code>
- */
- private $value = false;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type bool $value
- * The bool value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The bool value.
- *
- * Generated from protobuf field <code>bool value = 1;</code>
- * @return bool
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The bool value.
- *
- * Generated from protobuf field <code>bool value = 1;</code>
- * @param bool $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkBool($var);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/BytesValue.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/BytesValue.php
deleted file mode 100644
index f1b3817185..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/BytesValue.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `bytes`.
- * The JSON representation for `BytesValue` is JSON string.
- *
- * Generated from protobuf message <code>google.protobuf.BytesValue</code>
- */
-class BytesValue extends \Google\Protobuf\Internal\Message
-{
- /**
- * The bytes value.
- *
- * Generated from protobuf field <code>bytes value = 1;</code>
- */
- private $value = '';
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $value
- * The bytes value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The bytes value.
- *
- * Generated from protobuf field <code>bytes value = 1;</code>
- * @return string
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The bytes value.
- *
- * Generated from protobuf field <code>bytes value = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkString($var, False);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/DoubleValue.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/DoubleValue.php
deleted file mode 100644
index 236d918223..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/DoubleValue.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `double`.
- * The JSON representation for `DoubleValue` is JSON number.
- *
- * Generated from protobuf message <code>google.protobuf.DoubleValue</code>
- */
-class DoubleValue extends \Google\Protobuf\Internal\Message
-{
- /**
- * The double value.
- *
- * Generated from protobuf field <code>double value = 1;</code>
- */
- private $value = 0.0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type float $value
- * The double value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The double value.
- *
- * Generated from protobuf field <code>double value = 1;</code>
- * @return float
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The double value.
- *
- * Generated from protobuf field <code>double value = 1;</code>
- * @param float $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkDouble($var);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Duration.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Duration.php
deleted file mode 100644
index 414a1868b7..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Duration.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/duration.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * A Duration represents a signed, fixed-length span of time represented
- * as a count of seconds and fractions of seconds at nanosecond
- * resolution. It is independent of any calendar and concepts like "day"
- * or "month". It is related to Timestamp in that the difference between
- * two Timestamp values is a Duration and it can be added or subtracted
- * from a Timestamp. Range is approximately +-10,000 years.
- * # Examples
- * Example 1: Compute Duration from two Timestamps in pseudo code.
- * Timestamp start = ...;
- * Timestamp end = ...;
- * Duration duration = ...;
- * duration.seconds = end.seconds - start.seconds;
- * duration.nanos = end.nanos - start.nanos;
- * if (duration.seconds < 0 && duration.nanos > 0) {
- * duration.seconds += 1;
- * duration.nanos -= 1000000000;
- * } else if (durations.seconds > 0 && duration.nanos < 0) {
- * duration.seconds -= 1;
- * duration.nanos += 1000000000;
- * }
- * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
- * Timestamp start = ...;
- * Duration duration = ...;
- * Timestamp end = ...;
- * end.seconds = start.seconds + duration.seconds;
- * end.nanos = start.nanos + duration.nanos;
- * if (end.nanos < 0) {
- * end.seconds -= 1;
- * end.nanos += 1000000000;
- * } else if (end.nanos >= 1000000000) {
- * end.seconds += 1;
- * end.nanos -= 1000000000;
- * }
- * Example 3: Compute Duration from datetime.timedelta in Python.
- * td = datetime.timedelta(days=3, minutes=10)
- * duration = Duration()
- * duration.FromTimedelta(td)
- * # JSON Mapping
- * In JSON format, the Duration type is encoded as a string rather than an
- * object, where the string ends in the suffix "s" (indicating seconds) and
- * is preceded by the number of seconds, with nanoseconds expressed as
- * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
- * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
- * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
- * microsecond should be expressed in JSON format as "3.000001s".
- *
- * Generated from protobuf message <code>google.protobuf.Duration</code>
- */
-class Duration extends \Google\Protobuf\Internal\Message
-{
- /**
- * Signed seconds of the span of time. Must be from -315,576,000,000
- * to +315,576,000,000 inclusive. Note: these bounds are computed from:
- * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
- *
- * Generated from protobuf field <code>int64 seconds = 1;</code>
- */
- private $seconds = 0;
- /**
- * Signed fractions of a second at nanosecond resolution of the span
- * of time. Durations less than one second are represented with a 0
- * `seconds` field and a positive or negative `nanos` field. For durations
- * of one second or more, a non-zero value for the `nanos` field must be
- * of the same sign as the `seconds` field. Must be from -999,999,999
- * to +999,999,999 inclusive.
- *
- * Generated from protobuf field <code>int32 nanos = 2;</code>
- */
- private $nanos = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int|string $seconds
- * Signed seconds of the span of time. Must be from -315,576,000,000
- * to +315,576,000,000 inclusive. Note: these bounds are computed from:
- * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
- * @type int $nanos
- * Signed fractions of a second at nanosecond resolution of the span
- * of time. Durations less than one second are represented with a 0
- * `seconds` field and a positive or negative `nanos` field. For durations
- * of one second or more, a non-zero value for the `nanos` field must be
- * of the same sign as the `seconds` field. Must be from -999,999,999
- * to +999,999,999 inclusive.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Duration::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Signed seconds of the span of time. Must be from -315,576,000,000
- * to +315,576,000,000 inclusive. Note: these bounds are computed from:
- * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
- *
- * Generated from protobuf field <code>int64 seconds = 1;</code>
- * @return int|string
- */
- public function getSeconds()
- {
- return $this->seconds;
- }
-
- /**
- * Signed seconds of the span of time. Must be from -315,576,000,000
- * to +315,576,000,000 inclusive. Note: these bounds are computed from:
- * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
- *
- * Generated from protobuf field <code>int64 seconds = 1;</code>
- * @param int|string $var
- * @return $this
- */
- public function setSeconds($var)
- {
- GPBUtil::checkInt64($var);
- $this->seconds = $var;
-
- return $this;
- }
-
- /**
- * Signed fractions of a second at nanosecond resolution of the span
- * of time. Durations less than one second are represented with a 0
- * `seconds` field and a positive or negative `nanos` field. For durations
- * of one second or more, a non-zero value for the `nanos` field must be
- * of the same sign as the `seconds` field. Must be from -999,999,999
- * to +999,999,999 inclusive.
- *
- * Generated from protobuf field <code>int32 nanos = 2;</code>
- * @return int
- */
- public function getNanos()
- {
- return $this->nanos;
- }
-
- /**
- * Signed fractions of a second at nanosecond resolution of the span
- * of time. Durations less than one second are represented with a 0
- * `seconds` field and a positive or negative `nanos` field. For durations
- * of one second or more, a non-zero value for the `nanos` field must be
- * of the same sign as the `seconds` field. Must be from -999,999,999
- * to +999,999,999 inclusive.
- *
- * Generated from protobuf field <code>int32 nanos = 2;</code>
- * @param int $var
- * @return $this
- */
- public function setNanos($var)
- {
- GPBUtil::checkInt32($var);
- $this->nanos = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Enum.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Enum.php
deleted file mode 100644
index 243c40d289..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Enum.php
+++ /dev/null
@@ -1,203 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Enum type definition.
- *
- * Generated from protobuf message <code>google.protobuf.Enum</code>
- */
-class Enum extends \Google\Protobuf\Internal\Message
-{
- /**
- * Enum type name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- */
- private $name = '';
- /**
- * Enum value definitions.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
- */
- private $enumvalue;
- /**
- * Protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- */
- private $options;
- /**
- * The source context.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
- */
- private $source_context = null;
- /**
- * The source syntax.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
- */
- private $syntax = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * Enum type name.
- * @type \Google\Protobuf\EnumValue[]|\Google\Protobuf\Internal\RepeatedField $enumvalue
- * Enum value definitions.
- * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
- * Protocol buffer options.
- * @type \Google\Protobuf\SourceContext $source_context
- * The source context.
- * @type int $syntax
- * The source syntax.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Enum type name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * Enum type name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * Enum value definitions.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getEnumvalue()
- {
- return $this->enumvalue;
- }
-
- /**
- * Enum value definitions.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
- * @param \Google\Protobuf\EnumValue[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setEnumvalue($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\EnumValue::class);
- $this->enumvalue = $arr;
-
- return $this;
- }
-
- /**
- * Protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * Protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setOptions($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
- $this->options = $arr;
-
- return $this;
- }
-
- /**
- * The source context.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
- * @return \Google\Protobuf\SourceContext
- */
- public function getSourceContext()
- {
- return $this->source_context;
- }
-
- /**
- * The source context.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
- * @param \Google\Protobuf\SourceContext $var
- * @return $this
- */
- public function setSourceContext($var)
- {
- GPBUtil::checkMessage($var, \Google\Protobuf\SourceContext::class);
- $this->source_context = $var;
-
- return $this;
- }
-
- /**
- * The source syntax.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
- * @return int
- */
- public function getSyntax()
- {
- return $this->syntax;
- }
-
- /**
- * The source syntax.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
- * @param int $var
- * @return $this
- */
- public function setSyntax($var)
- {
- GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class);
- $this->syntax = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumValue.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumValue.php
deleted file mode 100644
index 1dc3c7a6ee..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/EnumValue.php
+++ /dev/null
@@ -1,135 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Enum value definition.
- *
- * Generated from protobuf message <code>google.protobuf.EnumValue</code>
- */
-class EnumValue extends \Google\Protobuf\Internal\Message
-{
- /**
- * Enum value name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- */
- private $name = '';
- /**
- * Enum value number.
- *
- * Generated from protobuf field <code>int32 number = 2;</code>
- */
- private $number = 0;
- /**
- * Protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- */
- private $options;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * Enum value name.
- * @type int $number
- * Enum value number.
- * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
- * Protocol buffer options.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Enum value name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * Enum value name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * Enum value number.
- *
- * Generated from protobuf field <code>int32 number = 2;</code>
- * @return int
- */
- public function getNumber()
- {
- return $this->number;
- }
-
- /**
- * Enum value number.
- *
- * Generated from protobuf field <code>int32 number = 2;</code>
- * @param int $var
- * @return $this
- */
- public function setNumber($var)
- {
- GPBUtil::checkInt32($var);
- $this->number = $var;
-
- return $this;
- }
-
- /**
- * Protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * Protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
- * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setOptions($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
- $this->options = $arr;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field.php
deleted file mode 100644
index 8da43e34da..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field.php
+++ /dev/null
@@ -1,381 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * A single field of a message type.
- *
- * Generated from protobuf message <code>google.protobuf.Field</code>
- */
-class Field extends \Google\Protobuf\Internal\Message
-{
- /**
- * The field type.
- *
- * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
- */
- private $kind = 0;
- /**
- * The field cardinality.
- *
- * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
- */
- private $cardinality = 0;
- /**
- * The field number.
- *
- * Generated from protobuf field <code>int32 number = 3;</code>
- */
- private $number = 0;
- /**
- * The field name.
- *
- * Generated from protobuf field <code>string name = 4;</code>
- */
- private $name = '';
- /**
- * The field type URL, without the scheme, for message or enumeration
- * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
- *
- * Generated from protobuf field <code>string type_url = 6;</code>
- */
- private $type_url = '';
- /**
- * The index of the field type in `Type.oneofs`, for message or enumeration
- * types. The first type has index 1; zero means the type is not in the list.
- *
- * Generated from protobuf field <code>int32 oneof_index = 7;</code>
- */
- private $oneof_index = 0;
- /**
- * Whether to use alternative packed wire representation.
- *
- * Generated from protobuf field <code>bool packed = 8;</code>
- */
- private $packed = false;
- /**
- * The protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
- */
- private $options;
- /**
- * The field JSON name.
- *
- * Generated from protobuf field <code>string json_name = 10;</code>
- */
- private $json_name = '';
- /**
- * The string value of the default value of this field. Proto2 syntax only.
- *
- * Generated from protobuf field <code>string default_value = 11;</code>
- */
- private $default_value = '';
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int $kind
- * The field type.
- * @type int $cardinality
- * The field cardinality.
- * @type int $number
- * The field number.
- * @type string $name
- * The field name.
- * @type string $type_url
- * The field type URL, without the scheme, for message or enumeration
- * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
- * @type int $oneof_index
- * The index of the field type in `Type.oneofs`, for message or enumeration
- * types. The first type has index 1; zero means the type is not in the list.
- * @type bool $packed
- * Whether to use alternative packed wire representation.
- * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
- * The protocol buffer options.
- * @type string $json_name
- * The field JSON name.
- * @type string $default_value
- * The string value of the default value of this field. Proto2 syntax only.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The field type.
- *
- * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
- * @return int
- */
- public function getKind()
- {
- return $this->kind;
- }
-
- /**
- * The field type.
- *
- * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
- * @param int $var
- * @return $this
- */
- public function setKind($var)
- {
- GPBUtil::checkEnum($var, \Google\Protobuf\Field_Kind::class);
- $this->kind = $var;
-
- return $this;
- }
-
- /**
- * The field cardinality.
- *
- * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
- * @return int
- */
- public function getCardinality()
- {
- return $this->cardinality;
- }
-
- /**
- * The field cardinality.
- *
- * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
- * @param int $var
- * @return $this
- */
- public function setCardinality($var)
- {
- GPBUtil::checkEnum($var, \Google\Protobuf\Field_Cardinality::class);
- $this->cardinality = $var;
-
- return $this;
- }
-
- /**
- * The field number.
- *
- * Generated from protobuf field <code>int32 number = 3;</code>
- * @return int
- */
- public function getNumber()
- {
- return $this->number;
- }
-
- /**
- * The field number.
- *
- * Generated from protobuf field <code>int32 number = 3;</code>
- * @param int $var
- * @return $this
- */
- public function setNumber($var)
- {
- GPBUtil::checkInt32($var);
- $this->number = $var;
-
- return $this;
- }
-
- /**
- * The field name.
- *
- * Generated from protobuf field <code>string name = 4;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * The field name.
- *
- * Generated from protobuf field <code>string name = 4;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * The field type URL, without the scheme, for message or enumeration
- * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
- *
- * Generated from protobuf field <code>string type_url = 6;</code>
- * @return string
- */
- public function getTypeUrl()
- {
- return $this->type_url;
- }
-
- /**
- * The field type URL, without the scheme, for message or enumeration
- * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
- *
- * Generated from protobuf field <code>string type_url = 6;</code>
- * @param string $var
- * @return $this
- */
- public function setTypeUrl($var)
- {
- GPBUtil::checkString($var, True);
- $this->type_url = $var;
-
- return $this;
- }
-
- /**
- * The index of the field type in `Type.oneofs`, for message or enumeration
- * types. The first type has index 1; zero means the type is not in the list.
- *
- * Generated from protobuf field <code>int32 oneof_index = 7;</code>
- * @return int
- */
- public function getOneofIndex()
- {
- return $this->oneof_index;
- }
-
- /**
- * The index of the field type in `Type.oneofs`, for message or enumeration
- * types. The first type has index 1; zero means the type is not in the list.
- *
- * Generated from protobuf field <code>int32 oneof_index = 7;</code>
- * @param int $var
- * @return $this
- */
- public function setOneofIndex($var)
- {
- GPBUtil::checkInt32($var);
- $this->oneof_index = $var;
-
- return $this;
- }
-
- /**
- * Whether to use alternative packed wire representation.
- *
- * Generated from protobuf field <code>bool packed = 8;</code>
- * @return bool
- */
- public function getPacked()
- {
- return $this->packed;
- }
-
- /**
- * Whether to use alternative packed wire representation.
- *
- * Generated from protobuf field <code>bool packed = 8;</code>
- * @param bool $var
- * @return $this
- */
- public function setPacked($var)
- {
- GPBUtil::checkBool($var);
- $this->packed = $var;
-
- return $this;
- }
-
- /**
- * The protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * The protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
- * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setOptions($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
- $this->options = $arr;
-
- return $this;
- }
-
- /**
- * The field JSON name.
- *
- * Generated from protobuf field <code>string json_name = 10;</code>
- * @return string
- */
- public function getJsonName()
- {
- return $this->json_name;
- }
-
- /**
- * The field JSON name.
- *
- * Generated from protobuf field <code>string json_name = 10;</code>
- * @param string $var
- * @return $this
- */
- public function setJsonName($var)
- {
- GPBUtil::checkString($var, True);
- $this->json_name = $var;
-
- return $this;
- }
-
- /**
- * The string value of the default value of this field. Proto2 syntax only.
- *
- * Generated from protobuf field <code>string default_value = 11;</code>
- * @return string
- */
- public function getDefaultValue()
- {
- return $this->default_value;
- }
-
- /**
- * The string value of the default value of this field. Proto2 syntax only.
- *
- * Generated from protobuf field <code>string default_value = 11;</code>
- * @param string $var
- * @return $this
- */
- public function setDefaultValue($var)
- {
- GPBUtil::checkString($var, True);
- $this->default_value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field/Cardinality.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field/Cardinality.php
deleted file mode 100644
index c887f6d31d..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field/Cardinality.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf\Field;
-
-/**
- * Whether a field is optional, required, or repeated.
- *
- * Protobuf type <code>google.protobuf.Field.Cardinality</code>
- */
-class Cardinality
-{
- /**
- * For fields with unknown cardinality.
- *
- * Generated from protobuf enum <code>CARDINALITY_UNKNOWN = 0;</code>
- */
- const CARDINALITY_UNKNOWN = 0;
- /**
- * For optional fields.
- *
- * Generated from protobuf enum <code>CARDINALITY_OPTIONAL = 1;</code>
- */
- const CARDINALITY_OPTIONAL = 1;
- /**
- * For required fields. Proto2 syntax only.
- *
- * Generated from protobuf enum <code>CARDINALITY_REQUIRED = 2;</code>
- */
- const CARDINALITY_REQUIRED = 2;
- /**
- * For repeated fields.
- *
- * Generated from protobuf enum <code>CARDINALITY_REPEATED = 3;</code>
- */
- const CARDINALITY_REPEATED = 3;
-}
-
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Cardinality::class, \Google\Protobuf\Field_Cardinality::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field/Kind.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field/Kind.php
deleted file mode 100644
index a2bbbdebbf..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field/Kind.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf\Field;
-
-/**
- * Basic field types.
- *
- * Protobuf type <code>google.protobuf.Field.Kind</code>
- */
-class Kind
-{
- /**
- * Field type unknown.
- *
- * Generated from protobuf enum <code>TYPE_UNKNOWN = 0;</code>
- */
- const TYPE_UNKNOWN = 0;
- /**
- * Field type double.
- *
- * Generated from protobuf enum <code>TYPE_DOUBLE = 1;</code>
- */
- const TYPE_DOUBLE = 1;
- /**
- * Field type float.
- *
- * Generated from protobuf enum <code>TYPE_FLOAT = 2;</code>
- */
- const TYPE_FLOAT = 2;
- /**
- * Field type int64.
- *
- * Generated from protobuf enum <code>TYPE_INT64 = 3;</code>
- */
- const TYPE_INT64 = 3;
- /**
- * Field type uint64.
- *
- * Generated from protobuf enum <code>TYPE_UINT64 = 4;</code>
- */
- const TYPE_UINT64 = 4;
- /**
- * Field type int32.
- *
- * Generated from protobuf enum <code>TYPE_INT32 = 5;</code>
- */
- const TYPE_INT32 = 5;
- /**
- * Field type fixed64.
- *
- * Generated from protobuf enum <code>TYPE_FIXED64 = 6;</code>
- */
- const TYPE_FIXED64 = 6;
- /**
- * Field type fixed32.
- *
- * Generated from protobuf enum <code>TYPE_FIXED32 = 7;</code>
- */
- const TYPE_FIXED32 = 7;
- /**
- * Field type bool.
- *
- * Generated from protobuf enum <code>TYPE_BOOL = 8;</code>
- */
- const TYPE_BOOL = 8;
- /**
- * Field type string.
- *
- * Generated from protobuf enum <code>TYPE_STRING = 9;</code>
- */
- const TYPE_STRING = 9;
- /**
- * Field type group. Proto2 syntax only, and deprecated.
- *
- * Generated from protobuf enum <code>TYPE_GROUP = 10;</code>
- */
- const TYPE_GROUP = 10;
- /**
- * Field type message.
- *
- * Generated from protobuf enum <code>TYPE_MESSAGE = 11;</code>
- */
- const TYPE_MESSAGE = 11;
- /**
- * Field type bytes.
- *
- * Generated from protobuf enum <code>TYPE_BYTES = 12;</code>
- */
- const TYPE_BYTES = 12;
- /**
- * Field type uint32.
- *
- * Generated from protobuf enum <code>TYPE_UINT32 = 13;</code>
- */
- const TYPE_UINT32 = 13;
- /**
- * Field type enum.
- *
- * Generated from protobuf enum <code>TYPE_ENUM = 14;</code>
- */
- const TYPE_ENUM = 14;
- /**
- * Field type sfixed32.
- *
- * Generated from protobuf enum <code>TYPE_SFIXED32 = 15;</code>
- */
- const TYPE_SFIXED32 = 15;
- /**
- * Field type sfixed64.
- *
- * Generated from protobuf enum <code>TYPE_SFIXED64 = 16;</code>
- */
- const TYPE_SFIXED64 = 16;
- /**
- * Field type sint32.
- *
- * Generated from protobuf enum <code>TYPE_SINT32 = 17;</code>
- */
- const TYPE_SINT32 = 17;
- /**
- * Field type sint64.
- *
- * Generated from protobuf enum <code>TYPE_SINT64 = 18;</code>
- */
- const TYPE_SINT64 = 18;
-}
-
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Kind::class, \Google\Protobuf\Field_Kind::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/FieldMask.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/FieldMask.php
deleted file mode 100644
index 8fb38cbfb2..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/FieldMask.php
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/field_mask.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * `FieldMask` represents a set of symbolic field paths, for example:
- * paths: "f.a"
- * paths: "f.b.d"
- * Here `f` represents a field in some root message, `a` and `b`
- * fields in the message found in `f`, and `d` a field found in the
- * message in `f.b`.
- * Field masks are used to specify a subset of fields that should be
- * returned by a get operation or modified by an update operation.
- * Field masks also have a custom JSON encoding (see below).
- * # Field Masks in Projections
- * When used in the context of a projection, a response message or
- * sub-message is filtered by the API to only contain those fields as
- * specified in the mask. For example, if the mask in the previous
- * example is applied to a response message as follows:
- * f {
- * a : 22
- * b {
- * d : 1
- * x : 2
- * }
- * y : 13
- * }
- * z: 8
- * The result will not contain specific values for fields x,y and z
- * (their value will be set to the default, and omitted in proto text
- * output):
- * f {
- * a : 22
- * b {
- * d : 1
- * }
- * }
- * A repeated field is not allowed except at the last position of a
- * paths string.
- * If a FieldMask object is not present in a get operation, the
- * operation applies to all fields (as if a FieldMask of all fields
- * had been specified).
- * Note that a field mask does not necessarily apply to the
- * top-level response message. In case of a REST get operation, the
- * field mask applies directly to the response, but in case of a REST
- * list operation, the mask instead applies to each individual message
- * in the returned resource list. In case of a REST custom method,
- * other definitions may be used. Where the mask applies will be
- * clearly documented together with its declaration in the API. In
- * any case, the effect on the returned resource/resources is required
- * behavior for APIs.
- * # Field Masks in Update Operations
- * A field mask in update operations specifies which fields of the
- * targeted resource are going to be updated. The API is required
- * to only change the values of the fields as specified in the mask
- * and leave the others untouched. If a resource is passed in to
- * describe the updated values, the API ignores the values of all
- * fields not covered by the mask.
- * If a repeated field is specified for an update operation, the existing
- * repeated values in the target resource will be overwritten by the new values.
- * Note that a repeated field is only allowed in the last position of a `paths`
- * string.
- * If a sub-message is specified in the last position of the field mask for an
- * update operation, then the existing sub-message in the target resource is
- * overwritten. Given the target message:
- * f {
- * b {
- * d : 1
- * x : 2
- * }
- * c : 1
- * }
- * And an update message:
- * f {
- * b {
- * d : 10
- * }
- * }
- * then if the field mask is:
- * paths: "f.b"
- * then the result will be:
- * f {
- * b {
- * d : 10
- * }
- * c : 1
- * }
- * However, if the update mask was:
- * paths: "f.b.d"
- * then the result would be:
- * f {
- * b {
- * d : 10
- * x : 2
- * }
- * c : 1
- * }
- * In order to reset a field's value to the default, the field must
- * be in the mask and set to the default value in the provided resource.
- * Hence, in order to reset all fields of a resource, provide a default
- * instance of the resource and set all fields in the mask, or do
- * not provide a mask as described below.
- * If a field mask is not present on update, the operation applies to
- * all fields (as if a field mask of all fields has been specified).
- * Note that in the presence of schema evolution, this may mean that
- * fields the client does not know and has therefore not filled into
- * the request will be reset to their default. If this is unwanted
- * behavior, a specific service may require a client to always specify
- * a field mask, producing an error if not.
- * As with get operations, the location of the resource which
- * describes the updated values in the request message depends on the
- * operation kind. In any case, the effect of the field mask is
- * required to be honored by the API.
- * ## Considerations for HTTP REST
- * The HTTP kind of an update operation which uses a field mask must
- * be set to PATCH instead of PUT in order to satisfy HTTP semantics
- * (PUT must only be used for full updates).
- * # JSON Encoding of Field Masks
- * In JSON, a field mask is encoded as a single string where paths are
- * separated by a comma. Fields name in each path are converted
- * to/from lower-camel naming conventions.
- * As an example, consider the following message declarations:
- * message Profile {
- * User user = 1;
- * Photo photo = 2;
- * }
- * message User {
- * string display_name = 1;
- * string address = 2;
- * }
- * In proto a field mask for `Profile` may look as such:
- * mask {
- * paths: "user.display_name"
- * paths: "photo"
- * }
- * In JSON, the same mask is represented as below:
- * {
- * mask: "user.displayName,photo"
- * }
- * # Field Masks and Oneof Fields
- * Field masks treat fields in oneofs just as regular fields. Consider the
- * following message:
- * message SampleMessage {
- * oneof test_oneof {
- * string name = 4;
- * SubMessage sub_message = 9;
- * }
- * }
- * The field mask can be:
- * mask {
- * paths: "name"
- * }
- * Or:
- * mask {
- * paths: "sub_message"
- * }
- * Note that oneof type names ("test_oneof" in this case) cannot be used in
- * paths.
- * ## Field Mask Verification
- * The implementation of any API method which has a FieldMask type field in the
- * request should verify the included field paths, and return an
- * `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
- *
- * Generated from protobuf message <code>google.protobuf.FieldMask</code>
- */
-class FieldMask extends \Google\Protobuf\Internal\Message
-{
- /**
- * The set of field mask paths.
- *
- * Generated from protobuf field <code>repeated string paths = 1;</code>
- */
- private $paths;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string[]|\Google\Protobuf\Internal\RepeatedField $paths
- * The set of field mask paths.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\FieldMask::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The set of field mask paths.
- *
- * Generated from protobuf field <code>repeated string paths = 1;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getPaths()
- {
- return $this->paths;
- }
-
- /**
- * The set of field mask paths.
- *
- * Generated from protobuf field <code>repeated string paths = 1;</code>
- * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setPaths($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
- $this->paths = $arr;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field_Cardinality.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field_Cardinality.php
deleted file mode 100644
index dff8f8931b..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field_Cardinality.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf;
-
-if (false) {
- /**
- * This class is deprecated. Use Google\Protobuf\Field\Cardinality instead.
- * @deprecated
- */
- class Field_Cardinality {}
-}
-class_exists(Field\Cardinality::class);
-@trigger_error('Google\Protobuf\Field_Cardinality is deprecated and will be removed in the next major release. Use Google\Protobuf\Field\Cardinality instead', E_USER_DEPRECATED);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field_Kind.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field_Kind.php
deleted file mode 100644
index aa20237047..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Field_Kind.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf;
-
-if (false) {
- /**
- * This class is deprecated. Use Google\Protobuf\Field\Kind instead.
- * @deprecated
- */
- class Field_Kind {}
-}
-class_exists(Field\Kind::class);
-@trigger_error('Google\Protobuf\Field_Kind is deprecated and will be removed in the next major release. Use Google\Protobuf\Field\Kind instead', E_USER_DEPRECATED);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/FloatValue.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/FloatValue.php
deleted file mode 100644
index 47ba52e6af..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/FloatValue.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `float`.
- * The JSON representation for `FloatValue` is JSON number.
- *
- * Generated from protobuf message <code>google.protobuf.FloatValue</code>
- */
-class FloatValue extends \Google\Protobuf\Internal\Message
-{
- /**
- * The float value.
- *
- * Generated from protobuf field <code>float value = 1;</code>
- */
- private $value = 0.0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type float $value
- * The float value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The float value.
- *
- * Generated from protobuf field <code>float value = 1;</code>
- * @return float
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The float value.
- *
- * Generated from protobuf field <code>float value = 1;</code>
- * @param float $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkFloat($var);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/GPBEmpty.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/GPBEmpty.php
deleted file mode 100644
index 2de9c3bc06..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/GPBEmpty.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/empty.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * A generic empty message that you can re-use to avoid defining duplicated
- * empty messages in your APIs. A typical example is to use it as the request
- * or the response type of an API method. For instance:
- * service Foo {
- * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
- * }
- * The JSON representation for `Empty` is empty JSON object `{}`.
- *
- * Generated from protobuf message <code>google.protobuf.Empty</code>
- */
-class GPBEmpty extends \Google\Protobuf\Internal\Message
-{
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\GPBEmpty::initOnce();
- parent::__construct($data);
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Int32Value.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Int32Value.php
deleted file mode 100644
index d7fd528d21..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Int32Value.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `int32`.
- * The JSON representation for `Int32Value` is JSON number.
- *
- * Generated from protobuf message <code>google.protobuf.Int32Value</code>
- */
-class Int32Value extends \Google\Protobuf\Internal\Message
-{
- /**
- * The int32 value.
- *
- * Generated from protobuf field <code>int32 value = 1;</code>
- */
- private $value = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int $value
- * The int32 value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The int32 value.
- *
- * Generated from protobuf field <code>int32 value = 1;</code>
- * @return int
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The int32 value.
- *
- * Generated from protobuf field <code>int32 value = 1;</code>
- * @param int $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkInt32($var);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Int64Value.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Int64Value.php
deleted file mode 100644
index ca66305583..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Int64Value.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `int64`.
- * The JSON representation for `Int64Value` is JSON string.
- *
- * Generated from protobuf message <code>google.protobuf.Int64Value</code>
- */
-class Int64Value extends \Google\Protobuf\Internal\Message
-{
- /**
- * The int64 value.
- *
- * Generated from protobuf field <code>int64 value = 1;</code>
- */
- private $value = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int|string $value
- * The int64 value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The int64 value.
- *
- * Generated from protobuf field <code>int64 value = 1;</code>
- * @return int|string
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The int64 value.
- *
- * Generated from protobuf field <code>int64 value = 1;</code>
- * @param int|string $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkInt64($var);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
deleted file mode 100644
index da30fa9906..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
+++ /dev/null
@@ -1,231 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/descriptor.proto
-
-namespace Google\Protobuf\Internal;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\GPBWire;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\InputStream;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Describes an enum type.
- *
- * Generated from protobuf message <code>google.protobuf.EnumDescriptorProto</code>
- */
-class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
-{
- /**
- * Generated from protobuf field <code>optional string name = 1;</code>
- */
- private $name = '';
- private $has_name = false;
- /**
- * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
- */
- private $value;
- private $has_value = false;
- /**
- * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
- */
- private $options = null;
- private $has_options = false;
- /**
- * Range of reserved numeric values. Reserved numeric values may not be used
- * by enum values in the same enum declaration. Reserved ranges may not
- * overlap.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;</code>
- */
- private $reserved_range;
- private $has_reserved_range = false;
- /**
- * Reserved enum value names, which may not be reused. A given name may only
- * be reserved once.
- *
- * Generated from protobuf field <code>repeated string reserved_name = 5;</code>
- */
- private $reserved_name;
- private $has_reserved_name = false;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * @type \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $value
- * @type \Google\Protobuf\Internal\EnumOptions $options
- * @type \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range
- * Range of reserved numeric values. Reserved numeric values may not be used
- * by enum values in the same enum declaration. Reserved ranges may not
- * overlap.
- * @type string[]|\Google\Protobuf\Internal\RepeatedField $reserved_name
- * Reserved enum value names, which may not be reused. A given name may only
- * be reserved once.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Generated from protobuf field <code>optional string name = 1;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * Generated from protobuf field <code>optional string name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
- $this->has_name = true;
-
- return $this;
- }
-
- public function hasName()
- {
- return $this->has_name;
- }
-
- /**
- * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
- * @param \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setValue($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class);
- $this->value = $arr;
- $this->has_value = true;
-
- return $this;
- }
-
- public function hasValue()
- {
- return $this->has_value;
- }
-
- /**
- * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
- * @return \Google\Protobuf\Internal\EnumOptions
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
- * @param \Google\Protobuf\Internal\EnumOptions $var
- * @return $this
- */
- public function setOptions($var)
- {
- GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumOptions::class);
- $this->options = $var;
- $this->has_options = true;
-
- return $this;
- }
-
- public function hasOptions()
- {
- return $this->has_options;
- }
-
- /**
- * Range of reserved numeric values. Reserved numeric values may not be used
- * by enum values in the same enum declaration. Reserved ranges may not
- * overlap.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getReservedRange()
- {
- return $this->reserved_range;
- }
-
- /**
- * Range of reserved numeric values. Reserved numeric values may not be used
- * by enum values in the same enum declaration. Reserved ranges may not
- * overlap.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;</code>
- * @param \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setReservedRange($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange::class);
- $this->reserved_range = $arr;
- $this->has_reserved_range = true;
-
- return $this;
- }
-
- public function hasReservedRange()
- {
- return $this->has_reserved_range;
- }
-
- /**
- * Reserved enum value names, which may not be reused. A given name may only
- * be reserved once.
- *
- * Generated from protobuf field <code>repeated string reserved_name = 5;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getReservedName()
- {
- return $this->reserved_name;
- }
-
- /**
- * Reserved enum value names, which may not be reused. A given name may only
- * be reserved once.
- *
- * Generated from protobuf field <code>repeated string reserved_name = 5;</code>
- * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setReservedName($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
- $this->reserved_name = $arr;
- $this->has_reserved_name = true;
-
- return $this;
- }
-
- public function hasReservedName()
- {
- return $this->has_reserved_name;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php
deleted file mode 100644
index e1079585ec..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/descriptor.proto
-
-namespace Google\Protobuf\Internal\EnumDescriptorProto;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\GPBWire;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\InputStream;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Range of reserved numeric values. Reserved values may not be used by
- * entries in the same enum. Reserved ranges may not overlap.
- * Note that this is distinct from DescriptorProto.ReservedRange in that it
- * is inclusive such that it can appropriately represent the entire int32
- * domain.
- *
- * Generated from protobuf message <code>google.protobuf.EnumDescriptorProto.EnumReservedRange</code>
- */
-class EnumReservedRange extends \Google\Protobuf\Internal\Message
-{
- /**
- * Inclusive.
- *
- * Generated from protobuf field <code>optional int32 start = 1;</code>
- */
- private $start = 0;
- private $has_start = false;
- /**
- * Inclusive.
- *
- * Generated from protobuf field <code>optional int32 end = 2;</code>
- */
- private $end = 0;
- private $has_end = false;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int $start
- * Inclusive.
- * @type int $end
- * Inclusive.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Inclusive.
- *
- * Generated from protobuf field <code>optional int32 start = 1;</code>
- * @return int
- */
- public function getStart()
- {
- return $this->start;
- }
-
- /**
- * Inclusive.
- *
- * Generated from protobuf field <code>optional int32 start = 1;</code>
- * @param int $var
- * @return $this
- */
- public function setStart($var)
- {
- GPBUtil::checkInt32($var);
- $this->start = $var;
- $this->has_start = true;
-
- return $this;
- }
-
- public function hasStart()
- {
- return $this->has_start;
- }
-
- /**
- * Inclusive.
- *
- * Generated from protobuf field <code>optional int32 end = 2;</code>
- * @return int
- */
- public function getEnd()
- {
- return $this->end;
- }
-
- /**
- * Inclusive.
- *
- * Generated from protobuf field <code>optional int32 end = 2;</code>
- * @param int $var
- * @return $this
- */
- public function setEnd($var)
- {
- GPBUtil::checkInt32($var);
- $this->end = $var;
- $this->has_end = true;
-
- return $this;
- }
-
- public function hasEnd()
- {
- return $this->has_end;
- }
-
-}
-
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(EnumReservedRange::class, \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange::class);
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php
deleted file mode 100644
index 00fbebecaf..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/descriptor.proto
-
-namespace Google\Protobuf\Internal;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\GPBWire;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\InputStream;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Generated from protobuf message <code>google.protobuf.ExtensionRangeOptions</code>
- */
-class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message
-{
- /**
- * The parser stores options it doesn't recognize here. See above.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
- */
- private $uninterpreted_option;
- private $has_uninterpreted_option = false;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
- * The parser stores options it doesn't recognize here. See above.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The parser stores options it doesn't recognize here. See above.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getUninterpretedOption()
- {
- return $this->uninterpreted_option;
- }
-
- /**
- * The parser stores options it doesn't recognize here. See above.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
- * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setUninterpretedOption($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $arr;
- $this->has_uninterpreted_option = true;
-
- return $this;
- }
-
- public function hasUninterpretedOption()
- {
- return $this->has_uninterpreted_option;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBUtil.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBUtil.php
deleted file mode 100644
index 023b07f4d3..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Internal/GPBUtil.php
+++ /dev/null
@@ -1,579 +0,0 @@
-<?php
-
-// 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.
-
-namespace Google\Protobuf\Internal;
-
-use Google\Protobuf\Duration;
-use Google\Protobuf\FieldMask;
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\MapField;
-
-function camel2underscore($input) {
- preg_match_all(
- '!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!',
- $input,
- $matches);
- $ret = $matches[0];
- foreach ($ret as &$match) {
- $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match);
- }
- return implode('_', $ret);
-}
-
-class GPBUtil
-{
- const NANOS_PER_MILLISECOND = 1000000;
- const NANOS_PER_MICROSECOND = 1000;
- const TYPE_URL_PREFIX = 'type.googleapis.com/';
-
- public static function divideInt64ToInt32($value, &$high, &$low, $trim = false)
- {
- $isNeg = (bccomp($value, 0) < 0);
- if ($isNeg) {
- $value = bcsub(0, $value);
- }
-
- $high = bcdiv($value, 4294967296);
- $low = bcmod($value, 4294967296);
- if (bccomp($high, 2147483647) > 0) {
- $high = (int) bcsub($high, 4294967296);
- } else {
- $high = (int) $high;
- }
- if (bccomp($low, 2147483647) > 0) {
- $low = (int) bcsub($low, 4294967296);
- } else {
- $low = (int) $low;
- }
-
- if ($isNeg) {
- $high = ~$high;
- $low = ~$low;
- $low++;
- if (!$low) {
- $high = (int)($high + 1);
- }
- }
-
- if ($trim) {
- $high = 0;
- }
- }
-
- public static function checkString(&$var, $check_utf8)
- {
- if (is_array($var) || is_object($var)) {
- throw new \InvalidArgumentException("Expect string.");
- }
- if (!is_string($var)) {
- $var = strval($var);
- }
- if ($check_utf8 && !preg_match('//u', $var)) {
- throw new \Exception("Expect utf-8 encoding.");
- }
- }
-
- public static function checkEnum(&$var)
- {
- static::checkInt32($var);
- }
-
- public static function checkInt32(&$var)
- {
- if (is_numeric($var)) {
- $var = intval($var);
- } else {
- throw new \Exception("Expect integer.");
- }
- }
-
- public static function checkUint32(&$var)
- {
- if (is_numeric($var)) {
- if (PHP_INT_SIZE === 8) {
- $var = intval($var);
- $var |= ((-(($var >> 31) & 0x1)) & ~0xFFFFFFFF);
- } else {
- if (bccomp($var, 0x7FFFFFFF) > 0) {
- $var = bcsub($var, "4294967296");
- }
- $var = (int) $var;
- }
- } else {
- throw new \Exception("Expect integer.");
- }
- }
-
- public static function checkInt64(&$var)
- {
- if (is_numeric($var)) {
- if (PHP_INT_SIZE == 8) {
- $var = intval($var);
- } else {
- if (is_float($var) ||
- is_integer($var) ||
- (is_string($var) &&
- bccomp($var, "9223372036854774784") < 0)) {
- $var = number_format($var, 0, ".", "");
- }
- }
- } else {
- throw new \Exception("Expect integer.");
- }
- }
-
- public static function checkUint64(&$var)
- {
- if (is_numeric($var)) {
- if (PHP_INT_SIZE == 8) {
- $var = intval($var);
- } else {
- $var = number_format($var, 0, ".", "");
- }
- } else {
- throw new \Exception("Expect integer.");
- }
- }
-
- public static function checkFloat(&$var)
- {
- if (is_float($var) || is_numeric($var)) {
- $var = floatval($var);
- } else {
- throw new \Exception("Expect float.");
- }
- }
-
- public static function checkDouble(&$var)
- {
- if (is_float($var) || is_numeric($var)) {
- $var = floatval($var);
- } else {
- throw new \Exception("Expect float.");
- }
- }
-
- public static function checkBool(&$var)
- {
- if (is_array($var) || is_object($var)) {
- throw new \Exception("Expect boolean.");
- }
- $var = boolval($var);
- }
-
- public static function checkMessage(&$var, $klass, $newClass = null)
- {
- if (!$var instanceof $klass && !is_null($var)) {
- throw new \Exception("Expect $klass.");
- }
- }
-
- public static function checkRepeatedField(&$var, $type, $klass = null)
- {
- if (!$var instanceof RepeatedField && !is_array($var)) {
- throw new \Exception("Expect array.");
- }
- if (is_array($var)) {
- $tmp = new RepeatedField($type, $klass);
- foreach ($var as $value) {
- $tmp[] = $value;
- }
- return $tmp;
- } else {
- if ($var->getType() != $type) {
- throw new \Exception(
- "Expect repeated field of different type.");
- }
- if ($var->getType() === GPBType::MESSAGE &&
- $var->getClass() !== $klass) {
- throw new \Exception(
- "Expect repeated field of different message.");
- }
- return $var;
- }
- }
-
- public static function checkMapField(&$var, $key_type, $value_type, $klass = null)
- {
- if (!$var instanceof MapField && !is_array($var)) {
- throw new \Exception("Expect dict.");
- }
- if (is_array($var)) {
- $tmp = new MapField($key_type, $value_type, $klass);
- foreach ($var as $key => $value) {
- $tmp[$key] = $value;
- }
- return $tmp;
- } else {
- if ($var->getKeyType() != $key_type) {
- throw new \Exception("Expect map field of key type.");
- }
- if ($var->getValueType() != $value_type) {
- throw new \Exception("Expect map field of value type.");
- }
- if ($var->getValueType() === GPBType::MESSAGE &&
- $var->getValueClass() !== $klass) {
- throw new \Exception(
- "Expect map field of different value message.");
- }
- return $var;
- }
- }
-
- public static function Int64($value)
- {
- return new Int64($value);
- }
-
- public static function Uint64($value)
- {
- return new Uint64($value);
- }
-
- public static function getClassNamePrefix(
- $classname,
- $file_proto)
- {
- $option = $file_proto->getOptions();
- $prefix = is_null($option) ? "" : $option->getPhpClassPrefix();
- if ($prefix !== "") {
- return $prefix;
- }
-
- $reserved_words = array(
- "abstract"=>0, "and"=>0, "array"=>0, "as"=>0, "break"=>0,
- "callable"=>0, "case"=>0, "catch"=>0, "class"=>0, "clone"=>0,
- "const"=>0, "continue"=>0, "declare"=>0, "default"=>0, "die"=>0,
- "do"=>0, "echo"=>0, "else"=>0, "elseif"=>0, "empty"=>0,
- "enddeclare"=>0, "endfor"=>0, "endforeach"=>0, "endif"=>0,
- "endswitch"=>0, "endwhile"=>0, "eval"=>0, "exit"=>0, "extends"=>0,
- "final"=>0, "for"=>0, "foreach"=>0, "function"=>0, "global"=>0,
- "goto"=>0, "if"=>0, "implements"=>0, "include"=>0,
- "include_once"=>0, "instanceof"=>0, "insteadof"=>0, "interface"=>0,
- "isset"=>0, "list"=>0, "namespace"=>0, "new"=>0, "or"=>0,
- "print"=>0, "private"=>0, "protected"=>0, "public"=>0, "require"=>0,
- "require_once"=>0, "return"=>0, "static"=>0, "switch"=>0,
- "throw"=>0, "trait"=>0, "try"=>0, "unset"=>0, "use"=>0, "var"=>0,
- "while"=>0, "xor"=>0, "int"=>0, "float"=>0, "bool"=>0, "string"=>0,
- "true"=>0, "false"=>0, "null"=>0, "void"=>0, "iterable"=>0
- );
-
- if (array_key_exists(strtolower($classname), $reserved_words)) {
- if ($file_proto->getPackage() === "google.protobuf") {
- return "GPB";
- } else {
- return "PB";
- }
- }
-
- return "";
- }
-
- public static function getClassNameWithoutPackage(
- $name,
- $file_proto)
- {
- $parts = explode('.', $name);
- foreach ($parts as $i => $part) {
- $parts[$i] = static::getClassNamePrefix($parts[$i], $file_proto) . $parts[$i];
- }
- return implode('\\', $parts);
- }
-
- public static function getFullClassName(
- $proto,
- $containing,
- $file_proto,
- &$message_name_without_package,
- &$classname,
- &$fullname)
- {
- // Full name needs to start with '.'.
- $message_name_without_package = $proto->getName();
- if ($containing !== "") {
- $message_name_without_package =
- $containing . "." . $message_name_without_package;
- }
-
- $package = $file_proto->getPackage();
- if ($package === "") {
- $fullname = "." . $message_name_without_package;
- } else {
- $fullname = "." . $package . "." . $message_name_without_package;
- }
-
- $class_name_without_package =
- static::getClassNameWithoutPackage($message_name_without_package, $file_proto);
-
- $option = $file_proto->getOptions();
- if (!is_null($option) && $option->hasPhpNamespace()) {
- $namespace = $option->getPhpNamespace();
- if ($namespace !== "") {
- $classname = $namespace . "\\" . $class_name_without_package;
- return;
- } else {
- $classname = $class_name_without_package;
- return;
- }
- }
-
- if ($package === "") {
- $classname = $class_name_without_package;
- } else {
- $parts = array_map('ucwords', explode('.', $package));
- foreach ($parts as $i => $part) {
- $parts[$i] = self::getClassNamePrefix($part, $file_proto).$part;
- }
- $classname =
- implode('\\', $parts) .
- "\\".self::getClassNamePrefix($class_name_without_package,$file_proto).
- $class_name_without_package;
- }
- }
-
- public static function combineInt32ToInt64($high, $low)
- {
- $isNeg = $high < 0;
- if ($isNeg) {
- $high = ~$high;
- $low = ~$low;
- $low++;
- if (!$low) {
- $high = (int) ($high + 1);
- }
- }
- $result = bcadd(bcmul($high, 4294967296), $low);
- if ($low < 0) {
- $result = bcadd($result, 4294967296);
- }
- if ($isNeg) {
- $result = bcsub(0, $result);
- }
- return $result;
- }
-
- public static function parseTimestamp($timestamp)
- {
- // prevent parsing timestamps containing with the non-existant year "0000"
- // DateTime::createFromFormat parses without failing but as a nonsensical date
- if (substr($timestamp, 0, 4) === "0000") {
- throw new \Exception("Year cannot be zero.");
- }
- // prevent parsing timestamps ending with a lowercase z
- if (substr($timestamp, -1, 1) === "z") {
- throw new \Exception("Timezone cannot be a lowercase z.");
- }
-
- $nanoseconds = 0;
- $periodIndex = strpos($timestamp, ".");
- if ($periodIndex !== false) {
- $nanosecondsLength = 0;
- // find the next non-numeric character in the timestamp to calculate
- // the length of the nanoseconds text
- for ($i = $periodIndex + 1, $length = strlen($timestamp); $i < $length; $i++) {
- if (!is_numeric($timestamp[$i])) {
- $nanosecondsLength = $i - ($periodIndex + 1);
- break;
- }
- }
- if ($nanosecondsLength % 3 !== 0) {
- throw new \Exception("Nanoseconds must be disible by 3.");
- }
- if ($nanosecondsLength > 9) {
- throw new \Exception("Nanoseconds must be in the range of 0 to 999,999,999 nanoseconds.");
- }
- if ($nanosecondsLength > 0) {
- $nanoseconds = substr($timestamp, $periodIndex + 1, $nanosecondsLength);
- $nanoseconds = intval($nanoseconds);
-
- // remove the nanoseconds and preceding period from the timestamp
- $date = substr($timestamp, 0, $periodIndex - 1);
- $timezone = substr($timestamp, $periodIndex + $nanosecondsLength);
- $timestamp = $date.$timezone;
- }
- }
-
- $date = \DateTime::createFromFormat(\DateTime::RFC3339, $timestamp, new \DateTimeZone("UTC"));
- if ($date === false) {
- throw new \Exception("Invalid RFC 3339 timestamp.");
- }
-
- $value = new \Google\Protobuf\Timestamp();
- $seconds = $date->format("U");
- $value->setSeconds($seconds);
- $value->setNanos($nanoseconds);
- return $value;
- }
-
- public static function formatTimestamp($value)
- {
- if (bccomp($value->getSeconds(), "253402300800") != -1) {
- throw new GPBDecodeException("Duration number too large.");
- }
- if (bccomp($value->getSeconds(), "-62135596801") != 1) {
- throw new GPBDecodeException("Duration number too small.");
- }
- $nanoseconds = static::getNanosecondsForTimestamp($value->getNanos());
- if (!empty($nanoseconds)) {
- $nanoseconds = ".".$nanoseconds;
- }
- $date = new \DateTime('@'.$value->getSeconds(), new \DateTimeZone("UTC"));
- return $date->format("Y-m-d\TH:i:s".$nanoseconds."\Z");
- }
-
- public static function parseDuration($value)
- {
- if (strlen($value) < 2 || substr($value, -1) !== "s") {
- throw new GPBDecodeException("Missing s after duration string");
- }
- $number = substr($value, 0, -1);
- if (bccomp($number, "315576000001") != -1) {
- throw new GPBDecodeException("Duration number too large.");
- }
- if (bccomp($number, "-315576000001") != 1) {
- throw new GPBDecodeException("Duration number too small.");
- }
- $pos = strrpos($number, ".");
- if ($pos !== false) {
- $seconds = substr($number, 0, $pos);
- if (bccomp($seconds, 0) < 0) {
- $nanos = bcmul("0" . substr($number, $pos), -1000000000);
- } else {
- $nanos = bcmul("0" . substr($number, $pos), 1000000000);
- }
- } else {
- $seconds = $number;
- $nanos = 0;
- }
- $duration = new Duration();
- $duration->setSeconds($seconds);
- $duration->setNanos($nanos);
- return $duration;
- }
-
- public static function formatDuration($value)
- {
- if (bccomp($value->getSeconds(), "315576000001") != -1) {
- throw new GPBDecodeException("Duration number too large.");
- }
- if (bccomp($value->getSeconds(), "-315576000001") != 1) {
- throw new GPBDecodeException("Duration number too small.");
- }
- return strval(bcadd($value->getSeconds(),
- $value->getNanos() / 1000000000.0, 9));
- }
-
-
-
- public static function parseFieldMask($paths_string)
- {
- $path_strings = explode(",", $paths_string);
- $field_mask = new FieldMask();
- $paths = $field_mask->getPaths();
- foreach($path_strings as &$path_string) {
- $field_strings = explode(".", $path_string);
- foreach($field_strings as &$field_string) {
- $field_string = camel2underscore($field_string);
- }
- $path_string = implode(".", $field_strings);
- $paths[] = $path_string;
- }
- return $field_mask;
- }
-
- public static function formatFieldMask($field_mask)
- {
- $converted_paths = [];
- foreach($field_mask->getPaths() as $path) {
- $fields = explode('.', $path);
- $converted_path = [];
- foreach ($fields as $field) {
- $segments = explode('_', $field);
- $start = true;
- $converted_segments = "";
- foreach($segments as $segment) {
- if (!$start) {
- $converted = ucfirst($segment);
- } else {
- $converted = $segment;
- $start = false;
- }
- $converted_segments .= $converted;
- }
- $converted_path []= $converted_segments;
- }
- $converted_path = implode(".", $converted_path);
- $converted_paths []= $converted_path;
- }
- return implode(",", $converted_paths);
- }
-
- public static function getNanosecondsForTimestamp($nanoseconds)
- {
- if ($nanoseconds == 0) {
- return '';
- }
- if ($nanoseconds % static::NANOS_PER_MILLISECOND == 0) {
- return sprintf('%03d', $nanoseconds / static::NANOS_PER_MILLISECOND);
- }
- if ($nanoseconds % static::NANOS_PER_MICROSECOND == 0) {
- return sprintf('%06d', $nanoseconds / static::NANOS_PER_MICROSECOND);
- }
- return sprintf('%09d', $nanoseconds);
- }
-
- public static function hasSpecialJsonMapping($msg)
- {
- return is_a($msg, 'Google\Protobuf\Any') ||
- is_a($msg, "Google\Protobuf\ListValue") ||
- is_a($msg, "Google\Protobuf\Struct") ||
- is_a($msg, "Google\Protobuf\Value") ||
- is_a($msg, "Google\Protobuf\Duration") ||
- is_a($msg, "Google\Protobuf\Timestamp") ||
- is_a($msg, "Google\Protobuf\FieldMask") ||
- static::hasJsonValue($msg);
- }
-
- public static function hasJsonValue($msg)
- {
- return is_a($msg, "Google\Protobuf\DoubleValue") ||
- is_a($msg, "Google\Protobuf\FloatValue") ||
- is_a($msg, "Google\Protobuf\Int64Value") ||
- is_a($msg, "Google\Protobuf\UInt64Value") ||
- is_a($msg, "Google\Protobuf\Int32Value") ||
- is_a($msg, "Google\Protobuf\UInt32Value") ||
- is_a($msg, "Google\Protobuf\BoolValue") ||
- is_a($msg, "Google\Protobuf\StringValue") ||
- is_a($msg, "Google\Protobuf\BytesValue");
- }
-}
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/ListValue.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/ListValue.php
deleted file mode 100644
index 70f542326f..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/ListValue.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/struct.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * `ListValue` is a wrapper around a repeated field of values.
- * The JSON representation for `ListValue` is JSON array.
- *
- * Generated from protobuf message <code>google.protobuf.ListValue</code>
- */
-class ListValue extends \Google\Protobuf\Internal\Message
-{
- /**
- * Repeated field of dynamically typed values.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Value values = 1;</code>
- */
- private $values;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Google\Protobuf\Value[]|\Google\Protobuf\Internal\RepeatedField $values
- * Repeated field of dynamically typed values.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Struct::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Repeated field of dynamically typed values.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Value values = 1;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getValues()
- {
- return $this->values;
- }
-
- /**
- * Repeated field of dynamically typed values.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Value values = 1;</code>
- * @param \Google\Protobuf\Value[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setValues($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class);
- $this->values = $arr;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Method.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Method.php
deleted file mode 100644
index 8e80350688..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Method.php
+++ /dev/null
@@ -1,271 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/api.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Method represents a method of an API interface.
- *
- * Generated from protobuf message <code>google.protobuf.Method</code>
- */
-class Method extends \Google\Protobuf\Internal\Message
-{
- /**
- * The simple name of this method.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- */
- private $name = '';
- /**
- * A URL of the input message type.
- *
- * Generated from protobuf field <code>string request_type_url = 2;</code>
- */
- private $request_type_url = '';
- /**
- * If true, the request is streamed.
- *
- * Generated from protobuf field <code>bool request_streaming = 3;</code>
- */
- private $request_streaming = false;
- /**
- * The URL of the output message type.
- *
- * Generated from protobuf field <code>string response_type_url = 4;</code>
- */
- private $response_type_url = '';
- /**
- * If true, the response is streamed.
- *
- * Generated from protobuf field <code>bool response_streaming = 5;</code>
- */
- private $response_streaming = false;
- /**
- * Any metadata attached to the method.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 6;</code>
- */
- private $options;
- /**
- * The source syntax of this method.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
- */
- private $syntax = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * The simple name of this method.
- * @type string $request_type_url
- * A URL of the input message type.
- * @type bool $request_streaming
- * If true, the request is streamed.
- * @type string $response_type_url
- * The URL of the output message type.
- * @type bool $response_streaming
- * If true, the response is streamed.
- * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
- * Any metadata attached to the method.
- * @type int $syntax
- * The source syntax of this method.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Api::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The simple name of this method.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * The simple name of this method.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * A URL of the input message type.
- *
- * Generated from protobuf field <code>string request_type_url = 2;</code>
- * @return string
- */
- public function getRequestTypeUrl()
- {
- return $this->request_type_url;
- }
-
- /**
- * A URL of the input message type.
- *
- * Generated from protobuf field <code>string request_type_url = 2;</code>
- * @param string $var
- * @return $this
- */
- public function setRequestTypeUrl($var)
- {
- GPBUtil::checkString($var, True);
- $this->request_type_url = $var;
-
- return $this;
- }
-
- /**
- * If true, the request is streamed.
- *
- * Generated from protobuf field <code>bool request_streaming = 3;</code>
- * @return bool
- */
- public function getRequestStreaming()
- {
- return $this->request_streaming;
- }
-
- /**
- * If true, the request is streamed.
- *
- * Generated from protobuf field <code>bool request_streaming = 3;</code>
- * @param bool $var
- * @return $this
- */
- public function setRequestStreaming($var)
- {
- GPBUtil::checkBool($var);
- $this->request_streaming = $var;
-
- return $this;
- }
-
- /**
- * The URL of the output message type.
- *
- * Generated from protobuf field <code>string response_type_url = 4;</code>
- * @return string
- */
- public function getResponseTypeUrl()
- {
- return $this->response_type_url;
- }
-
- /**
- * The URL of the output message type.
- *
- * Generated from protobuf field <code>string response_type_url = 4;</code>
- * @param string $var
- * @return $this
- */
- public function setResponseTypeUrl($var)
- {
- GPBUtil::checkString($var, True);
- $this->response_type_url = $var;
-
- return $this;
- }
-
- /**
- * If true, the response is streamed.
- *
- * Generated from protobuf field <code>bool response_streaming = 5;</code>
- * @return bool
- */
- public function getResponseStreaming()
- {
- return $this->response_streaming;
- }
-
- /**
- * If true, the response is streamed.
- *
- * Generated from protobuf field <code>bool response_streaming = 5;</code>
- * @param bool $var
- * @return $this
- */
- public function setResponseStreaming($var)
- {
- GPBUtil::checkBool($var);
- $this->response_streaming = $var;
-
- return $this;
- }
-
- /**
- * Any metadata attached to the method.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 6;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * Any metadata attached to the method.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 6;</code>
- * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setOptions($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
- $this->options = $arr;
-
- return $this;
- }
-
- /**
- * The source syntax of this method.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
- * @return int
- */
- public function getSyntax()
- {
- return $this->syntax;
- }
-
- /**
- * The source syntax of this method.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
- * @param int $var
- * @return $this
- */
- public function setSyntax($var)
- {
- GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class);
- $this->syntax = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Mixin.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Mixin.php
deleted file mode 100644
index a2ea59c757..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Mixin.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/api.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Declares an API Interface to be included in this interface. The including
- * interface must redeclare all the methods from the included interface, but
- * documentation and options are inherited as follows:
- * - If after comment and whitespace stripping, the documentation
- * string of the redeclared method is empty, it will be inherited
- * from the original method.
- * - Each annotation belonging to the service config (http,
- * visibility) which is not set in the redeclared method will be
- * inherited.
- * - If an http annotation is inherited, the path pattern will be
- * modified as follows. Any version prefix will be replaced by the
- * version of the including interface plus the [root][] path if
- * specified.
- * Example of a simple mixin:
- * package google.acl.v1;
- * service AccessControl {
- * // Get the underlying ACL object.
- * rpc GetAcl(GetAclRequest) returns (Acl) {
- * option (google.api.http).get = "/v1/{resource=**}:getAcl";
- * }
- * }
- * package google.storage.v2;
- * service Storage {
- * rpc GetAcl(GetAclRequest) returns (Acl);
- * // Get a data record.
- * rpc GetData(GetDataRequest) returns (Data) {
- * option (google.api.http).get = "/v2/{resource=**}";
- * }
- * }
- * Example of a mixin configuration:
- * apis:
- * - name: google.storage.v2.Storage
- * mixins:
- * - name: google.acl.v1.AccessControl
- * The mixin construct implies that all methods in `AccessControl` are
- * also declared with same name and request/response types in
- * `Storage`. A documentation generator or annotation processor will
- * see the effective `Storage.GetAcl` method after inherting
- * documentation and annotations as follows:
- * service Storage {
- * // Get the underlying ACL object.
- * rpc GetAcl(GetAclRequest) returns (Acl) {
- * option (google.api.http).get = "/v2/{resource=**}:getAcl";
- * }
- * ...
- * }
- * Note how the version in the path pattern changed from `v1` to `v2`.
- * If the `root` field in the mixin is specified, it should be a
- * relative path under which inherited HTTP paths are placed. Example:
- * apis:
- * - name: google.storage.v2.Storage
- * mixins:
- * - name: google.acl.v1.AccessControl
- * root: acls
- * This implies the following inherited HTTP annotation:
- * service Storage {
- * // Get the underlying ACL object.
- * rpc GetAcl(GetAclRequest) returns (Acl) {
- * option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
- * }
- * ...
- * }
- *
- * Generated from protobuf message <code>google.protobuf.Mixin</code>
- */
-class Mixin extends \Google\Protobuf\Internal\Message
-{
- /**
- * The fully qualified name of the interface which is included.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- */
- private $name = '';
- /**
- * If non-empty specifies a path under which inherited HTTP paths
- * are rooted.
- *
- * Generated from protobuf field <code>string root = 2;</code>
- */
- private $root = '';
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * The fully qualified name of the interface which is included.
- * @type string $root
- * If non-empty specifies a path under which inherited HTTP paths
- * are rooted.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Api::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The fully qualified name of the interface which is included.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * The fully qualified name of the interface which is included.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * If non-empty specifies a path under which inherited HTTP paths
- * are rooted.
- *
- * Generated from protobuf field <code>string root = 2;</code>
- * @return string
- */
- public function getRoot()
- {
- return $this->root;
- }
-
- /**
- * If non-empty specifies a path under which inherited HTTP paths
- * are rooted.
- *
- * Generated from protobuf field <code>string root = 2;</code>
- * @param string $var
- * @return $this
- */
- public function setRoot($var)
- {
- GPBUtil::checkString($var, True);
- $this->root = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/NullValue.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/NullValue.php
deleted file mode 100644
index 482b80dde5..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/NullValue.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/struct.proto
-
-namespace Google\Protobuf;
-
-/**
- * `NullValue` is a singleton enumeration to represent the null value for the
- * `Value` type union.
- * The JSON representation for `NullValue` is JSON `null`.
- *
- * Protobuf type <code>google.protobuf.NullValue</code>
- */
-class NullValue
-{
- /**
- * Null value.
- *
- * Generated from protobuf enum <code>NULL_VALUE = 0;</code>
- */
- const NULL_VALUE = 0;
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Option.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Option.php
deleted file mode 100644
index 22ecfc5f5c..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Option.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * A protocol buffer option, which can be attached to a message, field,
- * enumeration, etc.
- *
- * Generated from protobuf message <code>google.protobuf.Option</code>
- */
-class Option extends \Google\Protobuf\Internal\Message
-{
- /**
- * The option's name. For protobuf built-in options (options defined in
- * descriptor.proto), this is the short name. For example, `"map_entry"`.
- * For custom options, it should be the fully-qualified name. For example,
- * `"google.api.http"`.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- */
- private $name = '';
- /**
- * The option's value packed in an Any message. If the value is a primitive,
- * the corresponding wrapper type defined in google/protobuf/wrappers.proto
- * should be used. If the value is an enum, it should be stored as an int32
- * value using the google.protobuf.Int32Value type.
- *
- * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
- */
- private $value = null;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * The option's name. For protobuf built-in options (options defined in
- * descriptor.proto), this is the short name. For example, `"map_entry"`.
- * For custom options, it should be the fully-qualified name. For example,
- * `"google.api.http"`.
- * @type \Google\Protobuf\Any $value
- * The option's value packed in an Any message. If the value is a primitive,
- * the corresponding wrapper type defined in google/protobuf/wrappers.proto
- * should be used. If the value is an enum, it should be stored as an int32
- * value using the google.protobuf.Int32Value type.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The option's name. For protobuf built-in options (options defined in
- * descriptor.proto), this is the short name. For example, `"map_entry"`.
- * For custom options, it should be the fully-qualified name. For example,
- * `"google.api.http"`.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * The option's name. For protobuf built-in options (options defined in
- * descriptor.proto), this is the short name. For example, `"map_entry"`.
- * For custom options, it should be the fully-qualified name. For example,
- * `"google.api.http"`.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * The option's value packed in an Any message. If the value is a primitive,
- * the corresponding wrapper type defined in google/protobuf/wrappers.proto
- * should be used. If the value is an enum, it should be stored as an int32
- * value using the google.protobuf.Int32Value type.
- *
- * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
- * @return \Google\Protobuf\Any
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The option's value packed in an Any message. If the value is a primitive,
- * the corresponding wrapper type defined in google/protobuf/wrappers.proto
- * should be used. If the value is an enum, it should be stored as an int32
- * value using the google.protobuf.Int32Value type.
- *
- * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
- * @param \Google\Protobuf\Any $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkMessage($var, \Google\Protobuf\Any::class);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/SourceContext.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/SourceContext.php
deleted file mode 100644
index cbc50c6842..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/SourceContext.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/source_context.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * `SourceContext` represents information about the source of a
- * protobuf element, like the file in which it is defined.
- *
- * Generated from protobuf message <code>google.protobuf.SourceContext</code>
- */
-class SourceContext extends \Google\Protobuf\Internal\Message
-{
- /**
- * The path-qualified name of the .proto file that contained the associated
- * protobuf element. For example: `"google/protobuf/source_context.proto"`.
- *
- * Generated from protobuf field <code>string file_name = 1;</code>
- */
- private $file_name = '';
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $file_name
- * The path-qualified name of the .proto file that contained the associated
- * protobuf element. For example: `"google/protobuf/source_context.proto"`.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\SourceContext::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The path-qualified name of the .proto file that contained the associated
- * protobuf element. For example: `"google/protobuf/source_context.proto"`.
- *
- * Generated from protobuf field <code>string file_name = 1;</code>
- * @return string
- */
- public function getFileName()
- {
- return $this->file_name;
- }
-
- /**
- * The path-qualified name of the .proto file that contained the associated
- * protobuf element. For example: `"google/protobuf/source_context.proto"`.
- *
- * Generated from protobuf field <code>string file_name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setFileName($var)
- {
- GPBUtil::checkString($var, True);
- $this->file_name = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/StringValue.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/StringValue.php
deleted file mode 100644
index 8fb354f388..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/StringValue.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `string`.
- * The JSON representation for `StringValue` is JSON string.
- *
- * Generated from protobuf message <code>google.protobuf.StringValue</code>
- */
-class StringValue extends \Google\Protobuf\Internal\Message
-{
- /**
- * The string value.
- *
- * Generated from protobuf field <code>string value = 1;</code>
- */
- private $value = '';
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $value
- * The string value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The string value.
- *
- * Generated from protobuf field <code>string value = 1;</code>
- * @return string
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The string value.
- *
- * Generated from protobuf field <code>string value = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkString($var, True);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Struct.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Struct.php
deleted file mode 100644
index 0456541cbd..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Struct.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/struct.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * `Struct` represents a structured data value, consisting of fields
- * which map to dynamically typed values. In some languages, `Struct`
- * might be supported by a native representation. For example, in
- * scripting languages like JS a struct is represented as an
- * object. The details of that representation are described together
- * with the proto support for the language.
- * The JSON representation for `Struct` is JSON object.
- *
- * Generated from protobuf message <code>google.protobuf.Struct</code>
- */
-class Struct extends \Google\Protobuf\Internal\Message
-{
- /**
- * Unordered map of dynamically typed values.
- *
- * Generated from protobuf field <code>map<string, .google.protobuf.Value> fields = 1;</code>
- */
- private $fields;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type array|\Google\Protobuf\Internal\MapField $fields
- * Unordered map of dynamically typed values.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Struct::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Unordered map of dynamically typed values.
- *
- * Generated from protobuf field <code>map<string, .google.protobuf.Value> fields = 1;</code>
- * @return \Google\Protobuf\Internal\MapField
- */
- public function getFields()
- {
- return $this->fields;
- }
-
- /**
- * Unordered map of dynamically typed values.
- *
- * Generated from protobuf field <code>map<string, .google.protobuf.Value> fields = 1;</code>
- * @param array|\Google\Protobuf\Internal\MapField $var
- * @return $this
- */
- public function setFields($var)
- {
- $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class);
- $this->fields = $arr;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Syntax.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Syntax.php
deleted file mode 100644
index 3a52dc9e1c..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Syntax.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf;
-
-/**
- * The syntax in which a protocol buffer element is defined.
- *
- * Protobuf type <code>google.protobuf.Syntax</code>
- */
-class Syntax
-{
- /**
- * Syntax `proto2`.
- *
- * Generated from protobuf enum <code>SYNTAX_PROTO2 = 0;</code>
- */
- const SYNTAX_PROTO2 = 0;
- /**
- * Syntax `proto3`.
- *
- * Generated from protobuf enum <code>SYNTAX_PROTO3 = 1;</code>
- */
- const SYNTAX_PROTO3 = 1;
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Timestamp.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Timestamp.php
deleted file mode 100644
index e21f3231cb..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Timestamp.php
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/timestamp.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * A Timestamp represents a point in time independent of any time zone
- * or calendar, represented as seconds and fractions of seconds at
- * nanosecond resolution in UTC Epoch time. It is encoded using the
- * Proleptic Gregorian Calendar which extends the Gregorian calendar
- * backwards to year one. It is encoded assuming all minutes are 60
- * seconds long, i.e. leap seconds are "smeared" so that no leap second
- * table is needed for interpretation. Range is from
- * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
- * By restricting to that range, we ensure that we can convert to
- * and from RFC 3339 date strings.
- * See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
- * # Examples
- * Example 1: Compute Timestamp from POSIX `time()`.
- * Timestamp timestamp;
- * timestamp.set_seconds(time(NULL));
- * timestamp.set_nanos(0);
- * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
- * struct timeval tv;
- * gettimeofday(&tv, NULL);
- * Timestamp timestamp;
- * timestamp.set_seconds(tv.tv_sec);
- * timestamp.set_nanos(tv.tv_usec * 1000);
- * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
- * FILETIME ft;
- * GetSystemTimeAsFileTime(&ft);
- * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
- * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
- * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
- * Timestamp timestamp;
- * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
- * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
- * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
- * long millis = System.currentTimeMillis();
- * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
- * .setNanos((int) ((millis % 1000) * 1000000)).build();
- * Example 5: Compute Timestamp from current time in Python.
- * timestamp = Timestamp()
- * timestamp.GetCurrentTime()
- * # JSON Mapping
- * In JSON format, the Timestamp type is encoded as a string in the
- * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
- * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
- * where {year} is always expressed using four digits while {month}, {day},
- * {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.
- * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
- * 01:30 UTC on January 15, 2017.
- * In JavaScript, one can convert a Date object to this format using the
- * standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
- * method. In Python, a standard `datetime.datetime` object can be converted
- * 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.
- *
- * Generated from protobuf message <code>google.protobuf.Timestamp</code>
- */
-class Timestamp extends \Google\Protobuf\Internal\Message
-{
- /**
- * Represents seconds of UTC time since Unix epoch
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
- * 9999-12-31T23:59:59Z inclusive.
- *
- * Generated from protobuf field <code>int64 seconds = 1;</code>
- */
- private $seconds = 0;
- /**
- * Non-negative fractions of a second at nanosecond resolution. Negative
- * second values with fractions must still have non-negative nanos values
- * that count forward in time. Must be from 0 to 999,999,999
- * inclusive.
- *
- * Generated from protobuf field <code>int32 nanos = 2;</code>
- */
- private $nanos = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int|string $seconds
- * Represents seconds of UTC time since Unix epoch
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
- * 9999-12-31T23:59:59Z inclusive.
- * @type int $nanos
- * Non-negative fractions of a second at nanosecond resolution. Negative
- * second values with fractions must still have non-negative nanos values
- * that count forward in time. Must be from 0 to 999,999,999
- * inclusive.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Timestamp::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Represents seconds of UTC time since Unix epoch
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
- * 9999-12-31T23:59:59Z inclusive.
- *
- * Generated from protobuf field <code>int64 seconds = 1;</code>
- * @return int|string
- */
- public function getSeconds()
- {
- return $this->seconds;
- }
-
- /**
- * Represents seconds of UTC time since Unix epoch
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
- * 9999-12-31T23:59:59Z inclusive.
- *
- * Generated from protobuf field <code>int64 seconds = 1;</code>
- * @param int|string $var
- * @return $this
- */
- public function setSeconds($var)
- {
- GPBUtil::checkInt64($var);
- $this->seconds = $var;
-
- return $this;
- }
-
- /**
- * Non-negative fractions of a second at nanosecond resolution. Negative
- * second values with fractions must still have non-negative nanos values
- * that count forward in time. Must be from 0 to 999,999,999
- * inclusive.
- *
- * Generated from protobuf field <code>int32 nanos = 2;</code>
- * @return int
- */
- public function getNanos()
- {
- return $this->nanos;
- }
-
- /**
- * Non-negative fractions of a second at nanosecond resolution. Negative
- * second values with fractions must still have non-negative nanos values
- * that count forward in time. Must be from 0 to 999,999,999
- * inclusive.
- *
- * Generated from protobuf field <code>int32 nanos = 2;</code>
- * @param int $var
- * @return $this
- */
- public function setNanos($var)
- {
- GPBUtil::checkInt32($var);
- $this->nanos = $var;
-
- return $this;
- }
-
- /*
- * Converts PHP DateTime to Timestamp.
- *
- * @param \DateTime $datetime
- */
- public function fromDateTime(\DateTime $datetime)
- {
- $this->seconds = $datetime->format('U');
- $this->nanos = 0;
- }
-
- /**
- * Converts Timestamp to PHP DateTime. Nano second is ignored.
- *
- * @return \DateTime $datetime
- */
- public function toDateTime()
- {
- return \DateTime::createFromFormat('U', $this->seconds);
- }
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Type.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Type.php
deleted file mode 100644
index 1b47811050..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Type.php
+++ /dev/null
@@ -1,237 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/type.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * A protocol buffer message type.
- *
- * Generated from protobuf message <code>google.protobuf.Type</code>
- */
-class Type extends \Google\Protobuf\Internal\Message
-{
- /**
- * The fully qualified message name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- */
- private $name = '';
- /**
- * The list of fields.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Field fields = 2;</code>
- */
- private $fields;
- /**
- * The list of types appearing in `oneof` definitions in this type.
- *
- * Generated from protobuf field <code>repeated string oneofs = 3;</code>
- */
- private $oneofs;
- /**
- * The protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 4;</code>
- */
- private $options;
- /**
- * The source context.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 5;</code>
- */
- private $source_context = null;
- /**
- * The source syntax.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 6;</code>
- */
- private $syntax = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * The fully qualified message name.
- * @type \Google\Protobuf\Field[]|\Google\Protobuf\Internal\RepeatedField $fields
- * The list of fields.
- * @type string[]|\Google\Protobuf\Internal\RepeatedField $oneofs
- * The list of types appearing in `oneof` definitions in this type.
- * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
- * The protocol buffer options.
- * @type \Google\Protobuf\SourceContext $source_context
- * The source context.
- * @type int $syntax
- * The source syntax.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The fully qualified message name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * The fully qualified message name.
- *
- * Generated from protobuf field <code>string name = 1;</code>
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * The list of fields.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Field fields = 2;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getFields()
- {
- return $this->fields;
- }
-
- /**
- * The list of fields.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Field fields = 2;</code>
- * @param \Google\Protobuf\Field[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setFields($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Field::class);
- $this->fields = $arr;
-
- return $this;
- }
-
- /**
- * The list of types appearing in `oneof` definitions in this type.
- *
- * Generated from protobuf field <code>repeated string oneofs = 3;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getOneofs()
- {
- return $this->oneofs;
- }
-
- /**
- * The list of types appearing in `oneof` definitions in this type.
- *
- * Generated from protobuf field <code>repeated string oneofs = 3;</code>
- * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setOneofs($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
- $this->oneofs = $arr;
-
- return $this;
- }
-
- /**
- * The protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 4;</code>
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * The protocol buffer options.
- *
- * Generated from protobuf field <code>repeated .google.protobuf.Option options = 4;</code>
- * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setOptions($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
- $this->options = $arr;
-
- return $this;
- }
-
- /**
- * The source context.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 5;</code>
- * @return \Google\Protobuf\SourceContext
- */
- public function getSourceContext()
- {
- return $this->source_context;
- }
-
- /**
- * The source context.
- *
- * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 5;</code>
- * @param \Google\Protobuf\SourceContext $var
- * @return $this
- */
- public function setSourceContext($var)
- {
- GPBUtil::checkMessage($var, \Google\Protobuf\SourceContext::class);
- $this->source_context = $var;
-
- return $this;
- }
-
- /**
- * The source syntax.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 6;</code>
- * @return int
- */
- public function getSyntax()
- {
- return $this->syntax;
- }
-
- /**
- * The source syntax.
- *
- * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 6;</code>
- * @param int $var
- * @return $this
- */
- public function setSyntax($var)
- {
- GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class);
- $this->syntax = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/UInt32Value.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/UInt32Value.php
deleted file mode 100644
index f5a522d2e8..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/UInt32Value.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `uint32`.
- * The JSON representation for `UInt32Value` is JSON number.
- *
- * Generated from protobuf message <code>google.protobuf.UInt32Value</code>
- */
-class UInt32Value extends \Google\Protobuf\Internal\Message
-{
- /**
- * The uint32 value.
- *
- * Generated from protobuf field <code>uint32 value = 1;</code>
- */
- private $value = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int $value
- * The uint32 value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The uint32 value.
- *
- * Generated from protobuf field <code>uint32 value = 1;</code>
- * @return int
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The uint32 value.
- *
- * Generated from protobuf field <code>uint32 value = 1;</code>
- * @param int $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkUint32($var);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/UInt64Value.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/UInt64Value.php
deleted file mode 100644
index 89e69cd892..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/UInt64Value.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/wrappers.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * Wrapper message for `uint64`.
- * The JSON representation for `UInt64Value` is JSON string.
- *
- * Generated from protobuf message <code>google.protobuf.UInt64Value</code>
- */
-class UInt64Value extends \Google\Protobuf\Internal\Message
-{
- /**
- * The uint64 value.
- *
- * Generated from protobuf field <code>uint64 value = 1;</code>
- */
- private $value = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int|string $value
- * The uint64 value.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct($data);
- }
-
- /**
- * The uint64 value.
- *
- * Generated from protobuf field <code>uint64 value = 1;</code>
- * @return int|string
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * The uint64 value.
- *
- * Generated from protobuf field <code>uint64 value = 1;</code>
- * @param int|string $var
- * @return $this
- */
- public function setValue($var)
- {
- GPBUtil::checkUint64($var);
- $this->value = $var;
-
- return $this;
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Value.php b/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Value.php
deleted file mode 100644
index 5c1e864c3d..0000000000
--- a/third_party/protobuf/3.6.0/php/src/Google/Protobuf/Value.php
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/protobuf/struct.proto
-
-namespace Google\Protobuf;
-
-use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBUtil;
-
-/**
- * `Value` represents a dynamically typed value which can be either
- * null, a number, a string, a boolean, a recursive struct value, or a
- * list of values. A producer of value is expected to set one of that
- * variants, absence of any variant indicates an error.
- * The JSON representation for `Value` is JSON value.
- *
- * Generated from protobuf message <code>google.protobuf.Value</code>
- */
-class Value extends \Google\Protobuf\Internal\Message
-{
- protected $kind;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int $null_value
- * Represents a null value.
- * @type float $number_value
- * Represents a double value.
- * @type string $string_value
- * Represents a string value.
- * @type bool $bool_value
- * Represents a boolean value.
- * @type \Google\Protobuf\Struct $struct_value
- * Represents a structured value.
- * @type \Google\Protobuf\ListValue $list_value
- * Represents a repeated `Value`.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Google\Protobuf\Struct::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Represents a null value.
- *
- * Generated from protobuf field <code>.google.protobuf.NullValue null_value = 1;</code>
- * @return int
- */
- public function getNullValue()
- {
- return $this->readOneof(1);
- }
-
- /**
- * Represents a null value.
- *
- * Generated from protobuf field <code>.google.protobuf.NullValue null_value = 1;</code>
- * @param int $var
- * @return $this
- */
- public function setNullValue($var)
- {
- GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class);
- $this->writeOneof(1, $var);
-
- return $this;
- }
-
- /**
- * Represents a double value.
- *
- * Generated from protobuf field <code>double number_value = 2;</code>
- * @return float
- */
- public function getNumberValue()
- {
- return $this->readOneof(2);
- }
-
- /**
- * Represents a double value.
- *
- * Generated from protobuf field <code>double number_value = 2;</code>
- * @param float $var
- * @return $this
- */
- public function setNumberValue($var)
- {
- GPBUtil::checkDouble($var);
- $this->writeOneof(2, $var);
-
- return $this;
- }
-
- /**
- * Represents a string value.
- *
- * Generated from protobuf field <code>string string_value = 3;</code>
- * @return string
- */
- public function getStringValue()
- {
- return $this->readOneof(3);
- }
-
- /**
- * Represents a string value.
- *
- * Generated from protobuf field <code>string string_value = 3;</code>
- * @param string $var
- * @return $this
- */
- public function setStringValue($var)
- {
- GPBUtil::checkString($var, True);
- $this->writeOneof(3, $var);
-
- return $this;
- }
-
- /**
- * Represents a boolean value.
- *
- * Generated from protobuf field <code>bool bool_value = 4;</code>
- * @return bool
- */
- public function getBoolValue()
- {
- return $this->readOneof(4);
- }
-
- /**
- * Represents a boolean value.
- *
- * Generated from protobuf field <code>bool bool_value = 4;</code>
- * @param bool $var
- * @return $this
- */
- public function setBoolValue($var)
- {
- GPBUtil::checkBool($var);
- $this->writeOneof(4, $var);
-
- return $this;
- }
-
- /**
- * Represents a structured value.
- *
- * Generated from protobuf field <code>.google.protobuf.Struct struct_value = 5;</code>
- * @return \Google\Protobuf\Struct
- */
- public function getStructValue()
- {
- return $this->readOneof(5);
- }
-
- /**
- * Represents a structured value.
- *
- * Generated from protobuf field <code>.google.protobuf.Struct struct_value = 5;</code>
- * @param \Google\Protobuf\Struct $var
- * @return $this
- */
- public function setStructValue($var)
- {
- GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
- $this->writeOneof(5, $var);
-
- return $this;
- }
-
- /**
- * Represents a repeated `Value`.
- *
- * Generated from protobuf field <code>.google.protobuf.ListValue list_value = 6;</code>
- * @return \Google\Protobuf\ListValue
- */
- public function getListValue()
- {
- return $this->readOneof(6);
- }
-
- /**
- * Represents a repeated `Value`.
- *
- * Generated from protobuf field <code>.google.protobuf.ListValue list_value = 6;</code>
- * @param \Google\Protobuf\ListValue $var
- * @return $this
- */
- public function setListValue($var)
- {
- GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class);
- $this->writeOneof(6, $var);
-
- return $this;
- }
-
- /**
- * @return string
- */
- public function getKind()
- {
- return $this->whichOneof("kind");
- }
-
-}
-
diff --git a/third_party/protobuf/3.6.0/php/tests/bootstrap_phpunit.php b/third_party/protobuf/3.6.0/php/tests/bootstrap_phpunit.php
deleted file mode 100644
index 8452f15896..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/bootstrap_phpunit.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-require_once("vendor/autoload.php");
-
-error_reporting(E_ALL);
diff --git a/third_party/protobuf/3.6.0/php/tests/generated_class_test.php b/third_party/protobuf/3.6.0/php/tests/generated_class_test.php
deleted file mode 100644
index 9f20bddc17..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/generated_class_test.php
+++ /dev/null
@@ -1,1345 +0,0 @@
-<?php
-
-require_once('generated/NoNamespaceEnum.php');
-require_once('generated/NoNamespaceMessage.php');
-require_once('test_base.php');
-require_once('test_util.php');
-
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\MapField;
-use Google\Protobuf\Internal\GPBType;
-use Bar\TestLegacyMessage;
-use Bar\TestLegacyMessage_NestedEnum;
-use Bar\TestLegacyMessage_NestedMessage;
-use Foo\TestEnum;
-use Foo\TestIncludeNamespaceMessage;
-use Foo\TestIncludePrefixMessage;
-use Foo\TestMessage;
-use Foo\TestMessage\Sub;
-use Foo\TestMessage_Sub;
-use Foo\TestMessage\NestedEnum;
-use Foo\TestReverseFieldOrder;
-use Foo\testLowerCaseMessage;
-use Foo\testLowerCaseEnum;
-use PBEmpty\PBEcho\TestEmptyPackage;
-use Php\Test\TestNamespace;
-
-class GeneratedClassTest extends TestBase
-{
-
- #########################################################
- # Test field accessors.
- #########################################################
-
- public function testSetterGetter()
- {
- $m = new TestMessage();
- $m->setOptionalInt32(1);
- $this->assertSame(1, $m->getOptionalInt32());
- }
-
- #########################################################
- # Test int32 field.
- #########################################################
-
- public function testInt32Field()
- {
- $m = new TestMessage();
-
- // Set integer.
- $m->setOptionalInt32(MAX_INT32);
- $this->assertSame(MAX_INT32, $m->getOptionalInt32());
- $m->setOptionalInt32(MIN_INT32);
- $this->assertSame(MIN_INT32, $m->getOptionalInt32());
-
- // Set float.
- $m->setOptionalInt32(1.1);
- $this->assertSame(1, $m->getOptionalInt32());
- $m->setOptionalInt32(MAX_INT32_FLOAT);
- $this->assertSame(MAX_INT32, $m->getOptionalInt32());
- $m->setOptionalInt32(MIN_INT32_FLOAT);
- $this->assertSame(MIN_INT32, $m->getOptionalInt32());
-
- // Set string.
- $m->setOptionalInt32('2');
- $this->assertSame(2, $m->getOptionalInt32());
- $m->setOptionalInt32('3.1');
- $this->assertSame(3, $m->getOptionalInt32());
- $m->setOptionalInt32(MAX_INT32_STRING);
- $this->assertSame(MAX_INT32, $m->getOptionalInt32());
- $m->setOptionalInt32(MIN_INT32_STRING);
- $this->assertSame(MIN_INT32, $m->getOptionalInt32());
- }
-
- #########################################################
- # Test uint32 field.
- #########################################################
-
- public function testUint32Field()
- {
- $m = new TestMessage();
-
- // Set integer.
- $m->setOptionalUint32(MAX_UINT32);
- $this->assertSame(-1, $m->getOptionalUint32());
- $m->setOptionalUint32(-1);
- $this->assertSame(-1, $m->getOptionalUint32());
- $m->setOptionalUint32(MIN_UINT32);
- $this->assertSame(MIN_INT32, $m->getOptionalUint32());
-
- // Set float.
- $m->setOptionalUint32(1.1);
- $this->assertSame(1, $m->getOptionalUint32());
- $m->setOptionalUint32(MAX_UINT32_FLOAT);
- $this->assertSame(-1, $m->getOptionalUint32());
- $m->setOptionalUint32(-1.0);
- $this->assertSame(-1, $m->getOptionalUint32());
- $m->setOptionalUint32(MIN_UINT32_FLOAT);
- $this->assertSame(MIN_INT32, $m->getOptionalUint32());
-
- // Set string.
- $m->setOptionalUint32('2');
- $this->assertSame(2, $m->getOptionalUint32());
- $m->setOptionalUint32('3.1');
- $this->assertSame(3, $m->getOptionalUint32());
- $m->setOptionalUint32(MAX_UINT32_STRING);
- $this->assertSame(-1, $m->getOptionalUint32());
- $m->setOptionalUint32('-1.0');
- $this->assertSame(-1, $m->getOptionalUint32());
- $m->setOptionalUint32(MIN_UINT32_STRING);
- $this->assertSame(MIN_INT32, $m->getOptionalUint32());
- }
-
- #########################################################
- # Test int64 field.
- #########################################################
-
- public function testInt64Field()
- {
- $m = new TestMessage();
-
- // Set integer.
- $m->setOptionalInt64(MAX_INT64);
- $this->assertSame(MAX_INT64, $m->getOptionalInt64());
- $m->setOptionalInt64(MIN_INT64);
- $this->assertEquals(MIN_INT64, $m->getOptionalInt64());
-
- // Set float.
- $m->setOptionalInt64(1.1);
- if (PHP_INT_SIZE == 4) {
- $this->assertSame('1', $m->getOptionalInt64());
- } else {
- $this->assertSame(1, $m->getOptionalInt64());
- }
-
- // Set string.
- $m->setOptionalInt64('2');
- if (PHP_INT_SIZE == 4) {
- $this->assertSame('2', $m->getOptionalInt64());
- } else {
- $this->assertSame(2, $m->getOptionalInt64());
- }
-
- $m->setOptionalInt64('3.1');
- if (PHP_INT_SIZE == 4) {
- $this->assertSame('3', $m->getOptionalInt64());
- } else {
- $this->assertSame(3, $m->getOptionalInt64());
- }
-
- $m->setOptionalInt64(MAX_INT64_STRING);
- if (PHP_INT_SIZE == 4) {
- $this->assertSame(MAX_INT64_STRING, $m->getOptionalInt64());
- } else {
- $this->assertSame(MAX_INT64, $m->getOptionalInt64());
- }
-
- $m->setOptionalInt64(MIN_INT64_STRING);
- if (PHP_INT_SIZE == 4) {
- $this->assertSame(MIN_INT64_STRING, $m->getOptionalInt64());
- } else {
- $this->assertSame(MIN_INT64, $m->getOptionalInt64());
- }
- }
-
- #########################################################
- # Test uint64 field.
- #########################################################
-
- public function testUint64Field()
- {
- $m = new TestMessage();
-
- // Set integer.
- $m->setOptionalUint64(MAX_UINT64);
- if (PHP_INT_SIZE == 4) {
- $this->assertSame(MAX_UINT64_STRING, $m->getOptionalUint64());
- } else {
- $this->assertSame(MAX_UINT64, $m->getOptionalUint64());
- }
-
- // Set float.
- $m->setOptionalUint64(1.1);
- if (PHP_INT_SIZE == 4) {
- $this->assertSame('1', $m->getOptionalUint64());
- } else {
- $this->assertSame(1, $m->getOptionalUint64());
- }
-
- // Set string.
- $m->setOptionalUint64('2');
- if (PHP_INT_SIZE == 4) {
- $this->assertSame('2', $m->getOptionalUint64());
- } else {
- $this->assertSame(2, $m->getOptionalUint64());
- }
-
- $m->setOptionalUint64('3.1');
- if (PHP_INT_SIZE == 4) {
- $this->assertSame('3', $m->getOptionalUint64());
- } else {
- $this->assertSame(3, $m->getOptionalUint64());
- }
-
- $m->setOptionalUint64(MAX_UINT64_STRING);
- if (PHP_INT_SIZE == 4) {
- $this->assertSame(MAX_UINT64_STRING, $m->getOptionalUint64());
- } else {
- $this->assertSame(MAX_UINT64, $m->getOptionalUint64());
- }
- }
-
- #########################################################
- # Test enum field.
- #########################################################
-
- public function testEnumField()
- {
- $m = new TestMessage();
-
- // Set enum.
- $m->setOptionalEnum(TestEnum::ONE);
- $this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
-
- // Set integer.
- $m->setOptionalEnum(1);
- $this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
-
- // Set float.
- $m->setOptionalEnum(1.1);
- $this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
-
- // Set string.
- $m->setOptionalEnum("1");
- $this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
- }
-
- public function testNestedEnum()
- {
- $m = new TestMessage();
- $m->setOptionalNestedEnum(NestedEnum::ZERO);
- }
-
- public function testLegacyNestedEnum()
- {
- $m = new TestMessage();
- $m->setOptionalNestedEnum(\Foo\TestMessage_NestedEnum::ZERO);
- }
-
- public function testLegacyTypehintWithNestedEnums()
- {
- $this->legacyEnum(new TestLegacyMessage\NestedEnum);
- }
-
- private function legacyEnum(TestLegacyMessage_NestedEnum $enum)
- {
- // If we made it here without a PHP Fatal error, the typehint worked
- $this->assertTrue(true);
- }
-
- #########################################################
- # Test float field.
- #########################################################
-
- public function testFloatField()
- {
- $m = new TestMessage();
-
- // Set integer.
- $m->setOptionalFloat(1);
- $this->assertEquals(1.0, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
-
- // Set float.
- $m->setOptionalFloat(1.1);
- $this->assertEquals(1.1, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
-
- // Set string.
- $m->setOptionalFloat('2');
- $this->assertEquals(2.0, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
- $m->setOptionalFloat('3.1');
- $this->assertEquals(3.1, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
- }
-
- #########################################################
- # Test double field.
- #########################################################
-
- public function testDoubleField()
- {
- $m = new TestMessage();
-
- // Set integer.
- $m->setOptionalDouble(1);
- $this->assertEquals(1.0, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
-
- // Set float.
- $m->setOptionalDouble(1.1);
- $this->assertEquals(1.1, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
-
- // Set string.
- $m->setOptionalDouble('2');
- $this->assertEquals(2.0, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
- $m->setOptionalDouble('3.1');
- $this->assertEquals(3.1, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
- }
-
- #########################################################
- # Test bool field.
- #########################################################
-
- public function testBoolField()
- {
- $m = new TestMessage();
-
- // Set bool.
- $m->setOptionalBool(true);
- $this->assertSame(true, $m->getOptionalBool());
-
- // Set integer.
- $m->setOptionalBool(-1);
- $this->assertSame(true, $m->getOptionalBool());
-
- // Set float.
- $m->setOptionalBool(1.1);
- $this->assertSame(true, $m->getOptionalBool());
-
- // Set string.
- $m->setOptionalBool('');
- $this->assertSame(false, $m->getOptionalBool());
- }
-
- #########################################################
- # Test string field.
- #########################################################
-
- public function testStringField()
- {
- $m = new TestMessage();
-
- // Set string.
- $m->setOptionalString('abc');
- $this->assertSame('abc', $m->getOptionalString());
-
- // Set integer.
- $m->setOptionalString(1);
- $this->assertSame('1', $m->getOptionalString());
-
- // Set double.
- $m->setOptionalString(1.1);
- $this->assertSame('1.1', $m->getOptionalString());
-
- // Set bool.
- $m->setOptionalString(true);
- $this->assertSame('1', $m->getOptionalString());
- }
-
- #########################################################
- # Test bytes field.
- #########################################################
-
- public function testBytesField()
- {
- $m = new TestMessage();
-
- // Set string.
- $m->setOptionalBytes('abc');
- $this->assertSame('abc', $m->getOptionalBytes());
-
- // Set integer.
- $m->setOptionalBytes(1);
- $this->assertSame('1', $m->getOptionalBytes());
-
- // Set double.
- $m->setOptionalBytes(1.1);
- $this->assertSame('1.1', $m->getOptionalBytes());
-
- // Set bool.
- $m->setOptionalBytes(true);
- $this->assertSame('1', $m->getOptionalBytes());
- }
-
- public function testBytesFieldInvalidUTF8Success()
- {
- $m = new TestMessage();
- $hex = hex2bin("ff");
- $m->setOptionalBytes($hex);
- }
-
- #########################################################
- # Test message field.
- #########################################################
-
- public function testMessageField()
- {
- $m = new TestMessage();
-
- $sub_m = new Sub();
- $sub_m->setA(1);
- $m->setOptionalMessage($sub_m);
- $this->assertSame(1, $m->getOptionalMessage()->getA());
-
- $null = null;
- $m->setOptionalMessage($null);
- $this->assertNull($m->getOptionalMessage());
- }
-
- public function testLegacyMessageField()
- {
- $m = new TestMessage();
-
- $sub_m = new TestMessage_Sub();
- $sub_m->setA(1);
- $m->setOptionalMessage($sub_m);
- $this->assertSame(1, $m->getOptionalMessage()->getA());
-
- $null = null;
- $m->setOptionalMessage($null);
- $this->assertNull($m->getOptionalMessage());
- }
-
- public function testLegacyTypehintWithNestedMessages()
- {
- $this->legacyMessage(new TestLegacyMessage\NestedMessage);
- }
-
- private function legacyMessage(TestLegacyMessage_NestedMessage $sub)
- {
- // If we made it here without a PHP Fatal error, the typehint worked
- $this->assertTrue(true);
- }
-
- #########################################################
- # Test repeated field.
- #########################################################
-
- public function testRepeatedField()
- {
- $m = new TestMessage();
-
- $repeated_int32 = new RepeatedField(GPBType::INT32);
- $m->setRepeatedInt32($repeated_int32);
- $this->assertSame($repeated_int32, $m->getRepeatedInt32());
- }
-
- public function testRepeatedFieldViaArray()
- {
- $m = new TestMessage();
-
- $arr = array();
- $m->setRepeatedInt32($arr);
- $this->assertSame(0, count($m->getRepeatedInt32()));
-
- $arr = array(1, 2.1, "3");
- $m->setRepeatedInt32($arr);
- $this->assertTrue($m->getRepeatedInt32() instanceof RepeatedField);
- $this->assertSame("Google\Protobuf\Internal\RepeatedField",
- get_class($m->getRepeatedInt32()));
- $this->assertSame(3, count($m->getRepeatedInt32()));
- $this->assertSame(1, $m->getRepeatedInt32()[0]);
- $this->assertSame(2, $m->getRepeatedInt32()[1]);
- $this->assertSame(3, $m->getRepeatedInt32()[2]);
- $this->assertFalse($arr instanceof RepeatedField);
- }
-
- #########################################################
- # Test map field.
- #########################################################
-
- public function testMapField()
- {
- $m = new TestMessage();
-
- $map_int32_int32 = new MapField(GPBType::INT32, GPBType::INT32);
- $m->setMapInt32Int32($map_int32_int32);
- $this->assertSame($map_int32_int32, $m->getMapInt32Int32());
- }
-
- public function testMapFieldViaArray()
- {
- $m = new TestMessage();
-
- $dict = array();
- $m->setMapInt32Int32($dict);
- $this->assertSame(0, count($m->getMapInt32Int32()));
-
- $dict = array(5 => 5, 6.1 => 6.1, "7" => "7");
- $m->setMapInt32Int32($dict);
- $this->assertTrue($m->getMapInt32Int32() instanceof MapField);
- $this->assertSame(3, count($m->getMapInt32Int32()));
- $this->assertSame(5, $m->getMapInt32Int32()[5]);
- $this->assertSame(6, $m->getMapInt32Int32()[6]);
- $this->assertSame(7, $m->getMapInt32Int32()[7]);
- $this->assertFalse($dict instanceof MapField);
- }
-
- #########################################################
- # Test oneof field.
- #########################################################
-
- public function testOneofField() {
- $m = new TestMessage();
-
- $this->assertSame("", $m->getMyOneof());
-
- $m->setOneofInt32(1);
- $this->assertSame(1, $m->getOneofInt32());
- $this->assertSame(0.0, $m->getOneofFloat());
- $this->assertSame('', $m->getOneofString());
- $this->assertSame(NULL, $m->getOneofMessage());
- $this->assertSame("oneof_int32", $m->getMyOneof());
-
- $m->setOneofFloat(2.0);
- $this->assertSame(0, $m->getOneofInt32());
- $this->assertSame(2.0, $m->getOneofFloat());
- $this->assertSame('', $m->getOneofString());
- $this->assertSame(NULL, $m->getOneofMessage());
- $this->assertSame("oneof_float", $m->getMyOneof());
-
- $m->setOneofString('abc');
- $this->assertSame(0, $m->getOneofInt32());
- $this->assertSame(0.0, $m->getOneofFloat());
- $this->assertSame('abc', $m->getOneofString());
- $this->assertSame(NULL, $m->getOneofMessage());
- $this->assertSame("oneof_string", $m->getMyOneof());
-
- $sub_m = new Sub();
- $sub_m->setA(1);
- $m->setOneofMessage($sub_m);
- $this->assertSame(0, $m->getOneofInt32());
- $this->assertSame(0.0, $m->getOneofFloat());
- $this->assertSame('', $m->getOneofString());
- $this->assertSame(1, $m->getOneofMessage()->getA());
- $this->assertSame("oneof_message", $m->getMyOneof());
- }
-
- #########################################################
- # Test clear method.
- #########################################################
-
- public function testMessageClear()
- {
- $m = new TestMessage();
- $this->setFields($m);
- $this->expectFields($m);
- $m->clear();
- $this->expectEmptyFields($m);
- }
-
- #########################################################
- # Test mergeFrom method.
- #########################################################
-
- public function testMessageMergeFrom()
- {
- $m = new TestMessage();
- $this->setFields($m);
- $this->expectFields($m);
- $arr = $m->getOptionalMessage()->getB();
- $arr[] = 1;
-
- $n = new TestMessage();
-
- // Singular
- $n->setOptionalInt32(100);
- $sub1 = new Sub();
- $sub1->setA(101);
-
- $b = $sub1->getB();
- $b[] = 102;
- $sub1->setB($b);
-
- $n->setOptionalMessage($sub1);
-
- // Repeated
- $repeatedInt32 = $n->getRepeatedInt32();
- $repeatedInt32[] = 200;
- $n->setRepeatedInt32($repeatedInt32);
-
- $repeatedString = $n->getRepeatedString();
- $repeatedString[] = 'abc';
- $n->setRepeatedString($repeatedString);
-
- $sub2 = new Sub();
- $sub2->setA(201);
- $repeatedMessage = $n->getRepeatedMessage();
- $repeatedMessage[] = $sub2;
- $n->setRepeatedMessage($repeatedMessage);
-
- // Map
- $mapInt32Int32 = $n->getMapInt32Int32();
- $mapInt32Int32[1] = 300;
- $mapInt32Int32[-62] = 301;
- $n->setMapInt32Int32($mapInt32Int32);
-
- $mapStringString = $n->getMapStringString();
- $mapStringString['def'] = 'def';
- $n->setMapStringString($mapStringString);
-
- $mapInt32Message = $n->getMapInt32Message();
- $mapInt32Message[1] = new Sub();
- $mapInt32Message[1]->setA(302);
- $mapInt32Message[2] = new Sub();
- $mapInt32Message[2]->setA(303);
- $n->setMapInt32Message($mapInt32Message);
-
- $m->mergeFrom($n);
-
- $this->assertSame(100, $m->getOptionalInt32());
- $this->assertSame(42, $m->getOptionalUint32());
- $this->assertSame(101, $m->getOptionalMessage()->getA());
- $this->assertSame(2, count($m->getOptionalMessage()->getB()));
- $this->assertSame(1, $m->getOptionalMessage()->getB()[0]);
- $this->assertSame(102, $m->getOptionalMessage()->getB()[1]);
-
- $this->assertSame(3, count($m->getRepeatedInt32()));
- $this->assertSame(200, $m->getRepeatedInt32()[2]);
- $this->assertSame(2, count($m->getRepeatedUint32()));
- $this->assertSame(3, count($m->getRepeatedString()));
- $this->assertSame('abc', $m->getRepeatedString()[2]);
- $this->assertSame(3, count($m->getRepeatedMessage()));
- $this->assertSame(201, $m->getRepeatedMessage()[2]->getA());
-
- $this->assertSame(2, count($m->getMapInt32Int32()));
- $this->assertSame(300, $m->getMapInt32Int32()[1]);
- $this->assertSame(301, $m->getMapInt32Int32()[-62]);
- $this->assertSame(1, count($m->getMapUint32Uint32()));
- $this->assertSame(2, count($m->getMapStringString()));
- $this->assertSame('def', $m->getMapStringString()['def']);
-
- $this->assertSame(2, count($m->getMapInt32Message()));
- $this->assertSame(302, $m->getMapInt32Message()[1]->getA());
- $this->assertSame(303, $m->getMapInt32Message()[2]->getA());
-
- $this->assertSame("", $m->getMyOneof());
-
- // Check sub-messages are copied by value.
- $n->getOptionalMessage()->setA(-101);
- $this->assertSame(101, $m->getOptionalMessage()->getA());
-
- $repeatedMessage = $n->getRepeatedMessage();
- $repeatedMessage[0]->setA(-201);
- $n->setRepeatedMessage($repeatedMessage);
- $this->assertSame(201, $m->getRepeatedMessage()[2]->getA());
-
- $mapInt32Message = $n->getMapInt32Message();
- $mapInt32Message[1]->setA(-302);
- $n->setMapInt32Message($mapInt32Message);
-
- $this->assertSame(302, $m->getMapInt32Message()[1]->getA());
-
- // Test merge oneof.
- $m = new TestMessage();
-
- $n = new TestMessage();
- $n->setOneofInt32(1);
- $m->mergeFrom($n);
- $this->assertSame(1, $m->getOneofInt32());
-
- $sub = new Sub();
- $n->setOneofMessage($sub);
- $n->getOneofMessage()->setA(400);
- $m->mergeFrom($n);
- $this->assertSame(400, $m->getOneofMessage()->getA());
- $n->getOneofMessage()->setA(-400);
- $this->assertSame(400, $m->getOneofMessage()->getA());
-
- // Test all fields
- $m = new TestMessage();
- $n = new TestMessage();
- $this->setFields($m);
- $n->mergeFrom($m);
- $this->expectFields($n);
- }
-
- #########################################################
- # Test message/enum without namespace.
- #########################################################
-
- public function testMessageWithoutNamespace()
- {
- $m = new TestMessage();
- $n = new NoNameSpaceMessage();
- $m->setOptionalNoNamespaceMessage($n);
- $repeatedNoNamespaceMessage = $m->getRepeatedNoNamespaceMessage();
- $repeatedNoNamespaceMessage[] = new NoNameSpaceMessage();
- $m->setRepeatedNoNamespaceMessage($repeatedNoNamespaceMessage);
-
- // test nested messages
- $sub = new NoNamespaceMessage\NestedMessage();
- $n->setNestedMessage($sub);
- }
-
- public function testEnumWithoutNamespace()
- {
- $m = new TestMessage();
- $m->setOptionalNoNamespaceEnum(NoNameSpaceEnum::VALUE_A);
- $repeatedNoNamespaceEnum = $m->getRepeatedNoNamespaceEnum();
- $repeatedNoNamespaceEnum[] = NoNameSpaceEnum::VALUE_A;
- $m->setRepeatedNoNamespaceEnum($repeatedNoNamespaceEnum);
- }
-
- #########################################################
- # Test message with given namespace.
- #########################################################
-
- public function testNestedMessagesAndEnums()
- {
- $m = new TestMessage();
- $n = new TestMessage\Sub();
- $m->setOptionalMessage($n);
- $m->setOptionalNestedEnum(TestMessage\NestedEnum::ZERO);
- $this->assertSame($n, $m->getOptionalMessage());
- $this->assertSame(TestMessage\NestedEnum::ZERO, $m->getOptionalNestedEnum());
- }
-
- public function testMessagesAndEnumsWithPrefix()
- {
- // Test message prefix
- $m = new TestIncludePrefixMessage();
- $n = new PrefixTestPrefix();
- $n->setA(1);
- $m->setPrefixMessage($n);
- $this->assertSame(1, $m->getPrefixMessage()->getA());
-
- // Test nested message prefix
- $o = new PrefixTestPrefix();
- $p = new PrefixTestPrefix\PrefixNestedMessage();
- $o->setNestedMessage($p);
- $o->setNestedEnum(PrefixTestPrefix\PrefixNestedEnum::ZERO);
- $this->assertSame($p, $o->getNestedMessage());
- $this->assertSame(PrefixTestPrefix\PrefixNestedEnum::ZERO, $o->getNestedEnum());
- }
-
- public function testMessagesAndEnumsWithPhpNamespace()
- {
- $m = new TestNamespace();
- $n = new TestNamespace\NestedMessage();
- $m->setNestedMessage($n);
- $m->setNestedEnum(TestNamespace\NestedEnum::ZERO);
- $this->assertSame($n, $m->getNestedMessage());
- $this->assertSame(TestNamespace\NestedEnum::ZERO, $m->getNestedEnum());
- }
-
- public function testMesssagesAndEnumsWithEmptyPhpNamespace()
- {
- $m = new TestEmptyNamespace();
- $n = new TestEmptyNamespace\NestedMessage();
- $m->setNestedMessage($n);
- $m->setNestedEnum(TestEmptyNamespace\NestedEnum::ZERO);
- $this->assertSame($n, $m->getNestedMessage());
- $this->assertSame(TestEmptyNamespace\NestedEnum::ZERO, $m->getNestedEnum());
- }
-
- public function testMessagesAndEnumsWithNoNamespace()
- {
- $m = new NoNamespaceMessage();
- $n = new NoNamespaceMessage\NestedMessage();
- $m->setNestedMessage($n);
- $m->setNestedEnum(NoNamespaceMessage\NestedEnum::ZERO);
- $this->assertSame($n, $m->getNestedMessage());
- $this->assertSame(NoNamespaceMessage\NestedEnum::ZERO, $m->getNestedEnum());
- }
-
- public function testReservedWordsInPackageName()
- {
- $m = new TestEmptyPackage();
- $n = new TestEmptyPackage\NestedMessage();
- $m->setNestedMessage($n);
- $m->setNestedEnum(TestEmptyPackage\NestedEnum::ZERO);
- $this->assertSame($n, $m->getNestedMessage());
- $this->assertSame(TestEmptyPackage\NestedEnum::ZERO, $m->getNestedEnum());
- }
-
- public function testReservedWordsInNamespace()
- {
- $m = new TestNamespace();
- $n = new TestNamespace\PBEmpty();
- $o = new TestNamespace\PBEmpty\NestedMessage();
- $n->setNestedMessage($o);
- $n->setNestedEnum(TestNamespace\PBEmpty\NestedEnum::ZERO);
- $m->setReservedName($n);
- $this->assertSame($n, $m->getReservedName());
- $this->assertSame($o, $n->getNestedMessage());
- $this->assertSame(
- TestNamespace\PBEmpty\NestedEnum::ZERO,
- $n->getNestedEnum()
- );
- }
-
- #########################################################
- # Test prefix for reserved words.
- #########################################################
-
- public function testPrefixForReservedWords()
- {
- $m = new \Foo\TestMessage\PBEmpty();
- $m = new \Foo\PBEmpty();
- $m = new \PrefixEmpty();
- $m = new \Foo\PBARRAY();
-
- $m = new \Lower\PBabstract();
- $m = new \Lower\PBand();
- $m = new \Lower\PBarray();
- $m = new \Lower\PBas();
- $m = new \Lower\PBbreak();
- $m = new \Lower\PBcallable();
- $m = new \Lower\PBcase();
- $m = new \Lower\PBcatch();
- $m = new \Lower\PBclass();
- $m = new \Lower\PBclone();
- $m = new \Lower\PBconst();
- $m = new \Lower\PBcontinue();
- $m = new \Lower\PBdeclare();
- $m = new \Lower\PBdefault();
- $m = new \Lower\PBdie();
- $m = new \Lower\PBdo();
- $m = new \Lower\PBecho();
- $m = new \Lower\PBelse();
- $m = new \Lower\PBelseif();
- $m = new \Lower\PBempty();
- $m = new \Lower\PBenddeclare();
- $m = new \Lower\PBendfor();
- $m = new \Lower\PBendforeach();
- $m = new \Lower\PBendif();
- $m = new \Lower\PBendswitch();
- $m = new \Lower\PBendwhile();
- $m = new \Lower\PBeval();
- $m = new \Lower\PBexit();
- $m = new \Lower\PBextends();
- $m = new \Lower\PBfinal();
- $m = new \Lower\PBfor();
- $m = new \Lower\PBforeach();
- $m = new \Lower\PBfunction();
- $m = new \Lower\PBglobal();
- $m = new \Lower\PBgoto();
- $m = new \Lower\PBif();
- $m = new \Lower\PBimplements();
- $m = new \Lower\PBinclude();
- $m = new \Lower\PBinclude_once();
- $m = new \Lower\PBinstanceof();
- $m = new \Lower\PBinsteadof();
- $m = new \Lower\PBinterface();
- $m = new \Lower\PBisset();
- $m = new \Lower\PBlist();
- $m = new \Lower\PBnamespace();
- $m = new \Lower\PBnew();
- $m = new \Lower\PBor();
- $m = new \Lower\PBprint();
- $m = new \Lower\PBprivate();
- $m = new \Lower\PBprotected();
- $m = new \Lower\PBpublic();
- $m = new \Lower\PBrequire();
- $m = new \Lower\PBrequire_once();
- $m = new \Lower\PBreturn();
- $m = new \Lower\PBstatic();
- $m = new \Lower\PBswitch();
- $m = new \Lower\PBthrow();
- $m = new \Lower\PBtrait();
- $m = new \Lower\PBtry();
- $m = new \Lower\PBunset();
- $m = new \Lower\PBuse();
- $m = new \Lower\PBvar();
- $m = new \Lower\PBwhile();
- $m = new \Lower\PBxor();
- $m = new \Lower\PBint();
- $m = new \Lower\PBfloat();
- $m = new \Lower\PBbool();
- $m = new \Lower\PBstring();
- $m = new \Lower\PBtrue();
- $m = new \Lower\PBfalse();
- $m = new \Lower\PBnull();
- $m = new \Lower\PBvoid();
- $m = new \Lower\PBiterable();
-
- $m = new \Upper\PBABSTRACT();
- $m = new \Upper\PBAND();
- $m = new \Upper\PBARRAY();
- $m = new \Upper\PBAS();
- $m = new \Upper\PBBREAK();
- $m = new \Upper\PBCALLABLE();
- $m = new \Upper\PBCASE();
- $m = new \Upper\PBCATCH();
- $m = new \Upper\PBCLASS();
- $m = new \Upper\PBCLONE();
- $m = new \Upper\PBCONST();
- $m = new \Upper\PBCONTINUE();
- $m = new \Upper\PBDECLARE();
- $m = new \Upper\PBDEFAULT();
- $m = new \Upper\PBDIE();
- $m = new \Upper\PBDO();
- $m = new \Upper\PBECHO();
- $m = new \Upper\PBELSE();
- $m = new \Upper\PBELSEIF();
- $m = new \Upper\PBEMPTY();
- $m = new \Upper\PBENDDECLARE();
- $m = new \Upper\PBENDFOR();
- $m = new \Upper\PBENDFOREACH();
- $m = new \Upper\PBENDIF();
- $m = new \Upper\PBENDSWITCH();
- $m = new \Upper\PBENDWHILE();
- $m = new \Upper\PBEVAL();
- $m = new \Upper\PBEXIT();
- $m = new \Upper\PBEXTENDS();
- $m = new \Upper\PBFINAL();
- $m = new \Upper\PBFOR();
- $m = new \Upper\PBFOREACH();
- $m = new \Upper\PBFUNCTION();
- $m = new \Upper\PBGLOBAL();
- $m = new \Upper\PBGOTO();
- $m = new \Upper\PBIF();
- $m = new \Upper\PBIMPLEMENTS();
- $m = new \Upper\PBINCLUDE();
- $m = new \Upper\PBINCLUDE_ONCE();
- $m = new \Upper\PBINSTANCEOF();
- $m = new \Upper\PBINSTEADOF();
- $m = new \Upper\PBINTERFACE();
- $m = new \Upper\PBISSET();
- $m = new \Upper\PBLIST();
- $m = new \Upper\PBNAMESPACE();
- $m = new \Upper\PBNEW();
- $m = new \Upper\PBOR();
- $m = new \Upper\PBPRINT();
- $m = new \Upper\PBPRIVATE();
- $m = new \Upper\PBPROTECTED();
- $m = new \Upper\PBPUBLIC();
- $m = new \Upper\PBREQUIRE();
- $m = new \Upper\PBREQUIRE_ONCE();
- $m = new \Upper\PBRETURN();
- $m = new \Upper\PBSTATIC();
- $m = new \Upper\PBSWITCH();
- $m = new \Upper\PBTHROW();
- $m = new \Upper\PBTRAIT();
- $m = new \Upper\PBTRY();
- $m = new \Upper\PBUNSET();
- $m = new \Upper\PBUSE();
- $m = new \Upper\PBVAR();
- $m = new \Upper\PBWHILE();
- $m = new \Upper\PBXOR();
- $m = new \Upper\PBINT();
- $m = new \Upper\PBFLOAT();
- $m = new \Upper\PBBOOL();
- $m = new \Upper\PBSTRING();
- $m = new \Upper\PBTRUE();
- $m = new \Upper\PBFALSE();
- $m = new \Upper\PBNULL();
- $m = new \Upper\PBVOID();
- $m = new \Upper\PBITERABLE();
-
- $m = new \Lower_enum\PBabstract();
- $m = new \Lower_enum\PBand();
- $m = new \Lower_enum\PBarray();
- $m = new \Lower_enum\PBas();
- $m = new \Lower_enum\PBbreak();
- $m = new \Lower_enum\PBcallable();
- $m = new \Lower_enum\PBcase();
- $m = new \Lower_enum\PBcatch();
- $m = new \Lower_enum\PBclass();
- $m = new \Lower_enum\PBclone();
- $m = new \Lower_enum\PBconst();
- $m = new \Lower_enum\PBcontinue();
- $m = new \Lower_enum\PBdeclare();
- $m = new \Lower_enum\PBdefault();
- $m = new \Lower_enum\PBdie();
- $m = new \Lower_enum\PBdo();
- $m = new \Lower_enum\PBecho();
- $m = new \Lower_enum\PBelse();
- $m = new \Lower_enum\PBelseif();
- $m = new \Lower_enum\PBempty();
- $m = new \Lower_enum\PBenddeclare();
- $m = new \Lower_enum\PBendfor();
- $m = new \Lower_enum\PBendforeach();
- $m = new \Lower_enum\PBendif();
- $m = new \Lower_enum\PBendswitch();
- $m = new \Lower_enum\PBendwhile();
- $m = new \Lower_enum\PBeval();
- $m = new \Lower_enum\PBexit();
- $m = new \Lower_enum\PBextends();
- $m = new \Lower_enum\PBfinal();
- $m = new \Lower_enum\PBfor();
- $m = new \Lower_enum\PBforeach();
- $m = new \Lower_enum\PBfunction();
- $m = new \Lower_enum\PBglobal();
- $m = new \Lower_enum\PBgoto();
- $m = new \Lower_enum\PBif();
- $m = new \Lower_enum\PBimplements();
- $m = new \Lower_enum\PBinclude();
- $m = new \Lower_enum\PBinclude_once();
- $m = new \Lower_enum\PBinstanceof();
- $m = new \Lower_enum\PBinsteadof();
- $m = new \Lower_enum\PBinterface();
- $m = new \Lower_enum\PBisset();
- $m = new \Lower_enum\PBlist();
- $m = new \Lower_enum\PBnamespace();
- $m = new \Lower_enum\PBnew();
- $m = new \Lower_enum\PBor();
- $m = new \Lower_enum\PBprint();
- $m = new \Lower_enum\PBprivate();
- $m = new \Lower_enum\PBprotected();
- $m = new \Lower_enum\PBpublic();
- $m = new \Lower_enum\PBrequire();
- $m = new \Lower_enum\PBrequire_once();
- $m = new \Lower_enum\PBreturn();
- $m = new \Lower_enum\PBstatic();
- $m = new \Lower_enum\PBswitch();
- $m = new \Lower_enum\PBthrow();
- $m = new \Lower_enum\PBtrait();
- $m = new \Lower_enum\PBtry();
- $m = new \Lower_enum\PBunset();
- $m = new \Lower_enum\PBuse();
- $m = new \Lower_enum\PBvar();
- $m = new \Lower_enum\PBwhile();
- $m = new \Lower_enum\PBxor();
- $m = new \Lower_enum\PBint();
- $m = new \Lower_enum\PBfloat();
- $m = new \Lower_enum\PBbool();
- $m = new \Lower_enum\PBstring();
- $m = new \Lower_enum\PBtrue();
- $m = new \Lower_enum\PBfalse();
- $m = new \Lower_enum\PBnull();
- $m = new \Lower_enum\PBvoid();
- $m = new \Lower_enum\PBiterable();
-
- $m = new \Upper_enum\PBABSTRACT();
- $m = new \Upper_enum\PBAND();
- $m = new \Upper_enum\PBARRAY();
- $m = new \Upper_enum\PBAS();
- $m = new \Upper_enum\PBBREAK();
- $m = new \Upper_enum\PBCALLABLE();
- $m = new \Upper_enum\PBCASE();
- $m = new \Upper_enum\PBCATCH();
- $m = new \Upper_enum\PBCLASS();
- $m = new \Upper_enum\PBCLONE();
- $m = new \Upper_enum\PBCONST();
- $m = new \Upper_enum\PBCONTINUE();
- $m = new \Upper_enum\PBDECLARE();
- $m = new \Upper_enum\PBDEFAULT();
- $m = new \Upper_enum\PBDIE();
- $m = new \Upper_enum\PBDO();
- $m = new \Upper_enum\PBECHO();
- $m = new \Upper_enum\PBELSE();
- $m = new \Upper_enum\PBELSEIF();
- $m = new \Upper_enum\PBEMPTY();
- $m = new \Upper_enum\PBENDDECLARE();
- $m = new \Upper_enum\PBENDFOR();
- $m = new \Upper_enum\PBENDFOREACH();
- $m = new \Upper_enum\PBENDIF();
- $m = new \Upper_enum\PBENDSWITCH();
- $m = new \Upper_enum\PBENDWHILE();
- $m = new \Upper_enum\PBEVAL();
- $m = new \Upper_enum\PBEXIT();
- $m = new \Upper_enum\PBEXTENDS();
- $m = new \Upper_enum\PBFINAL();
- $m = new \Upper_enum\PBFOR();
- $m = new \Upper_enum\PBFOREACH();
- $m = new \Upper_enum\PBFUNCTION();
- $m = new \Upper_enum\PBGLOBAL();
- $m = new \Upper_enum\PBGOTO();
- $m = new \Upper_enum\PBIF();
- $m = new \Upper_enum\PBIMPLEMENTS();
- $m = new \Upper_enum\PBINCLUDE();
- $m = new \Upper_enum\PBINCLUDE_ONCE();
- $m = new \Upper_enum\PBINSTANCEOF();
- $m = new \Upper_enum\PBINSTEADOF();
- $m = new \Upper_enum\PBINTERFACE();
- $m = new \Upper_enum\PBISSET();
- $m = new \Upper_enum\PBLIST();
- $m = new \Upper_enum\PBNAMESPACE();
- $m = new \Upper_enum\PBNEW();
- $m = new \Upper_enum\PBOR();
- $m = new \Upper_enum\PBPRINT();
- $m = new \Upper_enum\PBPRIVATE();
- $m = new \Upper_enum\PBPROTECTED();
- $m = new \Upper_enum\PBPUBLIC();
- $m = new \Upper_enum\PBREQUIRE();
- $m = new \Upper_enum\PBREQUIRE_ONCE();
- $m = new \Upper_enum\PBRETURN();
- $m = new \Upper_enum\PBSTATIC();
- $m = new \Upper_enum\PBSWITCH();
- $m = new \Upper_enum\PBTHROW();
- $m = new \Upper_enum\PBTRAIT();
- $m = new \Upper_enum\PBTRY();
- $m = new \Upper_enum\PBUNSET();
- $m = new \Upper_enum\PBUSE();
- $m = new \Upper_enum\PBVAR();
- $m = new \Upper_enum\PBWHILE();
- $m = new \Upper_enum\PBXOR();
- $m = new \Upper_enum\PBINT();
- $m = new \Upper_enum\PBFLOAT();
- $m = new \Upper_enum\PBBOOL();
- $m = new \Upper_enum\PBSTRING();
- $m = new \Upper_enum\PBTRUE();
- $m = new \Upper_enum\PBFALSE();
- $m = new \Upper_enum\PBNULL();
- $m = new \Upper_enum\PBVOID();
- $m = new \Upper_enum\PBITERABLE();
-
- $m = \Lower_enum_value\NotAllowed::PBabstract;
- $m = \Lower_enum_value\NotAllowed::PBand;
- $m = \Lower_enum_value\NotAllowed::PBarray;
- $m = \Lower_enum_value\NotAllowed::PBas;
- $m = \Lower_enum_value\NotAllowed::PBbreak;
- $m = \Lower_enum_value\NotAllowed::PBcallable;
- $m = \Lower_enum_value\NotAllowed::PBcase;
- $m = \Lower_enum_value\NotAllowed::PBcatch;
- $m = \Lower_enum_value\NotAllowed::PBclass;
- $m = \Lower_enum_value\NotAllowed::PBclone;
- $m = \Lower_enum_value\NotAllowed::PBconst;
- $m = \Lower_enum_value\NotAllowed::PBcontinue;
- $m = \Lower_enum_value\NotAllowed::PBdeclare;
- $m = \Lower_enum_value\NotAllowed::PBdefault;
- $m = \Lower_enum_value\NotAllowed::PBdie;
- $m = \Lower_enum_value\NotAllowed::PBdo;
- $m = \Lower_enum_value\NotAllowed::PBecho;
- $m = \Lower_enum_value\NotAllowed::PBelse;
- $m = \Lower_enum_value\NotAllowed::PBelseif;
- $m = \Lower_enum_value\NotAllowed::PBempty;
- $m = \Lower_enum_value\NotAllowed::PBenddeclare;
- $m = \Lower_enum_value\NotAllowed::PBendfor;
- $m = \Lower_enum_value\NotAllowed::PBendforeach;
- $m = \Lower_enum_value\NotAllowed::PBendif;
- $m = \Lower_enum_value\NotAllowed::PBendswitch;
- $m = \Lower_enum_value\NotAllowed::PBendwhile;
- $m = \Lower_enum_value\NotAllowed::PBeval;
- $m = \Lower_enum_value\NotAllowed::PBexit;
- $m = \Lower_enum_value\NotAllowed::PBextends;
- $m = \Lower_enum_value\NotAllowed::PBfinal;
- $m = \Lower_enum_value\NotAllowed::PBfor;
- $m = \Lower_enum_value\NotAllowed::PBforeach;
- $m = \Lower_enum_value\NotAllowed::PBfunction;
- $m = \Lower_enum_value\NotAllowed::PBglobal;
- $m = \Lower_enum_value\NotAllowed::PBgoto;
- $m = \Lower_enum_value\NotAllowed::PBif;
- $m = \Lower_enum_value\NotAllowed::PBimplements;
- $m = \Lower_enum_value\NotAllowed::PBinclude;
- $m = \Lower_enum_value\NotAllowed::PBinclude_once;
- $m = \Lower_enum_value\NotAllowed::PBinstanceof;
- $m = \Lower_enum_value\NotAllowed::PBinsteadof;
- $m = \Lower_enum_value\NotAllowed::PBinterface;
- $m = \Lower_enum_value\NotAllowed::PBisset;
- $m = \Lower_enum_value\NotAllowed::PBlist;
- $m = \Lower_enum_value\NotAllowed::PBnamespace;
- $m = \Lower_enum_value\NotAllowed::PBnew;
- $m = \Lower_enum_value\NotAllowed::PBor;
- $m = \Lower_enum_value\NotAllowed::PBprint;
- $m = \Lower_enum_value\NotAllowed::PBprivate;
- $m = \Lower_enum_value\NotAllowed::PBprotected;
- $m = \Lower_enum_value\NotAllowed::PBpublic;
- $m = \Lower_enum_value\NotAllowed::PBrequire;
- $m = \Lower_enum_value\NotAllowed::PBrequire_once;
- $m = \Lower_enum_value\NotAllowed::PBreturn;
- $m = \Lower_enum_value\NotAllowed::PBstatic;
- $m = \Lower_enum_value\NotAllowed::PBswitch;
- $m = \Lower_enum_value\NotAllowed::PBthrow;
- $m = \Lower_enum_value\NotAllowed::PBtrait;
- $m = \Lower_enum_value\NotAllowed::PBtry;
- $m = \Lower_enum_value\NotAllowed::PBunset;
- $m = \Lower_enum_value\NotAllowed::PBuse;
- $m = \Lower_enum_value\NotAllowed::PBvar;
- $m = \Lower_enum_value\NotAllowed::PBwhile;
- $m = \Lower_enum_value\NotAllowed::PBxor;
- $m = \Lower_enum_value\NotAllowed::int;
- $m = \Lower_enum_value\NotAllowed::float;
- $m = \Lower_enum_value\NotAllowed::bool;
- $m = \Lower_enum_value\NotAllowed::string;
- $m = \Lower_enum_value\NotAllowed::true;
- $m = \Lower_enum_value\NotAllowed::false;
- $m = \Lower_enum_value\NotAllowed::null;
- $m = \Lower_enum_value\NotAllowed::void;
- $m = \Lower_enum_value\NotAllowed::iterable;
-
- $m = \Upper_enum_value\NotAllowed::PBABSTRACT;
- $m = \Upper_enum_value\NotAllowed::PBAND;
- $m = \Upper_enum_value\NotAllowed::PBARRAY;
- $m = \Upper_enum_value\NotAllowed::PBAS;
- $m = \Upper_enum_value\NotAllowed::PBBREAK;
- $m = \Upper_enum_value\NotAllowed::PBCALLABLE;
- $m = \Upper_enum_value\NotAllowed::PBCASE;
- $m = \Upper_enum_value\NotAllowed::PBCATCH;
- $m = \Upper_enum_value\NotAllowed::PBCLASS;
- $m = \Upper_enum_value\NotAllowed::PBCLONE;
- $m = \Upper_enum_value\NotAllowed::PBCONST;
- $m = \Upper_enum_value\NotAllowed::PBCONTINUE;
- $m = \Upper_enum_value\NotAllowed::PBDECLARE;
- $m = \Upper_enum_value\NotAllowed::PBDEFAULT;
- $m = \Upper_enum_value\NotAllowed::PBDIE;
- $m = \Upper_enum_value\NotAllowed::PBDO;
- $m = \Upper_enum_value\NotAllowed::PBECHO;
- $m = \Upper_enum_value\NotAllowed::PBELSE;
- $m = \Upper_enum_value\NotAllowed::PBELSEIF;
- $m = \Upper_enum_value\NotAllowed::PBEMPTY;
- $m = \Upper_enum_value\NotAllowed::PBENDDECLARE;
- $m = \Upper_enum_value\NotAllowed::PBENDFOR;
- $m = \Upper_enum_value\NotAllowed::PBENDFOREACH;
- $m = \Upper_enum_value\NotAllowed::PBENDIF;
- $m = \Upper_enum_value\NotAllowed::PBENDSWITCH;
- $m = \Upper_enum_value\NotAllowed::PBENDWHILE;
- $m = \Upper_enum_value\NotAllowed::PBEVAL;
- $m = \Upper_enum_value\NotAllowed::PBEXIT;
- $m = \Upper_enum_value\NotAllowed::PBEXTENDS;
- $m = \Upper_enum_value\NotAllowed::PBFINAL;
- $m = \Upper_enum_value\NotAllowed::PBFOR;
- $m = \Upper_enum_value\NotAllowed::PBFOREACH;
- $m = \Upper_enum_value\NotAllowed::PBFUNCTION;
- $m = \Upper_enum_value\NotAllowed::PBGLOBAL;
- $m = \Upper_enum_value\NotAllowed::PBGOTO;
- $m = \Upper_enum_value\NotAllowed::PBIF;
- $m = \Upper_enum_value\NotAllowed::PBIMPLEMENTS;
- $m = \Upper_enum_value\NotAllowed::PBINCLUDE;
- $m = \Upper_enum_value\NotAllowed::PBINCLUDE_ONCE;
- $m = \Upper_enum_value\NotAllowed::PBINSTANCEOF;
- $m = \Upper_enum_value\NotAllowed::PBINSTEADOF;
- $m = \Upper_enum_value\NotAllowed::PBINTERFACE;
- $m = \Upper_enum_value\NotAllowed::PBISSET;
- $m = \Upper_enum_value\NotAllowed::PBLIST;
- $m = \Upper_enum_value\NotAllowed::PBNAMESPACE;
- $m = \Upper_enum_value\NotAllowed::PBNEW;
- $m = \Upper_enum_value\NotAllowed::PBOR;
- $m = \Upper_enum_value\NotAllowed::PBPRINT;
- $m = \Upper_enum_value\NotAllowed::PBPRIVATE;
- $m = \Upper_enum_value\NotAllowed::PBPROTECTED;
- $m = \Upper_enum_value\NotAllowed::PBPUBLIC;
- $m = \Upper_enum_value\NotAllowed::PBREQUIRE;
- $m = \Upper_enum_value\NotAllowed::PBREQUIRE_ONCE;
- $m = \Upper_enum_value\NotAllowed::PBRETURN;
- $m = \Upper_enum_value\NotAllowed::PBSTATIC;
- $m = \Upper_enum_value\NotAllowed::PBSWITCH;
- $m = \Upper_enum_value\NotAllowed::PBTHROW;
- $m = \Upper_enum_value\NotAllowed::PBTRAIT;
- $m = \Upper_enum_value\NotAllowed::PBTRY;
- $m = \Upper_enum_value\NotAllowed::PBUNSET;
- $m = \Upper_enum_value\NotAllowed::PBUSE;
- $m = \Upper_enum_value\NotAllowed::PBVAR;
- $m = \Upper_enum_value\NotAllowed::PBWHILE;
- $m = \Upper_enum_value\NotAllowed::PBXOR;
- $m = \Upper_enum_value\NotAllowed::INT;
- $m = \Upper_enum_value\NotAllowed::FLOAT;
- $m = \Upper_enum_value\NotAllowed::BOOL;
- $m = \Upper_enum_value\NotAllowed::STRING;
- $m = \Upper_enum_value\NotAllowed::TRUE;
- $m = \Upper_enum_value\NotAllowed::FALSE;
- $m = \Upper_enum_value\NotAllowed::NULL;
- $m = \Upper_enum_value\NotAllowed::VOID;
- $m = \Upper_enum_value\NotAllowed::ITERABLE;
- }
-
- #########################################################
- # Test fluent setters.
- #########################################################
-
- public function testFluentSetters()
- {
- $m = (new TestMessage())
- ->setOptionalInt32(1)
- ->setOptionalUInt32(2);
- $this->assertSame(1, $m->getOptionalInt32());
- $this->assertSame(2, $m->getOptionalUInt32());
- }
-
- #########################################################
- # Test Reverse Field Order.
- #########################################################
-
- public function testReverseFieldOrder()
- {
- $m = new TestReverseFieldOrder();
- $m->setB("abc");
- $this->assertSame("abc", $m->getB());
- $this->assertNotSame("abc", $m->getA());
- }
-
- #########################################################
- # Test Reverse Field Order.
- #########################################################
-
- public function testLowerCase()
- {
- $m = new testLowerCaseMessage();
- $n = testLowerCaseEnum::VALUE;
- }
-
- #########################################################
- # Test Array Constructor.
- #########################################################
-
- public function testArrayConstructor()
- {
- $m = new TestMessage([
- 'optional_int32' => -42,
- 'optional_int64' => -43,
- 'optional_uint32' => 42,
- 'optional_uint64' => 43,
- 'optional_sint32' => -44,
- 'optional_sint64' => -45,
- 'optional_fixed32' => 46,
- 'optional_fixed64' => 47,
- 'optional_sfixed32' => -46,
- 'optional_sfixed64' => -47,
- 'optional_float' => 1.5,
- 'optional_double' => 1.6,
- 'optional_bool' => true,
- 'optional_string' => 'a',
- 'optional_bytes' => 'b',
- 'optional_enum' => TestEnum::ONE,
- 'optional_message' => new Sub([
- 'a' => 33
- ]),
- 'repeated_int32' => [-42, -52],
- 'repeated_int64' => [-43, -53],
- 'repeated_uint32' => [42, 52],
- 'repeated_uint64' => [43, 53],
- 'repeated_sint32' => [-44, -54],
- 'repeated_sint64' => [-45, -55],
- 'repeated_fixed32' => [46, 56],
- 'repeated_fixed64' => [47, 57],
- 'repeated_sfixed32' => [-46, -56],
- 'repeated_sfixed64' => [-47, -57],
- 'repeated_float' => [1.5, 2.5],
- 'repeated_double' => [1.6, 2.6],
- 'repeated_bool' => [true, false],
- 'repeated_string' => ['a', 'c'],
- 'repeated_bytes' => ['b', 'd'],
- 'repeated_enum' => [TestEnum::ZERO, TestEnum::ONE],
- 'repeated_message' => [new Sub(['a' => 34]),
- new Sub(['a' => 35])],
- 'map_int32_int32' => [-62 => -62],
- 'map_int64_int64' => [-63 => -63],
- 'map_uint32_uint32' => [62 => 62],
- 'map_uint64_uint64' => [63 => 63],
- 'map_sint32_sint32' => [-64 => -64],
- 'map_sint64_sint64' => [-65 => -65],
- 'map_fixed32_fixed32' => [66 => 66],
- 'map_fixed64_fixed64' => [67 => 67],
- 'map_sfixed32_sfixed32' => [-68 => -68],
- 'map_sfixed64_sfixed64' => [-69 => -69],
- 'map_int32_float' => [1 => 3.5],
- 'map_int32_double' => [1 => 3.6],
- 'map_bool_bool' => [true => true],
- 'map_string_string' => ['e' => 'e'],
- 'map_int32_bytes' => [1 => 'f'],
- 'map_int32_enum' => [1 => TestEnum::ONE],
- 'map_int32_message' => [1 => new Sub(['a' => 36])],
- ]);
-
- TestUtil::assertTestMessage($m);
- }
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/memory_leak_test.php b/third_party/protobuf/3.6.0/php/tests/memory_leak_test.php
deleted file mode 100644
index 4e3874b7f1..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/memory_leak_test.php
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php
-
-# phpunit has memory leak by itself. Thus, it cannot be used to test memory leak.
-
-require_once('generated/NoNamespaceEnum.php');
-require_once('generated/NoNamespaceMessage.php');
-require_once('generated/NoNamespaceMessage/NestedEnum.php');
-require_once('generated/NoNamespaceMessage/NestedMessage.php');
-require_once('generated/PrefixEmpty.php');
-require_once('generated/PrefixTestPrefix.php');
-require_once('generated/PrefixTestPrefix/PrefixNestedEnum.php');
-require_once('generated/PrefixTestPrefix/PrefixNestedMessage.php');
-require_once('generated/TestEmptyNamespace.php');
-require_once('generated/TestEmptyNamespace/NestedEnum.php');
-require_once('generated/TestEmptyNamespace/NestedMessage.php');
-require_once('generated/Bar/TestInclude.php');
-require_once('generated/Bar/TestLegacyMessage.php');
-require_once('generated/Bar/TestLegacyMessage/NestedEnum.php');
-require_once('generated/Bar/TestLegacyMessage/NestedMessage.php');
-require_once('generated/Foo/PBARRAY.php');
-require_once('generated/Foo/PBEmpty.php');
-require_once('generated/Foo/TestEnum.php');
-require_once('generated/Foo/TestIncludeNamespaceMessage.php');
-require_once('generated/Foo/TestIncludePrefixMessage.php');
-require_once('generated/Foo/TestMessage.php');
-require_once('generated/Foo/TestMessage/PBEmpty.php');
-require_once('generated/Foo/TestMessage/NestedEnum.php');
-require_once('generated/Foo/TestMessage/Sub.php');
-require_once('generated/Foo/TestPackedMessage.php');
-require_once('generated/Foo/TestPhpDoc.php');
-require_once('generated/Foo/TestRandomFieldOrder.php');
-require_once('generated/Foo/TestReverseFieldOrder.php');
-require_once('generated/Foo/TestUnpackedMessage.php');
-require_once('generated/Foo/testLowerCaseMessage.php');
-require_once('generated/Foo/testLowerCaseEnum.php');
-require_once('generated/GPBMetadata/Proto/Test.php');
-require_once('generated/TestEmptyPhpNamespace.php');
-require_once('generated/GPBMetadata/Proto/TestInclude.php');
-require_once('generated/TestNoNamespace.php');
-require_once('generated/Metadata/Php/Test/TestPhpNamespace.php');
-require_once('generated/GPBMetadata/Proto/TestPrefix.php');
-require_once('generated/Php/Test/TestNamespace.php');
-require_once('generated/Php/Test/TestNamespace/PBEmpty.php');
-require_once('generated/Php/Test/TestNamespace/PBEmpty/NestedEnum.php');
-require_once('generated/Php/Test/TestNamespace/PBEmpty/NestedMessage.php');
-require_once('generated/Php/Test/TestNamespace/NestedEnum.php');
-require_once('generated/Php/Test/TestNamespace/NestedMessage.php');
-require_once('test_util.php');
-
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBType;
-use Foo\TestMessage;
-use Foo\TestMessage\Sub;
-
-$from = new TestMessage();
-TestUtil::setTestMessage($from);
-TestUtil::assertTestMessage($from);
-
-$data = $from->serializeToString();
-
-$to = new TestMessage();
-$to->mergeFromString($data);
-
-TestUtil::assertTestMessage($to);
-
-$from = new TestMessage();
-TestUtil::setTestMessage2($from);
-
-$data = $from->serializeToString();
-
-$to->mergeFromString($data);
-
-// TODO(teboring): This causes following tests fail in php7.
-# $from->setRecursive($from);
-
-$arr = new RepeatedField(GPBType::MESSAGE, TestMessage::class);
-$arr[] = new TestMessage;
-$arr[0]->SetRepeatedRecursive($arr);
-
-// Test oneof fields.
-$m = new TestMessage();
-
-$m->setOneofInt32(1);
-assert(1 === $m->getOneofInt32());
-assert(0.0 === $m->getOneofFloat());
-assert('' === $m->getOneofString());
-assert(NULL === $m->getOneofMessage());
-$data = $m->serializeToString();
-$n = new TestMessage();
-$n->mergeFromString($data);
-assert(1 === $n->getOneofInt32());
-
-$m->setOneofFloat(2.0);
-assert(0 === $m->getOneofInt32());
-assert(2.0 === $m->getOneofFloat());
-assert('' === $m->getOneofString());
-assert(NULL === $m->getOneofMessage());
-$data = $m->serializeToString();
-$n = new TestMessage();
-$n->mergeFromString($data);
-assert(2.0 === $n->getOneofFloat());
-
-$m->setOneofString('abc');
-assert(0 === $m->getOneofInt32());
-assert(0.0 === $m->getOneofFloat());
-assert('abc' === $m->getOneofString());
-assert(NULL === $m->getOneofMessage());
-$data = $m->serializeToString();
-$n = new TestMessage();
-$n->mergeFromString($data);
-assert('abc' === $n->getOneofString());
-
-$sub_m = new Sub();
-$sub_m->setA(1);
-$m->setOneofMessage($sub_m);
-assert(0 === $m->getOneofInt32());
-assert(0.0 === $m->getOneofFloat());
-assert('' === $m->getOneofString());
-assert(1 === $m->getOneofMessage()->getA());
-$data = $m->serializeToString();
-$n = new TestMessage();
-$n->mergeFromString($data);
-assert(1 === $n->getOneofMessage()->getA());
-
-$m = new TestMessage();
-$m->mergeFromString(hex2bin('F80601'));
-assert('f80601' === bin2hex($m->serializeToString()));
-
-// Test create repeated field via array.
-$str_arr = array("abc");
-$m = new TestMessage();
-$m->setRepeatedString($str_arr);
-
-// Test create map field via array.
-$str_arr = array("abc"=>"abc");
-$m = new TestMessage();
-$m->setMapStringString($str_arr);
-
-// Test unset
-$from = new TestMessage();
-TestUtil::setTestMessage($from);
-unset($from);
-
-// Test wellknown
-$from = new \Google\Protobuf\Timestamp();
-$from->setSeconds(1);
-assert(1, $from->getSeconds());
-
-$timestamp = new \Google\Protobuf\Timestamp();
-
-date_default_timezone_set('UTC');
-$from = new DateTime('2011-01-01T15:03:01.012345UTC');
-$timestamp->fromDateTime($from);
-assert($from->format('U') == $timestamp->getSeconds());
-assert(0 == $timestamp->getNanos());
-
-$to = $timestamp->toDateTime();
-assert(\DateTime::class == get_class($to));
-assert($from->format('U') == $to->format('U'));
-
-$from = new \Google\Protobuf\Value();
-$from->setNumberValue(1);
-assert(1, $from->getNumberValue());
-
-// Test discard unknown in message.
-$m = new TestMessage();
-$from = hex2bin('F80601');
-$m->mergeFromString($from);
-$m->discardUnknownFields();
-$to = $m->serializeToString();
-assert("" === bin2hex($to));
-
-// Test clear
-$m = new TestMessage();
-TestUtil::setTestMessage($m);
-$m->clear();
-
-// Test unset map element
-$m = new TestMessage();
-$map = $m->getMapStringString();
-$map[1] = 1;
-unset($map[1]);
-
-// Test descriptor
-$pool = \Google\Protobuf\DescriptorPool::getGeneratedPool();
-$desc = $pool->getDescriptorByClassName("\Foo\TestMessage");
-$field = $desc->getField(1);
-
-$from = new TestMessage();
-$to = new TestMessage();
-TestUtil::setTestMessage($from);
-$to->mergeFrom($from);
-TestUtil::assertTestMessage($to);
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/empty/echo.proto b/third_party/protobuf/3.6.0/php/tests/proto/empty/echo.proto
deleted file mode 100644
index 1817018dd2..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/empty/echo.proto
+++ /dev/null
@@ -1,17 +0,0 @@
-syntax = "proto3";
-
-package empty.echo;
-
-message TestEmptyPackage {
- int32 a = 1;
-
- // Test nested messages, enums, and reserved names
- NestedMessage nested_message = 2;
- NestedEnum nested_enum = 3;
- message NestedMessage {
- int32 a = 1;
- }
- enum NestedEnum {
- ZERO = 0;
- };
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_empty_php_namespace.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_empty_php_namespace.proto
deleted file mode 100644
index c7ed16573e..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_empty_php_namespace.proto
+++ /dev/null
@@ -1,19 +0,0 @@
-syntax = "proto3";
-
-package foo;
-option php_namespace = "";
-option php_metadata_namespace = "";
-
-message TestEmptyNamespace {
- int32 a = 1;
-
- // Test nested messages, enums, and reserved names
- NestedMessage nested_message = 2;
- NestedEnum nested_enum = 3;
- message NestedMessage {
- int32 a = 1;
- }
- enum NestedEnum {
- ZERO = 0;
- };
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_include.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_include.proto
deleted file mode 100644
index a9072fe304..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_include.proto
+++ /dev/null
@@ -1,18 +0,0 @@
-syntax = "proto3";
-
-package bar;
-
-message TestInclude {
- int32 a = 1;
-}
-
-message TestLegacyMessage {
- NestedMessage message = 1;
- NestedEnum enum = 2;
- message NestedMessage {
- int32 a = 1;
- }
- enum NestedEnum {
- ZERO = 0;
- }
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_no_namespace.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_no_namespace.proto
deleted file mode 100644
index cce42ea2c3..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_no_namespace.proto
+++ /dev/null
@@ -1,22 +0,0 @@
-syntax = "proto3";
-
-option php_metadata_namespace = "\\";
-
-message NoNamespaceMessage {
- int32 a = 1;
-
- // Test nested messages, enums, and reserved names
- NestedMessage nested_message = 2;
- NestedEnum nested_enum = 3;
- message NestedMessage {
- int32 a = 1;
- }
- enum NestedEnum {
- ZERO = 0;
- };
-}
-
-enum NoNamespaceEnum {
- VALUE_A = 0;
- VALUE_B = 1;
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_php_namespace.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_php_namespace.proto
deleted file mode 100644
index 61085bf75a..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_php_namespace.proto
+++ /dev/null
@@ -1,31 +0,0 @@
-syntax = "proto3";
-
-package foo;
-option php_namespace = "Php\\Test";
-option php_metadata_namespace = "Metadata\\Php\\Test";
-
-message TestNamespace {
- int32 a = 1;
-
- // Test nested messages, enums, and reserved names
- NestedMessage nested_message = 2;
- NestedEnum nested_enum = 3;
- Empty reserved_name = 4;
- message NestedMessage {
- int32 a = 1;
- }
- enum NestedEnum {
- ZERO = 0;
- };
- // Test reserved name
- message Empty {
- NestedMessage nested_message = 1;
- NestedEnum nested_enum = 2;
- message NestedMessage {
- int32 a = 1;
- }
- enum NestedEnum {
- ZERO = 0;
- };
- }
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_lower.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_lower.proto
deleted file mode 100644
index d2daeaff4a..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_lower.proto
+++ /dev/null
@@ -1,77 +0,0 @@
-syntax = "proto3";
-
-package lower_enum;
-
-enum abstract { ZERO1 = 0; }
-enum and { ZERO2 = 0; }
-enum array { ZERO3 = 0; }
-enum as { ZERO4 = 0; }
-enum break { ZERO5 = 0; }
-enum callable { ZERO6 = 0; }
-enum case { ZERO7 = 0; }
-enum catch { ZERO8 = 0; }
-enum class { ZERO9 = 0; }
-enum clone { ZERO10 = 0; }
-enum const { ZERO11 = 0; }
-enum continue { ZERO12 = 0; }
-enum declare { ZERO13 = 0; }
-enum default { ZERO14 = 0; }
-enum die { ZERO15 = 0; }
-enum do { ZERO16 = 0; }
-enum echo { ZERO17 = 0; }
-enum else { ZERO18 = 0; }
-enum elseif { ZERO19 = 0; }
-enum empty { ZERO20 = 0; }
-enum enddeclare { ZERO21 = 0; }
-enum endfor { ZERO22 = 0; }
-enum endforeach { ZERO23 = 0; }
-enum endif { ZERO24 = 0; }
-enum endswitch { ZERO25 = 0; }
-enum endwhile { ZERO26 = 0; }
-enum eval { ZERO27 = 0; }
-enum exit { ZERO28 = 0; }
-enum extends { ZERO29 = 0; }
-enum final { ZERO30 = 0; }
-enum for { ZERO31 = 0; }
-enum foreach { ZERO32 = 0; }
-enum function { ZERO33 = 0; }
-enum global { ZERO34 = 0; }
-enum goto { ZERO35 = 0; }
-enum if { ZERO36 = 0; }
-enum implements { ZERO37 = 0; }
-enum include { ZERO38 = 0; }
-enum include_once { ZERO39 = 0; }
-enum instanceof { ZERO40 = 0; }
-enum insteadof { ZERO41 = 0; }
-enum interface { ZERO42 = 0; }
-enum isset { ZERO43 = 0; }
-enum list { ZERO44 = 0; }
-enum namespace { ZERO45 = 0; }
-enum new { ZERO46 = 0; }
-enum or { ZERO47 = 0; }
-enum print { ZERO48 = 0; }
-enum private { ZERO49 = 0; }
-enum protected { ZERO50 = 0; }
-enum public { ZERO51 = 0; }
-enum require { ZERO52 = 0; }
-enum require_once { ZERO53 = 0; }
-enum return { ZERO54 = 0; }
-enum static { ZERO55 = 0; }
-enum switch { ZERO56 = 0; }
-enum throw { ZERO57 = 0; }
-enum trait { ZERO58 = 0; }
-enum try { ZERO59 = 0; }
-enum unset { ZERO60 = 0; }
-enum use { ZERO61 = 0; }
-enum var { ZERO62 = 0; }
-enum while { ZERO63 = 0; }
-enum xor { ZERO64 = 0; }
-enum int { ZERO65 = 0; }
-enum float { ZERO66 = 0; }
-enum bool { ZERO67 = 0; }
-enum string { ZERO68 = 0; }
-enum true { ZERO69 = 0; }
-enum false { ZERO70 = 0; }
-enum null { ZERO71 = 0; }
-enum void { ZERO72 = 0; }
-enum iterable { ZERO73 = 0; }
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_upper.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_upper.proto
deleted file mode 100644
index a396fea31c..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_upper.proto
+++ /dev/null
@@ -1,77 +0,0 @@
-syntax = "proto3";
-
-package upper_enum;
-
-enum ABSTRACT { ZERO1 = 0; }
-enum AND { ZERO2 = 0; }
-enum ARRAY { ZERO3 = 0; }
-enum AS { ZERO4 = 0; }
-enum BREAK { ZERO5 = 0; }
-enum CALLABLE { ZERO6 = 0; }
-enum CASE { ZERO7 = 0; }
-enum CATCH { ZERO8 = 0; }
-enum CLASS { ZERO9 = 0; }
-enum CLONE { ZERO10 = 0; }
-enum CONST { ZERO11 = 0; }
-enum CONTINUE { ZERO12 = 0; }
-enum DECLARE { ZERO13 = 0; }
-enum DEFAULT { ZERO14 = 0; }
-enum DIE { ZERO15 = 0; }
-enum DO { ZERO16 = 0; }
-enum ECHO { ZERO17 = 0; }
-enum ELSE { ZERO18 = 0; }
-enum ELSEIF { ZERO19 = 0; }
-enum EMPTY { ZERO20 = 0; }
-enum ENDDECLARE { ZERO21 = 0; }
-enum ENDFOR { ZERO22 = 0; }
-enum ENDFOREACH { ZERO23 = 0; }
-enum ENDIF { ZERO24 = 0; }
-enum ENDSWITCH { ZERO25 = 0; }
-enum ENDWHILE { ZERO26 = 0; }
-enum EVAL { ZERO27 = 0; }
-enum EXIT { ZERO28 = 0; }
-enum EXTENDS { ZERO29 = 0; }
-enum FINAL { ZERO30 = 0; }
-enum FOR { ZERO31 = 0; }
-enum FOREACH { ZERO32 = 0; }
-enum FUNCTION { ZERO33 = 0; }
-enum GLOBAL { ZERO34 = 0; }
-enum GOTO { ZERO35 = 0; }
-enum IF { ZERO36 = 0; }
-enum IMPLEMENTS { ZERO37 = 0; }
-enum INCLUDE { ZERO38 = 0; }
-enum INCLUDE_ONCE { ZERO39 = 0; }
-enum INSTANCEOF { ZERO40 = 0; }
-enum INSTEADOF { ZERO41 = 0; }
-enum INTERFACE { ZERO42 = 0; }
-enum ISSET { ZERO43 = 0; }
-enum LIST { ZERO44 = 0; }
-enum NAMESPACE { ZERO45 = 0; }
-enum NEW { ZERO46 = 0; }
-enum OR { ZERO47 = 0; }
-enum PRINT { ZERO48 = 0; }
-enum PRIVATE { ZERO49 = 0; }
-enum PROTECTED { ZERO50 = 0; }
-enum PUBLIC { ZERO51 = 0; }
-enum REQUIRE { ZERO52 = 0; }
-enum REQUIRE_ONCE { ZERO53 = 0; }
-enum RETURN { ZERO54 = 0; }
-enum STATIC { ZERO55 = 0; }
-enum SWITCH { ZERO56 = 0; }
-enum THROW { ZERO57 = 0; }
-enum TRAIT { ZERO58 = 0; }
-enum TRY { ZERO59 = 0; }
-enum UNSET { ZERO60 = 0; }
-enum USE { ZERO61 = 0; }
-enum VAR { ZERO62 = 0; }
-enum WHILE { ZERO63 = 0; }
-enum XOR { ZERO64 = 0; }
-enum INT { ZERO65 = 0; }
-enum FLOAT { ZERO66 = 0; }
-enum BOOL { ZERO67 = 0; }
-enum STRING { ZERO68 = 0; }
-enum TRUE { ZERO69 = 0; }
-enum FALSE { ZERO70 = 0; }
-enum NULL { ZERO71 = 0; }
-enum VOID { ZERO72 = 0; }
-enum ITERABLE { ZERO73 = 0; }
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_value_lower.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_value_lower.proto
deleted file mode 100644
index 96da319e55..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_value_lower.proto
+++ /dev/null
@@ -1,79 +0,0 @@
-syntax = "proto3";
-
-package lower_enum_value;
-
-enum NotAllowed {
- abstract = 0;
- and = 1;
- array = 2;
- as = 3;
- break = 4;
- callable = 5;
- case = 6;
- catch = 7;
- class = 8;
- clone = 9;
- const = 10;
- continue = 11;
- declare = 12;
- default = 13;
- die = 14;
- do = 15;
- echo = 16;
- else = 17;
- elseif = 18;
- empty = 19;
- enddeclare = 20;
- endfor = 21;
- endforeach = 22;
- endif = 23;
- endswitch = 24;
- endwhile = 25;
- eval = 26;
- exit = 27;
- extends = 28;
- final = 29;
- for = 30;
- foreach = 31;
- function = 32;
- global = 33;
- goto = 34;
- if = 35;
- implements = 36;
- include = 37;
- include_once = 38;
- instanceof = 39;
- insteadof = 40;
- interface = 41;
- isset = 42;
- list = 43;
- namespace = 44;
- new = 45;
- or = 46;
- print = 47;
- private = 48;
- protected = 49;
- public = 50;
- require = 51;
- require_once = 52;
- return = 53;
- static = 54;
- switch = 55;
- throw = 56;
- trait = 57;
- try = 58;
- unset = 59;
- use = 60;
- var = 61;
- while = 62;
- xor = 63;
- int = 64;
- float = 65;
- bool = 66;
- string = 67;
- true = 68;
- false = 69;
- null = 70;
- void = 71;
- iterable = 72;
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_value_upper.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_value_upper.proto
deleted file mode 100644
index b026a85855..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_enum_value_upper.proto
+++ /dev/null
@@ -1,79 +0,0 @@
-syntax = "proto3";
-
-package upper_enum_value;
-
-enum NotAllowed {
- ABSTRACT = 0;
- AND = 1;
- ARRAY = 2;
- AS = 3;
- BREAK = 4;
- CALLABLE = 5;
- CASE = 6;
- CATCH = 7;
- CLASS = 8;
- CLONE = 9;
- CONST = 10;
- CONTINUE = 11;
- DECLARE = 12;
- DEFAULT = 13;
- DIE = 14;
- DO = 15;
- ECHO = 16;
- ELSE = 17;
- ELSEIF = 18;
- EMPTY = 19;
- ENDDECLARE = 20;
- ENDFOR = 21;
- ENDFOREACH = 22;
- ENDIF = 23;
- ENDSWITCH = 24;
- ENDWHILE = 25;
- EVAL = 26;
- EXIT = 27;
- EXTENDS = 28;
- FINAL = 29;
- FOR = 30;
- FOREACH = 31;
- FUNCTION = 32;
- GLOBAL = 33;
- GOTO = 34;
- IF = 35;
- IMPLEMENTS = 36;
- INCLUDE = 37;
- INCLUDE_ONCE = 38;
- INSTANCEOF = 39;
- INSTEADOF = 40;
- INTERFACE = 41;
- ISSET = 42;
- LIST = 43;
- NAMESPACE = 44;
- NEW = 45;
- OR = 46;
- PRINT = 47;
- PRIVATE = 48;
- PROTECTED = 49;
- PUBLIC = 50;
- REQUIRE = 51;
- REQUIRE_ONCE = 52;
- RETURN = 53;
- STATIC = 54;
- SWITCH = 55;
- THROW = 56;
- TRAIT = 57;
- TRY = 58;
- UNSET = 59;
- USE = 60;
- VAR = 61;
- WHILE = 62;
- XOR = 63;
- INT = 64;
- FLOAT = 65;
- BOOL = 66;
- STRING = 67;
- TRUE = 68;
- FALSE = 69;
- NULL = 70;
- VOID = 71;
- ITERABLE = 72;
-}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_message_lower.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_message_lower.proto
deleted file mode 100644
index ed120808b7..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_message_lower.proto
+++ /dev/null
@@ -1,77 +0,0 @@
-syntax = "proto3";
-
-package lower;
-
-message abstract {}
-message and {}
-message array {}
-message as {}
-message break {}
-message callable {}
-message case {}
-message catch {}
-message class {}
-message clone {}
-message const {}
-message continue {}
-message declare {}
-message default {}
-message die {}
-message do {}
-message echo {}
-message else {}
-message elseif {}
-message empty {}
-message enddeclare {}
-message endfor {}
-message endforeach {}
-message endif {}
-message endswitch {}
-message endwhile {}
-message eval {}
-message exit {}
-message extends {}
-message final {}
-message for {}
-message foreach {}
-message function {}
-message global {}
-message goto {}
-message if {}
-message implements {}
-message include {}
-message include_once {}
-message instanceof {}
-message insteadof {}
-message interface {}
-message isset {}
-message list {}
-message namespace {}
-message new {}
-message or {}
-message print {}
-message private {}
-message protected {}
-message public {}
-message require {}
-message require_once {}
-message return {}
-message static {}
-message switch {}
-message throw {}
-message trait {}
-message try {}
-message unset {}
-message use {}
-message var {}
-message while {}
-message xor {}
-message int {}
-message float {}
-message bool {}
-message string {}
-message true {}
-message false {}
-message null {}
-message void {}
-message iterable {}
diff --git a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_message_upper.proto b/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_message_upper.proto
deleted file mode 100644
index 2917fd11ea..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/proto/test_reserved_message_upper.proto
+++ /dev/null
@@ -1,77 +0,0 @@
-syntax = "proto3";
-
-package upper;
-
-message ABSTRACT {}
-message AND {}
-message ARRAY {}
-message AS {}
-message BREAK {}
-message CALLABLE {}
-message CASE {}
-message CATCH {}
-message CLASS {}
-message CLONE {}
-message CONST {}
-message CONTINUE {}
-message DECLARE {}
-message DEFAULT {}
-message DIE {}
-message DO {}
-message ECHO {}
-message ELSE {}
-message ELSEIF {}
-message EMPTY {}
-message ENDDECLARE {}
-message ENDFOR {}
-message ENDFOREACH {}
-message ENDIF {}
-message ENDSWITCH {}
-message ENDWHILE {}
-message EVAL {}
-message EXIT {}
-message EXTENDS {}
-message FINAL {}
-message FOR {}
-message FOREACH {}
-message FUNCTION {}
-message GLOBAL {}
-message GOTO {}
-message IF {}
-message IMPLEMENTS {}
-message INCLUDE {}
-message INCLUDE_ONCE {}
-message INSTANCEOF {}
-message INSTEADOF {}
-message INTERFACE {}
-message ISSET {}
-message LIST {}
-message NAMESPACE {}
-message NEW {}
-message OR {}
-message PRINT {}
-message PRIVATE {}
-message PROTECTED {}
-message PUBLIC {}
-message REQUIRE {}
-message REQUIRE_ONCE {}
-message RETURN {}
-message STATIC {}
-message SWITCH {}
-message THROW {}
-message TRAIT {}
-message TRY {}
-message UNSET {}
-message USE {}
-message VAR {}
-message WHILE {}
-message XOR {}
-message INT {}
-message FLOAT {}
-message BOOL {}
-message STRING {}
-message TRUE {}
-message FALSE {}
-message NULL {}
-message VOID {}
-message ITERABLE {}
diff --git a/third_party/protobuf/3.6.0/php/tests/well_known_test.php b/third_party/protobuf/3.6.0/php/tests/well_known_test.php
deleted file mode 100644
index 1e8c4f4286..0000000000
--- a/third_party/protobuf/3.6.0/php/tests/well_known_test.php
+++ /dev/null
@@ -1,393 +0,0 @@
-<?php
-
-require_once('test_base.php');
-require_once('test_util.php');
-
-use Foo\TestMessage;
-use Google\Protobuf\Any;
-use Google\Protobuf\Api;
-use Google\Protobuf\BoolValue;
-use Google\Protobuf\BytesValue;
-use Google\Protobuf\DoubleValue;
-use Google\Protobuf\Duration;
-use Google\Protobuf\Enum;
-use Google\Protobuf\EnumValue;
-use Google\Protobuf\Field;
-use Google\Protobuf\FieldMask;
-use Google\Protobuf\Field\Cardinality;
-use Google\Protobuf\Field\Kind;
-use Google\Protobuf\FloatValue;
-use Google\Protobuf\GPBEmpty;
-use Google\Protobuf\Int32Value;
-use Google\Protobuf\Int64Value;
-use Google\Protobuf\ListValue;
-use Google\Protobuf\Method;
-use Google\Protobuf\Mixin;
-use Google\Protobuf\NullValue;
-use Google\Protobuf\Option;
-use Google\Protobuf\SourceContext;
-use Google\Protobuf\StringValue;
-use Google\Protobuf\Struct;
-use Google\Protobuf\Syntax;
-use Google\Protobuf\Timestamp;
-use Google\Protobuf\Type;
-use Google\Protobuf\UInt32Value;
-use Google\Protobuf\UInt64Value;
-use Google\Protobuf\Value;
-
-class NotMessage {}
-
-class WellKnownTest extends TestBase {
-
- public function testEmpty()
- {
- $msg = new GPBEmpty();
- }
-
- public function testImportDescriptorProto()
- {
- $msg = new TestImportDescriptorProto();
- }
-
- public function testAny()
- {
- // Create embed message
- $embed = new TestMessage();
- $this->setFields($embed);
- $data = $embed->serializeToString();
-
- // Set any via normal setter.
- $any = new Any();
-
- $this->assertSame(
- $any, $any->setTypeUrl("type.googleapis.com/foo.TestMessage"));
- $this->assertSame("type.googleapis.com/foo.TestMessage",
- $any->getTypeUrl());
-
- $this->assertSame($any, $any->setValue($data));
- $this->assertSame($data, $any->getValue());
-
- // Test unpack.
- $msg = $any->unpack();
- $this->assertTrue($msg instanceof TestMessage);
- $this->expectFields($msg);
-
- // Test pack.
- $any = new Any();
- $any->pack($embed);
- $this->assertSame($data, $any->getValue());
- $this->assertSame("type.googleapis.com/foo.TestMessage", $any->getTypeUrl());
-
- // Test is.
- $this->assertTrue($any->is(TestMessage::class));
- $this->assertFalse($any->is(Any::class));
- }
-
- /**
- * @expectedException Exception
- */
- public function testAnyUnpackInvalidTypeUrl()
- {
- $any = new Any();
- $any->setTypeUrl("invalid");
- $any->unpack();
- }
-
- /**
- * @expectedException Exception
- */
- public function testAnyUnpackMessageNotAdded()
- {
- $any = new Any();
- $any->setTypeUrl("type.googleapis.com/MessageNotAdded");
- $any->unpack();
- }
-
- /**
- * @expectedException Exception
- */
- public function testAnyUnpackDecodeError()
- {
- $any = new Any();
- $any->setTypeUrl("type.googleapis.com/foo.TestMessage");
- $any->setValue("abc");
- $any->unpack();
- }
-
- public function testApi()
- {
- $m = new Api();
-
- $m->setName("a");
- $this->assertSame("a", $m->getName());
-
- $m->setMethods([new Method()]);
- $this->assertSame(1, count($m->getMethods()));
-
- $m->setOptions([new Option()]);
- $this->assertSame(1, count($m->getOptions()));
-
- $m->setVersion("a");
- $this->assertSame("a", $m->getVersion());
-
- $m->setSourceContext(new SourceContext());
- $this->assertFalse(is_null($m->getSourceContext()));
-
- $m->setMixins([new Mixin()]);
- $this->assertSame(1, count($m->getMixins()));
-
- $m->setSyntax(Syntax::SYNTAX_PROTO2);
- $this->assertSame(Syntax::SYNTAX_PROTO2, $m->getSyntax());
-
- $m = new Method();
-
- $m->setName("a");
- $this->assertSame("a", $m->getName());
-
- $m->setRequestTypeUrl("a");
- $this->assertSame("a", $m->getRequestTypeUrl());
-
- $m->setRequestStreaming(true);
- $this->assertSame(true, $m->getRequestStreaming());
-
- $m->setResponseTypeUrl("a");
- $this->assertSame("a", $m->getResponseTypeUrl());
-
- $m->setResponseStreaming(true);
- $this->assertSame(true, $m->getResponseStreaming());
-
- $m->setOptions([new Option()]);
- $this->assertSame(1, count($m->getOptions()));
-
- $m = new Mixin();
-
- $m->setName("a");
- $this->assertSame("a", $m->getName());
-
- $m->setRoot("a");
- $this->assertSame("a", $m->getRoot());
- }
-
- public function testEnum()
- {
- $m = new Enum();
-
- $m->setName("a");
- $this->assertSame("a", $m->getName());
-
- $m->setEnumvalue([new EnumValue()]);
- $this->assertSame(1, count($m->getEnumvalue()));
-
- $m->setOptions([new Option()]);
- $this->assertSame(1, count($m->getOptions()));
-
- $m->setSourceContext(new SourceContext());
- $this->assertFalse(is_null($m->getSourceContext()));
-
- $m->setSyntax(Syntax::SYNTAX_PROTO2);
- $this->assertSame(Syntax::SYNTAX_PROTO2, $m->getSyntax());
- }
-
- public function testEnumValue()
- {
- $m = new EnumValue();
-
- $m->setName("a");
- $this->assertSame("a", $m->getName());
-
- $m->setNumber(1);
- $this->assertSame(1, $m->getNumber());
-
- $m->setOptions([new Option()]);
- $this->assertSame(1, count($m->getOptions()));
- }
-
- public function testField()
- {
- $m = new Field();
-
- $m->setKind(Kind::TYPE_DOUBLE);
- $this->assertSame(Kind::TYPE_DOUBLE, $m->getKind());
-
- $m->setCardinality(Cardinality::CARDINALITY_OPTIONAL);
- $this->assertSame(Cardinality::CARDINALITY_OPTIONAL, $m->getCardinality());
-
- $m->setNumber(1);
- $this->assertSame(1, $m->getNumber());
-
- $m->setName("a");
- $this->assertSame("a", $m->getName());
-
- $m->setTypeUrl("a");
- $this->assertSame("a", $m->getTypeUrl());
-
- $m->setOneofIndex(1);
- $this->assertSame(1, $m->getOneofIndex());
-
- $m->setPacked(true);
- $this->assertSame(true, $m->getPacked());
-
- $m->setOptions([new Option()]);
- $this->assertSame(1, count($m->getOptions()));
-
- $m->setJsonName("a");
- $this->assertSame("a", $m->getJsonName());
-
- $m->setDefaultValue("a");
- $this->assertSame("a", $m->getDefaultValue());
- }
-
- public function testFieldMask()
- {
- $m = new FieldMask();
- $m->setPaths(["a"]);
- $this->assertSame(1, count($m->getPaths()));
- }
-
- public function testOption()
- {
- $m = new Option();
-
- $m->setName("a");
- $this->assertSame("a", $m->getName());
-
- $m->setValue(new Any());
- $this->assertFalse(is_null($m->getValue()));
- }
-
- public function testSourceContext()
- {
- $m = new SourceContext();
- $m->setFileName("a");
- $this->assertSame("a", $m->getFileName());
- }
-
- public function testStruct()
- {
- $m = new ListValue();
- $m->setValues([new Value()]);
- $this->assertSame(1, count($m->getValues()));
-
- $m = new Value();
-
- $m->setNullValue(NullValue::NULL_VALUE);
- $this->assertSame(NullValue::NULL_VALUE, $m->getNullValue());
- $this->assertSame("null_value", $m->getKind());
-
- $m->setNumberValue(1.0);
- $this->assertSame(1.0, $m->getNumberValue());
- $this->assertSame("number_value", $m->getKind());
-
- $m->setStringValue("a");
- $this->assertSame("a", $m->getStringValue());
- $this->assertSame("string_value", $m->getKind());
-
- $m->setBoolValue(true);
- $this->assertSame(true, $m->getBoolValue());
- $this->assertSame("bool_value", $m->getKind());
-
- $m->setStructValue(new Struct());
- $this->assertFalse(is_null($m->getStructValue()));
- $this->assertSame("struct_value", $m->getKind());
-
- $m->setListValue(new ListValue());
- $this->assertFalse(is_null($m->getListValue()));
- $this->assertSame("list_value", $m->getKind());
-
- $m = new Struct();
- $m->setFields(array("a"=>new Value()));
- $this->assertSame(1, count($m->getFields()));
- }
-
- public function testTimestamp()
- {
- $timestamp = new Timestamp();
-
- $timestamp->setSeconds(1);
- $timestamp->setNanos(2);
- $this->assertEquals(1, $timestamp->getSeconds());
- $this->assertSame(2, $timestamp->getNanos());
-
- date_default_timezone_set('UTC');
- $from = new DateTime('2011-01-01T15:03:01.012345UTC');
- $timestamp->fromDateTime($from);
- $this->assertEquals($from->format('U'), $timestamp->getSeconds());
- $this->assertSame(0, $timestamp->getNanos());
-
- $to = $timestamp->toDateTime();
- $this->assertSame(\DateTime::class, get_class($to));
- $this->assertSame($from->format('U'), $to->format('U'));
- }
-
- public function testType()
- {
- $m = new Type();
-
- $m->setName("a");
- $this->assertSame("a", $m->getName());
-
- $m->setFields([new Field()]);
- $this->assertSame(1, count($m->getFields()));
-
- $m->setOneofs(["a"]);
- $this->assertSame(1, count($m->getOneofs()));
-
- $m->setOptions([new Option()]);
- $this->assertSame(1, count($m->getOptions()));
-
- $m->setSourceContext(new SourceContext());
- $this->assertFalse(is_null($m->getSourceContext()));
-
- $m->setSyntax(Syntax::SYNTAX_PROTO2);
- $this->assertSame(Syntax::SYNTAX_PROTO2, $m->getSyntax());
- }
-
- public function testDuration()
- {
- $duration = new Duration();
-
- $duration->setSeconds(1);
- $duration->setNanos(2);
- $this->assertEquals(1, $duration->getSeconds());
- $this->assertSame(2, $duration->getNanos());
- }
-
- public function testWrappers()
- {
- $m = new DoubleValue();
- $m->setValue(1.0);
- $this->assertSame(1.0, $m->getValue());
-
- $m = new FloatValue();
- $m->setValue(1.0);
- $this->assertSame(1.0, $m->getValue());
-
- $m = new Int64Value();
- $m->setValue(1);
- $this->assertEquals(1, $m->getValue());
-
- $m = new UInt64Value();
- $m->setValue(1);
- $this->assertEquals(1, $m->getValue());
-
- $m = new Int32Value();
- $m->setValue(1);
- $this->assertSame(1, $m->getValue());
-
- $m = new UInt32Value();
- $m->setValue(1);
- $this->assertSame(1, $m->getValue());
-
- $m = new BoolValue();
- $m->setValue(true);
- $this->assertSame(true, $m->getValue());
-
- $m = new StringValue();
- $m->setValue("a");
- $this->assertSame("a", $m->getValue());
-
- $m = new BytesValue();
- $m->setValue("a");
- $this->assertSame("a", $m->getValue());
- }
-}
diff --git a/third_party/protobuf/3.6.0/protoc-artifacts/scl-enable-devtoolset.sh b/third_party/protobuf/3.6.0/protoc-artifacts/scl-enable-devtoolset.sh
deleted file mode 100644
index 8d9585eab3..0000000000
--- a/third_party/protobuf/3.6.0/protoc-artifacts/scl-enable-devtoolset.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-set -eu -o pipefail
-
-quote() {
- local arg
- for arg in "$@"; do
- printf "'"
- printf "%s" "$arg" | sed -e "s/'/'\\\\''/g"
- printf "' "
- done
-}
-
-exec scl enable devtoolset-1.1 "$(quote "$@")"
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/compiler/__init__.py b/third_party/protobuf/3.6.0/python/google/protobuf/compiler/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/third_party/protobuf/3.6.0/python/google/protobuf/compiler/__init__.py
+++ /dev/null
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/__init__.py b/third_party/protobuf/3.6.0/python/google/protobuf/internal/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/__init__.py
+++ /dev/null
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/internal/no_package.proto b/third_party/protobuf/3.6.0/python/google/protobuf/internal/no_package.proto
deleted file mode 100644
index 3546dcc3f5..0000000000
--- a/third_party/protobuf/3.6.0/python/google/protobuf/internal/no_package.proto
+++ /dev/null
@@ -1,10 +0,0 @@
-syntax = "proto2";
-
-enum NoPackageEnum {
- NO_PACKAGE_VALUE_0 = 0;
- NO_PACKAGE_VALUE_1 = 1;
-}
-
-message NoPackageMessage {
- optional NoPackageEnum no_package_enum = 1;
-}
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/thread_unsafe_shared_ptr.h b/third_party/protobuf/3.6.0/python/google/protobuf/pyext/thread_unsafe_shared_ptr.h
deleted file mode 100644
index ad804b5f63..0000000000
--- a/third_party/protobuf/3.6.0/python/google/protobuf/pyext/thread_unsafe_shared_ptr.h
+++ /dev/null
@@ -1,104 +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.
-
-// ThreadUnsafeSharedPtr<T> is the same as shared_ptr<T> without the locking
-// overhread (and thread-safety).
-#ifndef GOOGLE_PROTOBUF_PYTHON_CPP_THREAD_UNSAFE_SHARED_PTR_H__
-#define GOOGLE_PROTOBUF_PYTHON_CPP_THREAD_UNSAFE_SHARED_PTR_H__
-
-#include <algorithm>
-#include <utility>
-
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
-
-namespace google {
-namespace protobuf {
-namespace python {
-
-template <typename T>
-class ThreadUnsafeSharedPtr {
- public:
- // Takes ownership.
- explicit ThreadUnsafeSharedPtr(T* ptr)
- : ptr_(ptr), refcount_(ptr ? new RefcountT(1) : nullptr) {
- }
-
- ThreadUnsafeSharedPtr(const ThreadUnsafeSharedPtr& other)
- : ThreadUnsafeSharedPtr(nullptr) {
- *this = other;
- }
-
- ThreadUnsafeSharedPtr& operator=(const ThreadUnsafeSharedPtr& other) {
- if (other.refcount_ == refcount_) {
- return *this;
- }
- this->~ThreadUnsafeSharedPtr();
- ptr_ = other.ptr_;
- refcount_ = other.refcount_;
- if (refcount_) {
- ++*refcount_;
- }
- return *this;
- }
-
- ~ThreadUnsafeSharedPtr() {
- if (refcount_ == nullptr) {
- GOOGLE_DCHECK(ptr_ == nullptr);
- return;
- }
- if (--*refcount_ == 0) {
- delete refcount_;
- delete ptr_;
- }
- }
-
- void reset(T* ptr = nullptr) { *this = ThreadUnsafeSharedPtr(ptr); }
-
- T* get() { return ptr_; }
- const T* get() const { return ptr_; }
-
- void swap(ThreadUnsafeSharedPtr& other) {
- using std::swap;
- swap(ptr_, other.ptr_);
- swap(refcount_, other.refcount_);
- }
-
- private:
- typedef int RefcountT;
- T* ptr_;
- RefcountT* refcount_;
-};
-
-} // namespace python
-} // namespace protobuf
-
-} // namespace google
-#endif // GOOGLE_PROTOBUF_PYTHON_CPP_THREAD_UNSAFE_SHARED_PTR_H__
diff --git a/third_party/protobuf/3.6.0/python/google/protobuf/util/__init__.py b/third_party/protobuf/3.6.0/python/google/protobuf/util/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/third_party/protobuf/3.6.0/python/google/protobuf/util/__init__.py
+++ /dev/null
diff --git a/third_party/protobuf/3.6.0/ruby/tests/encode_decode_test.rb b/third_party/protobuf/3.6.0/ruby/tests/encode_decode_test.rb
deleted file mode 100644
index 2bd9b98b5a..0000000000
--- a/third_party/protobuf/3.6.0/ruby/tests/encode_decode_test.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/ruby
-
-# generated_code.rb is in the same directory as this test.
-$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
-
-require 'generated_code_pb'
-require 'test/unit'
-
-def hex2bin(s)
- s.scan(/../).map { |x| x.hex.chr }.join
-end
-
-class EncodeDecodeTest < Test::Unit::TestCase
- def test_discard_unknown
- # Test discard unknown in message.
- unknown_msg = A::B::C::TestUnknown.new(:unknown_field => 1)
- from = A::B::C::TestUnknown.encode(unknown_msg)
- m = A::B::C::TestMessage.decode(from)
- Google::Protobuf.discard_unknown(m)
- to = A::B::C::TestMessage.encode(m)
- assert_equal '', to
-
- # Test discard unknown for singular message field.
- unknown_msg = A::B::C::TestUnknown.new(
- :optional_unknown =>
- A::B::C::TestUnknown.new(:unknown_field => 1))
- from = A::B::C::TestUnknown.encode(unknown_msg)
- m = A::B::C::TestMessage.decode(from)
- Google::Protobuf.discard_unknown(m)
- to = A::B::C::TestMessage.encode(m.optional_msg)
- assert_equal '', to
-
- # Test discard unknown for repeated message field.
- unknown_msg = A::B::C::TestUnknown.new(
- :repeated_unknown =>
- [A::B::C::TestUnknown.new(:unknown_field => 1)])
- from = A::B::C::TestUnknown.encode(unknown_msg)
- m = A::B::C::TestMessage.decode(from)
- Google::Protobuf.discard_unknown(m)
- to = A::B::C::TestMessage.encode(m.repeated_msg[0])
- assert_equal '', to
-
- # Test discard unknown for map value message field.
- unknown_msg = A::B::C::TestUnknown.new(
- :map_unknown =>
- {"" => A::B::C::TestUnknown.new(:unknown_field => 1)})
- from = A::B::C::TestUnknown.encode(unknown_msg)
- m = A::B::C::TestMessage.decode(from)
- Google::Protobuf.discard_unknown(m)
- to = A::B::C::TestMessage.encode(m.map_string_msg[''])
- assert_equal '', to
-
- # Test discard unknown for oneof message field.
- unknown_msg = A::B::C::TestUnknown.new(
- :oneof_unknown =>
- A::B::C::TestUnknown.new(:unknown_field => 1))
- from = A::B::C::TestUnknown.encode(unknown_msg)
- m = A::B::C::TestMessage.decode(from)
- Google::Protobuf.discard_unknown(m)
- to = A::B::C::TestMessage.encode(m.oneof_msg)
- assert_equal '', to
- end
-
- def test_encode_json
- msg = A::B::C::TestMessage.new({ optional_int32: 22 })
- json = msg.to_json
-
- to = A::B::C::TestMessage.decode_json(json)
- assert_equal to.optional_int32, 22
-
- msg = A::B::C::TestMessage.new({ optional_int32: 22 })
- json = msg.to_json({ preserve_proto_fieldnames: true })
-
- assert_match 'optional_int32', json
-
- to = A::B::C::TestMessage.decode_json(json)
- assert_equal 22, to.optional_int32
-
- msg = A::B::C::TestMessage.new({ optional_int32: 22 })
- json = A::B::C::TestMessage.encode_json(
- msg,
- { preserve_proto_fieldnames: true, emit_defaults: true }
- )
-
- assert_match 'optional_int32', json
- end
-end
diff --git a/third_party/protobuf/3.6.0/ruby/tests/gc_test.rb b/third_party/protobuf/3.6.0/ruby/tests/gc_test.rb
deleted file mode 100644
index f3470ccaa5..0000000000
--- a/third_party/protobuf/3.6.0/ruby/tests/gc_test.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/ruby
-#
-# generated_code.rb is in the same directory as this test.
-$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
-
-old_gc = GC.stress
-GC.stress = 0x01 | 0x04
-require 'generated_code_pb'
-GC.stress = old_gc
-
-require 'test/unit'
-
-class GCTest < Test::Unit::TestCase
- def get_msg
- A::B::C::TestMessage.new(
- :optional_int32 => 1,
- :optional_int64 => 1,
- :optional_uint32 => 1,
- :optional_uint64 => 1,
- :optional_bool => true,
- :optional_double => 1.0,
- :optional_float => 1.0,
- :optional_string => "a",
- :optional_bytes => "b",
- :optional_enum => A::B::C::TestEnum::A,
- :optional_msg => A::B::C::TestMessage.new(),
- :repeated_int32 => [1],
- :repeated_int64 => [1],
- :repeated_uint32 => [1],
- :repeated_uint64 => [1],
- :repeated_bool => [true],
- :repeated_double => [1.0],
- :repeated_float => [1.0],
- :repeated_string => ["a"],
- :repeated_bytes => ["b"],
- :repeated_enum => [A::B::C::TestEnum::A],
- :repeated_msg => [A::B::C::TestMessage.new()],
- :map_int32_string => {1 => "a"},
- :map_int64_string => {1 => "a"},
- :map_uint32_string => {1 => "a"},
- :map_uint64_string => {1 => "a"},
- :map_bool_string => {true => "a"},
- :map_string_string => {"a" => "a"},
- :map_string_msg => {"a" => A::B::C::TestMessage.new()},
- :map_string_int32 => {"a" => 1},
- :map_string_bool => {"a" => true},
- )
- end
- def test_generated_msg
- old_gc = GC.stress
- GC.stress = 0x01 | 0x04
- from = get_msg
- data = A::B::C::TestMessage.encode(from)
- to = A::B::C::TestMessage.decode(data)
- GC.stress = old_gc
- puts "passed"
- end
-end
diff --git a/third_party/protobuf/3.6.0/ruby/tests/test_ruby_package.proto b/third_party/protobuf/3.6.0/ruby/tests/test_ruby_package.proto
deleted file mode 100644
index b872562028..0000000000
--- a/third_party/protobuf/3.6.0/ruby/tests/test_ruby_package.proto
+++ /dev/null
@@ -1,7 +0,0 @@
-syntax = "proto3";
-
-package foo_bar;
-
-option ruby_package = "A.B";
-
-message TestRubyPackageMessage {}
diff --git a/third_party/protobuf/3.6.0/src/README.md b/third_party/protobuf/3.6.0/src/README.md
deleted file mode 100644
index 3cbeb3e669..0000000000
--- a/third_party/protobuf/3.6.0/src/README.md
+++ /dev/null
@@ -1,228 +0,0 @@
-Protocol Buffers - Google's data interchange format
-===================================================
-
-[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf) [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf)
-
-Copyright 2008 Google Inc.
-
-https://developers.google.com/protocol-buffers/
-
-C++ Installation - Unix
------------------------
-
-To build protobuf from source, the following tools are needed:
-
- * autoconf
- * automake
- * libtool
- * make
- * g++
- * unzip
-
-On Ubuntu/Debian, you can install them with:
-
- $ sudo apt-get install autoconf automake libtool curl make g++ unzip
-
-On other platforms, please use the corresponding package managing tool to
-install them before proceeding.
-
-To get the source, download one of the release .tar.gz or .zip packages in the
-release page:
-
- https://github.com/google/protobuf/releases/latest
-
-For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if
-you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package
-contains C++ source already); if you need C++ and multiple other languages,
-download `protobuf-all-[VERSION].tar.gz`.
-
-You can also get the source by "git clone" our git repository. Make sure you
-have also cloned the submodules and generated the configure script (skip this
-if you are using a release .tar.gz or .zip package):
-
- $ git clone https://github.com/google/protobuf.git
- $ cd protobuf
- $ git submodule update --init --recursive
- $ ./autogen.sh
-
-To build and install the C++ Protocol Buffer runtime and the Protocol
-Buffer compiler (protoc) execute the following:
-
- $ ./configure
- $ make
- $ make check
- $ sudo make install
- $ sudo ldconfig # refresh shared library cache.
-
-If "make check" fails, you can still install, but it is likely that
-some features of this library will not work correctly on your system.
-Proceed at your own risk.
-
-For advanced usage information on configure and make, please refer to the
-autoconf documentation:
-
- http://www.gnu.org/software/autoconf/manual/autoconf.html#Running-configure-Scripts
-
-**Hint on install location**
-
-By default, the package will be installed to /usr/local. However,
-on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH.
-You can add it, but it may be easier to just install to /usr
-instead. To do this, invoke configure as follows:
-
- ./configure --prefix=/usr
-
-If you already built the package with a different prefix, make sure
-to run "make clean" before building again.
-
-**Compiling dependent packages**
-
-To compile a package that uses Protocol Buffers, you need to pass
-various flags to your compiler and linker. As of version 2.2.0,
-Protocol Buffers integrates with pkg-config to manage this. If you
-have pkg-config installed, then you can invoke it to get a list of
-flags like so:
-
- pkg-config --cflags protobuf # print compiler flags
- pkg-config --libs protobuf # print linker flags
- pkg-config --cflags --libs protobuf # print both
-
-For example:
-
- c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf`
-
-Note that packages written prior to the 2.2.0 release of Protocol
-Buffers may not yet integrate with pkg-config to get flags, and may
-not pass the correct set of flags to correctly link against
-libprotobuf. If the package in question uses autoconf, you can
-often fix the problem by invoking its configure script like:
-
- configure CXXFLAGS="$(pkg-config --cflags protobuf)" \
- LIBS="$(pkg-config --libs protobuf)"
-
-This will force it to use the correct flags.
-
-If you are writing an autoconf-based package that uses Protocol
-Buffers, you should probably use the PKG_CHECK_MODULES macro in your
-configure script like:
-
- PKG_CHECK_MODULES([protobuf], [protobuf])
-
-See the pkg-config man page for more info.
-
-If you only want protobuf-lite, substitute "protobuf-lite" in place
-of "protobuf" in these examples.
-
-**Note for Mac users**
-
-For a Mac system, Unix tools are not available by default. You will first need
-to install Xcode from the Mac AppStore and then run the following command from
-a terminal:
-
- $ sudo xcode-select --install
-
-To install Unix tools, you can install "port" following the instructions at
-https://www.macports.org . This will reside in /opt/local/bin/port for most
-Mac installations.
-
- $ sudo /opt/local/bin/port install autoconf automake libtool
-
-Then follow the Unix instructions above.
-
-**Note for cross-compiling**
-
-The makefiles normally invoke the protoc executable that they just
-built in order to build tests. When cross-compiling, the protoc
-executable may not be executable on the host machine. In this case,
-you must build a copy of protoc for the host machine first, then use
-the --with-protoc option to tell configure to use it instead. For
-example:
-
- ./configure --with-protoc=protoc
-
-This will use the installed protoc (found in your $PATH) instead of
-trying to execute the one built during the build process. You can
-also use an executable that hasn't been installed. For example, if
-you built the protobuf package for your host machine in ../host,
-you might do:
-
- ./configure --with-protoc=../host/src/protoc
-
-Either way, you must make sure that the protoc executable you use
-has the same version as the protobuf source code you are trying to
-use it with.
-
-**Note for Solaris users**
-
-Solaris 10 x86 has a bug that will make linking fail, complaining
-about libstdc++.la being invalid. We have included a work-around
-in this package. To use the work-around, run configure as follows:
-
- ./configure LDFLAGS=-L$PWD/src/solaris
-
-See src/solaris/libstdc++.la for more info on this bug.
-
-**Note for HP C++ Tru64 users**
-
-To compile invoke configure as follows:
-
- ./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM"
-
-Also, you will need to use gmake instead of make.
-
-**Note for AIX users**
-
-Compile using the IBM xlC C++ compiler as follows:
-
- ./configure CXX=xlC
-
-Also, you will need to use GNU `make` (`gmake`) instead of AIX `make`.
-
-C++ Installation - Windows
---------------------------
-
-If you only need the protoc binary, you can download it from the release
-page:
-
- https://github.com/google/protobuf/releases/latest
-
-In the downloads section, download the zip file protoc-$VERSION-win32.zip.
-It contains the protoc binary as well as public proto files of protobuf
-library.
-
-Protobuf and its dependencies can be installed directly by using `vcpkg`:
-
- >vcpkg install protobuf protobuf:x64-windows
-
-If zlib support is desired, you'll also need to install the zlib feature:
-
- >vcpkg install protobuf[zlib] protobuf[zlib]:x64-windows
-
-See https://github.com/Microsoft/vcpkg for more information.
-
-To build from source using Microsoft Visual C++, see [cmake/README.md](../cmake/README.md).
-
-To build from source using Cygwin or MinGW, follow the Unix installation
-instructions, above.
-
-Binary Compatibility Warning
-----------------------------
-
-Due to the nature of C++, it is unlikely that any two versions of the
-Protocol Buffers C++ runtime libraries will have compatible ABIs.
-That is, if you linked an executable against an older version of
-libprotobuf, it is unlikely to work with a newer version without
-re-compiling. This problem, when it occurs, will normally be detected
-immediately on startup of your app. Still, you may want to consider
-using static linkage. You can configure this package to install
-static libraries only using:
-
- ./configure --disable-shared
-
-Usage
------
-
-The complete documentation for Protocol Buffers is available via the
-web at:
-
- https://developers.google.com/protocol-buffers/
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/arena.cc b/third_party/protobuf/3.6.0/src/google/protobuf/arena.cc
deleted file mode 100644
index c117c9e528..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/arena.cc
+++ /dev/null
@@ -1,415 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <google/protobuf/arena.h>
-
-#include <algorithm>
-#include <limits>
-
-
-#ifdef ADDRESS_SANITIZER
-#include <sanitizer/asan_interface.h>
-#endif // ADDRESS_SANITIZER
-
-#include <google/protobuf/stubs/port.h>
-
-namespace google {
-static const size_t kMinCleanupListElements = 8;
-static const size_t kMaxCleanupListElements = 64; // 1kB on 64-bit.
-
-namespace protobuf {
-namespace internal {
-
-
-std::atomic<int64> ArenaImpl::lifecycle_id_generator_;
-#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
-ArenaImpl::ThreadCache& ArenaImpl::thread_cache() {
- static internal::ThreadLocalStorage<ThreadCache>* thread_cache_ =
- new internal::ThreadLocalStorage<ThreadCache>();
- return *thread_cache_->Get();
-}
-#elif defined(PROTOBUF_USE_DLLS)
-ArenaImpl::ThreadCache& ArenaImpl::thread_cache() {
- static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_ = { -1, NULL };
- return thread_cache_;
-}
-#else
-GOOGLE_THREAD_LOCAL ArenaImpl::ThreadCache ArenaImpl::thread_cache_ = {-1, NULL};
-#endif
-
-void ArenaImpl::Init() {
- lifecycle_id_ =
- lifecycle_id_generator_.fetch_add(1, std::memory_order_relaxed);
- hint_.store(nullptr, std::memory_order_relaxed);
- threads_.store(nullptr, std::memory_order_relaxed);
-
- if (initial_block_) {
- // 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.
- new (initial_block_) Block(options_.initial_block_size, NULL);
- SerialArena* serial =
- SerialArena::New(initial_block_, &thread_cache(), this);
- serial->set_next(NULL);
- threads_.store(serial, std::memory_order_relaxed);
- space_allocated_.store(options_.initial_block_size,
- std::memory_order_relaxed);
- CacheSerialArena(serial);
- } else {
- space_allocated_.store(0, std::memory_order_relaxed);
- }
-}
-
-ArenaImpl::~ArenaImpl() {
- // Have to do this in a first pass, because some of the destructors might
- // refer to memory in other blocks.
- CleanupList();
- FreeBlocks();
-}
-
-uint64 ArenaImpl::Reset() {
- // Have to do this in a first pass, because some of the destructors might
- // refer to memory in other blocks.
- CleanupList();
- uint64 space_allocated = FreeBlocks();
- Init();
-
- return space_allocated;
-}
-
-ArenaImpl::Block* ArenaImpl::NewBlock(Block* last_block, size_t min_bytes) {
- size_t size;
- if (last_block) {
- // Double the current block size, up to a limit.
- size = std::min(2 * last_block->size(), options_.max_block_size);
- } else {
- size = options_.start_block_size;
- }
- // 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);
-
- void* mem = options_.block_alloc(size);
- Block* b = new (mem) Block(size, last_block);
- space_allocated_.fetch_add(size, std::memory_order_relaxed);
- return b;
-}
-
-ArenaImpl::Block::Block(size_t size, Block* next)
- : next_(next), pos_(kBlockHeaderSize), size_(size) {}
-
-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));
- CleanupChunk* list = reinterpret_cast<CleanupChunk*>(AllocateAligned(bytes));
- list->next = cleanup_;
- list->size = size;
-
- cleanup_ = list;
- cleanup_ptr_ = &list->nodes[0];
- cleanup_limit_ = &list->nodes[size];
-
- AddCleanup(elem, cleanup);
-}
-
-GOOGLE_PROTOBUF_ATTRIBUTE_FUNC_ALIGN(32)
-void* ArenaImpl::AllocateAligned(size_t n) {
- SerialArena* arena;
- if (GOOGLE_PREDICT_TRUE(GetSerialArenaFast(&arena))) {
- return arena->AllocateAligned(n);
- } else {
- return AllocateAlignedFallback(n);
- }
-}
-
-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*)) {
- SerialArena* arena;
- if (GOOGLE_PREDICT_TRUE(GetSerialArenaFast(&arena))) {
- arena->AddCleanup(elem, cleanup);
- } else {
- return AddCleanupFallback(elem, cleanup);
- }
-}
-
-GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
-void* ArenaImpl::AllocateAlignedFallback(size_t n) {
- return GetSerialArena()->AllocateAligned(n);
-}
-
-GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
-void* ArenaImpl::AllocateAlignedAndAddCleanupFallback(size_t n,
- void (*cleanup)(void*)) {
- return GetSerialArena()->AllocateAlignedAndAddCleanup(n, cleanup);
-}
-
-GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
-void ArenaImpl::AddCleanupFallback(void* elem, void (*cleanup)(void*)) {
- GetSerialArena()->AddCleanup(elem, cleanup);
-}
-
-inline GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
-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 (GOOGLE_PREDICT_TRUE(tc->last_lifecycle_id_seen == lifecycle_id_)) {
- *arena = tc->last_serial_arena;
- return true;
- }
-
- // Check whether we own the last accessed SerialArena on this arena. This
- // fast path optimizes the case where a single thread uses multiple arenas.
- SerialArena* serial = hint_.load(std::memory_order_acquire);
- if (GOOGLE_PREDICT_TRUE(serial != NULL && serial->owner() == tc)) {
- *arena = serial;
- return true;
- }
-
- return false;
-}
-
-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_POISON_MEMORY_REGION(ptr_, limit_ - ptr_);
-#endif // ADDRESS_SANITIZER
-
- return AllocateAligned(n);
-}
-
-uint64 ArenaImpl::SpaceAllocated() const {
- return space_allocated_.load(std::memory_order_relaxed);
-}
-
-uint64 ArenaImpl::SpaceUsed() const {
- SerialArena* serial = threads_.load(std::memory_order_acquire);
- uint64 space_used = 0;
- 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;
-}
-
-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.
- SerialArena* serial = threads_.load(std::memory_order_relaxed);
-
- 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;
- }
-
- 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.
- 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(b->Pointer(0), b->size());
-#endif // ADDRESS_SANITIZER
-
- if (b != initial_block) {
- block_dealloc(b, b->size());
- }
-
- b = next_block;
- }
-
- return space_allocated;
-}
-
-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.
- SerialArena* serial = threads_.load(std::memory_order_relaxed);
-
- for ( ; serial; serial = serial->next()) {
- serial->CleanupList();
- }
-}
-
-void ArenaImpl::SerialArena::CleanupList() {
- if (cleanup_ != NULL) {
- CleanupListFallback();
- }
-}
-
-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;
- }
-}
-
-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;
-}
-
-GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
-ArenaImpl::SerialArena* ArenaImpl::GetSerialArenaFallback(void* me) {
- // Look for this SerialArena in our linked list.
- SerialArena* serial = threads_.load(std::memory_order_acquire);
- for ( ; serial; serial = serial->next()) {
- if (serial->owner() == me) {
- break;
- }
- }
-
- 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);
-
- SerialArena* head = threads_.load(std::memory_order_relaxed);
- do {
- serial->set_next(head);
- } while (!threads_.compare_exchange_weak(
- head, serial, std::memory_order_release, std::memory_order_relaxed));
- }
-
- CacheSerialArena(serial);
- return serial;
-}
-
-} // namespace internal
-
-void Arena::CallDestructorHooks() {
- uint64 space_allocated = impl_.SpaceAllocated();
- // Call the reset hook
- if (on_arena_reset_ != NULL) {
- on_arena_reset_(this, hooks_cookie_, space_allocated);
- }
-
- // Call the destruction hook
- if (on_arena_destruction_ != NULL) {
- on_arena_destruction_(this, hooks_cookie_, space_allocated);
- }
-}
-
-void Arena::OnArenaAllocation(const std::type_info* allocated_type,
- size_t n) const {
- if (on_arena_allocation_ != NULL) {
- on_arena_allocation_(allocated_type, n, hooks_cookie_);
- }
-}
-
-} // namespace protobuf
-} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/annotation_test_util.cc b/third_party/protobuf/3.6.0/src/google/protobuf/compiler/annotation_test_util.cc
deleted file mode 100644
index a0530b9a69..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/annotation_test_util.cc
+++ /dev/null
@@ -1,166 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <google/protobuf/compiler/annotation_test_util.h>
-
-#include <memory>
-#include <google/protobuf/compiler/code_generator.h>
-#include <google/protobuf/compiler/command_line_interface.h>
-#include <google/protobuf/io/printer.h>
-#include <google/protobuf/io/zero_copy_stream.h>
-#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
-#include <google/protobuf/descriptor.pb.h>
-
-#include <google/protobuf/testing/file.h>
-#include <google/protobuf/testing/file.h>
-#include <google/protobuf/testing/googletest.h>
-#include <gtest/gtest.h>
-
-namespace google {
-namespace protobuf {
-namespace compiler {
-namespace annotation_test_util {
-namespace {
-
-// A CodeGenerator that captures the FileDescriptor it's passed as a
-// FileDescriptorProto.
-class DescriptorCapturingGenerator : public CodeGenerator {
- public:
- // Does not own file; file must outlive the Generator.
- explicit DescriptorCapturingGenerator(FileDescriptorProto* file)
- : file_(file) {}
-
- virtual bool Generate(const FileDescriptor* file, const string& parameter,
- GeneratorContext* context, string* error) const {
- file->CopyTo(file_);
- return true;
- }
-
- private:
- FileDescriptorProto* file_;
-};
-} // namespace
-
-void AddFile(const string& filename, const string& data) {
- GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data,
- true));
-}
-
-bool RunProtoCompiler(const string& filename,
- const string& plugin_specific_args,
- CommandLineInterface* cli, FileDescriptorProto* file) {
- cli->SetInputsAreProtoPathRelative(true);
-
- DescriptorCapturingGenerator capturing_generator(file);
- cli->RegisterGenerator("--capture_out", &capturing_generator, "");
-
- string proto_path = "-I" + TestTempDir();
- string capture_out = "--capture_out=" + TestTempDir();
-
- const char* argv[] = {"protoc", proto_path.c_str(),
- plugin_specific_args.c_str(), capture_out.c_str(),
- filename.c_str()};
-
- return cli->Run(5, argv) == 0;
-}
-
-bool DecodeMetadata(const string& path, GeneratedCodeInfo* info) {
- string data;
- GOOGLE_CHECK_OK(File::GetContents(path, &data, true));
- io::ArrayInputStream input(data.data(), data.size());
- return info->ParseFromZeroCopyStream(&input);
-}
-
-void FindAnnotationsOnPath(
- const GeneratedCodeInfo& info, const string& source_file,
- const std::vector<int>& path,
- std::vector<const GeneratedCodeInfo::Annotation*>* annotations) {
- for (int i = 0; i < info.annotation_size(); ++i) {
- const GeneratedCodeInfo::Annotation* annotation = &info.annotation(i);
- if (annotation->source_file() != source_file ||
- annotation->path_size() != path.size()) {
- continue;
- }
- int node = 0;
- for (; node < path.size(); ++node) {
- if (annotation->path(node) != path[node]) {
- break;
- }
- }
- if (node == path.size()) {
- annotations->push_back(annotation);
- }
- }
-}
-
-const GeneratedCodeInfo::Annotation* FindAnnotationOnPath(
- const GeneratedCodeInfo& info, const string& source_file,
- const std::vector<int>& path) {
- std::vector<const GeneratedCodeInfo::Annotation*> annotations;
- FindAnnotationsOnPath(info, source_file, path, &annotations);
- if (annotations.empty()) {
- return NULL;
- }
- return annotations[0];
-}
-
-bool AtLeastOneAnnotationMatchesSubstring(
- const string& file_content,
- const std::vector<const GeneratedCodeInfo::Annotation*>& annotations,
- const string& expected_text) {
- for (std::vector<const GeneratedCodeInfo::Annotation*>::const_iterator
- i = annotations.begin(),
- e = annotations.end();
- i != e; ++i) {
- const GeneratedCodeInfo::Annotation* annotation = *i;
- uint32 begin = annotation->begin();
- uint32 end = annotation->end();
- if (end < begin || end > file_content.size()) {
- return false;
- }
- if (file_content.substr(begin, end - begin) == expected_text) {
- return true;
- }
- }
- return false;
-}
-
-bool AnnotationMatchesSubstring(const string& file_content,
- const GeneratedCodeInfo::Annotation* annotation,
- const string& expected_text) {
- std::vector<const GeneratedCodeInfo::Annotation*> annotations;
- annotations.push_back(annotation);
- return AtLeastOneAnnotationMatchesSubstring(file_content, annotations,
- expected_text);
-}
-} // namespace annotation_test_util
-} // namespace compiler
-} // namespace protobuf
-} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/annotation_test_util.h b/third_party/protobuf/3.6.0/src/google/protobuf/compiler/annotation_test_util.h
deleted file mode 100644
index 90bd88b372..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/annotation_test_util.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_PROTOBUF_COMPILER_ANNOTATION_TEST_UTIL_H__
-#define GOOGLE_PROTOBUF_COMPILER_ANNOTATION_TEST_UTIL_H__
-
-#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/testing/googletest.h>
-#include <gtest/gtest.h>
-
-// Utilities that assist in writing tests for generator annotations.
-// See java/internal/annotation_unittest.cc for an example.
-namespace google {
-namespace protobuf {
-namespace compiler {
-namespace annotation_test_util {
-
-// Struct that contains the file generated from a .proto file and its
-// GeneratedCodeInfo. For example, the Java generator will fill this struct
-// (for some 'foo.proto') with:
-// file_path = "Foo.java"
-// file_content = content of Foo.java
-// file_info = parsed content of Foo.java.pb.meta
-struct ExpectedOutput {
- string file_path;
- string file_content;
- GeneratedCodeInfo file_info;
- explicit ExpectedOutput(const string& file_path) : file_path(file_path) {}
-};
-
-// Creates a file with name `filename` and content `data` in temp test
-// directory.
-void AddFile(const string& filename, const string& data);
-
-// 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"
-// 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.
-bool RunProtoCompiler(const string& filename,
- const string& plugin_specific_args,
- CommandLineInterface* cli, FileDescriptorProto* file);
-
-bool DecodeMetadata(const string& path, GeneratedCodeInfo* info);
-
-// Finds all of the Annotations for a given source file and path.
-// See Location.path in http://google/protobuf/descriptor.proto for
-// explanation of what path vector is.
-void FindAnnotationsOnPath(
- const GeneratedCodeInfo& info, const string& source_file,
- const std::vector<int>& path,
- std::vector<const GeneratedCodeInfo::Annotation*>* annotations);
-
-// Finds the Annotation for a given source file and path (or returns null if it
-// couldn't). If there are several annotations for given path, returns the first
-// one. See Location.path in
-// http://google/protobuf/descriptor.proto for explanation of what path
-// vector is.
-const GeneratedCodeInfo::Annotation* FindAnnotationOnPath(
- const GeneratedCodeInfo& info, const string& source_file,
- const std::vector<int>& path);
-
-// Returns true if at least one of the provided annotations covers a given
-// substring in file_content.
-bool AtLeastOneAnnotationMatchesSubstring(
- const string& file_content,
- const std::vector<const GeneratedCodeInfo::Annotation*>& annotations,
- const string& expected_text);
-
-// Returns true if the provided annotation covers a given substring in
-// file_content.
-bool AnnotationMatchesSubstring(const string& file_content,
- const GeneratedCodeInfo::Annotation* annotation,
- const string& expected_text);
-
-} // namespace annotation_test_util
-} // namespace compiler
-} // namespace protobuf
-
-} // namespace google
-#endif // GOOGLE_PROTOBUF_COMPILER_ANNOTATION_TEST_UTIL_H__
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_field.cc
deleted file mode 100644
index c1e15c5232..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_message_field.cc
+++ /dev/null
@@ -1,836 +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.
-
-#include <google/protobuf/compiler/cpp/cpp_message_field.h>
-#include <google/protobuf/compiler/cpp/cpp_helpers.h>
-#include <google/protobuf/io/printer.h>
-
-#include <google/protobuf/stubs/strutil.h>
-
-namespace google {
-namespace protobuf {
-namespace compiler {
-namespace cpp {
-
-namespace {
-
-// When we are generating code for implicit weak fields, we need to insert some
-// additional casts. These functions return the casted expression if
-// implicit_weak_field is true but otherwise return the original expression.
-// Ordinarily a static_cast is enough to cast google::protobuf::MessageLite* to a class
-// deriving from it, but we need a reinterpret_cast in cases where the generated
-// message is forward-declared but its full definition is not visible.
-string StaticCast(const string& type, const string& expression,
- bool implicit_weak_field) {
- if (implicit_weak_field) {
- return "static_cast< " + type + " >(" + expression + ")";
- } else {
- return expression;
- }
-}
-
-string ReinterpretCast(const string& type, const string& expression,
- bool implicit_weak_field) {
- if (implicit_weak_field) {
- return "reinterpret_cast< " + type + " >(" + expression + ")";
- } else {
- return expression;
- }
-}
-
-void SetMessageVariables(const FieldDescriptor* descriptor,
- const Options& options, bool implicit_weak,
- std::map<string, string>* variables) {
- SetCommonFieldVariables(descriptor, variables, options);
- (*variables)["type"] = FieldMessageTypeName(descriptor);
- (*variables)["casted_member"] = ReinterpretCast(
- (*variables)["type"] + "*", (*variables)["name"] + "_", implicit_weak);
- (*variables)["type_default_instance"] =
- DefaultInstanceName(descriptor->message_type());
- (*variables)["type_reference_function"] =
- implicit_weak
- ? (" " + ReferenceFunctionName(descriptor->message_type()) + "();\n")
- : "";
- (*variables)["stream_writer"] =
- (*variables)["declared_type"] +
- (HasFastArraySerialization(descriptor->message_type()->file(), options)
- ? "MaybeToArray"
- : "");
- // NOTE: Escaped here to unblock proto1->proto2 migration.
- // TODO(liujisi): Extend this to apply for other conflicting methods.
- (*variables)["release_name"] =
- SafeFunctionName(descriptor->containing_type(),
- descriptor, "release_");
- (*variables)["full_name"] = descriptor->full_name();
-}
-
-} // namespace
-
-// ===================================================================
-
-MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor,
- const Options& options,
- SCCAnalyzer* scc_analyzer)
- : FieldGenerator(options),
- descriptor_(descriptor),
- implicit_weak_field_(
- IsImplicitWeakField(descriptor, options, scc_analyzer)) {
- SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_);
-}
-
-MessageFieldGenerator::~MessageFieldGenerator() {}
-
-void MessageFieldGenerator::
-GeneratePrivateMembers(io::Printer* printer) const {
- if (implicit_weak_field_) {
- printer->Print(variables_, "::google::protobuf::MessageLite* $name$_;\n");
- } else {
- printer->Print(variables_, "$type$* $name$_;\n");
- }
-}
-
-void MessageFieldGenerator::
-GenerateAccessorDeclarations(io::Printer* printer) const {
- if (implicit_weak_field_) {
- // These private accessors are used by MergeFrom and
- // MergePartialFromCodedStream, and their purpose is to provide access to
- // the field without creating a strong dependency on the message type.
- printer->Print(variables_,
- "private:\n"
- "const ::google::protobuf::MessageLite& _internal_$name$() const;\n"
- "::google::protobuf::MessageLite* _internal_mutable_$name$();\n"
- "public:\n");
- } else {
- // This inline accessor directly returns member field and is used in
- // Serialize such that AFDO profile correctly captures access information to
- // message fields under serialize.
- printer->Print(variables_,
- "private:\n"
- "const $type$& _internal_$name$() const;\n"
- "public:\n");
- }
- printer->Print(variables_,
- "$deprecated_attr$const $type$& $name$() const;\n");
- printer->Annotate("name", descriptor_);
- printer->Print(variables_, "$deprecated_attr$$type$* $release_name$();\n");
- printer->Annotate("release_name", 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");
- printer->Annotate("{", "}", descriptor_);
- if (SupportsArenas(descriptor_)) {
- printer->Print(variables_,
- "$deprecated_attr$void "
- "${$unsafe_arena_set_allocated_$name$$}$(\n"
- " $type$* $name$);\n");
- printer->Annotate("{", "}", descriptor_);
- printer->Print(
- variables_,
- "$deprecated_attr$$type$* ${$unsafe_arena_release_$name$$}$();\n");
- printer->Annotate("{", "}", descriptor_);
- }
-}
-
-void MessageFieldGenerator::GenerateNonInlineAccessorDefinitions(
- io::Printer* printer) const {
- if (implicit_weak_field_) {
- printer->Print(variables_,
- "const ::google::protobuf::MessageLite& $classname$::_internal_$name$() const {\n"
- " if ($name$_ != NULL) {\n"
- " return *$name$_;\n"
- " } else if (&$type_default_instance$ != NULL) {\n"
- " return *reinterpret_cast<const ::google::protobuf::MessageLite*>(\n"
- " &$type_default_instance$);\n"
- " } else {\n"
- " return "
- "*::google::protobuf::internal::ImplicitWeakMessage::default_instance();\n"
- " }\n"
- "}\n");
- }
- if (SupportsArenas(descriptor_)) {
- if (implicit_weak_field_) {
- printer->Print(variables_,
- "::google::protobuf::MessageLite* $classname$::_internal_mutable_$name$() {\n"
- " $set_hasbit$\n"
- " if ($name$_ == NULL) {\n"
- " if (&$type_default_instance$ == NULL) {\n"
- " $name$_ = ::google::protobuf::Arena::CreateMessage<\n"
- " ::google::protobuf::internal::ImplicitWeakMessage>(\n"
- " GetArenaNoVirtual());\n"
- " } else {\n"
- " $name$_ = reinterpret_cast<const ::google::protobuf::MessageLite*>(\n"
- " &$type_default_instance$)->New(GetArenaNoVirtual());\n"
- " }\n"
- " }\n"
- " return $name$_;\n"
- "}\n");
- }
-
- printer->Print(variables_,
- "void $classname$::unsafe_arena_set_allocated_$name$(\n"
- " $type$* $name$) {\n"
- // If we're not on an arena, free whatever we were holding before.
- // (If we are on arena, we can just forget the earlier pointer.)
- " if (GetArenaNoVirtual() == NULL) {\n"
- " delete $name$_;\n"
- " }\n"
- " $name$_ = $name$;\n"
- " if ($name$) {\n"
- " $set_hasbit$\n"
- " } else {\n"
- " $clear_hasbit$\n"
- " }\n"
- " // @@protoc_insertion_point(field_unsafe_arena_set_allocated"
- ":$full_name$)\n"
- "}\n");
- } else if (implicit_weak_field_) {
- printer->Print(variables_,
- "::google::protobuf::MessageLite* $classname$::_internal_mutable_$name$() {\n"
- " $set_hasbit$\n"
- " if ($name$_ == NULL) {\n"
- " if (&$type_default_instance$ == NULL) {\n"
- " $name$_ = new ::google::protobuf::internal::ImplicitWeakMessage;\n"
- " } else {\n"
- " $name$_ = reinterpret_cast<const ::google::protobuf::MessageLite*>(\n"
- " &$type_default_instance$)->New();\n"
- " }\n"
- " }\n"
- " return $name$_;\n"
- "}\n");
- }
-}
-
-void MessageFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- if (!implicit_weak_field_) {
- printer->Print(variables_,
- "inline const $type$& $classname$::_internal_$name$() const {\n"
- " return *$field_member$;\n"
- "}\n");
- }
- printer->Print(variables_,
- "inline const $type$& $classname$::$name$() const {\n"
- " 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_,
- "inline $type$* $classname$::$release_name$() {\n"
- " // @@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_,
- " if (GetArenaNoVirtual() != NULL) {\n"
- " temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);\n"
- " }\n");
- }
- printer->Print(variables_,
- " $name$_ = NULL;\n"
- " return temp;\n"
- "}\n");
-
- if (SupportsArenas(descriptor_)) {
- printer->Print(variables_,
- "inline $type$* $classname$::unsafe_arena_release_$name$() {\n"
- " // @@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
- "$type_reference_function$"
- " $clear_hasbit$\n"
- " $type$* temp = $casted_member$;\n"
- " $name$_ = NULL;\n"
- " return temp;\n"
- "}\n");
- }
-
- printer->Print(variables_,
- "inline $type$* $classname$::mutable_$name$() {\n"
- " $set_hasbit$\n"
- " if ($name$_ == NULL) {\n"
- " auto* p = CreateMaybeMessage<$type$>(GetArenaNoVirtual());\n");
- if (implicit_weak_field_) {
- printer->Print(variables_,
- " $name$_ = reinterpret_cast<::google::protobuf::MessageLite*>(p);\n");
- } else {
- printer->Print(variables_,
- " $name$_ = p;\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_,
- "inline void $classname$::set_allocated_$name$($type$* $name$) {\n"
- " ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();\n");
- printer->Print(variables_,
- " if (message_arena == NULL) {\n");
- if (IsCrossFileMessage(descriptor_)) {
- printer->Print(variables_,
- " delete reinterpret_cast< ::google::protobuf::MessageLite*>($name$_);\n");
- } else {
- printer->Print(variables_,
- " delete $name$_;\n");
- }
- 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_,
- " ::google::protobuf::Arena* submessage_arena =\n"
- " reinterpret_cast<::google::protobuf::MessageLite*>($name$)->GetArena();\n");
- } else if (!SupportsArenas(descriptor_->message_type())) {
- printer->Print(variables_,
- " ::google::protobuf::Arena* submessage_arena = NULL;\n");
- } else {
- printer->Print(variables_,
- " ::google::protobuf::Arena* submessage_arena =\n"
- " ::google::protobuf::Arena::GetArena($name$);\n");
- }
- printer->Print(variables_,
- " if (message_arena != submessage_arena) {\n"
- " $name$ = ::google::protobuf::internal::GetOwnedMessage(\n"
- " message_arena, $name$, submessage_arena);\n"
- " }\n"
- " $set_hasbit$\n"
- " } else {\n"
- " $clear_hasbit$\n"
- " }\n");
- if (implicit_weak_field_) {
- printer->Print(variables_,
- " $name$_ = reinterpret_cast<MessageLite*>($name$);\n");
- } else {
- printer->Print(variables_,
- " $name$_ = $name$;\n");
- }
- printer->Print(variables_,
- " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
- "}\n");
-}
-
-void MessageFieldGenerator::
-GenerateClearingCode(io::Printer* printer) const {
- if (!HasFieldPresence(descriptor_->file())) {
- // If we don't have has-bits, message presence is indicated only by ptr !=
- // NULL. Thus on clear, we need to delete the object.
- printer->Print(variables_,
- "if (GetArenaNoVirtual() == NULL && $name$_ != NULL) {\n"
- " delete $name$_;\n"
- "}\n"
- "$name$_ = NULL;\n");
- } else {
- printer->Print(variables_,
- "if ($name$_ != NULL) $name$_->Clear();\n");
- }
-}
-
-void MessageFieldGenerator::
-GenerateMessageClearingCode(io::Printer* printer) const {
- if (!HasFieldPresence(descriptor_->file())) {
- // If we don't have has-bits, message presence is indicated only by ptr !=
- // NULL. Thus on clear, we need to delete the object.
- printer->Print(variables_,
- "if (GetArenaNoVirtual() == NULL && $name$_ != NULL) {\n"
- " delete $name$_;\n"
- "}\n"
- "$name$_ = NULL;\n");
- } else {
- printer->Print(variables_,
- "GOOGLE_DCHECK($name$_ != NULL);\n"
- "$name$_->Clear();\n");
- }
-}
-
-void MessageFieldGenerator::
-GenerateMergingCode(io::Printer* printer) const {
- if (implicit_weak_field_) {
- printer->Print(variables_,
- "_internal_mutable_$name$()->CheckTypeAndMergeFrom(\n"
- " from._internal_$name$());\n");
- } else {
- printer->Print(variables_,
- "mutable_$name$()->$type$::MergeFrom(from.$name$());\n");
- }
-}
-
-void MessageFieldGenerator::
-GenerateSwappingCode(io::Printer* printer) const {
- printer->Print(variables_, "swap($name$_, other->$name$_);\n");
-}
-
-void MessageFieldGenerator::
-GenerateDestructorCode(io::Printer* printer) const {
- // TODO(gerbens) Remove this when we don't need to destruct default instances.
- // In google3 a default instance will never get deleted so we don't need to
- // worry about that but in opensource protobuf default instances are deleted
- // in shutdown process and we need to take special care when handling them.
- printer->Print(variables_,
- "if (this != internal_default_instance()) ");
- printer->Print(variables_, "delete $name$_;\n");
-}
-
-void MessageFieldGenerator::
-GenerateConstructorCode(io::Printer* printer) const {
- printer->Print(variables_, "$name$_ = NULL;\n");
-}
-
-void MessageFieldGenerator::
-GenerateCopyConstructorCode(io::Printer* printer) const {
- printer->Print(variables_,
- "if (from.has_$name$()) {\n"
- " $name$_ = new $type$(*from.$name$_);\n"
- "} else {\n"
- " $name$_ = NULL;\n"
- "}\n");
-}
-
-void MessageFieldGenerator::
-GenerateMergeFromCodedStream(io::Printer* printer) const {
- if (implicit_weak_field_) {
- printer->Print(variables_,
- "DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(\n"
- " input, _internal_mutable_$name$()));\n");
- } else if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) {
- printer->Print(variables_,
- "DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(\n"
- " input, mutable_$name$()));\n");
- } else {
- printer->Print(variables_,
- "DO_(::google::protobuf::internal::WireFormatLite::ReadGroup(\n"
- " $number$, input, mutable_$name$()));\n");
- }
-}
-
-void MessageFieldGenerator::
-GenerateSerializeWithCachedSizes(io::Printer* printer) const {
- printer->Print(variables_,
- "::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n"
- " $number$, this->_internal_$name$(), output);\n");
-}
-
-void MessageFieldGenerator::
-GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
- printer->Print(variables_,
- "target = ::google::protobuf::internal::WireFormatLite::\n"
- " InternalWrite$declared_type$ToArray(\n"
- " $number$, this->_internal_$name$(), deterministic, target);\n");
-}
-
-void MessageFieldGenerator::
-GenerateByteSize(io::Printer* printer) const {
- printer->Print(variables_,
- "total_size += $tag_size$ +\n"
- " ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n"
- " *$field_member$);\n");
-}
-
-// ===================================================================
-
-MessageOneofFieldGenerator::MessageOneofFieldGenerator(
- const FieldDescriptor* descriptor, const Options& options,
- SCCAnalyzer* scc_analyzer)
- : MessageFieldGenerator(descriptor, options, scc_analyzer) {
- SetCommonOneofFieldVariables(descriptor, &variables_);
-}
-
-MessageOneofFieldGenerator::~MessageOneofFieldGenerator() {}
-
-void MessageOneofFieldGenerator::GenerateNonInlineAccessorDefinitions(
- io::Printer* printer) const {
- printer->Print(variables_,
- "void $classname$::set_allocated_$name$($type$* $name$) {\n"
- " ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();\n"
- " clear_$oneof_name$();\n"
- " if ($name$) {\n");
- if (SupportsArenas(descriptor_->message_type()) &&
- descriptor_->file() != descriptor_->message_type()->file()) {
- // We have to read the arena through the virtual method, because the type
- // isn't defined in this file.
- 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_,
- " ::google::protobuf::Arena* submessage_arena = NULL;\n");
- } else {
- printer->Print(variables_,
- " ::google::protobuf::Arena* submessage_arena =\n"
- " ::google::protobuf::Arena::GetArena($name$);\n");
- }
- printer->Print(variables_,
- " if (message_arena != submessage_arena) {\n"
- " $name$ = ::google::protobuf::internal::GetOwnedMessage(\n"
- " message_arena, $name$, submessage_arena);\n"
- " }\n"
- " set_has_$name$();\n"
- " $field_member$ = $name$;\n"
- " }\n"
- " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
- "}\n");
-}
-
-void MessageOneofFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- if (!implicit_weak_field_) {
- printer->Print(variables_,
- "inline const $type$& $classname$::_internal_$name$() const {\n"
- " return *$field_member$;\n"
- "}\n");
- }
- printer->Print(variables_,
- "inline $type$* $classname$::$release_name$() {\n"
- " // @@protoc_insertion_point(field_release:$full_name$)\n"
- " if (has_$name$()) {\n"
- " clear_has_$oneof_name$();\n"
- " $type$* temp = $field_member$;\n");
- if (SupportsArenas(descriptor_)) {
- printer->Print(variables_,
- " if (GetArenaNoVirtual() != NULL) {\n"
- " temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);\n"
- " }\n");
- }
- printer->Print(variables_,
- " $field_member$ = NULL;\n"
- " return temp;\n"
- " } else {\n"
- " return NULL;\n"
- " }\n"
- "}\n");
-
- printer->Print(variables_,
- "inline const $type$& $classname$::$name$() const {\n"
- " // @@protoc_insertion_point(field_get:$full_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$* $classname$::unsafe_arena_release_$name$() {\n"
- " // @@protoc_insertion_point(field_unsafe_arena_release"
- ":$full_name$)\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"
- " }\n"
- "}\n"
- "inline void $classname$::unsafe_arena_set_allocated_$name$"
- "($type$* $name$) {\n"
- // We rely on the oneof clear method to free the earlier contents of this
- // oneof. We can directly use the pointer we're given to set the new
- // value.
- " clear_$oneof_name$();\n"
- " if ($name$) {\n"
- " set_has_$name$();\n"
- " $field_member$ = $name$;\n"
- " }\n"
- " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:"
- "$full_name$)\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$ = CreateMaybeMessage< $type$ >(\n"
- " GetArenaNoVirtual());\n"
- " }\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $field_member$;\n"
- "}\n");
-}
-
-void MessageOneofFieldGenerator::
-GenerateClearingCode(io::Printer* printer) const {
- if (SupportsArenas(descriptor_)) {
- printer->Print(variables_,
- "if (GetArenaNoVirtual() == NULL) {\n"
- " delete $field_member$;\n"
- "}\n");
- } else {
- printer->Print(variables_,
- "delete $field_member$;\n");
- }
-}
-
-void MessageOneofFieldGenerator::
-GenerateMessageClearingCode(io::Printer* printer) const {
- GenerateClearingCode(printer);
-}
-
-void MessageOneofFieldGenerator::
-GenerateSwappingCode(io::Printer* printer) const {
- // Don't print any swapping code. Swapping the union will swap this field.
-}
-
-void MessageOneofFieldGenerator::
-GenerateDestructorCode(io::Printer* printer) const {
- // We inherit from MessageFieldGenerator, so we need to override the default
- // behavior.
-}
-
-void MessageOneofFieldGenerator::
-GenerateConstructorCode(io::Printer* printer) const {
- // Don't print any constructor code. The field is in a union. We allocate
- // space only when this field is used.
-}
-
-// ===================================================================
-
-RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator(
- const FieldDescriptor* descriptor, const Options& options,
- SCCAnalyzer* scc_analyzer)
- : FieldGenerator(options),
- descriptor_(descriptor),
- implicit_weak_field_(
- IsImplicitWeakField(descriptor, options, scc_analyzer)) {
- SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_);
-}
-
-RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {}
-
-void RepeatedMessageFieldGenerator::
-GeneratePrivateMembers(io::Printer* printer) const {
- printer->Print(variables_,
- "::google::protobuf::RepeatedPtrField< $type$ > $name$_;\n");
-}
-
-void RepeatedMessageFieldGenerator::
-GenerateAccessorDeclarations(io::Printer* printer) const {
- 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_);
- printer->Print(variables_, "$deprecated_attr$$type$* ${$add_$name$$}$();\n");
- printer->Annotate("{", "}", descriptor_);
- printer->Print(variables_,
- "$deprecated_attr$const ::google::protobuf::RepeatedPtrField< $type$ >&\n"
- " $name$() const;\n");
- printer->Annotate("name", descriptor_);
-}
-
-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"
- "$classname$::mutable_$name$() {\n"
- " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
- "$type_reference_function$"
- " return &$name$_;\n"
- "}\n");
-
- 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"
- " 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"
- "$type_reference_function$"
- " return $name$_.Get(index);\n"
- "}\n");
- }
-
- printer->Print(variables_,
- "inline $type$* $classname$::add_$name$() {\n"
- " // @@protoc_insertion_point(field_add:$full_name$)\n"
- " return $name$_.Add();\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 {
- 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 {
- 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_,
- "CastToBase(&$name$_)->InternalSwap(CastToBase(&other->$name$_));\n");
-}
-
-void RepeatedMessageFieldGenerator::
-GenerateConstructorCode(io::Printer* printer) const {
- // Not needed for repeated fields.
-}
-
-void RepeatedMessageFieldGenerator::
-GenerateMergeFromCodedStream(io::Printer* printer) const {
- if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) {
- 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::"
- "ReadGroup($number$, input, add_$name$()));\n");
- }
-}
-
-void RepeatedMessageFieldGenerator::
-GenerateSerializeWithCachedSizes(io::Printer* printer) const {
- printer->Print(variables_,
- "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$,\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");
-}
-
-void RepeatedMessageFieldGenerator::
-GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
- printer->Print(variables_,
- "for (unsigned int i = 0,\n"
- " n = static_cast<unsigned int>(this->$name$_size()); i < n; i++) {\n"
- " target = ::google::protobuf::internal::WireFormatLite::\n"
- " InternalWrite$declared_type$ToArray(\n"
- " $number$, this->$name$(static_cast<int>(i)), deterministic, target);\n"
- "}\n");
-}
-
-void RepeatedMessageFieldGenerator::
-GenerateByteSize(io::Printer* printer) const {
- printer->Print(variables_,
- "{\n"
- " unsigned int count = static_cast<unsigned int>(this->$name$_size());\n");
- printer->Indent();
- printer->Print(variables_,
- "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");
- 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");
-}
-
-} // namespace cpp
-} // namespace compiler
-} // namespace protobuf
-} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc b/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
deleted file mode 100644
index e9303865c0..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
+++ /dev/null
@@ -1,220 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <google/protobuf/compiler/cpp/cpp_padding_optimizer.h>
-
-#include <google/protobuf/compiler/cpp/cpp_helpers.h>
-
-namespace google {
-namespace protobuf {
-namespace compiler {
-namespace cpp {
-
-namespace {
-
-// FieldGroup is just a helper for PaddingOptimizer below. It holds a vector of
-// fields that are grouped together because they have compatible alignment, and
-// a preferred location in the final field ordering.
-class FieldGroup {
- public:
- FieldGroup() : preferred_location_(0) {}
-
- // A group with a single field.
- FieldGroup(float preferred_location, const FieldDescriptor* field)
- : preferred_location_(preferred_location), fields_(1, field) {}
-
- // Append the fields in 'other' to this group.
- void Append(const FieldGroup& other) {
- if (other.fields_.empty()) {
- return;
- }
- // Preferred location is the average among all the fields, so we weight by
- // the number of fields on each FieldGroup object.
- preferred_location_ = (preferred_location_ * fields_.size() +
- (other.preferred_location_ * other.fields_.size())) /
- (fields_.size() + other.fields_.size());
- fields_.insert(fields_.end(), other.fields_.begin(), other.fields_.end());
- }
-
- void SetPreferredLocation(float location) { preferred_location_ = location; }
- const std::vector<const FieldDescriptor*>& fields() const { return fields_; }
-
- // FieldGroup objects sort by their preferred location.
- bool operator<(const FieldGroup& other) const {
- return preferred_location_ < other.preferred_location_;
- }
-
- private:
- // "preferred_location_" is an estimate of where this group should go in the
- // final list of fields. We compute this by taking the average index of each
- // field in this group in the original ordering of fields. This is very
- // approximate, but should put this group close to where its member fields
- // originally went.
- float preferred_location_;
- std::vector<const FieldDescriptor*> fields_;
- // We rely on the default copy constructor and operator= so this type can be
- // used in a vector.
-};
-
-} // namespace
-
-// Reorder 'fields' so that if the fields are output into a c++ class in the new
-// order, fields of similar family (see below) are together and within each
-// family, alignment padding is minimized.
-//
-// We try to do this while keeping each field as close as possible to its field
-// number order so that we don't reduce cache locality much for function that
-// access each field in order. Originally, OptimizePadding used declaration
-// order for its decisions, but generated code minus the serializer/parsers uses
-// the output of OptimizePadding as well (stored in
-// MessageGenerator::optimized_order_). Since the serializers use field number
-// order, we use that as a tie-breaker.
-//
-// We classify each field into a particular "family" of fields, that we perform
-// the same operation on in our generated functions.
-//
-// REPEATED is placed first, as the C++ compiler automatically initializes
-// these fields in layout order.
-//
-// STRING is grouped next, as our Clear/SharedCtor/SharedDtor walks it and
-// calls ArenaStringPtr::Destroy on each.
-//
-//
-// MESSAGE is grouped next, as our Clear/SharedDtor code walks it and calls
-// delete on each. We initialize these fields with a NULL pointer (see
-// MessageFieldGenerator::GenerateConstructorCode), which allows them to be
-// memset.
-//
-// ZERO_INITIALIZABLE is memset in Clear/SharedCtor
-//
-// OTHER these fields are initialized one-by-one.
-void PaddingOptimizer::OptimizeLayout(
- std::vector<const FieldDescriptor*>* fields, const Options& options) {
- // The sorted numeric order of Family determines the declaration order in the
- // memory layout.
- enum Family {
- REPEATED = 0,
- STRING = 1,
- MESSAGE = 3,
- ZERO_INITIALIZABLE = 4,
- OTHER = 5,
- kMaxFamily
- };
-
- // First divide fields into those that align to 1 byte, 4 bytes or 8 bytes.
- std::vector<FieldGroup> aligned_to_1[kMaxFamily];
- std::vector<FieldGroup> aligned_to_4[kMaxFamily];
- std::vector<FieldGroup> aligned_to_8[kMaxFamily];
- for (int i = 0; i < fields->size(); ++i) {
- const FieldDescriptor* field = (*fields)[i];
-
- Family f = OTHER;
- if (field->is_repeated()) {
- f = REPEATED;
- } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) {
- f = STRING;
- } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
- f = MESSAGE;
-
- } else if (CanInitializeByZeroing(field)) {
- f = ZERO_INITIALIZABLE;
- }
-
- const int j = field->number();
- switch (EstimateAlignmentSize(field)) {
- case 1:
- aligned_to_1[f].push_back(FieldGroup(j, field));
- break;
- case 4:
- aligned_to_4[f].push_back(FieldGroup(j, field));
- break;
- case 8:
- aligned_to_8[f].push_back(FieldGroup(j, field));
- break;
- default:
- GOOGLE_LOG(FATAL) << "Unknown alignment size " << EstimateAlignmentSize(field)
- << "for a field " << field->full_name() << ".";
- }
- }
-
- // For each family, group fields to optimize padding.
- for (int f = 0; f < kMaxFamily; f++) {
- // Now group fields aligned to 1 byte into sets of 4, and treat those like a
- // single field aligned to 4 bytes.
- for (int i = 0; i < aligned_to_1[f].size(); i += 4) {
- FieldGroup field_group;
- for (int j = i; j < aligned_to_1[f].size() && j < i + 4; ++j) {
- field_group.Append(aligned_to_1[f][j]);
- }
- aligned_to_4[f].push_back(field_group);
- }
- // Sort by preferred location to keep fields as close to their field number
- // order as possible. Using stable_sort ensures that the output is
- // consistent across runs.
- std::stable_sort(aligned_to_4[f].begin(), aligned_to_4[f].end());
-
- // Now group fields aligned to 4 bytes (or the 4-field groups created above)
- // into pairs, and treat those like a single field aligned to 8 bytes.
- for (int i = 0; i < aligned_to_4[f].size(); i += 2) {
- FieldGroup field_group;
- for (int j = i; j < aligned_to_4[f].size() && j < i + 2; ++j) {
- field_group.Append(aligned_to_4[f][j]);
- }
- if (i == aligned_to_4[f].size() - 1) {
- if (f == OTHER) {
- // Move incomplete 4-byte block to the beginning. This is done to
- // pair with the (possible) leftover blocks from the
- // ZERO_INITIALIZABLE family.
- field_group.SetPreferredLocation(-1);
- } else {
- // Move incomplete 4-byte block to the end.
- field_group.SetPreferredLocation(fields->size() + 1);
- }
- }
- aligned_to_8[f].push_back(field_group);
- }
- // Sort by preferred location.
- std::stable_sort(aligned_to_8[f].begin(), aligned_to_8[f].end());
- }
-
- // Now pull out all the FieldDescriptors in order.
- fields->clear();
- for (int f = 0; f < kMaxFamily; ++f) {
- for (int i = 0; i < aligned_to_8[f].size(); ++i) {
- fields->insert(fields->end(), aligned_to_8[f][i].fields().begin(),
- aligned_to_8[f][i].fields().end());
- }
- }
-}
-
-} // namespace cpp
-} // namespace compiler
-} // namespace protobuf
-} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.cc b/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.cc
deleted file mode 100644
index 22b759a923..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/compiler/cpp/cpp_unittest.cc
+++ /dev/null
@@ -1,122 +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.
-//
-// To test the code generator, we actually use it to generate code for
-// google/protobuf/unittest.proto, then test that. This means that we
-// are actually testing the parser and other parts of the system at the same
-// time, and that problems in the generator may show up as compile-time errors
-// rather than unittest failures, which may be surprising. However, testing
-// the output of the C++ generator directly would be very hard. We can't very
-// well just check it against golden files since those files would have to be
-// updated for any small change; such a test would be very brittle and probably
-// not very helpful. What we really want to test is that the code compiles
-// correctly and produces the interfaces we expect, which is why this test
-// is written this way.
-
-#include <google/protobuf/compiler/cpp/cpp_unittest.h>
-
-#include <google/protobuf/unittest.pb.h>
-#include <google/protobuf/unittest_optimize_for.pb.h>
-#include <google/protobuf/unittest_embed_optimize_for.pb.h>
-
-#include <google/protobuf/test_util.h>
-
-#define MESSAGE_TEST_NAME MessageTest
-#define GENERATED_DESCRIPTOR_TEST_NAME GeneratedDescriptorTest
-#define GENERATED_MESSAGE_TEST_NAME GeneratedMessageTest
-#define GENERATED_ENUM_TEST_NAME GeneratedEnumTest
-#define GENERATED_SERVICE_TEST_NAME GeneratedServiceTest
-#define HELPERS_TEST_NAME HelpersTest
-#define DESCRIPTOR_INIT_TEST_NAME DescriptorInitializationTest
-
-#define UNITTEST_PROTO_PATH "google/protobuf/unittest.proto"
-#define UNITTEST ::protobuf_unittest
-#define UNITTEST_IMPORT ::protobuf_unittest_import
-
-// Must include after the above macros.
-#include <google/protobuf/compiler/cpp/cpp_unittest.inc>
-
-namespace google {
-namespace protobuf {
-namespace compiler {
-namespace cpp {
-
-// Can't use an anonymous namespace here due to brokenness of Tru64 compiler.
-namespace cpp_unittest {
-
-namespace protobuf_unittest = ::protobuf_unittest;
-
-TEST(GENERATED_MESSAGE_TEST_NAME, TestConflictingSymbolNames) {
- // test_bad_identifiers.proto successfully compiled, then it works. The
- // following is just a token usage to insure that the code is, in fact,
- // being compiled and linked.
-
- protobuf_unittest::TestConflictingSymbolNames message;
- message.set_uint32(1);
- EXPECT_EQ(3, message.ByteSizeLong());
-
- message.set_friend_(5);
- EXPECT_EQ(5, message.friend_());
-
- message.set_class_(6);
- EXPECT_EQ(6, message.class_());
-
- // Instantiate extension template functions to test conflicting template
- // parameter names.
- typedef protobuf_unittest::TestConflictingSymbolNamesExtension ExtensionMessage;
- message.AddExtension(ExtensionMessage::repeated_int32_ext, 123);
- EXPECT_EQ(123,
- message.GetExtension(ExtensionMessage::repeated_int32_ext, 0));
-}
-
-TEST(GENERATED_MESSAGE_TEST_NAME, TestConflictingEnumNames) {
- protobuf_unittest::TestConflictingEnumNames message;
- message.set_conflicting_enum(protobuf_unittest::TestConflictingEnumNames_NestedConflictingEnum_and_);
- EXPECT_EQ(1, message.conflicting_enum());
- message.set_conflicting_enum(protobuf_unittest::TestConflictingEnumNames_NestedConflictingEnum_XOR);
- EXPECT_EQ(5, message.conflicting_enum());
-
-
- protobuf_unittest::ConflictingEnum conflicting_enum;
- conflicting_enum = protobuf_unittest::NOT_EQ;
- EXPECT_EQ(1, conflicting_enum);
- conflicting_enum = protobuf_unittest::return_;
- EXPECT_EQ(3, conflicting_enum);
-}
-
-} // namespace cpp_unittest
-} // namespace cpp
-} // namespace compiler
-} // namespace protobuf
-} // namespace google
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/implicit_weak_message.h b/third_party/protobuf/3.6.0/src/google/protobuf/implicit_weak_message.h
deleted file mode 100644
index 3279bd1777..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/implicit_weak_message.h
+++ /dev/null
@@ -1,135 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__
-#define GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__
-
-#include <google/protobuf/io/coded_stream.h>
-#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) {}
- explicit ImplicitWeakMessage(Arena* arena) : arena_(arena) {}
-
- static const ImplicitWeakMessage* default_instance();
-
- string GetTypeName() const { return ""; }
-
- MessageLite* New() const { return new ImplicitWeakMessage; }
- MessageLite* New(Arena* arena) const {
- return Arena::CreateMessage<ImplicitWeakMessage>(arena);
- }
-
- Arena* GetArena() const { return arena_; }
-
- void Clear() { data_.clear(); }
-
- bool IsInitialized() const { return true; }
-
- void CheckTypeAndMergeFrom(const MessageLite& other) {
- data_.append(static_cast<const ImplicitWeakMessage&>(other).data_);
- }
-
- bool MergePartialFromCodedStream(io::CodedInputStream* input);
-
- size_t ByteSizeLong() const { return data_.size(); }
-
- void SerializeWithCachedSizes(io::CodedOutputStream* output) const {
- output->WriteString(data_);
- }
-
- int GetCachedSize() const { return static_cast<int>(data_.size()); }
-
- typedef void InternalArenaConstructable_;
-
- private:
- Arena* const arena_;
- string data_;
- 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;
- static const bool Moveable = false;
-
- // 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();
- }
-};
-
-} // namespace internal
-} // namespace protobuf
-
-} // namespace google
-#endif // GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/inlined_string_field.h b/third_party/protobuf/3.6.0/src/google/protobuf/inlined_string_field.h
deleted file mode 100644
index 95d4687be3..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/inlined_string_field.h
+++ /dev/null
@@ -1,271 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__
-#define GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__
-
-#include <string>
-
-#include <google/protobuf/stubs/port.h>
-#include <google/protobuf/stubs/stringpiece.h>
-
-namespace google {
-namespace protobuf {
-
-class Arena;
-
-namespace internal {
-
-// InlinedStringField wraps a ::std::string instance and exposes an API similar to
-// ArenaStringPtr's wrapping of a ::std::string* instance. As ::std::string is never
-// allocated on the Arena, we expose only the *NoArena methods of
-// ArenaStringPtr.
-//
-// default_value parameters are taken for consistency with ArenaStringPtr, but
-// are not used for most methods. With inlining, these should be removed from
-// the generated binary.
-class LIBPROTOBUF_EXPORT InlinedStringField {
- public:
- InlinedStringField()
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
- explicit InlinedStringField(const ::std::string& default_value);
-
- void AssignWithDefault(const ::std::string* default_value,
- const InlinedStringField& from)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-
- void ClearToEmpty(const ::std::string* default_value, Arena* arena)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- ClearToEmptyNoArena(default_value);
- }
- void ClearNonDefaultToEmpty() GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- ClearNonDefaultToEmptyNoArena();
- }
- void ClearToEmptyNoArena(const ::std::string* default_value)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- ClearNonDefaultToEmptyNoArena();
- }
- void ClearNonDefaultToEmptyNoArena()
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-
- void ClearToDefault(const ::std::string* default_value, Arena* arena)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- ClearToDefaultNoArena(default_value);
- }
- void ClearToDefaultNoArena(const ::std::string* default_value)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-
- void Destroy(const ::std::string* default_value, Arena* arena)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- DestroyNoArena(default_value);
- }
- void DestroyNoArena(const ::std::string* default_value)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-
- const ::std::string& Get() const GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- return GetNoArena();
- }
- const ::std::string& GetNoArena() const GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-
- ::std::string* Mutable(const ::std::string* default_value, Arena* arena)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- return MutableNoArena(default_value);
- }
- ::std::string* MutableNoArena(const ::std::string* default_value)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-
- ::std::string* Release(const ::std::string* default_value, Arena* arena) {
- return ReleaseNoArena(default_value);
- }
- ::std::string* ReleaseNonDefault(const ::std::string* default_value, Arena* arena) {
- return ReleaseNonDefaultNoArena(default_value);
- }
- ::std::string* ReleaseNoArena(const ::std::string* default_value) {
- return ReleaseNonDefaultNoArena(default_value);
- }
- ::std::string* ReleaseNonDefaultNoArena(const ::std::string* default_value);
-
- void Set(const ::std::string* default_value,
- StringPiece value,
- Arena* arena) GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- SetNoArena(default_value, value);
- }
- void SetLite(const ::std::string* default_value,
- StringPiece value,
- Arena* arena) GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- SetNoArena(default_value, value);
- }
- void SetNoArena(const ::std::string* default_value,
- StringPiece value) GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-
- void Set(const ::std::string* default_value,
- const ::std::string& value,
- Arena* arena) GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- SetNoArena(default_value, value);
- }
- void SetLite(const ::std::string* default_value,
- const ::std::string& value,
- Arena* arena) GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE {
- SetNoArena(default_value, value);
- }
- void SetNoArena(const ::std::string* default_value,
- const ::std::string& value)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-
-#if LANG_CXX11
- void SetNoArena(const ::std::string* default_value,
- ::std::string&& value)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
-#endif
- void SetAllocated(const ::std::string* default_value,
- ::std::string* value,
- Arena* arena) {
- SetAllocatedNoArena(default_value, value);
- }
- void SetAllocatedNoArena(const ::std::string* default_value,
- ::std::string* value);
- void Swap(InlinedStringField* from)
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE;
- ::std::string* UnsafeMutablePointer();
- void UnsafeSetDefault(const ::std::string* default_value);
- ::std::string* UnsafeArenaRelease(const ::std::string* default_value, Arena* arena);
- void UnsafeArenaSetAllocated(
- const ::std::string* default_value, ::std::string* value, Arena* arena);
-
- bool IsDefault(const ::std::string* default_value) {
- return false;
- }
- private:
- ::std::string value_;
-};
-
-inline InlinedStringField::InlinedStringField() {}
-
-inline InlinedStringField::InlinedStringField(const ::std::string& default_value) :
- value_(default_value) {}
-
-inline void InlinedStringField::AssignWithDefault(
- const ::std::string* default_value, const InlinedStringField& from) {
- value_ = from.value_;
-}
-
-inline const ::std::string& InlinedStringField::GetNoArena() const {
- return value_;
-}
-
-inline ::std::string* InlinedStringField::MutableNoArena(const ::std::string*) {
- return &value_;
-}
-
-inline void InlinedStringField::SetAllocatedNoArena(
- const ::std::string* default_value, ::std::string* value) {
- if (value == NULL) {
- value_.assign(*default_value);
- } else {
-#if LANG_CXX11
- value_.assign(std::move(*value));
-#else
- value_.swap(*value);
-#endif
- delete value;
- }
-}
-
-inline void InlinedStringField::DestroyNoArena(const ::std::string*) {
- // This is invoked from the generated message's ArenaDtor, which is used to
- // clean up objects not allocated on the Arena.
- this->~InlinedStringField();
-}
-
-inline void InlinedStringField::ClearNonDefaultToEmptyNoArena() {
- value_.clear();
-}
-
-inline void InlinedStringField::ClearToDefaultNoArena(
- const ::std::string* default_value) {
- value_.assign(*default_value);
-}
-
-inline ::std::string* InlinedStringField::ReleaseNonDefaultNoArena(
- const ::std::string* default_value) {
- ::std::string* released = new ::std::string(*default_value);
- value_.swap(*released);
- return released;
-}
-
-inline void InlinedStringField::SetNoArena(
- const ::std::string* default_value, StringPiece value) {
- value_.assign(value.data(), value.length());
-}
-
-inline void InlinedStringField::SetNoArena(
- const ::std::string* default_value, const ::std::string& value) {
- value_.assign(value);
-}
-
-#if LANG_CXX11
-inline void InlinedStringField::SetNoArena(
- const ::std::string* default_value, ::std::string&& value) {
- value_.assign(std::move(value));
-}
-#endif
-
-inline void InlinedStringField::Swap(InlinedStringField* from) {
- value_.swap(from->value_);
-}
-
-inline ::std::string* InlinedStringField::UnsafeMutablePointer() {
- return &value_;
-}
-
-inline void InlinedStringField::UnsafeSetDefault(
- const ::std::string* default_value) {
- value_.assign(*default_value);
-}
-
-inline ::std::string* InlinedStringField::UnsafeArenaRelease(
- const ::std::string* default_value, Arena* arena) {
- return ReleaseNoArena(default_value);
-}
-
-inline void InlinedStringField::UnsafeArenaSetAllocated(
- const ::std::string* default_value, ::std::string* value, Arena* arena) {
- if (value == NULL) {
- value_.assign(*default_value);
- } else {
- value_.assign(*value);
- }
-}
-
-} // namespace internal
-} // namespace protobuf
-
-} // namespace google
-#endif // GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/test_util.h b/third_party/protobuf/3.6.0/src/google/protobuf/test_util.h
deleted file mode 100644
index b9abb6717d..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/test_util.h
+++ /dev/null
@@ -1,1301 +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.
-
-#ifndef GOOGLE_PROTOBUF_TEST_UTIL_H__
-#define GOOGLE_PROTOBUF_TEST_UTIL_H__
-
-#include <google/protobuf/unittest.pb.h>
-
-#define UNITTEST ::protobuf_unittest
-#define UNITTEST_IMPORT ::protobuf_unittest_import
-// Must be included when the preprocessor symbols above are defined.
-#include <google/protobuf/test_util.inc>
-#undef UNITTEST
-#undef UNITTEST_IMPORT
-
-
-namespace google {
-namespace protobuf {
-// This file doesn't use these declarations, but some .cc files do.
-namespace unittest = ::protobuf_unittest;
-namespace unittest_import = ::protobuf_unittest_import;
-
-namespace TestUtil {
-
-class ReflectionTester {
- public:
- // base_descriptor must be a descriptor for TestAllTypes or
- // TestAllExtensions. In the former case, ReflectionTester fetches from
- // it the FieldDescriptors needed to use the reflection interface. In
- // the latter case, ReflectionTester searches for extension fields in
- // its file.
- explicit ReflectionTester(const Descriptor* base_descriptor);
-
- void SetAllFieldsViaReflection(Message* message);
- void ModifyRepeatedFieldsViaReflection(Message* message);
- void ExpectAllFieldsSetViaReflection(const Message& message);
- void ExpectClearViaReflection(const Message& message);
-
- void SetPackedFieldsViaReflection(Message* message);
- void ModifyPackedFieldsViaReflection(Message* message);
- void ExpectPackedFieldsSetViaReflection(const Message& message);
- void ExpectPackedClearViaReflection(const Message& message);
-
- void RemoveLastRepeatedsViaReflection(Message* message);
- void ReleaseLastRepeatedsViaReflection(Message* message,
- bool expect_extensions_notnull);
- void SwapRepeatedsViaReflection(Message* message);
- void SetAllocatedOptionalMessageFieldsToNullViaReflection(Message* message);
- static void SetAllocatedOptionalMessageFieldsToMessageViaReflection(
- Message* from_message, Message* to_message);
-
- enum MessageReleaseState {
- IS_NULL,
- CAN_BE_NULL,
- NOT_NULL,
- };
- void ExpectMessagesReleasedViaReflection(
- Message* message, MessageReleaseState expected_release_state);
-
- // Set and check functions for TestOneof2 messages. No need to construct
- // the ReflectionTester by TestAllTypes nor TestAllExtensions.
- static void SetOneofViaReflection(Message* message);
- static void ExpectOneofSetViaReflection(const Message& message);
-
- private:
- const FieldDescriptor* F(const string& name);
-
- const Descriptor* base_descriptor_;
-
- const FieldDescriptor* group_a_;
- const FieldDescriptor* repeated_group_a_;
- const FieldDescriptor* nested_b_;
- const FieldDescriptor* foreign_c_;
- const FieldDescriptor* import_d_;
- const FieldDescriptor* import_e_;
-
- const EnumValueDescriptor* nested_foo_;
- const EnumValueDescriptor* nested_bar_;
- const EnumValueDescriptor* nested_baz_;
- const EnumValueDescriptor* foreign_foo_;
- const EnumValueDescriptor* foreign_bar_;
- const EnumValueDescriptor* foreign_baz_;
- const EnumValueDescriptor* import_foo_;
- const EnumValueDescriptor* import_bar_;
- const EnumValueDescriptor* import_baz_;
-
- // We have to split this into three function otherwise it creates a stack
- // frame so large that it triggers a warning.
- void ExpectAllFieldsSetViaReflection1(const Message& message);
- void ExpectAllFieldsSetViaReflection2(const Message& message);
- void ExpectAllFieldsSetViaReflection3(const Message& message);
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ReflectionTester);
-};
-
-inline TestUtil::ReflectionTester::ReflectionTester(
- const Descriptor* base_descriptor)
- : base_descriptor_(base_descriptor) {
- const DescriptorPool* pool = base_descriptor->file()->pool();
- string package = base_descriptor->file()->package();
- const FieldDescriptor* import_descriptor =
- pool->FindFieldByName(package + ".TestAllTypes.optional_import_message");
- string import_package = import_descriptor->message_type()->file()->package();
-
- nested_b_ = pool->FindFieldByName(package + ".TestAllTypes.NestedMessage.bb");
- foreign_c_ = pool->FindFieldByName(package + ".ForeignMessage.c");
- import_d_ = pool->FindFieldByName(import_package + ".ImportMessage.d");
- import_e_ = pool->FindFieldByName(import_package + ".PublicImportMessage.e");
- nested_foo_ = pool->FindEnumValueByName(package + ".TestAllTypes.FOO");
- nested_bar_ = pool->FindEnumValueByName(package + ".TestAllTypes.BAR");
- nested_baz_ = pool->FindEnumValueByName(package + ".TestAllTypes.BAZ");
- foreign_foo_ = pool->FindEnumValueByName(package + ".FOREIGN_FOO");
- foreign_bar_ = pool->FindEnumValueByName(package + ".FOREIGN_BAR");
- foreign_baz_ = pool->FindEnumValueByName(package + ".FOREIGN_BAZ");
- import_foo_ = pool->FindEnumValueByName(import_package + ".IMPORT_FOO");
- import_bar_ = pool->FindEnumValueByName(import_package + ".IMPORT_BAR");
- import_baz_ = pool->FindEnumValueByName(import_package + ".IMPORT_BAZ");
-
- if (base_descriptor_->name() == "TestAllExtensions") {
- group_a_ = pool->FindFieldByName(package + ".OptionalGroup_extension.a");
- repeated_group_a_ =
- pool->FindFieldByName(package + ".RepeatedGroup_extension.a");
- } else {
- group_a_ = pool->FindFieldByName(package + ".TestAllTypes.OptionalGroup.a");
- repeated_group_a_ =
- pool->FindFieldByName(package + ".TestAllTypes.RepeatedGroup.a");
- }
-
- EXPECT_TRUE(group_a_ != nullptr);
- EXPECT_TRUE(repeated_group_a_ != nullptr);
- EXPECT_TRUE(nested_b_ != nullptr);
- EXPECT_TRUE(foreign_c_ != nullptr);
- EXPECT_TRUE(import_d_ != nullptr);
- EXPECT_TRUE(import_e_ != nullptr);
- EXPECT_TRUE(nested_foo_ != nullptr);
- EXPECT_TRUE(nested_bar_ != nullptr);
- EXPECT_TRUE(nested_baz_ != nullptr);
- EXPECT_TRUE(foreign_foo_ != nullptr);
- EXPECT_TRUE(foreign_bar_ != nullptr);
- EXPECT_TRUE(foreign_baz_ != nullptr);
- EXPECT_TRUE(import_foo_ != nullptr);
- EXPECT_TRUE(import_bar_ != nullptr);
- EXPECT_TRUE(import_baz_ != nullptr);
-}
-
-// Shorthand to get a FieldDescriptor for a field of TestAllTypes.
-inline const FieldDescriptor* TestUtil::ReflectionTester::F(
- const string& name) {
- const FieldDescriptor* result = nullptr;
- if (base_descriptor_->name() == "TestAllExtensions" ||
- base_descriptor_->name() == "TestPackedExtensions") {
- result = base_descriptor_->file()->FindExtensionByName(name + "_extension");
- } else {
- result = base_descriptor_->FindFieldByName(name);
- }
- GOOGLE_CHECK(result != nullptr);
- return result;
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ReflectionTester::SetAllFieldsViaReflection(
- Message* message) {
- const Reflection* reflection = message->GetReflection();
- Message* sub_message;
-
- reflection->SetInt32(message, F("optional_int32"), 101);
- reflection->SetInt64(message, F("optional_int64"), 102);
- reflection->SetUInt32(message, F("optional_uint32"), 103);
- reflection->SetUInt64(message, F("optional_uint64"), 104);
- reflection->SetInt32(message, F("optional_sint32"), 105);
- reflection->SetInt64(message, F("optional_sint64"), 106);
- reflection->SetUInt32(message, F("optional_fixed32"), 107);
- reflection->SetUInt64(message, F("optional_fixed64"), 108);
- reflection->SetInt32(message, F("optional_sfixed32"), 109);
- reflection->SetInt64(message, F("optional_sfixed64"), 110);
- reflection->SetFloat(message, F("optional_float"), 111);
- reflection->SetDouble(message, F("optional_double"), 112);
- reflection->SetBool(message, F("optional_bool"), true);
- reflection->SetString(message, F("optional_string"), "115");
- reflection->SetString(message, F("optional_bytes"), "116");
-
- sub_message = reflection->MutableMessage(message, F("optionalgroup"));
- sub_message->GetReflection()->SetInt32(sub_message, group_a_, 117);
- sub_message =
- reflection->MutableMessage(message, F("optional_nested_message"));
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 118);
- sub_message =
- reflection->MutableMessage(message, F("optional_foreign_message"));
- sub_message->GetReflection()->SetInt32(sub_message, foreign_c_, 119);
- sub_message =
- reflection->MutableMessage(message, F("optional_import_message"));
- sub_message->GetReflection()->SetInt32(sub_message, import_d_, 120);
-
- reflection->SetEnum(message, F("optional_nested_enum"), nested_baz_);
- reflection->SetEnum(message, F("optional_foreign_enum"), foreign_baz_);
- reflection->SetEnum(message, F("optional_import_enum"), import_baz_);
-
- reflection->SetString(message, F("optional_string_piece"), "124");
- reflection->SetString(message, F("optional_cord"), "125");
-
- sub_message =
- reflection->MutableMessage(message, F("optional_public_import_message"));
- sub_message->GetReflection()->SetInt32(sub_message, import_e_, 126);
-
- sub_message = reflection->MutableMessage(message, F("optional_lazy_message"));
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 127);
-
- // -----------------------------------------------------------------
-
- reflection->AddInt32(message, F("repeated_int32"), 201);
- reflection->AddInt64(message, F("repeated_int64"), 202);
- reflection->AddUInt32(message, F("repeated_uint32"), 203);
- reflection->AddUInt64(message, F("repeated_uint64"), 204);
- reflection->AddInt32(message, F("repeated_sint32"), 205);
- reflection->AddInt64(message, F("repeated_sint64"), 206);
- reflection->AddUInt32(message, F("repeated_fixed32"), 207);
- reflection->AddUInt64(message, F("repeated_fixed64"), 208);
- reflection->AddInt32(message, F("repeated_sfixed32"), 209);
- reflection->AddInt64(message, F("repeated_sfixed64"), 210);
- reflection->AddFloat(message, F("repeated_float"), 211);
- reflection->AddDouble(message, F("repeated_double"), 212);
- reflection->AddBool(message, F("repeated_bool"), true);
- reflection->AddString(message, F("repeated_string"), "215");
- reflection->AddString(message, F("repeated_bytes"), "216");
-
- sub_message = reflection->AddMessage(message, F("repeatedgroup"));
- sub_message->GetReflection()->SetInt32(sub_message, repeated_group_a_, 217);
- sub_message = reflection->AddMessage(message, F("repeated_nested_message"));
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 218);
- sub_message = reflection->AddMessage(message, F("repeated_foreign_message"));
- sub_message->GetReflection()->SetInt32(sub_message, foreign_c_, 219);
- sub_message = reflection->AddMessage(message, F("repeated_import_message"));
- sub_message->GetReflection()->SetInt32(sub_message, import_d_, 220);
- sub_message = reflection->AddMessage(message, F("repeated_lazy_message"));
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 227);
-
- reflection->AddEnum(message, F("repeated_nested_enum"), nested_bar_);
- reflection->AddEnum(message, F("repeated_foreign_enum"), foreign_bar_);
- reflection->AddEnum(message, F("repeated_import_enum"), import_bar_);
-
- reflection->AddString(message, F("repeated_string_piece"), "224");
- reflection->AddString(message, F("repeated_cord"), "225");
-
- // Add a second one of each field.
- reflection->AddInt32(message, F("repeated_int32"), 301);
- reflection->AddInt64(message, F("repeated_int64"), 302);
- reflection->AddUInt32(message, F("repeated_uint32"), 303);
- reflection->AddUInt64(message, F("repeated_uint64"), 304);
- reflection->AddInt32(message, F("repeated_sint32"), 305);
- reflection->AddInt64(message, F("repeated_sint64"), 306);
- reflection->AddUInt32(message, F("repeated_fixed32"), 307);
- reflection->AddUInt64(message, F("repeated_fixed64"), 308);
- reflection->AddInt32(message, F("repeated_sfixed32"), 309);
- reflection->AddInt64(message, F("repeated_sfixed64"), 310);
- reflection->AddFloat(message, F("repeated_float"), 311);
- reflection->AddDouble(message, F("repeated_double"), 312);
- reflection->AddBool(message, F("repeated_bool"), false);
- reflection->AddString(message, F("repeated_string"), "315");
- reflection->AddString(message, F("repeated_bytes"), "316");
-
- sub_message = reflection->AddMessage(message, F("repeatedgroup"));
- sub_message->GetReflection()->SetInt32(sub_message, repeated_group_a_, 317);
- sub_message = reflection->AddMessage(message, F("repeated_nested_message"));
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 318);
- sub_message = reflection->AddMessage(message, F("repeated_foreign_message"));
- sub_message->GetReflection()->SetInt32(sub_message, foreign_c_, 319);
- sub_message = reflection->AddMessage(message, F("repeated_import_message"));
- sub_message->GetReflection()->SetInt32(sub_message, import_d_, 320);
- sub_message = reflection->AddMessage(message, F("repeated_lazy_message"));
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 327);
-
- reflection->AddEnum(message, F("repeated_nested_enum"), nested_baz_);
- reflection->AddEnum(message, F("repeated_foreign_enum"), foreign_baz_);
- reflection->AddEnum(message, F("repeated_import_enum"), import_baz_);
-
- reflection->AddString(message, F("repeated_string_piece"), "324");
- reflection->AddString(message, F("repeated_cord"), "325");
-
- // -----------------------------------------------------------------
-
- reflection->SetInt32(message, F("default_int32"), 401);
- reflection->SetInt64(message, F("default_int64"), 402);
- reflection->SetUInt32(message, F("default_uint32"), 403);
- reflection->SetUInt64(message, F("default_uint64"), 404);
- reflection->SetInt32(message, F("default_sint32"), 405);
- reflection->SetInt64(message, F("default_sint64"), 406);
- reflection->SetUInt32(message, F("default_fixed32"), 407);
- reflection->SetUInt64(message, F("default_fixed64"), 408);
- reflection->SetInt32(message, F("default_sfixed32"), 409);
- reflection->SetInt64(message, F("default_sfixed64"), 410);
- reflection->SetFloat(message, F("default_float"), 411);
- reflection->SetDouble(message, F("default_double"), 412);
- reflection->SetBool(message, F("default_bool"), false);
- reflection->SetString(message, F("default_string"), "415");
- reflection->SetString(message, F("default_bytes"), "416");
-
- reflection->SetEnum(message, F("default_nested_enum"), nested_foo_);
- reflection->SetEnum(message, F("default_foreign_enum"), foreign_foo_);
- reflection->SetEnum(message, F("default_import_enum"), import_foo_);
-
- reflection->SetString(message, F("default_string_piece"), "424");
- reflection->SetString(message, F("default_cord"), "425");
-
- reflection->SetUInt32(message, F("oneof_uint32"), 601);
- sub_message = reflection->MutableMessage(message, F("oneof_nested_message"));
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 602);
- reflection->SetString(message, F("oneof_string"), "603");
- reflection->SetString(message, F("oneof_bytes"), "604");
-}
-
-inline void TestUtil::ReflectionTester::SetOneofViaReflection(
- Message* message) {
- const Descriptor* descriptor = message->GetDescriptor();
- const Reflection* reflection = message->GetReflection();
- Message* sub_message = reflection->MutableMessage(
- message, descriptor->FindFieldByName("foo_lazy_message"));
- sub_message->GetReflection()->SetInt64(
- sub_message, sub_message->GetDescriptor()->FindFieldByName("qux_int"),
- 100);
-
- reflection->SetString(message, descriptor->FindFieldByName("bar_cord"),
- "101");
- reflection->SetInt32(message, descriptor->FindFieldByName("baz_int"), 102);
- reflection->SetString(message, descriptor->FindFieldByName("baz_string"),
- "103");
-}
-
-inline void TestUtil::ReflectionTester::ExpectOneofSetViaReflection(
- const Message& message) {
- const Descriptor* descriptor = message.GetDescriptor();
- const Reflection* reflection = message.GetReflection();
- string scratch;
- EXPECT_TRUE(reflection->HasField(
- message, descriptor->FindFieldByName("foo_lazy_message")));
- EXPECT_TRUE(
- reflection->HasField(message, descriptor->FindFieldByName("bar_cord")));
- EXPECT_TRUE(
- reflection->HasField(message, descriptor->FindFieldByName("baz_int")));
- EXPECT_TRUE(
- reflection->HasField(message, descriptor->FindFieldByName("baz_string")));
-
- const Message* sub_message = &reflection->GetMessage(
- message, descriptor->FindFieldByName("foo_lazy_message"));
- EXPECT_EQ(100, sub_message->GetReflection()->GetInt64(
- *sub_message,
- sub_message->GetDescriptor()->FindFieldByName("qux_int")));
-
- EXPECT_EQ("101", reflection->GetString(
- message, descriptor->FindFieldByName("bar_cord")));
- EXPECT_EQ("101",
- reflection->GetStringReference(
- message, descriptor->FindFieldByName("bar_cord"), &scratch));
-
- EXPECT_EQ(102, reflection->GetInt32(message,
- descriptor->FindFieldByName("baz_int")));
-
- EXPECT_EQ("103", reflection->GetString(
- message, descriptor->FindFieldByName("baz_string")));
- EXPECT_EQ("103",
- reflection->GetStringReference(
- message, descriptor->FindFieldByName("baz_string"), &scratch));
-}
-
-inline void TestUtil::ReflectionTester::SetPackedFieldsViaReflection(
- Message* message) {
- const Reflection* reflection = message->GetReflection();
- reflection->AddInt32(message, F("packed_int32"), 601);
- reflection->AddInt64(message, F("packed_int64"), 602);
- reflection->AddUInt32(message, F("packed_uint32"), 603);
- reflection->AddUInt64(message, F("packed_uint64"), 604);
- reflection->AddInt32(message, F("packed_sint32"), 605);
- reflection->AddInt64(message, F("packed_sint64"), 606);
- reflection->AddUInt32(message, F("packed_fixed32"), 607);
- reflection->AddUInt64(message, F("packed_fixed64"), 608);
- reflection->AddInt32(message, F("packed_sfixed32"), 609);
- reflection->AddInt64(message, F("packed_sfixed64"), 610);
- reflection->AddFloat(message, F("packed_float"), 611);
- reflection->AddDouble(message, F("packed_double"), 612);
- reflection->AddBool(message, F("packed_bool"), true);
- reflection->AddEnum(message, F("packed_enum"), foreign_bar_);
-
- reflection->AddInt32(message, F("packed_int32"), 701);
- reflection->AddInt64(message, F("packed_int64"), 702);
- reflection->AddUInt32(message, F("packed_uint32"), 703);
- reflection->AddUInt64(message, F("packed_uint64"), 704);
- reflection->AddInt32(message, F("packed_sint32"), 705);
- reflection->AddInt64(message, F("packed_sint64"), 706);
- reflection->AddUInt32(message, F("packed_fixed32"), 707);
- reflection->AddUInt64(message, F("packed_fixed64"), 708);
- reflection->AddInt32(message, F("packed_sfixed32"), 709);
- reflection->AddInt64(message, F("packed_sfixed64"), 710);
- reflection->AddFloat(message, F("packed_float"), 711);
- reflection->AddDouble(message, F("packed_double"), 712);
- reflection->AddBool(message, F("packed_bool"), false);
- reflection->AddEnum(message, F("packed_enum"), foreign_baz_);
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ReflectionTester::ExpectAllFieldsSetViaReflection(
- const Message& message) {
- // We have to split this into three function otherwise it creates a stack
- // frame so large that it triggers a warning.
- ExpectAllFieldsSetViaReflection1(message);
- ExpectAllFieldsSetViaReflection2(message);
- ExpectAllFieldsSetViaReflection3(message);
-}
-
-inline void TestUtil::ReflectionTester::ExpectAllFieldsSetViaReflection1(
- const Message& message) {
- const Reflection* reflection = message.GetReflection();
- string scratch;
- const Message* sub_message;
-
- EXPECT_TRUE(reflection->HasField(message, F("optional_int32")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_int64")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_uint32")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_uint64")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_sint32")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_sint64")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_fixed32")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_fixed64")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_sfixed32")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_sfixed64")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_float")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_double")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_bool")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_string")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_bytes")));
-
- EXPECT_TRUE(reflection->HasField(message, F("optionalgroup")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_nested_message")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_foreign_message")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_import_message")));
- EXPECT_TRUE(
- reflection->HasField(message, F("optional_public_import_message")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_lazy_message")));
-
- sub_message = &reflection->GetMessage(message, F("optionalgroup"));
- EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, group_a_));
- sub_message = &reflection->GetMessage(message, F("optional_nested_message"));
- EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, nested_b_));
- sub_message = &reflection->GetMessage(message, F("optional_foreign_message"));
- EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, foreign_c_));
- sub_message = &reflection->GetMessage(message, F("optional_import_message"));
- EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, import_d_));
- sub_message =
- &reflection->GetMessage(message, F("optional_public_import_message"));
- EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, import_e_));
- sub_message = &reflection->GetMessage(message, F("optional_lazy_message"));
- EXPECT_TRUE(sub_message->GetReflection()->HasField(*sub_message, nested_b_));
-
- EXPECT_TRUE(reflection->HasField(message, F("optional_nested_enum")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_foreign_enum")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_import_enum")));
-
- EXPECT_TRUE(reflection->HasField(message, F("optional_string_piece")));
- EXPECT_TRUE(reflection->HasField(message, F("optional_cord")));
-
- EXPECT_EQ(101, reflection->GetInt32(message, F("optional_int32")));
- EXPECT_EQ(102, reflection->GetInt64(message, F("optional_int64")));
- EXPECT_EQ(103, reflection->GetUInt32(message, F("optional_uint32")));
- EXPECT_EQ(104, reflection->GetUInt64(message, F("optional_uint64")));
- EXPECT_EQ(105, reflection->GetInt32(message, F("optional_sint32")));
- EXPECT_EQ(106, reflection->GetInt64(message, F("optional_sint64")));
- EXPECT_EQ(107, reflection->GetUInt32(message, F("optional_fixed32")));
- EXPECT_EQ(108, reflection->GetUInt64(message, F("optional_fixed64")));
- EXPECT_EQ(109, reflection->GetInt32(message, F("optional_sfixed32")));
- EXPECT_EQ(110, reflection->GetInt64(message, F("optional_sfixed64")));
- EXPECT_EQ(111, reflection->GetFloat(message, F("optional_float")));
- EXPECT_EQ(112, reflection->GetDouble(message, F("optional_double")));
- EXPECT_TRUE(reflection->GetBool(message, F("optional_bool")));
- EXPECT_EQ("115", reflection->GetString(message, F("optional_string")));
- EXPECT_EQ("116", reflection->GetString(message, F("optional_bytes")));
-
- EXPECT_EQ("115", reflection->GetStringReference(message, F("optional_string"),
- &scratch));
- EXPECT_EQ("116", reflection->GetStringReference(message, F("optional_bytes"),
- &scratch));
-
- sub_message = &reflection->GetMessage(message, F("optionalgroup"));
- EXPECT_EQ(117,
- sub_message->GetReflection()->GetInt32(*sub_message, group_a_));
- sub_message = &reflection->GetMessage(message, F("optional_nested_message"));
- EXPECT_EQ(118,
- sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
- sub_message = &reflection->GetMessage(message, F("optional_foreign_message"));
- EXPECT_EQ(119,
- sub_message->GetReflection()->GetInt32(*sub_message, foreign_c_));
- sub_message = &reflection->GetMessage(message, F("optional_import_message"));
- EXPECT_EQ(120,
- sub_message->GetReflection()->GetInt32(*sub_message, import_d_));
- sub_message =
- &reflection->GetMessage(message, F("optional_public_import_message"));
- EXPECT_EQ(126,
- sub_message->GetReflection()->GetInt32(*sub_message, import_e_));
- sub_message = &reflection->GetMessage(message, F("optional_lazy_message"));
- EXPECT_EQ(127,
- sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
-
- EXPECT_EQ(nested_baz_,
- reflection->GetEnum(message, F("optional_nested_enum")));
- EXPECT_EQ(foreign_baz_,
- reflection->GetEnum(message, F("optional_foreign_enum")));
- EXPECT_EQ(import_baz_,
- reflection->GetEnum(message, F("optional_import_enum")));
-
- EXPECT_EQ("124", reflection->GetString(message, F("optional_string_piece")));
- EXPECT_EQ("124", reflection->GetStringReference(
- message, F("optional_string_piece"), &scratch));
-
- EXPECT_EQ("125", reflection->GetString(message, F("optional_cord")));
- EXPECT_EQ("125", reflection->GetStringReference(message, F("optional_cord"),
- &scratch));
-
- EXPECT_TRUE(reflection->HasField(message, F("oneof_bytes")));
- EXPECT_EQ("604", reflection->GetString(message, F("oneof_bytes")));
-
- if (base_descriptor_->name() == "TestAllTypes") {
- EXPECT_FALSE(reflection->HasField(message, F("oneof_uint32")));
- EXPECT_FALSE(reflection->HasField(message, F("oneof_string")));
- } else {
- EXPECT_TRUE(reflection->HasField(message, F("oneof_uint32")));
- EXPECT_TRUE(reflection->HasField(message, F("oneof_string")));
- EXPECT_EQ(601, reflection->GetUInt32(message, F("oneof_uint32")));
- EXPECT_EQ("603", reflection->GetString(message, F("oneof_string")));
- sub_message = &reflection->GetMessage(message, F("oneof_nested_message"));
- EXPECT_EQ(602,
- sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
- }
-}
-
-inline void TestUtil::ReflectionTester::ExpectAllFieldsSetViaReflection2(
- const Message& message) {
- const Reflection* reflection = message.GetReflection();
- string scratch;
- const Message* sub_message;
-
- // -----------------------------------------------------------------
-
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_int32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_int64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_uint32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_uint64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_sint32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_sint64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_fixed32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_fixed64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_sfixed32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_sfixed64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_float")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_double")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_bool")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_string")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_bytes")));
-
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeatedgroup")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_nested_message")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_foreign_message")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_import_message")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_lazy_message")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_nested_enum")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_foreign_enum")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_import_enum")));
-
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_string_piece")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("repeated_cord")));
-
- EXPECT_EQ(201, reflection->GetRepeatedInt32(message, F("repeated_int32"), 0));
- EXPECT_EQ(202, reflection->GetRepeatedInt64(message, F("repeated_int64"), 0));
- EXPECT_EQ(203,
- reflection->GetRepeatedUInt32(message, F("repeated_uint32"), 0));
- EXPECT_EQ(204,
- reflection->GetRepeatedUInt64(message, F("repeated_uint64"), 0));
- EXPECT_EQ(205,
- reflection->GetRepeatedInt32(message, F("repeated_sint32"), 0));
- EXPECT_EQ(206,
- reflection->GetRepeatedInt64(message, F("repeated_sint64"), 0));
- EXPECT_EQ(207,
- reflection->GetRepeatedUInt32(message, F("repeated_fixed32"), 0));
- EXPECT_EQ(208,
- reflection->GetRepeatedUInt64(message, F("repeated_fixed64"), 0));
- EXPECT_EQ(209,
- reflection->GetRepeatedInt32(message, F("repeated_sfixed32"), 0));
- EXPECT_EQ(210,
- reflection->GetRepeatedInt64(message, F("repeated_sfixed64"), 0));
- EXPECT_EQ(211, reflection->GetRepeatedFloat(message, F("repeated_float"), 0));
- EXPECT_EQ(212,
- reflection->GetRepeatedDouble(message, F("repeated_double"), 0));
- EXPECT_TRUE(reflection->GetRepeatedBool(message, F("repeated_bool"), 0));
- EXPECT_EQ("215",
- reflection->GetRepeatedString(message, F("repeated_string"), 0));
- EXPECT_EQ("216",
- reflection->GetRepeatedString(message, F("repeated_bytes"), 0));
-
- EXPECT_EQ("215", reflection->GetRepeatedStringReference(
- message, F("repeated_string"), 0, &scratch));
- EXPECT_EQ("216", reflection->GetRepeatedStringReference(
- message, F("repeated_bytes"), 0, &scratch));
-
- sub_message = &reflection->GetRepeatedMessage(message, F("repeatedgroup"), 0);
- EXPECT_EQ(217, sub_message->GetReflection()->GetInt32(*sub_message,
- repeated_group_a_));
- sub_message =
- &reflection->GetRepeatedMessage(message, F("repeated_nested_message"), 0);
- EXPECT_EQ(218,
- sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
- sub_message = &reflection->GetRepeatedMessage(
- message, F("repeated_foreign_message"), 0);
- EXPECT_EQ(219,
- sub_message->GetReflection()->GetInt32(*sub_message, foreign_c_));
- sub_message =
- &reflection->GetRepeatedMessage(message, F("repeated_import_message"), 0);
- EXPECT_EQ(220,
- sub_message->GetReflection()->GetInt32(*sub_message, import_d_));
- sub_message =
- &reflection->GetRepeatedMessage(message, F("repeated_lazy_message"), 0);
- EXPECT_EQ(227,
- sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
-
- EXPECT_EQ(nested_bar_,
- reflection->GetRepeatedEnum(message, F("repeated_nested_enum"), 0));
- EXPECT_EQ(foreign_bar_, reflection->GetRepeatedEnum(
- message, F("repeated_foreign_enum"), 0));
- EXPECT_EQ(import_bar_,
- reflection->GetRepeatedEnum(message, F("repeated_import_enum"), 0));
-
- EXPECT_EQ("224", reflection->GetRepeatedString(
- message, F("repeated_string_piece"), 0));
- EXPECT_EQ("224", reflection->GetRepeatedStringReference(
- message, F("repeated_string_piece"), 0, &scratch));
-
- EXPECT_EQ("225",
- reflection->GetRepeatedString(message, F("repeated_cord"), 0));
- EXPECT_EQ("225", reflection->GetRepeatedStringReference(
- message, F("repeated_cord"), 0, &scratch));
-
- EXPECT_EQ(301, reflection->GetRepeatedInt32(message, F("repeated_int32"), 1));
- EXPECT_EQ(302, reflection->GetRepeatedInt64(message, F("repeated_int64"), 1));
- EXPECT_EQ(303,
- reflection->GetRepeatedUInt32(message, F("repeated_uint32"), 1));
- EXPECT_EQ(304,
- reflection->GetRepeatedUInt64(message, F("repeated_uint64"), 1));
- EXPECT_EQ(305,
- reflection->GetRepeatedInt32(message, F("repeated_sint32"), 1));
- EXPECT_EQ(306,
- reflection->GetRepeatedInt64(message, F("repeated_sint64"), 1));
- EXPECT_EQ(307,
- reflection->GetRepeatedUInt32(message, F("repeated_fixed32"), 1));
- EXPECT_EQ(308,
- reflection->GetRepeatedUInt64(message, F("repeated_fixed64"), 1));
- EXPECT_EQ(309,
- reflection->GetRepeatedInt32(message, F("repeated_sfixed32"), 1));
- EXPECT_EQ(310,
- reflection->GetRepeatedInt64(message, F("repeated_sfixed64"), 1));
- EXPECT_EQ(311, reflection->GetRepeatedFloat(message, F("repeated_float"), 1));
- EXPECT_EQ(312,
- reflection->GetRepeatedDouble(message, F("repeated_double"), 1));
- EXPECT_FALSE(reflection->GetRepeatedBool(message, F("repeated_bool"), 1));
- EXPECT_EQ("315",
- reflection->GetRepeatedString(message, F("repeated_string"), 1));
- EXPECT_EQ("316",
- reflection->GetRepeatedString(message, F("repeated_bytes"), 1));
-
- EXPECT_EQ("315", reflection->GetRepeatedStringReference(
- message, F("repeated_string"), 1, &scratch));
- EXPECT_EQ("316", reflection->GetRepeatedStringReference(
- message, F("repeated_bytes"), 1, &scratch));
-
- sub_message = &reflection->GetRepeatedMessage(message, F("repeatedgroup"), 1);
- EXPECT_EQ(317, sub_message->GetReflection()->GetInt32(*sub_message,
- repeated_group_a_));
- sub_message =
- &reflection->GetRepeatedMessage(message, F("repeated_nested_message"), 1);
- EXPECT_EQ(318,
- sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
- sub_message = &reflection->GetRepeatedMessage(
- message, F("repeated_foreign_message"), 1);
- EXPECT_EQ(319,
- sub_message->GetReflection()->GetInt32(*sub_message, foreign_c_));
- sub_message =
- &reflection->GetRepeatedMessage(message, F("repeated_import_message"), 1);
- EXPECT_EQ(320,
- sub_message->GetReflection()->GetInt32(*sub_message, import_d_));
- sub_message =
- &reflection->GetRepeatedMessage(message, F("repeated_lazy_message"), 1);
- EXPECT_EQ(327,
- sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
-
- EXPECT_EQ(nested_baz_,
- reflection->GetRepeatedEnum(message, F("repeated_nested_enum"), 1));
- EXPECT_EQ(foreign_baz_, reflection->GetRepeatedEnum(
- message, F("repeated_foreign_enum"), 1));
- EXPECT_EQ(import_baz_,
- reflection->GetRepeatedEnum(message, F("repeated_import_enum"), 1));
-
- EXPECT_EQ("324", reflection->GetRepeatedString(
- message, F("repeated_string_piece"), 1));
- EXPECT_EQ("324", reflection->GetRepeatedStringReference(
- message, F("repeated_string_piece"), 1, &scratch));
-
- EXPECT_EQ("325",
- reflection->GetRepeatedString(message, F("repeated_cord"), 1));
- EXPECT_EQ("325", reflection->GetRepeatedStringReference(
- message, F("repeated_cord"), 1, &scratch));
-}
-
-inline void TestUtil::ReflectionTester::ExpectAllFieldsSetViaReflection3(
- const Message& message) {
- const Reflection* reflection = message.GetReflection();
- string scratch;
-
- // -----------------------------------------------------------------
-
- EXPECT_TRUE(reflection->HasField(message, F("default_int32")));
- EXPECT_TRUE(reflection->HasField(message, F("default_int64")));
- EXPECT_TRUE(reflection->HasField(message, F("default_uint32")));
- EXPECT_TRUE(reflection->HasField(message, F("default_uint64")));
- EXPECT_TRUE(reflection->HasField(message, F("default_sint32")));
- EXPECT_TRUE(reflection->HasField(message, F("default_sint64")));
- EXPECT_TRUE(reflection->HasField(message, F("default_fixed32")));
- EXPECT_TRUE(reflection->HasField(message, F("default_fixed64")));
- EXPECT_TRUE(reflection->HasField(message, F("default_sfixed32")));
- EXPECT_TRUE(reflection->HasField(message, F("default_sfixed64")));
- EXPECT_TRUE(reflection->HasField(message, F("default_float")));
- EXPECT_TRUE(reflection->HasField(message, F("default_double")));
- EXPECT_TRUE(reflection->HasField(message, F("default_bool")));
- EXPECT_TRUE(reflection->HasField(message, F("default_string")));
- EXPECT_TRUE(reflection->HasField(message, F("default_bytes")));
-
- EXPECT_TRUE(reflection->HasField(message, F("default_nested_enum")));
- EXPECT_TRUE(reflection->HasField(message, F("default_foreign_enum")));
- EXPECT_TRUE(reflection->HasField(message, F("default_import_enum")));
-
- EXPECT_TRUE(reflection->HasField(message, F("default_string_piece")));
- EXPECT_TRUE(reflection->HasField(message, F("default_cord")));
-
- EXPECT_EQ(401, reflection->GetInt32(message, F("default_int32")));
- EXPECT_EQ(402, reflection->GetInt64(message, F("default_int64")));
- EXPECT_EQ(403, reflection->GetUInt32(message, F("default_uint32")));
- EXPECT_EQ(404, reflection->GetUInt64(message, F("default_uint64")));
- EXPECT_EQ(405, reflection->GetInt32(message, F("default_sint32")));
- EXPECT_EQ(406, reflection->GetInt64(message, F("default_sint64")));
- EXPECT_EQ(407, reflection->GetUInt32(message, F("default_fixed32")));
- EXPECT_EQ(408, reflection->GetUInt64(message, F("default_fixed64")));
- EXPECT_EQ(409, reflection->GetInt32(message, F("default_sfixed32")));
- EXPECT_EQ(410, reflection->GetInt64(message, F("default_sfixed64")));
- EXPECT_EQ(411, reflection->GetFloat(message, F("default_float")));
- EXPECT_EQ(412, reflection->GetDouble(message, F("default_double")));
- EXPECT_FALSE(reflection->GetBool(message, F("default_bool")));
- EXPECT_EQ("415", reflection->GetString(message, F("default_string")));
- EXPECT_EQ("416", reflection->GetString(message, F("default_bytes")));
-
- EXPECT_EQ("415", reflection->GetStringReference(message, F("default_string"),
- &scratch));
- EXPECT_EQ("416", reflection->GetStringReference(message, F("default_bytes"),
- &scratch));
-
- EXPECT_EQ(nested_foo_,
- reflection->GetEnum(message, F("default_nested_enum")));
- EXPECT_EQ(foreign_foo_,
- reflection->GetEnum(message, F("default_foreign_enum")));
- EXPECT_EQ(import_foo_,
- reflection->GetEnum(message, F("default_import_enum")));
-
- EXPECT_EQ("424", reflection->GetString(message, F("default_string_piece")));
- EXPECT_EQ("424", reflection->GetStringReference(
- message, F("default_string_piece"), &scratch));
-
- EXPECT_EQ("425", reflection->GetString(message, F("default_cord")));
- EXPECT_EQ("425", reflection->GetStringReference(message, F("default_cord"),
- &scratch));
-}
-
-inline void TestUtil::ReflectionTester::ExpectPackedFieldsSetViaReflection(
- const Message& message) {
- const Reflection* reflection = message.GetReflection();
-
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_int32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_int64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_uint32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_uint64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_sint32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_sint64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_fixed32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_fixed64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_sfixed32")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_sfixed64")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_float")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_double")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_bool")));
- ASSERT_EQ(2, reflection->FieldSize(message, F("packed_enum")));
-
- EXPECT_EQ(601, reflection->GetRepeatedInt32(message, F("packed_int32"), 0));
- EXPECT_EQ(602, reflection->GetRepeatedInt64(message, F("packed_int64"), 0));
- EXPECT_EQ(603, reflection->GetRepeatedUInt32(message, F("packed_uint32"), 0));
- EXPECT_EQ(604, reflection->GetRepeatedUInt64(message, F("packed_uint64"), 0));
- EXPECT_EQ(605, reflection->GetRepeatedInt32(message, F("packed_sint32"), 0));
- EXPECT_EQ(606, reflection->GetRepeatedInt64(message, F("packed_sint64"), 0));
- EXPECT_EQ(607,
- reflection->GetRepeatedUInt32(message, F("packed_fixed32"), 0));
- EXPECT_EQ(608,
- reflection->GetRepeatedUInt64(message, F("packed_fixed64"), 0));
- EXPECT_EQ(609,
- reflection->GetRepeatedInt32(message, F("packed_sfixed32"), 0));
- EXPECT_EQ(610,
- reflection->GetRepeatedInt64(message, F("packed_sfixed64"), 0));
- EXPECT_EQ(611, reflection->GetRepeatedFloat(message, F("packed_float"), 0));
- EXPECT_EQ(612, reflection->GetRepeatedDouble(message, F("packed_double"), 0));
- EXPECT_TRUE(reflection->GetRepeatedBool(message, F("packed_bool"), 0));
- EXPECT_EQ(foreign_bar_,
- reflection->GetRepeatedEnum(message, F("packed_enum"), 0));
-
- EXPECT_EQ(701, reflection->GetRepeatedInt32(message, F("packed_int32"), 1));
- EXPECT_EQ(702, reflection->GetRepeatedInt64(message, F("packed_int64"), 1));
- EXPECT_EQ(703, reflection->GetRepeatedUInt32(message, F("packed_uint32"), 1));
- EXPECT_EQ(704, reflection->GetRepeatedUInt64(message, F("packed_uint64"), 1));
- EXPECT_EQ(705, reflection->GetRepeatedInt32(message, F("packed_sint32"), 1));
- EXPECT_EQ(706, reflection->GetRepeatedInt64(message, F("packed_sint64"), 1));
- EXPECT_EQ(707,
- reflection->GetRepeatedUInt32(message, F("packed_fixed32"), 1));
- EXPECT_EQ(708,
- reflection->GetRepeatedUInt64(message, F("packed_fixed64"), 1));
- EXPECT_EQ(709,
- reflection->GetRepeatedInt32(message, F("packed_sfixed32"), 1));
- EXPECT_EQ(710,
- reflection->GetRepeatedInt64(message, F("packed_sfixed64"), 1));
- EXPECT_EQ(711, reflection->GetRepeatedFloat(message, F("packed_float"), 1));
- EXPECT_EQ(712, reflection->GetRepeatedDouble(message, F("packed_double"), 1));
- EXPECT_FALSE(reflection->GetRepeatedBool(message, F("packed_bool"), 1));
- EXPECT_EQ(foreign_baz_,
- reflection->GetRepeatedEnum(message, F("packed_enum"), 1));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ReflectionTester::ExpectClearViaReflection(
- const Message& message) {
- const Reflection* reflection = message.GetReflection();
- string scratch;
- const Message* sub_message;
-
- // has_blah() should initially be false for all optional fields.
- EXPECT_FALSE(reflection->HasField(message, F("optional_int32")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_int64")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_uint32")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_uint64")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_sint32")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_sint64")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_fixed32")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_fixed64")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_sfixed32")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_sfixed64")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_float")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_double")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_bool")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_string")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_bytes")));
-
- EXPECT_FALSE(reflection->HasField(message, F("optionalgroup")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_nested_message")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_foreign_message")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_import_message")));
- EXPECT_FALSE(
- reflection->HasField(message, F("optional_public_import_message")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_lazy_message")));
-
- EXPECT_FALSE(reflection->HasField(message, F("optional_nested_enum")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_foreign_enum")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_import_enum")));
-
- EXPECT_FALSE(reflection->HasField(message, F("optional_string_piece")));
- EXPECT_FALSE(reflection->HasField(message, F("optional_cord")));
-
- // Optional fields without defaults are set to zero or something like it.
- EXPECT_EQ(0, reflection->GetInt32(message, F("optional_int32")));
- EXPECT_EQ(0, reflection->GetInt64(message, F("optional_int64")));
- EXPECT_EQ(0, reflection->GetUInt32(message, F("optional_uint32")));
- EXPECT_EQ(0, reflection->GetUInt64(message, F("optional_uint64")));
- EXPECT_EQ(0, reflection->GetInt32(message, F("optional_sint32")));
- EXPECT_EQ(0, reflection->GetInt64(message, F("optional_sint64")));
- EXPECT_EQ(0, reflection->GetUInt32(message, F("optional_fixed32")));
- EXPECT_EQ(0, reflection->GetUInt64(message, F("optional_fixed64")));
- EXPECT_EQ(0, reflection->GetInt32(message, F("optional_sfixed32")));
- EXPECT_EQ(0, reflection->GetInt64(message, F("optional_sfixed64")));
- EXPECT_EQ(0, reflection->GetFloat(message, F("optional_float")));
- EXPECT_EQ(0, reflection->GetDouble(message, F("optional_double")));
- EXPECT_FALSE(reflection->GetBool(message, F("optional_bool")));
- EXPECT_EQ("", reflection->GetString(message, F("optional_string")));
- EXPECT_EQ("", reflection->GetString(message, F("optional_bytes")));
-
- EXPECT_EQ("", reflection->GetStringReference(message, F("optional_string"),
- &scratch));
- EXPECT_EQ("", reflection->GetStringReference(message, F("optional_bytes"),
- &scratch));
-
- // Embedded messages should also be clear.
- sub_message = &reflection->GetMessage(message, F("optionalgroup"));
- EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, group_a_));
- EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, group_a_));
- sub_message = &reflection->GetMessage(message, F("optional_nested_message"));
- EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, nested_b_));
- EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
- sub_message = &reflection->GetMessage(message, F("optional_foreign_message"));
- EXPECT_FALSE(
- sub_message->GetReflection()->HasField(*sub_message, foreign_c_));
- EXPECT_EQ(0,
- sub_message->GetReflection()->GetInt32(*sub_message, foreign_c_));
- sub_message = &reflection->GetMessage(message, F("optional_import_message"));
- EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, import_d_));
- EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, import_d_));
- sub_message =
- &reflection->GetMessage(message, F("optional_public_import_message"));
- EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, import_e_));
- EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, import_e_));
- sub_message = &reflection->GetMessage(message, F("optional_lazy_message"));
- EXPECT_FALSE(sub_message->GetReflection()->HasField(*sub_message, nested_b_));
- EXPECT_EQ(0, sub_message->GetReflection()->GetInt32(*sub_message, nested_b_));
-
- // Enums without defaults are set to the first value in the enum.
- EXPECT_EQ(nested_foo_,
- reflection->GetEnum(message, F("optional_nested_enum")));
- EXPECT_EQ(foreign_foo_,
- reflection->GetEnum(message, F("optional_foreign_enum")));
- EXPECT_EQ(import_foo_,
- reflection->GetEnum(message, F("optional_import_enum")));
-
- EXPECT_EQ("", reflection->GetString(message, F("optional_string_piece")));
- EXPECT_EQ("", reflection->GetStringReference(
- message, F("optional_string_piece"), &scratch));
-
- EXPECT_EQ("", reflection->GetString(message, F("optional_cord")));
- EXPECT_EQ("", reflection->GetStringReference(message, F("optional_cord"),
- &scratch));
-
- // Repeated fields are empty.
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_int32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_int64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_uint32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_uint64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_sint32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_sint64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_fixed32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_fixed64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_sfixed32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_sfixed64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_float")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_double")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_bool")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_string")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_bytes")));
-
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeatedgroup")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_nested_message")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_foreign_message")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_import_message")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_lazy_message")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_nested_enum")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_foreign_enum")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_import_enum")));
-
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_string_piece")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("repeated_cord")));
-
- // has_blah() should also be false for all default fields.
- EXPECT_FALSE(reflection->HasField(message, F("default_int32")));
- EXPECT_FALSE(reflection->HasField(message, F("default_int64")));
- EXPECT_FALSE(reflection->HasField(message, F("default_uint32")));
- EXPECT_FALSE(reflection->HasField(message, F("default_uint64")));
- EXPECT_FALSE(reflection->HasField(message, F("default_sint32")));
- EXPECT_FALSE(reflection->HasField(message, F("default_sint64")));
- EXPECT_FALSE(reflection->HasField(message, F("default_fixed32")));
- EXPECT_FALSE(reflection->HasField(message, F("default_fixed64")));
- EXPECT_FALSE(reflection->HasField(message, F("default_sfixed32")));
- EXPECT_FALSE(reflection->HasField(message, F("default_sfixed64")));
- EXPECT_FALSE(reflection->HasField(message, F("default_float")));
- EXPECT_FALSE(reflection->HasField(message, F("default_double")));
- EXPECT_FALSE(reflection->HasField(message, F("default_bool")));
- EXPECT_FALSE(reflection->HasField(message, F("default_string")));
- EXPECT_FALSE(reflection->HasField(message, F("default_bytes")));
-
- EXPECT_FALSE(reflection->HasField(message, F("default_nested_enum")));
- EXPECT_FALSE(reflection->HasField(message, F("default_foreign_enum")));
- EXPECT_FALSE(reflection->HasField(message, F("default_import_enum")));
-
- EXPECT_FALSE(reflection->HasField(message, F("default_string_piece")));
- EXPECT_FALSE(reflection->HasField(message, F("default_cord")));
-
- // Fields with defaults have their default values (duh).
- EXPECT_EQ(41, reflection->GetInt32(message, F("default_int32")));
- EXPECT_EQ(42, reflection->GetInt64(message, F("default_int64")));
- EXPECT_EQ(43, reflection->GetUInt32(message, F("default_uint32")));
- EXPECT_EQ(44, reflection->GetUInt64(message, F("default_uint64")));
- EXPECT_EQ(-45, reflection->GetInt32(message, F("default_sint32")));
- EXPECT_EQ(46, reflection->GetInt64(message, F("default_sint64")));
- EXPECT_EQ(47, reflection->GetUInt32(message, F("default_fixed32")));
- EXPECT_EQ(48, reflection->GetUInt64(message, F("default_fixed64")));
- EXPECT_EQ(49, reflection->GetInt32(message, F("default_sfixed32")));
- EXPECT_EQ(-50, reflection->GetInt64(message, F("default_sfixed64")));
- EXPECT_EQ(51.5, reflection->GetFloat(message, F("default_float")));
- EXPECT_EQ(52e3, reflection->GetDouble(message, F("default_double")));
- EXPECT_TRUE(reflection->GetBool(message, F("default_bool")));
- EXPECT_EQ("hello", reflection->GetString(message, F("default_string")));
- EXPECT_EQ("world", reflection->GetString(message, F("default_bytes")));
-
- EXPECT_EQ("hello", reflection->GetStringReference(
- message, F("default_string"), &scratch));
- EXPECT_EQ("world", reflection->GetStringReference(message, F("default_bytes"),
- &scratch));
-
- EXPECT_EQ(nested_bar_,
- reflection->GetEnum(message, F("default_nested_enum")));
- EXPECT_EQ(foreign_bar_,
- reflection->GetEnum(message, F("default_foreign_enum")));
- EXPECT_EQ(import_bar_,
- reflection->GetEnum(message, F("default_import_enum")));
-
- EXPECT_EQ("abc", reflection->GetString(message, F("default_string_piece")));
- EXPECT_EQ("abc", reflection->GetStringReference(
- message, F("default_string_piece"), &scratch));
-
- EXPECT_EQ("123", reflection->GetString(message, F("default_cord")));
- EXPECT_EQ("123", reflection->GetStringReference(message, F("default_cord"),
- &scratch));
-}
-
-inline void TestUtil::ReflectionTester::ExpectPackedClearViaReflection(
- const Message& message) {
- const Reflection* reflection = message.GetReflection();
-
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_int32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_int64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_uint32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_uint64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_sint32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_sint64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_fixed32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_fixed64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_sfixed32")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_sfixed64")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_float")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_double")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_bool")));
- EXPECT_EQ(0, reflection->FieldSize(message, F("packed_enum")));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ReflectionTester::ModifyRepeatedFieldsViaReflection(
- Message* message) {
- const Reflection* reflection = message->GetReflection();
- Message* sub_message;
-
- reflection->SetRepeatedInt32(message, F("repeated_int32"), 1, 501);
- reflection->SetRepeatedInt64(message, F("repeated_int64"), 1, 502);
- reflection->SetRepeatedUInt32(message, F("repeated_uint32"), 1, 503);
- reflection->SetRepeatedUInt64(message, F("repeated_uint64"), 1, 504);
- reflection->SetRepeatedInt32(message, F("repeated_sint32"), 1, 505);
- reflection->SetRepeatedInt64(message, F("repeated_sint64"), 1, 506);
- reflection->SetRepeatedUInt32(message, F("repeated_fixed32"), 1, 507);
- reflection->SetRepeatedUInt64(message, F("repeated_fixed64"), 1, 508);
- reflection->SetRepeatedInt32(message, F("repeated_sfixed32"), 1, 509);
- reflection->SetRepeatedInt64(message, F("repeated_sfixed64"), 1, 510);
- reflection->SetRepeatedFloat(message, F("repeated_float"), 1, 511);
- reflection->SetRepeatedDouble(message, F("repeated_double"), 1, 512);
- reflection->SetRepeatedBool(message, F("repeated_bool"), 1, true);
- reflection->SetRepeatedString(message, F("repeated_string"), 1, "515");
- reflection->SetRepeatedString(message, F("repeated_bytes"), 1, "516");
-
- sub_message =
- reflection->MutableRepeatedMessage(message, F("repeatedgroup"), 1);
- sub_message->GetReflection()->SetInt32(sub_message, repeated_group_a_, 517);
- sub_message = reflection->MutableRepeatedMessage(
- message, F("repeated_nested_message"), 1);
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 518);
- sub_message = reflection->MutableRepeatedMessage(
- message, F("repeated_foreign_message"), 1);
- sub_message->GetReflection()->SetInt32(sub_message, foreign_c_, 519);
- sub_message = reflection->MutableRepeatedMessage(
- message, F("repeated_import_message"), 1);
- sub_message->GetReflection()->SetInt32(sub_message, import_d_, 520);
- sub_message = reflection->MutableRepeatedMessage(
- message, F("repeated_lazy_message"), 1);
- sub_message->GetReflection()->SetInt32(sub_message, nested_b_, 527);
-
- reflection->SetRepeatedEnum(message, F("repeated_nested_enum"), 1,
- nested_foo_);
- reflection->SetRepeatedEnum(message, F("repeated_foreign_enum"), 1,
- foreign_foo_);
- reflection->SetRepeatedEnum(message, F("repeated_import_enum"), 1,
- import_foo_);
-
- reflection->SetRepeatedString(message, F("repeated_string_piece"), 1, "524");
- reflection->SetRepeatedString(message, F("repeated_cord"), 1, "525");
-}
-
-inline void TestUtil::ReflectionTester::ModifyPackedFieldsViaReflection(
- Message* message) {
- const Reflection* reflection = message->GetReflection();
- reflection->SetRepeatedInt32(message, F("packed_int32"), 1, 801);
- reflection->SetRepeatedInt64(message, F("packed_int64"), 1, 802);
- reflection->SetRepeatedUInt32(message, F("packed_uint32"), 1, 803);
- reflection->SetRepeatedUInt64(message, F("packed_uint64"), 1, 804);
- reflection->SetRepeatedInt32(message, F("packed_sint32"), 1, 805);
- reflection->SetRepeatedInt64(message, F("packed_sint64"), 1, 806);
- reflection->SetRepeatedUInt32(message, F("packed_fixed32"), 1, 807);
- reflection->SetRepeatedUInt64(message, F("packed_fixed64"), 1, 808);
- reflection->SetRepeatedInt32(message, F("packed_sfixed32"), 1, 809);
- reflection->SetRepeatedInt64(message, F("packed_sfixed64"), 1, 810);
- reflection->SetRepeatedFloat(message, F("packed_float"), 1, 811);
- reflection->SetRepeatedDouble(message, F("packed_double"), 1, 812);
- reflection->SetRepeatedBool(message, F("packed_bool"), 1, true);
- reflection->SetRepeatedEnum(message, F("packed_enum"), 1, foreign_foo_);
-}
-
-inline void TestUtil::ReflectionTester::RemoveLastRepeatedsViaReflection(
- Message* message) {
- const Reflection* reflection = message->GetReflection();
-
- std::vector<const FieldDescriptor*> output;
- reflection->ListFields(*message, &output);
- for (int i = 0; i < output.size(); ++i) {
- const FieldDescriptor* field = output[i];
- if (!field->is_repeated()) continue;
-
- reflection->RemoveLast(message, field);
- }
-}
-
-inline void TestUtil::ReflectionTester::ReleaseLastRepeatedsViaReflection(
- Message* message, bool expect_extensions_notnull) {
- const Reflection* reflection = message->GetReflection();
-
- std::vector<const FieldDescriptor*> output;
- reflection->ListFields(*message, &output);
- for (int i = 0; i < output.size(); ++i) {
- const FieldDescriptor* field = output[i];
- if (!field->is_repeated()) continue;
- if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) continue;
-
- Message* released = reflection->ReleaseLast(message, field);
- if (!field->is_extension() || expect_extensions_notnull) {
- ASSERT_TRUE(released != nullptr)
- << "ReleaseLast returned nullptr for: " << field->name();
- }
- delete released;
- }
-}
-
-inline void TestUtil::ReflectionTester::SwapRepeatedsViaReflection(
- Message* message) {
- const Reflection* reflection = message->GetReflection();
-
- std::vector<const FieldDescriptor*> output;
- reflection->ListFields(*message, &output);
- for (int i = 0; i < output.size(); ++i) {
- const FieldDescriptor* field = output[i];
- if (!field->is_repeated()) continue;
-
- reflection->SwapElements(message, field, 0, 1);
- }
-}
-
-inline void TestUtil::ReflectionTester::
- SetAllocatedOptionalMessageFieldsToNullViaReflection(Message* message) {
- const Reflection* reflection = message->GetReflection();
-
- std::vector<const FieldDescriptor*> fields;
- reflection->ListFields(*message, &fields);
-
- for (int i = 0; i < fields.size(); ++i) {
- const FieldDescriptor* field = fields[i];
- if (!field->is_optional() ||
- field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE)
- continue;
-
- reflection->SetAllocatedMessage(message, nullptr, field);
- }
-}
-
-inline void TestUtil::ReflectionTester::
- SetAllocatedOptionalMessageFieldsToMessageViaReflection(
- Message* from_message, Message* to_message) {
- EXPECT_EQ(from_message->GetDescriptor(), to_message->GetDescriptor());
- const Reflection* from_reflection = from_message->GetReflection();
- const Reflection* to_reflection = to_message->GetReflection();
-
- std::vector<const FieldDescriptor*> fields;
- from_reflection->ListFields(*from_message, &fields);
-
- for (int i = 0; i < fields.size(); ++i) {
- const FieldDescriptor* field = fields[i];
- if (!field->is_optional() ||
- field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE)
- continue;
-
- Message* sub_message = from_reflection->ReleaseMessage(from_message, field);
- to_reflection->SetAllocatedMessage(to_message, sub_message, field);
- }
-}
-
-inline void TestUtil::ReflectionTester::ExpectMessagesReleasedViaReflection(
- Message* message,
- TestUtil::ReflectionTester::MessageReleaseState expected_release_state) {
- const Reflection* reflection = message->GetReflection();
-
- static const char* fields[] = {
- "optionalgroup",
- "optional_nested_message",
- "optional_foreign_message",
- "optional_import_message",
- };
- for (int i = 0; i < GOOGLE_ARRAYSIZE(fields); i++) {
- const Message& sub_message = reflection->GetMessage(*message, F(fields[i]));
- Message* released = reflection->ReleaseMessage(message, F(fields[i]));
- switch (expected_release_state) {
- case IS_NULL:
- EXPECT_TRUE(released == nullptr);
- break;
- case NOT_NULL:
- EXPECT_TRUE(released != nullptr);
- if (message->GetArena() == nullptr) {
- // released message must be same as sub_message if source message is
- // not on arena.
- EXPECT_EQ(&sub_message, released);
- }
- break;
- case CAN_BE_NULL:
- break;
- }
- delete released;
- EXPECT_FALSE(reflection->HasField(*message, F(fields[i])));
- }
-}
-
-// Check that the passed-in serialization is the canonical serialization we
-// expect for a TestFieldOrderings message filled in by
-// SetAllFieldsAndExtensions().
-inline void ExpectAllFieldsAndExtensionsInOrder(
- const string& serialized) {
- // We set each field individually, serialize separately, and concatenate all
- // the strings in canonical order to determine the expected serialization.
- string expected;
- unittest::TestFieldOrderings message;
- message.set_my_int(1); // Field 1.
- message.AppendToString(&expected);
- message.Clear();
- message.SetExtension(unittest::my_extension_int, 23); // Field 5.
- message.AppendToString(&expected);
- message.Clear();
- message.set_my_string("foo"); // Field 11.
- message.AppendToString(&expected);
- message.Clear();
- message.SetExtension(unittest::my_extension_string, "bar"); // Field 50.
- message.AppendToString(&expected);
- message.Clear();
- message.set_my_float(1.0); // Field 101.
- message.AppendToString(&expected);
- message.Clear();
-
- // We don't EXPECT_EQ() since we don't want to print raw bytes to stdout.
- EXPECT_TRUE(serialized == expected);
-}
-
-} // namespace TestUtil
-} // namespace protobuf
-
-} // namespace google
-#endif // GOOGLE_PROTOBUF_TEST_UTIL_H__
diff --git a/third_party/protobuf/3.6.0/src/google/protobuf/test_util.inc b/third_party/protobuf/3.6.0/src/google/protobuf/test_util.inc
deleted file mode 100644
index 185f68d901..0000000000
--- a/third_party/protobuf/3.6.0/src/google/protobuf/test_util.inc
+++ /dev/null
@@ -1,2600 +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.
-//
-// This file needs to be included as .inc as it depends on the namespaces
-// (unittest and unittest_import) being set up properly. It is also included
-// within an enclosing namespace and requires header files to be included
-// out of this file.
-
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/descriptor.h>
-#include <google/protobuf/message.h>
-#include <google/protobuf/testing/googletest.h>
-#include <gtest/gtest.h>
-
-namespace google {
-namespace protobuf {
-namespace TestUtil {
-
-// Set every field in the message to a unique value.
-inline void SetAllFields(UNITTEST::TestAllTypes* message);
-inline void SetOptionalFields(UNITTEST::TestAllTypes* message);
-inline void AddRepeatedFields1(UNITTEST::TestAllTypes* message);
-inline void AddRepeatedFields2(UNITTEST::TestAllTypes* message);
-inline void SetDefaultFields(UNITTEST::TestAllTypes* message);
-inline void SetOneofFields(UNITTEST::TestAllTypes* message);
-inline void SetAllExtensions(UNITTEST::TestAllExtensions* message);
-inline void SetOneofFields(UNITTEST::TestAllExtensions* message);
-inline void SetAllFieldsAndExtensions(UNITTEST::TestFieldOrderings* message);
-inline void SetPackedFields(UNITTEST::TestPackedTypes* message);
-inline void SetPackedExtensions(UNITTEST::TestPackedExtensions* message);
-inline void SetUnpackedFields(UNITTEST::TestUnpackedTypes* message);
-inline void SetOneof1(UNITTEST::TestOneof2* message);
-inline void SetOneof2(UNITTEST::TestOneof2* message);
-
-// Use the repeated versions of the set_*() accessors to modify all the
-// repeated fields of the message (which should already have been
-// initialized with Set*Fields()). Set*Fields() itself only tests
-// the add_*() accessors.
-inline void ModifyRepeatedFields(UNITTEST::TestAllTypes* message);
-inline void ModifyRepeatedExtensions(UNITTEST::TestAllExtensions* message);
-inline void ModifyPackedFields(UNITTEST::TestPackedTypes* message);
-inline void ModifyPackedExtensions(UNITTEST::TestPackedExtensions* message);
-
-// Check that all fields have the values that they should have after
-// Set*Fields() is called.
-inline void ExpectAllFieldsSet(const UNITTEST::TestAllTypes& message);
-inline void ExpectAllExtensionsSet(const UNITTEST::TestAllExtensions& message);
-inline void ExpectPackedFieldsSet(const UNITTEST::TestPackedTypes& message);
-inline void ExpectPackedExtensionsSet(
- const UNITTEST::TestPackedExtensions& message);
-inline void ExpectUnpackedFieldsSet(const UNITTEST::TestUnpackedTypes& message);
-inline void ExpectUnpackedExtensionsSet(
- const UNITTEST::TestUnpackedExtensions& message);
-inline void ExpectOneofSet1(const UNITTEST::TestOneof2& message);
-inline void ExpectOneofSet2(const UNITTEST::TestOneof2& message);
-
-// Expect that the message is modified as would be expected from
-// Modify*Fields().
-inline void ExpectRepeatedFieldsModified(const UNITTEST::TestAllTypes& message);
-inline void ExpectRepeatedExtensionsModified(
- const UNITTEST::TestAllExtensions& message);
-inline void ExpectPackedFieldsModified(
- const UNITTEST::TestPackedTypes& message);
-inline void ExpectPackedExtensionsModified(
- const UNITTEST::TestPackedExtensions& message);
-
-// Check that all fields have their default values.
-inline void ExpectClear(const UNITTEST::TestAllTypes& message);
-inline void ExpectExtensionsClear(const UNITTEST::TestAllExtensions& message);
-inline void ExpectPackedClear(const UNITTEST::TestPackedTypes& message);
-inline void ExpectPackedExtensionsClear(
- const UNITTEST::TestPackedExtensions& message);
-inline void ExpectOneofClear(const UNITTEST::TestOneof2& message);
-
-// Check that all repeated fields have had their last elements removed.
-inline void ExpectLastRepeatedsRemoved(const UNITTEST::TestAllTypes& message);
-inline void ExpectLastRepeatedExtensionsRemoved(
- const UNITTEST::TestAllExtensions& message);
-inline void ExpectLastRepeatedsReleased(const UNITTEST::TestAllTypes& message);
-inline void ExpectLastRepeatedExtensionsReleased(
- const UNITTEST::TestAllExtensions& message);
-
-// Check that all repeated fields have had their first and last elements
-// swapped.
-inline void ExpectRepeatedsSwapped(const UNITTEST::TestAllTypes& message);
-inline void ExpectRepeatedExtensionsSwapped(
- const UNITTEST::TestAllExtensions& message);
-
-inline void ExpectAtMostOneFieldSetInOneof(const UNITTEST::TestOneof2& message);
-
-} // namespace TestUtil
-
-inline void TestUtil::SetAllFields(UNITTEST::TestAllTypes* message) {
- SetOptionalFields(message);
- AddRepeatedFields1(message);
- AddRepeatedFields2(message);
- SetDefaultFields(message);
- SetOneofFields(message);
-}
-
-inline void TestUtil::SetOptionalFields(UNITTEST::TestAllTypes* message) {
- message->set_optional_int32(101);
- message->set_optional_int64(102);
- message->set_optional_uint32(103);
- message->set_optional_uint64(104);
- message->set_optional_sint32(105);
- message->set_optional_sint64(106);
- message->set_optional_fixed32(107);
- message->set_optional_fixed64(108);
- message->set_optional_sfixed32(109);
- message->set_optional_sfixed64(110);
- message->set_optional_float(111);
- message->set_optional_double(112);
- message->set_optional_bool(true);
- message->set_optional_string("115");
- message->set_optional_bytes("116");
-
- message->mutable_optionalgroup()->set_a(117);
- message->mutable_optional_nested_message()->set_bb(118);
- message->mutable_optional_foreign_message()->set_c(119);
- message->mutable_optional_import_message()->set_d(120);
- message->mutable_optional_public_import_message()->set_e(126);
- message->mutable_optional_lazy_message()->set_bb(127);
-
- message->set_optional_nested_enum(UNITTEST::TestAllTypes::BAZ);
- message->set_optional_foreign_enum(UNITTEST::FOREIGN_BAZ);
- message->set_optional_import_enum(UNITTEST_IMPORT::IMPORT_BAZ);
-
- // StringPiece and Cord fields are only accessible via reflection in the
- // open source release; see comments in compiler/cpp/string_field.cc.
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- message->GetReflection()->SetString(
- message,
- message->GetDescriptor()->FindFieldByName("optional_string_piece"),
- "124");
- message->GetReflection()->SetString(
- message, message->GetDescriptor()->FindFieldByName("optional_cord"),
- "125");
-#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::AddRepeatedFields1(UNITTEST::TestAllTypes* message) {
- message->add_repeated_int32(201);
- message->add_repeated_int64(202);
- message->add_repeated_uint32(203);
- message->add_repeated_uint64(204);
- message->add_repeated_sint32(205);
- message->add_repeated_sint64(206);
- message->add_repeated_fixed32(207);
- message->add_repeated_fixed64(208);
- message->add_repeated_sfixed32(209);
- message->add_repeated_sfixed64(210);
- message->add_repeated_float(211);
- message->add_repeated_double(212);
- message->add_repeated_bool(true);
- message->add_repeated_string("215");
- message->add_repeated_bytes("216");
-
- message->add_repeatedgroup()->set_a(217);
- message->add_repeated_nested_message()->set_bb(218);
- message->add_repeated_foreign_message()->set_c(219);
- message->add_repeated_import_message()->set_d(220);
- message->add_repeated_lazy_message()->set_bb(227);
-
- message->add_repeated_nested_enum(UNITTEST::TestAllTypes::BAR);
- message->add_repeated_foreign_enum(UNITTEST::FOREIGN_BAR);
- message->add_repeated_import_enum(UNITTEST_IMPORT::IMPORT_BAR);
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- message->GetReflection()->AddString(
- message,
- message->GetDescriptor()->FindFieldByName("repeated_string_piece"),
- "224");
- message->GetReflection()->AddString(
- message, message->GetDescriptor()->FindFieldByName("repeated_cord"),
- "225");
-#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
-}
-
-inline void TestUtil::AddRepeatedFields2(UNITTEST::TestAllTypes* message) {
- // Add a second one of each field.
- message->add_repeated_int32(301);
- message->add_repeated_int64(302);
- message->add_repeated_uint32(303);
- message->add_repeated_uint64(304);
- message->add_repeated_sint32(305);
- message->add_repeated_sint64(306);
- message->add_repeated_fixed32(307);
- message->add_repeated_fixed64(308);
- message->add_repeated_sfixed32(309);
- message->add_repeated_sfixed64(310);
- message->add_repeated_float(311);
- message->add_repeated_double(312);
- message->add_repeated_bool(false);
- message->add_repeated_string("315");
- message->add_repeated_bytes("316");
-
- message->add_repeatedgroup()->set_a(317);
- message->add_repeated_nested_message()->set_bb(318);
- message->add_repeated_foreign_message()->set_c(319);
- message->add_repeated_import_message()->set_d(320);
- message->add_repeated_lazy_message()->set_bb(327);
-
- message->add_repeated_nested_enum(UNITTEST::TestAllTypes::BAZ);
- message->add_repeated_foreign_enum(UNITTEST::FOREIGN_BAZ);
- message->add_repeated_import_enum(UNITTEST_IMPORT::IMPORT_BAZ);
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- message->GetReflection()->AddString(
- message,
- message->GetDescriptor()->FindFieldByName("repeated_string_piece"),
- "324");
- message->GetReflection()->AddString(
- message, message->GetDescriptor()->FindFieldByName("repeated_cord"),
- "325");
-#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::SetDefaultFields(UNITTEST::TestAllTypes* message) {
- message->set_default_int32(401);
- message->set_default_int64(402);
- message->set_default_uint32(403);
- message->set_default_uint64(404);
- message->set_default_sint32(405);
- message->set_default_sint64(406);
- message->set_default_fixed32(407);
- message->set_default_fixed64(408);
- message->set_default_sfixed32(409);
- message->set_default_sfixed64(410);
- message->set_default_float(411);
- message->set_default_double(412);
- message->set_default_bool(false);
- message->set_default_string("415");
- message->set_default_bytes("416");
-
- message->set_default_nested_enum(UNITTEST::TestAllTypes::FOO);
- message->set_default_foreign_enum(UNITTEST::FOREIGN_FOO);
- message->set_default_import_enum(UNITTEST_IMPORT::IMPORT_FOO);
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- message->GetReflection()->SetString(
- message,
- message->GetDescriptor()->FindFieldByName("default_string_piece"), "424");
- message->GetReflection()->SetString(
- message, message->GetDescriptor()->FindFieldByName("default_cord"),
- "425");
-#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ModifyRepeatedFields(UNITTEST::TestAllTypes* message) {
- message->set_repeated_int32(1, 501);
- message->set_repeated_int64(1, 502);
- message->set_repeated_uint32(1, 503);
- message->set_repeated_uint64(1, 504);
- message->set_repeated_sint32(1, 505);
- message->set_repeated_sint64(1, 506);
- message->set_repeated_fixed32(1, 507);
- message->set_repeated_fixed64(1, 508);
- message->set_repeated_sfixed32(1, 509);
- message->set_repeated_sfixed64(1, 510);
- message->set_repeated_float(1, 511);
- message->set_repeated_double(1, 512);
- message->set_repeated_bool(1, true);
- message->set_repeated_string(1, "515");
- message->set_repeated_bytes(1, "516");
-
- message->mutable_repeatedgroup(1)->set_a(517);
- message->mutable_repeated_nested_message(1)->set_bb(518);
- message->mutable_repeated_foreign_message(1)->set_c(519);
- message->mutable_repeated_import_message(1)->set_d(520);
- message->mutable_repeated_lazy_message(1)->set_bb(527);
-
- message->set_repeated_nested_enum(1, UNITTEST::TestAllTypes::FOO);
- message->set_repeated_foreign_enum(1, UNITTEST::FOREIGN_FOO);
- message->set_repeated_import_enum(1, UNITTEST_IMPORT::IMPORT_FOO);
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- message->GetReflection()->SetRepeatedString(
- message,
- message->GetDescriptor()->FindFieldByName("repeated_string_piece"), 1,
- "524");
- message->GetReflection()->SetRepeatedString(
- message, message->GetDescriptor()->FindFieldByName("repeated_cord"), 1,
- "525");
-#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
-}
-
-// ------------------------------------------------------------------
-inline void TestUtil::SetOneofFields(UNITTEST::TestAllTypes* message) {
- message->set_oneof_uint32(601);
- message->mutable_oneof_nested_message()->set_bb(602);
- message->set_oneof_string("603");
- message->set_oneof_bytes("604");
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectAllFieldsSet(
- const UNITTEST::TestAllTypes& message) {
- EXPECT_TRUE(message.has_optional_int32());
- EXPECT_TRUE(message.has_optional_int64());
- EXPECT_TRUE(message.has_optional_uint32());
- EXPECT_TRUE(message.has_optional_uint64());
- EXPECT_TRUE(message.has_optional_sint32());
- EXPECT_TRUE(message.has_optional_sint64());
- EXPECT_TRUE(message.has_optional_fixed32());
- EXPECT_TRUE(message.has_optional_fixed64());
- EXPECT_TRUE(message.has_optional_sfixed32());
- EXPECT_TRUE(message.has_optional_sfixed64());
- EXPECT_TRUE(message.has_optional_float());
- EXPECT_TRUE(message.has_optional_double());
- EXPECT_TRUE(message.has_optional_bool());
- EXPECT_TRUE(message.has_optional_string());
- EXPECT_TRUE(message.has_optional_bytes());
-
- EXPECT_TRUE(message.has_optionalgroup());
- EXPECT_TRUE(message.has_optional_nested_message());
- EXPECT_TRUE(message.has_optional_foreign_message());
- EXPECT_TRUE(message.has_optional_import_message());
- EXPECT_TRUE(message.has_optional_public_import_message());
- EXPECT_TRUE(message.has_optional_lazy_message());
-
- EXPECT_TRUE(message.optionalgroup().has_a());
- EXPECT_TRUE(message.optional_nested_message().has_bb());
- EXPECT_TRUE(message.optional_foreign_message().has_c());
- EXPECT_TRUE(message.optional_import_message().has_d());
- EXPECT_TRUE(message.optional_public_import_message().has_e());
- EXPECT_TRUE(message.optional_lazy_message().has_bb());
-
- EXPECT_TRUE(message.has_optional_nested_enum());
- EXPECT_TRUE(message.has_optional_foreign_enum());
- EXPECT_TRUE(message.has_optional_import_enum());
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- EXPECT_TRUE(message.has_optional_string_piece());
- EXPECT_TRUE(message.has_optional_cord());
-#endif
-
- EXPECT_EQ(101, message.optional_int32());
- EXPECT_EQ(102, message.optional_int64());
- EXPECT_EQ(103, message.optional_uint32());
- EXPECT_EQ(104, message.optional_uint64());
- EXPECT_EQ(105, message.optional_sint32());
- EXPECT_EQ(106, message.optional_sint64());
- EXPECT_EQ(107, message.optional_fixed32());
- EXPECT_EQ(108, message.optional_fixed64());
- EXPECT_EQ(109, message.optional_sfixed32());
- EXPECT_EQ(110, message.optional_sfixed64());
- EXPECT_EQ(111, message.optional_float());
- EXPECT_EQ(112, message.optional_double());
- EXPECT_TRUE(message.optional_bool());
- EXPECT_EQ("115", message.optional_string());
- EXPECT_EQ("116", message.optional_bytes());
-
- EXPECT_EQ(117, message.optionalgroup().a());
- EXPECT_EQ(118, message.optional_nested_message().bb());
- EXPECT_EQ(119, message.optional_foreign_message().c());
- EXPECT_EQ(120, message.optional_import_message().d());
- EXPECT_EQ(126, message.optional_public_import_message().e());
- EXPECT_EQ(127, message.optional_lazy_message().bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAZ, message.optional_nested_enum());
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ, message.optional_foreign_enum());
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAZ, message.optional_import_enum());
-
-
- // -----------------------------------------------------------------
-
- ASSERT_EQ(2, message.repeated_int32_size());
- ASSERT_EQ(2, message.repeated_int64_size());
- ASSERT_EQ(2, message.repeated_uint32_size());
- ASSERT_EQ(2, message.repeated_uint64_size());
- ASSERT_EQ(2, message.repeated_sint32_size());
- ASSERT_EQ(2, message.repeated_sint64_size());
- ASSERT_EQ(2, message.repeated_fixed32_size());
- ASSERT_EQ(2, message.repeated_fixed64_size());
- ASSERT_EQ(2, message.repeated_sfixed32_size());
- ASSERT_EQ(2, message.repeated_sfixed64_size());
- ASSERT_EQ(2, message.repeated_float_size());
- ASSERT_EQ(2, message.repeated_double_size());
- ASSERT_EQ(2, message.repeated_bool_size());
- ASSERT_EQ(2, message.repeated_string_size());
- ASSERT_EQ(2, message.repeated_bytes_size());
-
- ASSERT_EQ(2, message.repeatedgroup_size());
- ASSERT_EQ(2, message.repeated_nested_message_size());
- ASSERT_EQ(2, message.repeated_foreign_message_size());
- ASSERT_EQ(2, message.repeated_import_message_size());
- ASSERT_EQ(2, message.repeated_lazy_message_size());
- ASSERT_EQ(2, message.repeated_nested_enum_size());
- ASSERT_EQ(2, message.repeated_foreign_enum_size());
- ASSERT_EQ(2, message.repeated_import_enum_size());
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- ASSERT_EQ(2, message.repeated_string_piece_size());
- ASSERT_EQ(2, message.repeated_cord_size());
-#endif
-
- EXPECT_EQ(201, message.repeated_int32(0));
- EXPECT_EQ(202, message.repeated_int64(0));
- EXPECT_EQ(203, message.repeated_uint32(0));
- EXPECT_EQ(204, message.repeated_uint64(0));
- EXPECT_EQ(205, message.repeated_sint32(0));
- EXPECT_EQ(206, message.repeated_sint64(0));
- EXPECT_EQ(207, message.repeated_fixed32(0));
- EXPECT_EQ(208, message.repeated_fixed64(0));
- EXPECT_EQ(209, message.repeated_sfixed32(0));
- EXPECT_EQ(210, message.repeated_sfixed64(0));
- EXPECT_EQ(211, message.repeated_float(0));
- EXPECT_EQ(212, message.repeated_double(0));
- EXPECT_TRUE(message.repeated_bool(0));
- EXPECT_EQ("215", message.repeated_string(0));
- EXPECT_EQ("216", message.repeated_bytes(0));
-
- EXPECT_EQ(217, message.repeatedgroup(0).a());
- EXPECT_EQ(218, message.repeated_nested_message(0).bb());
- EXPECT_EQ(219, message.repeated_foreign_message(0).c());
- EXPECT_EQ(220, message.repeated_import_message(0).d());
- EXPECT_EQ(227, message.repeated_lazy_message(0).bb());
-
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR, message.repeated_nested_enum(0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.repeated_foreign_enum(0));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR, message.repeated_import_enum(0));
-
- EXPECT_EQ(301, message.repeated_int32(1));
- EXPECT_EQ(302, message.repeated_int64(1));
- EXPECT_EQ(303, message.repeated_uint32(1));
- EXPECT_EQ(304, message.repeated_uint64(1));
- EXPECT_EQ(305, message.repeated_sint32(1));
- EXPECT_EQ(306, message.repeated_sint64(1));
- EXPECT_EQ(307, message.repeated_fixed32(1));
- EXPECT_EQ(308, message.repeated_fixed64(1));
- EXPECT_EQ(309, message.repeated_sfixed32(1));
- EXPECT_EQ(310, message.repeated_sfixed64(1));
- EXPECT_EQ(311, message.repeated_float(1));
- EXPECT_EQ(312, message.repeated_double(1));
- EXPECT_FALSE(message.repeated_bool(1));
- EXPECT_EQ("315", message.repeated_string(1));
- EXPECT_EQ("316", message.repeated_bytes(1));
-
- EXPECT_EQ(317, message.repeatedgroup(1).a());
- EXPECT_EQ(318, message.repeated_nested_message(1).bb());
- EXPECT_EQ(319, message.repeated_foreign_message(1).c());
- EXPECT_EQ(320, message.repeated_import_message(1).d());
- EXPECT_EQ(327, message.repeated_lazy_message(1).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAZ, message.repeated_nested_enum(1));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ, message.repeated_foreign_enum(1));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAZ, message.repeated_import_enum(1));
-
-
- // -----------------------------------------------------------------
-
- EXPECT_TRUE(message.has_default_int32());
- EXPECT_TRUE(message.has_default_int64());
- EXPECT_TRUE(message.has_default_uint32());
- EXPECT_TRUE(message.has_default_uint64());
- EXPECT_TRUE(message.has_default_sint32());
- EXPECT_TRUE(message.has_default_sint64());
- EXPECT_TRUE(message.has_default_fixed32());
- EXPECT_TRUE(message.has_default_fixed64());
- EXPECT_TRUE(message.has_default_sfixed32());
- EXPECT_TRUE(message.has_default_sfixed64());
- EXPECT_TRUE(message.has_default_float());
- EXPECT_TRUE(message.has_default_double());
- EXPECT_TRUE(message.has_default_bool());
- EXPECT_TRUE(message.has_default_string());
- EXPECT_TRUE(message.has_default_bytes());
-
- EXPECT_TRUE(message.has_default_nested_enum());
- EXPECT_TRUE(message.has_default_foreign_enum());
- EXPECT_TRUE(message.has_default_import_enum());
-
-
- EXPECT_EQ(401, message.default_int32());
- EXPECT_EQ(402, message.default_int64());
- EXPECT_EQ(403, message.default_uint32());
- EXPECT_EQ(404, message.default_uint64());
- EXPECT_EQ(405, message.default_sint32());
- EXPECT_EQ(406, message.default_sint64());
- EXPECT_EQ(407, message.default_fixed32());
- EXPECT_EQ(408, message.default_fixed64());
- EXPECT_EQ(409, message.default_sfixed32());
- EXPECT_EQ(410, message.default_sfixed64());
- EXPECT_EQ(411, message.default_float());
- EXPECT_EQ(412, message.default_double());
- EXPECT_FALSE(message.default_bool());
- EXPECT_EQ("415", message.default_string());
- EXPECT_EQ("416", message.default_bytes());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::FOO, message.default_nested_enum());
- EXPECT_EQ(UNITTEST::FOREIGN_FOO, message.default_foreign_enum());
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_FOO, message.default_import_enum());
-
-
- EXPECT_FALSE(message.has_oneof_uint32());
- EXPECT_FALSE(message.has_oneof_nested_message());
- EXPECT_FALSE(message.has_oneof_string());
- EXPECT_TRUE(message.has_oneof_bytes());
-
- EXPECT_EQ("604", message.oneof_bytes());
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectClear(const UNITTEST::TestAllTypes& message) {
- // has_blah() should initially be false for all optional fields.
- EXPECT_FALSE(message.has_optional_int32());
- EXPECT_FALSE(message.has_optional_int64());
- EXPECT_FALSE(message.has_optional_uint32());
- EXPECT_FALSE(message.has_optional_uint64());
- EXPECT_FALSE(message.has_optional_sint32());
- EXPECT_FALSE(message.has_optional_sint64());
- EXPECT_FALSE(message.has_optional_fixed32());
- EXPECT_FALSE(message.has_optional_fixed64());
- EXPECT_FALSE(message.has_optional_sfixed32());
- EXPECT_FALSE(message.has_optional_sfixed64());
- EXPECT_FALSE(message.has_optional_float());
- EXPECT_FALSE(message.has_optional_double());
- EXPECT_FALSE(message.has_optional_bool());
- EXPECT_FALSE(message.has_optional_string());
- EXPECT_FALSE(message.has_optional_bytes());
-
- EXPECT_FALSE(message.has_optionalgroup());
- EXPECT_FALSE(message.has_optional_nested_message());
- EXPECT_FALSE(message.has_optional_foreign_message());
- EXPECT_FALSE(message.has_optional_import_message());
- EXPECT_FALSE(message.has_optional_public_import_message());
- EXPECT_FALSE(message.has_optional_lazy_message());
-
- EXPECT_FALSE(message.has_optional_nested_enum());
- EXPECT_FALSE(message.has_optional_foreign_enum());
- EXPECT_FALSE(message.has_optional_import_enum());
-
- EXPECT_FALSE(message.has_optional_string_piece());
- EXPECT_FALSE(message.has_optional_cord());
-
- // Optional fields without defaults are set to zero or something like it.
- EXPECT_EQ(0, message.optional_int32());
- EXPECT_EQ(0, message.optional_int64());
- EXPECT_EQ(0, message.optional_uint32());
- EXPECT_EQ(0, message.optional_uint64());
- EXPECT_EQ(0, message.optional_sint32());
- EXPECT_EQ(0, message.optional_sint64());
- EXPECT_EQ(0, message.optional_fixed32());
- EXPECT_EQ(0, message.optional_fixed64());
- EXPECT_EQ(0, message.optional_sfixed32());
- EXPECT_EQ(0, message.optional_sfixed64());
- EXPECT_EQ(0, message.optional_float());
- EXPECT_EQ(0, message.optional_double());
- EXPECT_FALSE(message.optional_bool());
- EXPECT_EQ("", message.optional_string());
- EXPECT_EQ("", message.optional_bytes());
-
- // Embedded messages should also be clear.
- EXPECT_FALSE(message.optionalgroup().has_a());
- EXPECT_FALSE(message.optional_nested_message().has_bb());
- EXPECT_FALSE(message.optional_foreign_message().has_c());
- EXPECT_FALSE(message.optional_import_message().has_d());
- EXPECT_FALSE(message.optional_public_import_message().has_e());
- EXPECT_FALSE(message.optional_lazy_message().has_bb());
-
- EXPECT_EQ(0, message.optionalgroup().a());
- EXPECT_EQ(0, message.optional_nested_message().bb());
- EXPECT_EQ(0, message.optional_foreign_message().c());
- EXPECT_EQ(0, message.optional_import_message().d());
- EXPECT_EQ(0, message.optional_public_import_message().e());
- EXPECT_EQ(0, message.optional_lazy_message().bb());
-
- // Enums without defaults are set to the first value in the enum.
- EXPECT_EQ(UNITTEST::TestAllTypes::FOO, message.optional_nested_enum());
- EXPECT_EQ(UNITTEST::FOREIGN_FOO, message.optional_foreign_enum());
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_FOO, message.optional_import_enum());
-
-
- // Repeated fields are empty.
- EXPECT_EQ(0, message.repeated_int32_size());
- EXPECT_EQ(0, message.repeated_int64_size());
- EXPECT_EQ(0, message.repeated_uint32_size());
- EXPECT_EQ(0, message.repeated_uint64_size());
- EXPECT_EQ(0, message.repeated_sint32_size());
- EXPECT_EQ(0, message.repeated_sint64_size());
- EXPECT_EQ(0, message.repeated_fixed32_size());
- EXPECT_EQ(0, message.repeated_fixed64_size());
- EXPECT_EQ(0, message.repeated_sfixed32_size());
- EXPECT_EQ(0, message.repeated_sfixed64_size());
- EXPECT_EQ(0, message.repeated_float_size());
- EXPECT_EQ(0, message.repeated_double_size());
- EXPECT_EQ(0, message.repeated_bool_size());
- EXPECT_EQ(0, message.repeated_string_size());
- EXPECT_EQ(0, message.repeated_bytes_size());
-
- EXPECT_EQ(0, message.repeatedgroup_size());
- EXPECT_EQ(0, message.repeated_nested_message_size());
- EXPECT_EQ(0, message.repeated_foreign_message_size());
- EXPECT_EQ(0, message.repeated_import_message_size());
- EXPECT_EQ(0, message.repeated_lazy_message_size());
- EXPECT_EQ(0, message.repeated_nested_enum_size());
- EXPECT_EQ(0, message.repeated_foreign_enum_size());
- EXPECT_EQ(0, message.repeated_import_enum_size());
-
- EXPECT_EQ(0, message.repeated_string_piece_size());
- EXPECT_EQ(0, message.repeated_cord_size());
-
- // has_blah() should also be false for all default fields.
- EXPECT_FALSE(message.has_default_int32());
- EXPECT_FALSE(message.has_default_int64());
- EXPECT_FALSE(message.has_default_uint32());
- EXPECT_FALSE(message.has_default_uint64());
- EXPECT_FALSE(message.has_default_sint32());
- EXPECT_FALSE(message.has_default_sint64());
- EXPECT_FALSE(message.has_default_fixed32());
- EXPECT_FALSE(message.has_default_fixed64());
- EXPECT_FALSE(message.has_default_sfixed32());
- EXPECT_FALSE(message.has_default_sfixed64());
- EXPECT_FALSE(message.has_default_float());
- EXPECT_FALSE(message.has_default_double());
- EXPECT_FALSE(message.has_default_bool());
- EXPECT_FALSE(message.has_default_string());
- EXPECT_FALSE(message.has_default_bytes());
-
- EXPECT_FALSE(message.has_default_nested_enum());
- EXPECT_FALSE(message.has_default_foreign_enum());
- EXPECT_FALSE(message.has_default_import_enum());
-
-
- // Fields with defaults have their default values (duh).
- EXPECT_EQ(41, message.default_int32());
- EXPECT_EQ(42, message.default_int64());
- EXPECT_EQ(43, message.default_uint32());
- EXPECT_EQ(44, message.default_uint64());
- EXPECT_EQ(-45, message.default_sint32());
- EXPECT_EQ(46, message.default_sint64());
- EXPECT_EQ(47, message.default_fixed32());
- EXPECT_EQ(48, message.default_fixed64());
- EXPECT_EQ(49, message.default_sfixed32());
- EXPECT_EQ(-50, message.default_sfixed64());
- EXPECT_EQ(51.5, message.default_float());
- EXPECT_EQ(52e3, message.default_double());
- EXPECT_TRUE(message.default_bool());
- EXPECT_EQ("hello", message.default_string());
- EXPECT_EQ("world", message.default_bytes());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR, message.default_nested_enum());
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.default_foreign_enum());
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR, message.default_import_enum());
-
-
- EXPECT_FALSE(message.has_oneof_uint32());
- EXPECT_FALSE(message.has_oneof_nested_message());
- EXPECT_FALSE(message.has_oneof_string());
- EXPECT_FALSE(message.has_oneof_bytes());
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectRepeatedFieldsModified(
- const UNITTEST::TestAllTypes& message) {
- // ModifyRepeatedFields only sets the second repeated element of each
- // field. In addition to verifying this, we also verify that the first
- // element and size were *not* modified.
- ASSERT_EQ(2, message.repeated_int32_size());
- ASSERT_EQ(2, message.repeated_int64_size());
- ASSERT_EQ(2, message.repeated_uint32_size());
- ASSERT_EQ(2, message.repeated_uint64_size());
- ASSERT_EQ(2, message.repeated_sint32_size());
- ASSERT_EQ(2, message.repeated_sint64_size());
- ASSERT_EQ(2, message.repeated_fixed32_size());
- ASSERT_EQ(2, message.repeated_fixed64_size());
- ASSERT_EQ(2, message.repeated_sfixed32_size());
- ASSERT_EQ(2, message.repeated_sfixed64_size());
- ASSERT_EQ(2, message.repeated_float_size());
- ASSERT_EQ(2, message.repeated_double_size());
- ASSERT_EQ(2, message.repeated_bool_size());
- ASSERT_EQ(2, message.repeated_string_size());
- ASSERT_EQ(2, message.repeated_bytes_size());
-
- ASSERT_EQ(2, message.repeatedgroup_size());
- ASSERT_EQ(2, message.repeated_nested_message_size());
- ASSERT_EQ(2, message.repeated_foreign_message_size());
- ASSERT_EQ(2, message.repeated_import_message_size());
- ASSERT_EQ(2, message.repeated_lazy_message_size());
- ASSERT_EQ(2, message.repeated_nested_enum_size());
- ASSERT_EQ(2, message.repeated_foreign_enum_size());
- ASSERT_EQ(2, message.repeated_import_enum_size());
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- ASSERT_EQ(2, message.repeated_string_piece_size());
- ASSERT_EQ(2, message.repeated_cord_size());
-#endif
-
- EXPECT_EQ(201, message.repeated_int32(0));
- EXPECT_EQ(202, message.repeated_int64(0));
- EXPECT_EQ(203, message.repeated_uint32(0));
- EXPECT_EQ(204, message.repeated_uint64(0));
- EXPECT_EQ(205, message.repeated_sint32(0));
- EXPECT_EQ(206, message.repeated_sint64(0));
- EXPECT_EQ(207, message.repeated_fixed32(0));
- EXPECT_EQ(208, message.repeated_fixed64(0));
- EXPECT_EQ(209, message.repeated_sfixed32(0));
- EXPECT_EQ(210, message.repeated_sfixed64(0));
- EXPECT_EQ(211, message.repeated_float(0));
- EXPECT_EQ(212, message.repeated_double(0));
- EXPECT_TRUE(message.repeated_bool(0));
- EXPECT_EQ("215", message.repeated_string(0));
- EXPECT_EQ("216", message.repeated_bytes(0));
-
- EXPECT_EQ(217, message.repeatedgroup(0).a());
- EXPECT_EQ(218, message.repeated_nested_message(0).bb());
- EXPECT_EQ(219, message.repeated_foreign_message(0).c());
- EXPECT_EQ(220, message.repeated_import_message(0).d());
- EXPECT_EQ(227, message.repeated_lazy_message(0).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR, message.repeated_nested_enum(0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.repeated_foreign_enum(0));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR, message.repeated_import_enum(0));
-
-
- // Actually verify the second (modified) elements now.
- EXPECT_EQ(501, message.repeated_int32(1));
- EXPECT_EQ(502, message.repeated_int64(1));
- EXPECT_EQ(503, message.repeated_uint32(1));
- EXPECT_EQ(504, message.repeated_uint64(1));
- EXPECT_EQ(505, message.repeated_sint32(1));
- EXPECT_EQ(506, message.repeated_sint64(1));
- EXPECT_EQ(507, message.repeated_fixed32(1));
- EXPECT_EQ(508, message.repeated_fixed64(1));
- EXPECT_EQ(509, message.repeated_sfixed32(1));
- EXPECT_EQ(510, message.repeated_sfixed64(1));
- EXPECT_EQ(511, message.repeated_float(1));
- EXPECT_EQ(512, message.repeated_double(1));
- EXPECT_TRUE(message.repeated_bool(1));
- EXPECT_EQ("515", message.repeated_string(1));
- EXPECT_EQ("516", message.repeated_bytes(1));
-
- EXPECT_EQ(517, message.repeatedgroup(1).a());
- EXPECT_EQ(518, message.repeated_nested_message(1).bb());
- EXPECT_EQ(519, message.repeated_foreign_message(1).c());
- EXPECT_EQ(520, message.repeated_import_message(1).d());
- EXPECT_EQ(527, message.repeated_lazy_message(1).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::FOO, message.repeated_nested_enum(1));
- EXPECT_EQ(UNITTEST::FOREIGN_FOO, message.repeated_foreign_enum(1));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_FOO, message.repeated_import_enum(1));
-
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::SetPackedFields(UNITTEST::TestPackedTypes* message) {
- message->add_packed_int32(601);
- message->add_packed_int64(602);
- message->add_packed_uint32(603);
- message->add_packed_uint64(604);
- message->add_packed_sint32(605);
- message->add_packed_sint64(606);
- message->add_packed_fixed32(607);
- message->add_packed_fixed64(608);
- message->add_packed_sfixed32(609);
- message->add_packed_sfixed64(610);
- message->add_packed_float(611);
- message->add_packed_double(612);
- message->add_packed_bool(true);
- message->add_packed_enum(UNITTEST::FOREIGN_BAR);
- // add a second one of each field
- message->add_packed_int32(701);
- message->add_packed_int64(702);
- message->add_packed_uint32(703);
- message->add_packed_uint64(704);
- message->add_packed_sint32(705);
- message->add_packed_sint64(706);
- message->add_packed_fixed32(707);
- message->add_packed_fixed64(708);
- message->add_packed_sfixed32(709);
- message->add_packed_sfixed64(710);
- message->add_packed_float(711);
- message->add_packed_double(712);
- message->add_packed_bool(false);
- message->add_packed_enum(UNITTEST::FOREIGN_BAZ);
-}
-
-inline void TestUtil::SetUnpackedFields(UNITTEST::TestUnpackedTypes* message) {
- // The values applied here must match those of SetPackedFields.
-
- message->add_unpacked_int32(601);
- message->add_unpacked_int64(602);
- message->add_unpacked_uint32(603);
- message->add_unpacked_uint64(604);
- message->add_unpacked_sint32(605);
- message->add_unpacked_sint64(606);
- message->add_unpacked_fixed32(607);
- message->add_unpacked_fixed64(608);
- message->add_unpacked_sfixed32(609);
- message->add_unpacked_sfixed64(610);
- message->add_unpacked_float(611);
- message->add_unpacked_double(612);
- message->add_unpacked_bool(true);
- message->add_unpacked_enum(UNITTEST::FOREIGN_BAR);
- // add a second one of each field
- message->add_unpacked_int32(701);
- message->add_unpacked_int64(702);
- message->add_unpacked_uint32(703);
- message->add_unpacked_uint64(704);
- message->add_unpacked_sint32(705);
- message->add_unpacked_sint64(706);
- message->add_unpacked_fixed32(707);
- message->add_unpacked_fixed64(708);
- message->add_unpacked_sfixed32(709);
- message->add_unpacked_sfixed64(710);
- message->add_unpacked_float(711);
- message->add_unpacked_double(712);
- message->add_unpacked_bool(false);
- message->add_unpacked_enum(UNITTEST::FOREIGN_BAZ);
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ModifyPackedFields(UNITTEST::TestPackedTypes* message) {
- message->set_packed_int32(1, 801);
- message->set_packed_int64(1, 802);
- message->set_packed_uint32(1, 803);
- message->set_packed_uint64(1, 804);
- message->set_packed_sint32(1, 805);
- message->set_packed_sint64(1, 806);
- message->set_packed_fixed32(1, 807);
- message->set_packed_fixed64(1, 808);
- message->set_packed_sfixed32(1, 809);
- message->set_packed_sfixed64(1, 810);
- message->set_packed_float(1, 811);
- message->set_packed_double(1, 812);
- message->set_packed_bool(1, true);
- message->set_packed_enum(1, UNITTEST::FOREIGN_FOO);
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectPackedFieldsSet(
- const UNITTEST::TestPackedTypes& message) {
- ASSERT_EQ(2, message.packed_int32_size());
- ASSERT_EQ(2, message.packed_int64_size());
- ASSERT_EQ(2, message.packed_uint32_size());
- ASSERT_EQ(2, message.packed_uint64_size());
- ASSERT_EQ(2, message.packed_sint32_size());
- ASSERT_EQ(2, message.packed_sint64_size());
- ASSERT_EQ(2, message.packed_fixed32_size());
- ASSERT_EQ(2, message.packed_fixed64_size());
- ASSERT_EQ(2, message.packed_sfixed32_size());
- ASSERT_EQ(2, message.packed_sfixed64_size());
- ASSERT_EQ(2, message.packed_float_size());
- ASSERT_EQ(2, message.packed_double_size());
- ASSERT_EQ(2, message.packed_bool_size());
- ASSERT_EQ(2, message.packed_enum_size());
-
- EXPECT_EQ(601, message.packed_int32(0));
- EXPECT_EQ(602, message.packed_int64(0));
- EXPECT_EQ(603, message.packed_uint32(0));
- EXPECT_EQ(604, message.packed_uint64(0));
- EXPECT_EQ(605, message.packed_sint32(0));
- EXPECT_EQ(606, message.packed_sint64(0));
- EXPECT_EQ(607, message.packed_fixed32(0));
- EXPECT_EQ(608, message.packed_fixed64(0));
- EXPECT_EQ(609, message.packed_sfixed32(0));
- EXPECT_EQ(610, message.packed_sfixed64(0));
- EXPECT_EQ(611, message.packed_float(0));
- EXPECT_EQ(612, message.packed_double(0));
- EXPECT_TRUE(message.packed_bool(0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.packed_enum(0));
-
- EXPECT_EQ(701, message.packed_int32(1));
- EXPECT_EQ(702, message.packed_int64(1));
- EXPECT_EQ(703, message.packed_uint32(1));
- EXPECT_EQ(704, message.packed_uint64(1));
- EXPECT_EQ(705, message.packed_sint32(1));
- EXPECT_EQ(706, message.packed_sint64(1));
- EXPECT_EQ(707, message.packed_fixed32(1));
- EXPECT_EQ(708, message.packed_fixed64(1));
- EXPECT_EQ(709, message.packed_sfixed32(1));
- EXPECT_EQ(710, message.packed_sfixed64(1));
- EXPECT_EQ(711, message.packed_float(1));
- EXPECT_EQ(712, message.packed_double(1));
- EXPECT_FALSE(message.packed_bool(1));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ, message.packed_enum(1));
-}
-
-inline void TestUtil::ExpectUnpackedFieldsSet(
- const UNITTEST::TestUnpackedTypes& message) {
- // The values expected here must match those of ExpectPackedFieldsSet.
-
- ASSERT_EQ(2, message.unpacked_int32_size());
- ASSERT_EQ(2, message.unpacked_int64_size());
- ASSERT_EQ(2, message.unpacked_uint32_size());
- ASSERT_EQ(2, message.unpacked_uint64_size());
- ASSERT_EQ(2, message.unpacked_sint32_size());
- ASSERT_EQ(2, message.unpacked_sint64_size());
- ASSERT_EQ(2, message.unpacked_fixed32_size());
- ASSERT_EQ(2, message.unpacked_fixed64_size());
- ASSERT_EQ(2, message.unpacked_sfixed32_size());
- ASSERT_EQ(2, message.unpacked_sfixed64_size());
- ASSERT_EQ(2, message.unpacked_float_size());
- ASSERT_EQ(2, message.unpacked_double_size());
- ASSERT_EQ(2, message.unpacked_bool_size());
- ASSERT_EQ(2, message.unpacked_enum_size());
-
- EXPECT_EQ(601, message.unpacked_int32(0));
- EXPECT_EQ(602, message.unpacked_int64(0));
- EXPECT_EQ(603, message.unpacked_uint32(0));
- EXPECT_EQ(604, message.unpacked_uint64(0));
- EXPECT_EQ(605, message.unpacked_sint32(0));
- EXPECT_EQ(606, message.unpacked_sint64(0));
- EXPECT_EQ(607, message.unpacked_fixed32(0));
- EXPECT_EQ(608, message.unpacked_fixed64(0));
- EXPECT_EQ(609, message.unpacked_sfixed32(0));
- EXPECT_EQ(610, message.unpacked_sfixed64(0));
- EXPECT_EQ(611, message.unpacked_float(0));
- EXPECT_EQ(612, message.unpacked_double(0));
- EXPECT_TRUE(message.unpacked_bool(0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.unpacked_enum(0));
-
- EXPECT_EQ(701, message.unpacked_int32(1));
- EXPECT_EQ(702, message.unpacked_int64(1));
- EXPECT_EQ(703, message.unpacked_uint32(1));
- EXPECT_EQ(704, message.unpacked_uint64(1));
- EXPECT_EQ(705, message.unpacked_sint32(1));
- EXPECT_EQ(706, message.unpacked_sint64(1));
- EXPECT_EQ(707, message.unpacked_fixed32(1));
- EXPECT_EQ(708, message.unpacked_fixed64(1));
- EXPECT_EQ(709, message.unpacked_sfixed32(1));
- EXPECT_EQ(710, message.unpacked_sfixed64(1));
- EXPECT_EQ(711, message.unpacked_float(1));
- EXPECT_EQ(712, message.unpacked_double(1));
- EXPECT_FALSE(message.unpacked_bool(1));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ, message.unpacked_enum(1));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectPackedClear(
- const UNITTEST::TestPackedTypes& message) {
- // Packed repeated fields are empty.
- EXPECT_EQ(0, message.packed_int32_size());
- EXPECT_EQ(0, message.packed_int64_size());
- EXPECT_EQ(0, message.packed_uint32_size());
- EXPECT_EQ(0, message.packed_uint64_size());
- EXPECT_EQ(0, message.packed_sint32_size());
- EXPECT_EQ(0, message.packed_sint64_size());
- EXPECT_EQ(0, message.packed_fixed32_size());
- EXPECT_EQ(0, message.packed_fixed64_size());
- EXPECT_EQ(0, message.packed_sfixed32_size());
- EXPECT_EQ(0, message.packed_sfixed64_size());
- EXPECT_EQ(0, message.packed_float_size());
- EXPECT_EQ(0, message.packed_double_size());
- EXPECT_EQ(0, message.packed_bool_size());
- EXPECT_EQ(0, message.packed_enum_size());
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectPackedFieldsModified(
- const UNITTEST::TestPackedTypes& message) {
- // Do the same for packed repeated fields.
- ASSERT_EQ(2, message.packed_int32_size());
- ASSERT_EQ(2, message.packed_int64_size());
- ASSERT_EQ(2, message.packed_uint32_size());
- ASSERT_EQ(2, message.packed_uint64_size());
- ASSERT_EQ(2, message.packed_sint32_size());
- ASSERT_EQ(2, message.packed_sint64_size());
- ASSERT_EQ(2, message.packed_fixed32_size());
- ASSERT_EQ(2, message.packed_fixed64_size());
- ASSERT_EQ(2, message.packed_sfixed32_size());
- ASSERT_EQ(2, message.packed_sfixed64_size());
- ASSERT_EQ(2, message.packed_float_size());
- ASSERT_EQ(2, message.packed_double_size());
- ASSERT_EQ(2, message.packed_bool_size());
- ASSERT_EQ(2, message.packed_enum_size());
-
- EXPECT_EQ(601, message.packed_int32(0));
- EXPECT_EQ(602, message.packed_int64(0));
- EXPECT_EQ(603, message.packed_uint32(0));
- EXPECT_EQ(604, message.packed_uint64(0));
- EXPECT_EQ(605, message.packed_sint32(0));
- EXPECT_EQ(606, message.packed_sint64(0));
- EXPECT_EQ(607, message.packed_fixed32(0));
- EXPECT_EQ(608, message.packed_fixed64(0));
- EXPECT_EQ(609, message.packed_sfixed32(0));
- EXPECT_EQ(610, message.packed_sfixed64(0));
- EXPECT_EQ(611, message.packed_float(0));
- EXPECT_EQ(612, message.packed_double(0));
- EXPECT_TRUE(message.packed_bool(0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.packed_enum(0));
- // Actually verify the second (modified) elements now.
- EXPECT_EQ(801, message.packed_int32(1));
- EXPECT_EQ(802, message.packed_int64(1));
- EXPECT_EQ(803, message.packed_uint32(1));
- EXPECT_EQ(804, message.packed_uint64(1));
- EXPECT_EQ(805, message.packed_sint32(1));
- EXPECT_EQ(806, message.packed_sint64(1));
- EXPECT_EQ(807, message.packed_fixed32(1));
- EXPECT_EQ(808, message.packed_fixed64(1));
- EXPECT_EQ(809, message.packed_sfixed32(1));
- EXPECT_EQ(810, message.packed_sfixed64(1));
- EXPECT_EQ(811, message.packed_float(1));
- EXPECT_EQ(812, message.packed_double(1));
- EXPECT_TRUE(message.packed_bool(1));
- EXPECT_EQ(UNITTEST::FOREIGN_FOO, message.packed_enum(1));
-}
-
-// ===================================================================
-// Extensions
-//
-// All this code is exactly equivalent to the above code except that it's
-// manipulating extension fields instead of normal ones.
-
-inline void TestUtil::SetAllExtensions(UNITTEST::TestAllExtensions* message) {
- message->SetExtension(UNITTEST::optional_int32_extension, 101);
- message->SetExtension(UNITTEST::optional_int64_extension, 102);
- message->SetExtension(UNITTEST::optional_uint32_extension, 103);
- message->SetExtension(UNITTEST::optional_uint64_extension, 104);
- message->SetExtension(UNITTEST::optional_sint32_extension, 105);
- message->SetExtension(UNITTEST::optional_sint64_extension, 106);
- message->SetExtension(UNITTEST::optional_fixed32_extension, 107);
- message->SetExtension(UNITTEST::optional_fixed64_extension, 108);
- message->SetExtension(UNITTEST::optional_sfixed32_extension, 109);
- message->SetExtension(UNITTEST::optional_sfixed64_extension, 110);
- message->SetExtension(UNITTEST::optional_float_extension, 111);
- message->SetExtension(UNITTEST::optional_double_extension, 112);
- message->SetExtension(UNITTEST::optional_bool_extension, true);
- message->SetExtension(UNITTEST::optional_string_extension, "115");
- message->SetExtension(UNITTEST::optional_bytes_extension, "116");
-
- message->MutableExtension(UNITTEST::optionalgroup_extension)->set_a(117);
- message->MutableExtension(UNITTEST::optional_nested_message_extension)
- ->set_bb(118);
- message->MutableExtension(UNITTEST::optional_foreign_message_extension)
- ->set_c(119);
- message->MutableExtension(UNITTEST::optional_import_message_extension)
- ->set_d(120);
-
- message->SetExtension(UNITTEST::optional_nested_enum_extension,
- UNITTEST::TestAllTypes::BAZ);
- message->SetExtension(UNITTEST::optional_foreign_enum_extension,
- UNITTEST::FOREIGN_BAZ);
- message->SetExtension(UNITTEST::optional_import_enum_extension,
- UNITTEST_IMPORT::IMPORT_BAZ);
-
- message->SetExtension(UNITTEST::optional_string_piece_extension, "124");
- message->SetExtension(UNITTEST::optional_cord_extension, "125");
-
- message->MutableExtension(UNITTEST::optional_public_import_message_extension)
- ->set_e(126);
- message->MutableExtension(UNITTEST::optional_lazy_message_extension)
- ->set_bb(127);
-
- // -----------------------------------------------------------------
-
- message->AddExtension(UNITTEST::repeated_int32_extension, 201);
- message->AddExtension(UNITTEST::repeated_int64_extension, 202);
- message->AddExtension(UNITTEST::repeated_uint32_extension, 203);
- message->AddExtension(UNITTEST::repeated_uint64_extension, 204);
- message->AddExtension(UNITTEST::repeated_sint32_extension, 205);
- message->AddExtension(UNITTEST::repeated_sint64_extension, 206);
- message->AddExtension(UNITTEST::repeated_fixed32_extension, 207);
- message->AddExtension(UNITTEST::repeated_fixed64_extension, 208);
- message->AddExtension(UNITTEST::repeated_sfixed32_extension, 209);
- message->AddExtension(UNITTEST::repeated_sfixed64_extension, 210);
- message->AddExtension(UNITTEST::repeated_float_extension, 211);
- message->AddExtension(UNITTEST::repeated_double_extension, 212);
- message->AddExtension(UNITTEST::repeated_bool_extension, true);
- message->AddExtension(UNITTEST::repeated_string_extension, "215");
- message->AddExtension(UNITTEST::repeated_bytes_extension, "216");
-
- message->AddExtension(UNITTEST::repeatedgroup_extension)->set_a(217);
- message->AddExtension(UNITTEST::repeated_nested_message_extension)
- ->set_bb(218);
- message->AddExtension(UNITTEST::repeated_foreign_message_extension)
- ->set_c(219);
- message->AddExtension(UNITTEST::repeated_import_message_extension)
- ->set_d(220);
- message->AddExtension(UNITTEST::repeated_lazy_message_extension)->set_bb(227);
-
- message->AddExtension(UNITTEST::repeated_nested_enum_extension,
- UNITTEST::TestAllTypes::BAR);
- message->AddExtension(UNITTEST::repeated_foreign_enum_extension,
- UNITTEST::FOREIGN_BAR);
- message->AddExtension(UNITTEST::repeated_import_enum_extension,
- UNITTEST_IMPORT::IMPORT_BAR);
-
- message->AddExtension(UNITTEST::repeated_string_piece_extension, "224");
- message->AddExtension(UNITTEST::repeated_cord_extension, "225");
-
- // Add a second one of each field.
- message->AddExtension(UNITTEST::repeated_int32_extension, 301);
- message->AddExtension(UNITTEST::repeated_int64_extension, 302);
- message->AddExtension(UNITTEST::repeated_uint32_extension, 303);
- message->AddExtension(UNITTEST::repeated_uint64_extension, 304);
- message->AddExtension(UNITTEST::repeated_sint32_extension, 305);
- message->AddExtension(UNITTEST::repeated_sint64_extension, 306);
- message->AddExtension(UNITTEST::repeated_fixed32_extension, 307);
- message->AddExtension(UNITTEST::repeated_fixed64_extension, 308);
- message->AddExtension(UNITTEST::repeated_sfixed32_extension, 309);
- message->AddExtension(UNITTEST::repeated_sfixed64_extension, 310);
- message->AddExtension(UNITTEST::repeated_float_extension, 311);
- message->AddExtension(UNITTEST::repeated_double_extension, 312);
- message->AddExtension(UNITTEST::repeated_bool_extension, false);
- message->AddExtension(UNITTEST::repeated_string_extension, "315");
- message->AddExtension(UNITTEST::repeated_bytes_extension, "316");
-
- message->AddExtension(UNITTEST::repeatedgroup_extension)->set_a(317);
- message->AddExtension(UNITTEST::repeated_nested_message_extension)
- ->set_bb(318);
- message->AddExtension(UNITTEST::repeated_foreign_message_extension)
- ->set_c(319);
- message->AddExtension(UNITTEST::repeated_import_message_extension)
- ->set_d(320);
- message->AddExtension(UNITTEST::repeated_lazy_message_extension)->set_bb(327);
-
- message->AddExtension(UNITTEST::repeated_nested_enum_extension,
- UNITTEST::TestAllTypes::BAZ);
- message->AddExtension(UNITTEST::repeated_foreign_enum_extension,
- UNITTEST::FOREIGN_BAZ);
- message->AddExtension(UNITTEST::repeated_import_enum_extension,
- UNITTEST_IMPORT::IMPORT_BAZ);
-
- message->AddExtension(UNITTEST::repeated_string_piece_extension, "324");
- message->AddExtension(UNITTEST::repeated_cord_extension, "325");
-
- // -----------------------------------------------------------------
-
- message->SetExtension(UNITTEST::default_int32_extension, 401);
- message->SetExtension(UNITTEST::default_int64_extension, 402);
- message->SetExtension(UNITTEST::default_uint32_extension, 403);
- message->SetExtension(UNITTEST::default_uint64_extension, 404);
- message->SetExtension(UNITTEST::default_sint32_extension, 405);
- message->SetExtension(UNITTEST::default_sint64_extension, 406);
- message->SetExtension(UNITTEST::default_fixed32_extension, 407);
- message->SetExtension(UNITTEST::default_fixed64_extension, 408);
- message->SetExtension(UNITTEST::default_sfixed32_extension, 409);
- message->SetExtension(UNITTEST::default_sfixed64_extension, 410);
- message->SetExtension(UNITTEST::default_float_extension, 411);
- message->SetExtension(UNITTEST::default_double_extension, 412);
- message->SetExtension(UNITTEST::default_bool_extension, false);
- message->SetExtension(UNITTEST::default_string_extension, "415");
- message->SetExtension(UNITTEST::default_bytes_extension, "416");
-
- message->SetExtension(UNITTEST::default_nested_enum_extension,
- UNITTEST::TestAllTypes::FOO);
- message->SetExtension(UNITTEST::default_foreign_enum_extension,
- UNITTEST::FOREIGN_FOO);
- message->SetExtension(UNITTEST::default_import_enum_extension,
- UNITTEST_IMPORT::IMPORT_FOO);
-
- message->SetExtension(UNITTEST::default_string_piece_extension, "424");
- message->SetExtension(UNITTEST::default_cord_extension, "425");
-
- SetOneofFields(message);
-}
-
-inline void TestUtil::SetOneofFields(UNITTEST::TestAllExtensions* message) {
- message->SetExtension(UNITTEST::oneof_uint32_extension, 601);
- message->MutableExtension(UNITTEST::oneof_nested_message_extension)
- ->set_bb(602);
- message->SetExtension(UNITTEST::oneof_string_extension, "603");
- message->SetExtension(UNITTEST::oneof_bytes_extension, "604");
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::SetAllFieldsAndExtensions(
- UNITTEST::TestFieldOrderings* message) {
- GOOGLE_CHECK(message);
- message->set_my_int(1);
- message->set_my_string("foo");
- message->set_my_float(1.0);
- message->SetExtension(UNITTEST::my_extension_int, 23);
- message->SetExtension(UNITTEST::my_extension_string, "bar");
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ModifyRepeatedExtensions(
- UNITTEST::TestAllExtensions* message) {
- message->SetExtension(UNITTEST::repeated_int32_extension, 1, 501);
- message->SetExtension(UNITTEST::repeated_int64_extension, 1, 502);
- message->SetExtension(UNITTEST::repeated_uint32_extension, 1, 503);
- message->SetExtension(UNITTEST::repeated_uint64_extension, 1, 504);
- message->SetExtension(UNITTEST::repeated_sint32_extension, 1, 505);
- message->SetExtension(UNITTEST::repeated_sint64_extension, 1, 506);
- message->SetExtension(UNITTEST::repeated_fixed32_extension, 1, 507);
- message->SetExtension(UNITTEST::repeated_fixed64_extension, 1, 508);
- message->SetExtension(UNITTEST::repeated_sfixed32_extension, 1, 509);
- message->SetExtension(UNITTEST::repeated_sfixed64_extension, 1, 510);
- message->SetExtension(UNITTEST::repeated_float_extension, 1, 511);
- message->SetExtension(UNITTEST::repeated_double_extension, 1, 512);
- message->SetExtension(UNITTEST::repeated_bool_extension, 1, true);
- message->SetExtension(UNITTEST::repeated_string_extension, 1, "515");
- message->SetExtension(UNITTEST::repeated_bytes_extension, 1, "516");
-
- message->MutableExtension(UNITTEST::repeatedgroup_extension, 1)->set_a(517);
- message->MutableExtension(UNITTEST::repeated_nested_message_extension, 1)
- ->set_bb(518);
- message->MutableExtension(UNITTEST::repeated_foreign_message_extension, 1)
- ->set_c(519);
- message->MutableExtension(UNITTEST::repeated_import_message_extension, 1)
- ->set_d(520);
- message->MutableExtension(UNITTEST::repeated_lazy_message_extension, 1)
- ->set_bb(527);
-
- message->SetExtension(UNITTEST::repeated_nested_enum_extension, 1,
- UNITTEST::TestAllTypes::FOO);
- message->SetExtension(UNITTEST::repeated_foreign_enum_extension, 1,
- UNITTEST::FOREIGN_FOO);
- message->SetExtension(UNITTEST::repeated_import_enum_extension, 1,
- UNITTEST_IMPORT::IMPORT_FOO);
-
- message->SetExtension(UNITTEST::repeated_string_piece_extension, 1, "524");
- message->SetExtension(UNITTEST::repeated_cord_extension, 1, "525");
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectAllExtensionsSet(
- const UNITTEST::TestAllExtensions& message) {
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_int32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_int64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_uint32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_uint64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_sint32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_sint64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_fixed32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_fixed64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_sfixed32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_sfixed64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_float_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_double_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_bool_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_string_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_bytes_extension));
-
- EXPECT_TRUE(message.HasExtension(UNITTEST::optionalgroup_extension));
- EXPECT_TRUE(
- message.HasExtension(UNITTEST::optional_nested_message_extension));
- EXPECT_TRUE(
- message.HasExtension(UNITTEST::optional_foreign_message_extension));
- EXPECT_TRUE(
- message.HasExtension(UNITTEST::optional_import_message_extension));
- EXPECT_TRUE(
- message.HasExtension(UNITTEST::optional_public_import_message_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_lazy_message_extension));
-
- EXPECT_TRUE(message.GetExtension(UNITTEST::optionalgroup_extension).has_a());
- EXPECT_TRUE(message.GetExtension(UNITTEST::optional_nested_message_extension)
- .has_bb());
- EXPECT_TRUE(message.GetExtension(UNITTEST::optional_foreign_message_extension)
- .has_c());
- EXPECT_TRUE(message.GetExtension(UNITTEST::optional_import_message_extension)
- .has_d());
- EXPECT_TRUE(
- message.GetExtension(UNITTEST::optional_public_import_message_extension)
- .has_e());
- EXPECT_TRUE(
- message.GetExtension(UNITTEST::optional_lazy_message_extension).has_bb());
-
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_nested_enum_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_foreign_enum_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_import_enum_extension));
-
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_string_piece_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::optional_cord_extension));
-
- EXPECT_EQ(101, message.GetExtension(UNITTEST::optional_int32_extension));
- EXPECT_EQ(102, message.GetExtension(UNITTEST::optional_int64_extension));
- EXPECT_EQ(103, message.GetExtension(UNITTEST::optional_uint32_extension));
- EXPECT_EQ(104, message.GetExtension(UNITTEST::optional_uint64_extension));
- EXPECT_EQ(105, message.GetExtension(UNITTEST::optional_sint32_extension));
- EXPECT_EQ(106, message.GetExtension(UNITTEST::optional_sint64_extension));
- EXPECT_EQ(107, message.GetExtension(UNITTEST::optional_fixed32_extension));
- EXPECT_EQ(108, message.GetExtension(UNITTEST::optional_fixed64_extension));
- EXPECT_EQ(109, message.GetExtension(UNITTEST::optional_sfixed32_extension));
- EXPECT_EQ(110, message.GetExtension(UNITTEST::optional_sfixed64_extension));
- EXPECT_EQ(111, message.GetExtension(UNITTEST::optional_float_extension));
- EXPECT_EQ(112, message.GetExtension(UNITTEST::optional_double_extension));
- EXPECT_TRUE(message.GetExtension(UNITTEST::optional_bool_extension));
- EXPECT_EQ("115", message.GetExtension(UNITTEST::optional_string_extension));
- EXPECT_EQ("116", message.GetExtension(UNITTEST::optional_bytes_extension));
-
- EXPECT_EQ(117, message.GetExtension(UNITTEST::optionalgroup_extension).a());
- EXPECT_EQ(
- 118,
- message.GetExtension(UNITTEST::optional_nested_message_extension).bb());
- EXPECT_EQ(
- 119,
- message.GetExtension(UNITTEST::optional_foreign_message_extension).c());
- EXPECT_EQ(
- 120,
- message.GetExtension(UNITTEST::optional_import_message_extension).d());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAZ,
- message.GetExtension(UNITTEST::optional_nested_enum_extension));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ,
- message.GetExtension(UNITTEST::optional_foreign_enum_extension));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAZ,
- message.GetExtension(UNITTEST::optional_import_enum_extension));
-
- EXPECT_EQ("124",
- message.GetExtension(UNITTEST::optional_string_piece_extension));
- EXPECT_EQ("125", message.GetExtension(UNITTEST::optional_cord_extension));
- EXPECT_EQ(
- 126,
- message.GetExtension(UNITTEST::optional_public_import_message_extension)
- .e());
- EXPECT_EQ(
- 127,
- message.GetExtension(UNITTEST::optional_lazy_message_extension).bb());
-
- // -----------------------------------------------------------------
-
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_int32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_int64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_uint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_uint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_fixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_fixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sfixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sfixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_float_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_double_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_bool_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_string_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_bytes_extension));
-
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeatedgroup_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_nested_message_extension));
- ASSERT_EQ(
- 2, message.ExtensionSize(UNITTEST::repeated_foreign_message_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_import_message_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_lazy_message_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_nested_enum_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_foreign_enum_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_import_enum_extension));
-
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_string_piece_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_cord_extension));
-
- EXPECT_EQ(201, message.GetExtension(UNITTEST::repeated_int32_extension, 0));
- EXPECT_EQ(202, message.GetExtension(UNITTEST::repeated_int64_extension, 0));
- EXPECT_EQ(203, message.GetExtension(UNITTEST::repeated_uint32_extension, 0));
- EXPECT_EQ(204, message.GetExtension(UNITTEST::repeated_uint64_extension, 0));
- EXPECT_EQ(205, message.GetExtension(UNITTEST::repeated_sint32_extension, 0));
- EXPECT_EQ(206, message.GetExtension(UNITTEST::repeated_sint64_extension, 0));
- EXPECT_EQ(207, message.GetExtension(UNITTEST::repeated_fixed32_extension, 0));
- EXPECT_EQ(208, message.GetExtension(UNITTEST::repeated_fixed64_extension, 0));
- EXPECT_EQ(209,
- message.GetExtension(UNITTEST::repeated_sfixed32_extension, 0));
- EXPECT_EQ(210,
- message.GetExtension(UNITTEST::repeated_sfixed64_extension, 0));
- EXPECT_EQ(211, message.GetExtension(UNITTEST::repeated_float_extension, 0));
- EXPECT_EQ(212, message.GetExtension(UNITTEST::repeated_double_extension, 0));
- EXPECT_TRUE(message.GetExtension(UNITTEST::repeated_bool_extension, 0));
- EXPECT_EQ("215",
- message.GetExtension(UNITTEST::repeated_string_extension, 0));
- EXPECT_EQ("216", message.GetExtension(UNITTEST::repeated_bytes_extension, 0));
-
- EXPECT_EQ(217,
- message.GetExtension(UNITTEST::repeatedgroup_extension, 0).a());
- EXPECT_EQ(218,
- message.GetExtension(UNITTEST::repeated_nested_message_extension, 0)
- .bb());
- EXPECT_EQ(
- 219, message.GetExtension(UNITTEST::repeated_foreign_message_extension, 0)
- .c());
- EXPECT_EQ(
- 220,
- message.GetExtension(UNITTEST::repeated_import_message_extension, 0).d());
- EXPECT_EQ(
- 227,
- message.GetExtension(UNITTEST::repeated_lazy_message_extension, 0).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR,
- message.GetExtension(UNITTEST::repeated_nested_enum_extension, 0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR,
- message.GetExtension(UNITTEST::repeated_foreign_enum_extension, 0));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR,
- message.GetExtension(UNITTEST::repeated_import_enum_extension, 0));
-
- EXPECT_EQ("224",
- message.GetExtension(UNITTEST::repeated_string_piece_extension, 0));
- EXPECT_EQ("225", message.GetExtension(UNITTEST::repeated_cord_extension, 0));
-
- EXPECT_EQ(301, message.GetExtension(UNITTEST::repeated_int32_extension, 1));
- EXPECT_EQ(302, message.GetExtension(UNITTEST::repeated_int64_extension, 1));
- EXPECT_EQ(303, message.GetExtension(UNITTEST::repeated_uint32_extension, 1));
- EXPECT_EQ(304, message.GetExtension(UNITTEST::repeated_uint64_extension, 1));
- EXPECT_EQ(305, message.GetExtension(UNITTEST::repeated_sint32_extension, 1));
- EXPECT_EQ(306, message.GetExtension(UNITTEST::repeated_sint64_extension, 1));
- EXPECT_EQ(307, message.GetExtension(UNITTEST::repeated_fixed32_extension, 1));
- EXPECT_EQ(308, message.GetExtension(UNITTEST::repeated_fixed64_extension, 1));
- EXPECT_EQ(309,
- message.GetExtension(UNITTEST::repeated_sfixed32_extension, 1));
- EXPECT_EQ(310,
- message.GetExtension(UNITTEST::repeated_sfixed64_extension, 1));
- EXPECT_EQ(311, message.GetExtension(UNITTEST::repeated_float_extension, 1));
- EXPECT_EQ(312, message.GetExtension(UNITTEST::repeated_double_extension, 1));
- EXPECT_FALSE(message.GetExtension(UNITTEST::repeated_bool_extension, 1));
- EXPECT_EQ("315",
- message.GetExtension(UNITTEST::repeated_string_extension, 1));
- EXPECT_EQ("316", message.GetExtension(UNITTEST::repeated_bytes_extension, 1));
-
- EXPECT_EQ(317,
- message.GetExtension(UNITTEST::repeatedgroup_extension, 1).a());
- EXPECT_EQ(318,
- message.GetExtension(UNITTEST::repeated_nested_message_extension, 1)
- .bb());
- EXPECT_EQ(
- 319, message.GetExtension(UNITTEST::repeated_foreign_message_extension, 1)
- .c());
- EXPECT_EQ(
- 320,
- message.GetExtension(UNITTEST::repeated_import_message_extension, 1).d());
- EXPECT_EQ(
- 327,
- message.GetExtension(UNITTEST::repeated_lazy_message_extension, 1).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAZ,
- message.GetExtension(UNITTEST::repeated_nested_enum_extension, 1));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ,
- message.GetExtension(UNITTEST::repeated_foreign_enum_extension, 1));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAZ,
- message.GetExtension(UNITTEST::repeated_import_enum_extension, 1));
-
- EXPECT_EQ("324",
- message.GetExtension(UNITTEST::repeated_string_piece_extension, 1));
- EXPECT_EQ("325", message.GetExtension(UNITTEST::repeated_cord_extension, 1));
-
- // -----------------------------------------------------------------
-
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_int32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_int64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_uint32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_uint64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_sint32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_sint64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_fixed32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_fixed64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_sfixed32_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_sfixed64_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_float_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_double_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_bool_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_string_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_bytes_extension));
-
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_nested_enum_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_foreign_enum_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_import_enum_extension));
-
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_string_piece_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::default_cord_extension));
-
- EXPECT_EQ(401, message.GetExtension(UNITTEST::default_int32_extension));
- EXPECT_EQ(402, message.GetExtension(UNITTEST::default_int64_extension));
- EXPECT_EQ(403, message.GetExtension(UNITTEST::default_uint32_extension));
- EXPECT_EQ(404, message.GetExtension(UNITTEST::default_uint64_extension));
- EXPECT_EQ(405, message.GetExtension(UNITTEST::default_sint32_extension));
- EXPECT_EQ(406, message.GetExtension(UNITTEST::default_sint64_extension));
- EXPECT_EQ(407, message.GetExtension(UNITTEST::default_fixed32_extension));
- EXPECT_EQ(408, message.GetExtension(UNITTEST::default_fixed64_extension));
- EXPECT_EQ(409, message.GetExtension(UNITTEST::default_sfixed32_extension));
- EXPECT_EQ(410, message.GetExtension(UNITTEST::default_sfixed64_extension));
- EXPECT_EQ(411, message.GetExtension(UNITTEST::default_float_extension));
- EXPECT_EQ(412, message.GetExtension(UNITTEST::default_double_extension));
- EXPECT_FALSE(message.GetExtension(UNITTEST::default_bool_extension));
- EXPECT_EQ("415", message.GetExtension(UNITTEST::default_string_extension));
- EXPECT_EQ("416", message.GetExtension(UNITTEST::default_bytes_extension));
-
- EXPECT_EQ(UNITTEST::TestAllTypes::FOO,
- message.GetExtension(UNITTEST::default_nested_enum_extension));
- EXPECT_EQ(UNITTEST::FOREIGN_FOO,
- message.GetExtension(UNITTEST::default_foreign_enum_extension));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_FOO,
- message.GetExtension(UNITTEST::default_import_enum_extension));
-
- EXPECT_EQ("424",
- message.GetExtension(UNITTEST::default_string_piece_extension));
- EXPECT_EQ("425", message.GetExtension(UNITTEST::default_cord_extension));
-
- EXPECT_TRUE(message.HasExtension(UNITTEST::oneof_uint32_extension));
- EXPECT_TRUE(
- message.GetExtension(UNITTEST::oneof_nested_message_extension).has_bb());
- EXPECT_TRUE(message.HasExtension(UNITTEST::oneof_string_extension));
- EXPECT_TRUE(message.HasExtension(UNITTEST::oneof_bytes_extension));
-
- EXPECT_EQ(601, message.GetExtension(UNITTEST::oneof_uint32_extension));
- EXPECT_EQ(
- 602, message.GetExtension(UNITTEST::oneof_nested_message_extension).bb());
- EXPECT_EQ("603", message.GetExtension(UNITTEST::oneof_string_extension));
- EXPECT_EQ("604", message.GetExtension(UNITTEST::oneof_bytes_extension));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectExtensionsClear(
- const UNITTEST::TestAllExtensions& message) {
- string serialized;
- ASSERT_TRUE(message.SerializeToString(&serialized));
- EXPECT_EQ("", serialized);
- EXPECT_EQ(0, message.ByteSizeLong());
-
- // has_blah() should initially be false for all optional fields.
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_int32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_int64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_uint32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_uint64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_sint32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_sint64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_fixed32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_fixed64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_sfixed32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_sfixed64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_float_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_double_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_bool_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_string_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_bytes_extension));
-
- EXPECT_FALSE(message.HasExtension(UNITTEST::optionalgroup_extension));
- EXPECT_FALSE(
- message.HasExtension(UNITTEST::optional_nested_message_extension));
- EXPECT_FALSE(
- message.HasExtension(UNITTEST::optional_foreign_message_extension));
- EXPECT_FALSE(
- message.HasExtension(UNITTEST::optional_import_message_extension));
- EXPECT_FALSE(
- message.HasExtension(UNITTEST::optional_public_import_message_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_lazy_message_extension));
-
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_nested_enum_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_foreign_enum_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_import_enum_extension));
-
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_string_piece_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::optional_cord_extension));
-
- // Optional fields without defaults are set to zero or something like it.
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_int32_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_int64_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_uint32_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_uint64_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_sint32_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_sint64_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_fixed32_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_fixed64_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_sfixed32_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_sfixed64_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_float_extension));
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optional_double_extension));
- EXPECT_FALSE(message.GetExtension(UNITTEST::optional_bool_extension));
- EXPECT_EQ("", message.GetExtension(UNITTEST::optional_string_extension));
- EXPECT_EQ("", message.GetExtension(UNITTEST::optional_bytes_extension));
-
- // Embedded messages should also be clear.
- EXPECT_FALSE(message.GetExtension(UNITTEST::optionalgroup_extension).has_a());
- EXPECT_FALSE(message.GetExtension(UNITTEST::optional_nested_message_extension)
- .has_bb());
- EXPECT_FALSE(
- message.GetExtension(UNITTEST::optional_foreign_message_extension)
- .has_c());
- EXPECT_FALSE(message.GetExtension(UNITTEST::optional_import_message_extension)
- .has_d());
- EXPECT_FALSE(
- message.GetExtension(UNITTEST::optional_public_import_message_extension)
- .has_e());
- EXPECT_FALSE(
- message.GetExtension(UNITTEST::optional_lazy_message_extension).has_bb());
-
- EXPECT_EQ(0, message.GetExtension(UNITTEST::optionalgroup_extension).a());
- EXPECT_EQ(
- 0,
- message.GetExtension(UNITTEST::optional_nested_message_extension).bb());
- EXPECT_EQ(
- 0,
- message.GetExtension(UNITTEST::optional_foreign_message_extension).c());
- EXPECT_EQ(
- 0, message.GetExtension(UNITTEST::optional_import_message_extension).d());
- EXPECT_EQ(
- 0,
- message.GetExtension(UNITTEST::optional_public_import_message_extension)
- .e());
- EXPECT_EQ(
- 0, message.GetExtension(UNITTEST::optional_lazy_message_extension).bb());
-
- // Enums without defaults are set to the first value in the enum.
- EXPECT_EQ(UNITTEST::TestAllTypes::FOO,
- message.GetExtension(UNITTEST::optional_nested_enum_extension));
- EXPECT_EQ(UNITTEST::FOREIGN_FOO,
- message.GetExtension(UNITTEST::optional_foreign_enum_extension));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_FOO,
- message.GetExtension(UNITTEST::optional_import_enum_extension));
-
- EXPECT_EQ("",
- message.GetExtension(UNITTEST::optional_string_piece_extension));
- EXPECT_EQ("", message.GetExtension(UNITTEST::optional_cord_extension));
-
- // Repeated fields are empty.
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_int32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_int64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_uint32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_uint64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_sint32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_sint64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_fixed32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_fixed64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_sfixed32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_sfixed64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_float_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_double_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_bool_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_string_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_bytes_extension));
-
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeatedgroup_extension));
- EXPECT_EQ(0,
- message.ExtensionSize(UNITTEST::repeated_nested_message_extension));
- EXPECT_EQ(
- 0, message.ExtensionSize(UNITTEST::repeated_foreign_message_extension));
- EXPECT_EQ(0,
- message.ExtensionSize(UNITTEST::repeated_import_message_extension));
- EXPECT_EQ(0,
- message.ExtensionSize(UNITTEST::repeated_lazy_message_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_nested_enum_extension));
- EXPECT_EQ(0,
- message.ExtensionSize(UNITTEST::repeated_foreign_enum_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_import_enum_extension));
-
- EXPECT_EQ(0,
- message.ExtensionSize(UNITTEST::repeated_string_piece_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::repeated_cord_extension));
-
- // has_blah() should also be false for all default fields.
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_int32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_int64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_uint32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_uint64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_sint32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_sint64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_fixed32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_fixed64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_sfixed32_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_sfixed64_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_float_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_double_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_bool_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_string_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_bytes_extension));
-
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_nested_enum_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_foreign_enum_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_import_enum_extension));
-
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_string_piece_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::default_cord_extension));
-
- // Fields with defaults have their default values (duh).
- EXPECT_EQ(41, message.GetExtension(UNITTEST::default_int32_extension));
- EXPECT_EQ(42, message.GetExtension(UNITTEST::default_int64_extension));
- EXPECT_EQ(43, message.GetExtension(UNITTEST::default_uint32_extension));
- EXPECT_EQ(44, message.GetExtension(UNITTEST::default_uint64_extension));
- EXPECT_EQ(-45, message.GetExtension(UNITTEST::default_sint32_extension));
- EXPECT_EQ(46, message.GetExtension(UNITTEST::default_sint64_extension));
- EXPECT_EQ(47, message.GetExtension(UNITTEST::default_fixed32_extension));
- EXPECT_EQ(48, message.GetExtension(UNITTEST::default_fixed64_extension));
- EXPECT_EQ(49, message.GetExtension(UNITTEST::default_sfixed32_extension));
- EXPECT_EQ(-50, message.GetExtension(UNITTEST::default_sfixed64_extension));
- EXPECT_EQ(51.5, message.GetExtension(UNITTEST::default_float_extension));
- EXPECT_EQ(52e3, message.GetExtension(UNITTEST::default_double_extension));
- EXPECT_TRUE(message.GetExtension(UNITTEST::default_bool_extension));
- EXPECT_EQ("hello", message.GetExtension(UNITTEST::default_string_extension));
- EXPECT_EQ("world", message.GetExtension(UNITTEST::default_bytes_extension));
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR,
- message.GetExtension(UNITTEST::default_nested_enum_extension));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR,
- message.GetExtension(UNITTEST::default_foreign_enum_extension));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR,
- message.GetExtension(UNITTEST::default_import_enum_extension));
-
- EXPECT_EQ("abc",
- message.GetExtension(UNITTEST::default_string_piece_extension));
- EXPECT_EQ("123", message.GetExtension(UNITTEST::default_cord_extension));
-
- EXPECT_FALSE(message.HasExtension(UNITTEST::oneof_uint32_extension));
- EXPECT_FALSE(
- message.GetExtension(UNITTEST::oneof_nested_message_extension).has_bb());
- EXPECT_FALSE(message.HasExtension(UNITTEST::oneof_string_extension));
- EXPECT_FALSE(message.HasExtension(UNITTEST::oneof_bytes_extension));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectRepeatedExtensionsModified(
- const UNITTEST::TestAllExtensions& message) {
- // ModifyRepeatedFields only sets the second repeated element of each
- // field. In addition to verifying this, we also verify that the first
- // element and size were *not* modified.
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_int32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_int64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_uint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_uint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_fixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_fixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sfixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sfixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_float_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_double_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_bool_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_string_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_bytes_extension));
-
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeatedgroup_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_nested_message_extension));
- ASSERT_EQ(
- 2, message.ExtensionSize(UNITTEST::repeated_foreign_message_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_import_message_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_lazy_message_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_nested_enum_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_foreign_enum_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_import_enum_extension));
-
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_string_piece_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_cord_extension));
-
- EXPECT_EQ(201, message.GetExtension(UNITTEST::repeated_int32_extension, 0));
- EXPECT_EQ(202, message.GetExtension(UNITTEST::repeated_int64_extension, 0));
- EXPECT_EQ(203, message.GetExtension(UNITTEST::repeated_uint32_extension, 0));
- EXPECT_EQ(204, message.GetExtension(UNITTEST::repeated_uint64_extension, 0));
- EXPECT_EQ(205, message.GetExtension(UNITTEST::repeated_sint32_extension, 0));
- EXPECT_EQ(206, message.GetExtension(UNITTEST::repeated_sint64_extension, 0));
- EXPECT_EQ(207, message.GetExtension(UNITTEST::repeated_fixed32_extension, 0));
- EXPECT_EQ(208, message.GetExtension(UNITTEST::repeated_fixed64_extension, 0));
- EXPECT_EQ(209,
- message.GetExtension(UNITTEST::repeated_sfixed32_extension, 0));
- EXPECT_EQ(210,
- message.GetExtension(UNITTEST::repeated_sfixed64_extension, 0));
- EXPECT_EQ(211, message.GetExtension(UNITTEST::repeated_float_extension, 0));
- EXPECT_EQ(212, message.GetExtension(UNITTEST::repeated_double_extension, 0));
- EXPECT_TRUE(message.GetExtension(UNITTEST::repeated_bool_extension, 0));
- EXPECT_EQ("215",
- message.GetExtension(UNITTEST::repeated_string_extension, 0));
- EXPECT_EQ("216", message.GetExtension(UNITTEST::repeated_bytes_extension, 0));
-
- EXPECT_EQ(217,
- message.GetExtension(UNITTEST::repeatedgroup_extension, 0).a());
- EXPECT_EQ(218,
- message.GetExtension(UNITTEST::repeated_nested_message_extension, 0)
- .bb());
- EXPECT_EQ(
- 219, message.GetExtension(UNITTEST::repeated_foreign_message_extension, 0)
- .c());
- EXPECT_EQ(
- 220,
- message.GetExtension(UNITTEST::repeated_import_message_extension, 0).d());
- EXPECT_EQ(
- 227,
- message.GetExtension(UNITTEST::repeated_lazy_message_extension, 0).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR,
- message.GetExtension(UNITTEST::repeated_nested_enum_extension, 0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR,
- message.GetExtension(UNITTEST::repeated_foreign_enum_extension, 0));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR,
- message.GetExtension(UNITTEST::repeated_import_enum_extension, 0));
-
- EXPECT_EQ("224",
- message.GetExtension(UNITTEST::repeated_string_piece_extension, 0));
- EXPECT_EQ("225", message.GetExtension(UNITTEST::repeated_cord_extension, 0));
-
- // Actually verify the second (modified) elements now.
- EXPECT_EQ(501, message.GetExtension(UNITTEST::repeated_int32_extension, 1));
- EXPECT_EQ(502, message.GetExtension(UNITTEST::repeated_int64_extension, 1));
- EXPECT_EQ(503, message.GetExtension(UNITTEST::repeated_uint32_extension, 1));
- EXPECT_EQ(504, message.GetExtension(UNITTEST::repeated_uint64_extension, 1));
- EXPECT_EQ(505, message.GetExtension(UNITTEST::repeated_sint32_extension, 1));
- EXPECT_EQ(506, message.GetExtension(UNITTEST::repeated_sint64_extension, 1));
- EXPECT_EQ(507, message.GetExtension(UNITTEST::repeated_fixed32_extension, 1));
- EXPECT_EQ(508, message.GetExtension(UNITTEST::repeated_fixed64_extension, 1));
- EXPECT_EQ(509,
- message.GetExtension(UNITTEST::repeated_sfixed32_extension, 1));
- EXPECT_EQ(510,
- message.GetExtension(UNITTEST::repeated_sfixed64_extension, 1));
- EXPECT_EQ(511, message.GetExtension(UNITTEST::repeated_float_extension, 1));
- EXPECT_EQ(512, message.GetExtension(UNITTEST::repeated_double_extension, 1));
- EXPECT_TRUE(message.GetExtension(UNITTEST::repeated_bool_extension, 1));
- EXPECT_EQ("515",
- message.GetExtension(UNITTEST::repeated_string_extension, 1));
- EXPECT_EQ("516", message.GetExtension(UNITTEST::repeated_bytes_extension, 1));
-
- EXPECT_EQ(517,
- message.GetExtension(UNITTEST::repeatedgroup_extension, 1).a());
- EXPECT_EQ(518,
- message.GetExtension(UNITTEST::repeated_nested_message_extension, 1)
- .bb());
- EXPECT_EQ(
- 519, message.GetExtension(UNITTEST::repeated_foreign_message_extension, 1)
- .c());
- EXPECT_EQ(
- 520,
- message.GetExtension(UNITTEST::repeated_import_message_extension, 1).d());
- EXPECT_EQ(
- 527,
- message.GetExtension(UNITTEST::repeated_lazy_message_extension, 1).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::FOO,
- message.GetExtension(UNITTEST::repeated_nested_enum_extension, 1));
- EXPECT_EQ(UNITTEST::FOREIGN_FOO,
- message.GetExtension(UNITTEST::repeated_foreign_enum_extension, 1));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_FOO,
- message.GetExtension(UNITTEST::repeated_import_enum_extension, 1));
-
- EXPECT_EQ("524",
- message.GetExtension(UNITTEST::repeated_string_piece_extension, 1));
- EXPECT_EQ("525", message.GetExtension(UNITTEST::repeated_cord_extension, 1));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::SetPackedExtensions(
- UNITTEST::TestPackedExtensions* message) {
- message->AddExtension(UNITTEST::packed_int32_extension, 601);
- message->AddExtension(UNITTEST::packed_int64_extension, 602);
- message->AddExtension(UNITTEST::packed_uint32_extension, 603);
- message->AddExtension(UNITTEST::packed_uint64_extension, 604);
- message->AddExtension(UNITTEST::packed_sint32_extension, 605);
- message->AddExtension(UNITTEST::packed_sint64_extension, 606);
- message->AddExtension(UNITTEST::packed_fixed32_extension, 607);
- message->AddExtension(UNITTEST::packed_fixed64_extension, 608);
- message->AddExtension(UNITTEST::packed_sfixed32_extension, 609);
- message->AddExtension(UNITTEST::packed_sfixed64_extension, 610);
- message->AddExtension(UNITTEST::packed_float_extension, 611);
- message->AddExtension(UNITTEST::packed_double_extension, 612);
- message->AddExtension(UNITTEST::packed_bool_extension, true);
- message->AddExtension(UNITTEST::packed_enum_extension, UNITTEST::FOREIGN_BAR);
- // add a second one of each field
- message->AddExtension(UNITTEST::packed_int32_extension, 701);
- message->AddExtension(UNITTEST::packed_int64_extension, 702);
- message->AddExtension(UNITTEST::packed_uint32_extension, 703);
- message->AddExtension(UNITTEST::packed_uint64_extension, 704);
- message->AddExtension(UNITTEST::packed_sint32_extension, 705);
- message->AddExtension(UNITTEST::packed_sint64_extension, 706);
- message->AddExtension(UNITTEST::packed_fixed32_extension, 707);
- message->AddExtension(UNITTEST::packed_fixed64_extension, 708);
- message->AddExtension(UNITTEST::packed_sfixed32_extension, 709);
- message->AddExtension(UNITTEST::packed_sfixed64_extension, 710);
- message->AddExtension(UNITTEST::packed_float_extension, 711);
- message->AddExtension(UNITTEST::packed_double_extension, 712);
- message->AddExtension(UNITTEST::packed_bool_extension, false);
- message->AddExtension(UNITTEST::packed_enum_extension, UNITTEST::FOREIGN_BAZ);
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ModifyPackedExtensions(
- UNITTEST::TestPackedExtensions* message) {
- message->SetExtension(UNITTEST::packed_int32_extension, 1, 801);
- message->SetExtension(UNITTEST::packed_int64_extension, 1, 802);
- message->SetExtension(UNITTEST::packed_uint32_extension, 1, 803);
- message->SetExtension(UNITTEST::packed_uint64_extension, 1, 804);
- message->SetExtension(UNITTEST::packed_sint32_extension, 1, 805);
- message->SetExtension(UNITTEST::packed_sint64_extension, 1, 806);
- message->SetExtension(UNITTEST::packed_fixed32_extension, 1, 807);
- message->SetExtension(UNITTEST::packed_fixed64_extension, 1, 808);
- message->SetExtension(UNITTEST::packed_sfixed32_extension, 1, 809);
- message->SetExtension(UNITTEST::packed_sfixed64_extension, 1, 810);
- message->SetExtension(UNITTEST::packed_float_extension, 1, 811);
- message->SetExtension(UNITTEST::packed_double_extension, 1, 812);
- message->SetExtension(UNITTEST::packed_bool_extension, 1, true);
- message->SetExtension(UNITTEST::packed_enum_extension, 1,
- UNITTEST::FOREIGN_FOO);
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectPackedExtensionsSet(
- const UNITTEST::TestPackedExtensions& message) {
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_int32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_int64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_uint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_uint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_sint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_sint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_fixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_fixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_sfixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_sfixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_float_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_double_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_bool_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_enum_extension));
-
- EXPECT_EQ(601, message.GetExtension(UNITTEST::packed_int32_extension, 0));
- EXPECT_EQ(602, message.GetExtension(UNITTEST::packed_int64_extension, 0));
- EXPECT_EQ(603, message.GetExtension(UNITTEST::packed_uint32_extension, 0));
- EXPECT_EQ(604, message.GetExtension(UNITTEST::packed_uint64_extension, 0));
- EXPECT_EQ(605, message.GetExtension(UNITTEST::packed_sint32_extension, 0));
- EXPECT_EQ(606, message.GetExtension(UNITTEST::packed_sint64_extension, 0));
- EXPECT_EQ(607, message.GetExtension(UNITTEST::packed_fixed32_extension, 0));
- EXPECT_EQ(608, message.GetExtension(UNITTEST::packed_fixed64_extension, 0));
- EXPECT_EQ(609, message.GetExtension(UNITTEST::packed_sfixed32_extension, 0));
- EXPECT_EQ(610, message.GetExtension(UNITTEST::packed_sfixed64_extension, 0));
- EXPECT_EQ(611, message.GetExtension(UNITTEST::packed_float_extension, 0));
- EXPECT_EQ(612, message.GetExtension(UNITTEST::packed_double_extension, 0));
- EXPECT_TRUE(message.GetExtension(UNITTEST::packed_bool_extension, 0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR,
- message.GetExtension(UNITTEST::packed_enum_extension, 0));
- EXPECT_EQ(701, message.GetExtension(UNITTEST::packed_int32_extension, 1));
- EXPECT_EQ(702, message.GetExtension(UNITTEST::packed_int64_extension, 1));
- EXPECT_EQ(703, message.GetExtension(UNITTEST::packed_uint32_extension, 1));
- EXPECT_EQ(704, message.GetExtension(UNITTEST::packed_uint64_extension, 1));
- EXPECT_EQ(705, message.GetExtension(UNITTEST::packed_sint32_extension, 1));
- EXPECT_EQ(706, message.GetExtension(UNITTEST::packed_sint64_extension, 1));
- EXPECT_EQ(707, message.GetExtension(UNITTEST::packed_fixed32_extension, 1));
- EXPECT_EQ(708, message.GetExtension(UNITTEST::packed_fixed64_extension, 1));
- EXPECT_EQ(709, message.GetExtension(UNITTEST::packed_sfixed32_extension, 1));
- EXPECT_EQ(710, message.GetExtension(UNITTEST::packed_sfixed64_extension, 1));
- EXPECT_EQ(711, message.GetExtension(UNITTEST::packed_float_extension, 1));
- EXPECT_EQ(712, message.GetExtension(UNITTEST::packed_double_extension, 1));
- EXPECT_FALSE(message.GetExtension(UNITTEST::packed_bool_extension, 1));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ,
- message.GetExtension(UNITTEST::packed_enum_extension, 1));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectPackedExtensionsClear(
- const UNITTEST::TestPackedExtensions& message) {
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_int32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_int64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_uint32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_uint64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_sint32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_sint64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_fixed32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_fixed64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_sfixed32_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_sfixed64_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_float_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_double_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_bool_extension));
- EXPECT_EQ(0, message.ExtensionSize(UNITTEST::packed_enum_extension));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectPackedExtensionsModified(
- const UNITTEST::TestPackedExtensions& message) {
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_int32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_int64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_uint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_uint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_sint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_sint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_fixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_fixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_sfixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_sfixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_float_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_double_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_bool_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::packed_enum_extension));
- EXPECT_EQ(601, message.GetExtension(UNITTEST::packed_int32_extension, 0));
- EXPECT_EQ(602, message.GetExtension(UNITTEST::packed_int64_extension, 0));
- EXPECT_EQ(603, message.GetExtension(UNITTEST::packed_uint32_extension, 0));
- EXPECT_EQ(604, message.GetExtension(UNITTEST::packed_uint64_extension, 0));
- EXPECT_EQ(605, message.GetExtension(UNITTEST::packed_sint32_extension, 0));
- EXPECT_EQ(606, message.GetExtension(UNITTEST::packed_sint64_extension, 0));
- EXPECT_EQ(607, message.GetExtension(UNITTEST::packed_fixed32_extension, 0));
- EXPECT_EQ(608, message.GetExtension(UNITTEST::packed_fixed64_extension, 0));
- EXPECT_EQ(609, message.GetExtension(UNITTEST::packed_sfixed32_extension, 0));
- EXPECT_EQ(610, message.GetExtension(UNITTEST::packed_sfixed64_extension, 0));
- EXPECT_EQ(611, message.GetExtension(UNITTEST::packed_float_extension, 0));
- EXPECT_EQ(612, message.GetExtension(UNITTEST::packed_double_extension, 0));
- EXPECT_TRUE(message.GetExtension(UNITTEST::packed_bool_extension, 0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR,
- message.GetExtension(UNITTEST::packed_enum_extension, 0));
-
- // Actually verify the second (modified) elements now.
- EXPECT_EQ(801, message.GetExtension(UNITTEST::packed_int32_extension, 1));
- EXPECT_EQ(802, message.GetExtension(UNITTEST::packed_int64_extension, 1));
- EXPECT_EQ(803, message.GetExtension(UNITTEST::packed_uint32_extension, 1));
- EXPECT_EQ(804, message.GetExtension(UNITTEST::packed_uint64_extension, 1));
- EXPECT_EQ(805, message.GetExtension(UNITTEST::packed_sint32_extension, 1));
- EXPECT_EQ(806, message.GetExtension(UNITTEST::packed_sint64_extension, 1));
- EXPECT_EQ(807, message.GetExtension(UNITTEST::packed_fixed32_extension, 1));
- EXPECT_EQ(808, message.GetExtension(UNITTEST::packed_fixed64_extension, 1));
- EXPECT_EQ(809, message.GetExtension(UNITTEST::packed_sfixed32_extension, 1));
- EXPECT_EQ(810, message.GetExtension(UNITTEST::packed_sfixed64_extension, 1));
- EXPECT_EQ(811, message.GetExtension(UNITTEST::packed_float_extension, 1));
- EXPECT_EQ(812, message.GetExtension(UNITTEST::packed_double_extension, 1));
- EXPECT_TRUE(message.GetExtension(UNITTEST::packed_bool_extension, 1));
- EXPECT_EQ(UNITTEST::FOREIGN_FOO,
- message.GetExtension(UNITTEST::packed_enum_extension, 1));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectUnpackedExtensionsSet(
- const UNITTEST::TestUnpackedExtensions& message) {
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_int32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_int64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_uint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_uint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_sint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_sint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_fixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_fixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_sfixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_sfixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_float_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_double_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_bool_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::unpacked_enum_extension));
-
- EXPECT_EQ(601, message.GetExtension(UNITTEST::unpacked_int32_extension, 0));
- EXPECT_EQ(602, message.GetExtension(UNITTEST::unpacked_int64_extension, 0));
- EXPECT_EQ(603, message.GetExtension(UNITTEST::unpacked_uint32_extension, 0));
- EXPECT_EQ(604, message.GetExtension(UNITTEST::unpacked_uint64_extension, 0));
- EXPECT_EQ(605, message.GetExtension(UNITTEST::unpacked_sint32_extension, 0));
- EXPECT_EQ(606, message.GetExtension(UNITTEST::unpacked_sint64_extension, 0));
- EXPECT_EQ(607, message.GetExtension(UNITTEST::unpacked_fixed32_extension, 0));
- EXPECT_EQ(608, message.GetExtension(UNITTEST::unpacked_fixed64_extension, 0));
- EXPECT_EQ(609,
- message.GetExtension(UNITTEST::unpacked_sfixed32_extension, 0));
- EXPECT_EQ(610,
- message.GetExtension(UNITTEST::unpacked_sfixed64_extension, 0));
- EXPECT_EQ(611, message.GetExtension(UNITTEST::unpacked_float_extension, 0));
- EXPECT_EQ(612, message.GetExtension(UNITTEST::unpacked_double_extension, 0));
- EXPECT_EQ(true, message.GetExtension(UNITTEST::unpacked_bool_extension, 0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR,
- message.GetExtension(UNITTEST::unpacked_enum_extension, 0));
- EXPECT_EQ(701, message.GetExtension(UNITTEST::unpacked_int32_extension, 1));
- EXPECT_EQ(702, message.GetExtension(UNITTEST::unpacked_int64_extension, 1));
- EXPECT_EQ(703, message.GetExtension(UNITTEST::unpacked_uint32_extension, 1));
- EXPECT_EQ(704, message.GetExtension(UNITTEST::unpacked_uint64_extension, 1));
- EXPECT_EQ(705, message.GetExtension(UNITTEST::unpacked_sint32_extension, 1));
- EXPECT_EQ(706, message.GetExtension(UNITTEST::unpacked_sint64_extension, 1));
- EXPECT_EQ(707, message.GetExtension(UNITTEST::unpacked_fixed32_extension, 1));
- EXPECT_EQ(708, message.GetExtension(UNITTEST::unpacked_fixed64_extension, 1));
- EXPECT_EQ(709,
- message.GetExtension(UNITTEST::unpacked_sfixed32_extension, 1));
- EXPECT_EQ(710,
- message.GetExtension(UNITTEST::unpacked_sfixed64_extension, 1));
- EXPECT_EQ(711, message.GetExtension(UNITTEST::unpacked_float_extension, 1));
- EXPECT_EQ(712, message.GetExtension(UNITTEST::unpacked_double_extension, 1));
- EXPECT_EQ(false, message.GetExtension(UNITTEST::unpacked_bool_extension, 1));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ,
- message.GetExtension(UNITTEST::unpacked_enum_extension, 1));
-}
-
-// -------------------------------------------------------------------
-
-inline void TestUtil::ExpectLastRepeatedsRemoved(
- const UNITTEST::TestAllTypes& message) {
- ASSERT_EQ(1, message.repeated_int32_size());
- ASSERT_EQ(1, message.repeated_int64_size());
- ASSERT_EQ(1, message.repeated_uint32_size());
- ASSERT_EQ(1, message.repeated_uint64_size());
- ASSERT_EQ(1, message.repeated_sint32_size());
- ASSERT_EQ(1, message.repeated_sint64_size());
- ASSERT_EQ(1, message.repeated_fixed32_size());
- ASSERT_EQ(1, message.repeated_fixed64_size());
- ASSERT_EQ(1, message.repeated_sfixed32_size());
- ASSERT_EQ(1, message.repeated_sfixed64_size());
- ASSERT_EQ(1, message.repeated_float_size());
- ASSERT_EQ(1, message.repeated_double_size());
- ASSERT_EQ(1, message.repeated_bool_size());
- ASSERT_EQ(1, message.repeated_string_size());
- ASSERT_EQ(1, message.repeated_bytes_size());
-
- ASSERT_EQ(1, message.repeatedgroup_size());
- ASSERT_EQ(1, message.repeated_nested_message_size());
- ASSERT_EQ(1, message.repeated_foreign_message_size());
- ASSERT_EQ(1, message.repeated_import_message_size());
- ASSERT_EQ(1, message.repeated_import_message_size());
- ASSERT_EQ(1, message.repeated_nested_enum_size());
- ASSERT_EQ(1, message.repeated_foreign_enum_size());
- ASSERT_EQ(1, message.repeated_import_enum_size());
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- ASSERT_EQ(1, message.repeated_string_piece_size());
- ASSERT_EQ(1, message.repeated_cord_size());
-#endif
-
- // Test that the remaining element is the correct one.
- EXPECT_EQ(201, message.repeated_int32(0));
- EXPECT_EQ(202, message.repeated_int64(0));
- EXPECT_EQ(203, message.repeated_uint32(0));
- EXPECT_EQ(204, message.repeated_uint64(0));
- EXPECT_EQ(205, message.repeated_sint32(0));
- EXPECT_EQ(206, message.repeated_sint64(0));
- EXPECT_EQ(207, message.repeated_fixed32(0));
- EXPECT_EQ(208, message.repeated_fixed64(0));
- EXPECT_EQ(209, message.repeated_sfixed32(0));
- EXPECT_EQ(210, message.repeated_sfixed64(0));
- EXPECT_EQ(211, message.repeated_float(0));
- EXPECT_EQ(212, message.repeated_double(0));
- EXPECT_TRUE(message.repeated_bool(0));
- EXPECT_EQ("215", message.repeated_string(0));
- EXPECT_EQ("216", message.repeated_bytes(0));
-
- EXPECT_EQ(217, message.repeatedgroup(0).a());
- EXPECT_EQ(218, message.repeated_nested_message(0).bb());
- EXPECT_EQ(219, message.repeated_foreign_message(0).c());
- EXPECT_EQ(220, message.repeated_import_message(0).d());
- EXPECT_EQ(220, message.repeated_import_message(0).d());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR, message.repeated_nested_enum(0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.repeated_foreign_enum(0));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR, message.repeated_import_enum(0));
-}
-
-inline void TestUtil::ExpectLastRepeatedExtensionsRemoved(
- const UNITTEST::TestAllExtensions& message) {
- // Test that one element was removed.
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_int32_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_int64_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_uint32_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_uint64_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_sint32_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_sint64_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_fixed32_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_fixed64_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_sfixed32_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_sfixed64_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_float_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_double_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_bool_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_string_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_bytes_extension));
-
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeatedgroup_extension));
- ASSERT_EQ(1,
- message.ExtensionSize(UNITTEST::repeated_nested_message_extension));
- ASSERT_EQ(
- 1, message.ExtensionSize(UNITTEST::repeated_foreign_message_extension));
- ASSERT_EQ(1,
- message.ExtensionSize(UNITTEST::repeated_import_message_extension));
- ASSERT_EQ(1,
- message.ExtensionSize(UNITTEST::repeated_lazy_message_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_nested_enum_extension));
- ASSERT_EQ(1,
- message.ExtensionSize(UNITTEST::repeated_foreign_enum_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_import_enum_extension));
-
- ASSERT_EQ(1,
- message.ExtensionSize(UNITTEST::repeated_string_piece_extension));
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeated_cord_extension));
-
- // Test that the remaining element is the correct one.
- EXPECT_EQ(201, message.GetExtension(UNITTEST::repeated_int32_extension, 0));
- EXPECT_EQ(202, message.GetExtension(UNITTEST::repeated_int64_extension, 0));
- EXPECT_EQ(203, message.GetExtension(UNITTEST::repeated_uint32_extension, 0));
- EXPECT_EQ(204, message.GetExtension(UNITTEST::repeated_uint64_extension, 0));
- EXPECT_EQ(205, message.GetExtension(UNITTEST::repeated_sint32_extension, 0));
- EXPECT_EQ(206, message.GetExtension(UNITTEST::repeated_sint64_extension, 0));
- EXPECT_EQ(207, message.GetExtension(UNITTEST::repeated_fixed32_extension, 0));
- EXPECT_EQ(208, message.GetExtension(UNITTEST::repeated_fixed64_extension, 0));
- EXPECT_EQ(209,
- message.GetExtension(UNITTEST::repeated_sfixed32_extension, 0));
- EXPECT_EQ(210,
- message.GetExtension(UNITTEST::repeated_sfixed64_extension, 0));
- EXPECT_EQ(211, message.GetExtension(UNITTEST::repeated_float_extension, 0));
- EXPECT_EQ(212, message.GetExtension(UNITTEST::repeated_double_extension, 0));
- EXPECT_TRUE(message.GetExtension(UNITTEST::repeated_bool_extension, 0));
- EXPECT_EQ("215",
- message.GetExtension(UNITTEST::repeated_string_extension, 0));
- EXPECT_EQ("216", message.GetExtension(UNITTEST::repeated_bytes_extension, 0));
-
- EXPECT_EQ(217,
- message.GetExtension(UNITTEST::repeatedgroup_extension, 0).a());
- EXPECT_EQ(218,
- message.GetExtension(UNITTEST::repeated_nested_message_extension, 0)
- .bb());
- EXPECT_EQ(
- 219, message.GetExtension(UNITTEST::repeated_foreign_message_extension, 0)
- .c());
- EXPECT_EQ(
- 220,
- message.GetExtension(UNITTEST::repeated_import_message_extension, 0).d());
- EXPECT_EQ(
- 227,
- message.GetExtension(UNITTEST::repeated_lazy_message_extension, 0).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR,
- message.GetExtension(UNITTEST::repeated_nested_enum_extension, 0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR,
- message.GetExtension(UNITTEST::repeated_foreign_enum_extension, 0));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR,
- message.GetExtension(UNITTEST::repeated_import_enum_extension, 0));
-
- EXPECT_EQ("224",
- message.GetExtension(UNITTEST::repeated_string_piece_extension, 0));
- EXPECT_EQ("225", message.GetExtension(UNITTEST::repeated_cord_extension, 0));
-}
-
-inline void TestUtil::ExpectLastRepeatedsReleased(
- const UNITTEST::TestAllTypes& message) {
- ASSERT_EQ(1, message.repeatedgroup_size());
- ASSERT_EQ(1, message.repeated_nested_message_size());
- ASSERT_EQ(1, message.repeated_foreign_message_size());
- ASSERT_EQ(1, message.repeated_import_message_size());
- ASSERT_EQ(1, message.repeated_import_message_size());
-
- EXPECT_EQ(217, message.repeatedgroup(0).a());
- EXPECT_EQ(218, message.repeated_nested_message(0).bb());
- EXPECT_EQ(219, message.repeated_foreign_message(0).c());
- EXPECT_EQ(220, message.repeated_import_message(0).d());
- EXPECT_EQ(220, message.repeated_import_message(0).d());
-}
-
-inline void TestUtil::ExpectLastRepeatedExtensionsReleased(
- const UNITTEST::TestAllExtensions& message) {
- ASSERT_EQ(1, message.ExtensionSize(UNITTEST::repeatedgroup_extension));
- ASSERT_EQ(1,
- message.ExtensionSize(UNITTEST::repeated_nested_message_extension));
- ASSERT_EQ(
- 1, message.ExtensionSize(UNITTEST::repeated_foreign_message_extension));
- ASSERT_EQ(1,
- message.ExtensionSize(UNITTEST::repeated_import_message_extension));
- ASSERT_EQ(1,
- message.ExtensionSize(UNITTEST::repeated_lazy_message_extension));
-
- EXPECT_EQ(217,
- message.GetExtension(UNITTEST::repeatedgroup_extension, 0).a());
- EXPECT_EQ(218,
- message.GetExtension(UNITTEST::repeated_nested_message_extension, 0)
- .bb());
- EXPECT_EQ(
- 219, message.GetExtension(UNITTEST::repeated_foreign_message_extension, 0)
- .c());
- EXPECT_EQ(
- 220,
- message.GetExtension(UNITTEST::repeated_import_message_extension, 0).d());
- EXPECT_EQ(
- 227,
- message.GetExtension(UNITTEST::repeated_lazy_message_extension, 0).bb());
-}
-
-inline void TestUtil::ExpectRepeatedsSwapped(
- const UNITTEST::TestAllTypes& message) {
- ASSERT_EQ(2, message.repeated_int32_size());
- ASSERT_EQ(2, message.repeated_int64_size());
- ASSERT_EQ(2, message.repeated_uint32_size());
- ASSERT_EQ(2, message.repeated_uint64_size());
- ASSERT_EQ(2, message.repeated_sint32_size());
- ASSERT_EQ(2, message.repeated_sint64_size());
- ASSERT_EQ(2, message.repeated_fixed32_size());
- ASSERT_EQ(2, message.repeated_fixed64_size());
- ASSERT_EQ(2, message.repeated_sfixed32_size());
- ASSERT_EQ(2, message.repeated_sfixed64_size());
- ASSERT_EQ(2, message.repeated_float_size());
- ASSERT_EQ(2, message.repeated_double_size());
- ASSERT_EQ(2, message.repeated_bool_size());
- ASSERT_EQ(2, message.repeated_string_size());
- ASSERT_EQ(2, message.repeated_bytes_size());
-
- ASSERT_EQ(2, message.repeatedgroup_size());
- ASSERT_EQ(2, message.repeated_nested_message_size());
- ASSERT_EQ(2, message.repeated_foreign_message_size());
- ASSERT_EQ(2, message.repeated_import_message_size());
- ASSERT_EQ(2, message.repeated_import_message_size());
- ASSERT_EQ(2, message.repeated_nested_enum_size());
- ASSERT_EQ(2, message.repeated_foreign_enum_size());
- ASSERT_EQ(2, message.repeated_import_enum_size());
-
-#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
- ASSERT_EQ(2, message.repeated_string_piece_size());
- ASSERT_EQ(2, message.repeated_cord_size());
-#endif
-
- // Test that the first element and second element are flipped.
- EXPECT_EQ(201, message.repeated_int32(1));
- EXPECT_EQ(202, message.repeated_int64(1));
- EXPECT_EQ(203, message.repeated_uint32(1));
- EXPECT_EQ(204, message.repeated_uint64(1));
- EXPECT_EQ(205, message.repeated_sint32(1));
- EXPECT_EQ(206, message.repeated_sint64(1));
- EXPECT_EQ(207, message.repeated_fixed32(1));
- EXPECT_EQ(208, message.repeated_fixed64(1));
- EXPECT_EQ(209, message.repeated_sfixed32(1));
- EXPECT_EQ(210, message.repeated_sfixed64(1));
- EXPECT_EQ(211, message.repeated_float(1));
- EXPECT_EQ(212, message.repeated_double(1));
- EXPECT_TRUE(message.repeated_bool(1));
- EXPECT_EQ("215", message.repeated_string(1));
- EXPECT_EQ("216", message.repeated_bytes(1));
-
- EXPECT_EQ(217, message.repeatedgroup(1).a());
- EXPECT_EQ(218, message.repeated_nested_message(1).bb());
- EXPECT_EQ(219, message.repeated_foreign_message(1).c());
- EXPECT_EQ(220, message.repeated_import_message(1).d());
- EXPECT_EQ(220, message.repeated_import_message(1).d());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR, message.repeated_nested_enum(1));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR, message.repeated_foreign_enum(1));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR, message.repeated_import_enum(1));
-
- EXPECT_EQ(301, message.repeated_int32(0));
- EXPECT_EQ(302, message.repeated_int64(0));
- EXPECT_EQ(303, message.repeated_uint32(0));
- EXPECT_EQ(304, message.repeated_uint64(0));
- EXPECT_EQ(305, message.repeated_sint32(0));
- EXPECT_EQ(306, message.repeated_sint64(0));
- EXPECT_EQ(307, message.repeated_fixed32(0));
- EXPECT_EQ(308, message.repeated_fixed64(0));
- EXPECT_EQ(309, message.repeated_sfixed32(0));
- EXPECT_EQ(310, message.repeated_sfixed64(0));
- EXPECT_EQ(311, message.repeated_float(0));
- EXPECT_EQ(312, message.repeated_double(0));
- EXPECT_FALSE(message.repeated_bool(0));
- EXPECT_EQ("315", message.repeated_string(0));
- EXPECT_EQ("316", message.repeated_bytes(0));
-
- EXPECT_EQ(317, message.repeatedgroup(0).a());
- EXPECT_EQ(318, message.repeated_nested_message(0).bb());
- EXPECT_EQ(319, message.repeated_foreign_message(0).c());
- EXPECT_EQ(320, message.repeated_import_message(0).d());
- EXPECT_EQ(320, message.repeated_import_message(0).d());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAZ, message.repeated_nested_enum(0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ, message.repeated_foreign_enum(0));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAZ, message.repeated_import_enum(0));
-}
-
-inline void TestUtil::ExpectRepeatedExtensionsSwapped(
- const UNITTEST::TestAllExtensions& message) {
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_int32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_int64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_uint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_uint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sint32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sint64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_fixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_fixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sfixed32_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_sfixed64_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_float_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_double_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_bool_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_string_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_bytes_extension));
-
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeatedgroup_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_nested_message_extension));
- ASSERT_EQ(
- 2, message.ExtensionSize(UNITTEST::repeated_foreign_message_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_import_message_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_lazy_message_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_nested_enum_extension));
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_foreign_enum_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_import_enum_extension));
-
- ASSERT_EQ(2,
- message.ExtensionSize(UNITTEST::repeated_string_piece_extension));
- ASSERT_EQ(2, message.ExtensionSize(UNITTEST::repeated_cord_extension));
-
- EXPECT_EQ(201, message.GetExtension(UNITTEST::repeated_int32_extension, 1));
- EXPECT_EQ(202, message.GetExtension(UNITTEST::repeated_int64_extension, 1));
- EXPECT_EQ(203, message.GetExtension(UNITTEST::repeated_uint32_extension, 1));
- EXPECT_EQ(204, message.GetExtension(UNITTEST::repeated_uint64_extension, 1));
- EXPECT_EQ(205, message.GetExtension(UNITTEST::repeated_sint32_extension, 1));
- EXPECT_EQ(206, message.GetExtension(UNITTEST::repeated_sint64_extension, 1));
- EXPECT_EQ(207, message.GetExtension(UNITTEST::repeated_fixed32_extension, 1));
- EXPECT_EQ(208, message.GetExtension(UNITTEST::repeated_fixed64_extension, 1));
- EXPECT_EQ(209,
- message.GetExtension(UNITTEST::repeated_sfixed32_extension, 1));
- EXPECT_EQ(210,
- message.GetExtension(UNITTEST::repeated_sfixed64_extension, 1));
- EXPECT_EQ(211, message.GetExtension(UNITTEST::repeated_float_extension, 1));
- EXPECT_EQ(212, message.GetExtension(UNITTEST::repeated_double_extension, 1));
- EXPECT_TRUE(message.GetExtension(UNITTEST::repeated_bool_extension, 1));
- EXPECT_EQ("215",
- message.GetExtension(UNITTEST::repeated_string_extension, 1));
- EXPECT_EQ("216", message.GetExtension(UNITTEST::repeated_bytes_extension, 1));
-
- EXPECT_EQ(217,
- message.GetExtension(UNITTEST::repeatedgroup_extension, 1).a());
- EXPECT_EQ(218,
- message.GetExtension(UNITTEST::repeated_nested_message_extension, 1)
- .bb());
- EXPECT_EQ(
- 219, message.GetExtension(UNITTEST::repeated_foreign_message_extension, 1)
- .c());
- EXPECT_EQ(
- 220,
- message.GetExtension(UNITTEST::repeated_import_message_extension, 1).d());
- EXPECT_EQ(
- 227,
- message.GetExtension(UNITTEST::repeated_lazy_message_extension, 1).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAR,
- message.GetExtension(UNITTEST::repeated_nested_enum_extension, 1));
- EXPECT_EQ(UNITTEST::FOREIGN_BAR,
- message.GetExtension(UNITTEST::repeated_foreign_enum_extension, 1));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAR,
- message.GetExtension(UNITTEST::repeated_import_enum_extension, 1));
-
- EXPECT_EQ("224",
- message.GetExtension(UNITTEST::repeated_string_piece_extension, 1));
- EXPECT_EQ("225", message.GetExtension(UNITTEST::repeated_cord_extension, 1));
-
- EXPECT_EQ(301, message.GetExtension(UNITTEST::repeated_int32_extension, 0));
- EXPECT_EQ(302, message.GetExtension(UNITTEST::repeated_int64_extension, 0));
- EXPECT_EQ(303, message.GetExtension(UNITTEST::repeated_uint32_extension, 0));
- EXPECT_EQ(304, message.GetExtension(UNITTEST::repeated_uint64_extension, 0));
- EXPECT_EQ(305, message.GetExtension(UNITTEST::repeated_sint32_extension, 0));
- EXPECT_EQ(306, message.GetExtension(UNITTEST::repeated_sint64_extension, 0));
- EXPECT_EQ(307, message.GetExtension(UNITTEST::repeated_fixed32_extension, 0));
- EXPECT_EQ(308, message.GetExtension(UNITTEST::repeated_fixed64_extension, 0));
- EXPECT_EQ(309,
- message.GetExtension(UNITTEST::repeated_sfixed32_extension, 0));
- EXPECT_EQ(310,
- message.GetExtension(UNITTEST::repeated_sfixed64_extension, 0));
- EXPECT_EQ(311, message.GetExtension(UNITTEST::repeated_float_extension, 0));
- EXPECT_EQ(312, message.GetExtension(UNITTEST::repeated_double_extension, 0));
- EXPECT_FALSE(message.GetExtension(UNITTEST::repeated_bool_extension, 0));
- EXPECT_EQ("315",
- message.GetExtension(UNITTEST::repeated_string_extension, 0));
- EXPECT_EQ("316", message.GetExtension(UNITTEST::repeated_bytes_extension, 0));
-
- EXPECT_EQ(317,
- message.GetExtension(UNITTEST::repeatedgroup_extension, 0).a());
- EXPECT_EQ(318,
- message.GetExtension(UNITTEST::repeated_nested_message_extension, 0)
- .bb());
- EXPECT_EQ(
- 319, message.GetExtension(UNITTEST::repeated_foreign_message_extension, 0)
- .c());
- EXPECT_EQ(
- 320,
- message.GetExtension(UNITTEST::repeated_import_message_extension, 0).d());
- EXPECT_EQ(
- 327,
- message.GetExtension(UNITTEST::repeated_lazy_message_extension, 0).bb());
-
- EXPECT_EQ(UNITTEST::TestAllTypes::BAZ,
- message.GetExtension(UNITTEST::repeated_nested_enum_extension, 0));
- EXPECT_EQ(UNITTEST::FOREIGN_BAZ,
- message.GetExtension(UNITTEST::repeated_foreign_enum_extension, 0));
- EXPECT_EQ(UNITTEST_IMPORT::IMPORT_BAZ,
- message.GetExtension(UNITTEST::repeated_import_enum_extension, 0));
-
- EXPECT_EQ("324",
- message.GetExtension(UNITTEST::repeated_string_piece_extension, 0));
- EXPECT_EQ("325", message.GetExtension(UNITTEST::repeated_cord_extension, 0));
-}
-
-inline void TestUtil::SetOneof1(UNITTEST::TestOneof2* message) {
- message->mutable_foo_lazy_message()->set_qux_int(100);
- message->set_bar_string("101");
- message->set_baz_int(102);
- message->set_baz_string("103");
-}
-
-inline void TestUtil::SetOneof2(UNITTEST::TestOneof2* message) {
- message->set_foo_int(200);
- message->set_bar_enum(UNITTEST::TestOneof2::BAZ);
- message->set_baz_int(202);
- message->set_baz_string("203");
-}
-
-inline void TestUtil::ExpectOneofSet1(const UNITTEST::TestOneof2& message) {
- ExpectAtMostOneFieldSetInOneof(message);
-
- EXPECT_TRUE(message.has_foo_lazy_message());
- EXPECT_TRUE(message.foo_lazy_message().has_qux_int());
-
- EXPECT_TRUE(message.has_bar_string());
- EXPECT_TRUE(message.has_baz_int());
- EXPECT_TRUE(message.has_baz_string());
-
- ASSERT_EQ(0, message.foo_lazy_message().corge_int_size());
-
- EXPECT_EQ(100, message.foo_lazy_message().qux_int());
- EXPECT_EQ("101", message.bar_string());
- EXPECT_EQ(102, message.baz_int());
- EXPECT_EQ("103", message.baz_string());
-}
-
-inline void TestUtil::ExpectOneofSet2(const UNITTEST::TestOneof2& message) {
- ExpectAtMostOneFieldSetInOneof(message);
-
- EXPECT_TRUE(message.has_foo_int());
- EXPECT_TRUE(message.has_bar_enum());
- EXPECT_TRUE(message.has_baz_int());
- EXPECT_TRUE(message.has_baz_string());
-
- EXPECT_EQ(200, message.foo_int());
- EXPECT_EQ(UNITTEST::TestOneof2::BAZ, message.bar_enum());
- EXPECT_EQ(202, message.baz_int());
- EXPECT_EQ("203", message.baz_string());
-}
-
-inline void TestUtil::ExpectOneofClear(const UNITTEST::TestOneof2& message) {
- EXPECT_FALSE(message.has_foo_int());
- EXPECT_FALSE(message.has_foo_string());
- EXPECT_FALSE(message.has_foo_bytes());
- EXPECT_FALSE(message.has_foo_enum());
- EXPECT_FALSE(message.has_foo_message());
- EXPECT_FALSE(message.has_foogroup());
- EXPECT_FALSE(message.has_foo_lazy_message());
-
- EXPECT_FALSE(message.has_bar_int());
- EXPECT_FALSE(message.has_bar_string());
- EXPECT_FALSE(message.has_bar_bytes());
- EXPECT_FALSE(message.has_bar_enum());
-
- EXPECT_FALSE(message.has_baz_int());
- EXPECT_FALSE(message.has_baz_string());
-
- EXPECT_EQ(UNITTEST::TestOneof2::FOO_NOT_SET, message.foo_case());
- EXPECT_EQ(UNITTEST::TestOneof2::BAR_NOT_SET, message.bar_case());
-}
-
-inline void TestUtil::ExpectAtMostOneFieldSetInOneof(
- const UNITTEST::TestOneof2& message) {
- int count = 0;
- if (message.has_foo_int()) count++;
- if (message.has_foo_string()) count++;
- if (message.has_foo_bytes()) count++;
- if (message.has_foo_enum()) count++;
- if (message.has_foo_message()) count++;
- if (message.has_foogroup()) count++;
- if (message.has_foo_lazy_message()) count++;
- EXPECT_LE(count, 1);
- count = 0;
- if (message.has_bar_int()) count++;
- if (message.has_bar_string()) count++;
- if (message.has_bar_bytes()) count++;
- if (message.has_bar_enum()) count++;
- EXPECT_TRUE(count == 0 || count == 1);
-}
-
-// ===================================================================
-
-} // namespace protobuf
-} // namespace google
diff --git a/third_party/protobuf/BUILD b/third_party/protobuf/BUILD
index d1d5cbfd5c..f892ffa965 100644
--- a/third_party/protobuf/BUILD
+++ b/third_party/protobuf/BUILD
@@ -4,7 +4,7 @@ licenses(["notice"])
load(":proto_alias.bzl", "proto_alias")
-PROTOBUF_VERSION = "3.6.0"
+PROTOBUF_VERSION = "3.4.0"
filegroup(
name = "srcs",
diff --git a/third_party/protobuf/README.md b/third_party/protobuf/README.md
index 10837db9db..68fc1b1bf9 100644
--- a/third_party/protobuf/README.md
+++ b/third_party/protobuf/README.md
@@ -24,18 +24,18 @@ rm -rf .git .gitignore .gitmodules
4) Copy `third_party/protobuf/<old_proto>/com_google_protobuf_java.BUILD` to the new
directory.
5) Copy the `licenses` declaration and the `srcs` filegroup from
- `third_party/protobuf/<old_proto>/util/python/BUILD` and
- `third_party/protobuf/<old_proto>/examples/BUILD` to the corresponding
+ `third_party/protobuf/<old_proto>/util/python/BUILD` to the corresponding
file in the new directory.
-6) Name the `new\_proto` directory according to the protobuf version number.
-7) In `third\_party/protobuf/BUILD` update `PROTOBUF\_VERSION` to the name of the
+6) For each file listed in `RELATIVE_WELL_KNOWN_PROTOS` in the `new_proto/BUILD` file
+ copy it from `new_proto/srcs/google/protobuf` to `new_proto/google/protobuf`.
+7) Name the `new\_proto` directory according to the protobuf version number.
+8) In `third\_party/protobuf/BUILD` update `PROTOBUF\_VERSION` to the name of the
directory you just created.
-8) In the root `WORKSPACE` file update relative paths of protobuf to point to
+9) In the root `WORKSPACE` file update relative paths of protobuf to point to
the new version.
-9) Update version number in `src/main/protobuf/BUILD` and `src/test/shell/testenv.sh`.
10) Delete the `third_party/protobuf/<old_proto>` directory.
11) Update this file if you found the :instructions to be wrong or incomplete.
# Current protobuf version
-The current version of protobuf is [3.6.0](https://github.com/google/protobuf/releases/tag/v3.6.0).
+The current version of protobuf is [3.4.0](https://github.com/google/protobuf/releases/tag/v3.4.0).