Sync from Piper @359788468

PROTOBUF_SYNC_PIPER
This commit is contained in:
Joshua Haberman 2021-02-26 10:37:37 -08:00
commit 9df42757f9
146 changed files with 2827 additions and 3300 deletions

View File

@ -1,4 +1,26 @@
Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
2021-02-25 version 3.15.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Ruby
* Ruby <2.7 now uses WeakMap too, which prevents memory leaks. (#8341)
2021-02-23 version 3.15.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Ruby
* Fix for FieldDescriptor.get(msg) (#8330)
C++
* Fix PROTOBUF_CONSTINIT macro redefinition (#8323)
2021-02-05 version 3.15.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Ruby
* Bugfix for Message.[] for repeated or map fields (#8313)
2021-02-05 version 3.15.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Protocol Compiler
* Optional fields for proto3 are enabled by default, and no longer require
the --experimental_allow_proto3_optional flag.
C++
* MessageDifferencer: fixed bug when using custom ignore with multiple
@ -23,11 +45,56 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
output (does not affect comparison logic) and stop printing 'value' in the
path. The modified print functionality is in the
MessageDifferencer::StreamReporter.
* Fixes https://github.com/protocolbuffers/protobuf/issues/8129
* Fixed https://github.com/protocolbuffers/protobuf/issues/8129
* Ensure that null char symbol, package and file names do not result in a
crash.
* Constant initialize the global message instances
* Pretty print 'max' instead of numeric values in reserved ranges.
* Removed remaining instances of std::is_pod, which is deprecated in C++20.
* Changes to reduce code size for unknown field handling by making uncommon
cases out of line.
* Fix std::is_pod deprecated in C++20 (#7180)
* Fix some -Wunused-parameter warnings (#8053)
* Fix detecting file as directory on zOS issue #8051 (#8052)
* Don't include sys/param.h for _BYTE_ORDER (#8106)
* remove CMAKE_THREAD_LIBS_INIT from pkgconfig CFLAGS (#8154)
* Fix TextFormatMapTest.DynamicMessage issue#5136 (#8159)
* Fix for compiler warning issue#8145 (#8160)
* fix: support deprecated enums for GCC < 6 (#8164)
* Fix some warning when compiling with Visual Studio 2019 on x64 target (#8125)
Python
* Provided an override for the reverse() method that will reverse the internal
collection directly instead of using the other methods of the BaseContainer.
* MessageFactory.CreateProtoype can be overridden to customize class creation.
* Fix PyUnknownFields memory leak (#7928)
* Add macOS big sur compatibility (#8126)
JavaScript
* Generate `getDescriptor` methods with `*` as their `this` type.
* Enforce `let/const` for generated messages.
* js/binary/utils.js: Fix jspb.utils.joinUnsignedDecimalString to work with negative bitsLow and low but non-zero bitsHigh parameter. (#8170)
PHP
* Added support for PHP 8. (#8105)
* unregister INI entries and fix invalid read on shutdown (#8042)
* Fix PhpDoc comments for message accessors to include "|null". (#8136)
* fix: convert native PHP floats to single precision (#8187)
* Fixed PHP to support field numbers >=2**28. (#8235)
* feat: add support for deprecated fields to PHP compiler (#8223)
* Protect against stack overflow if the user derives from Message. (#8248)
* Fixed clone for Message, RepeatedField, and MapField. (#8245)
* Updated upb to allow nonzero offset minutes in JSON timestamps. (#8258)
Ruby
* Added support for Ruby 3. (#8184)
* Rewrote the data storage layer to be based on upb_msg objects from the
upb library. This should lead to much better parsing performance,
particularly for large messages. (#8184).
* Fill out JRuby support (#7923)
* [Ruby] Fix: (SIGSEGV) gRPC-Ruby issue on Windows. memory alloc infinite
recursion/run out of memory (#8195)
* Fix jruby support to handle messages nested more than 1 level deep (#8194)
Java
* Avoid possible UnsupportedOperationException when using CodedInputSteam
@ -40,15 +107,14 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Now Proto3 Oneof fields have "has" methods for checking their presence in
Java.
* Annotates Java proto generated *_FIELD_NUMBER constants.
* Add -assumevalues to remove JvmMemoryAccessor on Android.
Python
* Provided an override for the reverse() method that will reverse the internal
collection directly instead of using the other methods of the BaseContainer.
* MessageFactory.CreateProtoype can be overridden to customize class creation.
Javascript
* Generate `getDescriptor` methods with `*` as their `this` type.
* Enforce `let/const` for generated messages.
C#
* Fix parsing negative Int32Value that crosses segment boundary (#8035)
* Change ByteString to use memory and support unsafe create without copy (#7645)
* Optimize MapField serialization by removing MessageAdapter (#8143)
* Allow FileDescriptors to be parsed with extension registries (#8220)
* Optimize writing small strings (#8149)
2020-11-11 version 3.14.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

View File

@ -1397,10 +1397,6 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
examples/pubspec.yaml \
protobuf.bzl \
protobuf_deps.bzl \
python/release/wheel/build_wheel_manylinux.sh \
python/release/wheel/Dockerfile \
python/release/wheel/protobuf_optimized_pip.sh \
python/release/wheel/README.md \
third_party/six.BUILD \
third_party/zlib.BUILD \
third_party/wyhash/LICENSE \

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
s.version = '3.14.0'
s.version = '3.15.2'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = '3-Clause BSD License'

View File

@ -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.14.0'
s.version = '3.15.3'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = '3-Clause BSD License'

View File

@ -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.14.0],[protobuf@googlegroups.com],[protobuf])
AC_INIT([Protocol Buffers],[3.15.2],[protobuf@googlegroups.com],[protobuf])
AM_MAINTAINER_MODE([enable])

View File

@ -300,7 +300,7 @@ const FieldDescriptor* GetFieldForOneofType(FieldDescriptor::Type type,
}
string UpperCase(string str) {
for (int i = 0; i < str.size(); i++) {
for (size_t i = 0; i < str.size(); i++) {
str[i] = toupper(str[i]);
}
return str;

View File

@ -55,6 +55,7 @@ using google::protobuf::util::JsonToBinaryString;
using google::protobuf::util::NewTypeResolverForDescriptorPool;
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";
@ -102,6 +103,8 @@ void CheckedWrite(int fd, const void *buf, size_t len) {
void DoTest(const ConformanceRequest& request, ConformanceResponse* response) {
Message *test_message;
google::protobuf::LinkMessageReflection<TestAllTypesProto2>();
google::protobuf::LinkMessageReflection<TestAllTypesProto3>();
const Descriptor *descriptor = DescriptorPool::generated_pool()->FindMessageTypeByName(
request.message_type());
if (!descriptor) {

View File

@ -297,7 +297,7 @@ void ForkPipeRunner::SpawnTestProgram() {
std::vector<const char *> argv;
argv.push_back(executable.get());
for (int i = 0; i < executable_args_.size(); ++i) {
for (size_t i = 0; i < executable_args_.size(); ++i) {
argv.push_back(executable_args_[i].c_str());
}
argv.push_back(nullptr);
@ -307,7 +307,7 @@ void ForkPipeRunner::SpawnTestProgram() {
}
void ForkPipeRunner::CheckedWrite(int fd, const void *buf, size_t len) {
if (write(fd, buf, len) != len) {
if (static_cast<size_t>(write(fd, buf, len)) != len) {
GOOGLE_LOG(FATAL) << current_test_name_
<< ": error writing to test program: " << strerror(errno);
}

View File

@ -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.14.0</version>
<version>3.15.3</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>

View File

@ -17,4 +17,4 @@ Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath
# The SDK versions to install should be kept in sync with versions
# installed by kokoro/linux/dockerfile/test/csharp/Dockerfile
&$InstallScriptPath -Version 2.1.802
&$InstallScriptPath -Version 3.1.301
&$InstallScriptPath -Version 5.0.102

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<IsPackable>False</IsPackable>

View File

@ -25,49 +25,54 @@ namespace ProtobufUnittest {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Ci5nb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcHJvdG8zX29wdGlvbmFsLnBy",
"b3RvEhFwcm90b2J1Zl91bml0dGVzdCKxCgoSVGVzdFByb3RvM09wdGlvbmFs",
"EhsKDm9wdGlvbmFsX2ludDMyGAEgASgFSACIAQESGwoOb3B0aW9uYWxfaW50",
"NjQYAiABKANIAYgBARIcCg9vcHRpb25hbF91aW50MzIYAyABKA1IAogBARIc",
"Cg9vcHRpb25hbF91aW50NjQYBCABKARIA4gBARIcCg9vcHRpb25hbF9zaW50",
"MzIYBSABKBFIBIgBARIcCg9vcHRpb25hbF9zaW50NjQYBiABKBJIBYgBARId",
"ChBvcHRpb25hbF9maXhlZDMyGAcgASgHSAaIAQESHQoQb3B0aW9uYWxfZml4",
"ZWQ2NBgIIAEoBkgHiAEBEh4KEW9wdGlvbmFsX3NmaXhlZDMyGAkgASgPSAiI",
"AQESHgoRb3B0aW9uYWxfc2ZpeGVkNjQYCiABKBBICYgBARIbCg5vcHRpb25h",
"bF9mbG9hdBgLIAEoAkgKiAEBEhwKD29wdGlvbmFsX2RvdWJsZRgMIAEoAUgL",
"iAEBEhoKDW9wdGlvbmFsX2Jvb2wYDSABKAhIDIgBARIcCg9vcHRpb25hbF9z",
"dHJpbmcYDiABKAlIDYgBARIbCg5vcHRpb25hbF9ieXRlcxgPIAEoDEgOiAEB",
"Eh4KDW9wdGlvbmFsX2NvcmQYECABKAlCAggBSA+IAQESWQoXb3B0aW9uYWxf",
"bmVzdGVkX21lc3NhZ2UYEiABKAsyMy5wcm90b2J1Zl91bml0dGVzdC5UZXN0",
"UHJvdG8zT3B0aW9uYWwuTmVzdGVkTWVzc2FnZUgQiAEBElkKE2xhenlfbmVz",
"dGVkX21lc3NhZ2UYEyABKAsyMy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJv",
"dG8zT3B0aW9uYWwuTmVzdGVkTWVzc2FnZUICKAFIEYgBARJTChRvcHRpb25h",
"bF9uZXN0ZWRfZW51bRgVIAEoDjIwLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQ",
"cm90bzNPcHRpb25hbC5OZXN0ZWRFbnVtSBKIAQESFgoOc2luZ3VsYXJfaW50",
"MzIYFiABKAUSFgoOc2luZ3VsYXJfaW50NjQYFyABKAMaJwoNTmVzdGVkTWVz",
"c2FnZRIPCgJiYhgBIAEoBUgAiAEBQgUKA19iYiJKCgpOZXN0ZWRFbnVtEg8K",
"C1VOU1BFQ0lGSUVEEAASBwoDRk9PEAESBwoDQkFSEAISBwoDQkFaEAMSEAoD",
"TkVHEP///////////wFCEQoPX29wdGlvbmFsX2ludDMyQhEKD19vcHRpb25h",
"bF9pbnQ2NEISChBfb3B0aW9uYWxfdWludDMyQhIKEF9vcHRpb25hbF91aW50",
"NjRCEgoQX29wdGlvbmFsX3NpbnQzMkISChBfb3B0aW9uYWxfc2ludDY0QhMK",
"EV9vcHRpb25hbF9maXhlZDMyQhMKEV9vcHRpb25hbF9maXhlZDY0QhQKEl9v",
"cHRpb25hbF9zZml4ZWQzMkIUChJfb3B0aW9uYWxfc2ZpeGVkNjRCEQoPX29w",
"dGlvbmFsX2Zsb2F0QhIKEF9vcHRpb25hbF9kb3VibGVCEAoOX29wdGlvbmFs",
"X2Jvb2xCEgoQX29wdGlvbmFsX3N0cmluZ0IRCg9fb3B0aW9uYWxfYnl0ZXNC",
"EAoOX29wdGlvbmFsX2NvcmRCGgoYX29wdGlvbmFsX25lc3RlZF9tZXNzYWdl",
"QhYKFF9sYXp5X25lc3RlZF9tZXNzYWdlQhcKFV9vcHRpb25hbF9uZXN0ZWRf",
"ZW51bSKJAgoZVGVzdFByb3RvM09wdGlvbmFsTWVzc2FnZRJSCg5uZXN0ZWRf",
"bWVzc2FnZRgBIAEoCzI6LnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQcm90bzNP",
"cHRpb25hbE1lc3NhZ2UuTmVzdGVkTWVzc2FnZRJgChdvcHRpb25hbF9uZXN0",
"ZWRfbWVzc2FnZRgCIAEoCzI6LnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQcm90",
"bzNPcHRpb25hbE1lc3NhZ2UuTmVzdGVkTWVzc2FnZUgAiAEBGhoKDU5lc3Rl",
"ZE1lc3NhZ2USCQoBcxgBIAEoCUIaChhfb3B0aW9uYWxfbmVzdGVkX21lc3Nh",
"Z2VCJQohY29tLmdvb2dsZS5wcm90b2J1Zi50ZXN0aW5nLnByb3RvUAFiBnBy",
"b3RvMw=="));
"b3RvEhFwcm90b2J1Zl91bml0dGVzdBogZ29vZ2xlL3Byb3RvYnVmL2Rlc2Ny",
"aXB0b3IucHJvdG8isQoKElRlc3RQcm90bzNPcHRpb25hbBIbCg5vcHRpb25h",
"bF9pbnQzMhgBIAEoBUgAiAEBEhsKDm9wdGlvbmFsX2ludDY0GAIgASgDSAGI",
"AQESHAoPb3B0aW9uYWxfdWludDMyGAMgASgNSAKIAQESHAoPb3B0aW9uYWxf",
"dWludDY0GAQgASgESAOIAQESHAoPb3B0aW9uYWxfc2ludDMyGAUgASgRSASI",
"AQESHAoPb3B0aW9uYWxfc2ludDY0GAYgASgSSAWIAQESHQoQb3B0aW9uYWxf",
"Zml4ZWQzMhgHIAEoB0gGiAEBEh0KEG9wdGlvbmFsX2ZpeGVkNjQYCCABKAZI",
"B4gBARIeChFvcHRpb25hbF9zZml4ZWQzMhgJIAEoD0gIiAEBEh4KEW9wdGlv",
"bmFsX3NmaXhlZDY0GAogASgQSAmIAQESGwoOb3B0aW9uYWxfZmxvYXQYCyAB",
"KAJICogBARIcCg9vcHRpb25hbF9kb3VibGUYDCABKAFIC4gBARIaCg1vcHRp",
"b25hbF9ib29sGA0gASgISAyIAQESHAoPb3B0aW9uYWxfc3RyaW5nGA4gASgJ",
"SA2IAQESGwoOb3B0aW9uYWxfYnl0ZXMYDyABKAxIDogBARIeCg1vcHRpb25h",
"bF9jb3JkGBAgASgJQgIIAUgPiAEBElkKF29wdGlvbmFsX25lc3RlZF9tZXNz",
"YWdlGBIgASgLMjMucHJvdG9idWZfdW5pdHRlc3QuVGVzdFByb3RvM09wdGlv",
"bmFsLk5lc3RlZE1lc3NhZ2VIEIgBARJZChNsYXp5X25lc3RlZF9tZXNzYWdl",
"GBMgASgLMjMucHJvdG9idWZfdW5pdHRlc3QuVGVzdFByb3RvM09wdGlvbmFs",
"Lk5lc3RlZE1lc3NhZ2VCAigBSBGIAQESUwoUb3B0aW9uYWxfbmVzdGVkX2Vu",
"dW0YFSABKA4yMC5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9u",
"YWwuTmVzdGVkRW51bUgSiAEBEhYKDnNpbmd1bGFyX2ludDMyGBYgASgFEhYK",
"DnNpbmd1bGFyX2ludDY0GBcgASgDGicKDU5lc3RlZE1lc3NhZ2USDwoCYmIY",
"ASABKAVIAIgBAUIFCgNfYmIiSgoKTmVzdGVkRW51bRIPCgtVTlNQRUNJRklF",
"RBAAEgcKA0ZPTxABEgcKA0JBUhACEgcKA0JBWhADEhAKA05FRxD/////////",
"//8BQhEKD19vcHRpb25hbF9pbnQzMkIRCg9fb3B0aW9uYWxfaW50NjRCEgoQ",
"X29wdGlvbmFsX3VpbnQzMkISChBfb3B0aW9uYWxfdWludDY0QhIKEF9vcHRp",
"b25hbF9zaW50MzJCEgoQX29wdGlvbmFsX3NpbnQ2NEITChFfb3B0aW9uYWxf",
"Zml4ZWQzMkITChFfb3B0aW9uYWxfZml4ZWQ2NEIUChJfb3B0aW9uYWxfc2Zp",
"eGVkMzJCFAoSX29wdGlvbmFsX3NmaXhlZDY0QhEKD19vcHRpb25hbF9mbG9h",
"dEISChBfb3B0aW9uYWxfZG91YmxlQhAKDl9vcHRpb25hbF9ib29sQhIKEF9v",
"cHRpb25hbF9zdHJpbmdCEQoPX29wdGlvbmFsX2J5dGVzQhAKDl9vcHRpb25h",
"bF9jb3JkQhoKGF9vcHRpb25hbF9uZXN0ZWRfbWVzc2FnZUIWChRfbGF6eV9u",
"ZXN0ZWRfbWVzc2FnZUIXChVfb3B0aW9uYWxfbmVzdGVkX2VudW0iiQIKGVRl",
"c3RQcm90bzNPcHRpb25hbE1lc3NhZ2USUgoObmVzdGVkX21lc3NhZ2UYASAB",
"KAsyOi5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9uYWxNZXNz",
"YWdlLk5lc3RlZE1lc3NhZ2USYAoXb3B0aW9uYWxfbmVzdGVkX21lc3NhZ2UY",
"AiABKAsyOi5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9uYWxN",
"ZXNzYWdlLk5lc3RlZE1lc3NhZ2VIAIgBARoaCg1OZXN0ZWRNZXNzYWdlEgkK",
"AXMYASABKAlCGgoYX29wdGlvbmFsX25lc3RlZF9tZXNzYWdlIqkBChhQcm90",
"bzNPcHRpb25hbEV4dGVuc2lvbnMyPAoPZXh0X25vX29wdGlvbmFsEh8uZ29v",
"Z2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25zGIjN2akBIAEoBTJBChFleHRf",
"d2l0aF9vcHRpb25hbBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9u",
"cxiJzdmpASABKAWIAQE6DMDozM0KCMjozM0KEEIlCiFjb20uZ29vZ2xlLnBy",
"b3RvYnVmLnRlc3RpbmcucHJvdG9QAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3Optional), global::ProtobufUnittest.TestProto3Optional.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalCord", "OptionalNestedMessage", "LazyNestedMessage", "OptionalNestedEnum", "SingularInt32", "SingularInt64" }, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalCord", "OptionalNestedMessage", "LazyNestedMessage", "OptionalNestedEnum" }, new[]{ typeof(global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage), global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage.Parser, new[]{ "Bb" }, new[]{ "Bb" }, null, null, null)}),
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3OptionalMessage), global::ProtobufUnittest.TestProto3OptionalMessage.Parser, new[]{ "NestedMessage", "OptionalNestedMessage" }, new[]{ "OptionalNestedMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage), global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage.Parser, new[]{ "S" }, null, null, null, null)})
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3OptionalMessage), global::ProtobufUnittest.TestProto3OptionalMessage.Parser, new[]{ "NestedMessage", "OptionalNestedMessage" }, new[]{ "OptionalNestedMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage), global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage.Parser, new[]{ "S" }, null, null, null, null)}),
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.Proto3OptionalExtensions), global::ProtobufUnittest.Proto3OptionalExtensions.Parser, null, null, null, new pb::Extension[] { global::ProtobufUnittest.Proto3OptionalExtensions.Extensions.ExtNoOptional, global::ProtobufUnittest.Proto3OptionalExtensions.Extensions.ExtWithOptional }, null)
}));
}
#endregion
@ -1789,6 +1794,153 @@ namespace ProtobufUnittest {
}
public sealed partial class Proto3OptionalExtensions : pb::IMessage<Proto3OptionalExtensions>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Proto3OptionalExtensions> _parser = new pb::MessageParser<Proto3OptionalExtensions>(() => new Proto3OptionalExtensions());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Proto3OptionalExtensions> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::ProtobufUnittest.UnittestProto3OptionalReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Proto3OptionalExtensions() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Proto3OptionalExtensions(Proto3OptionalExtensions other) : this() {
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Proto3OptionalExtensions Clone() {
return new Proto3OptionalExtensions(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Proto3OptionalExtensions);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Proto3OptionalExtensions 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 !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[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(Proto3OptionalExtensions other) {
if (other == null) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
}
}
}
#endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the Proto3OptionalExtensions message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Extensions {
public static readonly pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, int> ExtNoOptional =
new pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, int>(355886728, pb::FieldCodec.ForInt32(2847093824, 0));
public static readonly pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, int> ExtWithOptional =
new pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, int>(355886729, pb::FieldCodec.ForInt32(2847093832, 0));
}
#endregion
}
#endregion
}

View File

@ -42,7 +42,7 @@ namespace Google.Protobuf.Buffers
/// ArrayBufferWriter is originally from corefx, and has been contributed to Protobuf
/// https://github.com/dotnet/runtime/blob/071da4c41aa808c949a773b92dca6f88de9d11f3/src/libraries/Common/src/System/Buffers/ArrayBufferWriter.cs
/// </summary>
internal sealed class ArrayBufferWriter<T> : IBufferWriter<T>
internal sealed class TestArrayBufferWriter<T> : IBufferWriter<T>
{
private T[] _buffer;
private int _index;
@ -50,10 +50,10 @@ namespace Google.Protobuf.Buffers
private const int DefaultInitialBufferSize = 256;
/// <summary>
/// Creates an instance of an <see cref="ArrayBufferWriter{T}"/>, in which data can be written to,
/// Creates an instance of an <see cref="TestArrayBufferWriter{T}"/>, in which data can be written to,
/// with the default initial capacity.
/// </summary>
public ArrayBufferWriter()
public TestArrayBufferWriter()
{
_buffer = new T[0];
_index = 0;
@ -66,14 +66,14 @@ namespace Google.Protobuf.Buffers
public int? MaxGrowBy { get; set; }
/// <summary>
/// Creates an instance of an <see cref="ArrayBufferWriter{T}"/>, in which data can be written to,
/// Creates an instance of an <see cref="TestArrayBufferWriter{T}"/>, in which data can be written to,
/// with an initial capacity specified.
/// </summary>
/// <param name="initialCapacity">The minimum capacity with which to initialize the underlying buffer.</param>
/// <exception cref="ArgumentException">
/// Thrown when <paramref name="initialCapacity"/> is not positive (i.e. less than or equal to 0).
/// </exception>
public ArrayBufferWriter(int initialCapacity)
public TestArrayBufferWriter(int initialCapacity)
{
if (initialCapacity <= 0)
throw new ArgumentException(nameof(initialCapacity));
@ -111,7 +111,7 @@ namespace Google.Protobuf.Buffers
/// Clears the data written to the underlying buffer.
/// </summary>
/// <remarks>
/// You must clear the <see cref="ArrayBufferWriter{T}"/> before trying to re-use it.
/// You must clear the <see cref="TestArrayBufferWriter{T}"/> before trying to re-use it.
/// </remarks>
public void Clear()
{

View File

@ -58,7 +58,7 @@ namespace Google.Protobuf
Assert.AreEqual(data, rawOutput.ToArray());
// IBufferWriter
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteUInt32((uint) value);
ctx.Flush();
@ -77,7 +77,7 @@ namespace Google.Protobuf
Assert.AreEqual(data, rawOutput.ToArray());
// IBufferWriter
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteUInt64(value);
ctx.Flush();
@ -100,7 +100,7 @@ namespace Google.Protobuf
output.Flush();
Assert.AreEqual(data, rawOutput.ToArray());
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
bufferWriter.MaxGrowBy = bufferSize;
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteUInt32((uint) value);
@ -115,7 +115,7 @@ namespace Google.Protobuf
output.Flush();
Assert.AreEqual(data, rawOutput.ToArray());
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
bufferWriter.MaxGrowBy = bufferSize;
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteUInt64(value);
@ -174,7 +174,7 @@ namespace Google.Protobuf
output.Flush();
Assert.AreEqual(data, rawOutput.ToArray());
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteFixed32(value);
ctx.Flush();
@ -190,7 +190,7 @@ namespace Google.Protobuf
output.Flush();
Assert.AreEqual(data, rawOutput.ToArray());
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
bufferWriter.MaxGrowBy = bufferSize;
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteFixed32(value);
@ -212,7 +212,7 @@ namespace Google.Protobuf
output.Flush();
Assert.AreEqual(data, rawOutput.ToArray());
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteFixed64(value);
ctx.Flush();
@ -228,7 +228,7 @@ namespace Google.Protobuf
output.Flush();
Assert.AreEqual(data, rawOutput.ToArray());
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
bufferWriter.MaxGrowBy = blockSize;
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteFixed64(value);
@ -270,7 +270,7 @@ namespace Google.Protobuf
output.Flush();
Assert.AreEqual(rawBytes, rawOutput.ToArray());
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
bufferWriter.MaxGrowBy = blockSize;
message.WriteTo(bufferWriter);
Assert.AreEqual(rawBytes, bufferWriter.WrittenSpan.ToArray());
@ -292,7 +292,7 @@ namespace Google.Protobuf
output.Flush();
byte[] expectedBytes2 = expectedOutput.ToArray();
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
WriteContext.Initialize(bufferWriter, out WriteContext ctx);
ctx.WriteMessage(message);
ctx.Flush();
@ -519,7 +519,21 @@ namespace Google.Protobuf
}
[Test]
public void WriteStringsOfDifferentSizes()
public void WriteString_AsciiSmall_MaxUtf8SizeExceedsBuffer()
{
var buffer = new byte[5];
var output = new CodedOutputStream(buffer);
output.WriteString("ABC");
output.Flush();
// Verify written content
var input = new CodedInputStream(buffer);
Assert.AreEqual("ABC", input.ReadString());
}
[Test]
public void WriteStringsOfDifferentSizes_Ascii()
{
for (int i = 1; i <= 1024; i++)
{
@ -540,5 +554,30 @@ namespace Google.Protobuf
Assert.AreEqual(s, input.ReadString());
}
}
[Test]
public void WriteStringsOfDifferentSizes_Unicode()
{
for (int i = 1; i <= 1024; i++)
{
var buffer = new byte[4096];
var output = new CodedOutputStream(buffer);
var sb = new StringBuilder();
for (int j = 0; j < i; j++)
{
char c = (char)((j % 10) + 10112);
sb.Append(c.ToString()); // incrementing unicode numbers, repeating
}
var s = sb.ToString();
output.WriteString(s);
output.Flush();
// Verify written content
var input = new CodedInputStream(buffer);
Assert.AreEqual(s, input.ReadString());
}
}
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net451;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net451;netcoreapp2.1;net50</TargetFrameworks>
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<IsPackable>False</IsPackable>

View File

@ -551,9 +551,13 @@ namespace Google.Protobuf
}
[Test]
// Skip these test cases in .NET 5 because floating point parsing supports bigger values.
// These big values won't throw an error in the test.
#if !NET5_0
[TestCase("1.7977e308")]
[TestCase("-1.7977e308")]
[TestCase("1e309")]
#endif
[TestCase("1,0")]
[TestCase("1.0.0")]
[TestCase("+1")]

View File

@ -199,8 +199,12 @@ namespace Google.Protobuf
[TestCase("1e-")]
[TestCase("--")]
[TestCase("--1")]
// Skip these test cases in .NET 5 because floating point parsing supports bigger values.
// These big values won't throw an error in the test.
#if !NET5_0
[TestCase("-1.7977e308")]
[TestCase("1.7977e308")]
#endif
public void InvalidNumberValue(string json)
{
AssertThrowsAfter(json);

View File

@ -141,7 +141,7 @@ namespace Google.Protobuf
};
var exception = Assert.Throws<InvalidProtocolBufferException>(() =>
{
WriteContext.Initialize(new ArrayBufferWriter<byte>(), out WriteContext writeCtx);
WriteContext.Initialize(new TestArrayBufferWriter<byte>(), out WriteContext writeCtx);
((IBufferMessage)message).InternalWriteTo(ref writeCtx);
});
Assert.AreEqual($"Message {typeof(LegacyGeneratedCodeMessageA).Name} doesn't provide the generated method that enables WriteContext-based serialization. You might need to regenerate the generated protobuf code.", exception.Message);

View File

@ -83,7 +83,7 @@ namespace Google.Protobuf
var bytes = message.ToByteArray();
// also serialize using IBufferWriter and check it leads to the same data
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
message.WriteTo(bufferWriter);
Assert.AreEqual(bytes, bufferWriter.WrittenSpan.ToArray(), "Both serialization approaches need to result in the same data.");
@ -112,7 +112,7 @@ namespace Google.Protobuf
Assert.AreEqual(message.CalculateSize(), bytes.Length);
// serialize using IBufferWriter and check it leads to the same output
var bufferWriter = new ArrayBufferWriter<byte>();
var bufferWriter = new TestArrayBufferWriter<byte>();
message.WriteTo(bufferWriter);
Assert.AreEqual(bytes, bufferWriter.WrittenSpan.ToArray());
@ -124,7 +124,7 @@ namespace Google.Protobuf
// test for different IBufferWriter.GetSpan() segment sizes
for (int blockSize = 1; blockSize < 256; blockSize *= 2)
{
var segmentedBufferWriter = new ArrayBufferWriter<byte>();
var segmentedBufferWriter = new TestArrayBufferWriter<byte>();
segmentedBufferWriter.MaxGrowBy = blockSize;
message.WriteTo(segmentedBufferWriter);
Assert.AreEqual(bytes, segmentedBufferWriter.WrittenSpan.ToArray());

View File

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<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.14.0</VersionPrefix>
<VersionPrefix>3.15.3</VersionPrefix>
<!-- C# 7.2 is required for Span/BufferWriter/ReadOnlySequence -->
<LangVersion>7.2</LangVersion>
<Authors>Google Inc.</Authors>
<TargetFrameworks>netstandard1.1;netstandard2.0;net45</TargetFrameworks>
<TargetFrameworks>netstandard1.1;netstandard2.0;net45;net50</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
@ -27,15 +27,23 @@
<DefineConstants>$(DefineConstants);GOOGLE_PROTOBUF_SUPPORT_FAST_STRING</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net50' ">
<DefineConstants>$(DefineConstants);GOOGLE_PROTOBUF_SUPPORT_FAST_STRING;GOOGLE_PROTOBUF_SIMD</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.3"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="1.0.0"/>
<!-- Needed for the net45 build to work on Unix. See https://github.com/dotnet/designs/pull/33 -->
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0"/>
</ItemGroup>
<!-- Needed for netcoreapp2.1 to work correctly. .NET is not able to load the assembly without this -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'netstandard1.1' ">
<PackageReference Include="System.Memory" Version="4.5.3"/>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Memory" Version="4.5.3"/>
<!-- Needed for netcoreapp2.1 to work correctly. .NET is not able to load the assembly without this -->
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2"/>
</ItemGroup>

View File

@ -32,8 +32,14 @@
using System;
using System.Buffers.Binary;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if GOOGLE_PROTOBUF_SIMD
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
#endif
using System.Security;
using System.Text;
@ -45,8 +51,11 @@ namespace Google.Protobuf
[SecuritySafeCritical]
internal static class WritingPrimitives
{
// "Local" copy of Encoding.UTF8, for efficiency. (Yes, it makes a difference.)
internal static readonly Encoding Utf8Encoding = Encoding.UTF8;
#if NET5_0
internal static Encoding Utf8Encoding => Encoding.UTF8; // allows JIT to devirtualize
#else
internal static readonly Encoding Utf8Encoding = Encoding.UTF8; // "Local" copy of Encoding.UTF8, for efficiency. (Yes, it makes a difference.)
#endif
#region Writing of values (not including tags)
@ -186,11 +195,7 @@ namespace Google.Protobuf
{
if (length == value.Length) // Must be all ASCII...
{
for (int i = 0; i < length; i++)
{
buffer[state.position + i] = (byte)value[i];
}
state.position += length;
WriteAsciiStringToBuffer(buffer, ref state, value, length);
}
else
{
@ -208,6 +213,104 @@ namespace Google.Protobuf
}
}
// Calling this method with non-ASCII content will break.
// Content must be verified to be all ASCII before using this method.
private static void WriteAsciiStringToBuffer(Span<byte> buffer, ref WriterInternalState state, string value, int length)
{
ref char sourceChars = ref MemoryMarshal.GetReference(value.AsSpan());
ref byte destinationBytes = ref MemoryMarshal.GetReference(buffer.Slice(state.position));
int currentIndex = 0;
// If 64bit, process 4 chars at a time.
// The logic inside this check will be elided by JIT in 32bit programs.
if (IntPtr.Size == 8)
{
// Need at least 4 chars available to use this optimization.
if (length >= 4)
{
ref byte sourceBytes = ref Unsafe.As<char, byte>(ref sourceChars);
// Process 4 chars at a time until there are less than 4 remaining.
// We already know all characters are ASCII so there is no need to validate the source.
int lastIndexWhereCanReadFourChars = value.Length - 4;
do
{
NarrowFourUtf16CharsToAsciiAndWriteToBuffer(
ref Unsafe.AddByteOffset(ref destinationBytes, (IntPtr)currentIndex),
Unsafe.ReadUnaligned<ulong>(ref Unsafe.AddByteOffset(ref sourceBytes, (IntPtr)(currentIndex * 2))));
} while ((currentIndex += 4) <= lastIndexWhereCanReadFourChars);
}
}
// Process any remaining, 1 char at a time.
// Avoid bounds checking with ref + Unsafe
for (; currentIndex < length; currentIndex++)
{
Unsafe.AddByteOffset(ref destinationBytes, (IntPtr)currentIndex) = (byte)Unsafe.AddByteOffset(ref sourceChars, (IntPtr)(currentIndex * 2));
}
state.position += length;
}
// Copied with permission from https://github.com/dotnet/runtime/blob/1cdafd27e4afd2c916af5df949c13f8b373c4335/src/libraries/System.Private.CoreLib/src/System/Text/ASCIIUtility.cs#L1119-L1171
//
/// <summary>
/// Given a QWORD which represents a buffer of 4 ASCII chars in machine-endian order,
/// narrows each WORD to a BYTE, then writes the 4-byte result to the output buffer
/// also in machine-endian order.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void NarrowFourUtf16CharsToAsciiAndWriteToBuffer(ref byte outputBuffer, ulong value)
{
#if GOOGLE_PROTOBUF_SIMD
if (Sse2.X64.IsSupported)
{
// Narrows a vector of words [ w0 w1 w2 w3 ] to a vector of bytes
// [ b0 b1 b2 b3 b0 b1 b2 b3 ], then writes 4 bytes (32 bits) to the destination.
Vector128<short> vecWide = Sse2.X64.ConvertScalarToVector128UInt64(value).AsInt16();
Vector128<uint> vecNarrow = Sse2.PackUnsignedSaturate(vecWide, vecWide).AsUInt32();
Unsafe.WriteUnaligned<uint>(ref outputBuffer, Sse2.ConvertToUInt32(vecNarrow));
}
else if (AdvSimd.IsSupported)
{
// Narrows a vector of words [ w0 w1 w2 w3 ] to a vector of bytes
// [ b0 b1 b2 b3 * * * * ], then writes 4 bytes (32 bits) to the destination.
Vector128<short> vecWide = Vector128.CreateScalarUnsafe(value).AsInt16();
Vector64<byte> lower = AdvSimd.ExtractNarrowingSaturateUnsignedLower(vecWide);
Unsafe.WriteUnaligned<uint>(ref outputBuffer, lower.AsUInt32().ToScalar());
}
else
#endif
{
// Fallback to non-SIMD approach when SIMD is not available.
// This could happen either because the APIs are not available, or hardware doesn't support it.
// Processing 4 chars at a time in this fallback is still faster than casting one char at a time.
if (BitConverter.IsLittleEndian)
{
outputBuffer = (byte)value;
value >>= 16;
Unsafe.Add(ref outputBuffer, 1) = (byte)value;
value >>= 16;
Unsafe.Add(ref outputBuffer, 2) = (byte)value;
value >>= 16;
Unsafe.Add(ref outputBuffer, 3) = (byte)value;
}
else
{
Unsafe.Add(ref outputBuffer, 3) = (byte)value;
value >>= 16;
Unsafe.Add(ref outputBuffer, 2) = (byte)value;
value >>= 16;
Unsafe.Add(ref outputBuffer, 1) = (byte)value;
value >>= 16;
outputBuffer = (byte)value;
}
}
}
private static int WriteStringToBuffer(Span<byte> buffer, ref WriterInternalState state, string value)
{
#if NETSTANDARD1_1

18
docs/jvm_aot.md Normal file
View File

@ -0,0 +1,18 @@
# Ahead Of Time (AOT) compilation for the Java Virtual Machine (JVM)"
Ahead Of Time (AOT) compilation build tools such as those provided by [GraalVM's `native-image`](https://www.graalvm.org/reference-manual/native-image/) can require some configuration when using protobuf.
Protobuf for the JVM uses reflection and some of its target classes are not possible to determine in advance.
Historically, there were good reasons to use reflection based on APIs that were published effectively requiring them, and this situation is unlikely to change.
[The Lite version of protobuf for the JVM](https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md)
avoids reflection and may be better suited for use with AOT compilation tooling. This Lite version was originally targeted for use on Android which has similar AOT compilation
goals as GraalVM's native-image tool.
## GraalVM native-image
This section addresses GraalVM's `native-image` configuration specifically as this AOT compilation tool due to its popularity. The `native-image` tool can be configured
with respect to: the [Java Native Interface](https://en.wikipedia.org/wiki/Java_Native_Interface) (JNI), http proxying, reflection, and other resources. While these
considerations can be manually declared as JSON files, we recommend that a JVM application is exercised along with
[the assisted configuration agent](https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/#assisted-configuration-of-native-image-builds). The agent
will generate files that you can then subsequently point at when invoking `native-image`. We recommend that the generated files are retained with a project's source
code.

View File

@ -252,11 +252,19 @@ with info about your project (name and website) so we can add an entry for you.
1. Confluent Schema Registry
* Website: https://github.com/confluentinc/schema-registry
* Extensions: 1088
1. ScalaPB Validate
* Website: https://scalapb.github.io/docs/validation
* Extension: 1089
1. Astounding (Currently Private)
* Website: https://github.com/PbPipes/Astounding
* Website: https://github.com/PbPipes/Astounding
* Extension: 1090
1. Protoc-gen-psql
* Website: https://github.com/Intrinsec/protoc-gen-psql
* Extension: 1091-1101
1. Protoc-gen-sanitize
* Website: https://github.com/Intrinsec/protoc-gen-sanitize
* Extension: 1102-1106

View File

@ -1,6 +1,6 @@
{
"sdk": {
"version": "3.0.100",
"version": "5.0.102",
"rollForward": "latestMinor"
}
}

View File

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>3.14.0</version>
<version>3.15.3</version>
<packaging>pom</packaging>
<name>Protocol Buffers [BOM]</name>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.14.0</version>
<version>3.15.3</version>
</parent>
<artifactId>protobuf-java</artifactId>

View File

@ -2055,6 +2055,44 @@ public abstract class CodedInputStream {
totalBytesRetired = 0;
}
/*
* The following wrapper methods exist so that InvalidProtocolBufferExceptions thrown by the
* InputStream can be differentiated from ones thrown by CodedInputStream itself. Each call to
* an InputStream method that can throw IOException must be wrapped like this. We do this
* because we sometimes need to modify IPBE instances after they are thrown far away from where
* they are thrown (ex. to add unfinished messages) and we use this signal elsewhere in the
* exception catch chain to know when to perform these operations directly or to wrap the
* exception in their own IPBE so the extra information can be communicated without trampling
* downstream information.
*/
private static int read(InputStream input, byte[] data, int offset, int length)
throws IOException {
try {
return input.read(data, offset, length);
} catch (InvalidProtocolBufferException e) {
e.setThrownFromInputStream();
throw e;
}
}
private static long skip(InputStream input, long length) throws IOException {
try {
return input.skip(length);
} catch (InvalidProtocolBufferException e) {
e.setThrownFromInputStream();
throw e;
}
}
private static int available(InputStream input) throws IOException {
try {
return input.available();
} catch (InvalidProtocolBufferException e) {
e.setThrownFromInputStream();
throw e;
}
}
@Override
public int readTag() throws IOException {
if (isAtEnd()) {
@ -2783,7 +2821,8 @@ public abstract class CodedInputStream {
// Here we should refill the buffer as many bytes as possible.
int bytesRead =
input.read(
read(
input,
buffer,
bufferSize,
Math.min(
@ -2905,7 +2944,7 @@ public abstract class CodedInputStream {
// Determine the number of bytes we need to read from the input stream.
int sizeLeft = size - bufferedBytes;
// TODO(nathanmittler): Consider using a value larger than DEFAULT_BUFFER_SIZE.
if (sizeLeft < DEFAULT_BUFFER_SIZE || sizeLeft <= input.available()) {
if (sizeLeft < DEFAULT_BUFFER_SIZE || sizeLeft <= available(input)) {
// Either the bytes we need are known to be available, or the required buffer is
// within an allowed threshold - go ahead and allocate the buffer now.
final byte[] bytes = new byte[size];
@ -2919,7 +2958,7 @@ public abstract class CodedInputStream {
// Fill the remaining bytes from the input stream.
int tempPos = bufferedBytes;
while (tempPos < bytes.length) {
int n = input.read(bytes, tempPos, size - tempPos);
int n = read(input, bytes, tempPos, size - tempPos);
if (n == -1) {
throw InvalidProtocolBufferException.truncatedMessage();
}
@ -3047,7 +3086,7 @@ public abstract class CodedInputStream {
try {
while (totalSkipped < size) {
int toSkip = size - totalSkipped;
long skipped = input.skip(toSkip);
long skipped = skip(input, toSkip);
if (skipped < 0 || skipped > toSkip) {
throw new IllegalStateException(
input.getClass()

View File

@ -282,7 +282,7 @@ final class FieldSet<T extends FieldSet.FieldDescriptorLite<T>> {
// Wrap the contents in a new list so that the caller cannot change
// the list's contents after setting it.
final List newList = new ArrayList();
final List newList = new ArrayList<>();
newList.addAll((List) value);
for (final Object element : newList) {
verifyType(descriptor, element);

View File

@ -1537,11 +1537,16 @@ public abstract class GeneratedMessageLite<
Schema<T> schema = Protobuf.getInstance().schemaFor(result);
schema.mergeFrom(result, CodedInputStreamReader.forCodedInput(input), extensionRegistry);
schema.makeImmutable(result);
} catch (InvalidProtocolBufferException e) {
if (e.getThrownFromInputStream()) {
e = new InvalidProtocolBufferException(e);
}
throw e.setUnfinishedMessage(result);
} catch (IOException e) {
if (e.getCause() instanceof InvalidProtocolBufferException) {
throw (InvalidProtocolBufferException) e.getCause();
}
throw new InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(result);
throw new InvalidProtocolBufferException(e).setUnfinishedMessage(result);
} catch (RuntimeException e) {
if (e.getCause() instanceof InvalidProtocolBufferException) {
throw (InvalidProtocolBufferException) e.getCause();
@ -1565,11 +1570,16 @@ public abstract class GeneratedMessageLite<
if (result.memoizedHashCode != 0) {
throw new RuntimeException();
}
} catch (InvalidProtocolBufferException e) {
if (e.getThrownFromInputStream()) {
e = new InvalidProtocolBufferException(e);
}
throw e.setUnfinishedMessage(result);
} catch (IOException e) {
if (e.getCause() instanceof InvalidProtocolBufferException) {
throw (InvalidProtocolBufferException) e.getCause();
}
throw new InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(result);
throw new InvalidProtocolBufferException(e).setUnfinishedMessage(result);
} catch (IndexOutOfBoundsException e) {
throw InvalidProtocolBufferException.truncatedMessage().setUnfinishedMessage(result);
}
@ -1727,8 +1737,13 @@ public abstract class GeneratedMessageLite<
return null;
}
size = CodedInputStream.readRawVarint32(firstByte, input);
} catch (InvalidProtocolBufferException e) {
if (e.getThrownFromInputStream()) {
e = new InvalidProtocolBufferException(e);
}
throw e;
} catch (IOException e) {
throw new InvalidProtocolBufferException(e.getMessage());
throw new InvalidProtocolBufferException(e);
}
InputStream limitedInput = new LimitedInputStream(input, size);
CodedInputStream codedInput = CodedInputStream.newInstance(limitedInput);

View File

@ -41,6 +41,7 @@ import java.io.IOException;
public class InvalidProtocolBufferException extends IOException {
private static final long serialVersionUID = -1616151763072450476L;
private MessageLite unfinishedMessage = null;
private boolean wasThrownFromInputStream;
public InvalidProtocolBufferException(final String description) {
super(description);
@ -72,6 +73,28 @@ public class InvalidProtocolBufferException extends IOException {
return unfinishedMessage;
}
/** Set by CodedInputStream */
void setThrownFromInputStream() {
/* This write can be racy if the same exception is stored and then thrown by multiple custom
* InputStreams on different threads. But since it only ever moves from false->true, there's no
* problem. A thread checking this condition after catching this exception from a delegate
* stram of CodedInputStream is guaranteed to always observe true, because a write on the same
* thread set the value when the exception left the delegate. A thread checking the same
* condition with an exception created by CodedInputStream is guaranteed to always see false,
* because the exception has not been exposed to any code that could publish it to other threads
* and cause a write.
*/
wasThrownFromInputStream = true;
}
/**
* Allows code catching IOException from CodedInputStream to tell whether this instance was thrown
* by a delegate InputStream, rather than directly by a parse failure.
*/
boolean getThrownFromInputStream() {
return wasThrownFromInputStream;
}
/**
* Unwraps the underlying {@link IOException} if this exception was caused by an I/O problem.
* Otherwise, returns {@code this}.

View File

@ -346,7 +346,7 @@ final class UnsafeUtil {
return MEMORY_ACCESSOR.supportsUnsafeByteBufferOperations();
}
private static boolean determineAndroidSupportByAddressSize(Class<?> addressClass) {
static boolean determineAndroidSupportByAddressSize(Class<?> addressClass) {
if (!Android.isOnAndroidDevice()) {
return false;
}

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.14.0</version>
<version>3.15.3</version>
</parent>
<artifactId>protobuf-javalite</artifactId>

View File

@ -38,6 +38,7 @@ import com.google.protobuf.UnittestImportLite.ImportEnumLite;
import com.google.protobuf.UnittestImportPublicLite.PublicImportMessageLite;
import com.google.protobuf.UnittestLite.ForeignEnumLite;
import com.google.protobuf.UnittestLite.ForeignMessageLite;
import com.google.protobuf.UnittestLite.RecursiveMessage;
import com.google.protobuf.UnittestLite.TestAllExtensionsLite;
import com.google.protobuf.UnittestLite.TestAllTypesLite;
import com.google.protobuf.UnittestLite.TestAllTypesLite.NestedEnum;
@ -61,6 +62,7 @@ import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestRecursiveOne
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
@ -1638,6 +1640,160 @@ public class LiteTest extends TestCase {
}
}
public void testParseFromStream_IOExceptionNotLost() throws Exception {
final IOException readException = new IOException();
try {
TestAllTypesLite.parseFrom(
CodedInputStream.newInstance(
new InputStream() {
@Override
public int read() throws IOException {
throw readException;
}
}));
fail();
} catch (InvalidProtocolBufferException expected) {
boolean found = false;
for (Throwable exception = expected; exception != null; exception = exception.getCause()) {
if (exception == readException) {
found = true;
break;
}
}
if (!found) {
throw new AssertionError("Lost cause of parsing error", expected);
}
}
}
public void testParseDelimitedFromStream_IOExceptionNotLost() throws Exception {
final IOException readException = new IOException();
try {
TestAllTypesLite.parseDelimitedFrom(
new InputStream() {
@Override
public int read() throws IOException {
throw readException;
}
});
fail();
} catch (InvalidProtocolBufferException expected) {
boolean found = false;
for (Throwable exception = expected; exception != null; exception = exception.getCause()) {
if (exception == readException) {
found = true;
break;
}
}
if (!found) {
throw new AssertionError("Lost cause of parsing error", expected);
}
}
}
public void testParseFromArray_manyNestedMessagesError() throws Exception {
RecursiveMessage.Builder recursiveMessage =
RecursiveMessage.newBuilder().setPayload(ByteString.copyFrom(new byte[1]));
for (int i = 0; i < 20; i++) {
recursiveMessage = RecursiveMessage.newBuilder().setRecurse(recursiveMessage.build());
}
byte[] result = recursiveMessage.build().toByteArray();
result[
result.length
- CodedOutputStream.computeTagSize(RecursiveMessage.PAYLOAD_FIELD_NUMBER)
- CodedOutputStream.computeLengthDelimitedFieldSize(1)] =
0; // Set invalid tag
try {
RecursiveMessage.parseFrom(result);
fail("Result was: " + Arrays.toString(result));
} catch (InvalidProtocolBufferException expected) {
boolean found = false;
int exceptionCount = 0;
for (Throwable exception = expected; exception != null; exception = exception.getCause()) {
if (exception instanceof InvalidProtocolBufferException) {
exceptionCount++;
}
for (StackTraceElement element : exception.getStackTrace()) {
if (InvalidProtocolBufferException.class.getName().equals(element.getClassName())
&& "invalidTag".equals(element.getMethodName())) {
found = true;
} else if (Android.isOnAndroidDevice()
&& "decodeUnknownField".equals(element.getMethodName())) {
// Android is missing the first element of the stack trace - b/181147885
found = true;
}
}
}
if (!found) {
throw new AssertionError("Lost cause of parsing error", expected);
}
if (exceptionCount > 1) {
throw new AssertionError(exceptionCount + " nested parsing exceptions", expected);
}
}
}
public void testParseFromStream_manyNestedMessagesError() throws Exception {
RecursiveMessage.Builder recursiveMessage =
RecursiveMessage.newBuilder().setPayload(ByteString.copyFrom(new byte[1]));
for (int i = 0; i < 20; i++) {
recursiveMessage = RecursiveMessage.newBuilder().setRecurse(recursiveMessage.build());
}
byte[] result = recursiveMessage.build().toByteArray();
result[
result.length
- CodedOutputStream.computeTagSize(RecursiveMessage.PAYLOAD_FIELD_NUMBER)
- CodedOutputStream.computeLengthDelimitedFieldSize(1)] =
0; // Set invalid tag
try {
RecursiveMessage.parseFrom(CodedInputStream.newInstance(new ByteArrayInputStream(result)));
fail("Result was: " + Arrays.toString(result));
} catch (InvalidProtocolBufferException expected) {
boolean found = false;
int exceptionCount = 0;
for (Throwable exception = expected; exception != null; exception = exception.getCause()) {
if (exception instanceof InvalidProtocolBufferException) {
exceptionCount++;
}
for (StackTraceElement element : exception.getStackTrace()) {
if (InvalidProtocolBufferException.class.getName().equals(element.getClassName())
&& "invalidTag".equals(element.getMethodName())) {
found = true;
} else if (Android.isOnAndroidDevice() && "readTag".equals(element.getMethodName())) {
// Android is missing the first element of the stack trace - b/181147885
found = true;
}
}
}
if (!found) {
throw new AssertionError("Lost cause of parsing error", expected);
}
if (exceptionCount > 1) {
throw new AssertionError(exceptionCount + " nested parsing exceptions", expected);
}
}
}
public void testParseFromStream_sneakyNestedException() throws Exception {
final InvalidProtocolBufferException sketchy =
new InvalidProtocolBufferException("Created in a sketchy way!")
.setUnfinishedMessage(TestAllTypesLite.getDefaultInstance());
try {
RecursiveMessage.parseFrom(
CodedInputStream.newInstance(
new InputStream() {
@Override
public int read() throws IOException {
throw sketchy;
}
}));
fail();
} catch (InvalidProtocolBufferException expected) {
assertNotSame(expected, sketchy);
}
assertEquals(sketchy.getUnfinishedMessage(), TestAllTypesLite.getDefaultInstance());
}
public void testMergeFrom_sanity() throws Exception {
TestAllTypesLite one = TestUtilLite.getAllLiteSetBuilder().build();
byte[] bytes = one.toByteArray();

View File

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.14.0</version>
<version>3.15.3</version>
<packaging>pom</packaging>
<name>Protocol Buffers [Parent]</name>
@ -93,12 +93,12 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-android</version>
<version>30.1-android</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-testlib</artifactId>
<version>30.0-android</version>
<version>30.1-android</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.14.0</version>
<version>3.15.3</version>
</parent>
<artifactId>protobuf-java-util</artifactId>

View File

@ -80,6 +80,8 @@ lineReader.on('line', function(line) {
if (isRequire) {
if (module) { // Skip goog.require() lines before the first directive.
var fullSym = isRequire[1];
// Skip lines importing from jspb.*, these are handled by the header above.
if (fullSym.match(/^jspb\./)) return;
var sym = tryStripPrefix(fullSym, pkg);
console.log("googleProtobuf.exportSymbol('" + fullSym + "', " + module + sym + ', global);');
}

View File

@ -1,6 +1,6 @@
{
"name": "google-protobuf",
"version": "3.14.0",
"version": "3.15.2",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [

View File

@ -16,6 +16,10 @@ until docker pull $DOCKER_IMAGE_NAME; do sleep 10; done
docker run -v $(pwd):/var/local/protobuf --rm $DOCKER_IMAGE_NAME \
bash -l /var/local/protobuf/tests.sh cpp || FAILED="true"
# This directory is owned by root. We need to delete it, because otherwise
# Kokoro will attempt to rsync it and fail with a permission error.
rm -rf src/core
if [ "$FAILED" = "true" ]; then
exit 1
fi

View File

@ -1,4 +1,4 @@
FROM debian:stretch
FROM debian:buster
# Install dependencies. We start with the basic ones require to build protoc
# and the C++ build
@ -22,14 +22,18 @@ RUN apt-get update && apt-get install -y \
wget \
&& apt-get clean
# Update ca-certificates to fix known buster + .NET 5 issue
# https://github.com/NuGet/Announcements/issues/49
RUN apt-get update && apt-get install -y ca-certificates && apt-get clean
# dotnet SDK prerequisites
RUN apt-get update && apt-get install -y libunwind8 libicu57 && apt-get clean
RUN apt-get update && apt-get install -y libunwind8 libicu63 && apt-get clean
# Install dotnet SDK via install script
RUN wget -q https://dot.net/v1/dotnet-install.sh && \
chmod u+x dotnet-install.sh && \
./dotnet-install.sh --version 2.1.802 && \
./dotnet-install.sh --version 3.1.301 && \
./dotnet-install.sh --version 5.0.102 && \
ln -s /root/.dotnet/dotnet /usr/local/bin
RUN wget -q www.nuget.org/NuGet.exe -O /usr/local/bin/nuget.exe

View File

@ -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

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -49,8 +49,7 @@ cp ${INPUT_ARTIFACTS_DIR}/build64/src/protoc protoc/macosx_x64/protoc
# Install nuget (will also install mono)
# TODO(jtattermusch): use "mono:5.14" docker image instead so we don't have to apt-get install
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt install apt-transport-https
echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt-get install -y nuget

View File

@ -30,10 +30,6 @@ cp kokoro/release/python/linux/config.sh config.sh
build_artifact_version() {
MB_PYTHON_VERSION=$1
# Clean up env
rm -rf venv
sudo rm -rf $REPO_DIR
cp -R $STAGE_DIR $REPO_DIR
source multibuild/common_utils.sh
@ -47,6 +43,10 @@ build_artifact_version() {
build_wheel $REPO_DIR/python $PLAT
mv wheelhouse/* $ARTIFACT_DIR
# Clean up env
rm -rf venv
sudo rm -rf $REPO_DIR
}
build_artifact_version 2.7

View File

@ -34,18 +34,20 @@
#import "GPBDescriptor.h"
@implementation GPBExtensionRegistry {
NSMutableDictionary *mutableClassMap_;
CFMutableDictionaryRef mutableClassMap_;
}
- (instancetype)init {
if ((self = [super init])) {
mutableClassMap_ = [[NSMutableDictionary alloc] init];
// The keys are ObjC classes, so straight up ptr comparisons are fine.
mutableClassMap_ = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL,
&kCFTypeDictionaryValueCallBacks);
}
return self;
}
- (void)dealloc {
[mutableClassMap_ release];
CFRelease(mutableClassMap_);
[super dealloc];
}
@ -68,14 +70,13 @@
Class containingMessageClass = extension.containingMessageClass;
CFMutableDictionaryRef extensionMap = (CFMutableDictionaryRef)
[mutableClassMap_ objectForKey:containingMessageClass];
CFDictionaryGetValue(mutableClassMap_, containingMessageClass);
if (extensionMap == nil) {
// Use a custom dictionary here because the keys are numbers and conversion
// back and forth from NSNumber isn't worth the cost.
extensionMap = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL,
&kCFTypeDictionaryValueCallBacks);
[mutableClassMap_ setObject:(id)extensionMap
forKey:(id<NSCopying>)containingMessageClass];
CFDictionarySetValue(mutableClassMap_, containingMessageClass, extensionMap);
CFRelease(extensionMap);
}
@ -87,7 +88,7 @@
fieldNumber:(NSInteger)fieldNumber {
Class messageClass = descriptor.messageClass;
CFMutableDictionaryRef extensionMap = (CFMutableDictionaryRef)
[mutableClassMap_ objectForKey:messageClass];
CFDictionaryGetValue(mutableClassMap_, messageClass);
ssize_t key = fieldNumber;
GPBExtensionDescriptor *result =
(extensionMap
@ -101,28 +102,28 @@ static void CopyKeyValue(const void *key, const void *value, void *context) {
CFDictionarySetValue(extensionMap, key, value);
}
static void CopySubDictionary(const void *key, const void *value, void *context) {
CFMutableDictionaryRef mutableClassMap = (CFMutableDictionaryRef)context;
Class containingMessageClass = key;
CFMutableDictionaryRef otherExtensionMap = (CFMutableDictionaryRef)value;
CFMutableDictionaryRef extensionMap = (CFMutableDictionaryRef)
CFDictionaryGetValue(mutableClassMap, containingMessageClass);
if (extensionMap == nil) {
extensionMap = CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, otherExtensionMap);
CFDictionarySetValue(mutableClassMap, containingMessageClass, extensionMap);
CFRelease(extensionMap);
} else {
CFDictionaryApplyFunction(otherExtensionMap, CopyKeyValue, extensionMap);
}
}
- (void)addExtensions:(GPBExtensionRegistry *)registry {
if (registry == nil) {
// In the case where there are no extensions just ignore.
return;
}
NSMutableDictionary *otherClassMap = registry->mutableClassMap_;
[otherClassMap enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL * stop) {
#pragma unused(stop)
Class containingMessageClass = key;
CFMutableDictionaryRef otherExtensionMap = (CFMutableDictionaryRef)value;
CFMutableDictionaryRef extensionMap = (CFMutableDictionaryRef)
[mutableClassMap_ objectForKey:containingMessageClass];
if (extensionMap == nil) {
extensionMap = CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, otherExtensionMap);
[mutableClassMap_ setObject:(id)extensionMap
forKey:(id<NSCopying>)containingMessageClass];
CFRelease(extensionMap);
} else {
CFDictionaryApplyFunction(otherExtensionMap, CopyKeyValue, extensionMap);
}
}];
CFDictionaryApplyFunction(registry->mutableClassMap_, CopySubDictionary, mutableClassMap_);
}
#pragma clang diagnostic pop

View File

@ -16,8 +16,8 @@ generation functionality.
To use PHP runtime library requires:
- C extension: PHP 5.5, 5.6, or 7.
- [PHP package](http://php.net/downloads.php): PHP 5.5, 5.6 or 7.
- C extension: PHP 7.x, 8.0
- [PHP package](http://php.net/downloads.php): PHP 5.5, 5.6, 7.x, or 8.0.
## Installation

View File

@ -916,7 +916,10 @@ static void add_descriptor(DescriptorPool *pool,
if (upb_symtab_lookupfile2(pool->symtab, name.data, name.size)) {
// Already added.
fprintf(stderr, "WARNING: file was already added\n");
zend_error(E_USER_WARNING,
"proto descriptor was previously loaded (included in multiple "
"metadata bundles?): " UPB_STRVIEW_FORMAT,
UPB_STRVIEW_ARGS(name));
return;
}

View File

@ -10,18 +10,28 @@
<email>protobuf-opensource@google.com</email>
<active>yes</active>
</lead>
<date>2020-11-12</date>
<time>14:06:40</time>
<date>2021-02-24</date>
<time>16:49:52</time>
<version>
<release>3.14.0</release>
<api>3.14.0</api>
<release>3.15.3</release>
<api>3.15.3</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>PHP protobuf</notes>
<notes>
New changes in 3.15.0:
* unregister INI entries and fix invalid read on shutdown (#8042)
* Fix PhpDoc comments for message accessors to include &quot;|null&quot;. (#8136)
* fix: convert native PHP floats to single precision (#8187)
* Fixed PHP to support field numbers &gt;=2**28. (#8235)
* feat: add support for deprecated fields to PHP compiler (#8223)
* Protect against stack overflow if the user derives from Message. (#8248)
* Fixed clone for Message, RepeatedField, and MapField. (#8245)
* Updated upb to allow nonzero offset minutes in JSON timestamps. (#8258)
</notes>
<contents>
<dir baseinstalldir="/" name="/">
<file baseinstalldir="/" name="config.m4" role="src"/>
@ -750,5 +760,95 @@ G A release.
<notes>
</notes>
</release>
<release>
<version>
<release>3.15.0RC1</release>
<api>3.15.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2021-02-05</date>
<time>14:15:36</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
</notes>
</release>
<release>
<version>
<release>3.15.0RC2</release>
<api>3.15.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2021-02-17</date>
<time>09:10:33</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
</notes>
</release>
<release>
<version>
<release>3.15.0</release>
<api>3.15.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2021-02-18</date>
<time>10:33:10</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
</notes>
</release>
<release>
<version>
<release>3.15.1</release>
<api>3.15.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2021-02-19</date>
<time>10:50:04</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
</notes>
</release>
<release>
<version>
<release>3.15.2</release>
<api>3.15.2</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2021-02-23</date>
<time>11:35:09</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
</notes>
</release>
<release>
<version>
<release>3.15.3</release>
<api>3.15.3</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2021-02-24</date>
<time>16:49:52</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
</notes>
</release>
</changelog>
</package>

View File

@ -76,7 +76,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
#define PHP_PROTOBUF_VERSION "3.14.0"
#define PHP_PROTOBUF_VERSION "3.15.3"
// ptr -> PHP object cache. This is a weak map that caches lazily-created
// wrapper objects around upb types:

View File

@ -67,7 +67,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
/**
* Constructs an instance of RepeatedField.
*
* @param long $type Type of the stored element.
* @param integer $type Type of the stored element.
* @param string $klass Message/Enum class name (message/enum fields only).
* @ignore
*/
@ -116,7 +116,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
*
* This will also be called for: $ele = $arr[0]
*
* @param long $offset The index of the element to be fetched.
* @param integer $offset The index of the element to be fetched.
* @return object The stored element at given index.
* @throws \ErrorException Invalid type for index.
* @throws \ErrorException Non-existing index.
@ -131,7 +131,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
*
* This will also be called for: $arr []= $ele and $arr[0] = ele
*
* @param long $offset The index of the element to be assigned.
* @param integer $offset The index of the element to be assigned.
* @param object $value The element to be assigned.
* @return void
* @throws \ErrorException Invalid type for index.
@ -204,7 +204,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
*
* This will also be called for: unset($arr)
*
* @param long $offset The index of the element to be removed.
* @param integer $offset The index of the element to be removed.
* @return void
* @throws \ErrorException Invalid type for index.
* @throws \ErrorException The element to be removed is not at the end of the
@ -227,7 +227,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
*
* This will also be called for: isset($arr)
*
* @param long $offset The index of the element to be removed.
* @param integer $offset The index of the element to be removed.
* @return bool True if the element at the given offset exists.
* @throws \ErrorException Invalid type for index.
*/

View File

@ -8,7 +8,7 @@
</parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
<version>3.14.0</version>
<version>3.15.3</version>
<packaging>pom</packaging>
<name>Protobuf Compiler</name>
<description>

View File

@ -30,4 +30,4 @@
# Copyright 2007 Google Inc. All Rights Reserved.
__version__ = '3.14.0'
__version__ = '3.15.2'

View File

@ -295,7 +295,7 @@ static VALUE DescriptorPool_alloc(VALUE klass) {
self->def_to_descriptor = rb_hash_new();
self->symtab = upb_symtab_new();
ObjectCache_Add(self->symtab, ret, _upb_symtab_arena(self->symtab));
ObjectCache_Add(self->symtab, ret);
return ret;
}
@ -960,16 +960,14 @@ static VALUE FieldDescriptor_subtype(VALUE _self) {
static VALUE FieldDescriptor_get(VALUE _self, VALUE msg_rb) {
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
const upb_msgdef *m;
const upb_msgdef *msg = Message_Get(msg_rb, &m);
VALUE arena = Message_GetArena(msg_rb);
upb_msgval msgval;
Message_Get(msg_rb, &m);
if (m != upb_fielddef_containingtype(self->fielddef)) {
rb_raise(cTypeError, "get method called on wrong message type");
}
msgval = upb_msg_get(msg, self->fielddef);
return Convert_UpbToRuby(msgval, TypeInfo_get(self->fielddef), arena);
return Message_getfield(msg_rb, self->fielddef);
}
/*

View File

@ -93,7 +93,7 @@ VALUE Map_GetRubyWrapper(upb_map* map, upb_fieldtype_t key_type,
if (val == Qnil) {
val = Map_alloc(cMap);
Map* self;
ObjectCache_Add(map, val, Arena_get(arena));
ObjectCache_Add(map, val);
TypedData_Get_Struct(val, Map, &Map_type, self);
self->map = map;
self->arena = arena;
@ -318,7 +318,7 @@ static VALUE Map_init(int argc, VALUE* argv, VALUE _self) {
self->map = upb_map_new(Arena_get(self->arena), self->key_type,
self->value_type_info.type);
ObjectCache_Add(self->map, _self, Arena_get(self->arena));
ObjectCache_Add(self->map, _self);
if (init_arg != Qnil) {
Map_merge_into_self(_self, init_arg);
@ -590,9 +590,10 @@ VALUE Map_eq(VALUE _self, VALUE _other) {
*/
static VALUE Map_freeze(VALUE _self) {
Map* self = ruby_to_Map(_self);
ObjectCache_Pin(self->map, _self, Arena_get(self->arena));
RB_OBJ_FREEZE(_self);
if (!RB_OBJ_FROZEN(_self)) {
Arena_Pin(self->arena, _self);
RB_OBJ_FREEZE(_self);
}
return _self;
}

View File

@ -105,7 +105,7 @@ void Message_InitPtr(VALUE self_, upb_msg *msg, VALUE arena) {
Message* self = ruby_to_Message(self_);
self->msg = msg;
self->arena = arena;
ObjectCache_Add(msg, self_, Arena_get(arena));
ObjectCache_Add(msg, self_);
}
VALUE Message_GetArena(VALUE msg_rb) {
@ -292,6 +292,35 @@ static void Message_setfield(upb_msg* msg, const upb_fielddef* f, VALUE val,
upb_msg_set(msg, f, msgval, arena);
}
VALUE Message_getfield(VALUE _self, const upb_fielddef* f) {
Message* self = ruby_to_Message(_self);
// This is a special-case: upb_msg_mutable() for map & array are logically
// const (they will not change what is serialized) but physically
// non-const, as they do allocate a repeated field or map. The logical
// constness means it's ok to do even if the message is frozen.
upb_msg *msg = (upb_msg*)self->msg;
upb_arena *arena = Arena_get(self->arena);
if (upb_fielddef_ismap(f)) {
upb_map *map = upb_msg_mutable(msg, f, arena).map;
const upb_fielddef *key_f = map_field_key(f);
const upb_fielddef *val_f = map_field_value(f);
upb_fieldtype_t key_type = upb_fielddef_type(key_f);
TypeInfo value_type_info = TypeInfo_get(val_f);
return Map_GetRubyWrapper(map, key_type, value_type_info, self->arena);
} else if (upb_fielddef_isseq(f)) {
upb_array *arr = upb_msg_mutable(msg, f, arena).array;
return RepeatedField_GetRubyWrapper(arr, TypeInfo_get(f), self->arena);
} else if (upb_fielddef_issubmsg(f)) {
if (!upb_msg_has(self->msg, f)) return Qnil;
upb_msg *submsg = upb_msg_mutable(msg, f, arena).msg;
const upb_msgdef *m = upb_fielddef_msgsubdef(f);
return Message_GetRubyWrapper(submsg, m, self->arena);
} else {
upb_msgval msgval = upb_msg_get(self->msg, f);
return Convert_UpbToRuby(msgval, TypeInfo_get(f), self->arena);
}
}
static VALUE Message_field_accessor(VALUE _self, const upb_fielddef* f,
int accessor_type, int argc, VALUE* argv) {
upb_arena *arena = Arena_get(Message_GetArena(_self));
@ -350,36 +379,11 @@ static VALUE Message_field_accessor(VALUE _self, const upb_fielddef* f,
return INT2NUM(msgval.int32_val);
}
}
case METHOD_GETTER: {
Message* self = ruby_to_Message(_self);
// This is a special-case: upb_msg_mutable() for map & array are logically
// const (they will not change what is serialized) but physically
// non-const, as they do allocate a repeated field or map. The logical
// constness means it's ok to do even if the message is frozen.
upb_msg *msg = (upb_msg*)self->msg;
if (upb_fielddef_ismap(f)) {
upb_map *map = upb_msg_mutable(msg, f, arena).map;
const upb_fielddef *key_f = map_field_key(f);
const upb_fielddef *val_f = map_field_value(f);
upb_fieldtype_t key_type = upb_fielddef_type(key_f);
TypeInfo value_type_info = TypeInfo_get(val_f);
return Map_GetRubyWrapper(map, key_type, value_type_info, self->arena);
} else if (upb_fielddef_isseq(f)) {
upb_array *arr = upb_msg_mutable(msg, f, arena).array;
return RepeatedField_GetRubyWrapper(arr, TypeInfo_get(f), self->arena);
} else if (upb_fielddef_issubmsg(f)) {
if (!upb_msg_has(self->msg, f)) return Qnil;
upb_msg *submsg = upb_msg_mutable(msg, f, arena).msg;
const upb_msgdef *m = upb_fielddef_msgsubdef(f);
return Message_GetRubyWrapper(submsg, m, self->arena);
} else {
upb_msgval msgval = upb_msg_get(self->msg, f);
return Convert_UpbToRuby(msgval, TypeInfo_get(f), self->arena);
}
case METHOD_GETTER:
return Message_getfield(_self, f);
default:
rb_raise(rb_eRuntimeError, "Internal error, no such accessor: %d",
accessor_type);
}
}
}
@ -851,8 +855,10 @@ static VALUE Message_to_h(VALUE _self) {
*/
static VALUE Message_freeze(VALUE _self) {
Message* self = ruby_to_Message(_self);
ObjectCache_Pin(self->msg, _self, Arena_get(self->arena));
RB_OBJ_FREEZE(_self);
if (!RB_OBJ_FROZEN(_self)) {
Arena_Pin(self->arena, _self);
RB_OBJ_FREEZE(_self);
}
return _self;
}
@ -866,7 +872,6 @@ static VALUE Message_freeze(VALUE _self) {
static VALUE Message_index(VALUE _self, VALUE field_name) {
Message* self = ruby_to_Message(_self);
const upb_fielddef* field;
upb_msgval val;
Check_Type(field_name, T_STRING);
field = upb_msgdef_ntofz(self->msgdef, RSTRING_PTR(field_name));
@ -875,8 +880,7 @@ static VALUE Message_index(VALUE _self, VALUE field_name) {
return Qnil;
}
val = upb_msg_get(self->msg, field);
return Convert_UpbToRuby(val, TypeInfo_get(field), self->arena);
return Message_getfield(_self, field);
}
/*
@ -1285,7 +1289,7 @@ const upb_msg* Message_GetUpbMessage(VALUE value, const upb_msgdef* m,
if (!rb_obj_is_kind_of(value, rb_cNumeric)) goto badtype;
sec.int64_val = NUM2LL(value);
nsec.int32_val = (NUM2DBL(value) - NUM2LL(value)) * 1000000000;
nsec.int32_val = round((NUM2DBL(value) - NUM2LL(value)) * 1000000000);
upb_msg_set(msg, sec_f, sec, arena);
upb_msg_set(msg, nsec_f, nsec, arena);
return msg;

View File

@ -63,6 +63,9 @@ const upb_msg* Message_GetUpbMessage(VALUE value, const upb_msgdef* m,
// object will reference |arena| and ensure that it outlives this object.
VALUE Message_GetRubyWrapper(upb_msg* msg, const upb_msgdef* m, VALUE arena);
// Gets the given field from this message.
VALUE Message_getfield(VALUE _self, const upb_fielddef* f);
// Implements #inspect for this message, printing the text to |b|.
void Message_PrintMessage(StringBuilder* b, const upb_msg* msg,
const upb_msgdef* m);

View File

@ -167,30 +167,55 @@ void StringBuilder_PrintMsgval(StringBuilder* b, upb_msgval val,
// Arena
// -----------------------------------------------------------------------------
void Arena_free(void* data) { upb_arena_free(data); }
typedef struct {
upb_arena *arena;
VALUE pinned_objs;
} Arena;
static void Arena_mark(void *data) {
Arena *arena = data;
rb_gc_mark(arena->pinned_objs);
}
static void Arena_free(void *data) {
Arena *arena = data;
upb_arena_free(arena->arena);
}
static VALUE cArena;
const rb_data_type_t Arena_type = {
"Google::Protobuf::Internal::Arena",
{ NULL, Arena_free, NULL },
{ Arena_mark, Arena_free, NULL },
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
};
static VALUE Arena_alloc(VALUE klass) {
upb_arena *arena = upb_arena_new();
Arena *arena = ALLOC(Arena);
arena->arena = upb_arena_new();
arena->pinned_objs = Qnil;
return TypedData_Wrap_Struct(klass, &Arena_type, arena);
}
upb_arena *Arena_get(VALUE _arena) {
upb_arena *arena;
TypedData_Get_Struct(_arena, upb_arena, &Arena_type, arena);
return arena;
Arena *arena;
TypedData_Get_Struct(_arena, Arena, &Arena_type, arena);
return arena->arena;
}
VALUE Arena_new() {
return Arena_alloc(cArena);
}
void Arena_Pin(VALUE _arena, VALUE obj) {
Arena *arena;
TypedData_Get_Struct(_arena, Arena, &Arena_type, arena);
if (arena->pinned_objs == Qnil) {
arena->pinned_objs = rb_ary_new();
}
rb_ary_push(arena->pinned_objs, obj);
}
void Arena_register(VALUE module) {
VALUE internal = rb_define_module_under(module, "Internal");
VALUE klass = rb_define_class_under(internal, "Arena", rb_cObject);
@ -209,15 +234,37 @@ void Arena_register(VALUE module) {
// different wrapper objects for the same C object, which saves memory and
// preserves object identity.
//
// We use Hash and/or WeakMap for the cache. WeakMap is faster overall
// (probably due to removal being integrated with GC) but doesn't work for Ruby
// <2.7 (see note below). We need Hash for Ruby <2.7 and for cases where we
// need to GC-root the object (notably when the object has been frozen).
// We use WeakMap for the cache. For Ruby <2.7 we also need a secondary Hash
// to store WeakMap keys because Ruby <2.7 WeakMap doesn't allow non-finalizable
// keys.
#if RUBY_API_VERSION_CODE >= 20700
#define USE_WEAK_MAP 1
#define USE_SECONDARY_MAP 0
#else
#define USE_WEAK_MAP 0
#define USE_SECONDARY_MAP 1
#endif
#if USE_SECONDARY_MAP
// Maps Numeric -> Object. The object is then used as a key into the WeakMap.
// This is needed for Ruby <2.7 where a number cannot be a key to WeakMap.
// The object is used only for its identity; it does not contain any data.
VALUE secondary_map = Qnil;
static void SecondaryMap_Init() {
rb_gc_register_address(&secondary_map);
secondary_map = rb_hash_new();
}
static VALUE SecondaryMap_Get(VALUE key) {
VALUE ret = rb_hash_lookup(secondary_map, key);
if (ret == Qnil) {
ret = rb_eval_string("Object.new");
rb_hash_aset(secondary_map, key, ret);
}
return ret;
}
#endif
static VALUE ObjectCache_GetKey(const void* key) {
@ -225,106 +272,41 @@ static VALUE ObjectCache_GetKey(const void* key) {
memcpy(&buf, &key, sizeof(key));
intptr_t key_int = (intptr_t)key;
PBRUBY_ASSERT((key_int & 3) == 0);
return LL2NUM(key_int >> 2);
}
// Strong object cache, uses regular Hash and GC-roots objects.
// - For Ruby <2.7, used for all objects.
// - For Ruby >=2.7, used only for frozen objects, so we preserve the "frozen"
// bit (since this information is not preserved at the upb level).
VALUE strong_obj_cache = Qnil;
static void StrongObjectCache_Init() {
rb_gc_register_address(&strong_obj_cache);
strong_obj_cache = rb_hash_new();
}
static void StrongObjectCache_Remove(void* key) {
VALUE key_rb = ObjectCache_GetKey(key);
PBRUBY_ASSERT(rb_hash_lookup(strong_obj_cache, key_rb) != Qnil);
rb_hash_delete(strong_obj_cache, key_rb);
}
static VALUE StrongObjectCache_Get(const void* key) {
VALUE key_rb = ObjectCache_GetKey(key);
return rb_hash_lookup(strong_obj_cache, key_rb);
}
static void StrongObjectCache_Add(const void* key, VALUE val,
upb_arena* arena) {
PBRUBY_ASSERT(StrongObjectCache_Get(key) == Qnil);
VALUE key_rb = ObjectCache_GetKey(key);
rb_hash_aset(strong_obj_cache, key_rb, val);
upb_arena_addcleanup(arena, (void*)key, StrongObjectCache_Remove);
}
// Weak object cache. This speeds up the test suite significantly, so we
// presume it speeds up real code also. However we can only use it in Ruby
// >=2.7 due to:
// https://bugs.ruby-lang.org/issues/16035
#if USE_WEAK_MAP
VALUE weak_obj_cache = Qnil;
static void WeakObjectCache_Init() {
rb_gc_register_address(&weak_obj_cache);
VALUE klass = rb_eval_string("ObjectSpace::WeakMap");
weak_obj_cache = rb_class_new_instance(0, NULL, klass);
}
static VALUE WeakObjectCache_Get(const void* key) {
VALUE key_rb = ObjectCache_GetKey(key);
VALUE ret = rb_funcall(weak_obj_cache, rb_intern("[]"), 1, key_rb);
VALUE ret = LL2NUM(key_int >> 2);
#if USE_SECONDARY_MAP
ret = SecondaryMap_Get(ret);
#endif
return ret;
}
static void WeakObjectCache_Add(const void* key, VALUE val) {
PBRUBY_ASSERT(WeakObjectCache_Get(key) == Qnil);
VALUE key_rb = ObjectCache_GetKey(key);
rb_funcall(weak_obj_cache, rb_intern("[]="), 2, key_rb, val);
PBRUBY_ASSERT(WeakObjectCache_Get(key) == val);
}
#endif
// Public ObjectCache API.
VALUE weak_obj_cache = Qnil;
ID item_get;
ID item_set;
static void ObjectCache_Init() {
StrongObjectCache_Init();
#if USE_WEAK_MAP
WeakObjectCache_Init();
rb_gc_register_address(&weak_obj_cache);
VALUE klass = rb_eval_string("ObjectSpace::WeakMap");
weak_obj_cache = rb_class_new_instance(0, NULL, klass);
item_get = rb_intern("[]");
item_set = rb_intern("[]=");
#if USE_SECONDARY_MAP
SecondaryMap_Init();
#endif
}
void ObjectCache_Add(const void* key, VALUE val, upb_arena *arena) {
#if USE_WEAK_MAP
(void)arena;
WeakObjectCache_Add(key, val);
#else
StrongObjectCache_Add(key, val, arena);
#endif
void ObjectCache_Add(const void* key, VALUE val) {
PBRUBY_ASSERT(ObjectCache_Get(key) == Qnil);
VALUE key_rb = ObjectCache_GetKey(key);
rb_funcall(weak_obj_cache, item_set, 2, key_rb, val);
PBRUBY_ASSERT(ObjectCache_Get(key) == val);
}
// Returns the cached object for this key, if any. Otherwise returns Qnil.
VALUE ObjectCache_Get(const void* key) {
#if USE_WEAK_MAP
return WeakObjectCache_Get(key);
#else
return StrongObjectCache_Get(key);
#endif
}
void ObjectCache_Pin(const void* key, VALUE val, upb_arena *arena) {
#if USE_WEAK_MAP
PBRUBY_ASSERT(WeakObjectCache_Get(key) == val);
// This will GC-root the object, but we'll still use the weak map for
// actual lookup.
StrongObjectCache_Add(key, val, arena);
#else
// Value is already pinned, nothing to do.
#endif
VALUE key_rb = ObjectCache_GetKey(key);
return rb_funcall(weak_obj_cache, item_get, 1, key_rb);
}
/*

View File

@ -55,6 +55,13 @@ const upb_fielddef* map_field_value(const upb_fielddef* field);
VALUE Arena_new();
upb_arena *Arena_get(VALUE arena);
// Pins this Ruby object to the lifetime of this arena, so that as long as the
// arena is alive this object will not be collected.
//
// We use this to guarantee that the "frozen" bit on the object will be
// remembered, even if the user drops their reference to this precise object.
void Arena_Pin(VALUE arena, VALUE obj);
// -----------------------------------------------------------------------------
// ObjectCache
// -----------------------------------------------------------------------------
@ -68,19 +75,11 @@ upb_arena *Arena_get(VALUE arena);
// Adds an entry to the cache. The "arena" parameter must give the arena that
// "key" was allocated from. In Ruby <2.7.0, it will be used to remove the key
// from the cache when the arena is destroyed.
void ObjectCache_Add(const void* key, VALUE val, upb_arena *arena);
void ObjectCache_Add(const void* key, VALUE val);
// Returns the cached object for this key, if any. Otherwise returns Qnil.
VALUE ObjectCache_Get(const void* key);
// Pins the previously added object so it is GC-rooted. This turns the
// reference to "val" from weak to strong. We use this to guarantee that the
// "frozen" bit on the object will be remembered, even if the user drops their
// reference to this precise object.
//
// The "arena" parameter must give the arena that "key" was allocated from.
void ObjectCache_Pin(const void* key, VALUE val, upb_arena *arena);
// -----------------------------------------------------------------------------
// StringBuilder, for inspect
// -----------------------------------------------------------------------------

View File

@ -88,7 +88,7 @@ VALUE RepeatedField_GetRubyWrapper(upb_array* array, TypeInfo type_info,
if (val == Qnil) {
val = RepeatedField_alloc(cRepeatedField);
RepeatedField* self;
ObjectCache_Add(array, val, Arena_get(arena));
ObjectCache_Add(array, val);
TypedData_Get_Struct(val, RepeatedField, &RepeatedField_type, self);
self->array = array;
self->arena = arena;
@ -500,9 +500,10 @@ VALUE RepeatedField_eq(VALUE _self, VALUE _other) {
*/
static VALUE RepeatedField_freeze(VALUE _self) {
RepeatedField* self = ruby_to_RepeatedField(_self);
ObjectCache_Pin(self->array, _self, Arena_get(self->arena));
RB_OBJ_FREEZE(_self);
if (!RB_OBJ_FROZEN(_self)) {
Arena_Pin(self->arena, _self);
RB_OBJ_FREEZE(_self);
}
return _self;
}
@ -610,7 +611,7 @@ VALUE RepeatedField_init(int argc, VALUE* argv, VALUE _self) {
self->type_info = TypeInfo_FromClass(argc, argv, 0, &self->type_class, &ary);
self->array = upb_array_new(arena, self->type_info.type);
ObjectCache_Add(self->array, _self, arena);
ObjectCache_Add(self->array, _self);
if (ary != Qnil) {
if (!RB_TYPE_P(ary, T_ARRAY)) {

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "google-protobuf"
s.version = "3.14.0"
s.version = "3.15.3"
git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers"

View File

@ -31,6 +31,33 @@ module BasicTest
end
include CommonTests
def test_issue_8311_crash
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("inner.proto", :syntax => :proto3) do
add_message "Inner" do
# Removing either of these fixes the segfault.
optional :foo, :string, 1
optional :bar, :string, 2
end
end
end
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("outer.proto", :syntax => :proto3) do
add_message "Outer" do
repeated :inners, :message, 1, "Inner"
end
end
end
outer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Outer").msgclass
outer_proto = outer.new(
inners: []
)
outer_proto['inners'].to_s
end
def test_has_field
m = TestSingularFields.new
assert !m.has_singular_msg?

View File

@ -1701,6 +1701,12 @@ module CommonTests
m = proto_module::TimeMessage.new(duration: 1.1)
assert_equal Google::Protobuf::Duration.new(seconds: 1, nanos: 100_000_000), m.duration
m = proto_module::TimeMessage.new(duration: 123.321)
assert_equal Google::Protobuf::Duration.new(seconds: 123, nanos: 321_000_000), m.duration
m = proto_module::TimeMessage.new(duration: -123.321)
assert_equal Google::Protobuf::Duration.new(seconds: -123, nanos: -321_000_000), m.duration
assert_raise(Google::Protobuf::TypeError) { m.duration = '2' }
assert_raise(Google::Protobuf::TypeError) { m.duration = proto_module::TimeMessage.new }
end

View File

@ -193,4 +193,12 @@ class TestWellKnownTypes < Test::Unit::TestCase
assert_equal false, s['b'][:y]
assert_equal false, s[:b]['y']
end
def test_b8325
value_field = Google::Protobuf::ListValue.descriptor.lookup("values")
proto = Google::Protobuf::ListValue.new(
values: [Google::Protobuf::Value.new(string_value: "Hello")]
)
assert_equal '[<Google::Protobuf::Value: string_value: "Hello">]', value_field.get(proto).inspect
end
end

View File

@ -18,7 +18,7 @@ else
PTHREAD_DEF =
endif
PROTOBUF_VERSION = 25:0:0
PROTOBUF_VERSION = 26:2:0
if GCC
# Turn on all warnings except for sign comparison (we ignore sign comparison

View File

@ -30,7 +30,7 @@ struct AnyDefaultTypeInternal {
Any _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY AnyDefaultTypeInternal _Any_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AnyDefaultTypeInternal _Any_default_instance_;
PROTOBUF_NAMESPACE_CLOSE
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fany_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
@ -68,10 +68,8 @@ const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google
schemas, file_default_instances, TableStruct_google_2fprotobuf_2fany_2eproto::offsets,
file_level_metadata_google_2fprotobuf_2fany_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto, file_level_service_descriptors_google_2fprotobuf_2fany_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
descriptor_table_google_2fprotobuf_2fany_2eproto_metadata_getter(int index) {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fany_2eproto);
return descriptor_table_google_2fprotobuf_2fany_2eproto.file_level_metadata[index];
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fany_2eproto_getter() {
return &descriptor_table_google_2fprotobuf_2fany_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
@ -323,10 +321,11 @@ void Any::InternalSwap(Any* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata Any::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fany_2eproto_getter, &descriptor_table_google_2fprotobuf_2fany_2eproto_once,
file_level_metadata_google_2fprotobuf_2fany_2eproto[0]);
}
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN

View File

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3014000
#if PROTOBUF_VERSION < 3015000
#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 3014000 < PROTOBUF_MIN_PROTOC_VERSION
#if 3015002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -53,7 +53,6 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fany_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto;
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_google_2fprotobuf_2fany_2eproto_metadata_getter(int index);
PROTOBUF_NAMESPACE_OPEN
class Any;
struct AnyDefaultTypeInternal;
@ -96,10 +95,10 @@ class PROTOBUF_EXPORT Any PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const Any& default_instance() {
return *internal_default_instance();
@ -200,12 +199,6 @@ class PROTOBUF_EXPORT Any PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fany_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------
@ -218,10 +211,8 @@ class PROTOBUF_EXPORT Any PROTOBUF_FINAL :
// string type_url = 1;
void clear_type_url();
const std::string& type_url() const;
void set_type_url(const std::string& value);
void set_type_url(std::string&& value);
void set_type_url(const char* value);
void set_type_url(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_type_url(ArgT0&& arg0, ArgT... args);
std::string* mutable_type_url();
std::string* release_type_url();
void set_allocated_type_url(std::string* type_url);
@ -234,10 +225,8 @@ class PROTOBUF_EXPORT Any PROTOBUF_FINAL :
// bytes value = 2;
void clear_value();
const std::string& value() const;
void set_value(const std::string& value);
void set_value(std::string&& value);
void set_value(const char* value);
void set_value(const void* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_value();
std::string* release_value();
void set_allocated_value(std::string* value);
@ -279,8 +268,11 @@ inline const std::string& Any::type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Any.type_url)
return _internal_type_url();
}
inline void Any::set_type_url(const std::string& value) {
_internal_set_type_url(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Any::set_type_url(ArgT0&& arg0, ArgT... args) {
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
}
inline std::string* Any::mutable_type_url() {
@ -294,25 +286,6 @@ inline void Any::_internal_set_type_url(const std::string& value) {
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Any::set_type_url(std::string&& value) {
type_url_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.type_url)
}
inline void Any::set_type_url(const char* value) {
GOOGLE_DCHECK(value != nullptr);
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Any.type_url)
}
inline void Any::set_type_url(const char* value,
size_t size) {
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url)
}
inline std::string* Any::_internal_mutable_type_url() {
return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -340,8 +313,11 @@ inline const std::string& Any::value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Any.value)
return _internal_value();
}
inline void Any::set_value(const std::string& value) {
_internal_set_value(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Any::set_value(ArgT0&& arg0, ArgT... args) {
value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Any.value)
}
inline std::string* Any::mutable_value() {
@ -355,25 +331,6 @@ inline void Any::_internal_set_value(const std::string& value) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Any::set_value(std::string&& value) {
value_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.value)
}
inline void Any::set_value(const char* value) {
GOOGLE_DCHECK(value != nullptr);
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Any.value)
}
inline void Any::set_value(const void* value,
size_t size) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value)
}
inline std::string* Any::_internal_mutable_value() {
return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());

View File

@ -35,7 +35,7 @@ struct ApiDefaultTypeInternal {
Api _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY ApiDefaultTypeInternal _Api_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ApiDefaultTypeInternal _Api_default_instance_;
constexpr Method::Method(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: options_()
@ -54,7 +54,7 @@ struct MethodDefaultTypeInternal {
Method _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY MethodDefaultTypeInternal _Method_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MethodDefaultTypeInternal _Method_default_instance_;
constexpr Mixin::Mixin(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
@ -67,7 +67,7 @@ struct MixinDefaultTypeInternal {
Mixin _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY MixinDefaultTypeInternal _Mixin_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MixinDefaultTypeInternal _Mixin_default_instance_;
PROTOBUF_NAMESPACE_CLOSE
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fapi_2eproto[3];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr;
@ -150,10 +150,8 @@ const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google
schemas, file_default_instances, TableStruct_google_2fprotobuf_2fapi_2eproto::offsets,
file_level_metadata_google_2fprotobuf_2fapi_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto, file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
descriptor_table_google_2fprotobuf_2fapi_2eproto_metadata_getter(int index) {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fapi_2eproto);
return descriptor_table_google_2fprotobuf_2fapi_2eproto.file_level_metadata[index];
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fapi_2eproto_getter() {
return &descriptor_table_google_2fprotobuf_2fapi_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
@ -575,10 +573,11 @@ void Api::InternalSwap(Api* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata Api::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fapi_2eproto_getter, &descriptor_table_google_2fprotobuf_2fapi_2eproto_once,
file_level_metadata_google_2fprotobuf_2fapi_2eproto[0]);
}
// ===================================================================
class Method::_Internal {
@ -968,10 +967,11 @@ void Method::InternalSwap(Method* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata Method::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fapi_2eproto_getter, &descriptor_table_google_2fprotobuf_2fapi_2eproto_once,
file_level_metadata_google_2fprotobuf_2fapi_2eproto[1]);
}
// ===================================================================
class Mixin::_Internal {
@ -1206,10 +1206,11 @@ void Mixin::InternalSwap(Mixin* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata Mixin::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fapi_2eproto_getter, &descriptor_table_google_2fprotobuf_2fapi_2eproto_once,
file_level_metadata_google_2fprotobuf_2fapi_2eproto[2]);
}
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN

View File

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3014000
#if PROTOBUF_VERSION < 3015000
#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 3014000 < PROTOBUF_MIN_PROTOC_VERSION
#if 3015002 < 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.
@ -55,7 +55,6 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fapi_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto;
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_google_2fprotobuf_2fapi_2eproto_metadata_getter(int index);
PROTOBUF_NAMESPACE_OPEN
class Api;
struct ApiDefaultTypeInternal;
@ -106,10 +105,10 @@ class PROTOBUF_EXPORT Api PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const Api& default_instance() {
return *internal_default_instance();
@ -177,12 +176,6 @@ class PROTOBUF_EXPORT Api PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fapi_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------
@ -254,10 +247,8 @@ class PROTOBUF_EXPORT Api PROTOBUF_FINAL :
// string name = 1;
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
void set_name(std::string&& value);
void set_name(const char* value);
void set_name(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
@ -270,10 +261,8 @@ class PROTOBUF_EXPORT Api PROTOBUF_FINAL :
// string version = 4;
void clear_version();
const std::string& version() const;
void set_version(const std::string& value);
void set_version(std::string&& value);
void set_version(const char* value);
void set_version(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_version(ArgT0&& arg0, ArgT... args);
std::string* mutable_version();
std::string* release_version();
void set_allocated_version(std::string* version);
@ -359,10 +348,10 @@ class PROTOBUF_EXPORT Method PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const Method& default_instance() {
return *internal_default_instance();
@ -430,12 +419,6 @@ class PROTOBUF_EXPORT Method PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fapi_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------
@ -471,10 +454,8 @@ class PROTOBUF_EXPORT Method PROTOBUF_FINAL :
// string name = 1;
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
void set_name(std::string&& value);
void set_name(const char* value);
void set_name(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
@ -487,10 +468,8 @@ class PROTOBUF_EXPORT Method PROTOBUF_FINAL :
// string request_type_url = 2;
void clear_request_type_url();
const std::string& request_type_url() const;
void set_request_type_url(const std::string& value);
void set_request_type_url(std::string&& value);
void set_request_type_url(const char* value);
void set_request_type_url(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_request_type_url(ArgT0&& arg0, ArgT... args);
std::string* mutable_request_type_url();
std::string* release_request_type_url();
void set_allocated_request_type_url(std::string* request_type_url);
@ -503,10 +482,8 @@ class PROTOBUF_EXPORT Method PROTOBUF_FINAL :
// string response_type_url = 4;
void clear_response_type_url();
const std::string& response_type_url() const;
void set_response_type_url(const std::string& value);
void set_response_type_url(std::string&& value);
void set_response_type_url(const char* value);
void set_response_type_url(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_response_type_url(ArgT0&& arg0, ArgT... args);
std::string* mutable_response_type_url();
std::string* release_response_type_url();
void set_allocated_response_type_url(std::string* response_type_url);
@ -592,10 +569,10 @@ class PROTOBUF_EXPORT Mixin PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const Mixin& default_instance() {
return *internal_default_instance();
@ -663,12 +640,6 @@ class PROTOBUF_EXPORT Mixin PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fapi_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------
@ -681,10 +652,8 @@ class PROTOBUF_EXPORT Mixin PROTOBUF_FINAL :
// string name = 1;
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
void set_name(std::string&& value);
void set_name(const char* value);
void set_name(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
@ -697,10 +666,8 @@ class PROTOBUF_EXPORT Mixin PROTOBUF_FINAL :
// string root = 2;
void clear_root();
const std::string& root() const;
void set_root(const std::string& value);
void set_root(std::string&& value);
void set_root(const char* value);
void set_root(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_root(ArgT0&& arg0, ArgT... args);
std::string* mutable_root();
std::string* release_root();
void set_allocated_root(std::string* root);
@ -741,8 +708,11 @@ inline const std::string& Api::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.name)
return _internal_name();
}
inline void Api::set_name(const std::string& value) {
_internal_set_name(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Api::set_name(ArgT0&& arg0, ArgT... args) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Api.name)
}
inline std::string* Api::mutable_name() {
@ -756,25 +726,6 @@ inline void Api::_internal_set_name(const std::string& value) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Api::set_name(std::string&& value) {
name_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.name)
}
inline void Api::set_name(const char* value) {
GOOGLE_DCHECK(value != nullptr);
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Api.name)
}
inline void Api::set_name(const char* value,
size_t size) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.name)
}
inline std::string* Api::_internal_mutable_name() {
return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -877,8 +828,11 @@ inline const std::string& Api::version() const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.version)
return _internal_version();
}
inline void Api::set_version(const std::string& value) {
_internal_set_version(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Api::set_version(ArgT0&& arg0, ArgT... args) {
version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Api.version)
}
inline std::string* Api::mutable_version() {
@ -892,25 +846,6 @@ inline void Api::_internal_set_version(const std::string& value) {
version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Api::set_version(std::string&& value) {
version_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.version)
}
inline void Api::set_version(const char* value) {
GOOGLE_DCHECK(value != nullptr);
version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Api.version)
}
inline void Api::set_version(const char* value,
size_t size) {
version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.version)
}
inline std::string* Api::_internal_mutable_version() {
return version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1078,8 +1013,11 @@ inline const std::string& Method::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.name)
return _internal_name();
}
inline void Method::set_name(const std::string& value) {
_internal_set_name(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Method::set_name(ArgT0&& arg0, ArgT... args) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Method.name)
}
inline std::string* Method::mutable_name() {
@ -1093,25 +1031,6 @@ inline void Method::_internal_set_name(const std::string& value) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Method::set_name(std::string&& value) {
name_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.name)
}
inline void Method::set_name(const char* value) {
GOOGLE_DCHECK(value != nullptr);
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Method.name)
}
inline void Method::set_name(const char* value,
size_t size) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.name)
}
inline std::string* Method::_internal_mutable_name() {
return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1139,8 +1058,11 @@ inline const std::string& Method::request_type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url)
return _internal_request_type_url();
}
inline void Method::set_request_type_url(const std::string& value) {
_internal_set_request_type_url(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Method::set_request_type_url(ArgT0&& arg0, ArgT... args) {
request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url)
}
inline std::string* Method::mutable_request_type_url() {
@ -1154,25 +1076,6 @@ inline void Method::_internal_set_request_type_url(const std::string& value) {
request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Method::set_request_type_url(std::string&& value) {
request_type_url_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.request_type_url)
}
inline void Method::set_request_type_url(const char* value) {
GOOGLE_DCHECK(value != nullptr);
request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Method.request_type_url)
}
inline void Method::set_request_type_url(const char* value,
size_t size) {
request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.request_type_url)
}
inline std::string* Method::_internal_mutable_request_type_url() {
return request_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1220,8 +1123,11 @@ inline const std::string& Method::response_type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url)
return _internal_response_type_url();
}
inline void Method::set_response_type_url(const std::string& value) {
_internal_set_response_type_url(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Method::set_response_type_url(ArgT0&& arg0, ArgT... args) {
response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url)
}
inline std::string* Method::mutable_response_type_url() {
@ -1235,25 +1141,6 @@ inline void Method::_internal_set_response_type_url(const std::string& value) {
response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Method::set_response_type_url(std::string&& value) {
response_type_url_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.response_type_url)
}
inline void Method::set_response_type_url(const char* value) {
GOOGLE_DCHECK(value != nullptr);
response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Method.response_type_url)
}
inline void Method::set_response_type_url(const char* value,
size_t size) {
response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.response_type_url)
}
inline std::string* Method::_internal_mutable_response_type_url() {
return response_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1361,8 +1248,11 @@ inline const std::string& Mixin::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Mixin.name)
return _internal_name();
}
inline void Mixin::set_name(const std::string& value) {
_internal_set_name(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Mixin::set_name(ArgT0&& arg0, ArgT... args) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Mixin.name)
}
inline std::string* Mixin::mutable_name() {
@ -1376,25 +1266,6 @@ inline void Mixin::_internal_set_name(const std::string& value) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Mixin::set_name(std::string&& value) {
name_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.name)
}
inline void Mixin::set_name(const char* value) {
GOOGLE_DCHECK(value != nullptr);
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.name)
}
inline void Mixin::set_name(const char* value,
size_t size) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.name)
}
inline std::string* Mixin::_internal_mutable_name() {
return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1422,8 +1293,11 @@ inline const std::string& Mixin::root() const {
// @@protoc_insertion_point(field_get:google.protobuf.Mixin.root)
return _internal_root();
}
inline void Mixin::set_root(const std::string& value) {
_internal_set_root(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Mixin::set_root(ArgT0&& arg0, ArgT... args) {
root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.Mixin.root)
}
inline std::string* Mixin::mutable_root() {
@ -1437,25 +1311,6 @@ inline void Mixin::_internal_set_root(const std::string& value) {
root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Mixin::set_root(std::string&& value) {
root_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.root)
}
inline void Mixin::set_root(const char* value) {
GOOGLE_DCHECK(value != nullptr);
root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.root)
}
inline void Mixin::set_root(const char* value,
size_t size) {
root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.root)
}
inline std::string* Mixin::_internal_mutable_root() {
return root_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());

View File

@ -327,7 +327,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
template <typename T>
PROTOBUF_NDEBUG_INLINE static T* CreateArray(Arena* arena,
size_t num_elements) {
static_assert(std::is_trivially_default_constructible<T>::value,
static_assert(std::is_trivial<T>::value,
"CreateArray requires a trivially constructible type");
static_assert(std::is_trivially_destructible<T>::value,
"CreateArray requires a trivially destructible type");

View File

@ -193,6 +193,34 @@ struct PROTOBUF_EXPORT ArenaStringPtr {
void Set(EmptyDefault, std::string&& value, ::google::protobuf::Arena* arena);
void Set(NonEmptyDefault, ConstStringParam value, ::google::protobuf::Arena* arena);
void Set(NonEmptyDefault, std::string&& value, ::google::protobuf::Arena* arena);
template <typename FirstParam>
void Set(FirstParam p1, const char* str, ::google::protobuf::Arena* arena) {
Set(p1, ConstStringParam(str), arena);
}
template <typename FirstParam>
void Set(FirstParam p1, const char* str, size_t size,
::google::protobuf::Arena* arena) {
ConstStringParam sp{str, size}; // for string_view and `const string &`
Set(p1, sp, arena);
}
template <typename FirstParam, typename RefWrappedType>
void Set(FirstParam p1,
std::reference_wrapper<RefWrappedType> const_string_ref,
::google::protobuf::Arena* arena) {
Set(p1, const_string_ref.get(), arena);
}
template <typename FirstParam, typename SecondParam>
void SetBytes(FirstParam p1, SecondParam&& p2, ::google::protobuf::Arena* arena) {
Set(p1, static_cast<SecondParam&&>(p2), arena);
}
template <typename FirstParam>
void SetBytes(FirstParam p1, const void* str, size_t size,
::google::protobuf::Arena* arena) {
// must work whether ConstStringParam is string_view or `const string &`
ConstStringParam sp{static_cast<const char*>(str), size};
Set(p1, sp, arena);
}
// Basic accessors.
const std::string& Get() const PROTOBUF_NDEBUG_INLINE {

View File

@ -1036,16 +1036,6 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
}
for (auto fd : parsed_files) {
if (!AllowProto3Optional(*fd) && ContainsProto3Optional(fd)) {
std::cerr << fd->name()
<< ": This file contains proto3 optional fields, but "
"--experimental_allow_proto3_optional was not set."
<< std::endl;
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.
@ -1214,13 +1204,6 @@ PopulateSingleSimpleDescriptorDatabase(const std::string& descriptor_set_name) {
} // namespace
bool CommandLineInterface::AllowProto3Optional(
const FileDescriptor& file) const {
// Proto3 optional is enabled by default now, the experimental flag is no
// longer required.
return true;
}
bool CommandLineInterface::VerifyInputFilesInDescriptors(
DescriptorDatabase* database) {
@ -1337,7 +1320,6 @@ void CommandLineInterface::Clear() {
source_info_in_descriptor_set_ = false;
disallow_services_ = false;
direct_dependencies_explicitly_set_ = false;
allow_proto3_optional_ = false;
deterministic_output_ = false;
}
@ -1857,8 +1839,7 @@ CommandLineInterface::InterpretArgument(const std::string& name,
} else if (name == "--experimental_allow_proto3_optional") {
allow_proto3_optional_ = true;
// Flag is no longer observed, but we allow it for backward compat.
} else if (name == "--encode" || name == "--decode" ||
name == "--decode_raw") {
if (mode_ != MODE_COMPILE) {

View File

@ -226,11 +226,6 @@ class PROTOC_EXPORT CommandLineInterface {
bool MakeInputsBeProtoPathRelative(DiskSourceTree* source_tree,
DescriptorDatabase* fallback_database);
// Is this .proto file whitelisted, or do we have a command-line flag allowing
// us to use proto3 optional? This is a temporary control to avoid people from
// using proto3 optional until code generators have implemented it.
bool AllowProto3Optional(const FileDescriptor& file) const;
// Fails if these files use proto3 optional and the code generator doesn't
// support it. This is a permanent check.
bool EnforceProto3OptionalSupport(
@ -448,9 +443,6 @@ class PROTOC_EXPORT CommandLineInterface {
// Was the --disallow_services flag used?
bool disallow_services_ = false;
// Was the --experimental_allow_proto3_optional flag used?
bool allow_proto3_optional_ = false;
// When using --encode, this will be passed to SetSerializationDeterministic.
bool deterministic_output_ = false;

View File

@ -2378,7 +2378,6 @@ TEST_F(CommandLineInterfaceTest, MissingValueAtEndError) {
ExpectErrorText("Missing value for flag: --test_out\n");
}
TEST_F(CommandLineInterfaceTest, Proto3OptionalDisallowedNoCodegenSupport) {
CreateTempFile("google/foo.proto",
"syntax = \"proto3\";\n"

View File

@ -454,7 +454,7 @@ void FileGenerator::GenerateSourceDefaultInstance(int idx,
// enough. However, the empty destructor fails to be elided in some
// configurations (like non-opt or with certain sanitizers). NO_DESTROY is
// there just to improve performance and binary size in these builds.
format("PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY $1$ $2$;\n",
format("PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT $1$ $2$;\n",
DefaultInstanceType(generator->descriptor_, options_),
DefaultInstanceName(generator->descriptor_, options_));
@ -694,10 +694,6 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
if (!message_generators_.empty()) {
format("static ::$proto_ns$::Metadata $file_level_metadata$[$1$];\n",
message_generators_.size());
} else {
format(
"static "
"constexpr ::$proto_ns$::Metadata* $file_level_metadata$ = nullptr;\n");
}
if (!enum_generators_.empty()) {
format(
@ -855,24 +851,30 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
" false, $1$, $2$, $3$, \"$filename$\", \n"
" &$desc_table$_once, $4$, $5$, $6$,\n"
" schemas, file_default_instances, $tablename$::offsets,\n"
" $file_level_metadata$, $file_level_enum_descriptors$, "
" $7$, $file_level_enum_descriptors$, "
"$file_level_service_descriptors$,\n"
"};\n"
// This function exists to be marked as weak.
// It can significantly speed up compilation by breaking up the SCC.
// It can significantly speed up compilation by breaking up LLVM's SCC in
// the .pb.cc tranlation units. Large translation units see a reduction of
// more than 35% of walltime for optimized builds.
// Without the weak attribute all the messages in the file, including all
// the vtables and everything they use become part of the same SCC.
// the vtables and everything they use become part of the same SCC through
// a cycle like:
// GetMetadata -> descriptor table -> default instances ->
// vtables -> GetMetadata
// By adding a weak function here we break the connection from the
// individual vtables back into the descriptor table.
"PROTOBUF_ATTRIBUTE_WEAK ::$proto_ns$::Metadata\n"
"$desc_table$_metadata_getter(int index) {\n"
" ::$proto_ns$::internal::AssignDescriptors(&$desc_table$);\n"
" return $desc_table$.file_level_metadata[index];\n"
"PROTOBUF_ATTRIBUTE_WEAK const ::$proto_ns$::internal::DescriptorTable* "
"$desc_table$_getter() {\n"
" return &$desc_table$;\n"
"}\n"
"\n",
eager ? "true" : "false", file_data.size(), protodef_name,
num_deps == 0 ? "nullptr" : variables_["desc_table"] + "_deps", num_deps,
message_generators_.size());
message_generators_.size(),
message_generators_.empty() ? "nullptr"
: variables_["file_level_metadata"]);
// For descriptor.proto we want to avoid doing any dynamic initialization,
// because in some situations that would otherwise pull in a lot of
@ -1288,9 +1290,7 @@ void FileGenerator::GenerateGlobalStateFunctionDeclarations(
if (HasDescriptorMethods(file_, options_)) {
format(
"extern $dllexport_decl $const ::$proto_ns$::internal::DescriptorTable "
"$desc_table$;\n"
"$dllexport_decl $::$proto_ns$::Metadata "
"$desc_table$_metadata_getter(int index);\n");
"$desc_table$;\n");
}
}

View File

@ -1076,19 +1076,9 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
if (HasDescriptorMethods(descriptor_->file(), options_)) {
format(
" void MergeFrom(const ::$proto_ns$::Message& other) final;\n"
" ::$proto_ns$::Metadata GetMetadata() const final;\n"
" private:\n"
" static ::$proto_ns$::Metadata GetMetadataStatic() {\n"
" ::$proto_ns$::internal::AssignDescriptors(&::$desc_table$);\n"
" return ::$desc_table$.file_level_metadata[$1$];\n"
" }\n"
"\n"
" public:\n"
"};\n",
index_in_file_messages_);
} else {
format("};\n");
" ::$proto_ns$::Metadata GetMetadata() const final;\n");
}
format("};\n");
return;
}
@ -1168,10 +1158,10 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
// separately.
format(
"static const ::$proto_ns$::Descriptor* GetDescriptor() {\n"
" return GetMetadataStatic().descriptor;\n"
" return default_instance().GetMetadata().descriptor;\n"
"}\n"
"static const ::$proto_ns$::Reflection* GetReflection() {\n"
" return GetMetadataStatic().reflection;\n"
" return default_instance().GetMetadata().reflection;\n"
"}\n");
}
@ -1380,12 +1370,6 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
if (HasDescriptorMethods(descriptor_->file(), options_)) {
format(
"::$proto_ns$::Metadata GetMetadata() const final;\n"
"private:\n"
"static ::$proto_ns$::Metadata GetMetadataStatic() {\n"
" return ::$desc_table$_metadata_getter(kIndexInFileMessages);\n"
"}\n"
"\n"
"public:\n"
"\n");
} else {
format(
@ -1889,8 +1873,11 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) {
if (HasDescriptorMethods(descriptor_->file(), options_)) {
format(
"::$proto_ns$::Metadata $classname$::GetMetadata() const {\n"
" return GetMetadataStatic();\n"
"}\n");
" return ::$proto_ns$::internal::AssignDescriptors(\n"
" &$desc_table$_getter, &$desc_table$_once,\n"
" $file_level_metadata$[$1$]);\n"
"}\n",
index_in_file_messages_);
format(
"void $classname$::MergeFrom(\n"
" const ::$proto_ns$::Message& other) {\n"
@ -2029,9 +2016,11 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) {
if (HasDescriptorMethods(descriptor_->file(), options_)) {
format(
"::$proto_ns$::Metadata $classname$::GetMetadata() const {\n"
" return GetMetadataStatic();\n"
"}\n"
"\n");
" return ::$proto_ns$::internal::AssignDescriptors(\n"
" &$desc_table$_getter, &$desc_table$_once,\n"
" $file_level_metadata$[$1$]);\n"
"}\n",
index_in_file_messages_);
} else {
format(
"std::string $classname$::GetTypeName() const {\n"

View File

@ -80,13 +80,9 @@ class TestGenerator : public CodeGenerator {
// Check field accessors for a required string:
TryInsert("test.pb.h", "field_get:foo.Bar.requiredString", context);
TryInsert("test.pb.h", "field_set:foo.Bar.requiredString", context);
TryInsert("test.pb.h", "field_set_char:foo.Bar.requiredString", context);
TryInsert("test.pb.h", "field_set_pointer:foo.Bar.requiredString", context);
TryInsert("test.pb.h", "field_mutable:foo.Bar.requiredString", context);
TryInsert("test.pb.h", "field_set_allocated:foo.Bar.requiredString",
context);
TryInsert("test.pb.h", "field_set_char:foo.Bar.requiredString", context);
TryInsert("test.pb.h", "field_set_pointer:foo.Bar.requiredString", context);
// Check field accessors for a repeated string:
TryInsert("test.pb.h", "field_get:foo.Bar.repeatedString", context);
@ -104,12 +100,8 @@ class TestGenerator : public CodeGenerator {
// Check field accessors for a string inside oneof{}:
TryInsert("test.pb.h", "field_get:foo.Bar.oneOfString", context);
TryInsert("test.pb.h", "field_set:foo.Bar.oneOfString", context);
TryInsert("test.pb.h", "field_set_char:foo.Bar.oneOfString", context);
TryInsert("test.pb.h", "field_set_pointer:foo.Bar.oneOfString", context);
TryInsert("test.pb.h", "field_mutable:foo.Bar.oneOfString", context);
TryInsert("test.pb.h", "field_set_allocated:foo.Bar.oneOfString", context);
TryInsert("test.pb.h", "field_set_char:foo.Bar.oneOfString", context);
TryInsert("test.pb.h", "field_set_pointer:foo.Bar.oneOfString", context);
// Check field accessors for an optional message:
TryInsert("test.pb.h", "field_get:foo.Bar.optMessage", context);

View File

@ -82,6 +82,8 @@ void SetStringVariables(const FieldDescriptor* descriptor,
: "lazy_variable"];
(*variables)["pointer_type"] =
descriptor->type() == FieldDescriptor::TYPE_BYTES ? "void" : "char";
(*variables)["setter"] =
descriptor->type() == FieldDescriptor::TYPE_BYTES ? "SetBytes" : "Set";
(*variables)["null_check"] = (*variables)["DCHK"] + "(value != nullptr);\n";
// NOTE: Escaped here to unblock proto1->proto2 migration.
// TODO(liujisi): Extend this to apply for other conflicting methods.
@ -155,19 +157,10 @@ void StringFieldGenerator::GenerateAccessorDeclarations(
format(
"$deprecated_attr$const std::string& ${1$$name$$}$() const;\n"
"$deprecated_attr$void ${1$set_$name$$}$(const std::string& value);\n"
"$deprecated_attr$void ${1$set_$name$$}$(std::string&& value);\n"
"$deprecated_attr$void ${1$set_$name$$}$(const char* value);\n",
"template <typename ArgT0 = const std::string&, typename... ArgT>\n"
"$deprecated_attr$void ${1$set_$name$$}$(ArgT0&& arg0, ArgT... args);\n",
descriptor_);
if (!options_.opensource_runtime) {
format(
"$deprecated_attr$void ${1$set_$name$$}$(::StringPiece value);\n",
descriptor_);
}
format(
"$deprecated_attr$void ${1$set_$name$$}$(const $pointer_type$* "
"value, size_t size)"
";\n"
"$deprecated_attr$std::string* ${1$mutable_$name$$}$();\n"
"$deprecated_attr$std::string* ${1$$release_name$$}$();\n"
"$deprecated_attr$void ${1$set_allocated_$name$$}$(std::string* "
@ -202,9 +195,13 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions(
format(
" return _internal_$name$();\n"
"}\n"
"inline void $classname$::set_$name$(const std::string& value) {\n"
"template <typename ArgT0, typename... ArgT>\n"
"PROTOBUF_ALWAYS_INLINE\n"
"inline void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n"
"$annotate_accessor$"
" _internal_set_$name$(value);\n"
" $set_hasbit$\n"
" $name$_.$setter$($default_value_tag$, static_cast<ArgT0 &&>(arg0),"
" args..., GetArena());\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline std::string* $classname$::mutable_$name$() {\n"
@ -219,40 +216,8 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions(
"value) {\n"
" $set_hasbit$\n"
" $name$_.Set($default_value_tag$, value, GetArena());\n"
"}\n"
"inline void $classname$::set_$name$(std::string&& value) {\n"
"$annotate_accessor$"
" $set_hasbit$\n"
" $name$_.Set(\n"
" $default_value_tag$, ::std::move(value), GetArena());\n"
" // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n"
"}\n"
"inline void $classname$::set_$name$(const char* value) {\n"
"$annotate_accessor$"
" $null_check$"
" $set_hasbit$\n"
" $name$_.Set($default_value_tag$, $string_piece$(value), GetArena());\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n");
if (!options_.opensource_runtime) {
format(
"inline void $classname$::set_$name$(::StringPiece value) {\n"
"$annotate_accessor$"
" $set_hasbit$\n"
" $name$_.Set($default_value_tag$, value,GetArena());\n"
" // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n"
"}\n");
}
format(
"inline "
"void $classname$::set_$name$(const $pointer_type$* value,\n"
" size_t size) {\n"
"$annotate_accessor$"
" $set_hasbit$\n"
" $name$_.Set($default_value_tag$, $string_piece$(\n"
" reinterpret_cast<const char*>(value), size), GetArena());\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
"inline std::string* $classname$::_internal_mutable_$name$() {\n"
" $set_hasbit$\n"
" return $name$_.Mutable($default_variable_or_tag$, GetArena());\n"
@ -431,9 +396,16 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions(
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return _internal_$name$();\n"
"}\n"
"inline void $classname$::set_$name$(const std::string& value) {\n"
"template <typename ArgT0, typename... ArgT>\n"
"inline void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n"
"$annotate_accessor$"
" _internal_set_$name$(value);\n"
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
" $field_member$.$setter$($default_value_tag$,"
" static_cast<ArgT0 &&>(arg0), args..., GetArena());\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline std::string* $classname$::mutable_$name$() {\n"
@ -455,60 +427,8 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions(
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
" $field_member$.Set($default_value_tag$, value, GetArena());\n"
"}\n"
"inline void $classname$::set_$name$(std::string&& value) {\n"
"$annotate_accessor$"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
" $field_member$.Set(\n"
" $default_value_tag$, ::std::move(value), GetArena());\n"
" // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n"
"}\n"
"inline void $classname$::set_$name$(const char* value) {\n"
"$annotate_accessor$"
" $null_check$"
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
" $field_member$.Set($default_value_tag$,\n"
" $string_piece$(value), GetArena());\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n");
if (!options_.opensource_runtime) {
format(
"inline void $classname$::set_$name$(::StringPiece value) {\n"
"$annotate_accessor$"
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
" $field_member$.Set($default_value_tag$, value, GetArena());\n"
" // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n"
"}\n");
}
format(
"inline "
"void $classname$::set_$name$(const $pointer_type$* value,\n"
" size_t size) {\n"
"$annotate_accessor$"
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
" $field_member$.Set(\n"
" $default_value_tag$, $string_piece$(\n"
" reinterpret_cast<const char*>(value), size),\n"
" GetArena());\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
"inline std::string* $classname$::_internal_mutable_$name$() {\n"
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"

View File

@ -108,6 +108,7 @@ void Context::InitializeFieldGeneratorInfoForMessage(
InitializeFieldGeneratorInfoForMessage(message->nested_type(i));
}
std::vector<const FieldDescriptor*> fields;
fields.reserve(message->field_count());
for (int i = 0; i < message->field_count(); ++i) {
fields.push_back(message->field(i));
}

View File

@ -95,9 +95,13 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex,
// We use `x.getClass()` as a null check because it generates less bytecode
// than an `if (x == null) { throw ... }` statement.
(*variables)["key_null_check"] =
IsReferenceType(keyJavaType) ? "key.getClass();" : "";
IsReferenceType(keyJavaType)
? "java.lang.Class<?> keyClass = key.getClass();"
: "";
(*variables)["value_null_check"] =
IsReferenceType(valueJavaType) ? "value.getClass();" : "";
IsReferenceType(valueJavaType)
? "java.lang.Class<?> valueClass = value.getClass();"
: "";
if (GetJavaType(value) == JAVATYPE_ENUM) {
// We store enums as Integers internally.

View File

@ -571,6 +571,7 @@ void ImmutableMessageGenerator::GenerateMessageSerializationMethods(
SortFieldsByNumber(descriptor_));
std::vector<const Descriptor::ExtensionRange*> sorted_extensions;
sorted_extensions.reserve(descriptor_->extension_range_count());
for (int i = 0; i < descriptor_->extension_range_count(); ++i) {
sorted_extensions.push_back(descriptor_->extension_range(i));
}

View File

@ -127,7 +127,8 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor,
if (IsReferenceType(javaType)) {
// We use `x.getClass()` as a null check because it generates less bytecode
// than an `if (x == null) { throw ... }` statement.
(*variables)["null_check"] = " value.getClass();\n";
(*variables)["null_check"] =
" java.lang.Class<?> valueClass = value.getClass();\n";
} else {
(*variables)["null_check"] = "";
}

View File

@ -77,7 +77,8 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor,
WireFormat::TagSize(descriptor->number(), GetType(descriptor)));
// We use `x.getClass()` as a null check because it generates less bytecode
// than an `if (x == null) { throw ... }` statement.
(*variables)["null_check"] = " value.getClass();\n";
(*variables)["null_check"] =
" java.lang.Class<?> valueClass = value.getClass();\n";
// TODO(birdo): Add @deprecated javadoc when generating javadoc is supported
// by the proto compiler

View File

@ -1628,7 +1628,7 @@ void Generator::GenerateHeader(const GeneratorOptions& options,
" * @fileoverview\n"
" * @enhanceable\n"
// TODO(b/152440355): requireType/requires diverged from internal version.
" * @suppress {missingRequire} reports error on implict type usages.\n"
" * @suppress {missingRequire} reports error on implicit type usages.\n"
" * @suppress {messageConventions} JS Compiler reports an "
"error if a variable or\n"
" * field starts with 'MSG_' and isn't a translatable "

View File

@ -32,7 +32,7 @@ struct VersionDefaultTypeInternal {
Version _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY VersionDefaultTypeInternal _Version_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT VersionDefaultTypeInternal _Version_default_instance_;
constexpr CodeGeneratorRequest::CodeGeneratorRequest(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: file_to_generate_()
@ -47,7 +47,7 @@ struct CodeGeneratorRequestDefaultTypeInternal {
CodeGeneratorRequest _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY CodeGeneratorRequestDefaultTypeInternal _CodeGeneratorRequest_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT CodeGeneratorRequestDefaultTypeInternal _CodeGeneratorRequest_default_instance_;
constexpr CodeGeneratorResponse_File::CodeGeneratorResponse_File(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
@ -62,7 +62,7 @@ struct CodeGeneratorResponse_FileDefaultTypeInternal {
CodeGeneratorResponse_File _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY CodeGeneratorResponse_FileDefaultTypeInternal _CodeGeneratorResponse_File_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT CodeGeneratorResponse_FileDefaultTypeInternal _CodeGeneratorResponse_File_default_instance_;
constexpr CodeGeneratorResponse::CodeGeneratorResponse(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: file_()
@ -76,7 +76,7 @@ struct CodeGeneratorResponseDefaultTypeInternal {
CodeGeneratorResponse _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY CodeGeneratorResponseDefaultTypeInternal _CodeGeneratorResponse_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT CodeGeneratorResponseDefaultTypeInternal _CodeGeneratorResponse_default_instance_;
} // namespace compiler
PROTOBUF_NAMESPACE_CLOSE
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[4];
@ -181,10 +181,8 @@ const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google
schemas, file_default_instances, TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets,
file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto, file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_metadata_getter(int index) {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto);
return descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto.file_level_metadata[index];
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter() {
return &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
@ -530,10 +528,11 @@ void Version::InternalSwap(Version* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata Version::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once,
file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[0]);
}
// ===================================================================
class CodeGeneratorRequest::_Internal {
@ -873,10 +872,11 @@ void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorRequest::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once,
file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1]);
}
// ===================================================================
class CodeGeneratorResponse_File::_Internal {
@ -1235,10 +1235,11 @@ void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other)
}
::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorResponse_File::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once,
file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[2]);
}
// ===================================================================
class CodeGeneratorResponse::_Internal {
@ -1520,10 +1521,11 @@ void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorResponse::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once,
file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[3]);
}
// @@protoc_insertion_point(namespace_scope)
} // namespace compiler
PROTOBUF_NAMESPACE_CLOSE

View File

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3014000
#if PROTOBUF_VERSION < 3015000
#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 3014000 < PROTOBUF_MIN_PROTOC_VERSION
#if 3015002 < 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.
@ -61,7 +61,6 @@ struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOC_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_metadata_getter(int index);
PROTOBUF_NAMESPACE_OPEN
namespace compiler {
class CodeGeneratorRequest;
@ -149,10 +148,10 @@ class PROTOC_EXPORT Version PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const Version& default_instance() {
return *internal_default_instance();
@ -220,12 +219,6 @@ class PROTOC_EXPORT Version PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------
@ -244,10 +237,8 @@ class PROTOC_EXPORT Version PROTOBUF_FINAL :
public:
void clear_suffix();
const std::string& suffix() const;
void set_suffix(const std::string& value);
void set_suffix(std::string&& value);
void set_suffix(const char* value);
void set_suffix(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_suffix(ArgT0&& arg0, ArgT... args);
std::string* mutable_suffix();
std::string* release_suffix();
void set_allocated_suffix(std::string* suffix);
@ -350,10 +341,10 @@ class PROTOC_EXPORT CodeGeneratorRequest PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const CodeGeneratorRequest& default_instance() {
return *internal_default_instance();
@ -421,12 +412,6 @@ class PROTOC_EXPORT CodeGeneratorRequest PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------
@ -487,10 +472,8 @@ class PROTOC_EXPORT CodeGeneratorRequest PROTOBUF_FINAL :
public:
void clear_parameter();
const std::string& parameter() const;
void set_parameter(const std::string& value);
void set_parameter(std::string&& value);
void set_parameter(const char* value);
void set_parameter(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_parameter(ArgT0&& arg0, ArgT... args);
std::string* mutable_parameter();
std::string* release_parameter();
void set_allocated_parameter(std::string* parameter);
@ -572,10 +555,10 @@ class PROTOC_EXPORT CodeGeneratorResponse_File PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const CodeGeneratorResponse_File& default_instance() {
return *internal_default_instance();
@ -643,12 +626,6 @@ class PROTOC_EXPORT CodeGeneratorResponse_File PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------
@ -667,10 +644,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File PROTOBUF_FINAL :
public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
void set_name(std::string&& value);
void set_name(const char* value);
void set_name(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
@ -687,10 +662,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File PROTOBUF_FINAL :
public:
void clear_insertion_point();
const std::string& insertion_point() const;
void set_insertion_point(const std::string& value);
void set_insertion_point(std::string&& value);
void set_insertion_point(const char* value);
void set_insertion_point(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_insertion_point(ArgT0&& arg0, ArgT... args);
std::string* mutable_insertion_point();
std::string* release_insertion_point();
void set_allocated_insertion_point(std::string* insertion_point);
@ -707,10 +680,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File PROTOBUF_FINAL :
public:
void clear_content();
const std::string& content() const;
void set_content(const std::string& value);
void set_content(std::string&& value);
void set_content(const char* value);
void set_content(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_content(ArgT0&& arg0, ArgT... args);
std::string* mutable_content();
std::string* release_content();
void set_allocated_content(std::string* content);
@ -792,10 +763,10 @@ class PROTOC_EXPORT CodeGeneratorResponse PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const CodeGeneratorResponse& default_instance() {
return *internal_default_instance();
@ -863,12 +834,6 @@ class PROTOC_EXPORT CodeGeneratorResponse PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------
@ -936,10 +901,8 @@ class PROTOC_EXPORT CodeGeneratorResponse PROTOBUF_FINAL :
public:
void clear_error();
const std::string& error() const;
void set_error(const std::string& value);
void set_error(std::string&& value);
void set_error(const char* value);
void set_error(const char* value, size_t size);
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_error(ArgT0&& arg0, ArgT... args);
std::string* mutable_error();
std::string* release_error();
void set_allocated_error(std::string* error);
@ -1087,8 +1050,11 @@ inline const std::string& Version::suffix() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.suffix)
return _internal_suffix();
}
inline void Version::set_suffix(const std::string& value) {
_internal_set_suffix(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void Version::set_suffix(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix)
}
inline std::string* Version::mutable_suffix() {
@ -1102,25 +1068,6 @@ inline void Version::_internal_set_suffix(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void Version::set_suffix(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
suffix_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.Version.suffix)
}
inline void Version::set_suffix(const char* value) {
GOOGLE_DCHECK(value != nullptr);
_has_bits_[0] |= 0x00000001u;
suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.compiler.Version.suffix)
}
inline void Version::set_suffix(const char* value,
size_t size) {
_has_bits_[0] |= 0x00000001u;
suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.Version.suffix)
}
inline std::string* Version::_internal_mutable_suffix() {
_has_bits_[0] |= 0x00000001u;
return suffix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1238,8 +1185,11 @@ inline const std::string& CodeGeneratorRequest::parameter() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.parameter)
return _internal_parameter();
}
inline void CodeGeneratorRequest::set_parameter(const std::string& value) {
_internal_set_parameter(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void CodeGeneratorRequest::set_parameter(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
inline std::string* CodeGeneratorRequest::mutable_parameter() {
@ -1253,25 +1203,6 @@ inline void CodeGeneratorRequest::_internal_set_parameter(const std::string& val
_has_bits_[0] |= 0x00000001u;
parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void CodeGeneratorRequest::set_parameter(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
parameter_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
inline void CodeGeneratorRequest::set_parameter(const char* value) {
GOOGLE_DCHECK(value != nullptr);
_has_bits_[0] |= 0x00000001u;
parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
inline void CodeGeneratorRequest::set_parameter(const char* value,
size_t size) {
_has_bits_[0] |= 0x00000001u;
parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() {
_has_bits_[0] |= 0x00000001u;
return parameter_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1434,8 +1365,11 @@ inline const std::string& CodeGeneratorResponse_File::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.name)
return _internal_name();
}
inline void CodeGeneratorResponse_File::set_name(const std::string& value) {
_internal_set_name(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void CodeGeneratorResponse_File::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
inline std::string* CodeGeneratorResponse_File::mutable_name() {
@ -1449,25 +1383,6 @@ inline void CodeGeneratorResponse_File::_internal_set_name(const std::string& va
_has_bits_[0] |= 0x00000001u;
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void CodeGeneratorResponse_File::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
inline void CodeGeneratorResponse_File::set_name(const char* value) {
GOOGLE_DCHECK(value != nullptr);
_has_bits_[0] |= 0x00000001u;
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
inline void CodeGeneratorResponse_File::set_name(const char* value,
size_t size) {
_has_bits_[0] |= 0x00000001u;
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1507,8 +1422,11 @@ inline const std::string& CodeGeneratorResponse_File::insertion_point() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
return _internal_insertion_point();
}
inline void CodeGeneratorResponse_File::set_insertion_point(const std::string& value) {
_internal_set_insertion_point(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void CodeGeneratorResponse_File::set_insertion_point(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
inline std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
@ -1522,25 +1440,6 @@ inline void CodeGeneratorResponse_File::_internal_set_insertion_point(const std:
_has_bits_[0] |= 0x00000002u;
insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void CodeGeneratorResponse_File::set_insertion_point(std::string&& value) {
_has_bits_[0] |= 0x00000002u;
insertion_point_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
inline void CodeGeneratorResponse_File::set_insertion_point(const char* value) {
GOOGLE_DCHECK(value != nullptr);
_has_bits_[0] |= 0x00000002u;
insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
inline void CodeGeneratorResponse_File::set_insertion_point(const char* value,
size_t size) {
_has_bits_[0] |= 0x00000002u;
insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_point() {
_has_bits_[0] |= 0x00000002u;
return insertion_point_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1580,8 +1479,11 @@ inline const std::string& CodeGeneratorResponse_File::content() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.content)
return _internal_content();
}
inline void CodeGeneratorResponse_File::set_content(const std::string& value) {
_internal_set_content(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void CodeGeneratorResponse_File::set_content(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
inline std::string* CodeGeneratorResponse_File::mutable_content() {
@ -1595,25 +1497,6 @@ inline void CodeGeneratorResponse_File::_internal_set_content(const std::string&
_has_bits_[0] |= 0x00000004u;
content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void CodeGeneratorResponse_File::set_content(std::string&& value) {
_has_bits_[0] |= 0x00000004u;
content_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
inline void CodeGeneratorResponse_File::set_content(const char* value) {
GOOGLE_DCHECK(value != nullptr);
_has_bits_[0] |= 0x00000004u;
content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
inline void CodeGeneratorResponse_File::set_content(const char* value,
size_t size) {
_has_bits_[0] |= 0x00000004u;
content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() {
_has_bits_[0] |= 0x00000004u;
return content_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
@ -1736,8 +1619,11 @@ inline const std::string& CodeGeneratorResponse::error() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.error)
return _internal_error();
}
inline void CodeGeneratorResponse::set_error(const std::string& value) {
_internal_set_error(value);
template <typename ArgT0, typename... ArgT>
PROTOBUF_ALWAYS_INLINE
inline void CodeGeneratorResponse::set_error(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error)
}
inline std::string* CodeGeneratorResponse::mutable_error() {
@ -1751,25 +1637,6 @@ inline void CodeGeneratorResponse::_internal_set_error(const std::string& value)
_has_bits_[0] |= 0x00000001u;
error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
}
inline void CodeGeneratorResponse::set_error(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
error_.Set(
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.error)
}
inline void CodeGeneratorResponse::set_error(const char* value) {
GOOGLE_DCHECK(value != nullptr);
_has_bits_[0] |= 0x00000001u;
error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena());
// @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.error)
}
inline void CodeGeneratorResponse::set_error(const char* value,
size_t size) {
_has_bits_[0] |= 0x00000001u;
error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.error)
}
inline std::string* CodeGeneratorResponse::_internal_mutable_error() {
_has_bits_[0] |= 0x00000001u;
return error_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());

View File

@ -28,7 +28,7 @@ struct FileDescriptorSetDefaultTypeInternal {
FileDescriptorSet _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY FileDescriptorSetDefaultTypeInternal _FileDescriptorSet_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FileDescriptorSetDefaultTypeInternal _FileDescriptorSet_default_instance_;
constexpr FileDescriptorProto::FileDescriptorProto(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: dependency_()
@ -51,7 +51,7 @@ struct FileDescriptorProtoDefaultTypeInternal {
FileDescriptorProto _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY FileDescriptorProtoDefaultTypeInternal _FileDescriptorProto_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FileDescriptorProtoDefaultTypeInternal _FileDescriptorProto_default_instance_;
constexpr DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: options_(nullptr)
@ -65,7 +65,7 @@ struct DescriptorProto_ExtensionRangeDefaultTypeInternal {
DescriptorProto_ExtensionRange _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY DescriptorProto_ExtensionRangeDefaultTypeInternal _DescriptorProto_ExtensionRange_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DescriptorProto_ExtensionRangeDefaultTypeInternal _DescriptorProto_ExtensionRange_default_instance_;
constexpr DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: start_(0)
@ -78,7 +78,7 @@ struct DescriptorProto_ReservedRangeDefaultTypeInternal {
DescriptorProto_ReservedRange _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY DescriptorProto_ReservedRangeDefaultTypeInternal _DescriptorProto_ReservedRange_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DescriptorProto_ReservedRangeDefaultTypeInternal _DescriptorProto_ReservedRange_default_instance_;
constexpr DescriptorProto::DescriptorProto(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: field_()
@ -99,7 +99,7 @@ struct DescriptorProtoDefaultTypeInternal {
DescriptorProto _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY DescriptorProtoDefaultTypeInternal _DescriptorProto_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DescriptorProtoDefaultTypeInternal _DescriptorProto_default_instance_;
constexpr ExtensionRangeOptions::ExtensionRangeOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_(){}
@ -111,7 +111,7 @@ struct ExtensionRangeOptionsDefaultTypeInternal {
ExtensionRangeOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY ExtensionRangeOptionsDefaultTypeInternal _ExtensionRangeOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ExtensionRangeOptionsDefaultTypeInternal _ExtensionRangeOptions_default_instance_;
constexpr FieldDescriptorProto::FieldDescriptorProto(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
@ -135,7 +135,7 @@ struct FieldDescriptorProtoDefaultTypeInternal {
FieldDescriptorProto _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY FieldDescriptorProtoDefaultTypeInternal _FieldDescriptorProto_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FieldDescriptorProtoDefaultTypeInternal _FieldDescriptorProto_default_instance_;
constexpr OneofDescriptorProto::OneofDescriptorProto(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
@ -148,7 +148,7 @@ struct OneofDescriptorProtoDefaultTypeInternal {
OneofDescriptorProto _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY OneofDescriptorProtoDefaultTypeInternal _OneofDescriptorProto_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT OneofDescriptorProtoDefaultTypeInternal _OneofDescriptorProto_default_instance_;
constexpr EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: start_(0)
@ -161,7 +161,7 @@ struct EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal {
EnumDescriptorProto_EnumReservedRange _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal _EnumDescriptorProto_EnumReservedRange_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal _EnumDescriptorProto_EnumReservedRange_default_instance_;
constexpr EnumDescriptorProto::EnumDescriptorProto(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: value_()
@ -177,7 +177,7 @@ struct EnumDescriptorProtoDefaultTypeInternal {
EnumDescriptorProto _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY EnumDescriptorProtoDefaultTypeInternal _EnumDescriptorProto_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EnumDescriptorProtoDefaultTypeInternal _EnumDescriptorProto_default_instance_;
constexpr EnumValueDescriptorProto::EnumValueDescriptorProto(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
@ -191,7 +191,7 @@ struct EnumValueDescriptorProtoDefaultTypeInternal {
EnumValueDescriptorProto _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY EnumValueDescriptorProtoDefaultTypeInternal _EnumValueDescriptorProto_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EnumValueDescriptorProtoDefaultTypeInternal _EnumValueDescriptorProto_default_instance_;
constexpr ServiceDescriptorProto::ServiceDescriptorProto(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: method_()
@ -205,7 +205,7 @@ struct ServiceDescriptorProtoDefaultTypeInternal {
ServiceDescriptorProto _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY ServiceDescriptorProtoDefaultTypeInternal _ServiceDescriptorProto_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ServiceDescriptorProtoDefaultTypeInternal _ServiceDescriptorProto_default_instance_;
constexpr MethodDescriptorProto::MethodDescriptorProto(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
@ -222,7 +222,7 @@ struct MethodDescriptorProtoDefaultTypeInternal {
MethodDescriptorProto _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY MethodDescriptorProtoDefaultTypeInternal _MethodDescriptorProto_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MethodDescriptorProtoDefaultTypeInternal _MethodDescriptorProto_default_instance_;
constexpr FileOptions::FileOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_()
@ -255,7 +255,7 @@ struct FileOptionsDefaultTypeInternal {
FileOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY FileOptionsDefaultTypeInternal _FileOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FileOptionsDefaultTypeInternal _FileOptions_default_instance_;
constexpr MessageOptions::MessageOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_()
@ -271,7 +271,7 @@ struct MessageOptionsDefaultTypeInternal {
MessageOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY MessageOptionsDefaultTypeInternal _MessageOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MessageOptionsDefaultTypeInternal _MessageOptions_default_instance_;
constexpr FieldOptions::FieldOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_()
@ -291,7 +291,7 @@ struct FieldOptionsDefaultTypeInternal {
FieldOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY FieldOptionsDefaultTypeInternal _FieldOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FieldOptionsDefaultTypeInternal _FieldOptions_default_instance_;
constexpr OneofOptions::OneofOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_(){}
@ -303,7 +303,7 @@ struct OneofOptionsDefaultTypeInternal {
OneofOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY OneofOptionsDefaultTypeInternal _OneofOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT OneofOptionsDefaultTypeInternal _OneofOptions_default_instance_;
constexpr EnumOptions::EnumOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_()
@ -317,7 +317,7 @@ struct EnumOptionsDefaultTypeInternal {
EnumOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY EnumOptionsDefaultTypeInternal _EnumOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EnumOptionsDefaultTypeInternal _EnumOptions_default_instance_;
constexpr EnumValueOptions::EnumValueOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_()
@ -330,7 +330,7 @@ struct EnumValueOptionsDefaultTypeInternal {
EnumValueOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY EnumValueOptionsDefaultTypeInternal _EnumValueOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EnumValueOptionsDefaultTypeInternal _EnumValueOptions_default_instance_;
constexpr ServiceOptions::ServiceOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_()
@ -343,7 +343,7 @@ struct ServiceOptionsDefaultTypeInternal {
ServiceOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY ServiceOptionsDefaultTypeInternal _ServiceOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ServiceOptionsDefaultTypeInternal _ServiceOptions_default_instance_;
constexpr MethodOptions::MethodOptions(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: uninterpreted_option_()
@ -358,7 +358,7 @@ struct MethodOptionsDefaultTypeInternal {
MethodOptions _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY MethodOptionsDefaultTypeInternal _MethodOptions_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MethodOptionsDefaultTypeInternal _MethodOptions_default_instance_;
constexpr UninterpretedOption_NamePart::UninterpretedOption_NamePart(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: name_part_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
@ -371,7 +371,7 @@ struct UninterpretedOption_NamePartDefaultTypeInternal {
UninterpretedOption_NamePart _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_;
constexpr UninterpretedOption::UninterpretedOption(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: name_()
@ -389,7 +389,7 @@ struct UninterpretedOptionDefaultTypeInternal {
UninterpretedOption _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY UninterpretedOptionDefaultTypeInternal _UninterpretedOption_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT UninterpretedOptionDefaultTypeInternal _UninterpretedOption_default_instance_;
constexpr SourceCodeInfo_Location::SourceCodeInfo_Location(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: path_()
@ -407,7 +407,7 @@ struct SourceCodeInfo_LocationDefaultTypeInternal {
SourceCodeInfo_Location _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY SourceCodeInfo_LocationDefaultTypeInternal _SourceCodeInfo_Location_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SourceCodeInfo_LocationDefaultTypeInternal _SourceCodeInfo_Location_default_instance_;
constexpr SourceCodeInfo::SourceCodeInfo(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: location_(){}
@ -419,7 +419,7 @@ struct SourceCodeInfoDefaultTypeInternal {
SourceCodeInfo _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY SourceCodeInfoDefaultTypeInternal _SourceCodeInfo_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SourceCodeInfoDefaultTypeInternal _SourceCodeInfo_default_instance_;
constexpr GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: path_()
@ -435,7 +435,7 @@ struct GeneratedCodeInfo_AnnotationDefaultTypeInternal {
GeneratedCodeInfo_Annotation _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY GeneratedCodeInfo_AnnotationDefaultTypeInternal _GeneratedCodeInfo_Annotation_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GeneratedCodeInfo_AnnotationDefaultTypeInternal _GeneratedCodeInfo_Annotation_default_instance_;
constexpr GeneratedCodeInfo::GeneratedCodeInfo(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: annotation_(){}
@ -447,7 +447,7 @@ struct GeneratedCodeInfoDefaultTypeInternal {
GeneratedCodeInfo _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY GeneratedCodeInfoDefaultTypeInternal _GeneratedCodeInfo_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GeneratedCodeInfoDefaultTypeInternal _GeneratedCodeInfo_default_instance_;
PROTOBUF_NAMESPACE_CLOSE
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[27];
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[6];
@ -1055,10 +1055,8 @@ const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google
schemas, file_default_instances, TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto, file_level_service_descriptors_google_2fprotobuf_2fdescriptor_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_metadata_getter(int index) {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto);
return descriptor_table_google_2fprotobuf_2fdescriptor_2eproto.file_level_metadata[index];
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter() {
return &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
@ -1424,10 +1422,11 @@ void FileDescriptorSet::InternalSwap(FileDescriptorSet* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata FileDescriptorSet::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[0]);
}
// ===================================================================
class FileDescriptorProto::_Internal {
@ -2077,10 +2076,11 @@ void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata FileDescriptorProto::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[1]);
}
// ===================================================================
class DescriptorProto_ExtensionRange::_Internal {
@ -2372,10 +2372,11 @@ void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange
}
::PROTOBUF_NAMESPACE_ID::Metadata DescriptorProto_ExtensionRange::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[2]);
}
// ===================================================================
class DescriptorProto_ReservedRange::_Internal {
@ -2621,10 +2622,11 @@ void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange*
}
::PROTOBUF_NAMESPACE_ID::Metadata DescriptorProto_ReservedRange::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[3]);
}
// ===================================================================
class DescriptorProto::_Internal {
@ -3161,10 +3163,11 @@ void DescriptorProto::InternalSwap(DescriptorProto* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata DescriptorProto::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[4]);
}
// ===================================================================
class ExtensionRangeOptions::_Internal {
@ -3377,10 +3380,11 @@ void ExtensionRangeOptions::InternalSwap(ExtensionRangeOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata ExtensionRangeOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[5]);
}
// ===================================================================
class FieldDescriptorProto::_Internal {
@ -4000,10 +4004,11 @@ void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata FieldDescriptorProto::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[6]);
}
// ===================================================================
class OneofDescriptorProto::_Internal {
@ -4271,10 +4276,11 @@ void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata OneofDescriptorProto::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[7]);
}
// ===================================================================
class EnumDescriptorProto_EnumReservedRange::_Internal {
@ -4520,10 +4526,11 @@ void EnumDescriptorProto_EnumReservedRange::InternalSwap(EnumDescriptorProto_Enu
}
::PROTOBUF_NAMESPACE_ID::Metadata EnumDescriptorProto_EnumReservedRange::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[8]);
}
// ===================================================================
class EnumDescriptorProto::_Internal {
@ -4895,10 +4902,11 @@ void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata EnumDescriptorProto::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[9]);
}
// ===================================================================
class EnumValueDescriptorProto::_Internal {
@ -5204,10 +5212,11 @@ void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata EnumValueDescriptorProto::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[10]);
}
// ===================================================================
class ServiceDescriptorProto::_Internal {
@ -5508,10 +5517,11 @@ void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata ServiceDescriptorProto::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[11]);
}
// ===================================================================
class MethodDescriptorProto::_Internal {
@ -5934,10 +5944,11 @@ void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata MethodDescriptorProto::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[12]);
}
// ===================================================================
class FileOptions::_Internal {
@ -6913,10 +6924,11 @@ void FileOptions::InternalSwap(FileOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata FileOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[13]);
}
// ===================================================================
class MessageOptions::_Internal {
@ -7259,10 +7271,11 @@ void MessageOptions::InternalSwap(MessageOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata MessageOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[14]);
}
// ===================================================================
class FieldOptions::_Internal {
@ -7670,10 +7683,11 @@ void FieldOptions::InternalSwap(FieldOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata FieldOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[15]);
}
// ===================================================================
class OneofOptions::_Internal {
@ -7886,10 +7900,11 @@ void OneofOptions::InternalSwap(OneofOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata OneofOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[16]);
}
// ===================================================================
class EnumOptions::_Internal {
@ -8182,10 +8197,11 @@ void EnumOptions::InternalSwap(EnumOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata EnumOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[17]);
}
// ===================================================================
class EnumValueOptions::_Internal {
@ -8435,10 +8451,11 @@ void EnumValueOptions::InternalSwap(EnumValueOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata EnumValueOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[18]);
}
// ===================================================================
class ServiceOptions::_Internal {
@ -8688,10 +8705,11 @@ void ServiceOptions::InternalSwap(ServiceOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata ServiceOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[19]);
}
// ===================================================================
class MethodOptions::_Internal {
@ -8993,10 +9011,11 @@ void MethodOptions::InternalSwap(MethodOptions* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata MethodOptions::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[20]);
}
// ===================================================================
class UninterpretedOption_NamePart::_Internal {
@ -9263,10 +9282,11 @@ void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* ot
}
::PROTOBUF_NAMESPACE_ID::Metadata UninterpretedOption_NamePart::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[21]);
}
// ===================================================================
class UninterpretedOption::_Internal {
@ -9700,10 +9720,11 @@ void UninterpretedOption::InternalSwap(UninterpretedOption* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata UninterpretedOption::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[22]);
}
// ===================================================================
class SourceCodeInfo_Location::_Internal {
@ -10085,10 +10106,11 @@ void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata SourceCodeInfo_Location::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[23]);
}
// ===================================================================
class SourceCodeInfo::_Internal {
@ -10279,10 +10301,11 @@ void SourceCodeInfo::InternalSwap(SourceCodeInfo* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata SourceCodeInfo::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[24]);
}
// ===================================================================
class GeneratedCodeInfo_Annotation::_Internal {
@ -10612,10 +10635,11 @@ void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* ot
}
::PROTOBUF_NAMESPACE_ID::Metadata GeneratedCodeInfo_Annotation::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[25]);
}
// ===================================================================
class GeneratedCodeInfo::_Internal {
@ -10806,10 +10830,11 @@ void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata GeneratedCodeInfo::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_getter, &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[26]);
}
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ struct DurationDefaultTypeInternal {
Duration _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY DurationDefaultTypeInternal _Duration_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DurationDefaultTypeInternal _Duration_default_instance_;
PROTOBUF_NAMESPACE_CLOSE
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fduration_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
@ -67,10 +67,8 @@ const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google
schemas, file_default_instances, TableStruct_google_2fprotobuf_2fduration_2eproto::offsets,
file_level_metadata_google_2fprotobuf_2fduration_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto, file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
descriptor_table_google_2fprotobuf_2fduration_2eproto_metadata_getter(int index) {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fduration_2eproto);
return descriptor_table_google_2fprotobuf_2fduration_2eproto.file_level_metadata[index];
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fduration_2eproto_getter() {
return &descriptor_table_google_2fprotobuf_2fduration_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
@ -297,10 +295,11 @@ void Duration::InternalSwap(Duration* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata Duration::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fduration_2eproto_getter, &descriptor_table_google_2fprotobuf_2fduration_2eproto_once,
file_level_metadata_google_2fprotobuf_2fduration_2eproto[0]);
}
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN

View File

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3014000
#if PROTOBUF_VERSION < 3015000
#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 3014000 < PROTOBUF_MIN_PROTOC_VERSION
#if 3015002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -53,7 +53,6 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fduration_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto;
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_google_2fprotobuf_2fduration_2eproto_metadata_getter(int index);
PROTOBUF_NAMESPACE_OPEN
class Duration;
struct DurationDefaultTypeInternal;
@ -96,10 +95,10 @@ class PROTOBUF_EXPORT Duration PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const Duration& default_instance() {
return *internal_default_instance();
@ -167,12 +166,6 @@ class PROTOBUF_EXPORT Duration PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fduration_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------

View File

@ -27,7 +27,7 @@ struct EmptyDefaultTypeInternal {
Empty _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY EmptyDefaultTypeInternal _Empty_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EmptyDefaultTypeInternal _Empty_default_instance_;
PROTOBUF_NAMESPACE_CLOSE
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fempty_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr;
@ -62,10 +62,8 @@ const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google
schemas, file_default_instances, TableStruct_google_2fprotobuf_2fempty_2eproto::offsets,
file_level_metadata_google_2fprotobuf_2fempty_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto, file_level_service_descriptors_google_2fprotobuf_2fempty_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
descriptor_table_google_2fprotobuf_2fempty_2eproto_metadata_getter(int index) {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fempty_2eproto);
return descriptor_table_google_2fprotobuf_2fempty_2eproto.file_level_metadata[index];
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fempty_2eproto_getter() {
return &descriptor_table_google_2fprotobuf_2fempty_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
@ -225,10 +223,11 @@ void Empty::InternalSwap(Empty* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata Empty::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2fempty_2eproto_getter, &descriptor_table_google_2fprotobuf_2fempty_2eproto_once,
file_level_metadata_google_2fprotobuf_2fempty_2eproto[0]);
}
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN

View File

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3014000
#if PROTOBUF_VERSION < 3015000
#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 3014000 < PROTOBUF_MIN_PROTOC_VERSION
#if 3015002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -53,7 +53,6 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fempty_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fempty_2eproto;
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_google_2fprotobuf_2fempty_2eproto_metadata_getter(int index);
PROTOBUF_NAMESPACE_OPEN
class Empty;
struct EmptyDefaultTypeInternal;
@ -96,10 +95,10 @@ class PROTOBUF_EXPORT Empty PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const Empty& default_instance() {
return *internal_default_instance();
@ -167,12 +166,6 @@ class PROTOBUF_EXPORT Empty PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2fempty_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------

View File

@ -28,7 +28,7 @@ struct FieldMaskDefaultTypeInternal {
FieldMask _instance;
};
};
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY FieldMaskDefaultTypeInternal _FieldMask_default_instance_;
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FieldMaskDefaultTypeInternal _FieldMask_default_instance_;
PROTOBUF_NAMESPACE_CLOSE
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2ffield_5fmask_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr;
@ -65,10 +65,8 @@ const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google
schemas, file_default_instances, TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets,
file_level_metadata_google_2fprotobuf_2ffield_5fmask_2eproto, file_level_enum_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto, file_level_service_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto_metadata_getter(int index) {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto);
return descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto.file_level_metadata[index];
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto_getter() {
return &descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
@ -270,10 +268,11 @@ void FieldMask::InternalSwap(FieldMask* other) {
}
::PROTOBUF_NAMESPACE_ID::Metadata FieldMask::GetMetadata() const {
return GetMetadataStatic();
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto_getter, &descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto_once,
file_level_metadata_google_2fprotobuf_2ffield_5fmask_2eproto[0]);
}
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN

View File

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3014000
#if PROTOBUF_VERSION < 3015000
#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 3014000 < PROTOBUF_MIN_PROTOC_VERSION
#if 3015002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -53,7 +53,6 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto;
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto_metadata_getter(int index);
PROTOBUF_NAMESPACE_OPEN
class FieldMask;
struct FieldMaskDefaultTypeInternal;
@ -96,10 +95,10 @@ class PROTOBUF_EXPORT FieldMask PROTOBUF_FINAL :
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
return default_instance().GetMetadata().reflection;
}
static const FieldMask& default_instance() {
return *internal_default_instance();
@ -167,12 +166,6 @@ class PROTOBUF_EXPORT FieldMask PROTOBUF_FINAL :
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
return ::descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto_metadata_getter(kIndexInFileMessages);
}
public:
// nested types ----------------------------------------------------

View File

@ -2520,6 +2520,17 @@ void RegisterAllTypesInternal(const Metadata* file_level_metadata, int size) {
namespace internal {
Metadata AssignDescriptors(const DescriptorTable* (*table)(),
internal::once_flag* once,
const Metadata& metadata) {
call_once(*once, [=] {
auto* t = table();
AssignDescriptorsImpl(t, t->is_eager);
});
return metadata;
}
void AssignDescriptors(const DescriptorTable* table, bool eager) {
if (!eager) eager = table->is_eager;
call_once(*table->once, AssignDescriptorsImpl, table, eager);

View File

@ -290,6 +290,14 @@ enum {
void PROTOBUF_EXPORT AssignDescriptors(const DescriptorTable* table,
bool eager = false);
// Overload used to implement GetMetadataStatic in the generated code.
// See comments in compiler/cpp/internal/file.cc as to why.
// It takes a `Metadata` and returns it to allow for tail calls and reduce
// binary size.
Metadata PROTOBUF_EXPORT AssignDescriptors(const DescriptorTable* (*table)(),
internal::once_flag* once,
const Metadata& metadata);
// These cannot be in lite so we put them in the reflection.
PROTOBUF_EXPORT void UnknownFieldSetSerializer(const uint8* base, uint32 offset,
uint32 tag, uint32 has_offset,

View File

@ -87,8 +87,7 @@ inline ExtensionSet* GetExtensionSet(MessageLite* msg, int64 extension_offset) {
template <typename Type>
inline Type* AddField(MessageLite* msg, int64 offset) {
static_assert(std::is_trivially_copy_assignable<Type>::value,
"Do not assign");
static_assert(std::is_trivial<Type>::value, "Do not assign");
RepeatedField<Type>* repeated = Raw<RepeatedField<Type>>(msg, offset);
return repeated->Add();
@ -104,8 +103,7 @@ inline std::string* AddField<std::string>(MessageLite* msg, int64 offset) {
template <typename Type>
inline void AddField(MessageLite* msg, int64 offset, Type value) {
static_assert(std::is_trivially_copy_assignable<Type>::value,
"Do not assign");
static_assert(std::is_trivial<Type>::value, "Do not assign");
*AddField<Type>(msg, offset) = value;
}
@ -126,8 +124,7 @@ 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_trivially_copy_assignable<Type>::value,
"Do not assign");
static_assert(std::is_trivial<Type>::value, "Do not assign");
*MutableField<Type>(msg, has_bits, has_bit_index, offset) = value;
}

View File

@ -120,12 +120,12 @@
#include <type_traits>
#include <utility>
#ifdef _MSC_VER
#ifdef _WIN32
// Assuming windows is always little-endian.
#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
#define PROTOBUF_LITTLE_ENDIAN 1
#endif
#if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER)
#if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER)
// If MSVC has "/RTCc" set, it will complain about truncating casts at
// runtime. This file contains some intentional truncating casts.
#pragma runtime_checks("c", off)
@ -851,11 +851,11 @@ class PROTOBUF_EXPORT EpsCopyOutputStream {
}
static constexpr int TagSize(uint32 tag) {
return (tag < (1 << 7))
? 1
: (tag < (1 << 14))
? 2
: (tag < (1 << 21)) ? 3 : (tag < (1 << 28)) ? 4 : 5;
return (tag < (1 << 7)) ? 1
: (tag < (1 << 14)) ? 2
: (tag < (1 << 21)) ? 3
: (tag < (1 << 28)) ? 4
: 5;
}
PROTOBUF_ALWAYS_INLINE uint8* WriteTag(uint32 num, uint32 wt, uint8* ptr) {
@ -1181,12 +1181,11 @@ class PROTOBUF_EXPORT CodedOutputStream {
// Compile-time equivalent of VarintSize32().
template <uint32 Value>
struct StaticVarintSize32 {
static const size_t value =
(Value < (1 << 7))
? 1
: (Value < (1 << 14))
? 2
: (Value < (1 << 21)) ? 3 : (Value < (1 << 28)) ? 4 : 5;
static const size_t value = (Value < (1 << 7)) ? 1
: (Value < (1 << 14)) ? 2
: (Value < (1 << 21)) ? 3
: (Value < (1 << 28)) ? 4
: 5;
};
// Returns the total number of bytes written since this object was created.

View File

@ -67,7 +67,7 @@ class InternalMetadata {
template <typename T>
void Delete() {
// Note that Delete<> should be called not more than once.
if (have_unknown_fields() && arena() == NULL) {
if (have_unknown_fields()) {
DeleteOutOfLineHelper<T>();
}
}
@ -204,7 +204,9 @@ class InternalMetadata {
template <typename T>
PROTOBUF_NOINLINE void DeleteOutOfLineHelper() {
delete PtrValue<Container<T>>();
if (arena() == NULL) {
delete PtrValue<Container<T>>();
}
}
template <typename T>

View File

@ -198,22 +198,24 @@
// You can #define these annotations yourself if the default implementation
// is not right for you.
#ifndef PROTOBUF_NO_INLINE
#ifdef GOOGLE_ATTRIBUTE_ALWAYS_INLINE
#define PROTOBUF_ALWAYS_INLINE GOOGLE_ATTRIBUTE_ALWAYS_INLINE
#define PROTOBUF_NDEBUG_INLINE GOOGLE_ATTRIBUTE_ALWAYS_INLINE
#else
#if defined(__GNUC__) && \
#elif defined(__GNUC__) && \
(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
// For functions we want to force inline.
// Introduced in gcc 3.1.
#define PROTOBUF_ALWAYS_INLINE __attribute__((always_inline))
#define PROTOBUF_NDEBUG_INLINE __attribute__((always_inline))
#else
#endif
#endif
#ifndef PROTOBUF_ALWAYS_INLINE
// Other compilers will have to figure it out for themselves.
#define PROTOBUF_ALWAYS_INLINE
#define PROTOBUF_NDEBUG_INLINE
#endif
#endif
#ifdef GOOGLE_ATTRIBUTE_NOINLINE
#define PROTOBUF_NOINLINE GOOGLE_ATTRIBUTE_NOINLINE
@ -335,14 +337,14 @@
// Shared google3/opensource definitions. //////////////////////////////////////
#define PROTOBUF_VERSION 3014000
#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3014000
#define PROTOBUF_MIN_PROTOC_VERSION 3014000
#define PROTOBUF_VERSION 3015002
#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3015000
#define PROTOBUF_MIN_PROTOC_VERSION 3015000
#define PROTOBUF_VERSION_SUFFIX ""
// The minimum library version which works with the current version of the
// headers.
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3014000
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3015000
#if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI
#define PROTOBUF_RTTI 0
@ -562,18 +564,9 @@
// by this flag is supposed to be removed after this experiment.
// #define PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT
#if defined(__cpp_constinit)
#define PROTOBUF_CONSTINIT constinit
#elif defined(__has_cpp_attribute)
#if __has_cpp_attribute(clang::require_constant_initialization)
#define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]]
#endif
#endif
#ifndef PROTOBUF_CONSTINIT
#define PROTOBUF_CONSTINIT
#endif
#if defined(__cpp_constinit)
// Our use of constinit does not yet work with GCC:
// https://github.com/protocolbuffers/protobuf/issues/8310
#if defined(__cpp_constinit) && !defined(__GNUC__)
#define PROTOBUF_CONSTINIT constinit
#elif defined(__has_cpp_attribute)
#if __has_cpp_attribute(clang::require_constant_initialization)
@ -615,7 +608,7 @@
#define PROTOBUF_PRAGMA_INIT_SEG
#endif
#if defined(__has_attribute)
#if defined(__has_attribute) && !defined(__MINGW32__)
#if __has_attribute(weak)
#define PROTOBUF_ATTRIBUTE_WEAK __attribute__((weak))
#endif

Some files were not shown because too many files have changed in this diff Show More